diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 0a7163067..fda7109b4 100644 Binary files a/Build/Notepad3.ini and b/Build/Notepad3.ini differ diff --git a/crypto/crypto.c b/crypto/crypto.c index 94bf5ba93..08009b7e1 100644 --- a/crypto/crypto.c +++ b/crypto/crypto.c @@ -1,510 +1,561 @@ - -/** -* -* Distributed under the terms of the GNU General Public License, -* see License.txt for details. -* -* Author: Dave Dyer ddyer@real-me.net Oct/2005 -* -adds the option to encrypt and decrypt files, using stong AES encryption, -optionally with master key - -see ecryption-doc.txt for details - -*/ -#if !defined(WINVER) -#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(NTDDI_VERSION) -#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ -#endif -#define VC_EXTRALEAN 1 -#include -#include -#include -#include "..\src\Dialogs.h" -#include "..\src\Helpers.h" -#include "..\src\resource.h" -#include "rijndael-api-fst.h" -#include "crypto.h" - -extern HINSTANCE g_hInstance; - -#define WKEY_LEN 256 -#define KEY_LEN 512 -#define PAD_SLOP 16 - -bool useFileKey = false; // file should be encrypted -char fileKey[KEY_LEN] = { 0 }; // ascii passphrase for the file key -WCHAR unicodeFileKey[WKEY_LEN] = { 0 }; // unicode file passphrase -bool useMasterKey = false; // file should have a master key -char masterKey[KEY_LEN] = { 0 }; // ascii passphrase for the master key -WCHAR unicodeMasterKey[WKEY_LEN] = { 0 }; // unicode master passphrase -BYTE binFileKey[KEY_BYTES]; // the encryption key in for the file -bool hasBinFileKey = false; -BYTE masterFileKey[KEY_BYTES]; // file key encrypted with the master key -BYTE masterFileIV[AES_MAX_IV_SIZE]; // the iv for the master key -bool hasMasterFileKey = false; -bool masterKeyAvailable = false; // information for the passphrase dialog box - -void ResetEncryption() -{ - masterKeyAvailable = false; - hasMasterFileKey = false; - hasBinFileKey = false; - useMasterKey = false; - useFileKey = false; - memset(fileKey, 0, sizeof(fileKey)); - memset(masterKey, 0, sizeof(masterKey)); - memset(binFileKey, 0, sizeof(binFileKey)); - memset(unicodeFileKey, 0, sizeof(unicodeFileKey)); - memset(unicodeMasterKey, 0, sizeof(unicodeMasterKey)); - memset(masterFileKey, 0, sizeof(masterFileKey)); - memset(masterFileIV, 0, sizeof(masterFileIV)); -} -//============================================================================= - -// -// copy a unicode string to a regular string, but keep the same -// result string for simple, non-unicode characters. -// this is used to convert a unicode password to a byte stream compatible with an ascii password -// -void unicodeStringCpy(char *dest, WCHAR *src, int destSize) -{ - int sidx = 0; - int didx = 0; - int destLim = destSize - 1; - while ((src[sidx] != 0) && (didx < destLim)) { - WCHAR c = src[sidx++]; - char clow = (char)(c & 0xff); - if (clow != 0) { dest[didx++] = clow; } // ignore zeros in the low order part - if (((c & 0xff00) != 0) && (didx < destLim)) // ignore zeros in the high order part - { - dest[didx++] = (char)((c >> 8) & 0xff); - } - } - dest[didx++] = (char)0; -} -//============================================================================= - -// helper function for set focus to editbox -void SetDialogFocus(HWND hDlg, HWND hwndControl) -{ - PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, true); -} - - -//============================================================================= -// helper function for the "set passphrase" dialog before output -// the complication in this version is that the incoming text is unicode. We deal -// with it by converting the unicode to an ascii compatible byte stream, so the -// caller (and hence the rest of the encryption) doesn't know unicode was involved. -INT_PTR CALLBACK SetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lParam) -{ - UNUSED(lParam); - - switch (umsg) { - - case WM_INITDIALOG: - { - SetDlgItemText(hDlg, IDC_EDIT1, unicodeFileKey); - SetDlgItemText(hDlg, IDC_EDIT2, unicodeMasterKey); - ShowWindow(GetDlgItem(hDlg, IDC_CHECK3), hasMasterFileKey); - CheckDlgButton(hDlg, IDC_CHECK3, hasMasterFileKey ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_CHECK2, (hasBinFileKey | useFileKey) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_CHECK1, useMasterKey ? BST_CHECKED : BST_UNCHECKED); - CenterDlgInParent(hDlg); - // Don't use: SetFocus( GetDlgItem( hDlg, IDC_EDIT1 ) ); - SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_EDIT1)); - } - - return true; - break; - - case WM_COMMAND: - - switch (LOWORD(wParam)) { - - case IDOK: - { - bool useMas = IsDlgButtonChecked(hDlg, IDC_CHECK1) == BST_CHECKED; - bool useFil = IsDlgButtonChecked(hDlg, IDC_CHECK2) == BST_CHECKED; - bool reuseMas = IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED; - WCHAR newFileKey[WKEY_LEN] = { 0 }; - WCHAR newMasKey[WKEY_LEN] = { 0 }; - hasMasterFileKey &= reuseMas; - GetDlgItemText(hDlg, IDC_EDIT1, newFileKey, COUNTOF(newFileKey)); - GetDlgItemText(hDlg, IDC_EDIT2, newMasKey, COUNTOF(newMasKey)); - useFileKey = !((newFileKey[0] <= ' ') || !useFil); - useMasterKey = !((newMasKey[0] <= ' ') || !useMas); - //@@@lstrcpyn(fileKey, newFileKey, WKEY_LEN); - //@@@lstrcpyn(masterKey, newMasKey, WKEY_LEN); - memcpy(unicodeFileKey, newFileKey, sizeof(unicodeFileKey)); - memcpy(unicodeMasterKey, newMasKey, sizeof(unicodeMasterKey)); - unicodeStringCpy(fileKey, unicodeFileKey, sizeof(fileKey)); - unicodeStringCpy(masterKey, unicodeMasterKey, sizeof(masterKey)); - EndDialog(hDlg, IDOK); - return(true); - } - - break; - - case IDC_EDIT1: - { - WCHAR newFileKey[WKEY_LEN] = { 0 }; - GetDlgItemText(hDlg, IDC_EDIT1, newFileKey, COUNTOF(newFileKey)); - CheckDlgButton(hDlg, IDC_CHECK2, (newFileKey[0] <= ' ') ? BST_UNCHECKED : BST_CHECKED); - } - - break; - - case IDC_EDIT2: - { - WCHAR newMasKey[WKEY_LEN] = { 0 }; - GetDlgItemText(hDlg, IDC_EDIT2, newMasKey, COUNTOF(newMasKey)); - { - bool newuse = (newMasKey[0] > ' '); // no leading whitespace or empty passwords - CheckDlgButton(hDlg, IDC_CHECK1, newuse ? BST_CHECKED : BST_UNCHECKED); - - if (newuse) { CheckDlgButton(hDlg, IDC_CHECK3, BST_UNCHECKED); } - } - } - - break; - - case IDC_CHECK3: // check reuse, uncheck set new and inverse - { - bool reuseMas = IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED; - - if (reuseMas) { CheckDlgButton(hDlg, IDC_CHECK1, reuseMas ? BST_UNCHECKED : BST_CHECKED); } - } - - break; - - case IDC_CHECK1: - { - bool useMas = IsDlgButtonChecked(hDlg, IDC_CHECK1) == BST_CHECKED; - - if (useMas) { CheckDlgButton(hDlg, IDC_CHECK3, useMas ? BST_UNCHECKED : BST_CHECKED); } - } - - break; - - case IDCANCEL: - EndDialog(hDlg, IDCANCEL); - break; - - } - - break; - - } - - return false; - -} -// -// helper for setting password when reading a file -// the complication in this version is that the incoming text is unicode. We deal -// with it by converting the unicode to an ascii compatible byte stream, so the -// caller (and hence the rest of the encryption) doesn't know unicode was involved. -// -INT_PTR CALLBACK GetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lParam) -{ - UNUSED(lParam); - - switch (umsg) { - - case WM_INITDIALOG: - { - int vis = masterKeyAvailable ? SW_SHOW : SW_HIDE; - ShowWindow(GetDlgItem(hDlg, IDC_STATICPW), vis); - ShowWindow(GetDlgItem(hDlg, IDC_CHECK3), vis); - //@@@SetDlgItemText( hDlg, IDC_EDIT3, fileKey ); - SetDlgItemText(hDlg, IDC_EDIT3, unicodeFileKey); - CheckDlgButton(hDlg, IDC_CHECK3, BST_UNCHECKED); - CenterDlgInParent(hDlg); - // Don't use: SetFocus( GetDlgItem( hDlg, IDC_EDIT3 ) ); - SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_EDIT3)); - } - return true; - break; - - case WM_COMMAND: - - switch (LOWORD(wParam)) { - case IDOK: - { - bool useMas = (IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED); - WCHAR newKey[WKEY_LEN] = L"\0"; - GetDlgItemText(hDlg, IDC_EDIT3, newKey, COUNTOF(newKey)); - - if (useMas) { - memcpy(unicodeMasterKey, newKey, sizeof(unicodeMasterKey)); - unicodeStringCpy(masterKey, unicodeMasterKey, sizeof(masterKey)); - useFileKey = false; - useMasterKey = true; - } - else { - memcpy(unicodeFileKey, newKey, sizeof(unicodeFileKey)); - unicodeStringCpy(fileKey, unicodeFileKey, sizeof(fileKey)); - useFileKey = true; - useMasterKey = false; - } - EndDialog(hDlg, IDOK); - } - return(true); - break; - - case IDCANCEL: - EndDialog(hDlg, IDCANCEL); - break; - } - break; - } - return false; -} - - -// set passphrases for output -bool GetFileKey(HWND hwnd) -{ - return (IDOK == DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_PASSWORDS), - GetParent(hwnd), SetKeysDlgProc, (LPARAM)hwnd)); -} - -// set passphrases for file being input -bool ReadFileKey(HWND hwnd, bool master) -{ - masterKeyAvailable = master; - return (IDOK == DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_READPW), - GetParent(hwnd), GetKeysDlgProc, (LPARAM)hwnd)); -} - - - -// read the file data, decrypt if necessary, return the result as a new allocation -bool ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWORD *resultlen) -{ - bool usedEncryption = false; - HANDLE rawhandle = *result; - BYTE* rawdata = (BYTE*)GlobalLock(rawhandle); - unsigned long readsize = 0; - bool bReadSuccess = ReadFile(hFile, rawdata, size, &readsize, NULL); - - // we read the file, check if it looks like our encryption format - - if (bReadSuccess && (readsize > (PREAMBLE_SIZE + AES_MAX_IV_SIZE))) { - long *ldata = (long*)rawdata; - - if (ldata && (ldata[0] == PREAMBLE)) { - long scheme = ldata[1]; - unsigned long code_offset = PREAMBLE_SIZE + AES_MAX_IV_SIZE; - - switch (scheme) { - case MASTERKEY_FORMAT: - code_offset += sizeof(masterFileKey) + sizeof(masterFileIV); - // save the encrypted file key and IV. They can be reused if the - // passphrases are not changed. - memcpy(masterFileIV, &rawdata[MASTER_KEY_OFFSET], sizeof(masterFileIV)); - memcpy(masterFileKey, &rawdata[MASTER_KEY_OFFSET + sizeof(masterFileIV)], sizeof(masterFileKey)); - hasMasterFileKey = true; - - // fall through - case FILEKEY_FORMAT: - { - bool haveFileKey = ReadFileKey(hwnd, scheme == MASTERKEY_FORMAT); - - if (useFileKey) { - // use the file key to decode - /*@@@ - char ansiKey[KEY_LEN+1]; - int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, fileKey, -1, ansiKey, KEY_LEN, NULL, NULL ); - ansiKey[len] = '\0'; - AES_keygen( ansiKey, binFileKey ); // generate the encryption key from the passphrase - */ - AES_keygen(fileKey, binFileKey); // generate the encryption key from the passphrase - hasBinFileKey = true; - } - else if ((scheme == MASTERKEY_FORMAT) && useMasterKey) { // use the master key to recover the file key - BYTE binMasterKey[KEY_BYTES]; - AES_keyInstance masterdecode; - AES_cipherInstance mastercypher; - /*@@@ - char ansiKey[KEY_LEN+1]; - int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, masterKey, -1, ansiKey, KEY_LEN, NULL, NULL ); - AES_keygen( ansiKey, binMasterKey ); - */ - AES_keygen(masterKey, binMasterKey); - AES_bin_setup(&masterdecode, AES_DIR_DECRYPT, KEY_BYTES * 8, binMasterKey); - AES_bin_cipherInit(&mastercypher, AES_MODE_CBC, masterFileIV); - AES_blockDecrypt(&mastercypher, &masterdecode, masterFileKey, sizeof(binFileKey), binFileKey); - hasBinFileKey = true; - haveFileKey = true; - useMasterKey = false; - } - - if (haveFileKey) { - AES_keyInstance fileDecode; - AES_cipherInstance fileCypher; - AES_bin_setup(&fileDecode, AES_DIR_DECRYPT, KEY_BYTES * 8, binFileKey); - AES_bin_cipherInit(&fileCypher, AES_MODE_CBC, &rawdata[PREAMBLE_SIZE]); // IV is next - { // finally, decrypt the actual data - int nbb = BAD_CIPHER_STATE; - int nbp = BAD_CIPHER_STATE; - if ((readsize - code_offset) >= PAD_SLOP) { - nbb = AES_blockDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset], readsize - code_offset - PAD_SLOP, rawdata); - } - if (nbb >= 0) { - nbp = AES_padDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset + nbb], readsize - code_offset - nbb, rawdata + nbb); - } - if (nbp >= 0) { - int nb = nbb + nbp; - rawdata[nb] = (char)0; - rawdata[nb + 1] = (char)0; // two zeros in case it's multi-byte - *resultlen = (DWORD)nb; - bReadSuccess = true; - } - else { - MsgBox(MBWARN, IDS_PASS_FAILURE); - *resultlen = 0; - bReadSuccess = false; - } - } - usedEncryption = true; - } - else { - // simulate read failure - MsgBox(MBWARN, IDS_NOPASS); - *resultlen = 0; - bReadSuccess = false; - usedEncryption = false; - } - } - - break; - - default: BUG1("format %d not understood", scheme); - } - } - } - - if (!usedEncryption) { // here, the file is believed to be a straight text file - ResetEncryption(); - *resultlen = readsize; - } - - GlobalUnlock(rawhandle); - - return(bReadSuccess); -} - -bool EncryptAndWriteFile(HWND hwnd, HANDLE hFile, BYTE *data, DWORD size, DWORD *written) -{ - UNUSED(hwnd); - - if (useFileKey || hasMasterFileKey) { - AES_keyInstance fileEncode; // encryption key for the file - AES_cipherInstance fileCypher; // cypher for the file, including the IV - DWORD PREAMBLE_written = 0; - BYTE precodedata[AES_MAX_IV_SIZE * 2 + KEY_BYTES * 2 + PREAMBLE_SIZE]; - long precode_size = AES_MAX_IV_SIZE + PREAMBLE_SIZE; //precode in standard file format - long *PREAMBLE_data = (long *)precodedata; - PREAMBLE_data[0] = PREAMBLE; - PREAMBLE_data[1] = FILEKEY_FORMAT; - - static int sequence = 1; // sequence counter so each time is unique - srand(sequence++ ^ (unsigned int)time(NULL)); - { - int i; for (i = 0; i < AES_MAX_IV_SIZE; i++) { - precodedata[PREAMBLE_SIZE + i] = 0;//rand(); - } - } - - { - if (useFileKey) { - // generate the encryption key from the passphrase - /* @@@ - char ansiKey[KEY_LEN+1]; - int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, fileKey, -1, ansiKey, KEY_LEN, NULL, NULL ); - ansiKey[len] = '\0'; - AES_keygen( ansiKey, binFileKey ); - */ - AES_keygen(fileKey, binFileKey); - hasBinFileKey = true; - }; - - AES_bin_setup(&fileEncode, AES_DIR_ENCRYPT, KEY_BYTES * 8, binFileKey); - - AES_bin_cipherInit(&fileCypher, AES_MODE_CBC, &precodedata[PREAMBLE_SIZE]); - - if (useMasterKey && *masterKey) { //setup with the master key and encrypt the file key. - //append the encrypted file key to the end of the PREAMBLE block - BYTE binMasterKey[KEY_BYTES]; - AES_keyInstance masterencode; - AES_cipherInstance mastercypher; - /* @@@ - char ansiKey[KEY_LEN+1]; - int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, masterKey, -1, ansiKey, KEY_LEN, NULL, NULL ); - ansiKey[len] = '\0'; - AES_keygen( ansiKey, binMasterKey ); - */ - AES_keygen(masterKey, binMasterKey); - AES_bin_setup(&masterencode, AES_DIR_ENCRYPT, KEY_BYTES * 8, binMasterKey); - {// generate another IV for the master key - - int i; for (i = 0; i < sizeof(masterFileIV); i++) { masterFileIV[i] = (BYTE)(rand() & BYTE_MAX); } - } - - AES_bin_cipherInit(&mastercypher, AES_MODE_CBC, masterFileIV); - - AES_blockEncrypt(&mastercypher, &masterencode, binFileKey, sizeof(binFileKey), masterFileKey); - hasMasterFileKey = true; - } - - if (hasMasterFileKey) {// copy the encrypted (new or recycled) into the output - memcpy(&precodedata[precode_size], masterFileIV, sizeof(masterFileIV)); - memcpy(&precodedata[precode_size + sizeof(masterFileIV)], masterFileKey, sizeof(masterFileKey)); - precode_size += sizeof(masterFileKey) + sizeof(masterFileIV); - PREAMBLE_data[1] = MASTERKEY_FORMAT; - } - - // write the PREAMBLE, punt if that failed - if (!WriteFile(hFile, precodedata, precode_size, &PREAMBLE_written, NULL)) { - *written = PREAMBLE_written; - return(false); - } - } - - // now encrypt the main file - { - DWORD enclen_written = 0; - DWORD enclen = 0; - bool bWriteRes = false; - - BYTE* encdata = (BYTE*)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size + PAD_SLOP); // add slop to the end for padding - if (!encdata) - return bWriteRes; - - if (size > PAD_SLOP) { enclen += AES_blockEncrypt(&fileCypher, &fileEncode, data, size - PAD_SLOP, encdata); } - - enclen += AES_padEncrypt(&fileCypher, &fileEncode, data + enclen, size - enclen, encdata + enclen); - - bWriteRes = WriteFile(hFile, encdata, enclen, &enclen_written, NULL); - - HeapFree(GetProcessHeap(), 0, encdata); // clean-up - - *written = PREAMBLE_written + enclen_written; // return the file size written - return(bWriteRes); // and the file ok status - } - } - else { - // not an encrypted file, write normally - bool bWriteSuccess = WriteFile(hFile, data, size, written, NULL); - return(bWriteSuccess); - } -} - + +/** +* +* Distributed under the terms of the GNU General Public License, +* see License.txt for details. +* +* Author: Dave Dyer ddyer@real-me.net Oct/2005 +* +adds the option to encrypt and decrypt files, using stong AES encryption, +optionally with master key + +see ecryption-doc.txt for details + +*/ +#if !defined(WINVER) +#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(NTDDI_VERSION) +#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ +#endif +#define VC_EXTRALEAN 1 +#include +#include +#include +#include "..\src\Dialogs.h" +#include "..\src\Helpers.h" +#include "..\src\resource.h" +#include "rijndael-api-fst.h" +#include "crypto.h" + +extern HINSTANCE g_hInstance; + +#define WKEY_LEN 256 +#define KEY_LEN 512 +#define PAD_SLOP 16 + +bool useFileKey = false; // file should be encrypted +char fileKey[KEY_LEN] = { 0 }; // ascii passphrase for the file key +WCHAR unicodeFileKey[WKEY_LEN] = { 0 }; // unicode file passphrase +bool useMasterKey = false; // file should have a master key +char masterKey[KEY_LEN] = { 0 }; // ascii passphrase for the master key +WCHAR unicodeMasterKey[WKEY_LEN] = { 0 }; // unicode master passphrase +BYTE binFileKey[KEY_BYTES]; // the encryption key in for the file +bool hasBinFileKey = false; +BYTE masterFileKey[KEY_BYTES]; // file key encrypted with the master key +BYTE masterFileIV[AES_MAX_IV_SIZE]; // the iv for the master key +bool hasMasterFileKey = false; +bool masterKeyAvailable = false; // information for the passphrase dialog box + +void ResetEncryption() +{ + masterKeyAvailable = false; + hasMasterFileKey = false; + hasBinFileKey = false; + useMasterKey = false; + useFileKey = false; + memset(fileKey, 0, sizeof(fileKey)); + memset(masterKey, 0, sizeof(masterKey)); + memset(binFileKey, 0, sizeof(binFileKey)); + memset(unicodeFileKey, 0, sizeof(unicodeFileKey)); + memset(unicodeMasterKey, 0, sizeof(unicodeMasterKey)); + memset(masterFileKey, 0, sizeof(masterFileKey)); + memset(masterFileIV, 0, sizeof(masterFileIV)); +} +//============================================================================= + +// +// copy a unicode string to a regular string, but keep the same +// result string for simple, non-unicode characters. +// this is used to convert a unicode password to a byte stream compatible with an ascii password +// +void unicodeStringCpy(char *dest, WCHAR *src, int destSize) +{ + int sidx = 0; + int didx = 0; + int destLim = destSize - 1; + while ((src[sidx] != 0) && (didx < destLim)) { + WCHAR c = src[sidx++]; + char clow = (char)(c & 0xff); + if (clow != 0) { dest[didx++] = clow; } // ignore zeros in the low order part + if (((c & 0xff00) != 0) && (didx < destLim)) // ignore zeros in the high order part + { + dest[didx++] = (char)((c >> 8) & 0xff); + } + } + dest[didx++] = (char)0; +} +//============================================================================= + +// helper function for set focus to editbox +void SetDialogFocus(HWND hDlg, HWND hwndControl) +{ + PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, true); +} + + +//============================================================================= +// helper function for the "set passphrase" dialog before output +// the complication in this version is that the incoming text is unicode. We deal +// with it by converting the unicode to an ascii compatible byte stream, so the +// caller (and hence the rest of the encryption) doesn't know unicode was involved. +INT_PTR CALLBACK SetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lParam) +{ + UNUSED(lParam); + const WCHAR wDot = (WCHAR)0x25CF; + + switch (umsg) { + + case WM_INITDIALOG: + { + SetDlgItemText(hDlg, IDC_EDIT1, unicodeFileKey); + SetDlgItemText(hDlg, IDC_EDIT2, unicodeMasterKey); + ShowWindow(GetDlgItem(hDlg, IDC_CHECK3), hasMasterFileKey); + CheckDlgButton(hDlg, IDC_CHECK3, hasMasterFileKey ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, IDC_CHECK2, (hasBinFileKey | useFileKey) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, IDC_CHECK1, useMasterKey ? BST_CHECKED : BST_UNCHECKED); + CenterDlgInParent(hDlg); + // Don't use: SetFocus( GetDlgItem( hDlg, IDC_EDIT1 ) ); + SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_EDIT1)); + } + + return true; + break; + + case WM_COMMAND: + + switch (LOWORD(wParam)) { + case IDC_CHECK4: + { + if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == BST_CHECKED) { + SendDlgItemMessage(hDlg, IDC_EDIT1, EM_SETPASSWORDCHAR, 0, 0); + SendDlgItemMessage(hDlg, IDC_EDIT2, EM_SETPASSWORDCHAR, 0, 0); + } + else { + SendDlgItemMessage(hDlg, IDC_EDIT1, EM_SETPASSWORDCHAR, (WPARAM)wDot, 0); + SendDlgItemMessage(hDlg, IDC_EDIT2, EM_SETPASSWORDCHAR, (WPARAM)wDot, 0); + } + InvalidateRect(hDlg, NULL, TRUE); + } + return(true); + break; + + case IDOK: + { + bool useMas = IsDlgButtonChecked(hDlg, IDC_CHECK1) == BST_CHECKED; + bool useFil = IsDlgButtonChecked(hDlg, IDC_CHECK2) == BST_CHECKED; + bool reuseMas = IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED; + WCHAR newFileKey[WKEY_LEN] = { 0 }; + WCHAR newMasKey[WKEY_LEN] = { 0 }; + hasMasterFileKey &= reuseMas; + GetDlgItemText(hDlg, IDC_EDIT1, newFileKey, COUNTOF(newFileKey)); + GetDlgItemText(hDlg, IDC_EDIT2, newMasKey, COUNTOF(newMasKey)); + useFileKey = !((newFileKey[0] <= ' ') || !useFil); + useMasterKey = !((newMasKey[0] <= ' ') || !useMas); + //@@@lstrcpyn(fileKey, newFileKey, WKEY_LEN); + //@@@lstrcpyn(masterKey, newMasKey, WKEY_LEN); + memcpy(unicodeFileKey, newFileKey, sizeof(unicodeFileKey)); + memcpy(unicodeMasterKey, newMasKey, sizeof(unicodeMasterKey)); + unicodeStringCpy(fileKey, unicodeFileKey, sizeof(fileKey)); + unicodeStringCpy(masterKey, unicodeMasterKey, sizeof(masterKey)); + EndDialog(hDlg, IDOK); + return(true); + } + + break; + + case IDC_EDIT1: + { + WCHAR newFileKey[WKEY_LEN] = { 0 }; + GetDlgItemText(hDlg, IDC_EDIT1, newFileKey, COUNTOF(newFileKey)); + CheckDlgButton(hDlg, IDC_CHECK2, (newFileKey[0] <= ' ') ? BST_UNCHECKED : BST_CHECKED); + } + + break; + + case IDC_EDIT2: + { + WCHAR newMasKey[WKEY_LEN] = { 0 }; + GetDlgItemText(hDlg, IDC_EDIT2, newMasKey, COUNTOF(newMasKey)); + { + bool newuse = (newMasKey[0] > ' '); // no leading whitespace or empty passwords + CheckDlgButton(hDlg, IDC_CHECK1, newuse ? BST_CHECKED : BST_UNCHECKED); + + if (newuse) { CheckDlgButton(hDlg, IDC_CHECK3, BST_UNCHECKED); } + } + } + + break; + + case IDC_CHECK3: // check reuse, uncheck set new and inverse + { + bool reuseMas = IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED; + + if (reuseMas) { CheckDlgButton(hDlg, IDC_CHECK1, reuseMas ? BST_UNCHECKED : BST_CHECKED); } + } + + break; + + case IDC_CHECK1: + { + bool useMas = IsDlgButtonChecked(hDlg, IDC_CHECK1) == BST_CHECKED; + + if (useMas) { CheckDlgButton(hDlg, IDC_CHECK3, useMas ? BST_UNCHECKED : BST_CHECKED); } + } + + break; + + case IDCANCEL: + EndDialog(hDlg, IDCANCEL); + break; + + } + + break; + + } + + return false; + +} +// +// helper for setting password when reading a file +// the complication in this version is that the incoming text is unicode. We deal +// with it by converting the unicode to an ascii compatible byte stream, so the +// caller (and hence the rest of the encryption) doesn't know unicode was involved. +// +INT_PTR CALLBACK GetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lParam) +{ + UNUSED(lParam); + + const WCHAR wDot = (WCHAR)0x25CF; + + switch (umsg) { + + case WM_INITDIALOG: + { + int vis = masterKeyAvailable ? SW_SHOW : SW_HIDE; + ShowWindow(GetDlgItem(hDlg, IDC_STATICPW), vis); + ShowWindow(GetDlgItem(hDlg, IDC_CHECK3), vis); + //@@@SetDlgItemText( hDlg, IDC_EDIT3, fileKey ); + SetDlgItemText(hDlg, IDC_EDIT3, unicodeFileKey); + CheckDlgButton(hDlg, IDC_CHECK3, BST_UNCHECKED); + CenterDlgInParent(hDlg); + // Don't use: SetFocus( GetDlgItem( hDlg, IDC_EDIT3 ) ); + SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_EDIT3)); + } + return true; + break; + + case WM_COMMAND: + + switch (LOWORD(wParam)) + { + case IDC_CHECK4: + { + if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == BST_CHECKED) { + SendDlgItemMessage(hDlg, IDC_EDIT3, EM_SETPASSWORDCHAR, 0, 0); + } + else { + SendDlgItemMessage(hDlg, IDC_EDIT3, EM_SETPASSWORDCHAR, (WPARAM)wDot, 0); + } + InvalidateRect(hDlg, NULL, TRUE); + return(true); + break; + } + case IDOK: + { + bool useMas = (IsDlgButtonChecked(hDlg, IDC_CHECK3) == BST_CHECKED); + WCHAR newKey[WKEY_LEN] = L"\0"; + GetDlgItemText(hDlg, IDC_EDIT3, newKey, COUNTOF(newKey)); + + if (useMas) { + memcpy(unicodeMasterKey, newKey, sizeof(unicodeMasterKey)); + unicodeStringCpy(masterKey, unicodeMasterKey, sizeof(masterKey)); + useFileKey = false; + useMasterKey = true; + } + else { + memcpy(unicodeFileKey, newKey, sizeof(unicodeFileKey)); + unicodeStringCpy(fileKey, unicodeFileKey, sizeof(fileKey)); + useFileKey = true; + useMasterKey = false; + } + EndDialog(hDlg, IDOK); + } + return(true); + break; + + case IDCANCEL: + EndDialog(hDlg, IDCANCEL); + break; + } + break; + } + return false; +} + + +// set passphrases for output +bool GetFileKey(HWND hwnd) +{ + return (IDOK == DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_PASSWORDS), + GetParent(hwnd), SetKeysDlgProc, (LPARAM)hwnd)); +} + +// set passphrases for file being input +bool ReadFileKey(HWND hwnd, bool master) +{ + masterKeyAvailable = master; + return (IDOK == DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_READPW), + GetParent(hwnd), GetKeysDlgProc, (LPARAM)hwnd)); +} + + +// //////////////////////////////////////////////////////////////////////////// +// +// read the file data, decrypt if necessary, +// return the result as a new allocation +// +int ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWORD *resultlen) +{ + HANDLE rawhandle = *result; + BYTE* rawdata = (BYTE*)GlobalLock(rawhandle); + + int returnFlag = DECRYPT_SUCCESS; + bool usedEncryption = false; + unsigned long readsize = 0; + bool bRetryPassPhrase = true; + + while (bRetryPassPhrase) { + + SetFilePointer(hFile, 0L, NULL, FILE_BEGIN); + returnFlag = DECRYPT_SUCCESS; + usedEncryption = false; + readsize = 0; + bRetryPassPhrase = false; + + bool bReadSuccess = ReadFile(hFile, rawdata, size, &readsize, NULL); + returnFlag = bReadSuccess ? DECRYPT_SUCCESS : DECRYPT_FREAD_FAILED; + + // we read the file, check if it looks like our encryption format + + if (bReadSuccess && (readsize > (PREAMBLE_SIZE + AES_MAX_IV_SIZE))) { + + long *ldata = (long*)rawdata; + + if (ldata && (ldata[0] == PREAMBLE)) { + long scheme = ldata[1]; + unsigned long code_offset = PREAMBLE_SIZE + AES_MAX_IV_SIZE; + + switch (scheme) { + + case MASTERKEY_FORMAT: + code_offset += sizeof(masterFileKey) + sizeof(masterFileIV); + // save the encrypted file key and IV. They can be reused if the + // passphrases are not changed. + memcpy(masterFileIV, &rawdata[MASTER_KEY_OFFSET], sizeof(masterFileIV)); + memcpy(masterFileKey, &rawdata[MASTER_KEY_OFFSET + sizeof(masterFileIV)], sizeof(masterFileKey)); + hasMasterFileKey = true; + + // fall through + case FILEKEY_FORMAT: + { + bool haveFileKey = ReadFileKey(hwnd, scheme == MASTERKEY_FORMAT); + + if (useFileKey) { + // use the file key to decode + /*@@@ + char ansiKey[KEY_LEN+1]; + int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, fileKey, -1, ansiKey, KEY_LEN, NULL, NULL ); + ansiKey[len] = '\0'; + AES_keygen( ansiKey, binFileKey ); // generate the encryption key from the passphrase + */ + AES_keygen(fileKey, binFileKey); // generate the encryption key from the passphrase + hasBinFileKey = true; + } + else if ((scheme == MASTERKEY_FORMAT) && useMasterKey) { // use the master key to recover the file key + BYTE binMasterKey[KEY_BYTES]; + AES_keyInstance masterdecode; + AES_cipherInstance mastercypher; + /*@@@ + char ansiKey[KEY_LEN+1]; + int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, masterKey, -1, ansiKey, KEY_LEN, NULL, NULL ); + AES_keygen( ansiKey, binMasterKey ); + */ + AES_keygen(masterKey, binMasterKey); + AES_bin_setup(&masterdecode, AES_DIR_DECRYPT, KEY_BYTES * 8, binMasterKey); + AES_bin_cipherInit(&mastercypher, AES_MODE_CBC, masterFileIV); + AES_blockDecrypt(&mastercypher, &masterdecode, masterFileKey, sizeof(binFileKey), binFileKey); + hasBinFileKey = true; + haveFileKey = true; + useMasterKey = false; + } + + if (haveFileKey) { + usedEncryption = true; + AES_keyInstance fileDecode; + AES_cipherInstance fileCypher; + AES_bin_setup(&fileDecode, AES_DIR_DECRYPT, KEY_BYTES * 8, binFileKey); + AES_bin_cipherInit(&fileCypher, AES_MODE_CBC, &rawdata[PREAMBLE_SIZE]); // IV is next + { // finally, decrypt the actual data + int nbb = BAD_CIPHER_STATE; + int nbp = BAD_CIPHER_STATE; + if ((readsize - code_offset) >= PAD_SLOP) { + nbb = AES_blockDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset], readsize - code_offset - PAD_SLOP, rawdata); + } + if (nbb >= 0) { + nbp = AES_padDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset + nbb], readsize - code_offset - nbb, rawdata + nbb); + } + if (nbp >= 0) { + int nb = nbb + nbp; + rawdata[nb] = (char)0; + rawdata[nb + 1] = (char)0; // two zeros in case it's multi-byte + *resultlen = (DWORD)nb; + } + else { + bRetryPassPhrase = (MsgBox(MBRETRYCANCEL, IDS_PASS_FAILURE) == IDRETRY); + if (!bRetryPassPhrase) { + // enable raw encryption read + *resultlen = readsize; + returnFlag |= DECRYPT_WRONG_PASS; + } + } + } + } + else { + // enable raw encryption read + returnFlag |= DECRYPT_CANCELED_NO_PASS; + } + } + break; + + default: + BUG1("format %d not understood", scheme); + returnFlag |= DECRYPT_FATAL_ERROR; + break; + } + } + } + } // while bRetryPassPhrase + + if (!usedEncryption) { // here, the file is believed to be a straight text file + ResetEncryption(); + *resultlen = readsize; + returnFlag |= DECRYPT_NO_ENCRYPTION; + } + + GlobalUnlock(rawhandle); + + return returnFlag; +} + +bool EncryptAndWriteFile(HWND hwnd, HANDLE hFile, BYTE *data, DWORD size, DWORD *written) +{ + UNUSED(hwnd); + + if (useFileKey || hasMasterFileKey) { + AES_keyInstance fileEncode; // encryption key for the file + AES_cipherInstance fileCypher; // cypher for the file, including the IV + DWORD PREAMBLE_written = 0; + BYTE precodedata[AES_MAX_IV_SIZE * 2 + KEY_BYTES * 2 + PREAMBLE_SIZE]; + long precode_size = AES_MAX_IV_SIZE + PREAMBLE_SIZE; //precode in standard file format + long *PREAMBLE_data = (long *)precodedata; + PREAMBLE_data[0] = PREAMBLE; + PREAMBLE_data[1] = FILEKEY_FORMAT; + + static int sequence = 1; // sequence counter so each time is unique + srand(sequence++ ^ (unsigned int)time(NULL)); + { + int i; for (i = 0; i < AES_MAX_IV_SIZE; i++) { + precodedata[PREAMBLE_SIZE + i] = 0;//rand(); + } + } + + { + if (useFileKey) { + // generate the encryption key from the passphrase + /* @@@ + char ansiKey[KEY_LEN+1]; + int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, fileKey, -1, ansiKey, KEY_LEN, NULL, NULL ); + ansiKey[len] = '\0'; + AES_keygen( ansiKey, binFileKey ); + */ + AES_keygen(fileKey, binFileKey); + hasBinFileKey = true; + }; + + AES_bin_setup(&fileEncode, AES_DIR_ENCRYPT, KEY_BYTES * 8, binFileKey); + + AES_bin_cipherInit(&fileCypher, AES_MODE_CBC, &precodedata[PREAMBLE_SIZE]); + + if (useMasterKey && *masterKey) { //setup with the master key and encrypt the file key. + //append the encrypted file key to the end of the PREAMBLE block + BYTE binMasterKey[KEY_BYTES]; + AES_keyInstance masterencode; + AES_cipherInstance mastercypher; + /* @@@ + char ansiKey[KEY_LEN+1]; + int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, masterKey, -1, ansiKey, KEY_LEN, NULL, NULL ); + ansiKey[len] = '\0'; + AES_keygen( ansiKey, binMasterKey ); + */ + AES_keygen(masterKey, binMasterKey); + AES_bin_setup(&masterencode, AES_DIR_ENCRYPT, KEY_BYTES * 8, binMasterKey); + {// generate another IV for the master key + + int i; for (i = 0; i < sizeof(masterFileIV); i++) { masterFileIV[i] = (BYTE)(rand() & BYTE_MAX); } + } + + AES_bin_cipherInit(&mastercypher, AES_MODE_CBC, masterFileIV); + + AES_blockEncrypt(&mastercypher, &masterencode, binFileKey, sizeof(binFileKey), masterFileKey); + hasMasterFileKey = true; + } + + if (hasMasterFileKey) {// copy the encrypted (new or recycled) into the output + memcpy(&precodedata[precode_size], masterFileIV, sizeof(masterFileIV)); + memcpy(&precodedata[precode_size + sizeof(masterFileIV)], masterFileKey, sizeof(masterFileKey)); + precode_size += sizeof(masterFileKey) + sizeof(masterFileIV); + PREAMBLE_data[1] = MASTERKEY_FORMAT; + } + + // write the PREAMBLE, punt if that failed + if (!WriteFile(hFile, precodedata, precode_size, &PREAMBLE_written, NULL)) { + *written = PREAMBLE_written; + return(false); + } + } + + // now encrypt the main file + { + DWORD enclen_written = 0; + DWORD enclen = 0; + bool bWriteRes = false; + + BYTE* encdata = (BYTE*)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size + PAD_SLOP); // add slop to the end for padding + if (!encdata) + return bWriteRes; + + if (size > PAD_SLOP) { enclen += AES_blockEncrypt(&fileCypher, &fileEncode, data, size - PAD_SLOP, encdata); } + + enclen += AES_padEncrypt(&fileCypher, &fileEncode, data + enclen, size - enclen, encdata + enclen); + + bWriteRes = WriteFile(hFile, encdata, enclen, &enclen_written, NULL); + + HeapFree(GetProcessHeap(), 0, encdata); // clean-up + + *written = PREAMBLE_written + enclen_written; // return the file size written + return(bWriteRes); // and the file ok status + } + } + else { + // not an encrypted file, write normally + bool bWriteSuccess = WriteFile(hFile, data, size, written, NULL); + return(bWriteSuccess); + } +} + diff --git a/crypto/crypto.h b/crypto/crypto.h index bf50b4767..37d0333b4 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -1,21 +1,29 @@ #ifndef __CRYPTO_H__ #define __CRYPTO_H__ -#include +#include #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 diff --git a/src/Dialogs.c b/src/Dialogs.c index b381b8ff0..aa3e8efc7 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -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 diff --git a/src/Dialogs.h b/src/Dialogs.h index 056821a03..e3c379478 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -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); diff --git a/src/Edit.c b/src/Edit.c index 05c7e62e7..09ad308fe 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -1,7872 +1,8291 @@ -/****************************************************************************** -* * -* * -* Notepad3 * -* * -* Edit.c * -* Text File Editing Helper Stuff * -* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * -* * -* (c) Rizonesoft 2008-2016 * -* https://rizonesoft.com * -* * -* * -*******************************************************************************/ - -#if !defined(WINVER) -#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(NTDDI_VERSION) -#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ -#endif - -#define VC_EXTRALEAN 1 -#include - -#include -#include -#include -#include -#include -#include - -#include "scintilla.h" -#include "scilexer.h" -#include "notepad3.h" -#include "styles.h" -#include "dialogs.h" -#include "resource.h" -#include "../crypto/crypto.h" -#include "../uthash/utarray.h" -//#include "../uthash/utstring.h" -#include "helpers.h" -#include "encoding.h" - -#include "SciCall.h" - -#include "edit.h" - - -#ifndef LCMAP_TITLECASE -#define LCMAP_TITLECASE 0x00000300 // Title Case Letters bit mask -#endif - -// find free bits in scintilla.h SCFIND_ defines -#define SCFIND_NP3_REGEX (SCFIND_REGEXP | SCFIND_POSIX) - -extern HWND g_hwndMain; -extern HWND g_hwndStatus; -extern HWND g_hwndDlgFindReplace; -extern WININFO g_WinInfo; - -extern HINSTANCE g_hInstance; -//extern LPMALLOC g_lpMalloc; - -extern DWORD dwLastIOError; -extern bool bReplaceInitialized; -extern bool bUseOldStyleBraceMatching; -extern bool bUseDefaultForFileEncoding; -extern bool bFindReplCopySelOrClip; - -static EDITFINDREPLACE efrSave; -static bool bSwitchedFindReplace = false; - -extern int xFindReplaceDlg; -extern int yFindReplaceDlg; -static int xFindReplaceDlgSave; -static int yFindReplaceDlgSave; - -extern int g_iDefaultEOLMode; -extern int iLineEndings[3]; -extern bool bFixLineEndings; -extern bool bAutoStripBlanks; - -// Default Codepage and Character Set -extern int g_iDefaultNewFileEncoding; -extern int g_iDefaultCharSet; -extern bool bLoadASCIIasUTF8; -extern bool bLoadNFOasOEM; - -extern bool bAccelWordNavigation; - -extern int iReplacedOccurrences; -extern int iMarkOccurrences; -extern int iMarkOccurrencesCount; -extern int iMarkOccurrencesMaxCount; -extern bool bMarkOccurrencesMatchVisible; -extern bool g_bCodeFoldingAvailable; -extern bool g_bShowCodeFolding; - -extern bool g_bTabsAsSpaces; -extern bool g_bTabIndents; -extern int g_iTabWidth; -extern int g_iIndentWidth; - -extern FR_STATES g_FindReplaceMatchFoundState; - -#define DELIM_BUFFER 258 -static char DelimChars[DELIM_BUFFER] = { '\0' }; -static char DelimCharsAccel[DELIM_BUFFER] = { '\0' }; -static char WordCharsDefault[DELIM_BUFFER] = { '\0' }; -static char WhiteSpaceCharsDefault[DELIM_BUFFER] = { '\0' }; -static char PunctuationCharsDefault[DELIM_BUFFER] = { '\0' }; -static char WordCharsAccelerated[DELIM_BUFFER] = { '\0' }; -static char WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { '\0' }; -static char PunctuationCharsAccelerated[1] = { '\0' }; // empty! - -//static WCHAR W_DelimChars[DELIM_BUFFER] = { L'\0' }; -//static WCHAR W_DelimCharsAccel[DELIM_BUFFER] = { L'\0' }; -//static WCHAR W_WhiteSpaceCharsDefault[DELIM_BUFFER] = { L'\0' }; -//static WCHAR W_WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { L'\0' }; - - -// Is the character a white space char? -//#define IsWhiteSpace(ch) (((ch) == ' ') || ((ch) == '\t')) -#define IsWhiteSpace(ch) StrChrA(WhiteSpaceCharsDefault, (ch)) -#define IsAccelWhiteSpace(ch) StrChrA(WhiteSpaceCharsAccelerated, (ch)) - - -// temporary line buffer for fast line ops -static char g_pTempLineBuffer[TEMPLINE_BUFFER]; - - -enum AlignMask { - ALIGN_LEFT = 0, - ALIGN_RIGHT = 1, - ALIGN_CENTER = 2, - ALIGN_JUSTIFY = 3, - ALIGN_JUSTIFY_EX = 4 -}; - -enum SortOrderMask { - SORT_ASCENDING = 0, - SORT_DESCENDING = 1, - SORT_SHUFFLE = 2, - SORT_MERGEDUP = 4, - SORT_UNIQDUP = 8, - SORT_UNIQUNIQ = 16, - SORT_NOCASE = 32, - SORT_LOGICAL = 64, - SORT_COLUMN = 128 -}; - - -extern LPMRULIST g_pMRUfind; -extern LPMRULIST g_pMRUreplace; - -extern bool bMarkOccurrencesCurrentWord; -extern bool bMarkOccurrencesMatchCase; -extern bool bMarkOccurrencesMatchWords; - -// Timer bitfield -static volatile LONG g_lTargetTransactionBits = 0; -#define BIT_TIMER_MARK_OCC 1L -#define BIT_MARK_OCC_IN_PROGRESS 2L -#define BLOCK_BIT_TARGET_TRANSACTION 4L - -#define TEST_AND_SET(BIT) InterlockedBitTestAndSet(&g_lTargetTransactionBits, BIT) -#define TEST_AND_RESET(BIT) InterlockedBitTestAndReset(&g_lTargetTransactionBits, BIT) - - -//============================================================================= -// -// EditEnterTargetTransaction(), EditLeaveTargetTransaction() -// -void EditEnterTargetTransaction() { - (void)TEST_AND_SET(BLOCK_BIT_TARGET_TRANSACTION); -} - -void EditLeaveTargetTransaction() { - (void)TEST_AND_RESET(BLOCK_BIT_TARGET_TRANSACTION); -} - -bool EditIsInTargetTransaction() { - if (TEST_AND_RESET(BLOCK_BIT_TARGET_TRANSACTION)) { - (void)TEST_AND_SET(BLOCK_BIT_TARGET_TRANSACTION); - return true; - } - return false; -} - - -//============================================================================= -// -// EditSetWordDelimiter() -// -void EditInitWordDelimiter(HWND hwnd) -{ - ZeroMemory(WordCharsDefault, COUNTOF(WordCharsDefault)); - ZeroMemory(WhiteSpaceCharsDefault, COUNTOF(WhiteSpaceCharsDefault)); - ZeroMemory(PunctuationCharsDefault, COUNTOF(PunctuationCharsDefault)); - ZeroMemory(WordCharsAccelerated, COUNTOF(WordCharsAccelerated)); - ZeroMemory(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated)); - //ZeroMemory(PunctuationCharsAccelerated, COUNTOF(PunctuationCharsAccelerated)); // empty! - - // 1st get/set defaults - SendMessage(hwnd, SCI_GETWORDCHARS, 0, (LPARAM)WordCharsDefault); - SendMessage(hwnd, SCI_GETWHITESPACECHARS, 0, (LPARAM)WhiteSpaceCharsDefault); - SendMessage(hwnd, SCI_GETPUNCTUATIONCHARS, 0, (LPARAM)PunctuationCharsDefault); - - // default word delimiter chars are whitespace & punctuation & line ends - const char* lineEnds = "\r\n"; - StringCchCopyA(DelimChars, COUNTOF(DelimChars), WhiteSpaceCharsDefault); - StringCchCatA(DelimChars, COUNTOF(DelimChars), PunctuationCharsDefault); - StringCchCatA(DelimChars, COUNTOF(DelimChars), lineEnds); - - // 2nd get user settings - WCHAR buffer[DELIM_BUFFER] = { L'\0' }; - ZeroMemory(buffer, DELIM_BUFFER * sizeof(WCHAR)); - - IniGetString(L"Settings2", L"ExtendedWhiteSpaceChars", L"", buffer, COUNTOF(buffer)); - char whitesp[DELIM_BUFFER] = { '\0' }; - if (StringCchLen(buffer, COUNTOF(buffer)) > 0) { - WideCharToMultiByteStrg(CP_ACP, buffer, whitesp); - } - - // 3rd set accelerated arrays - - // init with default - StringCchCopyA(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated), WhiteSpaceCharsDefault); - - // add only 7-bit-ASCII chars to accelerated whitespace list - for (size_t i = 0; i < strlen(whitesp); i++) { - if (whitesp[i] & 0x7F) { - if (!StrChrA(WhiteSpaceCharsAccelerated, whitesp[i])) { - StringCchCatNA(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated), &(whitesp[i]), 1); - } - } - } - - // construct word char array - StringCchCopyA(WordCharsAccelerated, COUNTOF(WordCharsAccelerated), WordCharsDefault); // init - // add punctuation chars not listed in white-space array - for (size_t i = 0; i < strlen(PunctuationCharsDefault); i++) { - if (!StrChrA(WhiteSpaceCharsAccelerated, PunctuationCharsDefault[i])) { - StringCchCatNA(WordCharsAccelerated, COUNTOF(WordCharsAccelerated), &(PunctuationCharsDefault[i]), 1); - } - } - - // construct accelerated delimiters - StringCchCopyA(DelimCharsAccel, COUNTOF(DelimCharsAccel), WhiteSpaceCharsDefault); - StringCchCatA(DelimCharsAccel, COUNTOF(DelimCharsAccel), lineEnds); - - // constuct wide char arrays - //MultiByteToWideChar(Encoding_SciCP, 0, DelimChars, -1, W_DelimChars, COUNTOF(W_DelimChars)); - //MultiByteToWideChar(Encoding_SciCP, 0, DelimCharsAccel, -1, W_DelimCharsAccel, COUNTOF(W_DelimCharsAccel)); - //MultiByteToWideChar(Encoding_SciCP, 0, WhiteSpaceCharsDefault, -1, W_WhiteSpaceCharsDefault, COUNTOF(W_WhiteSpaceCharsDefault)); - //MultiByteToWideChar(Encoding_SciCP, 0, WhiteSpaceCharsAccelerated, -1, W_WhiteSpaceCharsAccelerated, COUNTOF(W_WhiteSpaceCharsAccelerated)); - -} - - - -//============================================================================= -// -// EditSetNewText() -// -extern bool bFreezeAppTitle; -extern FILEVARS fvCurFile; - - -void EditSetNewText(HWND hwnd,char* lpstrText,DWORD cbText) -{ - bFreezeAppTitle = true; - - if (SendMessage(hwnd, SCI_GETREADONLY, 0, 0)) { - SendMessage(hwnd, SCI_SETREADONLY, false, 0); - } - SendMessage(hwnd,SCI_CANCEL,0,0); - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); - UndoRedoActionMap(-1,NULL); - SendMessage(hwnd,SCI_CLEARALL,0,0); - SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); - SendMessage(hwnd,SCI_SETSCROLLWIDTH, GetSystemMetrics(SM_CXSCREEN), 0); - SendMessage(hwnd,SCI_SETXOFFSET,0,0); - - FileVars_Apply(hwnd,&fvCurFile); - - if (cbText > 0) { - SendMessage(hwnd, SCI_ADDTEXT, cbText, (LPARAM)lpstrText); - } - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,1,0); - //SendMessage(hwnd,EM_EMPTYUNDOBUFFER,0,0); // deprecated - SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); - SendMessage(hwnd, SCI_SETSCROLLWIDTH, 1, 0); - SendMessage(hwnd,SCI_GOTOPOS,0,0); - SendMessage(hwnd,SCI_CHOOSECARETX,0,0); - - bFreezeAppTitle = false; -} - - -//============================================================================= -// -// EditConvertText() -// -bool EditConvertText(HWND hwnd, int encSource, int encDest, bool bSetSavePoint) -{ - if (encSource == encDest) - return(true); - - if (!(Encoding_IsValid(encSource) && Encoding_IsValid(encDest))) - return(false); - - DocPos length = SciCall_GetTextLength(); - - if (length == 0) - { - SendMessage(hwnd,SCI_CANCEL,0,0); - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); - UndoRedoActionMap(-1,NULL); - SendMessage(hwnd,SCI_CLEARALL,0,0); - SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0); - SendMessage(hwnd,SCI_GOTOPOS,0,0); - SendMessage(hwnd,SCI_CHOOSECARETX,0,0); - - if (bSetSavePoint) - SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); - } - else { - - const DocPos chBufSize = length * 5 + 2; - char* pchText = AllocMem(chBufSize,HEAP_ZERO_MEMORY); - - struct Sci_TextRange tr = { { 0, -1 }, NULL }; - tr.lpstrText = pchText; - SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); - - const DocPos wchBufSize = length * 3 + 2; - WCHAR* pwchText = AllocMem(wchBufSize, HEAP_ZERO_MEMORY); - - // MultiBytes(Sci) -> WideChar(destination) -> Sci(MultiByte) - const UINT cpDst = Encoding_GetCodePage(encDest); - - // get text as wide char - int cbwText = MultiByteToWideChar(Encoding_SciCP,0, pchText, (int)length, pwchText, (int)wchBufSize); - // convert wide char to destination multibyte - int cbText = WideCharToMultiByte(cpDst, 0, pwchText, cbwText, pchText, (int)chBufSize, NULL, NULL); - // re-code to wide char - cbwText = MultiByteToWideChar(cpDst, 0, pchText, cbText, pwchText, (int)wchBufSize); - // convert to Scintilla format - cbText = WideCharToMultiByte(Encoding_SciCP, 0, pwchText, cbwText, pchText, (int)chBufSize, NULL, NULL); - pchText[cbText] = '\0'; - pchText[cbText+1] = '\0'; - - SendMessage(hwnd,SCI_CANCEL,0,0); - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); - UndoRedoActionMap(-1,NULL); - SendMessage(hwnd,SCI_CLEARALL,0,0); - SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); - SendMessage(hwnd,SCI_ADDTEXT,cbText,(LPARAM)pchText); - SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0); - SendMessage(hwnd,SCI_GOTOPOS,0,0); - SendMessage(hwnd,SCI_CHOOSECARETX,0,0); - - FreeMem(pchText); - FreeMem(pwchText); - - } - return(true); -} - - -//============================================================================= -// -// EditSetNewEncoding() -// -bool EditSetNewEncoding(HWND hwnd,int iNewEncoding,bool bNoUI,bool bSetSavePoint) { - - int iCurrentEncoding = Encoding_Current(CPI_GET); - - if (iCurrentEncoding != iNewEncoding) { - - // conversion between arbitrary encodings may lead to unexpected results - //bool bOneEncodingIsANSI = (Encoding_IsANSI(iCurrentEncoding) || Encoding_IsANSI(iNewEncoding)); - //bool bBothEncodingsAreANSI = (Encoding_IsANSI(iCurrentEncoding) && Encoding_IsANSI(iNewEncoding)); - //if (!bOneEncodingIsANSI || bBothEncodingsAreANSI) { - // ~ return true; // this would imply a successful conversion - it is not ! - //return false; // commented out ? : allow conversion between arbitrary encodings - //} - - if (SciCall_GetTextLength() == 0) { - - bool bIsEmptyUndoHistory = (SendMessage(hwnd, SCI_CANUNDO, 0, 0) == 0 && SendMessage(hwnd, SCI_CANREDO, 0, 0) == 0); - - bool doNewEncoding = (!bIsEmptyUndoHistory && !bNoUI) ? - (InfoBox(MBYESNO, L"MsgConv2", IDS_ASK_ENCODING2) == IDYES) : true; - - if (doNewEncoding) { - return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,bSetSavePoint); - } - } - else { - - bool doNewEncoding = (!bNoUI) ? (InfoBox(MBYESNO, L"MsgConv1", IDS_ASK_ENCODING) == IDYES) : true; - - if (doNewEncoding) { - return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,false); - } - } - } - return false; -} - -//============================================================================= -// -// EditIsRecodingNeeded() -// -bool EditIsRecodingNeeded(WCHAR* pszText, int cchLen) -{ - if ((pszText == NULL) || (cchLen < 1)) - return false; - - UINT codepage = Encoding_GetCodePage(Encoding_Current(CPI_GET)); - - if ((codepage == CP_UTF7) || (codepage == CP_UTF8)) - return false; - - DWORD dwFlags = WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR; - bool useNullParams = Encoding_IsMBCS(Encoding_Current(CPI_GET)) ? true : false; - - BOOL bDefaultCharsUsed = FALSE; - int cch = 0; - if (useNullParams) - cch = WideCharToMultiByte(codepage, 0, pszText, cchLen, NULL, 0, NULL, NULL); - else - cch = WideCharToMultiByte(codepage, dwFlags, pszText, cchLen, NULL, 0, NULL, &bDefaultCharsUsed); - - if (useNullParams && (cch == 0)) { - if (GetLastError() != ERROR_NO_UNICODE_TRANSLATION) - cch = cchLen; // don't care - } - - bool bSuccess = ((cch >= cchLen) && (cch != (int)0xFFFD)) ? true : false; - - return (!bSuccess || bDefaultCharsUsed); -} - - -//============================================================================= -// -// EditGetClipboardText() -// -char* EditGetClipboardText(HWND hwnd,bool bCheckEncoding,int* pLineCount,int* pLenLastLn) { - - if (!IsClipboardFormatAvailable(CF_UNICODETEXT) || !OpenClipboard(GetParent(hwnd))) { - char* pEmpty = StrDupA(""); - return (pEmpty); - } - - // get clipboard - HANDLE hmem = GetClipboardData(CF_UNICODETEXT); - WCHAR* pwch = GlobalLock(hmem); - int wlen = lstrlenW(pwch); - - if (bCheckEncoding && EditIsRecodingNeeded(pwch,wlen)) - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocPos iAnchor = SciCall_GetAnchor(); - - // switch encoding to universal UTF-8 codepage - SendMessage(g_hwndMain,WM_COMMAND,(WPARAM)MAKELONG(IDM_ENCODING_UTF8,1),0); - - // restore and adjust selection - if (iPos > iAnchor) { - SciCall_SetSel(iAnchor, iPos); - } - else { - SciCall_SetSel(iPos, iAnchor); - } - EditFixPositions(hwnd); - } - - // translate to SCI editor component codepage (default: UTF-8) - int mlen = WideCharToMultiByte(Encoding_SciCP,0,pwch,wlen,NULL,0,NULL,NULL); - char* pmch = LocalAlloc(LPTR,mlen + 1); - if (pmch && mlen != 0) { - int cnt = WideCharToMultiByte(Encoding_SciCP,0,pwch,wlen,pmch,mlen + 1,NULL,NULL); - if (cnt == 0) - return (pmch); - } - else - return (pmch); - - int lineCount = 0; - int lenLastLine = 0; - if ((bool)SendMessage(hwnd,SCI_GETPASTECONVERTENDINGS,0,0)) { - char* ptmp = LocalAlloc(LPTR,mlen * 2 + 2); - if (ptmp) { - char *s = pmch; - char *d = ptmp; - int eolmode = SciCall_GetEOLMode(); - for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) { - if (*s == '\n' || *s == '\r') { - if (eolmode == SC_EOL_CR) { - *d++ = '\r'; - } - else if (eolmode == SC_EOL_LF) { - *d++ = '\n'; - } - else { // eolmode == SC_EOL_CRLF - *d++ = '\r'; - *d++ = '\n'; - } - if ((*s == '\r') && (i + 1 < mlen) && (*(s + 1) == '\n')) { - i++; - s++; - } - s++; - ++lineCount; - lenLastLine = 0; - } - else { - *d++ = *s++; - } - } - *d = '\0'; - int mlen2 = (int)(d - ptmp); - - LocalFree(pmch); - pmch = LocalAlloc(LPTR,mlen2 + 1); - StringCchCopyA(pmch,mlen2 + 1,ptmp); - LocalFree(ptmp); - } - } - else { - // count lines only - char *s = pmch; - for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) { - if (*s == '\n' || *s == '\r') { - if ((*s == '\r') && (i + 1 < mlen) && (*(s + 1) == '\n')) { - i++; - s++; - } - s++; - ++lineCount; - lenLastLine = 0; - } - } - } - - GlobalUnlock(hmem); - CloseClipboard(); - - if (pLineCount) - *pLineCount = lineCount; - - if (pLenLastLn) - *pLenLastLn = lenLastLine; - - return (pmch); -} - - -//============================================================================= -// -// EditSetClipboardText() -// -bool EditSetClipboardText(HWND hwnd, const char* pszText) -{ - if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { - SciCall_CopyText((DocPos)strlen(pszText), pszText); - return true; - } - - WCHAR* pszTextW = NULL; - int cchTextW = MultiByteToWideChar(Encoding_SciCP, 0, pszText, -1, NULL, 0) + 1; - if (cchTextW > 1) { - pszTextW = LocalAlloc(LPTR, sizeof(WCHAR)*cchTextW); - MultiByteToWideChar(Encoding_SciCP, 0, pszText, -1, pszTextW, cchTextW); - } - - if (pszTextW) { - SetClipboardTextW(GetParent(hwnd), pszTextW); - LocalFree(pszTextW); - return true; - } - return false; -} - - -//============================================================================= -// -// EditClearClipboard() -// -bool EditClearClipboard(HWND hwnd) -{ - if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { - SciCall_CopyText(0, ""); - return true; - } - if (!OpenClipboard(GetParent(hwnd))) { - return false; - } - EmptyClipboard(); - CloseClipboard(); - return true; -} - - -//============================================================================= -// -// EditPaste2RectSel() -// -void EditPaste2RectSel(HWND hwnd, char* pText) -{ - if (!SciCall_IsSelectionRectangle()) { return; } - - const DocPos length = lstrlenA(pText); // '\0' terminated - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - const DocPosU selCount = (DocPosU)SendMessage(hwnd, SCI_GETSELECTIONS, 0, 0); - - char* pTextLine = pText; - // remove line-break from last line - if (*pTextLine != '\0') { StrTrimA(pTextLine, "\r\n"); } - - for (DocPosU s = 0; s < selCount; ++s) { - // get lines from clip - char *ln = pTextLine; - int lnLen = 0; - while (*ln != '\0') { - if (s < (selCount - 1)) { - if (*ln == '\n' || *ln == '\r') { - if ((*ln == '\r') && (*(ln + 1) == '\n')) { ++ln; } - ++ln; // next line - break; - } - else { ++ln; ++lnLen; } - } - else { ++ln; ++lnLen; } // last line - } - - const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); - const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); - - DocPos virtualSpaceLen = 0; - DocPos selTargetStart = 0; - DocPos selTargetEnd = 0; - if (selCaretPos < selAnchorPos) { - selTargetStart = selCaretPos; - selTargetEnd = selAnchorPos; - virtualSpaceLen = SciCall_GetSelectionNCaretVirtualSpace(s); - } - else { - selTargetStart = selAnchorPos; - selTargetEnd = selCaretPos; - virtualSpaceLen = SciCall_GetSelectionNAnchorVirtualSpace(s); - } - - if (virtualSpaceLen > 0) { - char* pPadStr = LocalAlloc(LPTR, (virtualSpaceLen + length + 1) * sizeof(char)); - if (pPadStr) { - SIZE_T size = LocalSize(pPadStr) - sizeof(char); - FillMemory(pPadStr, virtualSpaceLen, ' '); - pPadStr[virtualSpaceLen] = '\0'; - StringCchCatNA(pPadStr, size, pTextLine, lnLen); - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(lstrlenA(pPadStr), pPadStr); - LocalFree(pPadStr); - } - else { - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(lnLen, pTextLine); - } - } - else // no virtual space to pad - { - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(lnLen, pTextLine); - } - - SciCall_SetSelectionNCaret(s, selTargetStart); - SciCall_SetSelectionNAnchor(s, selTargetStart); - if (virtualSpaceLen > 0) { - SciCall_SetSelectionNCaretVirtualSpace(s, virtualSpaceLen); - SciCall_SetSelectionNAnchorVirtualSpace(s, virtualSpaceLen); - } - - if (*ln != '\0') { - pTextLine = ln; // next clip line - } - //else: rest of rect single selections are filled with last line - - } // for() - - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); -} - - -//============================================================================= -// -// EditPasteClipboard() -// -bool EditPasteClipboard(HWND hwnd, bool bSwapClipBoard, bool bSkipUnicodeCheck) -{ - int lineCount = 0; - int lenLastLine = 0; - - char* pClip = EditGetClipboardText(hwnd, !bSkipUnicodeCheck, &lineCount, &lenLastLine); - if (!pClip) { - return false; // recoding canceled - } - const DocPos clipLen = lstrlenA(pClip); - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - if (SciCall_IsSelectionEmpty() || (lineCount <= 1)) - { - IgnoreNotifyChangeEvent(); - - if (SciCall_IsSelectionEmpty()) // SC_SEL_THIN - { - SciCall_Paste(); - if (bSwapClipBoard) { - EditClearClipboard(hwnd); - EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1); - } - //else { - // EditSelectEx(hwnd, SciCall_GetCurrentPos(), SciCall_GetCurrentPos(), -1, -1); - //} - } - else { - char* pszText = LocalAlloc(LPTR, SciCall_GetSelText(NULL)); - SciCall_GetSelText(pszText); - if (clipLen == 0) { SciCall_Clear(); } else { SciCall_Paste(); } - if (bSwapClipBoard) { - EditSetClipboardText(hwnd, pszText); - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, SciCall_GetCurrentPos(), iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1); - } - else { - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - } - LocalFree(pszText); - } - ObserveNotifyChangeEvent(); - } - else { - if (SciCall_IsSelectionRectangle()) - { - if (bSwapClipBoard) { SciCall_Copy(); } - EditPaste2RectSel(hwnd, pClip); - //TODO: restore selection in case of swap clipboard - } - else // Selection: SC_SEL_STREAM, SC_SEL_LINES - { - IgnoreNotifyChangeEvent(); - if (bSwapClipBoard) { - SciCall_Copy(); - SciCall_ReplaceSel(pClip); - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iCurPos + clipLen, iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + clipLen, -1, -1); - } - else { - SciCall_ReplaceSel(pClip); - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iCurPos, iCurPos, -1, -1); - } - ObserveNotifyChangeEvent(); - } - } - LocalFree(pClip); - return true; -} - - -//============================================================================= -// -// EditCopyAppend() -// -bool EditCopyAppend(HWND hwnd, bool bAppend) -{ - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - char* pszText = NULL; - if (iCurPos != iAnchorPos) { - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return false; - } - else { - pszText = LocalAlloc(LPTR, SciCall_GetSelText(NULL)); - SciCall_GetSelText(pszText); - } - } - else { - DocPos cchText = SciCall_GetTextLength(); - pszText = LocalAlloc(LPTR,cchText + 1); - SciCall_GetText((DocPos)LocalSize(pszText), pszText); - } - WCHAR* pszTextW = NULL; - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,-1,NULL,0); - if (cchTextW > 0) { - int lenTxt = (cchTextW + 1); - pszTextW = LocalAlloc(LPTR,sizeof(WCHAR)*lenTxt); - MultiByteToWideChar(Encoding_SciCP,0,pszText,-1,pszTextW,lenTxt); - } - - if (pszText) - LocalFree(pszText); - - if (!bAppend) { - bool res = (bool)SetClipboardTextW(GetParent(hwnd), pszTextW); - LocalFree(pszTextW); - return res; - } - - // --- Append to Clipboard --- - - if (!OpenClipboard(GetParent(hwnd))) { - LocalFree(pszTextW); - return false; - } - - HANDLE hOld = GetClipboardData(CF_UNICODETEXT); - WCHAR* pszOld = GlobalLock(hOld); - - int sizeNew = lstrlen(pszOld) + lstrlen(pszTextW) + 1; - - const WCHAR *pszSep = L"\r\n"; - sizeNew += (int)lstrlen(pszSep); - - // Copy Clip - WCHAR* pszNewTextW = LocalAlloc(LPTR, sizeof(WCHAR) * sizeNew); - - if (pszOld) - StringCchCopy(pszNewTextW, sizeNew, pszOld); - - GlobalUnlock(hOld); - CloseClipboard(); - - - // Add New - StringCchCat(pszNewTextW, sizeNew, pszSep); - StringCchCat(pszNewTextW, sizeNew, pszTextW); - - bool res = (bool)SetClipboardTextW(GetParent(hwnd), pszNewTextW); - - LocalFree(pszNewTextW); - return res; -} - - -//============================================================================= -// -// EditDetectEOLMode() - moved here to handle Unicode files correctly -// -int EditDetectEOLMode(HWND hwnd,char* lpData,DWORD cbData) -{ - int iEOLMode = iLineEndings[g_iDefaultEOLMode]; - char *cp = (char*)lpData; - - if (!cp) - return (iEOLMode); - - while (*cp && (*cp != '\x0D' && *cp != '\x0A')) cp++; - - if (*cp == '\x0D' && *(cp+1) == '\x0A') - iEOLMode = SC_EOL_CRLF; - else if (*cp == '\x0D' && *(cp+1) != '\x0A') - iEOLMode = SC_EOL_CR; - else if (*cp == '\x0A') - iEOLMode = SC_EOL_LF; - - UNUSED(hwnd); - UNUSED(cbData); - - return (iEOLMode); -} - - - -//============================================================================= -// -// EditLoadFile() -// -bool EditLoadFile( - HWND hwnd, - LPCWSTR pszFile, - bool bSkipUTFDetection, - bool bSkipANSICPDetection, - int* iEncoding, - int* iEOLMode, - bool *pbUnicodeErr, - bool *pbFileTooBig, - bool *pbUnkownExt) -{ - if (pbUnicodeErr) - *pbUnicodeErr = false; - if (pbFileTooBig) - *pbFileTooBig = false; - if (pbUnkownExt) - *pbUnkownExt = false; - - HANDLE hFile = CreateFile(pszFile, - GENERIC_READ, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - dwLastIOError = GetLastError(); - - if (hFile == INVALID_HANDLE_VALUE) { - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - - // calculate buffer limit - DWORD dwFileSize = GetFileSize(hFile,NULL); - DWORD dwBufSize = dwFileSize + 16; - - // check for unknown extension - LPWSTR lpszExt = PathFindExtension(pszFile); - if (!Style_HasLexerForExt(lpszExt)) { - if (InfoBox(MBYESNO,L"MsgFileUnknownExt",IDS_WARN_UNKNOWN_EXT,lpszExt) != IDYES) { - CloseHandle(hFile); - if (pbUnkownExt) - *pbUnkownExt = true; - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - } - - // Check if a warning message should be displayed for large files - DWORD dwFileSizeLimit = IniGetInt(L"Settings2",L"FileLoadWarningMB",1); - if (dwFileSizeLimit != 0 && dwFileSizeLimit * 1024 * 1024 < dwFileSize) { - if (InfoBox(MBYESNO,L"MsgFileSizeWarning",IDS_WARN_LOAD_BIG_FILE) != IDYES) { - CloseHandle(hFile); - if (pbFileTooBig) - *pbFileTooBig = true; - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - } - - char* lpData = AllocMem(dwBufSize, HEAP_ZERO_MEMORY); - - dwLastIOError = GetLastError(); - if (!lpData) - { - CloseHandle(hFile); - if (pbFileTooBig) - *pbFileTooBig = false; - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - - DWORD cbData = 0L; - bool bReadSuccess = ReadAndDecryptFile(hwnd, hFile, dwBufSize - 2, &lpData, &cbData); - dwLastIOError = GetLastError(); - CloseHandle(hFile); - - if (!bReadSuccess) { - FreeMem(lpData); - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - - bool bPreferOEM = false; - if (bLoadNFOasOEM) - { - if (lpszExt && !(StringCchCompareIX(lpszExt,L".nfo") && StringCchCompareIX(lpszExt,L".diz"))) - bPreferOEM = true; - } - - const int iForcedEncoding = Encoding_SrcCmdLn(CPI_GET); - const int iFileEncWeak = Encoding_SrcWeak(CPI_GET); - - const size_t cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L; - bool bIsReliable = false; - const int iAnalyzedEncoding = bSkipANSICPDetection ? CPI_NONE : Encoding_Analyze(lpData, cbNbytes4Analysis, &bIsReliable); - - // choose best encoding guess - int iPreferedEncoding = (bPreferOEM) ? g_DOSEncoding : (bUseDefaultForFileEncoding ? g_iDefaultNewFileEncoding : CPI_ANSI_DEFAULT); - - if (iForcedEncoding != CPI_NONE) - iPreferedEncoding = iForcedEncoding; - else if (iFileEncWeak != CPI_NONE) - iPreferedEncoding = iFileEncWeak; - else if (Encoding_IsUNICODE(iAnalyzedEncoding) && !bSkipUTFDetection) - iPreferedEncoding = iAnalyzedEncoding; - else if (iAnalyzedEncoding != CPI_NONE) - iPreferedEncoding = iAnalyzedEncoding; - - - bool bBOM = false; - bool bReverse = false; - - if (cbData == 0) { - FileVars_Init(NULL,0,&fvCurFile); - *iEOLMode = iLineEndings[g_iDefaultEOLMode]; - if (iForcedEncoding == CPI_NONE) { - if (bLoadASCIIasUTF8 && !bPreferOEM) - *iEncoding = CPI_UTF8; - else - *iEncoding = iPreferedEncoding; - } - else - *iEncoding = iForcedEncoding; - - EditSetNewText(hwnd,"",0); - SendMessage(hwnd,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); - FreeMem(lpData); - } - // === UNICODE === - else if (!bSkipUTFDetection && //TODO: use Encoding_IsUNICODE(iAnalyzedEncoding) here ??? - (Encoding_IsUNICODE(iForcedEncoding) || (iForcedEncoding == CPI_NONE)) && - (Encoding_IsUNICODE(iForcedEncoding) || IsUnicode(lpData,cbData,&bBOM,&bReverse)) && - (Encoding_IsUNICODE(iForcedEncoding) || !IsUTF8Signature(lpData))) // check for UTF-8 signature - { - char* lpDataUTF8; - - if (iForcedEncoding == CPI_UNICODE) { - bBOM = (*((UNALIGNED PWCHAR)lpData) == 0xFEFF); - bReverse = false; - } - else if (iForcedEncoding == CPI_UNICODEBE) - bBOM = (*((UNALIGNED PWCHAR)lpData) == 0xFFFE); - - if (iForcedEncoding == CPI_UNICODEBE || bReverse) { - _swab(lpData,lpData,cbData); - if (bBOM) - *iEncoding = CPI_UNICODEBEBOM; - else - *iEncoding = CPI_UNICODEBE; - } - else { - if (bBOM) - *iEncoding = CPI_UNICODEBOM; - else - *iEncoding = CPI_UNICODE; - } - - lpDataUTF8 = AllocMem((cbData * 3) + 2, HEAP_ZERO_MEMORY); - - DWORD convCnt = (DWORD)WideCharToMultiByte(Encoding_SciCP,0,(bBOM) ? (LPWSTR)lpData + 1 : (LPWSTR)lpData, - (bBOM) ? (cbData)/sizeof(WCHAR) : cbData/sizeof(WCHAR) + 1,lpDataUTF8,(int)SizeOfMem(lpDataUTF8),NULL,NULL); - - if (convCnt == 0) { - if (pbUnicodeErr) - *pbUnicodeErr = true; - convCnt = (DWORD)WideCharToMultiByte(CP_ACP,0,(bBOM) ? (LPWSTR)lpData + 1 : (LPWSTR)lpData, - (-1),lpDataUTF8,(int)SizeOfMem(lpDataUTF8),NULL,NULL); - } - - if (convCnt != 0) { - FreeMem(lpData); - EditSetNewText(hwnd,"",0); - FileVars_Init(lpDataUTF8,convCnt - 1,&fvCurFile); - EditSetNewText(hwnd,lpDataUTF8,convCnt - 1); - *iEOLMode = EditDetectEOLMode(hwnd,lpDataUTF8,convCnt - 1); - FreeMem(lpDataUTF8); - } - else { - FreeMem(lpDataUTF8); - FreeMem(lpData); - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - } - - else { // === ALL OTHERS === - - FileVars_Init(lpData,cbData,&fvCurFile); - - // === UTF-8 === - if (!bSkipUTFDetection && (Encoding_IsNONE(iForcedEncoding) || Encoding_IsUTF8(iForcedEncoding)) && - ((IsUTF8Signature(lpData) || - FileVars_IsUTF8(&fvCurFile) || - (Encoding_IsUTF8(iForcedEncoding) || - Encoding_IsUTF8(iAnalyzedEncoding) || - (!bPreferOEM && bLoadASCIIasUTF8) || // from menu "Reload As UTF-8" - (IsUTF8(lpData,cbData) && ((UTF8_ContainsInvalidChars(lpData, cbData) || - (!bPreferOEM && (Encoding_IsUTF8(iPreferedEncoding) || bLoadASCIIasUTF8))))))) && - !(FileVars_IsNonUTF8(&fvCurFile) && !Encoding_IsUTF8(iForcedEncoding)))) - { - EditSetNewText(hwnd,"",0); - if (IsUTF8Signature(lpData)) { - EditSetNewText(hwnd,UTF8StringStart(lpData),cbData-3); - *iEncoding = CPI_UTF8SIGN; - *iEOLMode = EditDetectEOLMode(hwnd,UTF8StringStart(lpData),cbData-3); - } - else { - EditSetNewText(hwnd,lpData,cbData); - *iEncoding = CPI_UTF8; - *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); - } - FreeMem(lpData); - } - - else { // === ALL OTHER === - - if (!Encoding_IsNONE(iForcedEncoding)) - *iEncoding = iForcedEncoding; - else { - *iEncoding = FileVars_GetEncoding(&fvCurFile); - if (Encoding_IsNONE(*iEncoding)) { - if (fvCurFile.mask & FV_ENCODING) - *iEncoding = CPI_ANSI_DEFAULT; - else { - *iEncoding = iPreferedEncoding; - } - } - } - - if (((Encoding_GetCodePage(*iEncoding) != CP_UTF7) && Encoding_IsEXTERNAL_8BIT(*iEncoding)) || - ((Encoding_GetCodePage(*iEncoding) == CP_UTF7) && IsUTF7(lpData,cbData))) { - - UINT uCodePage = Encoding_GetCodePage(*iEncoding); - - LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); - int cbDataWide = MultiByteToWideChar(uCodePage,0,lpData,cbData,lpDataWide,(int)SizeOfMem(lpDataWide)/sizeof(WCHAR)); - if (cbDataWide != 0) - { - FreeMem(lpData); - lpData = AllocMem(cbDataWide * 3 + 16, HEAP_ZERO_MEMORY); - - cbData = WideCharToMultiByte(Encoding_SciCP,0,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,NULL); - if (cbData != 0) { - FreeMem(lpDataWide); - EditSetNewText(hwnd,"",0); - EditSetNewText(hwnd,lpData,cbData); - *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); - FreeMem(lpData); - } - else { - FreeMem(lpDataWide); - FreeMem(lpData); - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - } - else { - FreeMem(lpDataWide); - FreeMem(lpData); - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return false; - } - } - else { - *iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferedEncoding; - EditSetNewText(hwnd,"",0); - EditSetNewText(hwnd,lpData,cbData); - *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); - FreeMem(lpData); - } - } - } - - Encoding_SrcCmdLn(CPI_NONE); - Encoding_SrcWeak(CPI_NONE); - return true; - -} - - -//============================================================================= -// -// EditSaveFile() -// -bool EditSaveFile( - HWND hwnd, - LPCWSTR pszFile, - int iEncoding, - bool *pbCancelDataLoss, - bool bSaveCopy) -{ - - HANDLE hFile; - bool bWriteSuccess; - - char* lpData; - DWORD cbData; - DWORD dwBytesWritten; - - *pbCancelDataLoss = false; - - hFile = CreateFile(pszFile, - GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - dwLastIOError = GetLastError(); - - // failure could be due to missing attributes (2k/XP) - if (hFile == INVALID_HANDLE_VALUE) - { - DWORD dwAttributes = GetFileAttributes(pszFile); - if (dwAttributes != INVALID_FILE_ATTRIBUTES) - { - dwAttributes = dwAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); - hFile = CreateFile(pszFile, - GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL | dwAttributes, - NULL); - dwLastIOError = GetLastError(); - } - } - - if (hFile == INVALID_HANDLE_VALUE) - return false; - - // ensure consistent line endings - if (bFixLineEndings) { - SendMessage(hwnd,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); - EditFixPositions(hwnd); - } - - // strip trailing blanks - if (bAutoStripBlanks) - EditStripLastCharacter(hwnd, true, true); - - // get text - cbData = (DWORD)SciCall_GetTextLength(); - lpData = AllocMem(cbData + 4, HEAP_ZERO_MEMORY); //fix: +bom - SendMessage(hwnd,SCI_GETTEXT,SizeOfMem(lpData),(LPARAM)lpData); - - if (cbData == 0) { - bWriteSuccess = SetEndOfFile(hFile); - dwLastIOError = GetLastError(); - } - - else { - - // FIXME: move checks in front of disk file access - /*if ((g_Encodings[iEncoding].uFlags & NCP_UNICODE) == 0 && (g_Encodings[iEncoding].uFlags & NCP_UTF8_SIGN) == 0) { - bool bEncodingMismatch = true; - FILEVARS fv; - FileVars_Init(lpData,cbData,&fv); - if (fv.mask & FV_ENCODING) { - int iAltEncoding; - if (FileVars_IsValidEncoding(&fv)) { - iAltEncoding = FileVars_GetEncoding(&fv); - if (iAltEncoding == iEncoding) - bEncodingMismatch = false; - else if ((g_Encodings[iAltEncoding].uFlags & NCP_UTF8) && (g_Encodings[iEncoding].uFlags & NCP_UTF8)) - bEncodingMismatch = false; - } - if (bEncodingMismatch) { - Encoding_SetLabel(iAltEncoding); - Encoding_SetLabel(iEncoding); - InfoBox(0,L"MsgEncodingMismatch",IDS_ENCODINGMISMATCH, - g_Encodings[iAltEncoding].wchLabel, - g_Encodings[iEncoding].wchLabel); - } - } - }*/ - - if (Encoding_IsUNICODE(iEncoding)) - { - SetEndOfFile(hFile); - - LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); - int bomoffset = 0; - if (Encoding_IsUNICODE_BOM(iEncoding)) { - const char* bom = "\xFF\xFE"; - CopyMemory((char*)lpDataWide, bom, 2); - bomoffset = 1; - } - int cbDataWide = bomoffset + MultiByteToWideChar(Encoding_SciCP, 0, lpData, cbData, &lpDataWide[bomoffset], (int)SizeOfMem(lpDataWide) / sizeof(WCHAR) - bomoffset); - if (Encoding_IsUNICODE_REVERSE(iEncoding)) { - _swab((char*)lpDataWide, (char*)lpDataWide, cbDataWide * sizeof(WCHAR)); - } - bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpDataWide, cbDataWide * sizeof(WCHAR), &dwBytesWritten); - dwLastIOError = GetLastError(); - - FreeMem(lpDataWide); - FreeMem(lpData); - } - - else if (Encoding_IsUTF8(iEncoding)) - { - SetEndOfFile(hFile); - - if (Encoding_IsUTF8_SIGN(iEncoding)) { - const char* bom = "\xEF\xBB\xBF"; - DWORD bomoffset = 3; - MoveMemory(&lpData[bomoffset], lpData, cbData); - CopyMemory(lpData, bom, bomoffset); - cbData += bomoffset; - } - //bWriteSuccess = WriteFile(hFile,lpData,cbData,&dwBytesWritten,NULL); - bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); - dwLastIOError = GetLastError(); - - FreeMem(lpData); - } - - else if (Encoding_IsEXTERNAL_8BIT(iEncoding)) { - - BOOL bCancelDataLoss = FALSE; - UINT uCodePage = Encoding_GetCodePage(iEncoding); - - LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); - int cbDataWide = MultiByteToWideChar(Encoding_SciCP,0,lpData,cbData,lpDataWide,(int)SizeOfMem(lpDataWide)/sizeof(WCHAR)); - - if (Encoding_IsMBCS(iEncoding)) { - FreeMem(lpData); - lpData = AllocMem(SizeOfMem(lpDataWide) * 2, HEAP_ZERO_MEMORY); // need more space - cbData = WideCharToMultiByte(uCodePage, 0, lpDataWide, cbDataWide, lpData, (int)SizeOfMem(lpData), NULL, NULL); - } - else { - ZeroMemory(lpData, SizeOfMem(lpData)); - cbData = WideCharToMultiByte(uCodePage,WC_NO_BEST_FIT_CHARS,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,&bCancelDataLoss); - if (!bCancelDataLoss) { - cbData = WideCharToMultiByte(uCodePage,0,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,NULL); - bCancelDataLoss = FALSE; - } - } - FreeMem(lpDataWide); - - if (!bCancelDataLoss || InfoBox(MBOKCANCEL,L"MsgConv3",IDS_ERR_UNICODE2) == IDOK) { - SetEndOfFile(hFile); - bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); - dwLastIOError = GetLastError(); - } - else { - bWriteSuccess = false; - *pbCancelDataLoss = true; - } - - FreeMem(lpData); - } - - else { - SetEndOfFile(hFile); - bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); - dwLastIOError = GetLastError(); - FreeMem(lpData); - } - } - - CloseHandle(hFile); - - if (bWriteSuccess) - { - if (!bSaveCopy) - SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); - - return true; - } - - else - return false; - -} - - -//============================================================================= -// -// EditInvertCase() -// -void EditInvertCase(HWND hwnd) -{ - UNUSED(hwnd); - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - if (iCurPos != iAnchorPos) - { - if (!SciCall_IsSelectionRectangle()) - { - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - const DocPos iSelLength = SciCall_GetSelText(NULL); - - char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); - LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); - - if (pszText == NULL || pszTextW == NULL) { - FreeMem(pszText); - FreeMem(pszTextW); - return; - } - SciCall_GetSelText(pszText); - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); - - bool bChanged = false; - for (int i = 0; i < cchTextW; i++) { - if (IsCharUpperW(pszTextW[i])) { - pszTextW[i] = LOWORD(CharLowerW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); - bChanged = true; - } - else if (IsCharLowerW(pszTextW[i])) { - pszTextW[i] = LOWORD(CharUpperW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); - bChanged = true; - } - } - - if (bChanged) { - - WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); - - SciCall_Clear(); - SciCall_AddText((iSelEnd - iSelStart), pszText); - SciCall_SetSel(iAnchorPos, iCurPos); - } - - FreeMem(pszText); - FreeMem(pszTextW); - } - else - MsgBox(MBWARN,IDS_SELRECT); - } -} - - -//============================================================================= -// -// EditTitleCase() -// -void EditTitleCase(HWND hwnd) -{ - UNUSED(hwnd); - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - if (iCurPos != iAnchorPos) - { - if (!SciCall_IsSelectionRectangle()) - { - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - const DocPos iSelLength = SciCall_GetSelText(NULL); - - char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); - LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); - - if (pszText == NULL || pszTextW == NULL) { - FreeMem(pszText); - FreeMem(pszTextW); - return; - } - SciCall_GetSelText(pszText); - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); - - bool bChanged = false; - LPWSTR pszMappedW = LocalAlloc(LPTR,SizeOfMem(pszTextW)); - // first make lower case, before applying TitleCase - if (LCMapString(LOCALE_SYSTEM_DEFAULT,(LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE), pszTextW,cchTextW,pszMappedW,(int)iSelLength)) - { - if (LCMapString(LOCALE_SYSTEM_DEFAULT,LCMAP_TITLECASE,pszMappedW,cchTextW,pszTextW,(int)iSelLength)) { - bChanged = true; - } - } - LocalFree(pszMappedW); - - if (bChanged) { - - WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); - - SciCall_Clear(); - SciCall_AddText((iSelEnd - iSelStart), pszText); - SciCall_SetSel(iAnchorPos, iCurPos); - } - - FreeMem(pszText); - FreeMem(pszTextW); - } - else - MsgBox(MBWARN,IDS_SELRECT); - } -} - - -//============================================================================= -// -// EditSentenceCase() -// -void EditSentenceCase(HWND hwnd) -{ - UNUSED(hwnd); - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - if (iCurPos != iAnchorPos) - { - if (!SciCall_IsSelectionRectangle()) - { - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - const DocPos iSelLength = SciCall_GetSelText(NULL); - - char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); - LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); - - if (pszText == NULL || pszTextW == NULL) { - FreeMem(pszText); - FreeMem(pszTextW); - return; - } - SciCall_GetSelText(pszText); - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); - - bool bChanged = false; - bool bNewSentence = true; - for (int i = 0; i < cchTextW; i++) { - if (StrChr(L".;!?\r\n",pszTextW[i])) { - bNewSentence = true; - } - else { - if (IsCharAlphaNumericW(pszTextW[i])) { - if (bNewSentence) { - if (IsCharLowerW(pszTextW[i])) { - pszTextW[i] = LOWORD(CharUpperW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); - bChanged = true; - } - bNewSentence = false; - } - else { - if (IsCharUpperW(pszTextW[i])) { - pszTextW[i] = LOWORD(CharLowerW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); - bChanged = true; - } - } - } - } - } - - if (bChanged) { - - WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); - - SciCall_Clear(); - SciCall_AddText((iSelEnd - iSelStart), pszText); - SciCall_SetSel(iAnchorPos, iCurPos); - } - - FreeMem(pszText); - FreeMem(pszTextW); - } - else - MsgBox(MBWARN,IDS_SELRECT); - } -} - - -//============================================================================= -// -// EditURLEncode() -// -void EditURLEncode(HWND hwnd) -{ - if (SciCall_IsSelectionEmpty()) { return; } - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelLength = SciCall_GetSelText(NULL); - - const char* pszText = (const char*)SciCall_GetRangePointer(min(iCurPos, iAnchorPos), iSelLength); - - LPWSTR pszTextW = LocalAlloc(LPTR, (iSelLength * sizeof(WCHAR))); - if (pszTextW == NULL) { - return; - } - - /*int cchTextW =*/ MultiByteToWideChar(Encoding_SciCP, 0, pszText, (int)(iSelLength-1), pszTextW, (int)iSelLength); - - char* pszEscaped = LocalAlloc(LPTR, iSelLength * 3); - if (pszEscaped == NULL) { - LocalFree(pszTextW); - return; - } - - LPWSTR pszEscapedW = LocalAlloc(LPTR, LocalSize(pszTextW) * 3); - if (pszEscapedW == NULL) { - LocalFree(pszTextW); - LocalFree(pszEscaped); - return; - } - - DWORD cchEscapedW = (int)LocalSize(pszEscapedW) / sizeof(WCHAR); - UrlEscape(pszTextW, pszEscapedW, &cchEscapedW, URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_PERCENT | URL_ESCAPE_AS_UTF8); - - DWORD cchEscaped = WideCharToMultiByte(Encoding_SciCP, 0, pszEscapedW, cchEscapedW, pszEscaped, (int)LocalSize(pszEscaped), NULL, NULL); - - EditEnterTargetTransaction(); - if (iCurPos < iAnchorPos) - SciCall_SetTargetRange(iCurPos, iAnchorPos); - else - SciCall_SetTargetRange(iAnchorPos, iCurPos); - - SciCall_ReplaceTarget(cchEscaped, pszEscaped); - EditLeaveTargetTransaction(); - - - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iCurPos + cchEscaped, iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cchEscaped, -1, -1); - - LocalFree(pszTextW); - LocalFree(pszEscaped); - LocalFree(pszEscapedW); -} - - -//============================================================================= -// -// EditURLDecode() -// -void EditURLDecode(HWND hwnd) -{ - if (SciCall_IsSelectionEmpty()) { return; } - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelLength = SciCall_GetSelText(NULL); - - const char* pszText = (const char*)SciCall_GetRangePointer(min(iCurPos, iAnchorPos), iSelLength); - - LPWSTR pszTextW = LocalAlloc(LPTR, (iSelLength * sizeof(WCHAR))); - if (pszTextW == NULL) { - return; - } - - /*int cchTextW =*/ MultiByteToWideChar(Encoding_SciCP, 0, pszText, (int)(iSelLength-1), pszTextW, (int)iSelLength); - - char* pszUnescaped = LocalAlloc(LPTR, iSelLength * 3); - if (pszUnescaped == NULL) { - LocalFree(pszTextW); - return; - } - - LPWSTR pszUnescapedW = LocalAlloc(LPTR, LocalSize(pszTextW) * 3); - if (pszUnescapedW == NULL) { - LocalFree(pszTextW); - LocalFree(pszUnescaped); - return; - } - - DWORD cchUnescapedW = (int)LocalSize(pszUnescapedW) / sizeof(WCHAR); - - UrlUnescapeEx(pszTextW, pszUnescapedW, &cchUnescapedW); - - DWORD cchUnescaped = WideCharToMultiByte(Encoding_SciCP, 0, pszUnescapedW, cchUnescapedW, pszUnescaped, (int)LocalSize(pszUnescaped), NULL, NULL); - - EditEnterTargetTransaction(); - if (iCurPos < iAnchorPos) - SciCall_SetTargetRange(iCurPos, iAnchorPos); - else - SciCall_SetTargetRange(iAnchorPos, iCurPos); - - SciCall_ReplaceTarget(cchUnescaped, pszUnescaped); - EditLeaveTargetTransaction(); - - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iCurPos + cchUnescaped, iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cchUnescaped, -1, -1); - - LocalFree(pszTextW); - LocalFree(pszUnescaped); - LocalFree(pszUnescapedW); - -} - - -//============================================================================= -// -// EditEscapeCChars() -// -void EditEscapeCChars(HWND hwnd) { - - if (!SciCall_IsSelectionEmpty()) - { - if (SciCall_IsSelectionRectangle()) - { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - EDITFINDREPLACE efr = EFR_INIT_DATA; - efr.hwnd = hwnd; - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\"); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\\"); - EditReplaceAllInSelection(hwnd,&efr,false); - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\""); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\""); - EditReplaceAllInSelection(hwnd,&efr,false); - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\'"); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\'"); - EditReplaceAllInSelection(hwnd,&efr,false); - } -} - - -//============================================================================= -// -// EditUnescapeCChars() -// -void EditUnescapeCChars(HWND hwnd) { - - if (!SciCall_IsSelectionEmpty()) - { - if (SciCall_IsSelectionRectangle()) - { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - EDITFINDREPLACE efr = EFR_INIT_DATA; - efr.hwnd = hwnd; - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\\"); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\"); - EditReplaceAllInSelection(hwnd,&efr,false); - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\""); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\""); - EditReplaceAllInSelection(hwnd,&efr,false); - - StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\'"); - StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\'"); - EditReplaceAllInSelection(hwnd,&efr,false); - } -} - - -//============================================================================= -// -// EditChar2Hex() -// -void EditChar2Hex(HWND hwnd) { - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelStart = SciCall_GetSelectionStart(); - DocPos iSelEnd = SciCall_GetSelectionEnd(); - - if (iCurPos == iAnchorPos) { - iSelEnd = SciCall_PositionAfter(iCurPos); - } - - char ch[32] = { '\0' }; - WCHAR wch[32] = { L'\0' }; - - EditSelectEx(hwnd, iSelStart, iSelEnd, -1, -1); - - //TODO: iterate over complete selection? - if (SciCall_GetSelText(NULL) <= COUNTOF(ch)) { - SciCall_GetSelText(ch); - } - - if (ch[0] == '\0') { - StringCchCopyA(ch, COUNTOF(ch), "\\x00"); - } - else { - MultiByteToWideCharStrg(Encoding_SciCP, ch, wch); - if (wch[0] <= 0xFF) - StringCchPrintfA(ch, COUNTOF(ch), "\\x%02X", wch[0] & 0xFF); - else - StringCchPrintfA(ch, COUNTOF(ch), "\\u%04X", wch[0]); - } - SendMessage(hwnd, SCI_REPLACESEL, 0, (LPARAM)ch); - - const DocPos iReplLen = StringCchLenA(ch, COUNTOF(ch)); - - if (iCurPos < iAnchorPos) { - EditSelectEx(hwnd, iCurPos + iReplLen, iCurPos, -1, -1); - } - else if (iCurPos > iAnchorPos) { - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + iReplLen, -1, -1); - } - else { // empty selection - EditSelectEx(hwnd, iCurPos + iReplLen, iCurPos + iReplLen, -1, -1); - } -} - - -//============================================================================= -// -// EditHex2Char() -// -void EditHex2Char(HWND hwnd) -{ - if (SciCall_IsSelectionEmpty()) { return; } - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - char ch[32] = { L'\0' }; - if (SciCall_GetSelText(NULL) <= COUNTOF(ch)) - { - bool bTrySelExpand = false; - - SciCall_GetSelText(ch); - - if (StrChrIA(ch, ' ') || StrChrIA(ch, '\t') || StrChrIA(ch, '\r') || StrChrIA(ch, '\n') || StrChrIA(ch, '-')) { - return; - } - - if (StrCmpNIA(ch, "\\x", 2) == 0 || StrCmpNIA(ch, "\\u", 2) == 0) { - ch[0] = '0'; - ch[1] = 'x'; - } - else if (StrChrIA("xu", ch[0])) { - ch[0] = '0'; - bTrySelExpand = true; - } - else - return; - - int i = 0; - if (sscanf_s(ch, "%x", &i) == 1) { - int cch = 0; - if (i == 0) { - ch[0] = 0; - cch = 1; - } - else { - WCHAR wch[8] = { L'\0' }; - StringCchPrintfW(wch, COUNTOF(wch), L"%lc", (WCHAR)i); - cch = WideCharToMultiByteStrg(Encoding_SciCP, wch, ch) - 1; - - if (bTrySelExpand && (char)SendMessage(hwnd, SCI_GETCHARAT, (WPARAM)iSelStart - 1, 0) == '\\') { - --iSelStart; - if (iCurPos < iAnchorPos) { --iCurPos; } else { --iAnchorPos; } - } - } - EditSelectEx(hwnd, iSelStart, iSelEnd, -1, -1); - SendMessage(hwnd, SCI_REPLACESEL, 0, (LPARAM)ch); - - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iCurPos + cch, iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cch, -1, -1); - - } - } -} - - -//============================================================================= -// -// EditFindMatchingBrace() -// -void EditFindMatchingBrace(HWND hwnd) -{ - bool bIsAfter = false; - DocPos iMatchingBracePos = (DocPos)-1; - const DocPos iCurPos = SciCall_GetCurrentPos(); - const char c = SciCall_GetCharAt(iCurPos); - if (StrChrA("()[]{}", c)) { - iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iCurPos, 0); - } - else { // Try one before - const DocPos iPosBefore = SciCall_PositionBefore(iCurPos); - const char cb = SciCall_GetCharAt(iPosBefore); - if (StrChrA("()[]{}", cb)) { - iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPosBefore, 0); - } - bIsAfter = true; - } - if (iMatchingBracePos != (DocPos)-1) { - iMatchingBracePos = bIsAfter ? iMatchingBracePos : SciCall_PositionAfter(iMatchingBracePos); - EditSelectEx(hwnd, iMatchingBracePos, iMatchingBracePos, -1, -1); - } -} - - -//============================================================================= -// -// EditSelectToMatchingBrace() -// -void EditSelectToMatchingBrace(HWND hwnd) -{ - bool bIsAfter = false; - DocPos iMatchingBracePos = -1; - const DocPos iCurPos = SciCall_GetCurrentPos(); - const char c = SciCall_GetCharAt(iCurPos); - if (StrChrA("()[]{}", c)) { - iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iCurPos, 0); - } - else { // Try one before - const DocPos iPosBefore = SciCall_PositionBefore(iCurPos); - const char cb = SciCall_GetCharAt(iPosBefore); - if (StrChrA("()[]{}", cb)) { - iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPosBefore, 0); - } - bIsAfter = true; - } - if (iMatchingBracePos != (DocPos)-1) { - if (bIsAfter) - EditSelectEx(hwnd, iCurPos, iMatchingBracePos, -1, -1); - else - EditSelectEx(hwnd, iCurPos, SciCall_PositionAfter(iMatchingBracePos), -1, -1); - } -} - - -//============================================================================= -// -// EditModifyNumber() -// -void EditModifyNumber(HWND hwnd,bool bIncrease) { - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - if ((iSelEnd - iSelStart) > 0) { - char chNumber[32] = { '\0' }; - if (SciCall_GetSelText(NULL) <= COUNTOF(chNumber)) - { - SciCall_GetSelText(chNumber); - - if (StrChrIA(chNumber, '-')) - return; - - int iNumber; - int iWidth; - char chFormat[32] = { '\0' }; - if (!StrChrIA(chNumber, 'x') && sscanf_s(chNumber, "%d", &iNumber) == 1) { - iWidth = (int)StringCchLenA(chNumber, COUNTOF(chNumber)); - if (iNumber >= 0) { - if (bIncrease && iNumber < INT_MAX) - iNumber++; - if (!bIncrease && iNumber > 0) - iNumber--; - - StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%0%ii", iWidth); - StringCchPrintfA(chNumber, COUNTOF(chNumber), chFormat, iNumber); - SciCall_ReplaceSel(chNumber); - SciCall_SetSel(iSelStart, iSelStart + StringCchLenA(chNumber, COUNTOF(chNumber))); - } - } - else if (sscanf_s(chNumber, "%x", &iNumber) == 1) { - bool bUppercase = false; - iWidth = (int)StringCchLenA(chNumber, COUNTOF(chNumber)) - 2; - if (iNumber >= 0) { - if (bIncrease && iNumber < INT_MAX) - iNumber++; - if (!bIncrease && iNumber > 0) - iNumber--; - for (int i = (int)StringCchLenA(chNumber, COUNTOF(chNumber)) - 1; i >= 0; i--) { - if (IsCharLowerA(chNumber[i])) - break; - else if (IsCharUpper(chNumber[i])) { - bUppercase = true; - break; - } - } - if (bUppercase) - StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%#0%iX", iWidth); - else - StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%#0%ix", iWidth); - - StringCchPrintfA(chNumber, COUNTOF(chNumber), chFormat, iNumber); - SciCall_ReplaceSel(chNumber); - SciCall_SetSel(iSelStart, iSelStart + StringCchLenA(chNumber, COUNTOF(chNumber))); - } - } - } - } - UNUSED(hwnd); -} - - -//============================================================================= -// -// EditTabsToSpaces() -// -void EditTabsToSpaces(HWND hwnd,int nTabWidth,bool bOnlyIndentingWS) -{ - if (SciCall_IsSelectionEmpty()) { return; } // no selection - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN,IDS_SELRECT); - return; - } - - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - DocPos iSelStart = SciCall_GetSelectionStart(); - //DocLn iLine = SciCall_LineFromPosition(iSelStart); - //iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line - DocPos iSelEnd = SciCall_GetSelectionEnd(); - DocPos iSelCount = (iSelEnd - iSelStart); - - - const char* pszText = SciCall_GetRangePointer(iSelStart, iSelCount); - - LPWSTR pszTextW = AllocMem((iSelCount + 1) * sizeof(WCHAR), HEAP_ZERO_MEMORY); - if (pszTextW == NULL) { return; } - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)iSelCount+1); - - LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)*nTabWidth+2, HEAP_ZERO_MEMORY); - if (pszConvW == NULL) { - FreeMem(pszTextW); - return; - } - - int cchConvW = 0; - - // Contributed by Homam - // Thank you very much! - int i = 0; - bool bIsLineStart = true; - bool bModified = false; - for (int iTextW = 0; iTextW < cchTextW; iTextW++) - { - WCHAR w = pszTextW[iTextW]; - if (w == L'\t' && (!bOnlyIndentingWS || bIsLineStart)) { - for (int j = 0; j < nTabWidth - i % nTabWidth; j++) - pszConvW[cchConvW++] = L' '; - i = 0; - bModified = true; - } - else { - i++; - if (w == L'\n' || w == L'\r') { - i = 0; - bIsLineStart = true; - } - else if (w != L' ') - bIsLineStart = false; - pszConvW[cchConvW++] = w; - } - } - - FreeMem(pszTextW); - - if (bModified) { - char* pszText2 = AllocMem(cchConvW*3, HEAP_ZERO_MEMORY); - - int cchConvM = WideCharToMultiByte(Encoding_SciCP,0,pszConvW,cchConvW,pszText2,(int)SizeOfMem(pszText2),NULL,NULL); - - if (iCurPos < iAnchorPos) { - iCurPos = iSelStart; - iAnchorPos = iSelStart + cchConvM; - } - else { - iAnchorPos = iSelStart; - iCurPos = iSelStart + cchConvM; - } - - EditEnterTargetTransaction(); - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText2); - EditLeaveTargetTransaction(); - - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - - FreeMem(pszText2); - } - - FreeMem(pszConvW); -} - - -//============================================================================= -// -// EditSpacesToTabs() -// -void EditSpacesToTabs(HWND hwnd,int nTabWidth,bool bOnlyIndentingWS) -{ - if (SciCall_IsSelectionEmpty()) { return; } // no selection - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - DocPos iSelStart = SciCall_GetSelectionStart(); - //DocLn iLine = SciCall_LineFromPosition(iSelStart); - //iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line - DocPos iSelEnd = SciCall_GetSelectionEnd(); - DocPos iSelCount = (iSelEnd - iSelStart); - - const char* pszText = SciCall_GetRangePointer(iSelStart, iSelCount); - - LPWSTR pszTextW = AllocMem((iSelCount + 1) * sizeof(WCHAR), HEAP_ZERO_MEMORY); - if (pszTextW == NULL) - { - return; - } - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)iSelCount+1); - - LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)+2, HEAP_ZERO_MEMORY); - if (pszConvW == NULL) { - FreeMem(pszTextW); - return; - } - - int cchConvW = 0; - - // Contributed by Homam - // Thank you very much! - int i = 0; - int j = 0; - bool bIsLineStart = true; - bool bModified = false; - WCHAR space[256] = { L'\0' }; - for (int iTextW = 0; iTextW < cchTextW; iTextW++) - { - WCHAR w = pszTextW[iTextW]; - if ((w == L' ' || w == L'\t') && (!bOnlyIndentingWS || bIsLineStart)) { - space[j++] = w; - if (j == nTabWidth - i % nTabWidth || w == L'\t') { - if (j > 1 || pszTextW[iTextW+1] == L' ' || pszTextW[iTextW+1] == L'\t') - pszConvW[cchConvW++] = L'\t'; - else - pszConvW[cchConvW++] = w; - i = j = 0; - bModified = bModified || (w != pszConvW[cchConvW-1]); - } - } - else { - i += j + 1; - if (j > 0) { - //space[j] = '\0'; - for (int t = 0; t < j; t++) - pszConvW[cchConvW++] = space[t]; - j = 0; - } - if (w == L'\n' || w == L'\r') { - i = 0; - bIsLineStart = true; - } - else - bIsLineStart = false; - pszConvW[cchConvW++] = w; - } - } - if (j > 0) { - for (int t = 0; t < j; t++) - pszConvW[cchConvW++] = space[t]; - } - - FreeMem(pszTextW); - - if (bModified || cchConvW != cchTextW) { - char* pszText2 = AllocMem(cchConvW * 3, HEAP_ZERO_MEMORY); - - int cchConvM = WideCharToMultiByte(Encoding_SciCP,0,pszConvW,cchConvW,pszText2,(int)SizeOfMem(pszText2),NULL,NULL); - - if (iAnchorPos > iCurPos) { - iCurPos = iSelStart; - iAnchorPos = iSelStart + cchConvM; - } - else { - iAnchorPos = iSelStart; - iCurPos = iSelStart + cchConvM; - } - - EditEnterTargetTransaction(); - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText2); - EditLeaveTargetTransaction(); - - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - - FreeMem(pszText2); - } - - FreeMem(pszConvW); -} - - -//============================================================================= -// -// EditMoveUp() -// -void EditMoveUp(HWND hwnd) -{ - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - } - else { - SendMessage(hwnd, SCI_MOVESELECTEDLINESUP, 0, 0); - } -} - - -//============================================================================= -// -// EditMoveDown() -// -void EditMoveDown(HWND hwnd) -{ - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - } - else { - SendMessage(hwnd, SCI_MOVESELECTEDLINESDOWN, 0, 0); - } -} - - -//============================================================================= -// -// EditJumpToSelectionStart() -// -void EditJumpToSelectionStart(HWND hwnd) -{ - UNUSED(hwnd); - if (!SciCall_IsSelectionRectangle()) { - if (SciCall_GetCurrentPos() != SciCall_GetSelectionStart()) { - SciCall_SwapMainAnchorCaret(); - } - } -} - -//============================================================================= -// -// EditJumpToSelectionEnd() -// -void EditJumpToSelectionEnd(HWND hwnd) -{ - UNUSED(hwnd); - if (!SciCall_IsSelectionRectangle()) { - if (SciCall_GetCurrentPos() != SciCall_GetSelectionEnd()) { - SciCall_SwapMainAnchorCaret(); - } - } -} - - -//============================================================================= -// -// EditModifyLines() -// -void EditModifyLines(HWND hwnd,LPCWSTR pwszPrefix,LPCWSTR pwszAppend) -{ - bool bAppendNum = false; - char mszPrefix1[256*3] = { '\0' }; - char mszAppend1[256*3] = { '\0' }; - - DocPos iSelStart = SciCall_GetSelectionStart(); - DocPos iSelEnd = SciCall_GetSelectionEnd(); - - if (lstrlen(pwszPrefix)) - WideCharToMultiByteStrg(Encoding_SciCP,pwszPrefix,mszPrefix1); - if (lstrlen(pwszAppend)) - WideCharToMultiByteStrg(Encoding_SciCP,pwszAppend,mszAppend1); - - if (!SciCall_IsSelectionRectangle()) - { - DocLn iLine; - - DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - - //if (iSelStart > SendMessage(hwnd,SCI_POSITIONFROMLINE,(WPARAM)iLineStart,0)) - // iLineStart++; - - if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) - { - if ((iLineEnd - iLineStart) >= 1) - --iLineEnd; - } - - bool bPrefixNum = false; - DocLn iPrefixNum = 0; - int iPrefixNumWidth = 1; - DocLn iAppendNum = 0; - int iAppendNumWidth = 1; - char* pszPrefixNumPad = ""; - char* pszAppendNumPad = ""; - char mszPrefix2[256*3] = { '\0' }; - char mszAppend2[256*3] = { '\0' }; - - if (StringCchLenA(mszPrefix1,COUNTOF(mszPrefix1))) - { - char* p = StrStrA(mszPrefix1, "$("); - while (!bPrefixNum && p) { - - if (StrCmpNA(p,"$(I)",CSTRLEN("$(I)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(I)")); - bPrefixNum = true; - iPrefixNum = 0; - for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = ""; - } - - else if (StrCmpNA(p,"$(0I)",CSTRLEN("$(0I)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0I)")); - bPrefixNum = true; - iPrefixNum = 0; - for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = "0"; - } - - else if (StrCmpNA(p,"$(N)",CSTRLEN("$(N)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(N)")); - bPrefixNum = true; - iPrefixNum = 1; - for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = ""; - } - - else if (StrCmpNA(p,"$(0N)",CSTRLEN("$(0N)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0N)")); - bPrefixNum = true; - iPrefixNum = 1; - for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = "0"; - } - - else if (StrCmpNA(p,"$(L)",CSTRLEN("$(L)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(L)")); - bPrefixNum = true; - iPrefixNum = iLineStart+1; - for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = ""; - } - - else if (StrCmpNA(p,"$(0L)",CSTRLEN("$(0L)")) == 0) { - *p = 0; - StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0L)")); - bPrefixNum = true; - iPrefixNum = iLineStart+1; - for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) - iPrefixNumWidth++; - pszPrefixNumPad = "0"; - } - p += CSTRLEN("$("); - p = StrStrA(p, "$("); // next - } - } - - if (StringCchLenA(mszAppend1,COUNTOF(mszAppend1))) - { - char* p = StrStrA(mszAppend1, "$("); - while (!bAppendNum && p) { - - if (StrCmpNA(p,"$(I)",CSTRLEN("$(I)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(I)")); - bAppendNum = true; - iAppendNum = 0; - for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = ""; - } - - else if (StrCmpNA(p,"$(0I)",CSTRLEN("$(0I)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0I)")); - bAppendNum = true; - iAppendNum = 0; - for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = "0"; - } - - else if (StrCmpNA(p,"$(N)",CSTRLEN("$(N)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(N)")); - bAppendNum = true; - iAppendNum = 1; - for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = ""; - } - - else if (StrCmpNA(p,"$(0N)",CSTRLEN("$(0N)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0N)")); - bAppendNum = true; - iAppendNum = 1; - for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = "0"; - } - - else if (StrCmpNA(p,"$(L)",CSTRLEN("$(L)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(L)")); - bAppendNum = true; - iAppendNum = iLineStart+1; - for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = ""; - } - - else if (StrCmpNA(p,"$(0L)",CSTRLEN("$(0L)")) == 0) { - *p = 0; - StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0L)")); - bAppendNum = true; - iAppendNum = iLineStart+1; - for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) - iAppendNumWidth++; - pszAppendNumPad = "0"; - } - p += CSTRLEN("$("); - p = StrStrA(p, "$("); // next - } - } - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - for (iLine = iLineStart; iLine <= iLineEnd; iLine++) - { - DocPos iPos; - - if (lstrlen(pwszPrefix)) { - - char mszInsert[512*3] = { '\0' }; - StringCchCopyA(mszInsert,COUNTOF(mszInsert),mszPrefix1); - - if (bPrefixNum) { - char tchFmt[64] = { '\0' }; - char tchNum[64] = { '\0' }; - StringCchPrintfA(tchFmt,COUNTOF(tchFmt),"%%%s%ii",pszPrefixNumPad,iPrefixNumWidth); - StringCchPrintfA(tchNum,COUNTOF(tchNum),tchFmt,iPrefixNum); - StringCchCatA(mszInsert,COUNTOF(mszInsert),tchNum); - StringCchCatA(mszInsert,COUNTOF(mszInsert),mszPrefix2); - iPrefixNum++; - } - iPos = SciCall_PositionFromLine(iLine); - SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, iPos); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszInsert); - } - - if (lstrlen(pwszAppend)) { - - char mszInsert[512*3] = { '\0' }; - StringCchCopyA(mszInsert,COUNTOF(mszInsert),mszAppend1); - - if (bAppendNum) { - char tchFmt[64] = { '\0' }; - char tchNum[64] = { '\0' }; - StringCchPrintfA(tchFmt,COUNTOF(tchFmt),"%%%s%ii",pszAppendNumPad,iAppendNumWidth); - StringCchPrintfA(tchNum,COUNTOF(tchNum),tchFmt,iAppendNum); - StringCchCatA(mszInsert,COUNTOF(mszInsert),tchNum); - StringCchCatA(mszInsert,COUNTOF(mszInsert),mszAppend2); - iAppendNum++; - } - iPos = SciCall_GetLineEndPosition(iLine); - SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, iPos); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszInsert); - } - } - - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - - // extend selection to start of first line - // the above code is not required when last line has been excluded - if (iSelStart != iSelEnd) - { - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - if (iCurPos < iAnchorPos) { - iCurPos = SciCall_PositionFromLine(iLineStart); - iAnchorPos = SciCall_PositionFromLine(iLineEnd + 1); - } - else { - iAnchorPos = SciCall_PositionFromLine(iLineStart); - iCurPos = SciCall_PositionFromLine(iLineEnd + 1); - } - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - } - } - else - MsgBox(MBWARN,IDS_SELRECT); -} - - -//============================================================================= -// -// EditIndentBlock() -// -void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation) -{ - if ((cmd != SCI_TAB) && (cmd != SCI_BACKTAB)) { - SendMessage(hwnd, cmd, 0, 0); - return; - } - - if (SciCall_IsSelectionRectangle()) - { - //if (cmd == SCI_TAB) { - // if (g_bTabsAsSpaces) { - // int size = (bFormatIndentation ? g_iIndentWidth : g_iTabWidth); - // char* pPadStr = LocalAlloc(LPTR, size + 1); - // FillMemory(pPadStr, size, ' '); - // EditPaste2RectSel(hwnd, pPadStr); - // LocalFree(pPadStr); - // } - // else { - // EditPaste2RectSel(hwnd, "\t"); - // } - // return; - //} - // better idea: EditPaste2RectSel(hwnd, pPadStr, pText); pText==NULL => copy single sel - - //TODO: workaround for rectangular selection: make stream selection - EditSelectEx(hwnd, SciCall_GetAnchor(), SciCall_GetCurrentPos(), -1, -1); - } - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - //const DocPos iSelStart = SciCall_GetSelectionStart(); - //const DocPos iSelEnd = SciCall_GetSelectionEnd(); - const DocLn iCurLine = SciCall_LineFromPosition(iCurPos); - const DocLn iAnchorLine = SciCall_LineFromPosition(iAnchorPos); - const bool bSingleLine = Sci_IsSingleLineSelection(); - - const bool _bTabIndents = (bool)SendMessage(hwnd, SCI_GETTABINDENTS, 0, 0); - const bool _bBSpUnindents = (bool)SendMessage(hwnd, SCI_GETBACKSPACEUNINDENTS, 0, 0); - - DocPos iDiffCurrent = 0; - DocPos iDiffAnchor = 0; - bool bFixStart = false; - - if (bSingleLine) { - if (bFormatIndentation) { - SendMessage(hwnd, SCI_VCHOME, 0, 0); - if (SciCall_PositionFromLine(iCurLine) == SciCall_GetCurrentPos()) { - SendMessage(hwnd, SCI_VCHOME, 0, 0); - } - iDiffCurrent = (iCurPos - SciCall_GetCurrentPos()); - } - } - else { - iDiffCurrent = (SciCall_GetLineEndPosition(iCurLine) - iCurPos); - iDiffAnchor = (SciCall_GetLineEndPosition(iAnchorLine) - iAnchorPos); - if (iCurPos < iAnchorPos) - bFixStart = (SciCall_PositionFromLine(iCurLine) == SciCall_GetCurrentPos()); - else - bFixStart = (SciCall_PositionFromLine(iAnchorLine) == SciCall_GetAnchor()); - } - - if (cmd == SCI_TAB) - { - SendMessage(hwnd, SCI_SETTABINDENTS, (bFormatIndentation ? true : _bTabIndents), 0); - SendMessage(hwnd, SCI_TAB, 0, 0); - if (bFormatIndentation) - SendMessage(hwnd, SCI_SETTABINDENTS, _bTabIndents, 0); - } - else // SCI_BACKTAB - { - //if (SciCall_PositionFromLine(iCurLine) != SciCall_GetSelectionStart()) - SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, (bFormatIndentation ? true : _bBSpUnindents), 0); - SendMessage(hwnd, SCI_BACKTAB, 0, 0); - if (bFormatIndentation) - SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, _bBSpUnindents, 0); - } - - if (bSingleLine) { - if (bFormatIndentation) - EditSelectEx(hwnd, SciCall_GetCurrentPos() + iDiffCurrent + (iAnchorPos - iCurPos), SciCall_GetCurrentPos() + iDiffCurrent, -1, -1); - } - else { // on multiline indentation, anchor and current positions are moved to line begin resp. end - if (bFixStart) { - if (iCurPos < iAnchorPos) - iDiffCurrent = SciCall_LineLength(iCurLine) - Sci_GetEOLLen(); - else - iDiffAnchor = SciCall_LineLength(iAnchorLine) - Sci_GetEOLLen(); - } - EditSelectEx(hwnd, SciCall_GetLineEndPosition(iAnchorLine) - iDiffAnchor, SciCall_GetLineEndPosition(iCurLine) - iDiffCurrent, -1, -1); - } -} - - -//============================================================================= -// -// EditAlignText() -// -void EditAlignText(HWND hwnd,int nMode) -{ - #define BUFSIZE_ALIGN 1024 - - bool bModified = false; - - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - if (!SciCall_IsSelectionRectangle()) - { - DocLn iLine; - DocPos iMinIndent = BUFSIZE_ALIGN; - DocPos iMaxLength = 0; - - DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - - if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) - { - if ((iLineEnd - iLineStart) >= 1) - --iLineEnd; - } - - for (iLine = iLineStart; iLine <= iLineEnd; iLine++) { - - DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine); - const DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine); - - if (iLineIndentPos != iLineEndPos) - { - const DocPos iIndentCol = (DocPos)SendMessage(hwnd,SCI_GETLINEINDENTATION,(WPARAM)iLine,0); - DocPos iTail; - - iTail = iLineEndPos-1; - char ch = (char)SendMessage(hwnd,SCI_GETCHARAT,(WPARAM)iTail,0); - while (iTail >= iLineStart && (ch == ' ' || ch == '\t')) - { - --iTail; - ch = (char)SendMessage(hwnd,SCI_GETCHARAT,(WPARAM)iTail,0); - --iLineEndPos; - } - const DocPos iEndCol = SciCall_GetColumn(iLineEndPos); - - iMinIndent = min(iMinIndent,iIndentCol); - iMaxLength = max(iMaxLength,iEndCol); - } - } - - if (iMaxLength < BUFSIZE_ALIGN) { - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - for (iLine = iLineStart; iLine <= iLineEnd; iLine++) - { - DocPos iEndPos = SciCall_GetLineEndPosition(iLine); - DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); - - if ((iIndentPos == iEndPos) && (iEndPos > 0)) { - - if (!bModified) { - SendMessage(hwnd, SCI_BEGINUNDOACTION, 0, 0); - bModified = true; - } - SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), iEndPos); - SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)""); - } - - else { - - char tchLineBuf[BUFSIZE_ALIGN*3] = { '\0' }; - WCHAR wchLineBuf[BUFSIZE_ALIGN*3] = L""; - WCHAR *pWords[BUFSIZE_ALIGN*3/2]; - WCHAR *p = wchLineBuf; - - int iWords = 0; - int iWordsLength = 0; - DocPos cchLine = SciCall_GetLine(iLine, tchLineBuf); - - if (!bModified) { - SendMessage(hwnd, SCI_BEGINUNDOACTION, 0, 0); - bModified = true; - } - - MultiByteToWideChar(Encoding_SciCP,0,tchLineBuf,(int)cchLine,wchLineBuf,COUNTOF(wchLineBuf)); - StrTrim(wchLineBuf,L"\r\n\t "); - - while (*p) { - if (*p != L' ' && *p != L'\t') { - pWords[iWords++] = p++; - iWordsLength++; - while (*p && *p != L' ' && *p != L'\t') { - p++; - iWordsLength++; - } - } - else - *p++ = 0; - } - - if (iWords > 0) { - - if (nMode == ALIGN_JUSTIFY || nMode == ALIGN_JUSTIFY_EX) { - - bool bNextLineIsBlank = false; - if (nMode == ALIGN_JUSTIFY_EX) { - - if (SciCall_GetLineCount() <= iLine+1) - bNextLineIsBlank = true; - - else { - - DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine + 1); - DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine + 1); - - if (iLineIndentPos == iLineEndPos) - bNextLineIsBlank = true; - } - } - - if ((nMode == ALIGN_JUSTIFY || nMode == ALIGN_JUSTIFY_EX) && - iWords > 1 && iWordsLength >= 2 && - ((nMode != ALIGN_JUSTIFY_EX || !bNextLineIsBlank || iLineStart == iLineEnd) || - (bNextLineIsBlank && iWordsLength > (iMaxLength - iMinIndent) * 0.75))) { - - int iGaps = iWords - 1; - DocPos iSpacesPerGap = (iMaxLength - iMinIndent - iWordsLength) / iGaps; - DocPos iExtraSpaces = (iMaxLength - iMinIndent - iWordsLength) % iGaps; - int i,j; - - WCHAR wchNewLineBuf[BUFSIZE_ALIGN * 3] = { L'\0' }; - int length = BUFSIZE_ALIGN * 3; - StringCchCopy(wchNewLineBuf,COUNTOF(wchNewLineBuf),pWords[0]); - p = StrEnd(wchNewLineBuf); - - for (i = 1; i < iWords; i++) { - for (j = 0; j < iSpacesPerGap; j++) { - *p++ = L' '; - *p = 0; - } - if (i > iGaps - iExtraSpaces) { - *p++ = L' '; - *p = 0; - } - StringCchCat(p,(length - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); - p = StrEnd(p); - } - - int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; - - SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), SciCall_GetLineEndPosition(iLine)); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); - - SendMessage(hwnd,SCI_SETLINEINDENTATION,(WPARAM)iLine,(LPARAM)iMinIndent); - } - else { - - WCHAR wchNewLineBuf[BUFSIZE_ALIGN] = { L'\0' }; - StringCchCopy(wchNewLineBuf,COUNTOF(wchNewLineBuf),pWords[0]); - p = StrEnd(wchNewLineBuf); - - for (int i = 1; i < iWords; i++) { - *p++ = L' '; - *p = 0; - StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); - p = StrEnd(p); - } - - int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; - - SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), SciCall_GetLineEndPosition(iLine)); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); - - SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent); - } - } - else { - - DocPos iExtraSpaces = iMaxLength - iMinIndent - iWordsLength - iWords + 1; - DocPos iOddSpaces = iExtraSpaces % 2; - int i; - DocPos iPos; - - WCHAR wchNewLineBuf[BUFSIZE_ALIGN*3] = L""; - p = wchNewLineBuf; - - if (nMode == ALIGN_RIGHT) { - for (i = 0; i < iExtraSpaces; i++) - *p++ = L' '; - *p = 0; - } - if (nMode == ALIGN_CENTER) { - for (i = 1; i < iExtraSpaces - iOddSpaces; i+=2) - *p++ = L' '; - *p = 0; - } - for (i = 0; i < iWords; i++) { - StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); - if (i < iWords - 1) - StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),L" "); - if (nMode == ALIGN_CENTER && iWords > 1 && iOddSpaces > 0 && i + 1 >= iWords / 2) { - StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),L" "); - iOddSpaces--; - } - p = StrEnd(p); - } - - int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; - - if (nMode == ALIGN_RIGHT || nMode == ALIGN_CENTER) { - SendMessage(hwnd,SCI_SETLINEINDENTATION,(WPARAM)iLine,(LPARAM)iMinIndent); - iPos = SciCall_GetLineIndentPosition(iLine); - } - else - iPos = SciCall_PositionFromLine(iLine); - - SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, SciCall_GetLineEndPosition(iLine)); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); - - if (nMode == ALIGN_LEFT) - SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent); - } - } - } - } - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - } - else - MsgBox(MBINFO, IDS_BUFFERTOOSMALL); - - if (bModified) { - SendMessage(hwnd, SCI_ENDUNDOACTION, 0, 0); - } - - if (iCurPos < iAnchorPos) { - iCurPos = SciCall_PositionFromLine(iLineStart); - iAnchorPos = SciCall_PositionFromLine(iLineEnd + 1); - } - else { - iAnchorPos = SciCall_PositionFromLine(iLineStart); - iCurPos = SciCall_PositionFromLine(iLineEnd + 1); - } - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - } - else - MsgBox(MBWARN, IDS_SELRECT); -} - - - -//============================================================================= -// -// EditEncloseSelection() -// -void EditEncloseSelection(HWND hwnd, LPCWSTR pwszOpen, LPCWSTR pwszClose) -{ - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - char mszOpen[256 * 3] = { '\0' }; - char mszClose[256 * 3] = { '\0' }; - - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - if (lstrlen(pwszOpen)) - WideCharToMultiByteStrg(Encoding_SciCP, pwszOpen, mszOpen); - if (lstrlen(pwszClose)) - WideCharToMultiByteStrg(Encoding_SciCP, pwszClose, mszClose); - - const DocPos iLenOpen = StringCchLenA(mszOpen, COUNTOF(mszOpen)); - const DocPos iLenClose = StringCchLenA(mszClose, COUNTOF(mszClose)); - - EditEnterTargetTransaction(); - - if (iLenOpen > 0) { - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelStart); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszOpen); - } - - if (iLenClose > 0) { - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelEnd + iLenOpen, iSelEnd + iLenOpen); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszClose); - } - - EditLeaveTargetTransaction(); - - // Fix selection - EditSelectEx(hwnd, iAnchorPos + iLenOpen, iCurPos + iLenOpen, -1, -1); -} - - -//============================================================================= -// -// EditToggleLineComments() -// -void EditToggleLineComments(HWND hwnd, LPCWSTR pwszComment, bool bInsertAtStart) -{ - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - const DocPos iSelBegCol = SciCall_GetColumn(iSelStart); - - char mszComment[32 * 3] = { '\0' }; - - if (lstrlen(pwszComment)) { - WideCharToMultiByte(Encoding_SciCP, 0, pwszComment, -1, mszComment, COUNTOF(mszComment), NULL, NULL); - } - const DocPos cchComment = StringCchLenA(mszComment, COUNTOF(mszComment)); - - if (cchComment == 0) { return; } - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - - if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { - if ((iLineEnd - iLineStart) >= 1) - --iLineEnd; - } - - DocPos iCommentCol = 0; - - if (!bInsertAtStart) { - iCommentCol = (DocPos)INT_MAX; - for (DocLn iLine = iLineStart; iLine <= iLineEnd; iLine++) - { - const DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine); - const DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine); - if (iLineIndentPos != iLineEndPos) { - const DocPos iIndentColumn = SciCall_GetColumn(iLineIndentPos); - iCommentCol = min(iCommentCol, iIndentColumn); - } - } - } - - DocPos iSelStartOffset = (iCommentCol >= iSelBegCol) ? 0 : cchComment; - DocPos iSelEndOffset = 0; - - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - int iAction = 0; - - for (DocLn iLine = iLineStart; iLine <= iLineEnd; iLine++) - { - const DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); - - if (iIndentPos == SciCall_GetLineEndPosition(iLine)) { - // don't set comment char on "empty" (white-space only) lines - //~iAction = 1; - continue; - } - - const char* tchBuf = SciCall_GetRangePointer(iIndentPos, cchComment + 1); - if (StrCmpNIA(tchBuf, mszComment, (int)cchComment) == 0) - { - // remove comment chars - switch (iAction) { - case 0: - iAction = 2; - case 2: - SciCall_SetTargetRange(iIndentPos, iIndentPos + cchComment); - SciCall_ReplaceTarget(0, ""); - iSelEndOffset -= cchComment; - if (iLine == iLineStart) { - iSelStartOffset = (iSelStart == SciCall_PositionFromLine(iLine)) ? 0 : (0 - cchComment); - } - break; - case 1: - break; - } - } - else { - // set comment chars at indent pos - switch (iAction) { - case 0: - iAction = 1; - case 1: - { - SciCall_InsertText(SciCall_FindColumn(iLine, iCommentCol), mszComment); - iSelEndOffset += cchComment; - if (iLine == iLineStart) { - iSelStartOffset = (iCommentCol >= iSelBegCol) ? 0 : cchComment; - } - } - break; - case 2: - break; - } - } - } - - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iAnchorPos + iSelEndOffset, iCurPos + iSelStartOffset, -1, -1); - else if (iCurPos > iAnchorPos) - EditSelectEx(hwnd, iAnchorPos + iSelStartOffset, iCurPos + iSelEndOffset, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos + iSelStartOffset, iCurPos + iSelStartOffset, -1, -1); -} - - -//============================================================================= -// -// _AppendSpaces() -// -static DocPos __fastcall _AppendSpaces(HWND hwnd, DocLn iLineStart, DocLn iLineEnd, DocPos iMaxColumn, bool bSkipEmpty) -{ - UNUSED(hwnd); - - size_t size = (size_t)iMaxColumn; - char* pmszPadStr = AllocMem(size + 1, HEAP_ZERO_MEMORY); - FillMemory(pmszPadStr, size, ' '); - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - DocPos spcCount = 0; - //const bool bIsSelectionRectangle = SciCall_IsSelectionRectangle(); - - for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { - - // insertion position is at end of line - const DocPos iPos = SciCall_GetLineEndPosition(iLine); - const DocPos iCol = SciCall_GetColumn(iPos); - - if (iCol >= iMaxColumn) { continue; } - if (bSkipEmpty && (iPos <= SciCall_PositionFromLine(iLine))) { continue; } - - const DocPos iPadLen = (iMaxColumn - iCol); - - pmszPadStr[iPadLen] = '\0'; // slice - - SciCall_SetTargetRange(iPos, iPos); - SciCall_ReplaceTarget(-1, pmszPadStr); // pad - - pmszPadStr[iPadLen] = ' '; // reset - spcCount += iPadLen; - } - - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - - FreeMem(pmszPadStr); - - return spcCount; -} - -//============================================================================= -// -// EditPadWithSpaces() -// -void EditPadWithSpaces(HWND hwnd, bool bSkipEmpty, bool bNoUndoGroup) -{ - if (SciCall_IsSelectionEmpty() || Sci_IsThinRectangleSelected()) { return; } - - const int token = (!bNoUndoGroup ? BeginUndoAction() : -1); - - if (SciCall_IsSelectionRectangle()) - { - const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); - const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); - const DocPos vSpcAnchorMainPos = 0; // SciCall_GetRectangularSelectionAnchorVirtualSpace(); - const DocPos vSpcCaretMainPos = 0; // SciCall_GetRectangularSelectionCaretVirtualSpace(); - - const DocLn iRcCurLine = SciCall_LineFromPosition(selCaretMainPos); - const DocLn iRcAnchorLine = SciCall_LineFromPosition(selAnchorMainPos); - - DocLn iStartLine = 0; - DocLn iEndLine = 0; - if (iRcAnchorLine == iRcCurLine) { - iEndLine = SciCall_GetLineCount() - 1; - } - else { - iStartLine = (iRcCurLine < iRcAnchorLine) ? iRcCurLine : iRcAnchorLine; - iEndLine = (iRcCurLine < iRcAnchorLine) ? iRcAnchorLine : iRcCurLine; - } - - DocPos iMaxColumn = 0; - for (DocLn iLine = iStartLine; iLine <= iEndLine; iLine++) { - const DocPos iPos = SciCall_GetLineSelEndPosition(iLine); - if (iPos != INVALID_POSITION) { - iMaxColumn = max(iMaxColumn, SciCall_GetColumn(iPos)); - } - } - if (iMaxColumn <= 0) { return; } - - const DocPos iSpcCount = _AppendSpaces(hwnd, iStartLine, iEndLine, iMaxColumn, bSkipEmpty); - - if (iRcCurLine < iRcAnchorLine) - EditSelectEx(hwnd, selAnchorMainPos + iSpcCount, selCaretMainPos, vSpcAnchorMainPos, vSpcCaretMainPos); - else - EditSelectEx(hwnd, selAnchorMainPos, selCaretMainPos + iSpcCount, vSpcAnchorMainPos, vSpcCaretMainPos); - } - else // SC_SEL_LINES | SC_SEL_STREAM - { - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - DocLn iStartLine = 0; - DocLn iEndLine = SciCall_GetLineCount() - 1; - - if (iSelStart != iSelEnd) { - iStartLine = SciCall_LineFromPosition(iSelStart); - iEndLine = SciCall_LineFromPosition(iSelEnd); - if (iSelEnd < SciCall_GetLineEndPosition(iEndLine)) { --iEndLine; } - if (iEndLine <= iStartLine) { return; } - } - - DocPos iMaxColumn = 0; - for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) { - iMaxColumn = max(iMaxColumn, SciCall_GetColumn(SciCall_GetLineEndPosition(iLine))); - } - if (iMaxColumn <= 0) { return; } - - const DocPos iSpcCount = _AppendSpaces(hwnd, iStartLine, iEndLine, iMaxColumn, bSkipEmpty); - - if (iCurPos < iAnchorPos) - EditSelectEx(hwnd, iAnchorPos + iSpcCount, iCurPos, -1, -1); - else - EditSelectEx(hwnd, iAnchorPos, iCurPos + iSpcCount, -1, -1); - } - - if (token >= 0) { EndUndoAction(token); } -} - - -//============================================================================= -// -// EditStripFirstCharacter() -// -void EditStripFirstCharacter(HWND hwnd) -{ - UNUSED(hwnd); - - DocPos iSelStart = 0; - DocPos iSelEnd = 0; - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - if (SciCall_IsSelectionRectangle()) - { - if (SciCall_IsSelectionEmpty()) { - SciCall_Clear(); - return; - } - - const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); - const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); - const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); - - DocPos remCount = 0; - const DocPosU selCount = SciCall_GetSelections(); - for (DocPosU s = 0; s < selCount; ++s) { - const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); - const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); - //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); - //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); - - const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; - const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; - //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); - - const DocPos nextPos = (selTargetStart < selTargetEnd) ? SciCall_PositionAfter(selTargetStart) : selTargetEnd; - const DocPos diff = (nextPos <= selTargetEnd) ? (nextPos - selTargetStart) : 0; - - const DocPos len = (selTargetEnd - nextPos); - if ((len >= 0) && (len < TEMPLINE_BUFFER)) //TODO: @@@ alloc memory dynamically - { - StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(nextPos, len + 1), len); - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(len, g_pTempLineBuffer); - } - remCount += diff; - - } // for() - - SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); - if (vSpcAnchorMainPos > 0) - SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); - - SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); - if (vSpcCaretMainPos > 0) - SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); - - } - else // SC_SEL_LINES | SC_SEL_STREAM - { - if (SciCall_IsSelectionEmpty()) - { - iSelEnd = SciCall_GetTextLength(); - } - else { - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - } - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - - for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { - const DocPos iPos = SciCall_PositionFromLine(iLine); - if (iPos < SciCall_GetLineEndPosition(iLine)) { - SciCall_SetTargetRange(iPos, SciCall_PositionAfter(iPos)); - SciCall_ReplaceTarget(0, ""); - } - } - } - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); -} - - -//============================================================================= -// -// EditStripLastCharacter() -// -void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlanksOnly) -{ - UNUSED(hwnd); - - DocPos iSelStart = 0; - DocPos iSelEnd = 0; - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - if (SciCall_IsSelectionRectangle() && !bIgnoreSelection) { - if (SciCall_IsSelectionEmpty()) { - SciCall_Clear(); - return; - } - - const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); - const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); - const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); - - DocPos remCount = 0; - const DocPosU selCount = SciCall_GetSelections(); - for (DocPosU s = 0; s < selCount; ++s) - { - const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); - const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); - //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); - //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); - - const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; - const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; - //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); - - DocPos diff = 0; - DocPos len = 0; - - if (bTrailingBlanksOnly) - { - len = (selTargetEnd - selTargetStart); - if ((len >= 0) && (len < TEMPLINE_BUFFER)) - { - StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(selTargetStart, len + 1), len); - DocPos end = (DocPos)StrCSpnA(g_pTempLineBuffer, "\r\n"); - DocPos i = end; - while (--i >= 0) { - const char ch = g_pTempLineBuffer[i]; - if (IsWhiteSpace(ch)) { - g_pTempLineBuffer[i] = '\0'; - } - else - break; - } - while (end < len) { - g_pTempLineBuffer[++i] = g_pTempLineBuffer[end++]; // add "\r\n" if anny - } - diff = len - (++i); - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(-1, g_pTempLineBuffer); - } - } - else { - - const DocPos prevPos = (selTargetStart < selTargetEnd) ? SciCall_PositionBefore(selTargetEnd) : selTargetStart; - diff = (prevPos >= selTargetStart) ? (selTargetEnd - prevPos) : 0; - len = (prevPos - selTargetStart); - - if ((len >= 0) && (len < TEMPLINE_BUFFER)) - { - StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(selTargetStart, len + 1), len); - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(len, g_pTempLineBuffer); - } - } - remCount += diff; - - } // for() - - SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); - if (vSpcAnchorMainPos > 0) - SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); - - SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); - if (vSpcCaretMainPos > 0) - SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); - } - else // SC_SEL_LINES | SC_SEL_STREAM - { - if (SciCall_IsSelectionEmpty() || bIgnoreSelection) { - iSelEnd = SciCall_GetTextLength(); - } - else { - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - } - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - - for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) - { - const DocPos iStartPos = SciCall_PositionFromLine(iLine); - const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); - - if (bTrailingBlanksOnly) - { - DocPos i = iEndPos; - char ch = '\0'; - do { - ch = SciCall_GetCharAt(--i); - } while ((i >= iStartPos) && IsWhiteSpace(ch)); - if ((++i) < iEndPos) { - SciCall_SetTargetRange(i, iEndPos); - SciCall_ReplaceTarget(0, ""); - } - } - else { // any char at line end - if (iStartPos < iEndPos) { - SciCall_SetTargetRange(SciCall_PositionBefore(iEndPos), iEndPos); - SciCall_ReplaceTarget(0, ""); - } - - } - } - } - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); -} - - -//============================================================================= -// -// EditCompressSpaces() -// -void EditCompressSpaces(HWND hwnd) -{ - const bool bIsSelEmpty = SciCall_IsSelectionEmpty(); - - if (SciCall_IsSelectionRectangle()) { - if (bIsSelEmpty) { - return; - } - - const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); - const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); - const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); - - DocPos remCount = 0; - const DocPosU selCount = SciCall_GetSelections(); - for (DocPosU s = 0; s < selCount; ++s) - { - const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); - const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); - //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); - //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); - - const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; - const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; - //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); - - DocPos diff = 0; - DocPos len = 0; - - len = (selTargetEnd - selTargetStart); - if ((len >= 0) && (len < TEMPLINE_BUFFER)) - { - char* pText = SciCall_GetRangePointer(selTargetStart, len + 1); - const char* pEnd = (pText + len); - DocPos i = 0; - while (pText < pEnd) { - const char ch = *pText++; - if (IsWhiteSpace(ch)) { - g_pTempLineBuffer[i++] = ' '; - while (IsWhiteSpace(*pText)) { ++pText; } - } - else { g_pTempLineBuffer[i++] = ch; } - } - g_pTempLineBuffer[i] = '\0'; - diff = len - i; - SciCall_SetTargetRange(selTargetStart, selTargetEnd); - SciCall_ReplaceTarget(-1, g_pTempLineBuffer); - } - remCount += diff; - - } // for() - - SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); - if (vSpcAnchorMainPos > 0) - SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); - - SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); - if (vSpcCaretMainPos > 0) - SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); - - } - else // SC_SEL_LINES | SC_SEL_STREAM - { - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iSelStartPos = SciCall_GetSelectionStart(); - const DocPos iSelEndPos = SciCall_GetSelectionEnd(); - const DocPos iSelLength = (iSelEndPos - iSelStartPos); - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStartPos); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEndPos); - const DocPos iTxtLength = SciCall_GetTextLength(); - - bool bIsLineStart = true; - bool bIsLineEnd = true; - bool bModified = false; - - const char* pszIn = NULL; - char* pszOut = NULL; - DocPos cch = 0; - if (bIsSelEmpty) { - pszIn = (const char*)SciCall_GetCharacterPointer(); - cch = iTxtLength; - pszOut = AllocMem(cch + 1, HEAP_ZERO_MEMORY); - } - else { - pszIn = (const char*)SciCall_GetRangePointer(iSelStartPos, iSelLength); - cch = SciCall_GetSelText(NULL) - 1; - pszOut = AllocMem(cch + 1, HEAP_ZERO_MEMORY); - bIsLineStart = (iSelStartPos == SciCall_PositionFromLine(iLineStart)); - bIsLineEnd = (iSelEndPos == SciCall_GetLineEndPosition(iLineEnd)); - } - - if (pszIn && pszOut) { - char* co = (char*)pszOut; - DocPos remWSuntilCaretPos = 0; - for (int i = 0; i < cch; ++i) { - if (IsWhiteSpace(pszIn[i])) { - if (pszIn[i] == '\t') { bModified = true; } - while (IsWhiteSpace(pszIn[i + 1])) { - if (bIsSelEmpty && (i < iSelStartPos)) { ++remWSuntilCaretPos; } - ++i; - bModified = true; - } - if (!bIsLineStart && ((pszIn[i + 1] != '\n') && (pszIn[i + 1] != '\r'))) { - *co++ = ' '; - } - else { - bModified = true; - } - } - else { - bIsLineStart = (pszIn[i] == '\n' || pszIn[i] == '\r') ? true : false; - *co++ = pszIn[i]; - } - } - - if (bIsLineEnd && (co > pszOut) && (*(co - 1) == ' ')) { - if (bIsSelEmpty && ((cch - 1) < iSelStartPos)) { --remWSuntilCaretPos; } - *--co = '\0'; - bModified = true; - } - - if (bModified) { - - EditEnterTargetTransaction(); - - if (!SciCall_IsSelectionEmpty()) { - SciCall_TargetFromSelection(); - } - else { - SciCall_SetTargetRange(0, iTxtLength); - } - SciCall_ReplaceTarget(-1, pszOut); - - EditLeaveTargetTransaction(); - - const DocPos iNewLen = StringCchLenA(pszOut, LocalSize(pszOut)); - - if (iCurPos < iAnchorPos) { - EditSelectEx(hwnd, iCurPos + iNewLen, iCurPos, -1, -1); - } - else if (iCurPos > iAnchorPos) { - EditSelectEx(hwnd, iAnchorPos, iAnchorPos + iNewLen, -1, -1); - } - else { // empty selection - DocPos iNewPos = iCurPos; - if (iCurPos > 0) { - iNewPos = SciCall_PositionBefore(SciCall_PositionAfter(iCurPos - remWSuntilCaretPos)); - } - EditSelectEx(hwnd, iNewPos, iNewPos, -1, -1); - } - } - } - if (pszOut) { FreeMem(pszOut); } - } -} - - -//============================================================================= -// -// EditRemoveBlankLines() -// -void EditRemoveBlankLines(HWND hwnd, bool bMerge, bool bRemoveWhiteSpace) -{ - UNUSED(hwnd); - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iSelStart = (SciCall_IsSelectionEmpty() ? 0 : SciCall_GetSelectionStart()); - const DocPos iSelEnd = (SciCall_IsSelectionEmpty() ? SciCall_GetTextLength() : SciCall_GetSelectionEnd()); - - DocLn iBegLine = SciCall_LineFromPosition(iSelStart); - DocLn iEndLine = SciCall_LineFromPosition(iSelEnd); - - if (iSelStart > SciCall_PositionFromLine(iBegLine)) { ++iBegLine; } - if ((iSelEnd <= SciCall_PositionFromLine(iEndLine)) && (iEndLine != SciCall_GetLineCount() - 1)) { --iEndLine; } - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - for (DocLn iLine = iBegLine; iLine <= iEndLine; ) - { - DocLn nBlanks = 0; - bool bSpcOnly = true; - while (((iLine + nBlanks) <= iEndLine) && bSpcOnly) - { - bSpcOnly = false; - const DocPos posLnBeg = SciCall_PositionFromLine(iLine + nBlanks); - const DocPos posLnEnd = SciCall_GetLineEndPosition(iLine + nBlanks); - const int iLnLength = (posLnEnd - posLnBeg); - - if (iLnLength == 0) { - ++nBlanks; - bSpcOnly = true; - } - else if (bRemoveWhiteSpace) { - const char* pLine = SciCall_GetRangePointer(posLnBeg, (DocPos)iLnLength); - int i = 0; - for (; i < iLnLength; ++i) { - if (!IsWhiteSpace(pLine[i])) { - break; - } - } - if (i >= iLnLength) { - ++nBlanks; - bSpcOnly = true; - } - } - } - if ((nBlanks == 0) || ((nBlanks == 1) && bMerge)) { - iLine += (nBlanks + 1); - } - else { - if (bMerge) { --nBlanks; } - - SciCall_SetTargetRange(SciCall_PositionFromLine(iLine), SciCall_PositionFromLine(iLine + nBlanks)); - SciCall_ReplaceTarget(0, ""); - - if (bMerge) { ++iLine; } - iEndLine -= nBlanks; - } - } - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); -} - - -//============================================================================= -// -// EditRemoveDuplicateLines() -// -void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines) -{ - UNUSED(hwnd); - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - - DocLn iStartLine = 0; - DocLn iEndLine = 0; - if (iSelStart != iSelEnd) { - iStartLine = SciCall_LineFromPosition(iSelStart); - if (iSelStart > SciCall_PositionFromLine(iStartLine)) { ++iStartLine; } - iEndLine = SciCall_LineFromPosition(iSelEnd); - if (iSelEnd <= SciCall_PositionFromLine(iEndLine)) { --iEndLine; } - } - else { - iEndLine = SciCall_GetLineCount() - 1; // last line - } - - if ((iEndLine - iStartLine) <= 1) { return; } - - const DocPos iEmptyLnLen = (SciCall_GetEOLMode() == SC_EOL_CRLF ? 2 : 1); - - DocPos iMaxLineLen = 0; - for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) { - DocPos iLnLen = SciCall_GetLine(iLine, NULL); - if (iLnLen > iMaxLineLen) - iMaxLineLen = iLnLen; - } - - char* pCurrentLine = AllocMem(iMaxLineLen + 1, HEAP_ZERO_MEMORY); - - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - for (DocLn iCurLine = iStartLine; iCurLine < iEndLine; ++iCurLine) - { - const DocPos iCurLnLen = SciCall_GetLine(iCurLine, pCurrentLine); - - if (bRemoveEmptyLines || (iCurLnLen > iEmptyLnLen)) { - - for (DocLn iCompareLine = iCurLine + 1; iCompareLine < iEndLine; ++iCompareLine) - { - const DocPos iCmpLnLen = SciCall_GetLine(iCompareLine, NULL); - - if (bRemoveEmptyLines || (iCmpLnLen > iEmptyLnLen)) { - - const DocPos iBegCmpLine = SciCall_PositionFromLine(iCompareLine); - const char* pCompareLine = SciCall_GetRangePointer(iBegCmpLine, iCmpLnLen + 2); - - if (iCurLnLen == iCmpLnLen) { - if (StringCchCompareNA(pCurrentLine, iCurLnLen, pCompareLine, iCmpLnLen) == 0) { - SciCall_SetTargetRange(iBegCmpLine, iBegCmpLine + iCmpLnLen); - SciCall_ReplaceTarget(0, ""); - --iCompareLine; // proactive preventing progress to avoid comparison line skip - --iEndLine; - } - } - } // empty - } - } // empty - } - - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - - FreeMem(pCurrentLine); -} - - -//============================================================================= -// -// EditWrapToColumn() -// -void EditWrapToColumn(HWND hwnd,DocPos nColumn/*,int nTabWidth*/) -{ - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN,IDS_SELRECT); - return; - } - - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - DocPos iSelStart = 0; - DocPos iSelEnd = SciCall_GetTextLength(); - DocPos iSelCount = SciCall_GetTextLength(); - - if (!SciCall_IsSelectionEmpty()) { - iSelStart = SciCall_GetSelectionStart(); - DocLn iLine = SciCall_LineFromPosition(iSelStart); - iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line - iSelEnd = SciCall_GetSelectionEnd(); - iSelCount = (iSelEnd - iSelStart); - } - - char* pszText = (char*)SciCall_GetRangePointer(iSelStart, iSelCount); - - LPWSTR pszTextW = AllocMem((iSelCount+2)*sizeof(WCHAR), HEAP_ZERO_MEMORY); - if (pszTextW == NULL) { - return; - } - - int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)(SizeOfMem(pszTextW)/sizeof(WCHAR))); - - LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)*3+2, HEAP_ZERO_MEMORY); - if (pszConvW == NULL) { - FreeMem(pszTextW); - return; - } - - int cchEOL = 2; - WCHAR wszEOL[] = L"\r\n"; - int cEOLMode = SciCall_GetEOLMode(); - if (cEOLMode == SC_EOL_CR) - cchEOL = 1; - else if (cEOLMode == SC_EOL_LF) { - cchEOL = 1; wszEOL[0] = L'\n'; - } - - int cchConvW = 0; - DocPos iLineLength = 0; - - //#define W_DELIMITER L"!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~" // underscore counted as part of word - //WCHAR* W_DELIMITER = bAccelWordNavigation ? W_DelimCharsAccel : W_DelimChars; - //#define ISDELIMITER(wc) StrChr(W_DELIMITER,wc) - - //WCHAR* W_WHITESPACE = bAccelWordNavigation ? W_WhiteSpaceCharsAccelerated : W_WhiteSpaceCharsDefault; - //#define ISWHITE(wc) StrChr(W_WHITESPACE,wc) - #define ISWHITE(wc) StrChr(L" \t\f",wc) - - //#define ISWORDEND(wc) (ISDELIMITER(wc) || ISWHITE(wc)) - #define ISWORDEND(wc) StrChr(L" \t\f\r\n\v",wc) - - DocPos iCaretShift = 0; - bool bModified = false; - - for (int iTextW = 0; iTextW < cchTextW; iTextW++) - { - WCHAR w = pszTextW[iTextW]; - - if (ISWHITE(w)) - { - DocPos iNextWordLen = 0; - - while (pszTextW[iTextW+1] == L' ' || pszTextW[iTextW+1] == L'\t') { - ++iTextW; - bModified = true; - } - - WCHAR w2 = pszTextW[iTextW + 1]; - - while (w2 != L'\0' && !ISWORDEND(w2)) { - iNextWordLen++; - w2 = pszTextW[iTextW + iNextWordLen + 1]; - } - - //if (ISDELIMITER(w2) /*&& iNextWordLen > 0*/) // delimiters go with the word - // iNextWordLen++; - - if (iNextWordLen > 0) - { - if (iLineLength + iNextWordLen + 1 > nColumn) { - if (cchConvW <= iCurPos) { ++iCaretShift; }; - pszConvW[cchConvW++] = wszEOL[0]; - if (cchEOL > 1) - pszConvW[cchConvW++] = wszEOL[1]; - iLineLength = 0; - bModified = true; - } - else { - if (iLineLength > 0) { - pszConvW[cchConvW++] = L' '; - iLineLength++; - } - } - } - } - else - { - pszConvW[cchConvW++] = w; - if (w == L'\r' || w == L'\n') { - iLineLength = 0; - } - else { - iLineLength++; - } - } - } - FreeMem(pszTextW); - - if (bModified) - { - pszText = AllocMem(cchConvW * 3, HEAP_ZERO_MEMORY); - if (pszText) - { - int cchConvM = WideCharToMultiByte(Encoding_SciCP, 0, pszConvW, cchConvW, pszText, (int)SizeOfMem(pszText), NULL, NULL); - - if (iCurPos < iAnchorPos) { - iAnchorPos = iSelStart + cchConvM; - } - else if (iCurPos > iAnchorPos) { - iCurPos = iSelStart + cchConvM; - } - else { - iCurPos += iCaretShift; - iAnchorPos = iCurPos; - } - - EditEnterTargetTransaction(); - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText); - EditLeaveTargetTransaction(); - - FreeMem(pszText); - - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - } - } - FreeMem(pszConvW); -} - - -//============================================================================= -// -// EditJoinLinesEx() -// -// Customized version of SCI_LINESJOIN (w/o using TARGET transaction) -// -// ~EditEnterTargetTransaction(); -// ~SciCall_TargetFromSelection(); -// ~SendMessage(g_hwndEdit, SCI_LINESJOIN, 0, 0); -// ~EditLeaveTargetTransaction(); -// -void EditJoinLinesEx(HWND hwnd, bool bPreserveParagraphs, bool bCRLF2Space) -{ - bool bModified = false; - - if (SciCall_IsSelectionEmpty()) - return; - - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN,IDS_SELRECT); - return; - } - - DocPos iCurPos = SciCall_GetCurrentPos(); - DocPos iAnchorPos = SciCall_GetAnchor(); - - DocPos iSelStart = SciCall_GetSelectionStart(); - DocPos iSelEnd = SciCall_GetSelectionEnd(); - DocPos iSelLength = (iSelEnd - iSelStart); - - char* pszText = (char*)SciCall_GetRangePointer(iSelStart, iSelLength); - - char* pszJoin = LocalAlloc(LPTR, iSelLength+1); - if (pszJoin == NULL) { - return; - } - - char szEOL[] = "\r\n"; - int cchEOL = 2; - switch (SciCall_GetEOLMode()) - { - case SC_EOL_LF: - szEOL[0] = '\n'; - szEOL[1] = '\0'; - cchEOL = 1; - break; - case SC_EOL_CR: - szEOL[1] = '\0'; - cchEOL = 1; - break; - case SC_EOL_CRLF: - default: - break; - } - - DocPos cchJoin = (DocPos)-1; - for (int i = 0; i < iSelLength; ++i) - { - if ((pszText[i] == '\r') || (pszText[i] == '\n')) - { - if ((pszText[i+1] == '\r') || (pszText[i+1] == '\n')) { ++i; } - - int j = ++i; - while (StrChrA("\r\n", pszText[j])) { ++j; } // swallow all next line-breaks - - if ((i < j) && (j < iSelLength) && pszText[j] && bPreserveParagraphs) - { - for (int k = 0; k < cchEOL; ++k) { pszJoin[++cchJoin] = szEOL[k]; } - if (bCRLF2Space) { - for (int k = 0; k < cchEOL; ++k) { pszJoin[++cchJoin] = szEOL[k]; } - } - } - else if ((j < iSelLength) && pszText[j] && bCRLF2Space) - { - pszJoin[++cchJoin] = ' '; - } - i = j; - bModified = true; - } - if (i < iSelLength) { - pszJoin[++cchJoin] = pszText[i]; // copy char - } - } - ++cchJoin; // start at -1 - - if (bModified) { - if (iAnchorPos > iCurPos) { - iCurPos = iSelStart; - iAnchorPos = iSelStart + cchJoin; - } - else { - iAnchorPos = iSelStart; - iCurPos = iSelStart + cchJoin; - } - - EditEnterTargetTransaction(); - SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchJoin, (LPARAM)pszJoin); - EditLeaveTargetTransaction(); - - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); - } - LocalFree(pszJoin); -} - - -//============================================================================= -// -// EditSortLines() -// -typedef struct _SORTLINE { - WCHAR *pwszLine; - WCHAR *pwszSortEntry; -} SORTLINE; - -static FARPROC pfnStrCmpLogicalW; -typedef int (__stdcall *FNSTRCMP)(LPCWSTR,LPCWSTR); - -int CmpStd(const void *s1, const void *s2) { - int cmp = StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - return (cmp) ? cmp : StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); -} - -int CmpStdRev(const void *s1, const void *s2) { - int cmp = -1 * StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - return (cmp) ? cmp : -1 * StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); -} - -int CmpLogical(const void *s1, const void *s2) { - int cmp = (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - if (cmp == 0) - cmp = (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); - if (cmp) - return cmp; - else { - cmp = StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - return (cmp) ? cmp : StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); - } -} - -int CmpLogicalRev(const void *s1, const void *s2) { - int cmp = -1 * (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - if (cmp == 0) - cmp = -1 * (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); - if (cmp) - return cmp; - else { - cmp = -1 * StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); - return (cmp) ? cmp : -1 * StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); - } -} - - -void EditSortLines(HWND hwnd, int iSortFlags) -{ - bool bIsRectangular = false; - - DocPos iCurPos = 0; - DocPos iAnchorPos = 0; - DocPos iCurPosVS = 0; - DocPos iAnchorPosVS = 0; - DocPos iSelStart = 0; - DocPos iSelEnd = 0; - DocLn iLineStart = 0; - DocLn iLineEnd = 0; - DocPos iSortColumn = 0; - - DocLn iLine = 0; - DocPos cchTotal = 0; - DocPos ichlMax = 3; - - SORTLINE *pLines = NULL; - char *pmszResult = NULL; - char *pmszBuf = NULL; - - int cEOLMode = 0; - char mszEOL[] = "\r\n"; - - int iTabWidth = 0; - - bool bLastDup = false; - FNSTRCMP pfnStrCmp; - - if ((bool)SendMessage(hwnd, SCI_GETSELECTIONEMPTY, 0, 0)) - return; // no selection - - pfnStrCmpLogicalW = GetProcAddress(GetModuleHandle(L"shlwapi"), "StrCmpLogicalW"); - pfnStrCmp = (iSortFlags & SORT_NOCASE) ? StrCmpIW : StrCmpW; - - if (SciCall_IsSelectionRectangle()) { - - bIsRectangular = true; - - iCurPos = SciCall_GetRectangularSelectionCaret(); - iAnchorPos = SciCall_GetRectangularSelectionAnchor(); - iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); - iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - - DocLn iRcCurLine = SciCall_LineFromPosition(iCurPos); - DocLn iRcAnchorLine = SciCall_LineFromPosition(iAnchorPos); - - DocPos iRcCurCol = SciCall_GetColumn(iCurPos); - DocPos iRcAnchorCol = SciCall_GetColumn(iAnchorPos); - - iLineStart = min(iRcCurLine, iRcAnchorLine); - iLineEnd = max(iRcCurLine, iRcAnchorLine); - - iSortColumn = min(iRcCurCol, iRcAnchorCol); - } - else { // stream selection - - iCurPos = SciCall_GetCurrentPos(); - iAnchorPos = SciCall_GetAnchor(); - - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - - iLine = SciCall_LineFromPosition(iSelStart); - iSelStart = SciCall_PositionFromLine(iLine); - iLineStart = SciCall_LineFromPosition(iSelStart); - iLineEnd = SciCall_LineFromPosition(iSelEnd); - - if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { --iLineEnd; } - - iSortColumn = (UINT)SciCall_GetColumn(iCurPos); - } - - DocLn iLineCount = iLineEnd - iLineStart + 1; - if (iLineCount < 2) - return; - - cEOLMode = SciCall_GetEOLMode(); - if (cEOLMode == SC_EOL_CR) { - mszEOL[1] = 0; - } - else if (cEOLMode == SC_EOL_LF) { - mszEOL[0] = '\n'; - mszEOL[1] = 0; - } - - iTabWidth = (int)SendMessage(hwnd, SCI_GETTABWIDTH, 0, 0); - - if (bIsRectangular) - { - EditPadWithSpaces(hwnd, !(iSortFlags & SORT_SHUFFLE), true); - - iCurPos = SciCall_GetRectangularSelectionCaret(); - iAnchorPos = SciCall_GetRectangularSelectionAnchor(); - iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); - iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - } - - pLines = LocalAlloc(LPTR, sizeof(SORTLINE) * iLineCount); - DocLn i = 0; - for (iLine = iLineStart; iLine <= iLineEnd; iLine++) { - - const DocPos cchm = SciCall_GetLine(iLine, NULL); - - char* pmsz = LocalAlloc(LPTR, cchm + 1); - SciCall_GetLine(iLine, pmsz); - - StrTrimA(pmsz, "\r\n"); - cchTotal += cchm; - ichlMax = max(ichlMax, cchm); - - int cchw = MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, NULL, 0) - 1; - if (cchw > 0) { - int col = 0, tabs = iTabWidth; - pLines[i].pwszLine = LocalAlloc(LPTR, sizeof(WCHAR) * (cchw + 1)); - MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, pLines[i].pwszLine, (int)LocalSize(pLines[i].pwszLine) / sizeof(WCHAR)); - pLines[i].pwszSortEntry = pLines[i].pwszLine; - if (iSortFlags & SORT_COLUMN) { - while (*(pLines[i].pwszSortEntry)) { - if (*(pLines[i].pwszSortEntry) == L'\t') { - if (col + tabs <= iSortColumn) { - col += tabs; - tabs = iTabWidth; - pLines[i].pwszSortEntry = CharNext(pLines[i].pwszSortEntry); - } - else - break; - } - else if (col < iSortColumn) { - col++; - if (--tabs == 0) - tabs = iTabWidth; - pLines[i].pwszSortEntry = CharNext(pLines[i].pwszSortEntry); - } - else - break; - } - } - } - else { - pLines[i].pwszLine = StrDup(L""); - pLines[i].pwszSortEntry = pLines[i].pwszLine; - } - LocalFree(pmsz); - i++; - } - - if (iSortFlags & SORT_DESCENDING) { - if (iSortFlags & SORT_LOGICAL && pfnStrCmpLogicalW) - qsort(pLines, iLineCount, sizeof(SORTLINE), CmpLogicalRev); - else - qsort(pLines, iLineCount, sizeof(SORTLINE), CmpStdRev); - } - else if (iSortFlags & SORT_SHUFFLE) { - srand((UINT)GetTickCount()); - for (i = iLineCount - 1; i > 0; i--) { - int j = rand() % i; - SORTLINE sLine; - sLine.pwszLine = pLines[i].pwszLine; - sLine.pwszSortEntry = pLines[i].pwszSortEntry; - pLines[i] = pLines[j]; - pLines[j].pwszLine = sLine.pwszLine; - pLines[j].pwszSortEntry = sLine.pwszSortEntry; - } - } - else { - if (iSortFlags & SORT_LOGICAL && pfnStrCmpLogicalW) - qsort(pLines, iLineCount, sizeof(SORTLINE), CmpLogical); - else - qsort(pLines, iLineCount, sizeof(SORTLINE), CmpStd); - } - - DocLn lenRes = cchTotal + 2 * iLineCount + 1; - pmszResult = LocalAlloc(LPTR, lenRes); - pmszBuf = LocalAlloc(LPTR, ichlMax + 1); - - for (i = 0; i < iLineCount; i++) { - bool bDropLine = false; - if (pLines[i].pwszLine && ((iSortFlags & SORT_SHUFFLE) || lstrlen(pLines[i].pwszLine))) { - if (!(iSortFlags & SORT_SHUFFLE)) { - if (iSortFlags & SORT_MERGEDUP || iSortFlags & SORT_UNIQDUP || iSortFlags & SORT_UNIQUNIQ) { - if (i < iLineCount - 1) { - if (pfnStrCmp(pLines[i].pwszLine, pLines[i + 1].pwszLine) == 0) { - bLastDup = true; - bDropLine = (iSortFlags & SORT_MERGEDUP || iSortFlags & SORT_UNIQDUP); - } - else { - bDropLine = (!bLastDup && (iSortFlags & SORT_UNIQUNIQ)) || (bLastDup && (iSortFlags & SORT_UNIQDUP)); - bLastDup = false; - } - } - else { - bDropLine = (!bLastDup && (iSortFlags & SORT_UNIQUNIQ)) || (bLastDup && (iSortFlags & SORT_UNIQDUP)); - bLastDup = false; - } - } - } - if (!bDropLine) { - WideCharToMultiByte(Encoding_SciCP, 0, pLines[i].pwszLine, -1, pmszBuf, (int)LocalSize(pmszBuf), NULL, NULL); - StringCchCatA(pmszResult, lenRes, pmszBuf); - StringCchCatA(pmszResult, lenRes, mszEOL); - } - } - } - - LocalFree(pmszBuf); - - for (i = 0; i < iLineCount; i++) { - if (pLines[i].pwszLine) - LocalFree(pLines[i].pwszLine); - } - LocalFree(pLines); - - DocPos iResultLength = StringCchLenA(pmszResult, lenRes); - if (!bIsRectangular) { - if (iAnchorPos > iCurPos) { - iCurPos = iSelStart; - iAnchorPos = iSelStart + iResultLength; - } - else { - iAnchorPos = iSelStart; - iCurPos = iSelStart + iResultLength; - } - } - EditEnterTargetTransaction(); - - SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLineStart), SciCall_PositionFromLine(iLineEnd + 1)); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)pmszResult); - - EditLeaveTargetTransaction(); - - LocalFree(pmszResult); - - if (bIsRectangular) - EditSelectEx(hwnd, iAnchorPos, iCurPos, iAnchorPosVS, iCurPosVS); - else - EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); -} - - -//============================================================================= -// -// EditSelectEx() -// -void EditSelectEx(HWND hwnd, DocPos iAnchorPos, DocPos iCurrentPos, int vSpcAnchor, int vSpcCurrent) -{ - UNUSED(hwnd); - - if ((iAnchorPos < 0) && (iCurrentPos < 0)) { - SciCall_SelectAll(); - } - else if (iAnchorPos < 0) { - iAnchorPos = 0; - } - if (iCurrentPos < 0) { - iCurrentPos = SciCall_GetTextLength(); - } - - const DocLn iNewLine = SciCall_LineFromPosition(iCurrentPos); - const DocLn iAnchorLine = SciCall_LineFromPosition(iAnchorPos); - - // Ensure that the first and last lines of a selection are always unfolded - // This needs to be done *before* the SCI_SETSEL message - SciCall_EnsureVisible(iAnchorLine); - if (iAnchorLine != iNewLine) { SciCall_EnsureVisible(iNewLine); } - - if ((vSpcAnchor >= 0) && (vSpcCurrent >= 0)) { - SciCall_SetRectangularSelectionAnchor(iAnchorPos); - if (vSpcAnchor > 0) - SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchor); - SciCall_SetRectangularSelectionCaret(iCurrentPos); - if (vSpcCurrent > 0) - SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCurrent); - - //Sci_PostMsgV2(SCROLLRANGE, iAnchorPos, iCurrentPos); - SciCall_ScrollRange(iAnchorPos, iCurrentPos); - } - else - SciCall_SetSel(iAnchorPos, iCurrentPos); // scrolls into view - - if (abs(iNewLine - iAnchorLine) < SciCall_LinesOnScreen()) - { - EditScrollTo(hwnd, (iAnchorLine + iNewLine) / 2, -1); // center small selection - } - // remember x-pos for moving caret vertically - SciCall_ChooseCaretX(); - - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); -} - - -//============================================================================= -// -// EditEnsureSelectionVisible() -// -void EditEnsureSelectionVisible(HWND hwnd) -{ - UNUSED(hwnd); - DocPos iAnchorPos = 0; - DocPos iCurrentPos = 0; - DocPos iAnchorPosVS = -1; - DocPos iCurPosVS = -1; - - if (SciCall_IsSelectionRectangle()) - { - iAnchorPos = SciCall_GetRectangularSelectionAnchor(); - iCurrentPos = SciCall_GetRectangularSelectionCaret(); - iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); - iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); - } - else { - iAnchorPos = SciCall_GetAnchor(); - iCurrentPos = SciCall_GetCurrentPos(); - } - EditSelectEx(hwnd, iAnchorPos, iCurrentPos, iAnchorPosVS, iCurPosVS); -} - - -//============================================================================= -// -// EditScrollTo() -// -void EditScrollTo(HWND hwnd, DocLn iScrollToLine, int iSlop) -{ - UNUSED(hwnd); - - const int iXoff = SciCall_GetXoffset(); - const int iLinesOnScreen = SciCall_LinesOnScreen(); - const DocLn iSlopLines = ((iSlop < 0) || (iSlop >= iLinesOnScreen)) ? (iLinesOnScreen/2) : iSlop; - - SciCall_SetVisiblePolicy((VISIBLE_SLOP | VISIBLE_STRICT), iSlopLines); - SciCall_EnsureVisibleEnforcePolicy(iScrollToLine); - SciCall_SetXoffset(iXoff); -} - - -//============================================================================= -// -// EditJumpTo() -// -void EditJumpTo(HWND hwnd, DocLn iNewLine, DocPos iNewCol) -{ - // jump to end with line set to -1 - if (iNewLine < 0) { - SendMessage(hwnd, SCI_DOCUMENTEND, 0, 0); - return; - } - const DocLn iMaxLine = SciCall_GetLineCount(); - // Line maximum is iMaxLine - 1 (doc line count starts with 0) - iNewLine = (min(iNewLine, iMaxLine) - 1); - const DocPos iLineEndPos = SciCall_GetLineEndPosition(iNewLine); - // Column minimum is 1 - iNewCol = max(0, min((iNewCol - 1), iLineEndPos)); - const DocPos iNewPos = SciCall_FindColumn(iNewLine, iNewCol); - - SciCall_GotoPos(iNewPos); - EditScrollTo(hwnd, iNewLine, -1); - - // remember x-pos for moving caret vertically - SciCall_ChooseCaretX(); -} - - -//============================================================================= -// -// EditFixPositions() -// -void EditFixPositions(HWND hwnd) -{ - UNUSED(hwnd); - - DocPos iCurrentPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - const DocPos iMaxPos = SciCall_GetTextLength(); - - if ((iCurrentPos > 0) && (iCurrentPos < iMaxPos)) - { - const DocPos iNewPos = SciCall_PositionAfter( SciCall_PositionBefore(iCurrentPos) ); - - if (iNewPos != iCurrentPos) { - SciCall_SetCurrentPos(iNewPos); - iCurrentPos = iNewPos; - } - } - - if ((iAnchorPos != iCurrentPos) && (iAnchorPos > 0) && (iAnchorPos < iMaxPos)) - { - const DocPos iNewPos = SciCall_PositionAfter(SciCall_PositionBefore(iAnchorPos)); - if (iNewPos != iAnchorPos) { - SciCall_SetAnchor(iNewPos); - } - } -} - - -//============================================================================= -// -// EditGetExcerpt() -// -void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt) -{ - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_GetAnchor(); - - if (iCurPos == iAnchorPos || SciCall_IsSelectionRectangle()) { - StringCchCopy(lpszExcerpt,cchExcerpt,L""); - return; - } - - WCHAR tch[256] = { L'\0' }; - struct Sci_TextRange tr = { { 0, 0 }, NULL }; - /*if (iCurPos != iAnchorPos && !SciCall_IsSelectionRectangle()) {*/ - tr.chrg.cpMin = (DocPosCR)SciCall_GetSelectionStart(); - tr.chrg.cpMax = min((tr.chrg.cpMin + (DocPosCR)COUNTOF(tch)), (DocPosCR)SciCall_GetSelectionEnd()); - /*} - else { - int iLine = SendMessage(hwnd,SCI_LINEFROMPOSITION,(WPARAM)iCurPos,0); - tr.chrg.cpMin = SendMessage(hwnd,SCI_POSITIONFROMLINE,(WPARAM)iLine,0); - tr.chrg.cpMax = min(SendMessage(hwnd,SCI_GETLINEENDPOSITION,(WPARAM)iLine,0),(LONG)(tr.chrg.cpMin + COUNTOF(tchBuf2))); - }*/ - tr.chrg.cpMax = min(tr.chrg.cpMax, (DocPosCR)SciCall_GetTextLength()); - - char* pszText = LocalAlloc(LPTR,(tr.chrg.cpMax - tr.chrg.cpMin)+2); - LPWSTR pszTextW = LocalAlloc(LPTR,((tr.chrg.cpMax - tr.chrg.cpMin)*2)+2); - - DWORD cch = 0; - if (pszText && pszTextW) - { - tr.lpstrText = pszText; - SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); - MultiByteToWideChar(Encoding_SciCP,0,pszText,tr.chrg.cpMax - tr.chrg.cpMin,pszTextW,(int)SizeOfMem(pszTextW)/sizeof(WCHAR)); - - for (WCHAR* p = pszTextW; *p && cch < COUNTOF(tch)-1; p++) { - if (*p == L'\r' || *p == L'\n' || *p == L'\t' || *p == L' ') { - tch[cch++] = L' '; - while (*(p+1) == L'\r' || *(p+1) == L'\n' || *(p+1) == L'\t' || *(p+1) == L' ') - p++; - } - else - tch[cch++] = *p; - } - tch[cch++] = L'\0'; - StrTrim(tch,L" "); - } - - if (cch == 1) - StringCchCopy(tch,COUNTOF(tch),L" ... "); - - if (cch > cchExcerpt) { - tch[cchExcerpt-2] = L'.'; - tch[cchExcerpt-3] = L'.'; - tch[cchExcerpt-4] = L'.'; - } - StringCchCopyN(lpszExcerpt,cchExcerpt,tch,cchExcerpt); - - if (pszText) - LocalFree(pszText); - if (pszTextW) - LocalFree(pszTextW); -} - - - -//============================================================================= -// -// _EditSetSearchFlags() -// -static void __fastcall _SetSearchFlags(HWND hwnd, LPEDITFINDREPLACE lpefr) -{ - GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, lpefr->szFind, COUNTOF(lpefr->szFind)); - - if (GetDlgItem(hwnd, IDC_REPLACETEXT)) { - GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, lpefr->szReplace, COUNTOF(lpefr->szReplace)); - } - - lpefr->fuFlags = 0; // clear all - - if (IsDlgButtonChecked(hwnd, IDC_FINDCASE) == BST_CHECKED) { - lpefr->fuFlags |= SCFIND_MATCHCASE; - } - if (IsDlgButtonChecked(hwnd, IDC_FINDWORD) == BST_CHECKED) { - lpefr->fuFlags |= SCFIND_WHOLEWORD; - } - if (IsDlgButtonChecked(hwnd, IDC_FINDSTART) == BST_CHECKED) { - lpefr->fuFlags |= SCFIND_WORDSTART; - } - if (IsDlgButtonChecked(hwnd, IDC_FINDREGEXP) == BST_CHECKED) { - lpefr->fuFlags |= SCFIND_NP3_REGEX; - if (IsDlgButtonChecked(hwnd, IDC_DOT_MATCH_ALL) == BST_CHECKED) { - lpefr->bDotMatchAll = true; - lpefr->fuFlags |= SCFIND_DOT_MATCH_ALL; - } - } - if (IsDlgButtonChecked(hwnd, IDC_WILDCARDSEARCH) == BST_CHECKED) { - lpefr->bWildcardSearch = true; - lpefr->fuFlags |= SCFIND_NP3_REGEX; - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - } - - lpefr->bTransformBS = (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) ? true : false; - lpefr->bMarkOccurences = (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED) ? true : false; - lpefr->bNoFindWrap = (IsDlgButtonChecked(hwnd, IDC_NOWRAP) == BST_CHECKED) ? true : false; -} - - -// Wildcard search uses the regexp engine to perform a simple search with * ? as wildcards -// instead of more advanced and user-unfriendly regexp syntax -// for speed, we only need POSIX syntax here -static void __fastcall _EscapeWildcards(char* szFind2, LPCEDITFINDREPLACE lpefr) -{ - char szWildcardEscaped[FNDRPL_BUFFER] = { '\0' }; - int iSource = 0; - int iDest = 0; - - lpefr->fuFlags |= SCFIND_NP3_REGEX; - - while (szFind2[iSource] != '\0') - { - char c = szFind2[iSource]; - if (c == '*') - { - szWildcardEscaped[iDest++] = '.'; - } - else if (c == '?') - { - c = '.'; - } - else - { - if (c == '^' || - c == '$' || - c == '(' || - c == ')' || - c == '[' || - c == ']' || - c == '{' || - c == '}' || - c == '.' || - c == '+' || - c == '|' || - c == '\\') - { - szWildcardEscaped[iDest++] = '\\'; - } - } - szWildcardEscaped[iDest++] = c; - iSource++; - } - - szWildcardEscaped[iDest] = '\0'; - - StringCchCopyNA(szFind2, FNDRPL_BUFFER, szWildcardEscaped, COUNTOF(szWildcardEscaped)); -} - - -//============================================================================= -// -// _EditGetFindStrg() -// -static int __fastcall _EditGetFindStrg(HWND hwnd, LPCEDITFINDREPLACE lpefr, LPSTR szFind, int cchCnt) -{ - UNUSED(hwnd); - if (StringCchLenA(lpefr->szFind, COUNTOF(lpefr->szFind))) { - StringCchCopyA(szFind, cchCnt, lpefr->szFind); - } - else { - GetFindPatternMB(szFind, cchCnt); - StringCchCopyA(lpefr->szFind, COUNTOF(lpefr->szFind), szFind); - } - if (!StringCchLenA(szFind, cchCnt)) { return 0; } - - bool bIsRegEx = (lpefr->fuFlags & SCFIND_REGEXP); - if (lpefr->bTransformBS || bIsRegEx) { - TransformBackslashes(szFind, bIsRegEx, Encoding_SciCP, NULL); - } - if (StringCchLenA(szFind, FNDRPL_BUFFER) > 0) { - if (lpefr->bWildcardSearch) - _EscapeWildcards(szFind, lpefr); - } - - return (int)StringCchLenA(szFind, FNDRPL_BUFFER); -} - - - - -//============================================================================= -// -// _FindInTarget() -// -static DocPos __fastcall _FindInTarget(HWND hwnd, LPCSTR szFind, DocPos length, int flags, - DocPos* start, DocPos* end, bool bForceNext, FR_UPD_MODES fMode) -{ - DocPos _start = *start; - DocPos _end = *end; - const bool bFindPrev = (_start > _end); - - EditEnterTargetTransaction(); - - SendMessage(hwnd, SCI_SETSEARCHFLAGS, flags, 0); - SendMessage(hwnd, SCI_SETTARGETRANGE, _start, _end); - DocPos iPos = (DocPos)SendMessage(hwnd, SCI_SEARCHINTARGET, length, (LPARAM)szFind); - // handle next in case of zero-length-matches (regex) ! - if (iPos == _start) { - DocPos nend = (DocPos)SendMessage(hwnd, SCI_GETTARGETEND, 0, 0); - if ((_start == nend) && bForceNext) - { - const DocPos _new_start = (int)(bFindPrev ? - SendMessage(hwnd, SCI_POSITIONBEFORE, _start, 0) : - SendMessage(hwnd, SCI_POSITIONAFTER, _start, 0)); - const bool bProceed = (bFindPrev ? (_new_start >= _end) : (_new_start <= _end)); - if ((_new_start != _start) && bProceed){ - SendMessage(hwnd, SCI_SETTARGETRANGE, _new_start, _end); - iPos = (DocPos)SendMessage(hwnd, SCI_SEARCHINTARGET, length, (LPARAM)szFind); - } - else { - iPos = (DocPos)-1; // already at document begin or end => not found - } - } - } - if (iPos >= 0) { - if (fMode != FRMOD_IGNORE) { - g_FindReplaceMatchFoundState = bFindPrev ? - ((fMode == FRMOD_WRAPED) ? PRV_WRP_FND : PRV_FND) : - ((fMode == FRMOD_WRAPED) ? NXT_WRP_FND : NXT_FND); - } - // found in range, set begin and end of finding - *start = (DocPos)SendMessage(hwnd, SCI_GETTARGETSTART, 0, 0); - *end = (DocPos)SendMessage(hwnd, SCI_GETTARGETEND, 0, 0); - } - else { - if (fMode != FRMOD_IGNORE) { - g_FindReplaceMatchFoundState = (fMode != FRMOD_WRAPED) ? (bFindPrev ? PRV_NOT_FND : NXT_NOT_FND) : FND_NOP; - } - } - EditLeaveTargetTransaction(); - - return iPos; -} - - -//============================================================================= -// -// _FindHasMatch() -// -typedef enum { MATCH = 0, NO_MATCH = 1, INVALID = 2 } RegExResult_t; - -static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bMarkAll, bool bFirstMatchOnly) -{ - char szFind[FNDRPL_BUFFER]; - DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); - - const DocPos iStart = bFirstMatchOnly ? SciCall_GetSelectionStart() : 0; - const DocPos iTextLength = SciCall_GetTextLength(); - - DocPos start = iStart; - DocPos end = iTextLength; - const DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_IGNORE); - - static DocLn lastScrollToLn = -1; - - if (bFirstMatchOnly && !bReplaceInitialized) { - if (GetForegroundWindow() == g_hwndDlgFindReplace) { - if (iPos >= 0) { - const DocLn scrollToLn = SciCall_LineFromPosition(iPos); - if (scrollToLn != lastScrollToLn) { - EditScrollTo(hwnd, scrollToLn, -1); - lastScrollToLn = scrollToLn; - } - } - else { - const DocLn scrollToLn = SciCall_LineFromPosition(iStart); - if (scrollToLn != lastScrollToLn) { - EditScrollTo(hwnd, scrollToLn, -1); - lastScrollToLn = scrollToLn; - } - } - } - } - else // mark all matches - { - if (bMarkAll && (iPos >= 0)) { - EditClearAllMarks(hwnd, (DocPos)0, iTextLength); - EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), (DocPos)0, iTextLength, false, false); - } - } - return ((iPos >= 0) ? MATCH : ((iPos == (DocPos)-1) ? NO_MATCH : INVALID)); -} - - - -//============================================================================= -// -// _SetTimerMarkAll() -// -static void __fastcall _SetTimerMarkAll(HWND hwnd, int delay) -{ - TEST_AND_SET(BIT_TIMER_MARK_OCC); // flag to swollow multi-timer calls - - if (delay < USER_TIMER_MINIMUM) { - PostMessage(hwnd, WM_TIMER, MAKELONG(IDT_TIMER_MRKALL, 1), 0); // direct timer event - } - else { - SetTimer(hwnd, IDT_TIMER_MRKALL, delay, NULL); - } -} - - -//============================================================================= -// -// EditFindReplaceDlgProcW() -// -static char g_lastFind[FNDRPL_BUFFER] = { L'\0' }; - -INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static LPEDITFINDREPLACE lpefr = NULL; - - static RegExResult_t regexMatch = INVALID; - - static bool bFlagsChanged = true; - - static COLORREF rgbRed = RGB(255, 170, 170); - static COLORREF rgbGreen = RGB(170, 255, 170); - static COLORREF rgbBlue = RGB(170, 200, 255); - static HBRUSH hBrushRed; - static HBRUSH hBrushGreen; - static HBRUSH hBrushBlue; - - static int iSaveMarkOcc = -1; - static bool bSaveOccVisible = false; - static bool bSaveTFBackSlashes = false; - - WCHAR tchBuf[FNDRPL_BUFFER] = { L'\0' }; - - switch(umsg) - { - case WM_INITDIALOG: - { - SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); - lpefr = (LPEDITFINDREPLACE)lParam; - - iReplacedOccurrences = 0; - g_FindReplaceMatchFoundState = FND_NOP; - - if (lpefr->bMarkOccurences) { - iSaveMarkOcc = iMarkOccurrences; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, false); - iMarkOccurrences = 0; - bSaveOccVisible = bMarkOccurrencesMatchVisible; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, false); - bMarkOccurrencesMatchVisible = false; - CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED); - } - else { - iSaveMarkOcc = -1; - bSaveOccVisible = bMarkOccurrencesMatchVisible; - CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_UNCHECKED); - EditClearAllMarks(g_hwndEdit, 0, -1); - } - - //const WORD wTabSpacing = (WORD)SendMessage(lpefr->hwnd, SCI_GETTABWIDTH, 0, 0);; // dialog box units - //SendDlgItemMessage(hwnd, IDC_FINDTEXT, EM_SETTABSTOPS, 1, (LPARAM)&wTabSpacing); - - // Load MRUs - for (int i = 0; i < MRU_Enum(g_pMRUfind, 0, NULL, 0); i++) { - MRU_Enum(g_pMRUfind, i, tchBuf, COUNTOF(tchBuf)); - SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf); - } - for (int i = 0; i < MRU_Enum(g_pMRUreplace, 0, NULL, 0); i++) { - MRU_Enum(g_pMRUreplace, i, tchBuf, COUNTOF(tchBuf)); - SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf); - } - - SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0); - SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_SETEXTENDEDUI, true, 0); - - if (!GetWindowTextLengthW(GetDlgItem(hwnd, IDC_FINDTEXT))) - SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, lpefr->szFind); - - if (GetDlgItem(hwnd, IDC_REPLACETEXT)) - { - SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0); - SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_SETEXTENDEDUI, true, 0); - SetDlgItemTextMB2W(hwnd, IDC_REPLACETEXT, lpefr->szReplace); - } - - if (lpefr->fuFlags & SCFIND_MATCHCASE) - CheckDlgButton(hwnd, IDC_FINDCASE, BST_CHECKED); - - if (lpefr->fuFlags & SCFIND_WHOLEWORD) - CheckDlgButton(hwnd, IDC_FINDWORD, BST_CHECKED); - - if (lpefr->fuFlags & SCFIND_WORDSTART) - CheckDlgButton(hwnd, IDC_FINDSTART, BST_CHECKED); - - if (lpefr->bTransformBS) { - bSaveTFBackSlashes = lpefr->bTransformBS; - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); - } - else - bSaveTFBackSlashes = false; - - if (lpefr->fuFlags & SCFIND_REGEXP) { - CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_CHECKED); - CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); - } - - if (lpefr->bDotMatchAll) { - CheckDlgButton(hwnd, IDC_DOT_MATCH_ALL, BST_CHECKED); - } - - if (lpefr->bWildcardSearch) { - CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); - CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_CHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); - } - - if (lpefr->bMarkOccurences) { - CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED); - } - - if (lpefr->fuFlags & SCFIND_REGEXP) { - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); - } - else { - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); - } - - if (lpefr->bNoFindWrap) { - CheckDlgButton(hwnd, IDC_NOWRAP, BST_CHECKED); - } - - if (GetDlgItem(hwnd, IDC_REPLACE)) { - if (bSwitchedFindReplace) { - if (lpefr->bFindClose) - CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); - } - else { - if (lpefr->bReplaceClose) - CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); - } - } - else { - if (bSwitchedFindReplace) { - if (lpefr->bReplaceClose) - CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); - } - else { - if (lpefr->bFindClose) - CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); - } - } - - if (!bSwitchedFindReplace) { - if (xFindReplaceDlg == 0 || yFindReplaceDlg == 0) - CenterDlgInParent(hwnd); - else - SetDlgPos(hwnd, xFindReplaceDlg, yFindReplaceDlg); - } - else { - SetDlgPos(hwnd, xFindReplaceDlgSave, yFindReplaceDlgSave); - bSwitchedFindReplace = false; - CopyMemory(lpefr, &efrSave, sizeof(EDITFINDREPLACE)); - } - - HMENU hmenu = GetSystemMenu(hwnd, false); - GetString(IDS_SAVEPOS, tchBuf, COUNTOF(tchBuf)); - InsertMenu(hmenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_SAVEPOS, tchBuf); - GetString(IDS_RESETPOS, tchBuf, COUNTOF(tchBuf)); - InsertMenu(hmenu, 1, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_RESETPOS, tchBuf); - InsertMenu(hmenu, 2, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - - hBrushRed = CreateSolidBrush(rgbRed); - hBrushGreen = CreateSolidBrush(rgbGreen); - hBrushBlue = CreateSolidBrush(rgbBlue); - - _SetSearchFlags(hwnd, lpefr); - bFlagsChanged = true; - - EditEnsureSelectionVisible(hwnd); - - _SetTimerMarkAll(hwnd, 50); - } - return true; - - - case WM_DESTROY: - { - if (!bSwitchedFindReplace) - { - lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); - lpefr->szFind[0] = '\0'; - - if (iSaveMarkOcc >= 0) { - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true); - if (iSaveMarkOcc != 0) { - SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0); - } - } - bMarkOccurrencesMatchVisible = bSaveOccVisible; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible); - - iReplacedOccurrences = 0; - g_FindReplaceMatchFoundState = FND_NOP; - - //EditScrollTo(g_hwndEdit, Sci_GetCurrentLine(), false); - EditEnsureSelectionVisible(g_hwndEdit); - } - KillTimer(hwnd, IDT_TIMER_MRKALL); - DeleteObject(hBrushRed); - DeleteObject(hBrushGreen); - DeleteObject(hBrushBlue); - } - return false; - - - case WM_TIMER: - { - // The KillTimer function does not remove WM_TIMER messages already posted to the message queue. - if (LOWORD(wParam) == IDT_TIMER_MRKALL) - { - if (TEST_AND_RESET(BIT_TIMER_MARK_OCC)) { - KillTimer(hwnd, IDT_TIMER_MRKALL); - if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS)) - { - iMarkOccurrencesCount = 0; - _SetSearchFlags(hwnd, lpefr); - if (lpefr->bMarkOccurences) { - if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) { - StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), lpefr->szFind); - RegExResult_t match = _FindHasMatch(g_hwndEdit, lpefr, (lpefr->bMarkOccurences), false); - if (regexMatch != match) { - regexMatch = match; - } - // we have to set Sci's regex instance to first find (have substitution in place) - _FindHasMatch(g_hwndEdit, lpefr, false, true); - bFlagsChanged = false; - InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); - UpdateToolbar(); - UpdateStatusbar(); - } - } - TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done - } - } - return true; - } - } - return false; - - - case WM_ACTIVATE: - { - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !SciCall_IsSelectionEmpty()); - - lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); - if (lpefr->bMarkOccurences) { - bFlagsChanged = true; // main window has been edited maybe - _SetTimerMarkAll(hwnd,50); - } - //if (LOWORD(wParam) == WA_INACTIVE) { - // bFindReplCopySelOrClip = true; - //} - } - return false; - - - case WM_COMMAND: - { - lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); - - switch (LOWORD(wParam)) - { - case IDC_FINDTEXT: - case IDC_REPLACETEXT: - { - if (bFindReplCopySelOrClip) - { - char *lpszSelection = NULL; - tchBuf[0] = L'\0'; - - DocPos cchSelection = (DocPos)SendMessage(lpefr->hwnd, SCI_GETSELTEXT, 0, (LPARAM)NULL); - if ((1 < cchSelection) && (cchSelection < FNDRPL_BUFFER)) { - lpszSelection = AllocMem(cchSelection, HEAP_ZERO_MEMORY); - SendMessage(lpefr->hwnd, SCI_GETSELTEXT, 0, (LPARAM)lpszSelection); - } - else if (cchSelection <= 1) { - // nothing is selected in the editor: - // if first time you bring up find/replace dialog, - // copy content clipboard to find box - char* pClip = EditGetClipboardText(hwnd, false, NULL, NULL); - if (pClip) { - int len = lstrlenA(pClip); - if (len > 0 && len < FNDRPL_BUFFER) { - lpszSelection = AllocMem(len + 1, HEAP_ZERO_MEMORY); - StringCchCopyNA(lpszSelection, len + 1, pClip, len); - } - LocalFree(pClip); - } - } - - if (lpszSelection) { - // Check lpszSelection and truncate bad chars (CR,LF,VT) - char* lpsz = StrChrA(lpszSelection, 13); - if (lpsz) *lpsz = '\0'; - - lpsz = StrChrA(lpszSelection, 10); - if (lpsz) *lpsz = '\0'; - - lpsz = StrChrA(lpszSelection, 11); - if (lpsz) *lpsz = '\0'; - - SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, lpszSelection); - FreeMem(lpszSelection); - } - else { - if (tchBuf[0] == L'\0') { - GetFindPattern(tchBuf, FNDRPL_BUFFER); - } - if (tchBuf[0] == L'\0') { - MRU_Enum(g_pMRUfind, 0, tchBuf, COUNTOF(tchBuf)); - } - SetDlgItemText(hwnd, IDC_FINDTEXT, tchBuf); - } - bFindReplCopySelOrClip = false; - - bFlagsChanged = true; - } - - bool bEnableF = (GetWindowTextLengthW(GetDlgItem(hwnd, IDC_FINDTEXT)) || - CB_ERR != SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_GETCURSEL, 0, 0)); - - bool bEnableR = (GetWindowTextLengthW(GetDlgItem(hwnd, IDC_REPLACETEXT)) || - CB_ERR != SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_GETCURSEL, 0, 0)); - - bool bEnableIS = !(bool)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0); - - DialogEnableWindow(hwnd, IDOK, bEnableF); - DialogEnableWindow(hwnd, IDC_FINDPREV, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACE, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACEALL, bEnableF); - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, bEnableF && bEnableIS); - DialogEnableWindow(hwnd, IDC_SWAPSTRG, bEnableF || bEnableR); - - if (HIWORD(wParam) == CBN_CLOSEUP) { - LONG lSelEnd; - SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETEDITSEL, 0, (LPARAM)&lSelEnd); - SendDlgItemMessage(hwnd, LOWORD(wParam), CB_SETEDITSEL, 0, MAKELPARAM(lSelEnd, lSelEnd)); - } - - _SetTimerMarkAll(hwnd, 50); - } - break; - - - case IDC_ALL_OCCURRENCES: - { - if (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED) - { - bFlagsChanged = !(lpefr->bMarkOccurences); - lpefr->bMarkOccurences = true; - iSaveMarkOcc = iMarkOccurrences; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, false); - iMarkOccurrences = 0; - bSaveOccVisible = bMarkOccurrencesMatchVisible; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, false); - bMarkOccurrencesMatchVisible = false; - } - else { // switched OFF - lpefr->bMarkOccurences = false; - if (iSaveMarkOcc >= 0) { - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true); - if (iSaveMarkOcc != 0) { - SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0); - } - } - iSaveMarkOcc = -1; - bMarkOccurrencesMatchVisible = bSaveOccVisible; - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible); - bSaveOccVisible = false; - EditClearAllMarks(g_hwndEdit, 0, -1); - InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); - bFlagsChanged = true; - } - _SetTimerMarkAll(hwnd,0); - } - break; - - - case IDC_FINDREGEXP: - if (IsDlgButtonChecked(hwnd, IDC_FINDREGEXP) == BST_CHECKED) - { - lpefr->fuFlags |= SCFIND_NP3_REGEX; - - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); - - if (lpefr->bDotMatchAll) { - lpefr->fuFlags |= SCFIND_DOT_MATCH_ALL; - } - else { - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - } - - CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); // Can not use wildcard search together with regexp - lpefr->bWildcardSearch = false; - - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); - } - else { // unchecked - - lpefr->fuFlags &= ~(SCFIND_NP3_REGEX); - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); - - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); - lpefr->bTransformBS = bSaveTFBackSlashes; - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (lpefr->bTransformBS) ? BST_CHECKED : BST_UNCHECKED); - } - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_DOT_MATCH_ALL: - if (IsDlgButtonChecked(hwnd, IDC_DOT_MATCH_ALL) == BST_CHECKED) { - lpefr->bDotMatchAll = true; - lpefr->fuFlags |= SCFIND_DOT_MATCH_ALL; - } - else { - lpefr->bDotMatchAll = false; - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - } - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_WILDCARDSEARCH: - if (IsDlgButtonChecked(hwnd, IDC_WILDCARDSEARCH) == BST_CHECKED) - { - lpefr->bWildcardSearch = true; - lpefr->fuFlags |= SCFIND_NP3_REGEX; - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - - CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); - DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); - - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); - } - else { // unchecked - - lpefr->bWildcardSearch = false; - lpefr->fuFlags &= ~(SCFIND_NP3_REGEX); - lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); - - DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); - lpefr->bTransformBS = bSaveTFBackSlashes; - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (lpefr->bTransformBS) ? BST_CHECKED : BST_UNCHECKED); - } - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_FINDTRANSFORMBS: - if (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) { - lpefr->bTransformBS = true; - bSaveTFBackSlashes = true; - } - else { - lpefr->bTransformBS = false; - bSaveTFBackSlashes = false; - } - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_FINDCASE: - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_FINDWORD: - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - case IDC_FINDSTART: - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,0); - break; - - - case IDC_REPLACE: - case IDC_REPLACEALL: - case IDC_REPLACEINSEL: - iReplacedOccurrences = 0; - case IDOK: - case IDC_FINDPREV: - case IDACC_SELTONEXT: - case IDACC_SELTOPREV: - case IDMSG_SWITCHTOFIND: - case IDMSG_SWITCHTOREPLACE: - { - bool bIsFindDlg = (GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE) == NULL); - - if ((bIsFindDlg && LOWORD(wParam) == IDMSG_SWITCHTOREPLACE || - !bIsFindDlg && LOWORD(wParam) == IDMSG_SWITCHTOFIND)) { - GetDlgPos(hwnd, &xFindReplaceDlgSave, &yFindReplaceDlgSave); - bSwitchedFindReplace = true; - CopyMemory(&efrSave, lpefr, sizeof(EDITFINDREPLACE)); - } - - if (!bSwitchedFindReplace && - !GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, lpefr->szFind, COUNTOF(lpefr->szFind))) { - DialogEnableWindow(hwnd, IDOK, false); - DialogEnableWindow(hwnd, IDC_FINDPREV, false); - DialogEnableWindow(hwnd, IDC_REPLACE, false); - DialogEnableWindow(hwnd, IDC_REPLACEALL, false); - DialogEnableWindow(hwnd, IDC_REPLACEINSEL, false); - if (!GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, lpefr->szReplace, COUNTOF(lpefr->szReplace))) - DialogEnableWindow(hwnd, IDC_SWAPSTRG, false); - return true; - } - - _SetSearchFlags(hwnd, lpefr); - - if (bIsFindDlg) { - lpefr->bFindClose = (IsDlgButtonChecked(hwnd, IDC_FINDCLOSE) == BST_CHECKED) ? true : false; - } - else { - lpefr->bReplaceClose = (IsDlgButtonChecked(hwnd, IDC_FINDCLOSE) == BST_CHECKED) ? true : false; - } - - WCHAR tchBuf2[FNDRPL_BUFFER] = { L'\0' }; - - if (!bSwitchedFindReplace) { - // Save MRUs - if (StringCchLenA(lpefr->szFind, COUNTOF(lpefr->szFind))) { - if (GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, lpefr->szFind, COUNTOF(lpefr->szFind))) { - GetDlgItemText(hwnd, IDC_FINDTEXT, tchBuf2, COUNTOF(tchBuf2)); - MRU_Add(g_pMRUfind, tchBuf2, 0, 0, NULL); - SetFindPattern(tchBuf2); - } - } - if (StringCchLenA(lpefr->szReplace, COUNTOF(lpefr->szReplace))) { - if (GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, lpefr->szReplace, COUNTOF(lpefr->szReplace))) { - GetDlgItemText(hwnd, IDC_REPLACETEXT, tchBuf2, COUNTOF(tchBuf2)); - MRU_Add(g_pMRUreplace, tchBuf2, 0, 0, NULL); - } - } - else - StringCchCopyA(lpefr->szReplace, COUNTOF(lpefr->szReplace), ""); - } - else { - GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, lpefr->szFind, COUNTOF(lpefr->szFind)); - if (!GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, lpefr->szReplace, COUNTOF(lpefr->szReplace))) - StringCchCopyA(lpefr->szReplace, COUNTOF(lpefr->szReplace), ""); - } - - // Reload MRUs - SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_RESETCONTENT, 0, 0); - - for (int i = 0; i < MRU_Enum(g_pMRUfind, 0, NULL, 0); i++) { - MRU_Enum(g_pMRUfind, i, tchBuf2, COUNTOF(tchBuf2)); - SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf2); - } - for (int i = 0; i < MRU_Enum(g_pMRUreplace, 0, NULL, 0); i++) { - MRU_Enum(g_pMRUreplace, i, tchBuf2, COUNTOF(tchBuf2)); - SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf2); - } - - SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, lpefr->szFind); - SetDlgItemTextMB2W(hwnd, IDC_REPLACETEXT, lpefr->szReplace); - - if (!bSwitchedFindReplace) - SendMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetFocus()), 1); - - bool bCloseDlg = false; - if (bIsFindDlg) { - bCloseDlg = lpefr->bFindClose; - } - else if (LOWORD(wParam) != IDOK) { - bCloseDlg = lpefr->bReplaceClose; - } - - if (bCloseDlg) { - //EndDialog(hwnd,LOWORD(wParam)); - DestroyWindow(hwnd); - } - - switch (LOWORD(wParam)) { - case IDOK: // find next - case IDACC_SELTONEXT: - if (!bIsFindDlg) { bReplaceInitialized = true; } - if (!SciCall_IsSelectionEmpty()) { EditJumpToSelectionEnd(hwnd); } - EditFindNext(lpefr->hwnd, lpefr, (LOWORD(wParam) == IDACC_SELTONEXT), HIBYTE(GetKeyState(VK_F3))); - break; - - case IDC_FINDPREV: // find previous - case IDACC_SELTOPREV: - if (!bIsFindDlg) { bReplaceInitialized = true; } - if (!SciCall_IsSelectionEmpty()) { EditJumpToSelectionStart(hwnd); } - EditFindPrev(lpefr->hwnd, lpefr, (LOWORD(wParam) == IDACC_SELTOPREV), HIBYTE(GetKeyState(VK_F3))); - break; - - case IDC_REPLACE: - { - bReplaceInitialized = true; - int token = BeginUndoAction(); - EditReplace(lpefr->hwnd, lpefr); - EndUndoAction(token); - } - break; - - case IDC_REPLACEALL: - bReplaceInitialized = true; - EditReplaceAll(lpefr->hwnd, lpefr, true); - break; - - case IDC_REPLACEINSEL: - if (!SciCall_IsSelectionEmpty()) { - bReplaceInitialized = true; - EditReplaceAllInSelection(lpefr->hwnd, lpefr, true); - } - break; - } - } - bFlagsChanged = true; - _SetTimerMarkAll(hwnd,50); - break; - - - case IDCANCEL: - //EndDialog(hwnd,IDCANCEL); - DestroyWindow(hwnd); - break; - - case IDC_SWAPSTRG: - { - WCHAR wszFind[FNDRPL_BUFFER] = { L'\0' }; - WCHAR wszRepl[FNDRPL_BUFFER] = { L'\0' }; - GetDlgItemTextW(hwnd, IDC_FINDTEXT, wszFind, COUNTOF(wszFind)); - GetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszRepl, COUNTOF(wszRepl)); - SetDlgItemTextW(hwnd, IDC_FINDTEXT, wszRepl); - SetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszFind); - bFlagsChanged = true; - g_FindReplaceMatchFoundState = FND_NOP; - _SetTimerMarkAll(hwnd,50); - } - break; - - case IDACC_FIND: - PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_FIND, 1), 0); - break; - - case IDACC_REPLACE: - PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_REPLACE, 1), 0); - break; - - case IDACC_SAVEPOS: - GetDlgPos(hwnd, &xFindReplaceDlg, &yFindReplaceDlg); - break; - - case IDACC_RESETPOS: - CenterDlgInParent(hwnd); - xFindReplaceDlg = yFindReplaceDlg = 0; - break; - - case IDACC_FINDNEXT: - //SetFocus(g_hwndMain); - //SetForegroundWindow(g_hwndMain); - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDOK, 1), 0); - break; - - case IDACC_FINDPREV: - //SetFocus(g_hwndMain); - //SetForegroundWindow(g_hwndMain); - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_FINDPREV, 1), 0); - break; - - case IDACC_REPLACENEXT: - if (GetDlgItem(hwnd, IDC_REPLACE) != NULL) - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_REPLACE, 1), 0); - break; - - case IDACC_SAVEFIND: - g_FindReplaceMatchFoundState = FND_NOP; - SendMessage(g_hwndMain, WM_COMMAND, MAKELONG(IDM_EDIT_SAVEFIND, 1), 0); - SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, lpefr->szFind); - CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); - CheckDlgButton(hwnd, IDC_DOT_MATCH_ALL, BST_UNCHECKED); - CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); - CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_UNCHECKED); - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_FINDTEXT)), 1); - break; - - case IDACC_VIEWSCHEMECONFIG: - PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_VIEW_SCHEMECONFIG, 1), 0); - break; - - default: - //return false; ??? - break; - } - - } // WM_COMMAND: - return true; - - - case WM_SYSCOMMAND: - if (wParam == IDS_SAVEPOS) { - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_SAVEPOS, 0), 0); - return true; - } - else if (wParam == IDS_RESETPOS) { - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_RESETPOS, 0), 0); - return true; - } - else - return false; - - - case WM_NOTIFY: - { - LPNMHDR pnmhdr = (LPNMHDR)lParam; - switch (pnmhdr->code) - { - case NM_CLICK: - case NM_RETURN: - if (pnmhdr->idFrom == IDC_TOGGLEFINDREPLACE) { - if (GetDlgItem(hwnd, IDC_REPLACE)) - PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_FIND, 1), 0); - else - PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_REPLACE, 1), 0); - } - // Display help messages in the find/replace windows - else if (pnmhdr->idFrom == IDC_BACKSLASHHELP) { - MsgBox(MBINFO, IDS_BACKSLASHHELP); - } - else if (pnmhdr->idFrom == IDC_REGEXPHELP) { - MsgBox(MBINFO, IDS_REGEXPHELP); - } - else if (pnmhdr->idFrom == IDC_WILDCARDHELP) { - MsgBox(MBINFO, IDS_WILDCARDHELP); - } - break; - - default: - return false; - } - } - break; - - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - { - lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); - if (lpefr->bMarkOccurences) - { - HWND hCheck = (HWND)lParam; - HDC hDC = (HDC)wParam; - - HWND hComboBox = GetDlgItem(hwnd, IDC_FINDTEXT); - COMBOBOXINFO ci = { sizeof(COMBOBOXINFO) }; - GetComboBoxInfo(hComboBox, &ci); - - //if (hCheck == ci.hwndItem || hCheck == ci.hwndList) - if (hCheck == ci.hwndItem) { - SetBkMode(hDC, TRANSPARENT); - INT_PTR hBrush; - switch (regexMatch) { - case MATCH: - //SetTextColor(hDC, green); - SetBkColor(hDC, rgbGreen); - hBrush = (INT_PTR)hBrushGreen; - break; - case NO_MATCH: - //SetTextColor(hDC, blue); - SetBkColor(hDC, rgbBlue); - hBrush = (INT_PTR)hBrushBlue; - break; - case INVALID: - default: - //SetTextColor(hDC, red); - SetBkColor(hDC, rgbRed); - hBrush = (INT_PTR)hBrushRed; - break; - } - return hBrush; - } - } - } - return DefWindowProc(hwnd, umsg, wParam, lParam); - - default: - break; - - } // switch(umsg) - - return false; -} - - -//============================================================================= -// -// EditFindReplaceDlg() -// -HWND EditFindReplaceDlg(HWND hwnd,LPCEDITFINDREPLACE lpefr,bool bReplace) -{ - lpefr->hwnd = hwnd; - HWND hDlg = CreateThemedDialogParam(g_hInstance, - (bReplace) ? MAKEINTRESOURCEW(IDD_REPLACE) : MAKEINTRESOURCEW(IDD_FIND), - GetParent(hwnd), - EditFindReplaceDlgProcW, - (LPARAM) lpefr); - - ShowWindow(hDlg,SW_SHOW); - - return hDlg; -} - - -//============================================================================= -// -// EditFindNext() -// -bool EditFindNext(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bool bFocusWnd) { - - char szFind[FNDRPL_BUFFER]; - bool bSuppressNotFound = false; - - DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); - if (slen <= 0) - return false; - - if (bFocusWnd) - SetFocus(hwnd); - - DocPos iTextLength = SciCall_GetTextLength(); - - DocPos start = SciCall_GetCurrentPos(); - DocPos end = iTextLength; - - if (start >= end) { - if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap1", IDS_FIND_WRAPFW)) { - end = min(start, iTextLength); start = 0; - } - else - bSuppressNotFound = true; - } - - DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, true, FRMOD_NORM); - - if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { - InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); - bSuppressNotFound = true; - } - else if ((iPos < 0) && (start > 0) && !bExtendSelection) - { - UpdateStatusbar(); - if (!lpefr->bNoFindWrap && !bSuppressNotFound) { - if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap2", IDS_FIND_WRAPFW)) { - end = min(start, iTextLength); start = 0; - - iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED); - - if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { - InfoBox(MBWARN, L"MsgInvalidRegex2", IDS_REGEX_INVALID); - bSuppressNotFound = true; - } - } - else - bSuppressNotFound = true; - } - } - - if (iPos < 0) { - if (!bSuppressNotFound) - InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); - return false; - } - - if (bExtendSelection) { - DocPos iSelPos = SciCall_GetCurrentPos(); - DocPos iSelAnchor = SciCall_GetAnchor(); - EditSelectEx(hwnd, min(iSelAnchor, iSelPos), end, -1, -1); - } - else { - EditSelectEx(hwnd, start, end, -1, -1); - } - return true; -} - - -//============================================================================= -// -// EditFindPrev() -// -bool EditFindPrev(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bool bFocusWnd) { - - char szFind[FNDRPL_BUFFER]; - bool bSuppressNotFound = false; - - if (bFocusWnd) - SetFocus(hwnd); - - DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); - if (slen <= 0) - return false; - - const DocPos iTextLength = SciCall_GetTextLength(); - - DocPos start = SciCall_GetCurrentPos(); - DocPos end = 0; - - if (start <= end) { - if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap1", IDS_FIND_WRAPFW)) { - end = start; start = iTextLength; - } - else - bSuppressNotFound = true; - } - - DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, true, FRMOD_NORM); - - if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) - { - InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); - bSuppressNotFound = true; - } - else if ((iPos < 0) && (start <= iTextLength) && !bExtendSelection) - { - UpdateStatusbar(); - if (!lpefr->bNoFindWrap && !bSuppressNotFound) - { - if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap2", IDS_FIND_WRAPRE)) { - end = start; start = iTextLength; - - iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED); - - if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { - InfoBox(MBWARN, L"MsgInvalidRegex2", IDS_REGEX_INVALID); - bSuppressNotFound = true; - } - } - else - bSuppressNotFound = true; - } - } - - if (iPos < 0) { - if (!bSuppressNotFound) - InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); - return false; - } - - if (bExtendSelection) { - DocPos iSelPos = SciCall_GetCurrentPos(); - DocPos iSelAnchor = SciCall_GetAnchor(); - EditSelectEx(hwnd, max(iSelPos, iSelAnchor), start, -1, -1); - } - else { - EditSelectEx(hwnd, end, start, -1, -1); - } - return true; -} - - -//============================================================================= -// -// EditMarkAllOccurrences() -// -void EditMarkAllOccurrences() -{ - if (iMarkOccurrences > 0) { - - if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure - - BeginWaitCursor(NULL); - IgnoreNotifyChangeEvent(); - EditEnterTargetTransaction(); - - if (bMarkOccurrencesMatchVisible) - { - // get visible lines for update - DocLn iFirstVisibleLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); - - DocLn iStartLine = max(0, (iFirstVisibleLine - SciCall_LinesOnScreen())); - DocLn iEndLine = min((iFirstVisibleLine + (SciCall_LinesOnScreen() << 1)), (SciCall_GetLineCount() - 1)); - - DocPos iPosStart = SciCall_PositionFromLine(iStartLine); - DocPos iPosEnd = SciCall_GetLineEndPosition(iEndLine); - - // !!! don't clear all marks, else this method is re-called - // !!! on UpdateUI notification on drawing indicator mark - EditMarkAll(g_hwndEdit, NULL, bMarkOccurrencesCurrentWord, iPosStart, iPosEnd, bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords); - } - else { - EditMarkAll(g_hwndEdit, NULL, bMarkOccurrencesCurrentWord, 0, SciCall_GetTextLength(), bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords); - UpdateStatusbar(); - } - EditLeaveTargetTransaction(); - ObserveNotifyChangeEvent(); - EndWaitCursor(); - - } - else { - iMarkOccurrencesCount = 0; - } -} - - -//============================================================================= -// -// EditUpdateVisibleUrlHotspot() -// -void EditUpdateVisibleUrlHotspot(bool bEnabled) -{ - if (bEnabled) - { - if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure - - BeginWaitCursor(NULL); - EditEnterTargetTransaction(); - - // get visible lines for update - DocLn iFirstVisibleLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); - - DocLn iStartLine = max(0, (iFirstVisibleLine - SciCall_LinesOnScreen())); - DocLn iEndLine = min((iFirstVisibleLine + (SciCall_LinesOnScreen() << 1)), (SciCall_GetLineCount() - 1)); - - DocPos iPosStart = SciCall_PositionFromLine(iStartLine); - DocPos iPosEnd = SciCall_GetLineEndPosition(iEndLine); - - EditUpdateUrlHotspots(g_hwndEdit, iPosStart, iPosEnd, bEnabled); - - EditLeaveTargetTransaction(); - EndWaitCursor(); - } -} - - -//============================================================================= -// -// _GetReplaceString() -// -static char* __fastcall _GetReplaceString(HWND hwnd, LPCEDITFINDREPLACE lpefr, int* iReplaceMsg) -{ - char* pszReplace = NULL; // replace text of arbitrary size - if (StringCchCompareINA(lpefr->szReplace, FNDRPL_BUFFER, "^c", -1) == 0) { - *iReplaceMsg = SCI_REPLACETARGET; - pszReplace = EditGetClipboardText(hwnd, true, NULL, NULL); - } - else { - pszReplace = StrDupA(lpefr->szReplace); - if (!pszReplace) { - pszReplace = StrDupA(""); - } - bool bIsRegEx = (lpefr->fuFlags & SCFIND_REGEXP); - if (lpefr->bTransformBS || bIsRegEx) { - TransformBackslashes(pszReplace, bIsRegEx, Encoding_SciCP, iReplaceMsg); - } - } - return pszReplace; -} - - -//============================================================================= -// -// EditReplace() -// -bool EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) { - - int iReplaceMsg = SCI_REPLACETARGET; - char* pszReplace = _GetReplaceString(hwnd, lpefr, &iReplaceMsg); - if (!pszReplace) - return false; // recoding of clipboard canceled - - // redo find to get group ranges filled - DocPos start = (SciCall_IsSelectionEmpty() ? SciCall_GetCurrentPos() : SciCall_GetSelectionStart()); - DocPos end = SciCall_GetTextLength(); - DocPos _start = start; - iReplacedOccurrences = 0; - - const DocPos iPos = _FindInTarget(hwnd, lpefr->szFind, StringCchLenA(lpefr->szFind, FRMOD_NORM), - (int)(lpefr->fuFlags), &start, &end, false, false); - - // w/o selection, replacement string is put into current position - // but this maybe not intended here - if (SciCall_IsSelectionEmpty()) { - if ((iPos < 0) || (_start != start) || (_start != end)) { - // empty-replace was not intended - LocalFree(pszReplace); - if (iPos < 0) - return EditFindNext(hwnd, lpefr, false, false); - else { - EditSelectEx(hwnd, start, end, -1, -1); - return true; - } - } - } - iReplacedOccurrences = 1; - - EditEnterTargetTransaction(); - - SciCall_TargetFromSelection(); - SendMessage(hwnd, iReplaceMsg, (WPARAM)-1, (LPARAM)pszReplace); - - // move caret behind replacement - - const DocPos after = SciCall_GetTargetEnd(); - SciCall_SetSel(after, after); - - EditLeaveTargetTransaction(); - - LocalFree(pszReplace); - - return EditFindNext(hwnd, lpefr, false, false); -} - - - -//============================================================================= -// -// EditReplaceAllInRange() -// - -typedef struct _replPos -{ - DocPos beg; - DocPos end; -} -ReplPos_t; - -static UT_icd ReplPos_icd = { sizeof(ReplPos_t), NULL, NULL, NULL }; - -// ------------------------------------------------------------------------------------------------------- - -int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, DocPos iStartPos, DocPos iEndPos, DocPos* enlargement) -{ - char szFind[FNDRPL_BUFFER]; - - if (iStartPos > iEndPos) { swapos(&iStartPos, &iEndPos); } - - int slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); - if (slen <= 0) { return 0; } - - int iReplaceMsg = SCI_REPLACETARGET; - char* pszReplace = _GetReplaceString(hwnd, lpefr, &iReplaceMsg); - if (!pszReplace) { - return -1; // recoding of clipboard canceled - } - - UT_array* ReplPosUTArray = NULL; - utarray_new(ReplPosUTArray, &ReplPos_icd); - utarray_reserve(ReplPosUTArray, (2 * SciCall_GetLineCount()) ); - - DocPos start = iStartPos; - DocPos end = iEndPos; - - DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_NORM); - - if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { - InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); - } - - // === build array of matches for later replacements === - - ReplPos_t posPair = { 0, 0 }; - - while ((iPos >= 0) && (start <= iEndPos)) - { - posPair.beg = start; - posPair.end = end; - utarray_push_back(ReplPosUTArray, &posPair); - - start = end; - end = iEndPos; - - if (start <= iEndPos) - iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, ((posPair.end - posPair.beg) == 0), FRMOD_IGNORE); - else - iPos = -1; - } - - int iCount = utarray_len(ReplPosUTArray); - - // === iterate over findings and replace strings === - IgnoreNotifyChangeEvent(); - - DocPos offset = 0; - for (ReplPos_t* pPosPair = (ReplPos_t*)utarray_front(ReplPosUTArray); - pPosPair != NULL; - pPosPair = (ReplPos_t*)utarray_next(ReplPosUTArray, pPosPair)) { - - // redo find to get group ranges filled - start = pPosPair->beg + offset; - end = iEndPos + offset; - - iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_IGNORE); - - EditEnterTargetTransaction(); - - SciCall_SetTargetRange(start, end); - - offset += ((DocPos)SendMessage(hwnd, iReplaceMsg, (WPARAM)-1, (LPARAM)pszReplace) - pPosPair->end + pPosPair->beg); - - EditLeaveTargetTransaction(); - } - - ObserveNotifyChangeEvent(); - - utarray_clear(ReplPosUTArray); - utarray_free(ReplPosUTArray); - LocalFree(pszReplace); - - *enlargement = offset; - - return iCount; -} - - -//============================================================================= -// -// EditReplaceAll() -// -bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) -{ - const DocPos start = 0; - const DocPos end = SciCall_GetTextLength(); - DocPos enlargement = 0; - - BeginWaitCursor(NULL); - - int token = BeginUndoAction(); - - iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement); - - EndUndoAction(token); - - EndWaitCursor(); - - if (bShowInfo) { - if (iReplacedOccurrences > 0) - InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences); - else - InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); - } - - return (iReplacedOccurrences > 0) ? true : false; -} - - -//============================================================================= -// -// EditReplaceAllInSelection() -// -bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) -{ - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return false; - } - - const DocPos start = SciCall_GetSelectionStart(); - const DocPos end = SciCall_GetSelectionEnd(); - const DocPos currPos = SciCall_GetCurrentPos(); - const DocPos anchorPos = SciCall_GetAnchor(); - DocPos enlargement = 0; - bool bWaitCursor = false; - - if ((end - start) > (512 * 512)) { - BeginWaitCursor(NULL); - bWaitCursor = true; - } - - int token = BeginUndoAction(); - - iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement); - - if (bWaitCursor) { - EndWaitCursor(); - } - - if (iReplacedOccurrences <= 0) { - EndUndoAction(token); - return false; - } - - if (currPos < anchorPos) - SciCall_SetSel(anchorPos + enlargement, currPos); - else - SciCall_SetSel(anchorPos, currPos + enlargement); - - EndUndoAction(token); - - if (bShowInfo) { - if (iReplacedOccurrences > 0) - InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences); - else - InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); - } - - return (iReplacedOccurrences > 0) ? true : false; -} - - -//============================================================================= -// -// EditClearAllMarks() -// -void EditClearAllMarks(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd) -{ - if (iRangeEnd <= 0) { - iRangeEnd = SciCall_GetTextLength(); - } - if (iRangeStart > iRangeEnd) { - swapos(&iRangeStart, &iRangeEnd); - } - SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0); - SendMessage(hwnd, SCI_INDICATORCLEARRANGE, iRangeStart, iRangeEnd); -} - - -//============================================================================= -// -// EditMarkAll() -// Mark all occurrences of the matching text in range (by Aleksandar Lekov) -// -void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd, bool bMatchCase, bool bMatchWords) -{ - char* pszText = NULL; - char txtBuffer[HUGE_BUFFER] = { '\0' }; - - DocPos iFindLength = 0; - - if (pszFind != NULL) - pszText = pszFind; - else - pszText = txtBuffer; - - if (pszFind == NULL) { - - if (SciCall_IsSelectionEmpty()) { - if (flags) { // nothing selected, get word under caret if flagged - DocPos iCurrPos = SciCall_GetCurrentPos(); - DocPos iWordStart = (DocPos)SendMessage(hwnd, SCI_WORDSTARTPOSITION, iCurrPos, (LPARAM)1); - DocPos iWordEnd = (DocPos)SendMessage(hwnd, SCI_WORDENDPOSITION, iCurrPos, (LPARAM)1); - iFindLength = (iWordEnd - iWordStart); - StringCchCopyNA(pszText, HUGE_BUFFER, SciCall_GetRangePointer(iWordStart, iFindLength), iFindLength); - } - else { - return; // no selection and no word mark chosen - } - } - else { // selection found - - if (flags) { return; } // no current word matching if we have a selection - - // get current selection - DocPos iSelStart = SciCall_GetSelectionStart(); - DocPos iSelEnd = SciCall_GetSelectionEnd(); - DocPos iSelCount = (iSelEnd - iSelStart); - - // if multiple lines are selected exit - - if ((SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) || (iSelCount >= HUGE_BUFFER)) { - return; - } - - iFindLength = SciCall_GetSelText(pszText) - 1; - - // exit if selection is not a word and Match whole words only is enabled - if (bMatchWords) { - DocPos iSelStart2 = 0; - const char* delims = (bAccelWordNavigation ? DelimCharsAccel : DelimChars); - while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) { - if (StrChrIA(delims, pszText[iSelStart2])) { - return; - } - iSelStart2++; - } - } - } - // set additional flags - flags = flags ? SCFIND_WHOLEWORD : 0; // match current word under caret ? - flags |= (bMatchWords) ? SCFIND_WHOLEWORD : 0; - flags |= (bMatchCase ? SCFIND_MATCHCASE : 0); - } - else { - iFindLength = StringCchLenA(pszFind, FNDRPL_BUFFER); - } - - if (iFindLength > 0) { - - const DocPos iTextLength = SciCall_GetTextLength(); - rangeStart = max(0, rangeStart); - rangeEnd = min(rangeEnd, iTextLength); - - DocPos start = rangeStart; - DocPos end = rangeEnd; - - - iMarkOccurrencesCount = 0; - SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0); - - DocPos iPos = (DocPos)-1; - do { - - iPos = _FindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (start == iPos), FRMOD_IGNORE); - - if (iPos < 0) - break; // not found - - // mark this match if not done before - SciCall_IndicatorFillRange(iPos, (end - start)); - - start = end; - end = rangeEnd; - - } while ((++iMarkOccurrencesCount < iMarkOccurrencesMaxCount) && (start < end)); - } -} - - -//============================================================================= -// -// EditCompleteWord() -// Auto-complete words (by Aleksandar Lekov) -// -struct WLIST { - char* word; - struct WLIST* next; -}; - -void EditCompleteWord(HWND hwnd, bool autoInsert) -{ - const char* NON_WORD = bAccelWordNavigation ? DelimCharsAccel : DelimChars; - - const DocPos iCurrentPos = SciCall_GetCurrentPos(); - const DocLn iLine = SciCall_LineFromPosition(iCurrentPos); - const DocPos iLineStart = SciCall_PositionFromLine(iLine); - const DocPos iCurrentLinePos = iCurrentPos - iLineStart; - - DocPos iLineLen = SciCall_GetLine(iLine, NULL); - const char* pLine = SciCall_GetRangePointer(iLineStart, iLineLen); - - bool bWordAllNumbers = true; - DocPos iStartWordPos = iCurrentLinePos; - while (iStartWordPos > 0 && !StrChrIA(NON_WORD, pLine[iStartWordPos - 1])) { - iStartWordPos--; - if (pLine[iStartWordPos] < '0' || pLine[iStartWordPos] > '9') { - bWordAllNumbers = false; - } - } - - if (iStartWordPos == iCurrentLinePos || bWordAllNumbers || iCurrentLinePos - iStartWordPos < 2) { - return; - } - - char pRoot[256]; - DocPosCR iRootLen = (DocPosCR)(iCurrentLinePos - iStartWordPos); - StringCchCopyNA(pRoot, COUNTOF(pRoot), pLine + iStartWordPos, (size_t)iRootLen); - - const DocPosCR iDocLen = (DocPosCR)SciCall_GetTextLength(); - struct Sci_TextToFind ft = { { 0, 0 }, 0, { 0, 0 } }; - ft.lpstrText = pRoot; - ft.chrg.cpMax = iDocLen; - - DocPos iPosFind = (DocPos)SendMessage(hwnd, SCI_FINDTEXT, SCFIND_WORDSTART, (LPARAM)&ft); - - int iNumWords = 0; - DocPos iWListSize = 0; - struct WLIST* lListHead = NULL; - - char pWord[1024]; - while ((iPosFind >= 0) && (iPosFind < iDocLen)) - { - DocPos wordLength; - DocPos wordEnd = (DocPosCR)(iPosFind + iRootLen); - - if (iPosFind != iCurrentPos - iRootLen) - { - while ((wordEnd < iDocLen) && !StrChrIA(NON_WORD, SciCall_GetCharAt(wordEnd))) { ++wordEnd; } - - wordLength = wordEnd - iPosFind; - if (wordLength > iRootLen) { - struct WLIST* p = lListHead; - struct WLIST* t = NULL; - bool found = false; - - StringCchCopyNA(pWord, COUNTOF(pWord), SciCall_GetRangePointer(iPosFind, wordLength), wordLength); - - while (p) { - int cmp = lstrcmpA(pWord, p->word); - if (!cmp) { - found = true; - break; - } - else if (cmp < 0) { - break; - } - t = p; - p = p->next; - } - if (!found) { - struct WLIST* el = (struct WLIST*)LocalAlloc(LPTR, sizeof(struct WLIST)); - const DocPos wSize = (wordEnd - iPosFind) + 1; - el->word = LocalAlloc(LPTR, wSize+1); - StringCchCopyA(el->word, wSize+1, pWord); - el->next = p; - if (t) { - t->next = el; - } - else { - lListHead = el; - } - ++iNumWords; - iWListSize += wSize; - } - } - } - ft.chrg.cpMin = (DocPosCR)wordEnd; - iPosFind = (DocPos)SendMessage(hwnd, SCI_FINDTEXT, SCFIND_WORDSTART, (LPARAM)&ft); - } - - if (iNumWords > 0) { - char *pList; - struct WLIST* p = lListHead; - struct WLIST* t; - - pList = LocalAlloc(LPTR, iWListSize + 1); - while (p) { - lstrcatA(pList, " "); - lstrcatA(pList, p->word); - LocalFree(p->word); - t = p; - p = p->next; - LocalFree(t); - } - - SendMessage(hwnd, SCI_AUTOCSETIGNORECASE, 1, 0); - SendMessage(hwnd, SCI_AUTOCSETSEPARATOR, ' ', 0); - SendMessage(hwnd, SCI_AUTOCSETFILLUPS, 0, (LPARAM)"\t\n\r"); - SendMessage(hwnd, SCI_AUTOCSETCHOOSESINGLE, autoInsert, 0); - SendMessage(hwnd, SCI_AUTOCSHOW, iRootLen, (LPARAM)(pList + 1)); - LocalFree(pList); - } - -// LocalFree(pRoot); -} - - - -//============================================================================= -// -// EditUpdateUrlHotspots() -// Find and mark all URL hot-spots -// -void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActiveHotspot) -{ - if (endPos < startPos) { - swapos(&startPos, &endPos); - } - - // 1st apply current lexer style - EditFinalizeStyling(hwnd,startPos); - - const char* pszUrlRegEx = "\\b(?:(?:https?|ftp|file)://|www\\.|ftp\\.)" - "(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*" - "(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#/%=~_|$])"; - - const int iRegExLen = (int)strlen(pszUrlRegEx); - - if (startPos < 0) { // current line only - DocPos currPos = SciCall_GetCurrentPos(); - DocLn lineNo = SciCall_LineFromPosition(currPos); - startPos = SciCall_PositionFromLine(lineNo); - endPos = SciCall_GetLineEndPosition(lineNo); - } - if (endPos == startPos) - return; - - DocPos start = startPos; - DocPos end = endPos; - int iStyle = bActiveHotspot ? Style_GetHotspotStyleID() : STYLE_DEFAULT; - - do { - DocPos iPos = _FindInTarget(hwnd, pszUrlRegEx, iRegExLen, SCFIND_NP3_REGEX, &start, &end, false, FRMOD_IGNORE); - - if (iPos < 0) - break; // not found - - DocPos mlen = end - start; - if ((mlen <= 0) || ((iPos + mlen) > endPos)) - break; // wrong match - - // mark this match - SciCall_StartStyling(iPos); - SciCall_SetStyling((DocPosCR)mlen, iStyle); - - // next occurrence - start = end; - end = endPos; - - } while (start < end); - - - if (bActiveHotspot) - SciCall_StartStyling(endPos); - else - SciCall_StartStyling(startPos); -} - - -//============================================================================= -// -// EditHighlightIfBrace() -// -static bool __fastcall _HighlightIfBrace(HWND hwnd, DocPos iPos) -{ - if (iPos < 0) { - // clear indicator - SendMessage(hwnd, SCI_BRACEBADLIGHT, (WPARAM)INVALID_POSITION, 0); - SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0); - if (!bUseOldStyleBraceMatching) - SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 0, INDIC_NP3_BAD_BRACE); - return true; - } - - char c = SciCall_GetCharAt(iPos); - - if (StrChrA("()[]{}", c)) { - DocPos iBrace2 = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPos, 0); - if (iBrace2 != -1) { - DocPos col1 = SciCall_GetColumn(iPos); - DocPos col2 = SciCall_GetColumn(iBrace2); - SendMessage(hwnd, SCI_BRACEHIGHLIGHT, iPos, iBrace2); - SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, min(col1, col2), 0); - if (!bUseOldStyleBraceMatching) { - SendMessage(hwnd, SCI_BRACEHIGHLIGHTINDICATOR, 1, INDIC_NP3_MATCH_BRACE); - } - } - else { - SendMessage(hwnd, SCI_BRACEBADLIGHT, iPos, 0); - SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0); - if (!bUseOldStyleBraceMatching) { - SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 1, INDIC_NP3_BAD_BRACE); - } - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditApplyLexerStyle() -// -void EditApplyLexerStyle(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd) -{ - SendMessage(hwnd, SCI_COLOURISE, (WPARAM)iRangeStart, (LPARAM)iRangeEnd); -} - - -//============================================================================= -// -// EditFinalizeStyling() -// -void EditFinalizeStyling(HWND hwnd, DocPos iEndPos) -{ - const int iEndStyled = SciCall_GetEndStyled(); - - if ((iEndPos < 0) || (iEndStyled < iEndPos)) - { - const DocLn iLineEndStyled = SciCall_LineFromPosition(iEndStyled); - const DocPos iStartStyling = SciCall_PositionFromLine(iLineEndStyled); - EditApplyLexerStyle(hwnd, iStartStyling, iEndPos); - } -} - - -//============================================================================= -// -// EditMatchBrace() -// -void EditMatchBrace(HWND hwnd) -{ - DocPos iPos = SciCall_GetCurrentPos(); - - EditFinalizeStyling(hwnd, iPos); - - if (!_HighlightIfBrace(hwnd, iPos)) { - // try one before - iPos = SciCall_PositionBefore(iPos); - if (!_HighlightIfBrace(hwnd, iPos)) { - // clear mark - _HighlightIfBrace(hwnd, -1); - } - } -} - - - -//============================================================================= -// -// EditLinenumDlgProc() -// -INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - switch(umsg) - { - case WM_INITDIALOG: - { - DocLn iCurLine = SciCall_LineFromPosition(SciCall_GetCurrentPos())+1; - DocPos iCurColumn = SciCall_GetColumn(SciCall_GetCurrentPos()) + 1; - - SetDlgItemInt(hwnd, IDC_LINENUM, (UINT)iCurLine, false); - SetDlgItemInt(hwnd, IDC_COLNUM, (UINT)iCurColumn, false); - SendDlgItemMessage(hwnd,IDC_LINENUM,EM_LIMITTEXT,15,0); - SendDlgItemMessage(hwnd,IDC_COLNUM,EM_LIMITTEXT,15,0); - CenterDlgInParent(hwnd); - } - return true; - - - case WM_COMMAND: - - switch(LOWORD(wParam)) - { - case IDOK: - { - BOOL fTranslated = TRUE; - DocLn iNewLine = (DocLn)GetDlgItemInt(hwnd,IDC_LINENUM,&fTranslated,FALSE); - - DocLn iMaxLine = (DocLn)SendMessage(g_hwndEdit,SCI_GETLINECOUNT,0,0); - - DocPos iNewCol = 1; - BOOL fTranslated2 = TRUE; - if (SendDlgItemMessage(hwnd, IDC_COLNUM, WM_GETTEXTLENGTH, 0, 0) > 0) { - iNewCol = (DocPos)GetDlgItemInt(hwnd, IDC_COLNUM, &fTranslated2, FALSE); - } - - if (!fTranslated || !fTranslated2) - { - PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,(!fTranslated) ? IDC_LINENUM : IDC_COLNUM)),1); - return true; - } - - if ((iNewLine > 0) && (iNewLine <= iMaxLine) && (iNewCol > 0)) - { - EditJumpTo(g_hwndEdit,iNewLine,iNewCol); - EndDialog(hwnd,IDOK); - } - else { - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, (!((iNewLine > 0) && (iNewLine <= iMaxLine))) ? IDC_LINENUM : IDC_COLNUM)), 1); - } - } - break; - - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - - } - return true; - - } - - UNUSED(lParam); - - return false; -} - - -//============================================================================= -// -// EditLinenumDlg() -// -bool EditLinenumDlg(HWND hwnd) -{ - - if (IDOK == ThemedDialogBoxParam(g_hInstance,MAKEINTRESOURCE(IDD_LINENUM), - GetParent(hwnd),EditLinenumDlgProc,(LPARAM)hwnd)) - return true; - - else - return false; - -} - - -//============================================================================= -// -// EditModifyLinesDlg() -// -// Controls: 100 Input -// 101 Input -// -typedef struct _modlinesdata { - LPWSTR pwsz1; - LPWSTR pwsz2; -} MODLINESDATA, *PMODLINESDATA; - - -INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static PMODLINESDATA pdata; - - static int id_hover; - static int id_capture; - - static HFONT hFontNormal; - static HFONT hFontHover; - - static HCURSOR hCursorNormal; - static HCURSOR hCursorHover; - - switch(umsg) - { - case WM_INITDIALOG: - { - LOGFONT lf; - - id_hover = 0; - id_capture = 0; - - if (NULL == (hFontNormal = (HFONT)SendDlgItemMessage(hwnd,200,WM_GETFONT,0,0))) - hFontNormal = GetStockObject(DEFAULT_GUI_FONT); - GetObject(hFontNormal,sizeof(LOGFONT),&lf); - lf.lfUnderline = true; - hFontHover = CreateFontIndirect(&lf); - - hCursorNormal = LoadCursor(NULL,IDC_ARROW); - hCursorHover = LoadCursor(NULL,IDC_HAND); - if (!hCursorHover) - hCursorHover = LoadCursor(g_hInstance, IDC_ARROW); - - pdata = (PMODLINESDATA)lParam; - SetDlgItemTextW(hwnd,100,pdata->pwsz1); - SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0); - SetDlgItemTextW(hwnd,101,pdata->pwsz2); - SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); - CenterDlgInParent(hwnd); - } - return true; - - case WM_DESTROY: - DeleteObject(hFontHover); - return false; - - case WM_NCACTIVATE: - if (!(bool)wParam) { - if (id_hover != 0) { - //int _id_hover = id_hover; - id_hover = 0; - id_capture = 0; - //InvalidateRect(GetDlgItem(hwnd,id_hover),NULL,false); - } - } - return false; - - case WM_CTLCOLORSTATIC: - { - DWORD dwId = GetWindowLong((HWND)lParam,GWL_ID); - HDC hdc = (HDC)wParam; - - if (dwId >= 200 && dwId <= 205) { - SetBkMode(hdc,TRANSPARENT); - if (GetSysColorBrush(COLOR_HOTLIGHT)) - SetTextColor(hdc,GetSysColor(COLOR_HOTLIGHT)); - else - SetTextColor(hdc,RGB(0, 0, 0xFF)); - SelectObject(hdc,/*dwId == id_hover?*/hFontHover/*:hFontNormal*/); - return (INT_PTR)GetSysColorBrush(COLOR_BTNFACE); - } - } - break; - - case WM_MOUSEMOVE: - { - POINT pt; - pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); - HWND hwndHover = ChildWindowFromPoint(hwnd,pt); - DWORD dwId = (DWORD)GetWindowLong(hwndHover,GWL_ID); - - if (GetActiveWindow() == hwnd) { - if (dwId >= 200 && dwId <= 205) { - if (id_capture == (int)dwId || id_capture == 0) { - if (id_hover != id_capture || id_hover == 0) { - id_hover = (int)dwId; - //InvalidateRect(GetDlgItem(hwnd,dwId),NULL,false); - } - } - else if (id_hover != 0) { - //int _id_hover = id_hover; - id_hover = 0; - //InvalidateRect(GetDlgItem(hwnd,_id_hover),NULL,false); - } - } - else if (id_hover != 0) { - //int _id_hover = id_hover; - id_hover = 0; - //InvalidateRect(GetDlgItem(hwnd,_id_hover),NULL,false); - } - SetCursor(id_hover != 0 ? hCursorHover : hCursorNormal); - } - } - break; - - case WM_LBUTTONDOWN: - { - POINT pt; - pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); - HWND hwndHover = ChildWindowFromPoint(hwnd,pt); - DWORD dwId = GetWindowLong(hwndHover,GWL_ID); - - if (dwId >= 200 && dwId <= 205) { - GetCapture(); - id_hover = dwId; - id_capture = dwId; - //InvalidateRect(GetDlgItem(hwnd,dwId),NULL,false); - } - SetCursor(id_hover != 0?hCursorHover:hCursorNormal); - } - break; - - case WM_LBUTTONUP: - { - POINT pt; - pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); - //HWND hwndHover = ChildWindowFromPoint(hwnd,pt); - //DWORD dwId = GetWindowLong(hwndHover,GWL_ID); - if (id_capture != 0) { - ReleaseCapture(); - if (id_hover == id_capture) { - int id_focus = GetWindowLong(GetFocus(),GWL_ID); - if (id_focus == 100 || id_focus == 101) { - WCHAR wch[8]; - GetDlgItemText(hwnd,id_capture,wch,COUNTOF(wch)); - SendDlgItemMessage(hwnd,id_focus,EM_SETSEL,(WPARAM)0,(LPARAM)-1); - SendDlgItemMessage(hwnd,id_focus,EM_REPLACESEL,(WPARAM)true,(LPARAM)wch); - PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetFocus()),1); - } - } - id_capture = 0; - } - SetCursor(id_hover != 0?hCursorHover:hCursorNormal); - } - break; - - case WM_CANCELMODE: - if (id_capture != 0) { - ReleaseCapture(); - id_hover = 0; - id_capture = 0; - SetCursor(hCursorNormal); - } - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: { - GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); - GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); - EndDialog(hwnd,IDOK); - } - break; - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditModifyLinesDlg() -// -bool EditModifyLinesDlg(HWND hwnd,LPWSTR pwsz1,LPWSTR pwsz2) -{ - - INT_PTR iResult; - MODLINESDATA data; - data.pwsz1 = pwsz1; data.pwsz2 = pwsz2; - - iResult = ThemedDialogBoxParam( - g_hInstance, - MAKEINTRESOURCEW(IDD_MODIFYLINES), - hwnd, - EditModifyLinesDlgProc, - (LPARAM)&data); - - return (iResult == IDOK) ? true : false; - -} - - -//============================================================================= -// -// EditAlignDlgProc() -// -// Controls: 100 Radio Button -// 101 Radio Button -// 102 Radio Button -// 103 Radio Button -// 104 Radio Button -// -INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static int *piAlignMode; - switch(umsg) - { - case WM_INITDIALOG: - { - piAlignMode = (int*)lParam; - CheckRadioButton(hwnd,100,104,*piAlignMode+100); - CenterDlgInParent(hwnd); - } - return true; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: { - *piAlignMode = 0; - if (IsDlgButtonChecked(hwnd,100) == BST_CHECKED) - *piAlignMode = ALIGN_LEFT; - else if (IsDlgButtonChecked(hwnd,101) == BST_CHECKED) - *piAlignMode = ALIGN_RIGHT; - else if (IsDlgButtonChecked(hwnd,102) == BST_CHECKED) - *piAlignMode = ALIGN_CENTER; - else if (IsDlgButtonChecked(hwnd,103) == BST_CHECKED) - *piAlignMode = ALIGN_JUSTIFY; - else if (IsDlgButtonChecked(hwnd,104) == BST_CHECKED) - *piAlignMode = ALIGN_JUSTIFY_EX; - EndDialog(hwnd,IDOK); - } - break; - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditAlignDlg() -// -bool EditAlignDlg(HWND hwnd,int *piAlignMode) -{ - - INT_PTR iResult; - - iResult = ThemedDialogBoxParam( - g_hInstance, - MAKEINTRESOURCEW(IDD_ALIGN), - hwnd, - EditAlignDlgProc, - (LPARAM)piAlignMode); - - return (iResult == IDOK) ? true : false; - -} - - -//============================================================================= -// -// EditEncloseSelectionDlgProc() -// -// Controls: 100 Input -// 101 Input -// -typedef struct _encloseselectiondata { - LPWSTR pwsz1; - LPWSTR pwsz2; -} ENCLOSESELDATA, *PENCLOSESELDATA; - - -INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static PENCLOSESELDATA pdata; - switch(umsg) - { - case WM_INITDIALOG: - { - pdata = (PENCLOSESELDATA)lParam; - SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0); - SetDlgItemTextW(hwnd,100,pdata->pwsz1); - SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); - SetDlgItemTextW(hwnd,101,pdata->pwsz2); - CenterDlgInParent(hwnd); - } - return true; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: { - GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); - GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); - EndDialog(hwnd,IDOK); - } - break; - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditEncloseSelectionDlg() -// -bool EditEncloseSelectionDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose) -{ - - INT_PTR iResult; - ENCLOSESELDATA data; - data.pwsz1 = pwszOpen; data.pwsz2 = pwszClose; - - iResult = ThemedDialogBoxParam( - g_hInstance, - MAKEINTRESOURCEW(IDD_ENCLOSESELECTION), - hwnd, - EditEncloseSelectionDlgProc, - (LPARAM)&data); - - return (iResult == IDOK) ? true : false; - -} - - -//============================================================================= -// -// EditInsertTagDlgProc() -// -// Controls: 100 Input -// 101 Input -// -typedef struct _tagsdata { - LPWSTR pwsz1; - LPWSTR pwsz2; -} TAGSDATA, *PTAGSDATA; - - -INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static PTAGSDATA pdata; - switch(umsg) - { - case WM_INITDIALOG: - { - pdata = (PTAGSDATA)lParam; - SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,254,0); - SetDlgItemTextW(hwnd,100,L""); - SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); - SetDlgItemTextW(hwnd,101,L""); - SetFocus(GetDlgItem(hwnd,100)); - PostMessage(GetDlgItem(hwnd,100),EM_SETSEL,1,4); - CenterDlgInParent(hwnd); - } - return false; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case 100: { - if (HIWORD(wParam) == EN_CHANGE) { - - WCHAR wchBuf[256] = { L'\0' }; - WCHAR wchIns[256] = L"= 3) { - - if (wchBuf[0] == L'<') - { - int cchIns = 2; - const WCHAR* pwCur = &wchBuf[1]; - while ( - *pwCur && - *pwCur != L'<' && - *pwCur != L'>' && - *pwCur != L' ' && - *pwCur != L'\t' && - (StrChr(L":_-.",*pwCur) || IsCharAlphaNumericW(*pwCur))) - - wchIns[cchIns++] = *pwCur++; - - while ( - *pwCur && - *pwCur != L'>') - - pwCur++; - - if (*pwCur == L'>' && *(pwCur-1) != L'/') { - wchIns[cchIns++] = L'>'; - wchIns[cchIns] = L'\0'; - - if (cchIns > 3 && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"
",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && - StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1)) { - - SetDlgItemTextW(hwnd,101,wchIns); - bClear = false; - } - } - } - } - if (bClear) - SetDlgItemTextW(hwnd,101,L""); - } - } - break; - case IDOK: { - GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); - GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); - EndDialog(hwnd,IDOK); - } - break; - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditInsertTagDlg() -// -bool EditInsertTagDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose) -{ - - INT_PTR iResult; - TAGSDATA data; - data.pwsz1 = pwszOpen; data.pwsz2 = pwszClose; - - iResult = ThemedDialogBoxParam( - g_hInstance, - MAKEINTRESOURCEW(IDD_INSERTTAG), - hwnd, - EditInsertTagDlgProc, - (LPARAM)&data); - - return (iResult == IDOK) ? true : false; - -} - - -//============================================================================= -// -// EditSortDlgProc() -// -// Controls: 100-102 Radio Button -// 103-108 Check Box -// -INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static int *piSortFlags; - static bool bEnableLogicalSort; - - switch(umsg) - { - case WM_INITDIALOG: - { - piSortFlags = (int*)lParam; - if (*piSortFlags & SORT_DESCENDING) - CheckRadioButton(hwnd,100,102,101); - else if (*piSortFlags & SORT_SHUFFLE) { - CheckRadioButton(hwnd,100,102,102); - DialogEnableWindow(hwnd,103,false); - DialogEnableWindow(hwnd,104,false); - DialogEnableWindow(hwnd,105,false); - DialogEnableWindow(hwnd,106,false); - DialogEnableWindow(hwnd,107,false); - } - else - CheckRadioButton(hwnd,100,102,100); - if (*piSortFlags & SORT_MERGEDUP) - CheckDlgButton(hwnd,103,BST_CHECKED); - if (*piSortFlags & SORT_UNIQDUP) { - CheckDlgButton(hwnd,104,BST_CHECKED); - DialogEnableWindow(hwnd,103,false); - } - if (*piSortFlags & SORT_UNIQUNIQ) - CheckDlgButton(hwnd,105,BST_CHECKED); - if (*piSortFlags & SORT_NOCASE) - CheckDlgButton(hwnd,106,BST_CHECKED); - if (GetProcAddress(GetModuleHandle(L"shlwapi"),"StrCmpLogicalW")) { - if (*piSortFlags & SORT_LOGICAL) - CheckDlgButton(hwnd,107,BST_CHECKED); - bEnableLogicalSort = true; - } - else { - DialogEnableWindow(hwnd,107,false); - bEnableLogicalSort = false; - } - if (!SciCall_IsSelectionRectangle()) { - *piSortFlags &= ~SORT_COLUMN; - DialogEnableWindow(hwnd,108,false); - } - else { - *piSortFlags |= SORT_COLUMN; - CheckDlgButton(hwnd,108,BST_CHECKED); - } - CenterDlgInParent(hwnd); - } - return true; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: { - *piSortFlags = 0; - if (IsDlgButtonChecked(hwnd,101) == BST_CHECKED) - *piSortFlags |= SORT_DESCENDING; - if (IsDlgButtonChecked(hwnd,102) == BST_CHECKED) - *piSortFlags |= SORT_SHUFFLE; - if (IsDlgButtonChecked(hwnd,103) == BST_CHECKED) - *piSortFlags |= SORT_MERGEDUP; - if (IsDlgButtonChecked(hwnd,104) == BST_CHECKED) - *piSortFlags |= SORT_UNIQDUP; - if (IsDlgButtonChecked(hwnd,105) == BST_CHECKED) - *piSortFlags |= SORT_UNIQUNIQ; - if (IsDlgButtonChecked(hwnd,106) == BST_CHECKED) - *piSortFlags |= SORT_NOCASE; - if (IsDlgButtonChecked(hwnd,107) == BST_CHECKED) - *piSortFlags |= SORT_LOGICAL; - if (IsDlgButtonChecked(hwnd,108) == BST_CHECKED) - *piSortFlags |= SORT_COLUMN; - EndDialog(hwnd,IDOK); - } - break; - case IDCANCEL: - EndDialog(hwnd,IDCANCEL); - break; - case 100: - case 101: - DialogEnableWindow(hwnd,103,IsDlgButtonChecked(hwnd,105) != BST_CHECKED); - DialogEnableWindow(hwnd,104,true); - DialogEnableWindow(hwnd,105,true); - DialogEnableWindow(hwnd,106,true); - DialogEnableWindow(hwnd,107,bEnableLogicalSort); - break; - case 102: - DialogEnableWindow(hwnd,103,false); - DialogEnableWindow(hwnd,104,false); - DialogEnableWindow(hwnd,105,false); - DialogEnableWindow(hwnd,106,false); - DialogEnableWindow(hwnd,107,false); - break; - case 104: - DialogEnableWindow(hwnd,103,IsDlgButtonChecked(hwnd,104) != BST_CHECKED); - break; - } - return true; - } - return false; -} - - -//============================================================================= -// -// EditSortDlg() -// -bool EditSortDlg(HWND hwnd,int *piSortFlags) -{ - - INT_PTR iResult; - - iResult = ThemedDialogBoxParam( - g_hInstance, - MAKEINTRESOURCEW(IDD_SORT), - hwnd, - EditSortDlgProc, - (LPARAM)piSortFlags); - - return (iResult == IDOK) ? true : false; - -} - - -//============================================================================= -// -// EditSortDlg() -// -void EditSetAccelWordNav(HWND hwnd,bool bAccelWordNav) -{ - bAccelWordNavigation = bAccelWordNav; - - if (bAccelWordNavigation) { - SendMessage(hwnd, SCI_SETWORDCHARS, 0, (LPARAM)WordCharsAccelerated); - SendMessage(hwnd, SCI_SETWHITESPACECHARS, 0,(LPARAM)WhiteSpaceCharsAccelerated); - SendMessage(hwnd, SCI_SETPUNCTUATIONCHARS,0,(LPARAM)PunctuationCharsAccelerated); - } - else - SendMessage(hwnd, SCI_SETCHARSDEFAULT, 0, 0); -} - - -//============================================================================= -// -// EditGetBookmarkList() -// -void EditGetBookmarkList(HWND hwnd, LPWSTR pszBookMarks, int cchLength) -{ - WCHAR tchLine[32]; - StringCchCopyW(pszBookMarks, cchLength, L""); - int bitmask = (1 << MARKER_NP3_BOOKMARK); - DocLn iLine = -1; - do { - iLine = (DocLn)SendMessage(hwnd, SCI_MARKERNEXT, iLine + 1, bitmask); - if (iLine >= 0) { - StringCchPrintfW(tchLine, COUNTOF(tchLine), L"%td;", iLine); - StringCchCatW(pszBookMarks, cchLength, tchLine); - } - } while (iLine >= 0); - - StrTrimW(pszBookMarks, L";"); -} - - -//============================================================================= -// -// EditSetBookmarkList() -// -void EditSetBookmarkList(HWND hwnd, LPCWSTR pszBookMarks) -{ - UNUSED(hwnd); - WCHAR lnNum[32]; - const WCHAR* p1 = pszBookMarks; - if (!p1) return; - - const DocLn iLineMax = SciCall_GetLineCount() - 1; - - while (*p1) { - const WCHAR* p2 = StrChr(p1, L';'); - if (!p2) - p2 = StrEnd(p1); - StringCchCopyNW(lnNum, COUNTOF(lnNum), p1, min((int)(p2 - p1), 16)); - long long iLine = 0; - if (swscanf_s(lnNum, L"%lld", &iLine) == 1) { - if (iLine <= iLineMax) { - Sci_SendMsgV2(MARKERADD, iLine, MARKER_NP3_BOOKMARK); - } - } - p1 = (*p2) ? (p2 + 1) : p2; - } -} - - -//============================================================================= -// -// _SetFileVars() -// -extern bool bNoEncodingTags; -extern int flagNoFileVariables; - -static void __fastcall _SetFileVars(char* lpData, char* tch, LPFILEVARS lpfv) -{ - int i; - bool bDisableFileVar = false; - - if (!flagNoFileVariables) { - - if (FileVars_ParseInt(tch, "enable-local-variables", &i) && (!i)) - bDisableFileVar = true; - - if (!bDisableFileVar) { - - if (FileVars_ParseInt(tch, "tab-width", &i)) { - lpfv->iTabWidth = max(min(i, 256), 1); - lpfv->mask |= FV_TABWIDTH; - } - - if (FileVars_ParseInt(tch, "c-basic-indent", &i)) { - lpfv->iIndentWidth = max(min(i, 256), 0); - lpfv->mask |= FV_INDENTWIDTH; - } - - if (FileVars_ParseInt(tch, "indent-tabs-mode", &i)) { - lpfv->bTabsAsSpaces = (i) ? false : true; - lpfv->mask |= FV_TABSASSPACES; - } - - if (FileVars_ParseInt(tch, "c-tab-always-indent", &i)) { - lpfv->bTabIndents = (i) ? true : false; - lpfv->mask |= FV_TABINDENTS; - } - - if (FileVars_ParseInt(tch, "truncate-lines", &i)) { - lpfv->fWordWrap = (i) ? false : true; - lpfv->mask |= FV_WORDWRAP; - } - - if (FileVars_ParseInt(tch, "fill-column", &i)) { - lpfv->iLongLinesLimit = max(min(i, 4096), 0); - lpfv->mask |= FV_LONGLINESLIMIT; - } - } - } - - if (!IsUTF8Signature(lpData) && !bNoEncodingTags && !bDisableFileVar) { - - if (FileVars_ParseStr(tch, "encoding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) - lpfv->mask |= FV_ENCODING; - else if (FileVars_ParseStr(tch, "charset", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) - lpfv->mask |= FV_ENCODING; - else if (FileVars_ParseStr(tch, "coding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) - lpfv->mask |= FV_ENCODING; - } - - if (!flagNoFileVariables && !bDisableFileVar) { - if (FileVars_ParseStr(tch, "mode", lpfv->tchMode, COUNTOF(lpfv->tchMode))) - lpfv->mask |= FV_MODE; - } -} - -//============================================================================= -// -// FileVars_Init() -// - -bool FileVars_Init(char *lpData, DWORD cbData, LPFILEVARS lpfv) { - - char tch[LARGE_BUFFER]; - - ZeroMemory(lpfv,sizeof(FILEVARS)); - if ((flagNoFileVariables && bNoEncodingTags) || !lpData || !cbData) - return true; - - StringCchCopyNA(tch,COUNTOF(tch),lpData,min(cbData + 1,COUNTOF(tch))); - _SetFileVars(lpData, tch, lpfv); - - if (lpfv->mask == 0 && cbData > COUNTOF(tch)) { - StringCchCopyNA(tch,COUNTOF(tch),lpData + cbData - COUNTOF(tch) + 1,COUNTOF(tch)); - _SetFileVars(lpData, tch, lpfv); - } - - if (lpfv->mask & FV_ENCODING) - lpfv->iEncoding = Encoding_MatchA(lpfv->tchEncoding); - - return true; -} - - -//============================================================================= -// -// FileVars_Apply() -// -extern bool bTabsAsSpacesG; -extern bool bTabIndentsG; -extern int iTabWidthG; -extern int iIndentWidthG; -extern bool bWordWrap; -extern bool bWordWrapG; -extern int iWordWrapMode; -extern int iLongLinesLimit; -extern int iLongLinesLimitG; -extern int iWrapCol; - -bool FileVars_Apply(HWND hwnd,LPFILEVARS lpfv) { - - if (lpfv->mask & FV_TABWIDTH) - g_iTabWidth = lpfv->iTabWidth; - else - g_iTabWidth = iTabWidthG; - SendMessage(hwnd,SCI_SETTABWIDTH,g_iTabWidth,0); - - if (lpfv->mask & FV_INDENTWIDTH) - g_iIndentWidth = lpfv->iIndentWidth; - else if (lpfv->mask & FV_TABWIDTH) - g_iIndentWidth = 0; - else - g_iIndentWidth = iIndentWidthG; - SendMessage(hwnd,SCI_SETINDENT,g_iIndentWidth,0); - - if (lpfv->mask & FV_TABSASSPACES) - g_bTabsAsSpaces = lpfv->bTabsAsSpaces; - else - g_bTabsAsSpaces = bTabsAsSpacesG; - SendMessage(hwnd,SCI_SETUSETABS,!g_bTabsAsSpaces,0); - - if (lpfv->mask & FV_TABINDENTS) - g_bTabIndents = lpfv->bTabIndents; - else - g_bTabIndents = bTabIndentsG; - SendMessage(g_hwndEdit,SCI_SETTABINDENTS,g_bTabIndents,0); - - if (lpfv->mask & FV_WORDWRAP) - bWordWrap = lpfv->fWordWrap; - else - bWordWrap = bWordWrapG; - - if (!bWordWrap) - SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0); - else - SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0); - - if (lpfv->mask & FV_LONGLINESLIMIT) - iLongLinesLimit = lpfv->iLongLinesLimit; - else - iLongLinesLimit = iLongLinesLimitG; - SendMessage(hwnd,SCI_SETEDGECOLUMN,iLongLinesLimit,0); - - iWrapCol = 0; - - return(true); -} - - -//============================================================================= -// -// FileVars_ParseInt() -// -bool FileVars_ParseInt(char* pszData,char* pszName,int* piValue) { - - char *pvStart = StrStrIA(pszData, pszName); - while (pvStart) { - char chPrev = (pvStart > pszData) ? *(pvStart-1) : 0; - if (!IsCharAlphaNumericA(chPrev) && chPrev != '-' && chPrev != '_') { - pvStart += lstrlenA(pszName); - while (*pvStart == ' ') - pvStart++; - if (*pvStart == ':' || *pvStart == '=') - break; - } - else - pvStart += lstrlenA(pszName); - - pvStart = StrStrIA(pvStart, pszName); // next - } - - if (pvStart) { - - while (*pvStart && StrChrIA(":=\"' \t",*pvStart)) - pvStart++; - - char tch[32] = { L'\0' }; - StringCchCopyNA(tch,COUNTOF(tch),pvStart,COUNTOF(tch)); - - char* pvEnd = tch; - while (*pvEnd && IsCharAlphaNumericA(*pvEnd)) - pvEnd++; - *pvEnd = 0; - StrTrimA(tch," \t:=\"'"); - - int itok = sscanf_s(tch,"%i",piValue); - if (itok == 1) - return(true); - - if (tch[0] == 't') { - *piValue = 1; - return(true); - } - - if (tch[0] == 'n' || tch[0] == 'f') { - *piValue = 0; - return(true); - } - } - return(false); -} - - -//============================================================================= -// -// FileVars_ParseStr() -// -bool FileVars_ParseStr(char* pszData,char* pszName,char* pszValue,int cchValue) { - - char *pvStart = StrStrIA(pszData, pszName); - while (pvStart) { - char chPrev = (pvStart > pszData) ? *(pvStart-1) : 0; - if (!IsCharAlphaNumericA(chPrev) && chPrev != '-' && chPrev != '_') { - pvStart += lstrlenA(pszName); - while (*pvStart == ' ') - pvStart++; - if (*pvStart == ':' || *pvStart == '=') - break; - } - else - pvStart += lstrlenA(pszName); - - pvStart = StrStrIA(pvStart, pszName); // next - } - - if (pvStart) { - - bool bQuoted = false; - while (*pvStart && StrChrIA(":=\"' \t",*pvStart)) { - if (*pvStart == '\'' || *pvStart == '"') - bQuoted = true; - pvStart++; - } - - char tch[32] = { L'\0' }; - StringCchCopyNA(tch,COUNTOF(tch),pvStart,COUNTOF(tch)); - - char* pvEnd = tch; - while (*pvEnd && (IsCharAlphaNumericA(*pvEnd) || StrChrIA("+-/_",*pvEnd) || (bQuoted && *pvEnd == ' '))) - pvEnd++; - *pvEnd = 0; - StrTrimA(tch," \t:=\"'"); - - StringCchCopyNA(pszValue,cchValue,tch,COUNTOF(tch)); - - return(true); - } - return(false); -} - - -//============================================================================= -// -// FileVars_IsUTF8() -// -bool FileVars_IsUTF8(LPFILEVARS lpfv) { - if (lpfv->mask & FV_ENCODING) { - if (StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf-8",-1) == 0 || - StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf8",-1) == 0) - return(true); - } - return(false); -} - - -//============================================================================= -// -// FileVars_IsNonUTF8() -// -bool FileVars_IsNonUTF8(LPFILEVARS lpfv) { - if (lpfv->mask & FV_ENCODING) { - if (StringCchLenA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)) && - StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf-8",-1) != 0 && - StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf8",-1) != 0) - return(true); - } - return(false); -} - - -//============================================================================= -// -// FileVars_IsValidEncoding() -// -bool FileVars_IsValidEncoding(LPFILEVARS lpfv) { - CPINFO cpi; - if (lpfv->mask & FV_ENCODING && - lpfv->iEncoding >= 0 && - lpfv->iEncoding < Encoding_CountOf()) { - if ((Encoding_IsINTERNAL(lpfv->iEncoding)) || - IsValidCodePage(Encoding_GetCodePage(lpfv->iEncoding)) && - GetCPInfo(Encoding_GetCodePage(lpfv->iEncoding),&cpi)) { - return(true); - } - } - return(false); -} - -//============================================================================= -// -// FileVars_GetEncoding() -// -int FileVars_GetEncoding(LPFILEVARS lpfv) { - if (lpfv->mask & FV_ENCODING) - return(lpfv->iEncoding); - else - return(-1); -} - - -//============================================================================== -// -// Folding Functions -// -// -#define FOLD_CHILDREN SCMOD_CTRL -#define FOLD_SIBLINGS SCMOD_SHIFT - -bool __stdcall FoldToggleNode(DocLn ln, FOLD_ACTION action) -{ - const bool fExpanded = SciCall_GetFoldExpanded(ln); - - if ((action == FOLD && fExpanded) || (action == EXPAND && !fExpanded)) - { - SciCall_ToggleFold(ln); - return true; - } - else if (action == SNIFF) - { - SciCall_ToggleFold(ln); - return true; - } - return false; -} - - -void __stdcall EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action) -{ - if (action == SNIFF) { - action = SciCall_GetFoldExpanded(ln) ? FOLD : EXPAND; - } - if (mode & (FOLD_CHILDREN | FOLD_SIBLINGS)) - { - // ln/lvNode: line and level of the source of this fold action - DocLn lnNode = ln; - int lvNode = SciCall_GetFoldLevel(lnNode) & SC_FOLDLEVELNUMBERMASK; - DocLn lnTotal = SciCall_GetLineCount(); - - // lvStop: the level over which we should not cross - int lvStop = lvNode; - - if (mode & FOLD_SIBLINGS) - { - ln = SciCall_GetFoldParent(lnNode) + 1; // -1 + 1 = 0 if no parent - --lvStop; - } - - for (; ln < lnTotal; ++ln) - { - int lv = SciCall_GetFoldLevel(ln); - bool fHeader = lv & SC_FOLDLEVELHEADERFLAG; - lv &= SC_FOLDLEVELNUMBERMASK; - - if (lv < lvStop || (lv == lvStop && fHeader && ln != lnNode)) - return; - else if (fHeader && (lv == lvNode || (lv > lvNode && mode & FOLD_CHILDREN))) - FoldToggleNode(ln, action); - } - } - else { - FoldToggleNode(ln, action); - } -} - - -void EditFoldToggleAll(FOLD_ACTION action) -{ - static FOLD_ACTION sLastAction = EXPAND; - - bool fToggled = false; - - DocLn lnTotal = SciCall_GetLineCount(); - - if (action == SNIFF) - { - int cntFolded = 0; - int cntExpanded = 0; - for (int ln = 0; ln < lnTotal; ++ln) - { - if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) - { - if (SciCall_GetFoldExpanded(ln)) - ++cntExpanded; - else - ++cntFolded; - } - } - if (cntFolded == cntExpanded) - action = (sLastAction == FOLD) ? EXPAND : FOLD; - else - action = (cntFolded < cntExpanded) ? FOLD : EXPAND; - } - - for (int ln = 0; ln < lnTotal; ++ln) - { - if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) - { - if (FoldToggleNode(ln, action)) { fToggled = true; } - } - } - if (fToggled) { SciCall_ScrollCaret(); } -} - - -void EditFoldClick(DocLn ln, int mode) -{ - static struct { - DocLn ln; - int mode; - DWORD dwTickCount; - } prev; - - bool fGotoFoldPoint = mode & FOLD_SIBLINGS; - - if (!(SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG)) - { - // Not a fold point: need to look for a double-click - if (prev.ln == ln && prev.mode == mode && - GetTickCount() - prev.dwTickCount <= GetDoubleClickTime()) - { - prev.ln = (DocLn)-1; // Prevent re-triggering on a triple-click - - ln = SciCall_GetFoldParent(ln); - - if (ln >= 0 && SciCall_GetFoldExpanded(ln)) - fGotoFoldPoint = true; - else - return; - } - else - { - // Save the info needed to match this click with the next click - prev.ln = ln; - prev.mode = mode; - prev.dwTickCount = GetTickCount(); - return; - } - } - - EditFoldPerformAction(ln, mode, SNIFF); - - if (fGotoFoldPoint) { - EditJumpTo(g_hwndEdit, ln + 1, 0); - } -} - - -void EditFoldAltArrow(FOLD_MOVE move, FOLD_ACTION action) -{ - if (g_bCodeFoldingAvailable && g_bShowCodeFolding) - { - DocLn ln = SciCall_LineFromPosition(SciCall_GetCurrentPos()); - - // Jump to the next visible fold point - if (move == DOWN) - { - DocLn lnTotal = SciCall_GetLineCount(); - for (ln = ln + 1; ln < lnTotal; ++ln) - { - if ((SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) && SciCall_GetLineVisible(ln)) - { - EditJumpTo(g_hwndEdit, ln + 1, 0); - return; - } - } - } - else if (move == UP) // Jump to the previous visible fold point - { - for (ln = ln - 1; ln >= 0; --ln) - { - if ((SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) && SciCall_GetLineVisible(ln)) - { - EditJumpTo(g_hwndEdit, ln + 1, 0); - return; - } - } - } - - // Perform a fold/unfold operation - if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) - { - if (action != SNIFF) { - FoldToggleNode(ln, action); - } - } - } -} - - - -//============================================================================= -// -// SciInitThemes() -// -//WNDPROC pfnSciWndProc = NULL; -// -//FARPROC pfnOpenThemeData = NULL; -//FARPROC pfnCloseThemeData = NULL; -//FARPROC pfnDrawThemeBackground = NULL; -//FARPROC pfnGetThemeBackgroundContentRect = NULL; -//FARPROC pfnIsThemeActive = NULL; -//FARPROC pfnDrawThemeParentBackground = NULL; -//FARPROC pfnIsThemeBackgroundPartiallyTransparent = NULL; -// -//bool bThemesPresent = false; -//extern bool bIsAppThemed; -//extern HMODULE hModUxTheme; -// -//void SciInitThemes(HWND hwnd) -//{ -// if (hModUxTheme) { -// -// pfnOpenThemeData = GetProcAddress(hModUxTheme,"OpenThemeData"); -// pfnCloseThemeData = GetProcAddress(hModUxTheme,"CloseThemeData"); -// pfnDrawThemeBackground = GetProcAddress(hModUxTheme,"DrawThemeBackground"); -// pfnGetThemeBackgroundContentRect = GetProcAddress(hModUxTheme,"GetThemeBackgroundContentRect"); -// pfnIsThemeActive = GetProcAddress(hModUxTheme,"IsThemeActive"); -// pfnDrawThemeParentBackground = GetProcAddress(hModUxTheme,"DrawThemeParentBackground"); -// pfnIsThemeBackgroundPartiallyTransparent = GetProcAddress(hModUxTheme,"IsThemeBackgroundPartiallyTransparent"); -// -// pfnSciWndProc = (WNDPROC)SetWindowLongPtrW(hwnd,GWLP_WNDPROC,(LONG_PTR)&SciThemedWndProc); -// bThemesPresent = true; -// } -//} -// -// -////============================================================================= -//// -//// SciThemedWndProc() -//// -//LRESULT CALLBACK SciThemedWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -//{ -// static RECT rcContent; -// -// if (umsg == WM_NCCALCSIZE) { -// if (wParam) { -// LRESULT lresult = CallWindowProcW(pfnSciWndProc,hwnd,WM_NCCALCSIZE,wParam,lParam); -// NCCALCSIZE_PARAMS *csp = (NCCALCSIZE_PARAMS*)lParam; -// -// if (bThemesPresent && bIsAppThemed) { -// HANDLE hTheme = (HANDLE)pfnOpenThemeData(hwnd,L"edit"); -// if(hTheme) { -// bool bSuccess = false; -// RECT rcClient; -// -// if(pfnGetThemeBackgroundContentRect( -// hTheme,NULL,/*EP_EDITTEXT*/1,/*ETS_NORMAL*/1,&csp->rgrc[0],&rcClient) == S_OK) { -// InflateRect(&rcClient,-1,-1); -// -// rcContent.left = rcClient.left-csp->rgrc[0].left; -// rcContent.top = rcClient.top-csp->rgrc[0].top; -// rcContent.right = csp->rgrc[0].right-rcClient.right; -// rcContent.bottom = csp->rgrc[0].bottom-rcClient.bottom; -// -// CopyRect(&csp->rgrc[0],&rcClient); -// bSuccess = true; -// } -// pfnCloseThemeData(hTheme); -// -// if (bSuccess) -// return WVR_REDRAW; -// } -// } -// return lresult; -// } -// } -// -// else if (umsg == WM_NCPAINT) { -// LRESULT lresult = CallWindowProcW(pfnSciWndProc,hwnd,WM_NCPAINT,wParam,lParam); -// if(bThemesPresent && bIsAppThemed) { -// -// HANDLE hTheme = (HANDLE)pfnOpenThemeData(hwnd,L"edit"); -// if(hTheme) { -// RECT rcBorder; -// RECT rcClient; -// int nState; -// -// HDC hdc = GetWindowDC(hwnd); -// -// GetWindowRect(hwnd,&rcBorder); -// OffsetRect(&rcBorder,-rcBorder.left,-rcBorder.top); -// -// CopyRect(&rcClient,&rcBorder); -// rcClient.left += rcContent.left; -// rcClient.top += rcContent.top; -// rcClient.right -= rcContent.right; -// rcClient.bottom -= rcContent.bottom; -// -// ExcludeClipRect(hdc,rcClient.left,rcClient.top,rcClient.right,rcClient.bottom); -// -// if(pfnIsThemeBackgroundPartiallyTransparent(hTheme,/*EP_EDITTEXT*/1,/*ETS_NORMAL*/1)) -// pfnDrawThemeParentBackground(hwnd,hdc,&rcBorder); -// -// /* -// ETS_NORMAL = 1 -// ETS_HOT = 2 -// ETS_SELECTED = 3 -// ETS_DISABLED = 4 -// ETS_FOCUSED = 5 -// ETS_READONLY = 6 -// ETS_ASSIST = 7 -// */ -// -// if(!IsWindowEnabled(hwnd)) -// nState = /*ETS_DISABLED*/4; -// else if (GetFocus() == hwnd) -// nState = /*ETS_FOCUSED*/5; -// else if(SendMessage(hwnd,SCI_GETREADONLY,0,0)) -// nState = /*ETS_READONLY*/6; -// else -// nState = /*ETS_NORMAL*/1; -// -// pfnDrawThemeBackground(hTheme,hdc,/*EP_EDITTEXT*/1,nState,&rcBorder,NULL); -// pfnCloseThemeData(hTheme); -// -// ReleaseDC(hwnd,hdc); -// return 0; -// } -// } -// return lresult; -// } -// -// return CallWindowProcW(pfnSciWndProc,hwnd,umsg,wParam,lParam); -//} - - - -/// End of Edit.c \\\ +/****************************************************************************** +* * +* * +* Notepad3 * +* * +* Edit.c * +* Text File Editing Helper Stuff * +* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * +* * +* (c) Rizonesoft 2008-2016 * +* https://rizonesoft.com * +* * +* * +*******************************************************************************/ + +#if !defined(WINVER) +#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(NTDDI_VERSION) +#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ +#endif + +#define VC_EXTRALEAN 1 +#include + +#include +#include +#include +#include +#include +#include + +#include "scintilla.h" +#include "scilexer.h" +#include "notepad3.h" +#include "styles.h" +#include "dialogs.h" +#include "resource.h" +#include "../crypto/crypto.h" +#include "../uthash/utarray.h" +#include "../uthash/utlist.h" +//#include "../uthash/utstring.h" +#include "helpers.h" +#include "encoding.h" + +#include "SciCall.h" + +#include "edit.h" + + +#ifndef LCMAP_TITLECASE +#define LCMAP_TITLECASE 0x00000300 // Title Case Letters bit mask +#endif + +// find free bits in scintilla.h SCFIND_ defines +#define SCFIND_NP3_REGEX (SCFIND_REGEXP | SCFIND_POSIX) + +extern HWND g_hwndMain; +extern HWND g_hwndStatus; +extern HWND g_hwndDlgFindReplace; +extern WININFO g_WinInfo; + +extern HINSTANCE g_hInstance; +//extern LPMALLOC g_lpMalloc; + +extern DWORD dwLastIOError; +extern bool bReplaceInitialized; +extern bool bUseOldStyleBraceMatching; +extern bool bUseDefaultForFileEncoding; +extern bool bFindReplCopySelOrClip; + +static EDITFINDREPLACE efrSave; +static bool bSwitchedFindReplace = false; + +extern int xFindReplaceDlg; +extern int yFindReplaceDlg; +static int xFindReplaceDlgSave; +static int yFindReplaceDlgSave; + +extern int g_iDefaultEOLMode; +extern int iLineEndings[3]; +extern bool bFixLineEndings; +extern bool bAutoStripBlanks; + +// Default Codepage and Character Set +extern int g_iDefaultNewFileEncoding; +extern int g_iDefaultCharSet; +extern bool bLoadASCIIasUTF8; +extern bool bLoadNFOasOEM; + +extern bool bAccelWordNavigation; + +extern int iReplacedOccurrences; +extern int g_iMarkOccurrences; +extern int g_iMarkOccurrencesCount; +extern int g_iMarkOccurrencesMaxCount; +extern bool g_bMarkOccurrencesMatchVisible; + +extern bool g_bHyperlinkHotspot; +extern bool g_bCodeFoldingAvailable; +extern bool g_bShowCodeFolding; + +extern bool g_bTabsAsSpaces; +extern bool g_bTabIndents; +extern int g_iTabWidth; +extern int g_iIndentWidth; + +extern FR_STATES g_FindReplaceMatchFoundState; + +#define DELIM_BUFFER 258 +static char DelimChars[DELIM_BUFFER] = { '\0' }; +static char DelimCharsAccel[DELIM_BUFFER] = { '\0' }; +static char WordCharsDefault[DELIM_BUFFER] = { '\0' }; +static char WhiteSpaceCharsDefault[DELIM_BUFFER] = { '\0' }; +static char PunctuationCharsDefault[DELIM_BUFFER] = { '\0' }; +static char WordCharsAccelerated[DELIM_BUFFER] = { '\0' }; +static char WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { '\0' }; +static char PunctuationCharsAccelerated[1] = { '\0' }; // empty! + +//static WCHAR W_DelimChars[DELIM_BUFFER] = { L'\0' }; +//static WCHAR W_DelimCharsAccel[DELIM_BUFFER] = { L'\0' }; +//static WCHAR W_WhiteSpaceCharsDefault[DELIM_BUFFER] = { L'\0' }; +//static WCHAR W_WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { L'\0' }; + + +// Is the character a white space char? +//#define IsWhiteSpace(ch) (((ch) == ' ') || ((ch) == '\t')) +#define IsWhiteSpace(ch) StrChrA(WhiteSpaceCharsDefault, (ch)) +#define IsAccelWhiteSpace(ch) StrChrA(WhiteSpaceCharsAccelerated, (ch)) + + +// temporary line buffer for fast line ops +static char g_pTempLineBuffer[TEMPLINE_BUFFER]; + + +enum AlignMask { + ALIGN_LEFT = 0, + ALIGN_RIGHT = 1, + ALIGN_CENTER = 2, + ALIGN_JUSTIFY = 3, + ALIGN_JUSTIFY_EX = 4 +}; + +enum SortOrderMask { + SORT_ASCENDING = 0, + SORT_DESCENDING = 1, + SORT_SHUFFLE = 2, + SORT_MERGEDUP = 4, + SORT_UNIQDUP = 8, + SORT_UNIQUNIQ = 16, + SORT_NOCASE = 32, + SORT_LOGICAL = 64, + SORT_COLUMN = 128 +}; + + +extern LPMRULIST g_pMRUfind; +extern LPMRULIST g_pMRUreplace; + +extern bool bMarkOccurrencesCurrentWord; +extern bool bMarkOccurrencesMatchCase; +extern bool bMarkOccurrencesMatchWords; + +// Timer bitfield +static volatile LONG g_lTargetTransactionBits = 0; +//#define BIT_TIMER_MARK_OCC 1L +#define BIT_MARK_OCC_IN_PROGRESS 2L +#define BLOCK_BIT_TARGET_TRANSACTION 4L + +#define TEST_AND_SET(BIT) InterlockedBitTestAndSet(&g_lTargetTransactionBits, BIT) +#define TEST_AND_RESET(BIT) InterlockedBitTestAndReset(&g_lTargetTransactionBits, BIT) + + +//============================================================================= +// +// EditEnterTargetTransaction(), EditLeaveTargetTransaction() +// +void EditEnterTargetTransaction() { + (void)TEST_AND_SET(BLOCK_BIT_TARGET_TRANSACTION); +} + +void EditLeaveTargetTransaction() { + (void)TEST_AND_RESET(BLOCK_BIT_TARGET_TRANSACTION); +} + +bool EditIsInTargetTransaction() { + if (TEST_AND_RESET(BLOCK_BIT_TARGET_TRANSACTION)) { + (void)TEST_AND_SET(BLOCK_BIT_TARGET_TRANSACTION); + return true; + } + return false; +} + + +//============================================================================= +// +// Delay Message Queue Handling (TODO: MultiThreading) +// + +static CmdMessageQueue_t* MessageQueue = NULL; + +// ---------------------------------------------------------------------------- + +static int msgcmp(void* mqc1, void* mqc2) +{ + const CmdMessageQueue_t* pMQC1 = (CmdMessageQueue_t*)mqc1; + const CmdMessageQueue_t* pMQC2 = (CmdMessageQueue_t*)mqc2; + + if ((pMQC1->hwnd == pMQC2->hwnd) + && (pMQC1->cmd == pMQC2->cmd) + && (pMQC1->wparam == pMQC2->wparam) + && (pMQC1->lparam == pMQC2->lparam)) { + return 0; + } + return 1; +} +// ---------------------------------------------------------------------------- + +static void __fastcall _MQ_AppendCmd(CmdMessageQueue_t* pMsgQCmd, int delay) +{ + CmdMessageQueue_t* pmqc = NULL; + DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp); + + if (!pmqc) { // NOT found + pmqc = AllocMem(sizeof(CmdMessageQueue_t), HEAP_ZERO_MEMORY); + pmqc->hwnd = pMsgQCmd->hwnd; + pmqc->cmd = pMsgQCmd->cmd; + pmqc->wparam = pMsgQCmd->wparam; + pmqc->lparam = pMsgQCmd->lparam; + pmqc->delay = 0; + DL_APPEND(MessageQueue, pmqc); + } + + if (delay < 2) { + pmqc->delay = 0; // execute next + PostMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam); + } + else { + pmqc->delay = (pmqc->delay + delay) / 2; // increase delay + } +} + +// ---------------------------------------------------------------------------- +// +// called by Timer(IDT_TIMER_MRKALL) +// +static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + UNUSED(hwnd); // must be main wnd + UNUSED(uMsg); // must be WM_TIMER + UNUSED(idEvent); // must be IDT_TIMER_MRKALL + UNUSED(dwTime); // This is the value returned by the GetTickCount function + + CmdMessageQueue_t* pmqc; + + DL_FOREACH(MessageQueue, pmqc) + { + if (pmqc->delay == 0) { + SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam); + } + if (pmqc->delay >= 0) { + pmqc->delay -= 1; + } + } +} + + + +//============================================================================= +// +// EditSetWordDelimiter() +// +void EditInitWordDelimiter(HWND hwnd) +{ + ZeroMemory(WordCharsDefault, COUNTOF(WordCharsDefault)); + ZeroMemory(WhiteSpaceCharsDefault, COUNTOF(WhiteSpaceCharsDefault)); + ZeroMemory(PunctuationCharsDefault, COUNTOF(PunctuationCharsDefault)); + ZeroMemory(WordCharsAccelerated, COUNTOF(WordCharsAccelerated)); + ZeroMemory(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated)); + //ZeroMemory(PunctuationCharsAccelerated, COUNTOF(PunctuationCharsAccelerated)); // empty! + + // 1st get/set defaults + SendMessage(hwnd, SCI_GETWORDCHARS, 0, (LPARAM)WordCharsDefault); + SendMessage(hwnd, SCI_GETWHITESPACECHARS, 0, (LPARAM)WhiteSpaceCharsDefault); + SendMessage(hwnd, SCI_GETPUNCTUATIONCHARS, 0, (LPARAM)PunctuationCharsDefault); + + // default word delimiter chars are whitespace & punctuation & line ends + const char* lineEnds = "\r\n"; + StringCchCopyA(DelimChars, COUNTOF(DelimChars), WhiteSpaceCharsDefault); + StringCchCatA(DelimChars, COUNTOF(DelimChars), PunctuationCharsDefault); + StringCchCatA(DelimChars, COUNTOF(DelimChars), lineEnds); + + // 2nd get user settings + WCHAR buffer[DELIM_BUFFER] = { L'\0' }; + ZeroMemory(buffer, DELIM_BUFFER * sizeof(WCHAR)); + + IniGetString(L"Settings2", L"ExtendedWhiteSpaceChars", L"", buffer, COUNTOF(buffer)); + char whitesp[DELIM_BUFFER] = { '\0' }; + if (StringCchLen(buffer, COUNTOF(buffer)) > 0) { + WideCharToMultiByteStrg(CP_ACP, buffer, whitesp); + } + + // 3rd set accelerated arrays + + // init with default + StringCchCopyA(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated), WhiteSpaceCharsDefault); + + // add only 7-bit-ASCII chars to accelerated whitespace list + for (size_t i = 0; i < strlen(whitesp); i++) { + if (whitesp[i] & 0x7F) { + if (!StrChrA(WhiteSpaceCharsAccelerated, whitesp[i])) { + StringCchCatNA(WhiteSpaceCharsAccelerated, COUNTOF(WhiteSpaceCharsAccelerated), &(whitesp[i]), 1); + } + } + } + + // construct word char array + StringCchCopyA(WordCharsAccelerated, COUNTOF(WordCharsAccelerated), WordCharsDefault); // init + // add punctuation chars not listed in white-space array + for (size_t i = 0; i < strlen(PunctuationCharsDefault); i++) { + if (!StrChrA(WhiteSpaceCharsAccelerated, PunctuationCharsDefault[i])) { + StringCchCatNA(WordCharsAccelerated, COUNTOF(WordCharsAccelerated), &(PunctuationCharsDefault[i]), 1); + } + } + + // construct accelerated delimiters + StringCchCopyA(DelimCharsAccel, COUNTOF(DelimCharsAccel), WhiteSpaceCharsDefault); + StringCchCatA(DelimCharsAccel, COUNTOF(DelimCharsAccel), lineEnds); + + // constuct wide char arrays + //MultiByteToWideChar(Encoding_SciCP, 0, DelimChars, -1, W_DelimChars, COUNTOF(W_DelimChars)); + //MultiByteToWideChar(Encoding_SciCP, 0, DelimCharsAccel, -1, W_DelimCharsAccel, COUNTOF(W_DelimCharsAccel)); + //MultiByteToWideChar(Encoding_SciCP, 0, WhiteSpaceCharsDefault, -1, W_WhiteSpaceCharsDefault, COUNTOF(W_WhiteSpaceCharsDefault)); + //MultiByteToWideChar(Encoding_SciCP, 0, WhiteSpaceCharsAccelerated, -1, W_WhiteSpaceCharsAccelerated, COUNTOF(W_WhiteSpaceCharsAccelerated)); + +} + + + +//============================================================================= +// +// EditSetNewText() +// +extern bool bFreezeAppTitle; +extern FILEVARS fvCurFile; + + +void EditSetNewText(HWND hwnd,char* lpstrText,DWORD cbText) +{ + bFreezeAppTitle = true; + + if (SendMessage(hwnd, SCI_GETREADONLY, 0, 0)) { + SendMessage(hwnd, SCI_SETREADONLY, false, 0); + } + + SendMessage(hwnd,SCI_CANCEL,0,0); + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); + UndoRedoActionMap(-1,NULL); + SendMessage(hwnd,SCI_CLEARALL,0,0); + SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); + SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_OCCUR_LINE,0); + SendMessage(hwnd,SCI_SETSCROLLWIDTH,GetSystemMetrics(SM_CXSCREEN),0); + SendMessage(hwnd,SCI_SETXOFFSET,0,0); + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + } + + FileVars_Apply(hwnd,&fvCurFile); + + if (cbText > 0) { + SendMessage(hwnd, SCI_ADDTEXT, cbText, (LPARAM)lpstrText); + } + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,1,0); + //SendMessage(hwnd,EM_EMPTYUNDOBUFFER,0,0); // deprecated + SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); + SendMessage(hwnd, SCI_SETSCROLLWIDTH, 1, 0); + SendMessage(hwnd,SCI_GOTOPOS,0,0); + SendMessage(hwnd,SCI_CHOOSECARETX,0,0); + + bFreezeAppTitle = false; +} + + +//============================================================================= +// +// EditConvertText() +// +bool EditConvertText(HWND hwnd, int encSource, int encDest, bool bSetSavePoint) +{ + if (encSource == encDest) + return(true); + + if (!(Encoding_IsValid(encSource) && Encoding_IsValid(encDest))) + return(false); + + DocPos length = SciCall_GetTextLength(); + + if (length == 0) + { + SendMessage(hwnd,SCI_CANCEL,0,0); + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); + UndoRedoActionMap(-1,NULL); + SendMessage(hwnd,SCI_CLEARALL,0,0); + SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); + SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0); + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0); + SendMessage(hwnd,SCI_GOTOPOS,0,0); + SendMessage(hwnd,SCI_CHOOSECARETX,0,0); + + if (bSetSavePoint) + SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); + } + else { + + const DocPos chBufSize = length * 5 + 2; + char* pchText = AllocMem(chBufSize,HEAP_ZERO_MEMORY); + + struct Sci_TextRange tr = { { 0, -1 }, NULL }; + tr.lpstrText = pchText; + SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); + + const DocPos wchBufSize = length * 3 + 2; + WCHAR* pwchText = AllocMem(wchBufSize, HEAP_ZERO_MEMORY); + + // MultiBytes(Sci) -> WideChar(destination) -> Sci(MultiByte) + const UINT cpDst = Encoding_GetCodePage(encDest); + + // get text as wide char + int cbwText = MultiByteToWideChar(Encoding_SciCP,0, pchText, (int)length, pwchText, (int)wchBufSize); + // convert wide char to destination multibyte + int cbText = WideCharToMultiByte(cpDst, 0, pwchText, cbwText, pchText, (int)chBufSize, NULL, NULL); + // re-code to wide char + cbwText = MultiByteToWideChar(cpDst, 0, pchText, cbText, pwchText, (int)wchBufSize); + // convert to Scintilla format + cbText = WideCharToMultiByte(Encoding_SciCP, 0, pwchText, cbwText, pchText, (int)chBufSize, NULL, NULL); + pchText[cbText] = '\0'; + pchText[cbText+1] = '\0'; + + SendMessage(hwnd,SCI_CANCEL,0,0); + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); + UndoRedoActionMap(-1,NULL); + SendMessage(hwnd,SCI_CLEARALL,0,0); + SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0); + SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0); + SendMessage(hwnd,SCI_ADDTEXT,cbText,(LPARAM)pchText); + SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0); + SendMessage(hwnd,SCI_GOTOPOS,0,0); + SendMessage(hwnd,SCI_CHOOSECARETX,0,0); + + FreeMem(pchText); + FreeMem(pwchText); + + } + return(true); +} + + +//============================================================================= +// +// EditSetNewEncoding() +// +bool EditSetNewEncoding(HWND hwnd,int iNewEncoding,bool bNoUI,bool bSetSavePoint) { + + int iCurrentEncoding = Encoding_Current(CPI_GET); + + if (iCurrentEncoding != iNewEncoding) { + + // conversion between arbitrary encodings may lead to unexpected results + //bool bOneEncodingIsANSI = (Encoding_IsANSI(iCurrentEncoding) || Encoding_IsANSI(iNewEncoding)); + //bool bBothEncodingsAreANSI = (Encoding_IsANSI(iCurrentEncoding) && Encoding_IsANSI(iNewEncoding)); + //if (!bOneEncodingIsANSI || bBothEncodingsAreANSI) { + // ~ return true; // this would imply a successful conversion - it is not ! + //return false; // commented out ? : allow conversion between arbitrary encodings + //} + + if (SciCall_GetTextLength() == 0) { + + bool bIsEmptyUndoHistory = (SendMessage(hwnd, SCI_CANUNDO, 0, 0) == 0 && SendMessage(hwnd, SCI_CANREDO, 0, 0) == 0); + + bool doNewEncoding = (!bIsEmptyUndoHistory && !bNoUI) ? + (InfoBox(MBYESNO, L"MsgConv2", IDS_ASK_ENCODING2) == IDYES) : true; + + if (doNewEncoding) { + return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,bSetSavePoint); + } + } + else { + + bool doNewEncoding = (!bNoUI) ? (InfoBox(MBYESNO, L"MsgConv1", IDS_ASK_ENCODING) == IDYES) : true; + + if (doNewEncoding) { + return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,false); + } + } + } + return false; +} + +//============================================================================= +// +// EditIsRecodingNeeded() +// +bool EditIsRecodingNeeded(WCHAR* pszText, int cchLen) +{ + if ((pszText == NULL) || (cchLen < 1)) + return false; + + UINT codepage = Encoding_GetCodePage(Encoding_Current(CPI_GET)); + + if ((codepage == CP_UTF7) || (codepage == CP_UTF8)) + return false; + + DWORD dwFlags = WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR; + bool useNullParams = Encoding_IsMBCS(Encoding_Current(CPI_GET)) ? true : false; + + BOOL bDefaultCharsUsed = FALSE; + int cch = 0; + if (useNullParams) + cch = WideCharToMultiByte(codepage, 0, pszText, cchLen, NULL, 0, NULL, NULL); + else + cch = WideCharToMultiByte(codepage, dwFlags, pszText, cchLen, NULL, 0, NULL, &bDefaultCharsUsed); + + if (useNullParams && (cch == 0)) { + if (GetLastError() != ERROR_NO_UNICODE_TRANSLATION) + cch = cchLen; // don't care + } + + bool bSuccess = ((cch >= cchLen) && (cch != (int)0xFFFD)) ? true : false; + + return (!bSuccess || bDefaultCharsUsed); +} + + +//============================================================================= +// +// EditGetClipboardText() +// +char* EditGetClipboardText(HWND hwnd,bool bCheckEncoding,int* pLineCount,int* pLenLastLn) { + + if (!IsClipboardFormatAvailable(CF_UNICODETEXT) || !OpenClipboard(GetParent(hwnd))) { + char* pEmpty = StrDupA(""); + return (pEmpty); + } + + // get clipboard + HANDLE hmem = GetClipboardData(CF_UNICODETEXT); + WCHAR* pwch = GlobalLock(hmem); + int wlen = lstrlenW(pwch); + + if (bCheckEncoding && EditIsRecodingNeeded(pwch,wlen)) + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocPos iAnchor = SciCall_GetAnchor(); + + // switch encoding to universal UTF-8 codepage + SendMessage(g_hwndMain,WM_COMMAND,(WPARAM)MAKELONG(IDM_ENCODING_UTF8,1),0); + + // restore and adjust selection + if (iPos > iAnchor) { + SciCall_SetSel(iAnchor, iPos); + } + else { + SciCall_SetSel(iPos, iAnchor); + } + EditFixPositions(hwnd); + } + + // translate to SCI editor component codepage (default: UTF-8) + int mlen = WideCharToMultiByte(Encoding_SciCP,0,pwch,wlen,NULL,0,NULL,NULL); + char* pmch = LocalAlloc(LPTR,mlen + 1); + if (pmch && mlen != 0) { + int cnt = WideCharToMultiByte(Encoding_SciCP,0,pwch,wlen,pmch,mlen + 1,NULL,NULL); + if (cnt == 0) + return (pmch); + } + else + return (pmch); + + int lineCount = 0; + int lenLastLine = 0; + if ((bool)SendMessage(hwnd,SCI_GETPASTECONVERTENDINGS,0,0)) { + char* ptmp = LocalAlloc(LPTR,mlen * 2 + 2); + if (ptmp) { + char *s = pmch; + char *d = ptmp; + int eolmode = SciCall_GetEOLMode(); + for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) { + if (*s == '\n' || *s == '\r') { + if (eolmode == SC_EOL_CR) { + *d++ = '\r'; + } + else if (eolmode == SC_EOL_LF) { + *d++ = '\n'; + } + else { // eolmode == SC_EOL_CRLF + *d++ = '\r'; + *d++ = '\n'; + } + if ((*s == '\r') && (i + 1 < mlen) && (*(s + 1) == '\n')) { + i++; + s++; + } + s++; + ++lineCount; + lenLastLine = 0; + } + else { + *d++ = *s++; + } + } + *d = '\0'; + int mlen2 = (int)(d - ptmp); + + LocalFree(pmch); + pmch = LocalAlloc(LPTR,mlen2 + 1); + StringCchCopyA(pmch,mlen2 + 1,ptmp); + LocalFree(ptmp); + } + } + else { + // count lines only + char *s = pmch; + for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) { + if (*s == '\n' || *s == '\r') { + if ((*s == '\r') && (i + 1 < mlen) && (*(s + 1) == '\n')) { + i++; + s++; + } + s++; + ++lineCount; + lenLastLine = 0; + } + } + } + + GlobalUnlock(hmem); + CloseClipboard(); + + if (pLineCount) + *pLineCount = lineCount; + + if (pLenLastLn) + *pLenLastLn = lenLastLine; + + return (pmch); +} + + +//============================================================================= +// +// EditSetClipboardText() +// +bool EditSetClipboardText(HWND hwnd, const char* pszText) +{ + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { + SciCall_CopyText((DocPos)strlen(pszText), pszText); + return true; + } + + WCHAR* pszTextW = NULL; + int cchTextW = MultiByteToWideChar(Encoding_SciCP, 0, pszText, -1, NULL, 0) + 1; + if (cchTextW > 1) { + pszTextW = LocalAlloc(LPTR, sizeof(WCHAR)*cchTextW); + MultiByteToWideChar(Encoding_SciCP, 0, pszText, -1, pszTextW, cchTextW); + } + + if (pszTextW) { + SetClipboardTextW(GetParent(hwnd), pszTextW); + LocalFree(pszTextW); + return true; + } + return false; +} + + +//============================================================================= +// +// EditClearClipboard() +// +bool EditClearClipboard(HWND hwnd) +{ + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { + SciCall_CopyText(0, ""); + return true; + } + if (!OpenClipboard(GetParent(hwnd))) { + return false; + } + EmptyClipboard(); + CloseClipboard(); + return true; +} + + +//============================================================================= +// +// EditPaste2RectSel() +// +void EditPaste2RectSel(HWND hwnd, char* pText) +{ + if (!SciCall_IsSelectionRectangle()) { return; } + + const DocPos length = lstrlenA(pText); // '\0' terminated + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + const DocPosU selCount = (DocPosU)SendMessage(hwnd, SCI_GETSELECTIONS, 0, 0); + + char* pTextLine = pText; + // remove line-break from last line + if (*pTextLine != '\0') { StrTrimA(pTextLine, "\r\n"); } + + for (DocPosU s = 0; s < selCount; ++s) { + // get lines from clip + char *ln = pTextLine; + int lnLen = 0; + while (*ln != '\0') { + if (s < (selCount - 1)) { + if (*ln == '\n' || *ln == '\r') { + if ((*ln == '\r') && (*(ln + 1) == '\n')) { ++ln; } + ++ln; // next line + break; + } + else { ++ln; ++lnLen; } + } + else { ++ln; ++lnLen; } // last line + } + + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + const DocPos selCaretVspc = SciCall_GetSelectionNCaretVirtualSpace(s); + const DocPos selAnchorVspc = SciCall_GetSelectionNAnchorVirtualSpace(s); + + DocPos virtualSpaceLen = 0; + DocPos selTargetStart = 0; + DocPos selTargetEnd = 0; + if (selCaretPos < selAnchorPos) { + selTargetStart = selCaretPos; + selTargetEnd = selAnchorPos; + virtualSpaceLen = selCaretVspc; + } + else { + selTargetStart = selAnchorPos; + selTargetEnd = selCaretPos; + virtualSpaceLen = selAnchorVspc; + } + + if (virtualSpaceLen > 0) { + char* pPadStr = LocalAlloc(LPTR, (virtualSpaceLen + length + 1) * sizeof(char)); + if (pPadStr) { + SIZE_T size = LocalSize(pPadStr) - sizeof(char); + FillMemory(pPadStr, virtualSpaceLen, ' '); + pPadStr[virtualSpaceLen] = '\0'; + StringCchCatNA(pPadStr, size, pTextLine, lnLen); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(lstrlenA(pPadStr), pPadStr); + LocalFree(pPadStr); + } + else { + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(lnLen, pTextLine); + } + } + else // no virtual space to pad + { + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(lnLen, pTextLine); + } + + //SciCall_SetSelectionNAnchor(s, selTargetStart); + //SciCall_SetSelectionNCaret(s, selTargetStart); + //if (virtualSpaceLen > 0) { + // SciCall_SetSelectionNCaretVirtualSpace(s, virtualSpaceLen); + // SciCall_SetSelectionNAnchorVirtualSpace(s, virtualSpaceLen); + //} + + if (*ln != '\0') { + pTextLine = ln; // next clip line + } + //else: rest of rect single selections are filled with last line + + } // for() + + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); +} + + +//============================================================================= +// +// EditPasteClipboard() +// +bool EditPasteClipboard(HWND hwnd, bool bSwapClipBoard, bool bSkipUnicodeCheck) +{ + int lineCount = 0; + int lenLastLine = 0; + + char* pClip = EditGetClipboardText(hwnd, !bSkipUnicodeCheck, &lineCount, &lenLastLine); + if (!pClip) { + return false; // recoding canceled + } + const DocPos clipLen = lstrlenA(pClip); + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + if (SciCall_IsSelectionEmpty() || (lineCount <= 1)) + { + IgnoreNotifyChangeEvent(); + + if (SciCall_IsSelectionEmpty()) // SC_SEL_THIN + { + SciCall_Paste(); + if (bSwapClipBoard) { + EditClearClipboard(hwnd); + EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1); + } + //else { + // EditSelectEx(hwnd, SciCall_GetCurrentPos(), SciCall_GetCurrentPos(), -1, -1); + //} + } + else { + char* pszText = LocalAlloc(LPTR, SciCall_GetSelText(NULL)); + SciCall_GetSelText(pszText); + if (clipLen == 0) { SciCall_Clear(); } else { SciCall_Paste(); } + if (bSwapClipBoard) { + EditSetClipboardText(hwnd, pszText); + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, SciCall_GetCurrentPos(), iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1); + } + else { + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos, iCurPos, -1, -1); + } + LocalFree(pszText); + } + ObserveNotifyChangeEvent(); + } + else { + if (SciCall_IsSelectionRectangle()) + { + if (bSwapClipBoard) { SciCall_Copy(); } + EditPaste2RectSel(hwnd, pClip); + //TODO: restore selection in case of swap clipboard + } + else // Selection: SC_SEL_STREAM, SC_SEL_LINES + { + IgnoreNotifyChangeEvent(); + if (bSwapClipBoard) { + SciCall_Copy(); + SciCall_ReplaceSel(pClip); + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos + clipLen, iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + clipLen, -1, -1); + } + else { + SciCall_ReplaceSel(pClip); + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos, iCurPos, -1, -1); + } + ObserveNotifyChangeEvent(); + } + } + LocalFree(pClip); + return true; +} + + +//============================================================================= +// +// EditCopyAppend() +// +bool EditCopyAppend(HWND hwnd, bool bAppend) +{ + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + char* pszText = NULL; + if (iCurPos != iAnchorPos) { + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return false; + } + else { + pszText = LocalAlloc(LPTR, SciCall_GetSelText(NULL)); + SciCall_GetSelText(pszText); + } + } + else { + DocPos cchText = SciCall_GetTextLength(); + pszText = LocalAlloc(LPTR,cchText + 1); + SciCall_GetText((DocPos)LocalSize(pszText), pszText); + } + WCHAR* pszTextW = NULL; + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,-1,NULL,0); + if (cchTextW > 0) { + int lenTxt = (cchTextW + 1); + pszTextW = LocalAlloc(LPTR,sizeof(WCHAR)*lenTxt); + MultiByteToWideChar(Encoding_SciCP,0,pszText,-1,pszTextW,lenTxt); + } + + if (pszText) + LocalFree(pszText); + + if (!bAppend) { + bool res = (bool)SetClipboardTextW(GetParent(hwnd), pszTextW); + LocalFree(pszTextW); + return res; + } + + // --- Append to Clipboard --- + + if (!OpenClipboard(GetParent(hwnd))) { + LocalFree(pszTextW); + return false; + } + + HANDLE hOld = GetClipboardData(CF_UNICODETEXT); + WCHAR* pszOld = GlobalLock(hOld); + + int sizeNew = lstrlen(pszOld) + lstrlen(pszTextW) + 1; + + const WCHAR *pszSep = L"\r\n"; + sizeNew += (int)lstrlen(pszSep); + + // Copy Clip + WCHAR* pszNewTextW = LocalAlloc(LPTR, sizeof(WCHAR) * sizeNew); + + if (pszOld) + StringCchCopy(pszNewTextW, sizeNew, pszOld); + + GlobalUnlock(hOld); + CloseClipboard(); + + + // Add New + StringCchCat(pszNewTextW, sizeNew, pszSep); + StringCchCat(pszNewTextW, sizeNew, pszTextW); + + bool res = (bool)SetClipboardTextW(GetParent(hwnd), pszNewTextW); + + LocalFree(pszNewTextW); + return res; +} + + +//============================================================================= +// +// EditDetectEOLMode() - moved here to handle Unicode files correctly +// +int EditDetectEOLMode(HWND hwnd,char* lpData,DWORD cbData) +{ + int iEOLMode = iLineEndings[g_iDefaultEOLMode]; + char *cp = (char*)lpData; + + if (!cp) + return (iEOLMode); + + while (*cp && (*cp != '\x0D' && *cp != '\x0A')) cp++; + + if (*cp == '\x0D' && *(cp+1) == '\x0A') + iEOLMode = SC_EOL_CRLF; + else if (*cp == '\x0D' && *(cp+1) != '\x0A') + iEOLMode = SC_EOL_CR; + else if (*cp == '\x0A') + iEOLMode = SC_EOL_LF; + + UNUSED(hwnd); + UNUSED(cbData); + + return (iEOLMode); +} + + + +//============================================================================= +// +// EditLoadFile() +// +bool EditLoadFile( + HWND hwnd, + LPCWSTR pszFile, + bool bSkipUTFDetection, + bool bSkipANSICPDetection, + int* iEncoding, + int* iEOLMode, + bool *pbUnicodeErr, + bool *pbFileTooBig, + bool *pbUnkownExt) +{ + if (pbUnicodeErr) + *pbUnicodeErr = false; + if (pbFileTooBig) + *pbFileTooBig = false; + if (pbUnkownExt) + *pbUnkownExt = false; + + HANDLE hFile = CreateFile(pszFile, + GENERIC_READ, + FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + dwLastIOError = GetLastError(); + + if (hFile == INVALID_HANDLE_VALUE) { + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + + // calculate buffer limit + DWORD dwFileSize = GetFileSize(hFile,NULL); + DWORD dwBufSize = dwFileSize + 16; + + // check for unknown extension + LPWSTR lpszExt = PathFindExtension(pszFile); + if (!Style_HasLexerForExt(lpszExt)) { + if (InfoBox(MBYESNO,L"MsgFileUnknownExt",IDS_WARN_UNKNOWN_EXT,lpszExt) != IDYES) { + CloseHandle(hFile); + if (pbUnkownExt) + *pbUnkownExt = true; + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + } + + // Check if a warning message should be displayed for large files + DWORD dwFileSizeLimit = IniGetInt(L"Settings2",L"FileLoadWarningMB",1); + if (dwFileSizeLimit != 0 && dwFileSizeLimit * 1024 * 1024 < dwFileSize) { + if (InfoBox(MBYESNO,L"MsgFileSizeWarning",IDS_WARN_LOAD_BIG_FILE) != IDYES) { + CloseHandle(hFile); + if (pbFileTooBig) + *pbFileTooBig = true; + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + } + + char* lpData = AllocMem(dwBufSize, HEAP_ZERO_MEMORY); + + dwLastIOError = GetLastError(); + if (!lpData) + { + CloseHandle(hFile); + if (pbFileTooBig) + *pbFileTooBig = false; + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + + DWORD cbData = 0L; + int const readFlag = ReadAndDecryptFile(hwnd, hFile, dwBufSize - 2, &lpData, &cbData); + dwLastIOError = GetLastError(); + CloseHandle(hFile); + + bool bReadSuccess = ((readFlag & DECRYPT_FATAL_ERROR) || (readFlag & DECRYPT_FREAD_FAILED)) ? false : true; + // ((readFlag == DECRYPT_SUCCESS) || (readFlag & DECRYPT_NO_ENCRYPTION)) => true; + + if ((readFlag & DECRYPT_CANCELED_NO_PASS) || (readFlag & DECRYPT_WRONG_PASS)) + { + bReadSuccess = (InfoBox(MBOKCANCEL, L"MsgNoOrWrongPassphrase", IDS_NOPASS) == IDOK); + if (!bReadSuccess) { + FreeMem(lpData); + return true; + } + } + + if (!bReadSuccess) { + FreeMem(lpData); + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + + bool bPreferOEM = false; + if (bLoadNFOasOEM) + { + if (lpszExt && !(StringCchCompareIX(lpszExt,L".nfo") && StringCchCompareIX(lpszExt,L".diz"))) + bPreferOEM = true; + } + + const int iForcedEncoding = Encoding_SrcCmdLn(CPI_GET); + const int iFileEncWeak = Encoding_SrcWeak(CPI_GET); + + const size_t cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L; + bool bIsReliable = false; + const int iAnalyzedEncoding = bSkipANSICPDetection ? CPI_NONE : Encoding_Analyze(lpData, cbNbytes4Analysis, &bIsReliable); + + // choose best encoding guess + int iPreferedEncoding = (bPreferOEM) ? g_DOSEncoding : (bUseDefaultForFileEncoding ? g_iDefaultNewFileEncoding : CPI_ANSI_DEFAULT); + + if (iForcedEncoding != CPI_NONE) + iPreferedEncoding = iForcedEncoding; + else if (iFileEncWeak != CPI_NONE) + iPreferedEncoding = iFileEncWeak; + else if (Encoding_IsUNICODE(iAnalyzedEncoding) && !bSkipUTFDetection) + iPreferedEncoding = iAnalyzedEncoding; + else if (iAnalyzedEncoding != CPI_NONE) + iPreferedEncoding = iAnalyzedEncoding; + + + bool bBOM = false; + bool bReverse = false; + + if (cbData == 0) { + FileVars_Init(NULL,0,&fvCurFile); + *iEOLMode = iLineEndings[g_iDefaultEOLMode]; + if (iForcedEncoding == CPI_NONE) { + if (bLoadASCIIasUTF8 && !bPreferOEM) + *iEncoding = CPI_UTF8; + else + *iEncoding = iPreferedEncoding; + } + else + *iEncoding = iForcedEncoding; + + EditSetNewText(hwnd,"",0); + SendMessage(hwnd,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); + FreeMem(lpData); + } + // === UNICODE === + else if (!bSkipUTFDetection && //TODO: use Encoding_IsUNICODE(iAnalyzedEncoding) here ??? + (Encoding_IsUNICODE(iForcedEncoding) || (iForcedEncoding == CPI_NONE)) && + (Encoding_IsUNICODE(iForcedEncoding) || IsUnicode(lpData,cbData,&bBOM,&bReverse)) && + (Encoding_IsUNICODE(iForcedEncoding) || !IsUTF8Signature(lpData))) // check for UTF-8 signature + { + char* lpDataUTF8; + + if (iForcedEncoding == CPI_UNICODE) { + bBOM = (*((UNALIGNED PWCHAR)lpData) == 0xFEFF); + bReverse = false; + } + else if (iForcedEncoding == CPI_UNICODEBE) + bBOM = (*((UNALIGNED PWCHAR)lpData) == 0xFFFE); + + if (iForcedEncoding == CPI_UNICODEBE || bReverse) { + _swab(lpData,lpData,cbData); + if (bBOM) + *iEncoding = CPI_UNICODEBEBOM; + else + *iEncoding = CPI_UNICODEBE; + } + else { + if (bBOM) + *iEncoding = CPI_UNICODEBOM; + else + *iEncoding = CPI_UNICODE; + } + + lpDataUTF8 = AllocMem((cbData * 3) + 2, HEAP_ZERO_MEMORY); + + DWORD convCnt = (DWORD)WideCharToMultiByte(Encoding_SciCP,0,(bBOM) ? (LPWSTR)lpData + 1 : (LPWSTR)lpData, + (bBOM) ? (cbData)/sizeof(WCHAR) : cbData/sizeof(WCHAR) + 1,lpDataUTF8,(int)SizeOfMem(lpDataUTF8),NULL,NULL); + + if (convCnt == 0) { + if (pbUnicodeErr) + *pbUnicodeErr = true; + convCnt = (DWORD)WideCharToMultiByte(CP_ACP,0,(bBOM) ? (LPWSTR)lpData + 1 : (LPWSTR)lpData, + (-1),lpDataUTF8,(int)SizeOfMem(lpDataUTF8),NULL,NULL); + } + + if (convCnt != 0) { + FreeMem(lpData); + EditSetNewText(hwnd,"",0); + FileVars_Init(lpDataUTF8,convCnt - 1,&fvCurFile); + EditSetNewText(hwnd,lpDataUTF8,convCnt - 1); + *iEOLMode = EditDetectEOLMode(hwnd,lpDataUTF8,convCnt - 1); + FreeMem(lpDataUTF8); + } + else { + FreeMem(lpDataUTF8); + FreeMem(lpData); + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + } + + else { // === ALL OTHERS === + + FileVars_Init(lpData,cbData,&fvCurFile); + + // === UTF-8 === + if (!bSkipUTFDetection && (Encoding_IsNONE(iForcedEncoding) || Encoding_IsUTF8(iForcedEncoding)) && + ((IsUTF8Signature(lpData) || + FileVars_IsUTF8(&fvCurFile) || + (Encoding_IsUTF8(iForcedEncoding) || + Encoding_IsUTF8(iAnalyzedEncoding) || + (!bPreferOEM && bLoadASCIIasUTF8) || // from menu "Reload As UTF-8" + (IsUTF8(lpData,cbData) && ((UTF8_ContainsInvalidChars(lpData, cbData) || + (!bPreferOEM && (Encoding_IsUTF8(iPreferedEncoding) || bLoadASCIIasUTF8))))))) && + !(FileVars_IsNonUTF8(&fvCurFile) && !Encoding_IsUTF8(iForcedEncoding)))) + { + EditSetNewText(hwnd,"",0); + if (IsUTF8Signature(lpData)) { + EditSetNewText(hwnd,UTF8StringStart(lpData),cbData-3); + *iEncoding = CPI_UTF8SIGN; + *iEOLMode = EditDetectEOLMode(hwnd,UTF8StringStart(lpData),cbData-3); + } + else { + EditSetNewText(hwnd,lpData,cbData); + *iEncoding = CPI_UTF8; + *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); + } + FreeMem(lpData); + } + + else { // === ALL OTHER === + + if (!Encoding_IsNONE(iForcedEncoding)) + *iEncoding = iForcedEncoding; + else { + *iEncoding = FileVars_GetEncoding(&fvCurFile); + if (Encoding_IsNONE(*iEncoding)) { + if (fvCurFile.mask & FV_ENCODING) + *iEncoding = CPI_ANSI_DEFAULT; + else { + *iEncoding = iPreferedEncoding; + } + } + } + + if (((Encoding_GetCodePage(*iEncoding) != CP_UTF7) && Encoding_IsEXTERNAL_8BIT(*iEncoding)) || + ((Encoding_GetCodePage(*iEncoding) == CP_UTF7) && IsUTF7(lpData,cbData))) { + + UINT uCodePage = Encoding_GetCodePage(*iEncoding); + + LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); + int cbDataWide = MultiByteToWideChar(uCodePage,0,lpData,cbData,lpDataWide,(int)SizeOfMem(lpDataWide)/sizeof(WCHAR)); + if (cbDataWide != 0) + { + FreeMem(lpData); + lpData = AllocMem(cbDataWide * 3 + 16, HEAP_ZERO_MEMORY); + + cbData = WideCharToMultiByte(Encoding_SciCP,0,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,NULL); + if (cbData != 0) { + FreeMem(lpDataWide); + EditSetNewText(hwnd,"",0); + EditSetNewText(hwnd,lpData,cbData); + *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); + FreeMem(lpData); + } + else { + FreeMem(lpDataWide); + FreeMem(lpData); + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + } + else { + FreeMem(lpDataWide); + FreeMem(lpData); + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return false; + } + } + else { + *iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferedEncoding; + EditSetNewText(hwnd,"",0); + EditSetNewText(hwnd,lpData,cbData); + *iEOLMode = EditDetectEOLMode(hwnd,lpData,cbData); + FreeMem(lpData); + } + } + } + + Encoding_SrcCmdLn(CPI_NONE); + Encoding_SrcWeak(CPI_NONE); + return true; + +} + + +//============================================================================= +// +// EditSaveFile() +// +bool EditSaveFile( + HWND hwnd, + LPCWSTR pszFile, + int iEncoding, + bool *pbCancelDataLoss, + bool bSaveCopy) +{ + + HANDLE hFile; + bool bWriteSuccess; + + char* lpData; + DWORD cbData; + DWORD dwBytesWritten; + + *pbCancelDataLoss = false; + + hFile = CreateFile(pszFile, + GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + dwLastIOError = GetLastError(); + + // failure could be due to missing attributes (2k/XP) + if (hFile == INVALID_HANDLE_VALUE) + { + DWORD dwAttributes = GetFileAttributes(pszFile); + if (dwAttributes != INVALID_FILE_ATTRIBUTES) + { + dwAttributes = dwAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); + hFile = CreateFile(pszFile, + GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL | dwAttributes, + NULL); + dwLastIOError = GetLastError(); + } + } + + if (hFile == INVALID_HANDLE_VALUE) + return false; + + // ensure consistent line endings + if (bFixLineEndings) { + SendMessage(hwnd,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); + EditFixPositions(hwnd); + } + + // strip trailing blanks + if (bAutoStripBlanks) + EditStripLastCharacter(hwnd, true, true); + + // get text + cbData = (DWORD)SciCall_GetTextLength(); + lpData = AllocMem(cbData + 4, HEAP_ZERO_MEMORY); //fix: +bom + SendMessage(hwnd,SCI_GETTEXT,SizeOfMem(lpData),(LPARAM)lpData); + + if (cbData == 0) { + bWriteSuccess = SetEndOfFile(hFile); + dwLastIOError = GetLastError(); + } + + else { + + // FIXME: move checks in front of disk file access + /*if ((g_Encodings[iEncoding].uFlags & NCP_UNICODE) == 0 && (g_Encodings[iEncoding].uFlags & NCP_UTF8_SIGN) == 0) { + bool bEncodingMismatch = true; + FILEVARS fv; + FileVars_Init(lpData,cbData,&fv); + if (fv.mask & FV_ENCODING) { + int iAltEncoding; + if (FileVars_IsValidEncoding(&fv)) { + iAltEncoding = FileVars_GetEncoding(&fv); + if (iAltEncoding == iEncoding) + bEncodingMismatch = false; + else if ((g_Encodings[iAltEncoding].uFlags & NCP_UTF8) && (g_Encodings[iEncoding].uFlags & NCP_UTF8)) + bEncodingMismatch = false; + } + if (bEncodingMismatch) { + Encoding_SetLabel(iAltEncoding); + Encoding_SetLabel(iEncoding); + InfoBox(0,L"MsgEncodingMismatch",IDS_ENCODINGMISMATCH, + g_Encodings[iAltEncoding].wchLabel, + g_Encodings[iEncoding].wchLabel); + } + } + }*/ + + if (Encoding_IsUNICODE(iEncoding)) + { + SetEndOfFile(hFile); + + LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); + int bomoffset = 0; + if (Encoding_IsUNICODE_BOM(iEncoding)) { + const char* bom = "\xFF\xFE"; + CopyMemory((char*)lpDataWide, bom, 2); + bomoffset = 1; + } + int cbDataWide = bomoffset + MultiByteToWideChar(Encoding_SciCP, 0, lpData, cbData, &lpDataWide[bomoffset], (int)SizeOfMem(lpDataWide) / sizeof(WCHAR) - bomoffset); + if (Encoding_IsUNICODE_REVERSE(iEncoding)) { + _swab((char*)lpDataWide, (char*)lpDataWide, cbDataWide * sizeof(WCHAR)); + } + bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpDataWide, cbDataWide * sizeof(WCHAR), &dwBytesWritten); + dwLastIOError = GetLastError(); + + FreeMem(lpDataWide); + FreeMem(lpData); + } + + else if (Encoding_IsUTF8(iEncoding)) + { + SetEndOfFile(hFile); + + if (Encoding_IsUTF8_SIGN(iEncoding)) { + const char* bom = "\xEF\xBB\xBF"; + DWORD bomoffset = 3; + MoveMemory(&lpData[bomoffset], lpData, cbData); + CopyMemory(lpData, bom, bomoffset); + cbData += bomoffset; + } + //bWriteSuccess = WriteFile(hFile,lpData,cbData,&dwBytesWritten,NULL); + bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); + dwLastIOError = GetLastError(); + + FreeMem(lpData); + } + + else if (Encoding_IsEXTERNAL_8BIT(iEncoding)) { + + BOOL bCancelDataLoss = FALSE; + UINT uCodePage = Encoding_GetCodePage(iEncoding); + + LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); + int cbDataWide = MultiByteToWideChar(Encoding_SciCP,0,lpData,cbData,lpDataWide,(int)SizeOfMem(lpDataWide)/sizeof(WCHAR)); + + if (Encoding_IsMBCS(iEncoding)) { + FreeMem(lpData); + lpData = AllocMem(SizeOfMem(lpDataWide) * 2, HEAP_ZERO_MEMORY); // need more space + cbData = WideCharToMultiByte(uCodePage, 0, lpDataWide, cbDataWide, lpData, (int)SizeOfMem(lpData), NULL, NULL); + } + else { + ZeroMemory(lpData, SizeOfMem(lpData)); + cbData = WideCharToMultiByte(uCodePage,WC_NO_BEST_FIT_CHARS,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,&bCancelDataLoss); + if (!bCancelDataLoss) { + cbData = WideCharToMultiByte(uCodePage,0,lpDataWide,cbDataWide,lpData,(int)SizeOfMem(lpData),NULL,NULL); + bCancelDataLoss = FALSE; + } + } + FreeMem(lpDataWide); + + if (!bCancelDataLoss || InfoBox(MBOKCANCEL,L"MsgConv3",IDS_ERR_UNICODE2) == IDOK) { + SetEndOfFile(hFile); + bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); + dwLastIOError = GetLastError(); + } + else { + bWriteSuccess = false; + *pbCancelDataLoss = true; + } + + FreeMem(lpData); + } + + else { + SetEndOfFile(hFile); + bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpData, cbData, &dwBytesWritten); + dwLastIOError = GetLastError(); + FreeMem(lpData); + } + } + + CloseHandle(hFile); + + if (bWriteSuccess) + { + if (!bSaveCopy) + SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); + + return true; + } + + else + return false; + +} + + +//============================================================================= +// +// EditInvertCase() +// +void EditInvertCase(HWND hwnd) +{ + UNUSED(hwnd); + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + if (iCurPos != iAnchorPos) + { + if (!SciCall_IsSelectionRectangle()) + { + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + const DocPos iSelLength = SciCall_GetSelText(NULL); + + char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); + LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); + + if (pszText == NULL || pszTextW == NULL) { + FreeMem(pszText); + FreeMem(pszTextW); + return; + } + SciCall_GetSelText(pszText); + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); + + bool bChanged = false; + for (int i = 0; i < cchTextW; i++) { + if (IsCharUpperW(pszTextW[i])) { + pszTextW[i] = LOWORD(CharLowerW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); + bChanged = true; + } + else if (IsCharLowerW(pszTextW[i])) { + pszTextW[i] = LOWORD(CharUpperW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); + bChanged = true; + } + } + + if (bChanged) { + + WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); + + SciCall_Clear(); + SciCall_AddText((iSelEnd - iSelStart), pszText); + SciCall_SetSel(iAnchorPos, iCurPos); + } + + FreeMem(pszText); + FreeMem(pszTextW); + } + else + MsgBox(MBWARN,IDS_SELRECT); + } +} + + +//============================================================================= +// +// EditTitleCase() +// +void EditTitleCase(HWND hwnd) +{ + UNUSED(hwnd); + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + if (iCurPos != iAnchorPos) + { + if (!SciCall_IsSelectionRectangle()) + { + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + const DocPos iSelLength = SciCall_GetSelText(NULL); + + char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); + LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); + + if (pszText == NULL || pszTextW == NULL) { + FreeMem(pszText); + FreeMem(pszTextW); + return; + } + SciCall_GetSelText(pszText); + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); + + bool bChanged = false; + LPWSTR pszMappedW = LocalAlloc(LPTR,SizeOfMem(pszTextW)); + // first make lower case, before applying TitleCase + if (LCMapString(LOCALE_SYSTEM_DEFAULT,(LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE), pszTextW,cchTextW,pszMappedW,(int)iSelLength)) + { + if (LCMapString(LOCALE_SYSTEM_DEFAULT,LCMAP_TITLECASE,pszMappedW,cchTextW,pszTextW,(int)iSelLength)) { + bChanged = true; + } + } + LocalFree(pszMappedW); + + if (bChanged) { + + WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); + + SciCall_Clear(); + SciCall_AddText((iSelEnd - iSelStart), pszText); + SciCall_SetSel(iAnchorPos, iCurPos); + } + + FreeMem(pszText); + FreeMem(pszTextW); + } + else + MsgBox(MBWARN,IDS_SELRECT); + } +} + + +//============================================================================= +// +// EditSentenceCase() +// +void EditSentenceCase(HWND hwnd) +{ + UNUSED(hwnd); + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + if (iCurPos != iAnchorPos) + { + if (!SciCall_IsSelectionRectangle()) + { + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + const DocPos iSelLength = SciCall_GetSelText(NULL); + + char* pszText = AllocMem(iSelLength, HEAP_ZERO_MEMORY); + LPWSTR pszTextW = AllocMem((iSelLength*sizeof(WCHAR)), HEAP_ZERO_MEMORY); + + if (pszText == NULL || pszTextW == NULL) { + FreeMem(pszText); + FreeMem(pszTextW); + return; + } + SciCall_GetSelText(pszText); + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)(iSelLength-1),pszTextW,(int)iSelLength); + + bool bChanged = false; + bool bNewSentence = true; + for (int i = 0; i < cchTextW; i++) { + if (StrChr(L".;!?\r\n",pszTextW[i])) { + bNewSentence = true; + } + else { + if (IsCharAlphaNumericW(pszTextW[i])) { + if (bNewSentence) { + if (IsCharLowerW(pszTextW[i])) { + pszTextW[i] = LOWORD(CharUpperW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); + bChanged = true; + } + bNewSentence = false; + } + else { + if (IsCharUpperW(pszTextW[i])) { + pszTextW[i] = LOWORD(CharLowerW((LPWSTR)(LONG_PTR)MAKELONG(pszTextW[i],0))); + bChanged = true; + } + } + } + } + } + + if (bChanged) { + + WideCharToMultiByte(Encoding_SciCP,0,pszTextW,cchTextW,pszText,(int)SizeOfMem(pszText),NULL,NULL); + + SciCall_Clear(); + SciCall_AddText((iSelEnd - iSelStart), pszText); + SciCall_SetSel(iAnchorPos, iCurPos); + } + + FreeMem(pszText); + FreeMem(pszTextW); + } + else + MsgBox(MBWARN,IDS_SELRECT); + } +} + + +//============================================================================= +// +// EditURLEncode() +// +void EditURLEncode(HWND hwnd) +{ + if (SciCall_IsSelectionEmpty()) { return; } + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelLength = SciCall_GetSelText(NULL); + + const char* pszText = (const char*)SciCall_GetRangePointer(min(iCurPos, iAnchorPos), iSelLength); + + LPWSTR pszTextW = LocalAlloc(LPTR, (iSelLength * sizeof(WCHAR))); + if (pszTextW == NULL) { + return; + } + + /*int cchTextW =*/ MultiByteToWideChar(Encoding_SciCP, 0, pszText, (int)(iSelLength-1), pszTextW, (int)iSelLength); + + char* pszEscaped = LocalAlloc(LPTR, iSelLength * 3); + if (pszEscaped == NULL) { + LocalFree(pszTextW); + return; + } + + LPWSTR pszEscapedW = LocalAlloc(LPTR, LocalSize(pszTextW) * 3); + if (pszEscapedW == NULL) { + LocalFree(pszTextW); + LocalFree(pszEscaped); + return; + } + + DWORD cchEscapedW = (int)LocalSize(pszEscapedW) / sizeof(WCHAR); + UrlEscape(pszTextW, pszEscapedW, &cchEscapedW, URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_PERCENT | URL_ESCAPE_AS_UTF8); + + DWORD cchEscaped = WideCharToMultiByte(Encoding_SciCP, 0, pszEscapedW, cchEscapedW, pszEscaped, (int)LocalSize(pszEscaped), NULL, NULL); + + EditEnterTargetTransaction(); + if (iCurPos < iAnchorPos) + SciCall_SetTargetRange(iCurPos, iAnchorPos); + else + SciCall_SetTargetRange(iAnchorPos, iCurPos); + + SciCall_ReplaceTarget(cchEscaped, pszEscaped); + EditLeaveTargetTransaction(); + + + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos + cchEscaped, iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cchEscaped, -1, -1); + + LocalFree(pszTextW); + LocalFree(pszEscaped); + LocalFree(pszEscapedW); +} + + +//============================================================================= +// +// EditURLDecode() +// +void EditURLDecode(HWND hwnd) +{ + if (SciCall_IsSelectionEmpty()) { return; } + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelLength = SciCall_GetSelText(NULL); + + const char* pszText = (const char*)SciCall_GetRangePointer(min(iCurPos, iAnchorPos), iSelLength); + + LPWSTR pszTextW = LocalAlloc(LPTR, (iSelLength * sizeof(WCHAR))); + if (pszTextW == NULL) { + return; + } + + /*int cchTextW =*/ MultiByteToWideChar(Encoding_SciCP, 0, pszText, (int)(iSelLength-1), pszTextW, (int)iSelLength); + + char* pszUnescaped = LocalAlloc(LPTR, iSelLength * 3); + if (pszUnescaped == NULL) { + LocalFree(pszTextW); + return; + } + + LPWSTR pszUnescapedW = LocalAlloc(LPTR, LocalSize(pszTextW) * 3); + if (pszUnescapedW == NULL) { + LocalFree(pszTextW); + LocalFree(pszUnescaped); + return; + } + + DWORD cchUnescapedW = (int)LocalSize(pszUnescapedW) / sizeof(WCHAR); + + UrlUnescapeEx(pszTextW, pszUnescapedW, &cchUnescapedW); + + DWORD cchUnescaped = WideCharToMultiByte(Encoding_SciCP, 0, pszUnescapedW, cchUnescapedW, pszUnescaped, (int)LocalSize(pszUnescaped), NULL, NULL); + + EditEnterTargetTransaction(); + if (iCurPos < iAnchorPos) + SciCall_SetTargetRange(iCurPos, iAnchorPos); + else + SciCall_SetTargetRange(iAnchorPos, iCurPos); + + SciCall_ReplaceTarget(cchUnescaped, pszUnescaped); + EditLeaveTargetTransaction(); + + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos + cchUnescaped, iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cchUnescaped, -1, -1); + + LocalFree(pszTextW); + LocalFree(pszUnescaped); + LocalFree(pszUnescapedW); + +} + + +//============================================================================= +// +// EditEscapeCChars() +// +void EditEscapeCChars(HWND hwnd) { + + if (!SciCall_IsSelectionEmpty()) + { + if (SciCall_IsSelectionRectangle()) + { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + EDITFINDREPLACE efr = EFR_INIT_DATA; + efr.hwnd = hwnd; + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\"); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\\"); + EditReplaceAllInSelection(hwnd,&efr,false); + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\""); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\""); + EditReplaceAllInSelection(hwnd,&efr,false); + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\'"); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\\'"); + EditReplaceAllInSelection(hwnd,&efr,false); + } +} + + +//============================================================================= +// +// EditUnescapeCChars() +// +void EditUnescapeCChars(HWND hwnd) { + + if (!SciCall_IsSelectionEmpty()) + { + if (SciCall_IsSelectionRectangle()) + { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + EDITFINDREPLACE efr = EFR_INIT_DATA; + efr.hwnd = hwnd; + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\\"); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\\"); + EditReplaceAllInSelection(hwnd,&efr,false); + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\""); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\""); + EditReplaceAllInSelection(hwnd,&efr,false); + + StringCchCopyA(efr.szFind,FNDRPL_BUFFER,"\\\'"); + StringCchCopyA(efr.szReplace,FNDRPL_BUFFER,"\'"); + EditReplaceAllInSelection(hwnd,&efr,false); + } +} + + +//============================================================================= +// +// EditChar2Hex() +// +void EditChar2Hex(HWND hwnd) { + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelStart = SciCall_GetSelectionStart(); + DocPos iSelEnd = SciCall_GetSelectionEnd(); + + if (iCurPos == iAnchorPos) { + iSelEnd = SciCall_PositionAfter(iCurPos); + } + + char ch[32] = { '\0' }; + WCHAR wch[32] = { L'\0' }; + + EditSelectEx(hwnd, iSelStart, iSelEnd, -1, -1); + + //TODO: iterate over complete selection? + if (SciCall_GetSelText(NULL) <= COUNTOF(ch)) { + SciCall_GetSelText(ch); + } + + if (ch[0] == '\0') { + StringCchCopyA(ch, COUNTOF(ch), "\\x00"); + } + else { + MultiByteToWideCharStrg(Encoding_SciCP, ch, wch); + if (wch[0] <= 0xFF) + StringCchPrintfA(ch, COUNTOF(ch), "\\x%02X", wch[0] & 0xFF); + else + StringCchPrintfA(ch, COUNTOF(ch), "\\u%04X", wch[0]); + } + SendMessage(hwnd, SCI_REPLACESEL, 0, (LPARAM)ch); + + const DocPos iReplLen = StringCchLenA(ch, COUNTOF(ch)); + + if (iCurPos < iAnchorPos) { + EditSelectEx(hwnd, iCurPos + iReplLen, iCurPos, -1, -1); + } + else if (iCurPos > iAnchorPos) { + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + iReplLen, -1, -1); + } + else { // empty selection + EditSelectEx(hwnd, iCurPos + iReplLen, iCurPos + iReplLen, -1, -1); + } +} + + +//============================================================================= +// +// EditHex2Char() +// +void EditHex2Char(HWND hwnd) +{ + if (SciCall_IsSelectionEmpty()) { return; } + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + char ch[32] = { L'\0' }; + if (SciCall_GetSelText(NULL) <= COUNTOF(ch)) + { + bool bTrySelExpand = false; + + SciCall_GetSelText(ch); + + if (StrChrIA(ch, ' ') || StrChrIA(ch, '\t') || StrChrIA(ch, '\r') || StrChrIA(ch, '\n') || StrChrIA(ch, '-')) { + return; + } + + if (StrCmpNIA(ch, "\\x", 2) == 0 || StrCmpNIA(ch, "\\u", 2) == 0) { + ch[0] = '0'; + ch[1] = 'x'; + } + else if (StrChrIA("xu", ch[0])) { + ch[0] = '0'; + bTrySelExpand = true; + } + else + return; + + int i = 0; + if (sscanf_s(ch, "%x", &i) == 1) { + int cch = 0; + if (i == 0) { + ch[0] = 0; + cch = 1; + } + else { + WCHAR wch[8] = { L'\0' }; + StringCchPrintfW(wch, COUNTOF(wch), L"%lc", (WCHAR)i); + cch = WideCharToMultiByteStrg(Encoding_SciCP, wch, ch) - 1; + + if (bTrySelExpand && (char)SendMessage(hwnd, SCI_GETCHARAT, (WPARAM)iSelStart - 1, 0) == '\\') { + --iSelStart; + if (iCurPos < iAnchorPos) { --iCurPos; } else { --iAnchorPos; } + } + } + EditSelectEx(hwnd, iSelStart, iSelEnd, -1, -1); + SendMessage(hwnd, SCI_REPLACESEL, 0, (LPARAM)ch); + + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iCurPos + cch, iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + cch, -1, -1); + + } + } +} + + +//============================================================================= +// +// EditFindMatchingBrace() +// +void EditFindMatchingBrace(HWND hwnd) +{ + bool bIsAfter = false; + DocPos iMatchingBracePos = (DocPos)-1; + const DocPos iCurPos = SciCall_GetCurrentPos(); + const char c = SciCall_GetCharAt(iCurPos); + if (StrChrA("()[]{}", c)) { + iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iCurPos, 0); + } + else { // Try one before + const DocPos iPosBefore = SciCall_PositionBefore(iCurPos); + const char cb = SciCall_GetCharAt(iPosBefore); + if (StrChrA("()[]{}", cb)) { + iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPosBefore, 0); + } + bIsAfter = true; + } + if (iMatchingBracePos != (DocPos)-1) { + iMatchingBracePos = bIsAfter ? iMatchingBracePos : SciCall_PositionAfter(iMatchingBracePos); + EditSelectEx(hwnd, iMatchingBracePos, iMatchingBracePos, -1, -1); + } +} + + +//============================================================================= +// +// EditSelectToMatchingBrace() +// +void EditSelectToMatchingBrace(HWND hwnd) +{ + bool bIsAfter = false; + DocPos iMatchingBracePos = -1; + const DocPos iCurPos = SciCall_GetCurrentPos(); + const char c = SciCall_GetCharAt(iCurPos); + if (StrChrA("()[]{}", c)) { + iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iCurPos, 0); + } + else { // Try one before + const DocPos iPosBefore = SciCall_PositionBefore(iCurPos); + const char cb = SciCall_GetCharAt(iPosBefore); + if (StrChrA("()[]{}", cb)) { + iMatchingBracePos = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPosBefore, 0); + } + bIsAfter = true; + } + if (iMatchingBracePos != (DocPos)-1) { + if (bIsAfter) + EditSelectEx(hwnd, iCurPos, iMatchingBracePos, -1, -1); + else + EditSelectEx(hwnd, iCurPos, SciCall_PositionAfter(iMatchingBracePos), -1, -1); + } +} + + +//============================================================================= +// +// EditModifyNumber() +// +void EditModifyNumber(HWND hwnd,bool bIncrease) { + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + if ((iSelEnd - iSelStart) > 0) { + char chNumber[32] = { '\0' }; + if (SciCall_GetSelText(NULL) <= COUNTOF(chNumber)) + { + SciCall_GetSelText(chNumber); + + if (StrChrIA(chNumber, '-')) + return; + + int iNumber; + int iWidth; + char chFormat[32] = { '\0' }; + if (!StrChrIA(chNumber, 'x') && sscanf_s(chNumber, "%d", &iNumber) == 1) { + iWidth = (int)StringCchLenA(chNumber, COUNTOF(chNumber)); + if (iNumber >= 0) { + if (bIncrease && iNumber < INT_MAX) + iNumber++; + if (!bIncrease && iNumber > 0) + iNumber--; + + StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%0%ii", iWidth); + StringCchPrintfA(chNumber, COUNTOF(chNumber), chFormat, iNumber); + SciCall_ReplaceSel(chNumber); + SciCall_SetSel(iSelStart, iSelStart + StringCchLenA(chNumber, COUNTOF(chNumber))); + } + } + else if (sscanf_s(chNumber, "%x", &iNumber) == 1) { + bool bUppercase = false; + iWidth = (int)StringCchLenA(chNumber, COUNTOF(chNumber)) - 2; + if (iNumber >= 0) { + if (bIncrease && iNumber < INT_MAX) + iNumber++; + if (!bIncrease && iNumber > 0) + iNumber--; + for (int i = (int)StringCchLenA(chNumber, COUNTOF(chNumber)) - 1; i >= 0; i--) { + if (IsCharLowerA(chNumber[i])) + break; + else if (IsCharUpper(chNumber[i])) { + bUppercase = true; + break; + } + } + if (bUppercase) + StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%#0%iX", iWidth); + else + StringCchPrintfA(chFormat, COUNTOF(chFormat), "%%#0%ix", iWidth); + + StringCchPrintfA(chNumber, COUNTOF(chNumber), chFormat, iNumber); + SciCall_ReplaceSel(chNumber); + SciCall_SetSel(iSelStart, iSelStart + StringCchLenA(chNumber, COUNTOF(chNumber))); + } + } + } + } + UNUSED(hwnd); +} + + +//============================================================================= +// +// EditTabsToSpaces() +// +void EditTabsToSpaces(HWND hwnd,int nTabWidth,bool bOnlyIndentingWS) +{ + if (SciCall_IsSelectionEmpty()) { return; } // no selection + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN,IDS_SELRECT); + return; + } + + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + DocPos iSelStart = SciCall_GetSelectionStart(); + //DocLn iLine = SciCall_LineFromPosition(iSelStart); + //iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line + DocPos iSelEnd = SciCall_GetSelectionEnd(); + DocPos iSelCount = (iSelEnd - iSelStart); + + + const char* pszText = SciCall_GetRangePointer(iSelStart, iSelCount); + + LPWSTR pszTextW = AllocMem((iSelCount + 1) * sizeof(WCHAR), HEAP_ZERO_MEMORY); + if (pszTextW == NULL) { return; } + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)iSelCount+1); + + LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)*nTabWidth+2, HEAP_ZERO_MEMORY); + if (pszConvW == NULL) { + FreeMem(pszTextW); + return; + } + + int cchConvW = 0; + + // Contributed by Homam + // Thank you very much! + int i = 0; + bool bIsLineStart = true; + bool bModified = false; + for (int iTextW = 0; iTextW < cchTextW; iTextW++) + { + WCHAR w = pszTextW[iTextW]; + if (w == L'\t' && (!bOnlyIndentingWS || bIsLineStart)) { + for (int j = 0; j < nTabWidth - i % nTabWidth; j++) + pszConvW[cchConvW++] = L' '; + i = 0; + bModified = true; + } + else { + i++; + if (w == L'\n' || w == L'\r') { + i = 0; + bIsLineStart = true; + } + else if (w != L' ') + bIsLineStart = false; + pszConvW[cchConvW++] = w; + } + } + + FreeMem(pszTextW); + + if (bModified) { + char* pszText2 = AllocMem(cchConvW*3, HEAP_ZERO_MEMORY); + + int cchConvM = WideCharToMultiByte(Encoding_SciCP,0,pszConvW,cchConvW,pszText2,(int)SizeOfMem(pszText2),NULL,NULL); + + if (iCurPos < iAnchorPos) { + iCurPos = iSelStart; + iAnchorPos = iSelStart + cchConvM; + } + else { + iAnchorPos = iSelStart; + iCurPos = iSelStart + cchConvM; + } + + EditEnterTargetTransaction(); + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText2); + EditLeaveTargetTransaction(); + + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + + FreeMem(pszText2); + } + + FreeMem(pszConvW); +} + + +//============================================================================= +// +// EditSpacesToTabs() +// +void EditSpacesToTabs(HWND hwnd,int nTabWidth,bool bOnlyIndentingWS) +{ + if (SciCall_IsSelectionEmpty()) { return; } // no selection + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + DocPos iSelStart = SciCall_GetSelectionStart(); + //DocLn iLine = SciCall_LineFromPosition(iSelStart); + //iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line + DocPos iSelEnd = SciCall_GetSelectionEnd(); + DocPos iSelCount = (iSelEnd - iSelStart); + + const char* pszText = SciCall_GetRangePointer(iSelStart, iSelCount); + + LPWSTR pszTextW = AllocMem((iSelCount + 1) * sizeof(WCHAR), HEAP_ZERO_MEMORY); + if (pszTextW == NULL) + { + return; + } + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)iSelCount+1); + + LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)+2, HEAP_ZERO_MEMORY); + if (pszConvW == NULL) { + FreeMem(pszTextW); + return; + } + + int cchConvW = 0; + + // Contributed by Homam + // Thank you very much! + int i = 0; + int j = 0; + bool bIsLineStart = true; + bool bModified = false; + WCHAR space[256] = { L'\0' }; + for (int iTextW = 0; iTextW < cchTextW; iTextW++) + { + WCHAR w = pszTextW[iTextW]; + if ((w == L' ' || w == L'\t') && (!bOnlyIndentingWS || bIsLineStart)) { + space[j++] = w; + if (j == nTabWidth - i % nTabWidth || w == L'\t') { + if (j > 1 || pszTextW[iTextW+1] == L' ' || pszTextW[iTextW+1] == L'\t') + pszConvW[cchConvW++] = L'\t'; + else + pszConvW[cchConvW++] = w; + i = j = 0; + bModified = bModified || (w != pszConvW[cchConvW-1]); + } + } + else { + i += j + 1; + if (j > 0) { + //space[j] = '\0'; + for (int t = 0; t < j; t++) + pszConvW[cchConvW++] = space[t]; + j = 0; + } + if (w == L'\n' || w == L'\r') { + i = 0; + bIsLineStart = true; + } + else + bIsLineStart = false; + pszConvW[cchConvW++] = w; + } + } + if (j > 0) { + for (int t = 0; t < j; t++) + pszConvW[cchConvW++] = space[t]; + } + + FreeMem(pszTextW); + + if (bModified || cchConvW != cchTextW) { + char* pszText2 = AllocMem(cchConvW * 3, HEAP_ZERO_MEMORY); + + int cchConvM = WideCharToMultiByte(Encoding_SciCP,0,pszConvW,cchConvW,pszText2,(int)SizeOfMem(pszText2),NULL,NULL); + + if (iAnchorPos > iCurPos) { + iCurPos = iSelStart; + iAnchorPos = iSelStart + cchConvM; + } + else { + iAnchorPos = iSelStart; + iCurPos = iSelStart + cchConvM; + } + + EditEnterTargetTransaction(); + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText2); + EditLeaveTargetTransaction(); + + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + + FreeMem(pszText2); + } + + FreeMem(pszConvW); +} + + +//============================================================================= +// +// EditMoveUp() +// +void EditMoveUp(HWND hwnd) +{ + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + } + else { + SendMessage(hwnd, SCI_MOVESELECTEDLINESUP, 0, 0); + } +} + + +//============================================================================= +// +// EditMoveDown() +// +void EditMoveDown(HWND hwnd) +{ + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + } + else { + SendMessage(hwnd, SCI_MOVESELECTEDLINESDOWN, 0, 0); + } +} + + +//============================================================================= +// +// EditJumpToSelectionStart() +// +void EditJumpToSelectionStart(HWND hwnd) +{ + UNUSED(hwnd); + if (!SciCall_IsSelectionRectangle()) { + if (SciCall_GetCurrentPos() != SciCall_GetSelectionStart()) { + SciCall_SwapMainAnchorCaret(); + } + } +} + +//============================================================================= +// +// EditJumpToSelectionEnd() +// +void EditJumpToSelectionEnd(HWND hwnd) +{ + UNUSED(hwnd); + if (!SciCall_IsSelectionRectangle()) { + if (SciCall_GetCurrentPos() != SciCall_GetSelectionEnd()) { + SciCall_SwapMainAnchorCaret(); + } + } +} + + +//============================================================================= +// +// EditModifyLines() +// +void EditModifyLines(HWND hwnd,LPCWSTR pwszPrefix,LPCWSTR pwszAppend) +{ + bool bAppendNum = false; + char mszPrefix1[256*3] = { '\0' }; + char mszAppend1[256*3] = { '\0' }; + + DocPos iSelStart = SciCall_GetSelectionStart(); + DocPos iSelEnd = SciCall_GetSelectionEnd(); + + if (lstrlen(pwszPrefix)) + WideCharToMultiByteStrg(Encoding_SciCP,pwszPrefix,mszPrefix1); + if (lstrlen(pwszAppend)) + WideCharToMultiByteStrg(Encoding_SciCP,pwszAppend,mszAppend1); + + if (!SciCall_IsSelectionRectangle()) + { + DocLn iLine; + + DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + //if (iSelStart > SendMessage(hwnd,SCI_POSITIONFROMLINE,(WPARAM)iLineStart,0)) + // iLineStart++; + + if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) + { + if ((iLineEnd - iLineStart) >= 1) + --iLineEnd; + } + + bool bPrefixNum = false; + DocLn iPrefixNum = 0; + int iPrefixNumWidth = 1; + DocLn iAppendNum = 0; + int iAppendNumWidth = 1; + char* pszPrefixNumPad = ""; + char* pszAppendNumPad = ""; + char mszPrefix2[256*3] = { '\0' }; + char mszAppend2[256*3] = { '\0' }; + + if (StringCchLenA(mszPrefix1,COUNTOF(mszPrefix1))) + { + char* p = StrStrA(mszPrefix1, "$("); + while (!bPrefixNum && p) { + + if (StrCmpNA(p,"$(I)",CSTRLEN("$(I)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(I)")); + bPrefixNum = true; + iPrefixNum = 0; + for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = ""; + } + + else if (StrCmpNA(p,"$(0I)",CSTRLEN("$(0I)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0I)")); + bPrefixNum = true; + iPrefixNum = 0; + for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = "0"; + } + + else if (StrCmpNA(p,"$(N)",CSTRLEN("$(N)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(N)")); + bPrefixNum = true; + iPrefixNum = 1; + for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = ""; + } + + else if (StrCmpNA(p,"$(0N)",CSTRLEN("$(0N)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0N)")); + bPrefixNum = true; + iPrefixNum = 1; + for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = "0"; + } + + else if (StrCmpNA(p,"$(L)",CSTRLEN("$(L)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(L)")); + bPrefixNum = true; + iPrefixNum = iLineStart+1; + for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = ""; + } + + else if (StrCmpNA(p,"$(0L)",CSTRLEN("$(0L)")) == 0) { + *p = 0; + StringCchCopyA(mszPrefix2,COUNTOF(mszPrefix2),p + CSTRLEN("$(0L)")); + bPrefixNum = true; + iPrefixNum = iLineStart+1; + for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) + iPrefixNumWidth++; + pszPrefixNumPad = "0"; + } + p += CSTRLEN("$("); + p = StrStrA(p, "$("); // next + } + } + + if (StringCchLenA(mszAppend1,COUNTOF(mszAppend1))) + { + char* p = StrStrA(mszAppend1, "$("); + while (!bAppendNum && p) { + + if (StrCmpNA(p,"$(I)",CSTRLEN("$(I)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(I)")); + bAppendNum = true; + iAppendNum = 0; + for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = ""; + } + + else if (StrCmpNA(p,"$(0I)",CSTRLEN("$(0I)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0I)")); + bAppendNum = true; + iAppendNum = 0; + for (DocLn i = iLineEnd - iLineStart; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = "0"; + } + + else if (StrCmpNA(p,"$(N)",CSTRLEN("$(N)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(N)")); + bAppendNum = true; + iAppendNum = 1; + for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = ""; + } + + else if (StrCmpNA(p,"$(0N)",CSTRLEN("$(0N)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0N)")); + bAppendNum = true; + iAppendNum = 1; + for (DocLn i = iLineEnd - iLineStart + 1; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = "0"; + } + + else if (StrCmpNA(p,"$(L)",CSTRLEN("$(L)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(L)")); + bAppendNum = true; + iAppendNum = iLineStart+1; + for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = ""; + } + + else if (StrCmpNA(p,"$(0L)",CSTRLEN("$(0L)")) == 0) { + *p = 0; + StringCchCopyA(mszAppend2,COUNTOF(mszAppend2),p + CSTRLEN("$(0L)")); + bAppendNum = true; + iAppendNum = iLineStart+1; + for (DocLn i = iLineEnd + 1; i >= 10; i = i / 10) + iAppendNumWidth++; + pszAppendNumPad = "0"; + } + p += CSTRLEN("$("); + p = StrStrA(p, "$("); // next + } + } + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + for (iLine = iLineStart; iLine <= iLineEnd; iLine++) + { + DocPos iPos; + + if (lstrlen(pwszPrefix)) { + + char mszInsert[512*3] = { '\0' }; + StringCchCopyA(mszInsert,COUNTOF(mszInsert),mszPrefix1); + + if (bPrefixNum) { + char tchFmt[64] = { '\0' }; + char tchNum[64] = { '\0' }; + StringCchPrintfA(tchFmt,COUNTOF(tchFmt),"%%%s%ii",pszPrefixNumPad,iPrefixNumWidth); + StringCchPrintfA(tchNum,COUNTOF(tchNum),tchFmt,iPrefixNum); + StringCchCatA(mszInsert,COUNTOF(mszInsert),tchNum); + StringCchCatA(mszInsert,COUNTOF(mszInsert),mszPrefix2); + iPrefixNum++; + } + iPos = SciCall_PositionFromLine(iLine); + SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, iPos); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszInsert); + } + + if (lstrlen(pwszAppend)) { + + char mszInsert[512*3] = { '\0' }; + StringCchCopyA(mszInsert,COUNTOF(mszInsert),mszAppend1); + + if (bAppendNum) { + char tchFmt[64] = { '\0' }; + char tchNum[64] = { '\0' }; + StringCchPrintfA(tchFmt,COUNTOF(tchFmt),"%%%s%ii",pszAppendNumPad,iAppendNumWidth); + StringCchPrintfA(tchNum,COUNTOF(tchNum),tchFmt,iAppendNum); + StringCchCatA(mszInsert,COUNTOF(mszInsert),tchNum); + StringCchCatA(mszInsert,COUNTOF(mszInsert),mszAppend2); + iAppendNum++; + } + iPos = SciCall_GetLineEndPosition(iLine); + SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, iPos); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszInsert); + } + } + + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); + + // extend selection to start of first line + // the above code is not required when last line has been excluded + if (iSelStart != iSelEnd) + { + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + if (iCurPos < iAnchorPos) { + iCurPos = SciCall_PositionFromLine(iLineStart); + iAnchorPos = SciCall_PositionFromLine(iLineEnd + 1); + } + else { + iAnchorPos = SciCall_PositionFromLine(iLineStart); + iCurPos = SciCall_PositionFromLine(iLineEnd + 1); + } + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + } + } + else + MsgBox(MBWARN,IDS_SELRECT); +} + + +//============================================================================= +// +// EditIndentBlock() +// +void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation) +{ + if ((cmd != SCI_TAB) && (cmd != SCI_BACKTAB)) { + SendMessage(hwnd, cmd, 0, 0); + return; + } + + if (SciCall_IsSelectionRectangle()) + { + //if (cmd == SCI_TAB) { + // if (g_bTabsAsSpaces) { + // int size = (bFormatIndentation ? g_iIndentWidth : g_iTabWidth); + // char* pPadStr = LocalAlloc(LPTR, size + 1); + // FillMemory(pPadStr, size, ' '); + // EditPaste2RectSel(hwnd, pPadStr); + // LocalFree(pPadStr); + // } + // else { + // EditPaste2RectSel(hwnd, "\t"); + // } + // return; + //} + // better idea: EditPaste2RectSel(hwnd, pPadStr, pText); pText==NULL => copy single sel + + //TODO: workaround for rectangular selection: make stream selection + EditSelectEx(hwnd, SciCall_GetAnchor(), SciCall_GetCurrentPos(), -1, -1); + } + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + //const DocPos iSelStart = SciCall_GetSelectionStart(); + //const DocPos iSelEnd = SciCall_GetSelectionEnd(); + const DocLn iCurLine = SciCall_LineFromPosition(iCurPos); + const DocLn iAnchorLine = SciCall_LineFromPosition(iAnchorPos); + const bool bSingleLine = Sci_IsSingleLineSelection(); + + const bool _bTabIndents = (bool)SendMessage(hwnd, SCI_GETTABINDENTS, 0, 0); + const bool _bBSpUnindents = (bool)SendMessage(hwnd, SCI_GETBACKSPACEUNINDENTS, 0, 0); + + DocPos iDiffCurrent = 0; + DocPos iDiffAnchor = 0; + bool bFixStart = false; + + if (bSingleLine) { + if (bFormatIndentation) { + SendMessage(hwnd, SCI_VCHOME, 0, 0); + if (SciCall_PositionFromLine(iCurLine) == SciCall_GetCurrentPos()) { + SendMessage(hwnd, SCI_VCHOME, 0, 0); + } + iDiffCurrent = (iCurPos - SciCall_GetCurrentPos()); + } + } + else { + iDiffCurrent = (SciCall_GetLineEndPosition(iCurLine) - iCurPos); + iDiffAnchor = (SciCall_GetLineEndPosition(iAnchorLine) - iAnchorPos); + if (iCurPos < iAnchorPos) + bFixStart = (SciCall_PositionFromLine(iCurLine) == SciCall_GetCurrentPos()); + else + bFixStart = (SciCall_PositionFromLine(iAnchorLine) == SciCall_GetAnchor()); + } + + if (cmd == SCI_TAB) + { + SendMessage(hwnd, SCI_SETTABINDENTS, (bFormatIndentation ? true : _bTabIndents), 0); + SendMessage(hwnd, SCI_TAB, 0, 0); + if (bFormatIndentation) + SendMessage(hwnd, SCI_SETTABINDENTS, _bTabIndents, 0); + } + else // SCI_BACKTAB + { + //if (SciCall_PositionFromLine(iCurLine) != SciCall_GetSelectionStart()) + SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, (bFormatIndentation ? true : _bBSpUnindents), 0); + SendMessage(hwnd, SCI_BACKTAB, 0, 0); + if (bFormatIndentation) + SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, _bBSpUnindents, 0); + } + + if (bSingleLine) { + if (bFormatIndentation) + EditSelectEx(hwnd, SciCall_GetCurrentPos() + iDiffCurrent + (iAnchorPos - iCurPos), SciCall_GetCurrentPos() + iDiffCurrent, -1, -1); + } + else { // on multiline indentation, anchor and current positions are moved to line begin resp. end + if (bFixStart) { + if (iCurPos < iAnchorPos) + iDiffCurrent = SciCall_LineLength(iCurLine) - Sci_GetEOLLen(); + else + iDiffAnchor = SciCall_LineLength(iAnchorLine) - Sci_GetEOLLen(); + } + EditSelectEx(hwnd, SciCall_GetLineEndPosition(iAnchorLine) - iDiffAnchor, SciCall_GetLineEndPosition(iCurLine) - iDiffCurrent, -1, -1); + } +} + + +//============================================================================= +// +// EditAlignText() +// +void EditAlignText(HWND hwnd,int nMode) +{ + #define BUFSIZE_ALIGN 1024 + + bool bModified = false; + + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + if (!SciCall_IsSelectionRectangle()) + { + DocLn iLine; + DocPos iMinIndent = BUFSIZE_ALIGN; + DocPos iMaxLength = 0; + + DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) + { + if ((iLineEnd - iLineStart) >= 1) + --iLineEnd; + } + + for (iLine = iLineStart; iLine <= iLineEnd; iLine++) { + + DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine); + const DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine); + + if (iLineIndentPos != iLineEndPos) + { + const DocPos iIndentCol = (DocPos)SendMessage(hwnd,SCI_GETLINEINDENTATION,(WPARAM)iLine,0); + DocPos iTail; + + iTail = iLineEndPos-1; + char ch = (char)SendMessage(hwnd,SCI_GETCHARAT,(WPARAM)iTail,0); + while (iTail >= iLineStart && (ch == ' ' || ch == '\t')) + { + --iTail; + ch = (char)SendMessage(hwnd,SCI_GETCHARAT,(WPARAM)iTail,0); + --iLineEndPos; + } + const DocPos iEndCol = SciCall_GetColumn(iLineEndPos); + + iMinIndent = min(iMinIndent,iIndentCol); + iMaxLength = max(iMaxLength,iEndCol); + } + } + + if (iMaxLength < BUFSIZE_ALIGN) { + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + for (iLine = iLineStart; iLine <= iLineEnd; iLine++) + { + DocPos iEndPos = SciCall_GetLineEndPosition(iLine); + DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); + + if ((iIndentPos == iEndPos) && (iEndPos > 0)) { + + if (!bModified) { + SendMessage(hwnd, SCI_BEGINUNDOACTION, 0, 0); + bModified = true; + } + SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), iEndPos); + SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)""); + } + + else { + + char tchLineBuf[BUFSIZE_ALIGN*3] = { '\0' }; + WCHAR wchLineBuf[BUFSIZE_ALIGN*3] = L""; + WCHAR *pWords[BUFSIZE_ALIGN*3/2]; + WCHAR *p = wchLineBuf; + + int iWords = 0; + int iWordsLength = 0; + DocPos cchLine = SciCall_GetLine(iLine, tchLineBuf); + + if (!bModified) { + SendMessage(hwnd, SCI_BEGINUNDOACTION, 0, 0); + bModified = true; + } + + MultiByteToWideChar(Encoding_SciCP,0,tchLineBuf,(int)cchLine,wchLineBuf,COUNTOF(wchLineBuf)); + StrTrim(wchLineBuf,L"\r\n\t "); + + while (*p) { + if (*p != L' ' && *p != L'\t') { + pWords[iWords++] = p++; + iWordsLength++; + while (*p && *p != L' ' && *p != L'\t') { + p++; + iWordsLength++; + } + } + else + *p++ = 0; + } + + if (iWords > 0) { + + if (nMode == ALIGN_JUSTIFY || nMode == ALIGN_JUSTIFY_EX) { + + bool bNextLineIsBlank = false; + if (nMode == ALIGN_JUSTIFY_EX) { + + if (SciCall_GetLineCount() <= iLine+1) + bNextLineIsBlank = true; + + else { + + DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine + 1); + DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine + 1); + + if (iLineIndentPos == iLineEndPos) + bNextLineIsBlank = true; + } + } + + if ((nMode == ALIGN_JUSTIFY || nMode == ALIGN_JUSTIFY_EX) && + iWords > 1 && iWordsLength >= 2 && + ((nMode != ALIGN_JUSTIFY_EX || !bNextLineIsBlank || iLineStart == iLineEnd) || + (bNextLineIsBlank && iWordsLength > (iMaxLength - iMinIndent) * 0.75))) { + + int iGaps = iWords - 1; + DocPos iSpacesPerGap = (iMaxLength - iMinIndent - iWordsLength) / iGaps; + DocPos iExtraSpaces = (iMaxLength - iMinIndent - iWordsLength) % iGaps; + int i,j; + + WCHAR wchNewLineBuf[BUFSIZE_ALIGN * 3] = { L'\0' }; + int length = BUFSIZE_ALIGN * 3; + StringCchCopy(wchNewLineBuf,COUNTOF(wchNewLineBuf),pWords[0]); + p = StrEnd(wchNewLineBuf); + + for (i = 1; i < iWords; i++) { + for (j = 0; j < iSpacesPerGap; j++) { + *p++ = L' '; + *p = 0; + } + if (i > iGaps - iExtraSpaces) { + *p++ = L' '; + *p = 0; + } + StringCchCat(p,(length - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); + p = StrEnd(p); + } + + int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; + + SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), SciCall_GetLineEndPosition(iLine)); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); + + SendMessage(hwnd,SCI_SETLINEINDENTATION,(WPARAM)iLine,(LPARAM)iMinIndent); + } + else { + + WCHAR wchNewLineBuf[BUFSIZE_ALIGN] = { L'\0' }; + StringCchCopy(wchNewLineBuf,COUNTOF(wchNewLineBuf),pWords[0]); + p = StrEnd(wchNewLineBuf); + + for (int i = 1; i < iWords; i++) { + *p++ = L' '; + *p = 0; + StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); + p = StrEnd(p); + } + + int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; + + SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLine), SciCall_GetLineEndPosition(iLine)); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); + + SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent); + } + } + else { + + DocPos iExtraSpaces = iMaxLength - iMinIndent - iWordsLength - iWords + 1; + DocPos iOddSpaces = iExtraSpaces % 2; + int i; + DocPos iPos; + + WCHAR wchNewLineBuf[BUFSIZE_ALIGN*3] = L""; + p = wchNewLineBuf; + + if (nMode == ALIGN_RIGHT) { + for (i = 0; i < iExtraSpaces; i++) + *p++ = L' '; + *p = 0; + } + if (nMode == ALIGN_CENTER) { + for (i = 1; i < iExtraSpaces - iOddSpaces; i+=2) + *p++ = L' '; + *p = 0; + } + for (i = 0; i < iWords; i++) { + StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),pWords[i]); + if (i < iWords - 1) + StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),L" "); + if (nMode == ALIGN_CENTER && iWords > 1 && iOddSpaces > 0 && i + 1 >= iWords / 2) { + StringCchCat(p,(COUNTOF(wchNewLineBuf) - StringCchLenW(wchNewLineBuf,COUNTOF(wchNewLineBuf))),L" "); + iOddSpaces--; + } + p = StrEnd(p); + } + + int cch = WideCharToMultiByteStrg(Encoding_SciCP,wchNewLineBuf,tchLineBuf) - 1; + + if (nMode == ALIGN_RIGHT || nMode == ALIGN_CENTER) { + SendMessage(hwnd,SCI_SETLINEINDENTATION,(WPARAM)iLine,(LPARAM)iMinIndent); + iPos = SciCall_GetLineIndentPosition(iLine); + } + else + iPos = SciCall_PositionFromLine(iLine); + + SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, SciCall_GetLineEndPosition(iLine)); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf); + + if (nMode == ALIGN_LEFT) + SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent); + } + } + } + } + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); + } + else + MsgBox(MBINFO, IDS_BUFFERTOOSMALL); + + if (bModified) { + SendMessage(hwnd, SCI_ENDUNDOACTION, 0, 0); + } + + if (iCurPos < iAnchorPos) { + iCurPos = SciCall_PositionFromLine(iLineStart); + iAnchorPos = SciCall_PositionFromLine(iLineEnd + 1); + } + else { + iAnchorPos = SciCall_PositionFromLine(iLineStart); + iCurPos = SciCall_PositionFromLine(iLineEnd + 1); + } + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + } + else + MsgBox(MBWARN, IDS_SELRECT); +} + + + +//============================================================================= +// +// EditEncloseSelection() +// +void EditEncloseSelection(HWND hwnd, LPCWSTR pwszOpen, LPCWSTR pwszClose) +{ + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + char mszOpen[256 * 3] = { '\0' }; + char mszClose[256 * 3] = { '\0' }; + + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + if (lstrlen(pwszOpen)) + WideCharToMultiByteStrg(Encoding_SciCP, pwszOpen, mszOpen); + if (lstrlen(pwszClose)) + WideCharToMultiByteStrg(Encoding_SciCP, pwszClose, mszClose); + + const DocPos iLenOpen = StringCchLenA(mszOpen, COUNTOF(mszOpen)); + const DocPos iLenClose = StringCchLenA(mszClose, COUNTOF(mszClose)); + + EditEnterTargetTransaction(); + + if (iLenOpen > 0) { + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelStart); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszOpen); + } + + if (iLenClose > 0) { + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelEnd + iLenOpen, iSelEnd + iLenOpen); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)mszClose); + } + + EditLeaveTargetTransaction(); + + // Fix selection + EditSelectEx(hwnd, iAnchorPos + iLenOpen, iCurPos + iLenOpen, -1, -1); +} + + +//============================================================================= +// +// EditToggleLineComments() +// +void EditToggleLineComments(HWND hwnd, LPCWSTR pwszComment, bool bInsertAtStart) +{ + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + const DocPos iSelBegCol = SciCall_GetColumn(iSelStart); + + char mszComment[32 * 3] = { '\0' }; + + if (lstrlen(pwszComment)) { + WideCharToMultiByte(Encoding_SciCP, 0, pwszComment, -1, mszComment, COUNTOF(mszComment), NULL, NULL); + } + const DocPos cchComment = StringCchLenA(mszComment, COUNTOF(mszComment)); + + if (cchComment == 0) { return; } + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { + if ((iLineEnd - iLineStart) >= 1) + --iLineEnd; + } + + DocPos iCommentCol = 0; + + if (!bInsertAtStart) { + iCommentCol = (DocPos)INT_MAX; + for (DocLn iLine = iLineStart; iLine <= iLineEnd; iLine++) + { + const DocPos iLineEndPos = SciCall_GetLineEndPosition(iLine); + const DocPos iLineIndentPos = SciCall_GetLineIndentPosition(iLine); + if (iLineIndentPos != iLineEndPos) { + const DocPos iIndentColumn = SciCall_GetColumn(iLineIndentPos); + iCommentCol = min(iCommentCol, iIndentColumn); + } + } + } + + DocPos iSelStartOffset = (iCommentCol >= iSelBegCol) ? 0 : cchComment; + DocPos iSelEndOffset = 0; + + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + int iAction = 0; + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; iLine++) + { + const DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); + + if (iIndentPos == SciCall_GetLineEndPosition(iLine)) { + // don't set comment char on "empty" (white-space only) lines + //~iAction = 1; + continue; + } + + const char* tchBuf = SciCall_GetRangePointer(iIndentPos, cchComment + 1); + if (StrCmpNIA(tchBuf, mszComment, (int)cchComment) == 0) + { + // remove comment chars + switch (iAction) { + case 0: + iAction = 2; + case 2: + SciCall_SetTargetRange(iIndentPos, iIndentPos + cchComment); + SciCall_ReplaceTarget(0, ""); + iSelEndOffset -= cchComment; + if (iLine == iLineStart) { + iSelStartOffset = (iSelStart == SciCall_PositionFromLine(iLine)) ? 0 : (0 - cchComment); + } + break; + case 1: + break; + } + } + else { + // set comment chars at indent pos + switch (iAction) { + case 0: + iAction = 1; + case 1: + { + SciCall_InsertText(SciCall_FindColumn(iLine, iCommentCol), mszComment); + iSelEndOffset += cchComment; + if (iLine == iLineStart) { + iSelStartOffset = (iCommentCol >= iSelBegCol) ? 0 : cchComment; + } + } + break; + case 2: + break; + } + } + } + + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); + + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iAnchorPos + iSelEndOffset, iCurPos + iSelStartOffset, -1, -1); + else if (iCurPos > iAnchorPos) + EditSelectEx(hwnd, iAnchorPos + iSelStartOffset, iCurPos + iSelEndOffset, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos + iSelStartOffset, iCurPos + iSelStartOffset, -1, -1); +} + + +//============================================================================= +// +// _AppendSpaces() +// +static DocPos __fastcall _AppendSpaces(HWND hwnd, DocLn iLineStart, DocLn iLineEnd, DocPos iMaxColumn, bool bSkipEmpty) +{ + UNUSED(hwnd); + + size_t size = (size_t)iMaxColumn; + char* pmszPadStr = AllocMem(size + 1, HEAP_ZERO_MEMORY); + FillMemory(pmszPadStr, size, ' '); + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + DocPos spcCount = 0; + //const bool bIsSelectionRectangle = SciCall_IsSelectionRectangle(); + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { + + // insertion position is at end of line + const DocPos iPos = SciCall_GetLineEndPosition(iLine); + const DocPos iCol = SciCall_GetColumn(iPos); + + if (iCol >= iMaxColumn) { continue; } + if (bSkipEmpty && (iPos <= SciCall_PositionFromLine(iLine))) { continue; } + + const DocPos iPadLen = (iMaxColumn - iCol); + + pmszPadStr[iPadLen] = '\0'; // slice + + SciCall_SetTargetRange(iPos, iPos); + SciCall_ReplaceTarget(-1, pmszPadStr); // pad + + pmszPadStr[iPadLen] = ' '; // reset + spcCount += iPadLen; + } + + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); + + FreeMem(pmszPadStr); + + return spcCount; +} + +//============================================================================= +// +// EditPadWithSpaces() +// +void EditPadWithSpaces(HWND hwnd, bool bSkipEmpty, bool bNoUndoGroup) +{ + if (SciCall_IsSelectionEmpty() || Sci_IsThinRectangleSelected()) { return; } + + const int token = (!bNoUndoGroup ? BeginUndoAction() : -1); + + if (SciCall_IsSelectionRectangle()) + { + const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); + const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); + const DocPos vSpcAnchorMainPos = 0; // SciCall_GetRectangularSelectionAnchorVirtualSpace(); + const DocPos vSpcCaretMainPos = 0; // SciCall_GetRectangularSelectionCaretVirtualSpace(); + + const DocLn iRcCurLine = SciCall_LineFromPosition(selCaretMainPos); + const DocLn iRcAnchorLine = SciCall_LineFromPosition(selAnchorMainPos); + + DocLn iStartLine = 0; + DocLn iEndLine = 0; + if (iRcAnchorLine == iRcCurLine) { + iEndLine = SciCall_GetLineCount() - 1; + } + else { + iStartLine = (iRcCurLine < iRcAnchorLine) ? iRcCurLine : iRcAnchorLine; + iEndLine = (iRcCurLine < iRcAnchorLine) ? iRcAnchorLine : iRcCurLine; + } + + DocPos iMaxColumn = 0; + for (DocLn iLine = iStartLine; iLine <= iEndLine; iLine++) { + const DocPos iPos = SciCall_GetLineSelEndPosition(iLine); + if (iPos != INVALID_POSITION) { + iMaxColumn = max(iMaxColumn, SciCall_GetColumn(iPos)); + } + } + if (iMaxColumn <= 0) { return; } + + const DocPos iSpcCount = _AppendSpaces(hwnd, iStartLine, iEndLine, iMaxColumn, bSkipEmpty); + + if (iRcCurLine < iRcAnchorLine) + EditSelectEx(hwnd, selAnchorMainPos + iSpcCount, selCaretMainPos, vSpcAnchorMainPos, vSpcCaretMainPos); + else + EditSelectEx(hwnd, selAnchorMainPos, selCaretMainPos + iSpcCount, vSpcAnchorMainPos, vSpcCaretMainPos); + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + DocLn iStartLine = 0; + DocLn iEndLine = SciCall_GetLineCount() - 1; + + if (iSelStart != iSelEnd) { + iStartLine = SciCall_LineFromPosition(iSelStart); + iEndLine = SciCall_LineFromPosition(iSelEnd); + if (iSelEnd < SciCall_GetLineEndPosition(iEndLine)) { --iEndLine; } + if (iEndLine <= iStartLine) { return; } + } + + DocPos iMaxColumn = 0; + for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) { + iMaxColumn = max(iMaxColumn, SciCall_GetColumn(SciCall_GetLineEndPosition(iLine))); + } + if (iMaxColumn <= 0) { return; } + + const DocPos iSpcCount = _AppendSpaces(hwnd, iStartLine, iEndLine, iMaxColumn, bSkipEmpty); + + if (iCurPos < iAnchorPos) + EditSelectEx(hwnd, iAnchorPos + iSpcCount, iCurPos, -1, -1); + else + EditSelectEx(hwnd, iAnchorPos, iCurPos + iSpcCount, -1, -1); + } + + if (token >= 0) { EndUndoAction(token); } +} + + +//============================================================================= +// +// EditStripFirstCharacter() +// +void EditStripFirstCharacter(HWND hwnd) +{ + UNUSED(hwnd); + + DocPos iSelStart = 0; + DocPos iSelEnd = 0; + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + if (SciCall_IsSelectionRectangle()) + { + if (SciCall_IsSelectionEmpty()) { + SciCall_Clear(); + return; + } + + const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); + const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); + const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); + + DocPos remCount = 0; + const DocPosU selCount = SciCall_GetSelections(); + for (DocPosU s = 0; s < selCount; ++s) { + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); + //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); + + const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; + const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; + //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); + + const DocPos nextPos = (selTargetStart < selTargetEnd) ? SciCall_PositionAfter(selTargetStart) : selTargetEnd; + const DocPos diff = (nextPos <= selTargetEnd) ? (nextPos - selTargetStart) : 0; + + const DocPos len = (selTargetEnd - nextPos); + if ((len >= 0) && (len < TEMPLINE_BUFFER)) //TODO: @@@ alloc memory dynamically + { + StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(nextPos, len + 1), len); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(len, g_pTempLineBuffer); + } + remCount += diff; + + } // for() + + SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); + if (vSpcAnchorMainPos > 0) + SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); + + SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); + if (vSpcCaretMainPos > 0) + SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); + + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + if (SciCall_IsSelectionEmpty()) + { + iSelEnd = SciCall_GetTextLength(); + } + else { + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + } + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { + const DocPos iPos = SciCall_PositionFromLine(iLine); + if (iPos < SciCall_GetLineEndPosition(iLine)) { + SciCall_SetTargetRange(iPos, SciCall_PositionAfter(iPos)); + SciCall_ReplaceTarget(0, ""); + } + } + } + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); +} + + +//============================================================================= +// +// EditStripLastCharacter() +// +void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlanksOnly) +{ + UNUSED(hwnd); + + DocPos iSelStart = 0; + DocPos iSelEnd = 0; + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + if (SciCall_IsSelectionRectangle() && !bIgnoreSelection) { + if (SciCall_IsSelectionEmpty()) { + SciCall_Clear(); + return; + } + + const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); + const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); + const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); + + DocPos remCount = 0; + const DocPosU selCount = SciCall_GetSelections(); + for (DocPosU s = 0; s < selCount; ++s) + { + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); + //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); + + const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; + const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; + //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); + + DocPos diff = 0; + DocPos len = 0; + + if (bTrailingBlanksOnly) + { + len = (selTargetEnd - selTargetStart); + if ((len >= 0) && (len < TEMPLINE_BUFFER)) + { + StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(selTargetStart, len + 1), len); + DocPos end = (DocPos)StrCSpnA(g_pTempLineBuffer, "\r\n"); + DocPos i = end; + while (--i >= 0) { + const char ch = g_pTempLineBuffer[i]; + if (IsWhiteSpace(ch)) { + g_pTempLineBuffer[i] = '\0'; + } + else + break; + } + while (end < len) { + g_pTempLineBuffer[++i] = g_pTempLineBuffer[end++]; // add "\r\n" if anny + } + diff = len - (++i); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(-1, g_pTempLineBuffer); + } + } + else { + + const DocPos prevPos = (selTargetStart < selTargetEnd) ? SciCall_PositionBefore(selTargetEnd) : selTargetStart; + diff = (prevPos >= selTargetStart) ? (selTargetEnd - prevPos) : 0; + len = (prevPos - selTargetStart); + + if ((len >= 0) && (len < TEMPLINE_BUFFER)) + { + StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(selTargetStart, len + 1), len); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(len, g_pTempLineBuffer); + } + } + remCount += diff; + + } // for() + + SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); + if (vSpcAnchorMainPos > 0) + SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); + + SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); + if (vSpcCaretMainPos > 0) + SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + if (SciCall_IsSelectionEmpty() || bIgnoreSelection) { + iSelEnd = SciCall_GetTextLength(); + } + else { + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + } + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) + { + const DocPos iStartPos = SciCall_PositionFromLine(iLine); + const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); + + if (bTrailingBlanksOnly) + { + DocPos i = iEndPos; + char ch = '\0'; + do { + ch = SciCall_GetCharAt(--i); + } while ((i >= iStartPos) && IsWhiteSpace(ch)); + if ((++i) < iEndPos) { + SciCall_SetTargetRange(i, iEndPos); + SciCall_ReplaceTarget(0, ""); + } + } + else { // any char at line end + if (iStartPos < iEndPos) { + SciCall_SetTargetRange(SciCall_PositionBefore(iEndPos), iEndPos); + SciCall_ReplaceTarget(0, ""); + } + + } + } + } + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); +} + + +//============================================================================= +// +// EditCompressSpaces() +// +void EditCompressSpaces(HWND hwnd) +{ + const bool bIsSelEmpty = SciCall_IsSelectionEmpty(); + + if (SciCall_IsSelectionRectangle()) { + if (bIsSelEmpty) { + return; + } + + const DocPos selAnchorMainPos = SciCall_GetRectangularSelectionAnchor(); + const DocPos selCaretMainPos = SciCall_GetRectangularSelectionCaret(); + const DocPos vSpcAnchorMainPos = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + const DocPos vSpcCaretMainPos = SciCall_GetRectangularSelectionCaretVirtualSpace(); + + DocPos remCount = 0; + const DocPosU selCount = SciCall_GetSelections(); + for (DocPosU s = 0; s < selCount; ++s) + { + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + //const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); + //const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); + + const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; + const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; + //const DocPos vSpcLength = (selAnchorPos < selCaretPos) ? (vSpcCaretPos - vSpcAnchorPos) : (vSpcAnchorPos - vSpcCaretPos); + + DocPos diff = 0; + DocPos len = 0; + + len = (selTargetEnd - selTargetStart); + if ((len >= 0) && (len < TEMPLINE_BUFFER)) + { + char* pText = SciCall_GetRangePointer(selTargetStart, len + 1); + const char* pEnd = (pText + len); + DocPos i = 0; + while (pText < pEnd) { + const char ch = *pText++; + if (IsWhiteSpace(ch)) { + g_pTempLineBuffer[i++] = ' '; + while (IsWhiteSpace(*pText)) { ++pText; } + } + else { g_pTempLineBuffer[i++] = ch; } + } + g_pTempLineBuffer[i] = '\0'; + diff = len - i; + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(-1, g_pTempLineBuffer); + } + remCount += diff; + + } // for() + + SciCall_SetRectangularSelectionAnchor(selAnchorMainPos); + if (vSpcAnchorMainPos > 0) + SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchorMainPos); + + SciCall_SetRectangularSelectionCaret(selCaretMainPos - remCount); + if (vSpcCaretMainPos > 0) + SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCaretMainPos); + + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iSelStartPos = SciCall_GetSelectionStart(); + const DocPos iSelEndPos = SciCall_GetSelectionEnd(); + const DocPos iSelLength = (iSelEndPos - iSelStartPos); + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStartPos); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEndPos); + const DocPos iTxtLength = SciCall_GetTextLength(); + + bool bIsLineStart = true; + bool bIsLineEnd = true; + bool bModified = false; + + const char* pszIn = NULL; + char* pszOut = NULL; + DocPos cch = 0; + if (bIsSelEmpty) { + pszIn = (const char*)SciCall_GetCharacterPointer(); + cch = iTxtLength; + pszOut = AllocMem(cch + 1, HEAP_ZERO_MEMORY); + } + else { + pszIn = (const char*)SciCall_GetRangePointer(iSelStartPos, iSelLength); + cch = SciCall_GetSelText(NULL) - 1; + pszOut = AllocMem(cch + 1, HEAP_ZERO_MEMORY); + bIsLineStart = (iSelStartPos == SciCall_PositionFromLine(iLineStart)); + bIsLineEnd = (iSelEndPos == SciCall_GetLineEndPosition(iLineEnd)); + } + + if (pszIn && pszOut) { + char* co = (char*)pszOut; + DocPos remWSuntilCaretPos = 0; + for (int i = 0; i < cch; ++i) { + if (IsWhiteSpace(pszIn[i])) { + if (pszIn[i] == '\t') { bModified = true; } + while (IsWhiteSpace(pszIn[i + 1])) { + if (bIsSelEmpty && (i < iSelStartPos)) { ++remWSuntilCaretPos; } + ++i; + bModified = true; + } + if (!bIsLineStart && ((pszIn[i + 1] != '\n') && (pszIn[i + 1] != '\r'))) { + *co++ = ' '; + } + else { + bModified = true; + } + } + else { + bIsLineStart = (pszIn[i] == '\n' || pszIn[i] == '\r') ? true : false; + *co++ = pszIn[i]; + } + } + + if (bIsLineEnd && (co > pszOut) && (*(co - 1) == ' ')) { + if (bIsSelEmpty && ((cch - 1) < iSelStartPos)) { --remWSuntilCaretPos; } + *--co = '\0'; + bModified = true; + } + + if (bModified) { + + EditEnterTargetTransaction(); + + if (!SciCall_IsSelectionEmpty()) { + SciCall_TargetFromSelection(); + } + else { + SciCall_SetTargetRange(0, iTxtLength); + } + SciCall_ReplaceTarget(-1, pszOut); + + EditLeaveTargetTransaction(); + + const DocPos iNewLen = StringCchLenA(pszOut, LocalSize(pszOut)); + + if (iCurPos < iAnchorPos) { + EditSelectEx(hwnd, iCurPos + iNewLen, iCurPos, -1, -1); + } + else if (iCurPos > iAnchorPos) { + EditSelectEx(hwnd, iAnchorPos, iAnchorPos + iNewLen, -1, -1); + } + else { // empty selection + DocPos iNewPos = iCurPos; + if (iCurPos > 0) { + iNewPos = SciCall_PositionBefore(SciCall_PositionAfter(iCurPos - remWSuntilCaretPos)); + } + EditSelectEx(hwnd, iNewPos, iNewPos, -1, -1); + } + } + } + if (pszOut) { FreeMem(pszOut); } + } +} + + +//============================================================================= +// +// EditRemoveBlankLines() +// +void EditRemoveBlankLines(HWND hwnd, bool bMerge, bool bRemoveWhiteSpace) +{ + UNUSED(hwnd); + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iSelStart = (SciCall_IsSelectionEmpty() ? 0 : SciCall_GetSelectionStart()); + const DocPos iSelEnd = (SciCall_IsSelectionEmpty() ? SciCall_GetTextLength() : SciCall_GetSelectionEnd()); + + DocLn iBegLine = SciCall_LineFromPosition(iSelStart); + DocLn iEndLine = SciCall_LineFromPosition(iSelEnd); + + if (iSelStart > SciCall_PositionFromLine(iBegLine)) { ++iBegLine; } + if ((iSelEnd <= SciCall_PositionFromLine(iEndLine)) && (iEndLine != SciCall_GetLineCount() - 1)) { --iEndLine; } + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + for (DocLn iLine = iBegLine; iLine <= iEndLine; ) + { + DocLn nBlanks = 0; + bool bSpcOnly = true; + while (((iLine + nBlanks) <= iEndLine) && bSpcOnly) + { + bSpcOnly = false; + const DocPos posLnBeg = SciCall_PositionFromLine(iLine + nBlanks); + const DocPos posLnEnd = SciCall_GetLineEndPosition(iLine + nBlanks); + const int iLnLength = (posLnEnd - posLnBeg); + + if (iLnLength == 0) { + ++nBlanks; + bSpcOnly = true; + } + else if (bRemoveWhiteSpace) { + const char* pLine = SciCall_GetRangePointer(posLnBeg, (DocPos)iLnLength); + int i = 0; + for (; i < iLnLength; ++i) { + if (!IsWhiteSpace(pLine[i])) { + break; + } + } + if (i >= iLnLength) { + ++nBlanks; + bSpcOnly = true; + } + } + } + if ((nBlanks == 0) || ((nBlanks == 1) && bMerge)) { + iLine += (nBlanks + 1); + } + else { + if (bMerge) { --nBlanks; } + + SciCall_SetTargetRange(SciCall_PositionFromLine(iLine), SciCall_PositionFromLine(iLine + nBlanks)); + SciCall_ReplaceTarget(0, ""); + + if (bMerge) { ++iLine; } + iEndLine -= nBlanks; + } + } + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); +} + + +//============================================================================= +// +// EditRemoveDuplicateLines() +// +void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines) +{ + UNUSED(hwnd); + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return; + } + + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + + DocLn iStartLine = 0; + DocLn iEndLine = 0; + if (iSelStart != iSelEnd) { + iStartLine = SciCall_LineFromPosition(iSelStart); + if (iSelStart > SciCall_PositionFromLine(iStartLine)) { ++iStartLine; } + iEndLine = SciCall_LineFromPosition(iSelEnd); + if (iSelEnd <= SciCall_PositionFromLine(iEndLine)) { --iEndLine; } + } + else { + iEndLine = SciCall_GetLineCount() - 1; // last line + } + + if ((iEndLine - iStartLine) <= 1) { return; } + + const DocPos iEmptyLnLen = (SciCall_GetEOLMode() == SC_EOL_CRLF ? 2 : 1); + + DocPos iMaxLineLen = 0; + for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) { + DocPos iLnLen = SciCall_GetLine(iLine, NULL); + if (iLnLen > iMaxLineLen) + iMaxLineLen = iLnLen; + } + + char* pCurrentLine = AllocMem(iMaxLineLen + 1, HEAP_ZERO_MEMORY); + + IgnoreNotifyChangeEvent(); + EditEnterTargetTransaction(); + + for (DocLn iCurLine = iStartLine; iCurLine < iEndLine; ++iCurLine) + { + const DocPos iCurLnLen = SciCall_GetLine(iCurLine, pCurrentLine); + + if (bRemoveEmptyLines || (iCurLnLen > iEmptyLnLen)) { + + for (DocLn iCompareLine = iCurLine + 1; iCompareLine < iEndLine; ++iCompareLine) + { + const DocPos iCmpLnLen = SciCall_GetLine(iCompareLine, NULL); + + if (bRemoveEmptyLines || (iCmpLnLen > iEmptyLnLen)) { + + const DocPos iBegCmpLine = SciCall_PositionFromLine(iCompareLine); + const char* pCompareLine = SciCall_GetRangePointer(iBegCmpLine, iCmpLnLen + 2); + + if (iCurLnLen == iCmpLnLen) { + if (StringCchCompareNA(pCurrentLine, iCurLnLen, pCompareLine, iCmpLnLen) == 0) { + SciCall_SetTargetRange(iBegCmpLine, iBegCmpLine + iCmpLnLen); + SciCall_ReplaceTarget(0, ""); + --iCompareLine; // proactive preventing progress to avoid comparison line skip + --iEndLine; + } + } + } // empty + } + } // empty + } + + EditLeaveTargetTransaction(); + ObserveNotifyChangeEvent(); + + FreeMem(pCurrentLine); +} + + +//============================================================================= +// +// EditWrapToColumn() +// +void EditWrapToColumn(HWND hwnd,DocPos nColumn/*,int nTabWidth*/) +{ + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN,IDS_SELRECT); + return; + } + + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + DocPos iSelStart = 0; + DocPos iSelEnd = SciCall_GetTextLength(); + DocPos iSelCount = SciCall_GetTextLength(); + + if (!SciCall_IsSelectionEmpty()) { + iSelStart = SciCall_GetSelectionStart(); + DocLn iLine = SciCall_LineFromPosition(iSelStart); + iSelStart = SciCall_PositionFromLine(iLine); // re-base selection to start of line + iSelEnd = SciCall_GetSelectionEnd(); + iSelCount = (iSelEnd - iSelStart); + } + + char* pszText = (char*)SciCall_GetRangePointer(iSelStart, iSelCount); + + LPWSTR pszTextW = AllocMem((iSelCount+2)*sizeof(WCHAR), HEAP_ZERO_MEMORY); + if (pszTextW == NULL) { + return; + } + + int cchTextW = MultiByteToWideChar(Encoding_SciCP,0,pszText,(int)iSelCount,pszTextW,(int)(SizeOfMem(pszTextW)/sizeof(WCHAR))); + + LPWSTR pszConvW = AllocMem(cchTextW*sizeof(WCHAR)*3+2, HEAP_ZERO_MEMORY); + if (pszConvW == NULL) { + FreeMem(pszTextW); + return; + } + + int cchEOL = 2; + WCHAR wszEOL[] = L"\r\n"; + int cEOLMode = SciCall_GetEOLMode(); + if (cEOLMode == SC_EOL_CR) + cchEOL = 1; + else if (cEOLMode == SC_EOL_LF) { + cchEOL = 1; wszEOL[0] = L'\n'; + } + + int cchConvW = 0; + DocPos iLineLength = 0; + + //#define W_DELIMITER L"!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~" // underscore counted as part of word + //WCHAR* W_DELIMITER = bAccelWordNavigation ? W_DelimCharsAccel : W_DelimChars; + //#define ISDELIMITER(wc) StrChr(W_DELIMITER,wc) + + //WCHAR* W_WHITESPACE = bAccelWordNavigation ? W_WhiteSpaceCharsAccelerated : W_WhiteSpaceCharsDefault; + //#define ISWHITE(wc) StrChr(W_WHITESPACE,wc) + #define ISWHITE(wc) StrChr(L" \t\f",wc) + + //#define ISWORDEND(wc) (ISDELIMITER(wc) || ISWHITE(wc)) + #define ISWORDEND(wc) StrChr(L" \t\f\r\n\v",wc) + + DocPos iCaretShift = 0; + bool bModified = false; + + for (int iTextW = 0; iTextW < cchTextW; iTextW++) + { + WCHAR w = pszTextW[iTextW]; + + if (ISWHITE(w)) + { + DocPos iNextWordLen = 0; + + while (pszTextW[iTextW+1] == L' ' || pszTextW[iTextW+1] == L'\t') { + ++iTextW; + bModified = true; + } + + WCHAR w2 = pszTextW[iTextW + 1]; + + while (w2 != L'\0' && !ISWORDEND(w2)) { + iNextWordLen++; + w2 = pszTextW[iTextW + iNextWordLen + 1]; + } + + //if (ISDELIMITER(w2) /*&& iNextWordLen > 0*/) // delimiters go with the word + // iNextWordLen++; + + if (iNextWordLen > 0) + { + if (iLineLength + iNextWordLen + 1 > nColumn) { + if (cchConvW <= iCurPos) { ++iCaretShift; }; + pszConvW[cchConvW++] = wszEOL[0]; + if (cchEOL > 1) + pszConvW[cchConvW++] = wszEOL[1]; + iLineLength = 0; + bModified = true; + } + else { + if (iLineLength > 0) { + pszConvW[cchConvW++] = L' '; + iLineLength++; + } + } + } + } + else + { + pszConvW[cchConvW++] = w; + if (w == L'\r' || w == L'\n') { + iLineLength = 0; + } + else { + iLineLength++; + } + } + } + FreeMem(pszTextW); + + if (bModified) + { + pszText = AllocMem(cchConvW * 3, HEAP_ZERO_MEMORY); + if (pszText) + { + int cchConvM = WideCharToMultiByte(Encoding_SciCP, 0, pszConvW, cchConvW, pszText, (int)SizeOfMem(pszText), NULL, NULL); + + if (iCurPos < iAnchorPos) { + iAnchorPos = iSelStart + cchConvM; + } + else if (iCurPos > iAnchorPos) { + iCurPos = iSelStart + cchConvM; + } + else { + iCurPos += iCaretShift; + iAnchorPos = iCurPos; + } + + EditEnterTargetTransaction(); + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchConvM, (LPARAM)pszText); + EditLeaveTargetTransaction(); + + FreeMem(pszText); + + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + } + } + FreeMem(pszConvW); +} + + +//============================================================================= +// +// EditJoinLinesEx() +// +// Customized version of SCI_LINESJOIN (w/o using TARGET transaction) +// +// ~EditEnterTargetTransaction(); +// ~SciCall_TargetFromSelection(); +// ~SendMessage(g_hwndEdit, SCI_LINESJOIN, 0, 0); +// ~EditLeaveTargetTransaction(); +// +void EditJoinLinesEx(HWND hwnd, bool bPreserveParagraphs, bool bCRLF2Space) +{ + bool bModified = false; + + if (SciCall_IsSelectionEmpty()) + return; + + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN,IDS_SELRECT); + return; + } + + DocPos iCurPos = SciCall_GetCurrentPos(); + DocPos iAnchorPos = SciCall_GetAnchor(); + + DocPos iSelStart = SciCall_GetSelectionStart(); + DocPos iSelEnd = SciCall_GetSelectionEnd(); + DocPos iSelLength = (iSelEnd - iSelStart); + + char* pszText = (char*)SciCall_GetRangePointer(iSelStart, iSelLength); + + char* pszJoin = LocalAlloc(LPTR, iSelLength+1); + if (pszJoin == NULL) { + return; + } + + char szEOL[] = "\r\n"; + int cchEOL = 2; + switch (SciCall_GetEOLMode()) + { + case SC_EOL_LF: + szEOL[0] = '\n'; + szEOL[1] = '\0'; + cchEOL = 1; + break; + case SC_EOL_CR: + szEOL[1] = '\0'; + cchEOL = 1; + break; + case SC_EOL_CRLF: + default: + break; + } + + DocPos cchJoin = (DocPos)-1; + for (int i = 0; i < iSelLength; ++i) + { + if ((pszText[i] == '\r') || (pszText[i] == '\n')) + { + if ((pszText[i+1] == '\r') || (pszText[i+1] == '\n')) { ++i; } + + int j = ++i; + while (StrChrA("\r\n", pszText[j])) { ++j; } // swallow all next line-breaks + + if ((i < j) && (j < iSelLength) && pszText[j] && bPreserveParagraphs) + { + for (int k = 0; k < cchEOL; ++k) { pszJoin[++cchJoin] = szEOL[k]; } + if (bCRLF2Space) { + for (int k = 0; k < cchEOL; ++k) { pszJoin[++cchJoin] = szEOL[k]; } + } + } + else if ((j < iSelLength) && pszText[j] && bCRLF2Space) + { + pszJoin[++cchJoin] = ' '; + } + i = j; + bModified = true; + } + if (i < iSelLength) { + pszJoin[++cchJoin] = pszText[i]; // copy char + } + } + ++cchJoin; // start at -1 + + if (bModified) { + if (iAnchorPos > iCurPos) { + iCurPos = iSelStart; + iAnchorPos = iSelStart + cchJoin; + } + else { + iAnchorPos = iSelStart; + iCurPos = iSelStart + cchJoin; + } + + EditEnterTargetTransaction(); + SendMessage(hwnd, SCI_SETTARGETRANGE, iSelStart, iSelEnd); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cchJoin, (LPARAM)pszJoin); + EditLeaveTargetTransaction(); + + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); + } + LocalFree(pszJoin); +} + + +//============================================================================= +// +// EditSortLines() +// +typedef struct _SORTLINE { + WCHAR *pwszLine; + WCHAR *pwszSortEntry; +} SORTLINE; + +static FARPROC pfnStrCmpLogicalW; +typedef int (__stdcall *FNSTRCMP)(LPCWSTR,LPCWSTR); + +int CmpStd(const void *s1, const void *s2) { + int cmp = StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + return (cmp) ? cmp : StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); +} + +int CmpStdRev(const void *s1, const void *s2) { + int cmp = -1 * StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + return (cmp) ? cmp : -1 * StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); +} + +int CmpLogical(const void *s1, const void *s2) { + int cmp = (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + if (cmp == 0) + cmp = (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); + if (cmp) + return cmp; + else { + cmp = StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + return (cmp) ? cmp : StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); + } +} + +int CmpLogicalRev(const void *s1, const void *s2) { + int cmp = -1 * (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + if (cmp == 0) + cmp = -1 * (int)pfnStrCmpLogicalW(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); + if (cmp) + return cmp; + else { + cmp = -1 * StrCmp(((SORTLINE*)s1)->pwszSortEntry,((SORTLINE*)s2)->pwszSortEntry); + return (cmp) ? cmp : -1 * StrCmp(((SORTLINE*)s1)->pwszLine,((SORTLINE*)s2)->pwszLine); + } +} + + +void EditSortLines(HWND hwnd, int iSortFlags) +{ + bool bIsRectangular = false; + + DocPos iCurPos = 0; + DocPos iAnchorPos = 0; + DocPos iCurPosVS = 0; + DocPos iAnchorPosVS = 0; + DocPos iSelStart = 0; + DocPos iSelEnd = 0; + DocLn iLineStart = 0; + DocLn iLineEnd = 0; + DocPos iSortColumn = 0; + + DocLn iLine = 0; + DocPos cchTotal = 0; + DocPos ichlMax = 3; + + SORTLINE *pLines = NULL; + char *pmszResult = NULL; + char *pmszBuf = NULL; + + int cEOLMode = 0; + char mszEOL[] = "\r\n"; + + int iTabWidth = 0; + + bool bLastDup = false; + FNSTRCMP pfnStrCmp; + + if ((bool)SendMessage(hwnd, SCI_GETSELECTIONEMPTY, 0, 0)) + return; // no selection + + pfnStrCmpLogicalW = GetProcAddress(GetModuleHandle(L"shlwapi"), "StrCmpLogicalW"); + pfnStrCmp = (iSortFlags & SORT_NOCASE) ? StrCmpIW : StrCmpW; + + if (SciCall_IsSelectionRectangle()) { + + bIsRectangular = true; + + iCurPos = SciCall_GetRectangularSelectionCaret(); + iAnchorPos = SciCall_GetRectangularSelectionAnchor(); + iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); + iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + + DocLn iRcCurLine = SciCall_LineFromPosition(iCurPos); + DocLn iRcAnchorLine = SciCall_LineFromPosition(iAnchorPos); + + DocPos iRcCurCol = SciCall_GetColumn(iCurPos); + DocPos iRcAnchorCol = SciCall_GetColumn(iAnchorPos); + + iLineStart = min(iRcCurLine, iRcAnchorLine); + iLineEnd = max(iRcCurLine, iRcAnchorLine); + + iSortColumn = min(iRcCurCol, iRcAnchorCol); + } + else { // stream selection + + iCurPos = SciCall_GetCurrentPos(); + iAnchorPos = SciCall_GetAnchor(); + + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + + iLine = SciCall_LineFromPosition(iSelStart); + iSelStart = SciCall_PositionFromLine(iLine); + iLineStart = SciCall_LineFromPosition(iSelStart); + iLineEnd = SciCall_LineFromPosition(iSelEnd); + + if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { --iLineEnd; } + + iSortColumn = (UINT)SciCall_GetColumn(iCurPos); + } + + DocLn iLineCount = iLineEnd - iLineStart + 1; + if (iLineCount < 2) + return; + + cEOLMode = SciCall_GetEOLMode(); + if (cEOLMode == SC_EOL_CR) { + mszEOL[1] = 0; + } + else if (cEOLMode == SC_EOL_LF) { + mszEOL[0] = '\n'; + mszEOL[1] = 0; + } + + iTabWidth = (int)SendMessage(hwnd, SCI_GETTABWIDTH, 0, 0); + + if (bIsRectangular) + { + EditPadWithSpaces(hwnd, !(iSortFlags & SORT_SHUFFLE), true); + + iCurPos = SciCall_GetRectangularSelectionCaret(); + iAnchorPos = SciCall_GetRectangularSelectionAnchor(); + iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); + iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + } + + pLines = LocalAlloc(LPTR, sizeof(SORTLINE) * iLineCount); + DocLn i = 0; + for (iLine = iLineStart; iLine <= iLineEnd; iLine++) { + + const DocPos cchm = SciCall_GetLine(iLine, NULL); + + char* pmsz = LocalAlloc(LPTR, cchm + 1); + SciCall_GetLine(iLine, pmsz); + + StrTrimA(pmsz, "\r\n"); + cchTotal += cchm; + ichlMax = max(ichlMax, cchm); + + int cchw = MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, NULL, 0) - 1; + if (cchw > 0) { + int col = 0, tabs = iTabWidth; + pLines[i].pwszLine = LocalAlloc(LPTR, sizeof(WCHAR) * (cchw + 1)); + MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, pLines[i].pwszLine, (int)LocalSize(pLines[i].pwszLine) / sizeof(WCHAR)); + pLines[i].pwszSortEntry = pLines[i].pwszLine; + if (iSortFlags & SORT_COLUMN) { + while (*(pLines[i].pwszSortEntry)) { + if (*(pLines[i].pwszSortEntry) == L'\t') { + if (col + tabs <= iSortColumn) { + col += tabs; + tabs = iTabWidth; + pLines[i].pwszSortEntry = CharNext(pLines[i].pwszSortEntry); + } + else + break; + } + else if (col < iSortColumn) { + col++; + if (--tabs == 0) + tabs = iTabWidth; + pLines[i].pwszSortEntry = CharNext(pLines[i].pwszSortEntry); + } + else + break; + } + } + } + else { + pLines[i].pwszLine = StrDup(L""); + pLines[i].pwszSortEntry = pLines[i].pwszLine; + } + LocalFree(pmsz); + i++; + } + + if (iSortFlags & SORT_DESCENDING) { + if (iSortFlags & SORT_LOGICAL && pfnStrCmpLogicalW) + qsort(pLines, iLineCount, sizeof(SORTLINE), CmpLogicalRev); + else + qsort(pLines, iLineCount, sizeof(SORTLINE), CmpStdRev); + } + else if (iSortFlags & SORT_SHUFFLE) { + srand((UINT)GetTickCount()); + for (i = iLineCount - 1; i > 0; i--) { + int j = rand() % i; + SORTLINE sLine; + sLine.pwszLine = pLines[i].pwszLine; + sLine.pwszSortEntry = pLines[i].pwszSortEntry; + pLines[i] = pLines[j]; + pLines[j].pwszLine = sLine.pwszLine; + pLines[j].pwszSortEntry = sLine.pwszSortEntry; + } + } + else { + if (iSortFlags & SORT_LOGICAL && pfnStrCmpLogicalW) + qsort(pLines, iLineCount, sizeof(SORTLINE), CmpLogical); + else + qsort(pLines, iLineCount, sizeof(SORTLINE), CmpStd); + } + + DocLn lenRes = cchTotal + 2 * iLineCount + 1; + pmszResult = LocalAlloc(LPTR, lenRes); + pmszBuf = LocalAlloc(LPTR, ichlMax + 1); + + for (i = 0; i < iLineCount; i++) { + bool bDropLine = false; + if (pLines[i].pwszLine && ((iSortFlags & SORT_SHUFFLE) || lstrlen(pLines[i].pwszLine))) { + if (!(iSortFlags & SORT_SHUFFLE)) { + if (iSortFlags & SORT_MERGEDUP || iSortFlags & SORT_UNIQDUP || iSortFlags & SORT_UNIQUNIQ) { + if (i < iLineCount - 1) { + if (pfnStrCmp(pLines[i].pwszLine, pLines[i + 1].pwszLine) == 0) { + bLastDup = true; + bDropLine = (iSortFlags & SORT_MERGEDUP || iSortFlags & SORT_UNIQDUP); + } + else { + bDropLine = (!bLastDup && (iSortFlags & SORT_UNIQUNIQ)) || (bLastDup && (iSortFlags & SORT_UNIQDUP)); + bLastDup = false; + } + } + else { + bDropLine = (!bLastDup && (iSortFlags & SORT_UNIQUNIQ)) || (bLastDup && (iSortFlags & SORT_UNIQDUP)); + bLastDup = false; + } + } + } + if (!bDropLine) { + WideCharToMultiByte(Encoding_SciCP, 0, pLines[i].pwszLine, -1, pmszBuf, (int)LocalSize(pmszBuf), NULL, NULL); + StringCchCatA(pmszResult, lenRes, pmszBuf); + StringCchCatA(pmszResult, lenRes, mszEOL); + } + } + } + + LocalFree(pmszBuf); + + for (i = 0; i < iLineCount; i++) { + if (pLines[i].pwszLine) + LocalFree(pLines[i].pwszLine); + } + LocalFree(pLines); + + DocPos iResultLength = StringCchLenA(pmszResult, lenRes); + if (!bIsRectangular) { + if (iAnchorPos > iCurPos) { + iCurPos = iSelStart; + iAnchorPos = iSelStart + iResultLength; + } + else { + iAnchorPos = iSelStart; + iCurPos = iSelStart + iResultLength; + } + } + EditEnterTargetTransaction(); + + SendMessage(hwnd, SCI_SETTARGETRANGE, SciCall_PositionFromLine(iLineStart), SciCall_PositionFromLine(iLineEnd + 1)); + SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)pmszResult); + + EditLeaveTargetTransaction(); + + LocalFree(pmszResult); + + if (bIsRectangular) + EditSelectEx(hwnd, iAnchorPos, iCurPos, iAnchorPosVS, iCurPosVS); + else + EditSelectEx(hwnd, iAnchorPos, iCurPos, -1, -1); +} + + +//============================================================================= +// +// EditSelectEx() +// +void EditSelectEx(HWND hwnd, DocPos iAnchorPos, DocPos iCurrentPos, int vSpcAnchor, int vSpcCurrent) +{ + UNUSED(hwnd); + + if ((iAnchorPos < 0) && (iCurrentPos < 0)) { + SciCall_SelectAll(); + } + else if (iAnchorPos < 0) { + iAnchorPos = 0; + } + if (iCurrentPos < 0) { + iCurrentPos = SciCall_GetTextLength(); + } + + const DocLn iNewLine = SciCall_LineFromPosition(iCurrentPos); + const DocLn iAnchorLine = SciCall_LineFromPosition(iAnchorPos); + + // Ensure that the first and last lines of a selection are always unfolded + // This needs to be done *before* the SCI_SETSEL message + SciCall_EnsureVisible(iAnchorLine); + if (iAnchorLine != iNewLine) { SciCall_EnsureVisible(iNewLine); } + + if ((vSpcAnchor >= 0) && (vSpcCurrent >= 0)) { + SciCall_SetRectangularSelectionAnchor(iAnchorPos); + if (vSpcAnchor > 0) + SciCall_SetRectangularSelectionAnchorVirtualSpace(vSpcAnchor); + SciCall_SetRectangularSelectionCaret(iCurrentPos); + if (vSpcCurrent > 0) + SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCurrent); + + SciCall_ScrollRange(iAnchorPos, iCurrentPos); + } + else + SciCall_SetSel(iAnchorPos, iCurrentPos); // scrolls into view + + // remember x-pos for moving caret vertically + SciCall_ChooseCaretX(); + + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); +} + + +//============================================================================= +// +// EditEnsureSelectionVisible() +// +void EditEnsureSelectionVisible(HWND hwnd) +{ + UNUSED(hwnd); + DocPos iAnchorPos = 0; + DocPos iCurrentPos = 0; + DocPos iAnchorPosVS = -1; + DocPos iCurPosVS = -1; + + if (SciCall_IsSelectionRectangle()) + { + iAnchorPos = SciCall_GetRectangularSelectionAnchor(); + iCurrentPos = SciCall_GetRectangularSelectionCaret(); + iAnchorPosVS = SciCall_GetRectangularSelectionAnchorVirtualSpace(); + iCurPosVS = SciCall_GetRectangularSelectionCaretVirtualSpace(); + } + else { + iAnchorPos = SciCall_GetAnchor(); + iCurrentPos = SciCall_GetCurrentPos(); + } + EditSelectEx(hwnd, iAnchorPos, iCurrentPos, iAnchorPosVS, iCurPosVS); +} + + +//============================================================================= +// +// EditScrollTo() +// +void EditScrollTo(HWND hwnd, DocLn iScrollToLine, int iSlop) +{ + UNUSED(hwnd); + + const int iXoff = SciCall_GetXoffset(); + const int iLinesOnScreen = SciCall_LinesOnScreen(); + const DocLn iSlopLines = ((iSlop < 0) || (iSlop >= iLinesOnScreen)) ? (iLinesOnScreen/2) : iSlop; + + SciCall_SetVisiblePolicy((VISIBLE_SLOP | VISIBLE_STRICT), iSlopLines); + SciCall_EnsureVisibleEnforcePolicy(iScrollToLine); + SciCall_SetXoffset(iXoff); +} + + +//============================================================================= +// +// EditJumpTo() +// +void EditJumpTo(HWND hwnd, DocLn iNewLine, DocPos iNewCol) +{ + // jump to end with line set to -1 + if (iNewLine < 0) { + SendMessage(hwnd, SCI_DOCUMENTEND, 0, 0); + return; + } + const DocLn iMaxLine = SciCall_GetLineCount(); + // Line maximum is iMaxLine - 1 (doc line count starts with 0) + iNewLine = (min(iNewLine, iMaxLine) - 1); + const DocPos iLineEndPos = SciCall_GetLineEndPosition(iNewLine); + // Column minimum is 1 + iNewCol = max(0, min((iNewCol - 1), iLineEndPos)); + const DocPos iNewPos = SciCall_FindColumn(iNewLine, iNewCol); + + SciCall_GotoPos(iNewPos); + EditScrollTo(hwnd, iNewLine, -1); + + // remember x-pos for moving caret vertically + SciCall_ChooseCaretX(); +} + + +//============================================================================= +// +// EditFixPositions() +// +void EditFixPositions(HWND hwnd) +{ + UNUSED(hwnd); + + DocPos iCurrentPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + const DocPos iMaxPos = SciCall_GetTextLength(); + + if ((iCurrentPos > 0) && (iCurrentPos < iMaxPos)) + { + const DocPos iNewPos = SciCall_PositionAfter( SciCall_PositionBefore(iCurrentPos) ); + + if (iNewPos != iCurrentPos) { + SciCall_SetCurrentPos(iNewPos); + iCurrentPos = iNewPos; + } + } + + if ((iAnchorPos != iCurrentPos) && (iAnchorPos > 0) && (iAnchorPos < iMaxPos)) + { + const DocPos iNewPos = SciCall_PositionAfter(SciCall_PositionBefore(iAnchorPos)); + if (iNewPos != iAnchorPos) { + SciCall_SetAnchor(iNewPos); + } + } +} + + +//============================================================================= +// +// EditGetExcerpt() +// +void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt) +{ + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_GetAnchor(); + + if (iCurPos == iAnchorPos || SciCall_IsSelectionRectangle()) { + StringCchCopy(lpszExcerpt,cchExcerpt,L""); + return; + } + + WCHAR tch[256] = { L'\0' }; + struct Sci_TextRange tr = { { 0, 0 }, NULL }; + /*if (iCurPos != iAnchorPos && !SciCall_IsSelectionRectangle()) {*/ + tr.chrg.cpMin = (DocPosCR)SciCall_GetSelectionStart(); + tr.chrg.cpMax = min((tr.chrg.cpMin + (DocPosCR)COUNTOF(tch)), (DocPosCR)SciCall_GetSelectionEnd()); + /*} + else { + int iLine = SendMessage(hwnd,SCI_LINEFROMPOSITION,(WPARAM)iCurPos,0); + tr.chrg.cpMin = SendMessage(hwnd,SCI_POSITIONFROMLINE,(WPARAM)iLine,0); + tr.chrg.cpMax = min(SendMessage(hwnd,SCI_GETLINEENDPOSITION,(WPARAM)iLine,0),(LONG)(tr.chrg.cpMin + COUNTOF(tchBuf2))); + }*/ + tr.chrg.cpMax = min(tr.chrg.cpMax, (DocPosCR)SciCall_GetTextLength()); + + char* pszText = LocalAlloc(LPTR,(tr.chrg.cpMax - tr.chrg.cpMin)+2); + LPWSTR pszTextW = LocalAlloc(LPTR,((tr.chrg.cpMax - tr.chrg.cpMin)*2)+2); + + DWORD cch = 0; + if (pszText && pszTextW) + { + tr.lpstrText = pszText; + SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); + MultiByteToWideChar(Encoding_SciCP,0,pszText,tr.chrg.cpMax - tr.chrg.cpMin,pszTextW,(int)SizeOfMem(pszTextW)/sizeof(WCHAR)); + + for (WCHAR* p = pszTextW; *p && cch < COUNTOF(tch)-1; p++) { + if (*p == L'\r' || *p == L'\n' || *p == L'\t' || *p == L' ') { + tch[cch++] = L' '; + while (*(p+1) == L'\r' || *(p+1) == L'\n' || *(p+1) == L'\t' || *(p+1) == L' ') + p++; + } + else + tch[cch++] = *p; + } + tch[cch++] = L'\0'; + StrTrim(tch,L" "); + } + + if (cch == 1) + StringCchCopy(tch,COUNTOF(tch),L" ... "); + + if (cch > cchExcerpt) { + tch[cchExcerpt-2] = L'.'; + tch[cchExcerpt-3] = L'.'; + tch[cchExcerpt-4] = L'.'; + } + StringCchCopyN(lpszExcerpt,cchExcerpt,tch,cchExcerpt); + + if (pszText) + LocalFree(pszText); + if (pszTextW) + LocalFree(pszTextW); +} + + + +//============================================================================= +// +// _EditSetSearchFlags() +// +static void __fastcall _SetSearchFlags(HWND hwnd, LPEDITFINDREPLACE lpefr) +{ + char szBuf[FNDRPL_BUFFER]; + + bool bIsFindDlg = (GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE) == NULL); + + + GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, szBuf, COUNTOF(szBuf)); + if (StringCchCompareXA(szBuf, lpefr->szFind) != 0) { + StringCchCopyNA(lpefr->szFind, COUNTOF(lpefr->szFind), szBuf, COUNTOF(szBuf)); + lpefr->bStateChanged = true; + } + + GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, szBuf, COUNTOF(szBuf)); + if (StringCchCompareXA(szBuf, lpefr->szReplace) != 0) { + StringCchCopyNA(lpefr->szReplace, COUNTOF(lpefr->szReplace), szBuf, COUNTOF(szBuf)); + lpefr->bStateChanged = true; + } + + bool bIsFlagSet = ((lpefr->fuFlags & SCFIND_MATCHCASE) != 0); + if (IsDlgButtonChecked(hwnd, IDC_FINDCASE) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_MATCHCASE; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_MATCHCASE); + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = ((lpefr->fuFlags & SCFIND_WHOLEWORD) != 0); + if (IsDlgButtonChecked(hwnd, IDC_FINDWORD) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_WHOLEWORD; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_WHOLEWORD); + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = ((lpefr->fuFlags & SCFIND_WORDSTART) != 0); + if (IsDlgButtonChecked(hwnd, IDC_FINDSTART) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_WORDSTART; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_WORDSTART); + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = ((lpefr->fuFlags & SCFIND_NP3_REGEX) != 0); + if (IsDlgButtonChecked(hwnd, IDC_FINDREGEXP) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_NP3_REGEX; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_NP3_REGEX); + lpefr->bStateChanged = true; + } + } + if (bIsFlagSet) // check "dot match all" too + { + bIsFlagSet = ((lpefr->fuFlags & SCFIND_DOT_MATCH_ALL) != 0); + if (IsDlgButtonChecked(hwnd, IDC_DOT_MATCH_ALL) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_DOT_MATCH_ALL; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); + lpefr->bStateChanged = true; + } + } + } + + bIsFlagSet = lpefr->bWildcardSearch; + if (IsDlgButtonChecked(hwnd, IDC_WILDCARDSEARCH) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bWildcardSearch = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bWildcardSearch = false; + lpefr->bStateChanged = true; + } + } + if (bIsFlagSet) // special setting for wildcardsearch + { + bIsFlagSet = ((lpefr->fuFlags & SCFIND_NP3_REGEX) != 0); + if (!bIsFlagSet) { + lpefr->fuFlags |= SCFIND_NP3_REGEX; + lpefr->bStateChanged = true; + } + + bIsFlagSet = ((lpefr->fuFlags & SCFIND_DOT_MATCH_ALL) != 0); + if (bIsFlagSet) { + lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL); + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = lpefr->bTransformBS; + if (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bTransformBS = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bTransformBS = false; + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = lpefr->bNoFindWrap; + if (IsDlgButtonChecked(hwnd, IDC_NOWRAP) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bNoFindWrap = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bNoFindWrap = false; + lpefr->bStateChanged = true; + } + } + + bIsFlagSet = lpefr->bMarkOccurences; + if (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bMarkOccurences = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bMarkOccurences = false; + lpefr->bStateChanged = true; + } + } + + if (bIsFindDlg) + { + bIsFlagSet = lpefr->bFindClose; + if (IsDlgButtonChecked(hwnd, IDC_FINDCLOSE) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bFindClose = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bFindClose = false; + lpefr->bStateChanged = true; + } + } + } + else // replace close + { + bIsFlagSet = lpefr->bReplaceClose; + if (IsDlgButtonChecked(hwnd, IDC_FINDCLOSE) == BST_CHECKED) { + if (!bIsFlagSet) { + lpefr->bReplaceClose = true; + lpefr->bStateChanged = true; + } + } + else { + if (bIsFlagSet) { + lpefr->bReplaceClose = false; + lpefr->bStateChanged = true; + } + } + + } +} + + +// Wildcard search uses the regexp engine to perform a simple search with * ? as wildcards +// instead of more advanced and user-unfriendly regexp syntax +// for speed, we only need POSIX syntax here +static void __fastcall _EscapeWildcards(char* szFind2, LPCEDITFINDREPLACE lpefr) +{ + char szWildcardEscaped[FNDRPL_BUFFER] = { '\0' }; + int iSource = 0; + int iDest = 0; + + lpefr->fuFlags |= SCFIND_NP3_REGEX; + + while (szFind2[iSource] != '\0') + { + char c = szFind2[iSource]; + if (c == '*') + { + szWildcardEscaped[iDest++] = '.'; + } + else if (c == '?') + { + c = '.'; + } + else + { + if (c == '^' || + c == '$' || + c == '(' || + c == ')' || + c == '[' || + c == ']' || + c == '{' || + c == '}' || + c == '.' || + c == '+' || + c == '|' || + c == '\\') + { + szWildcardEscaped[iDest++] = '\\'; + } + } + szWildcardEscaped[iDest++] = c; + iSource++; + } + + szWildcardEscaped[iDest] = '\0'; + + StringCchCopyNA(szFind2, FNDRPL_BUFFER, szWildcardEscaped, COUNTOF(szWildcardEscaped)); +} + + +//============================================================================= +// +// _EditGetFindStrg() +// +static int __fastcall _EditGetFindStrg(HWND hwnd, LPCEDITFINDREPLACE lpefr, LPSTR szFind, int cchCnt) +{ + UNUSED(hwnd); + if (StringCchLenA(lpefr->szFind, COUNTOF(lpefr->szFind))) { + StringCchCopyA(szFind, cchCnt, lpefr->szFind); + } + else { + GetFindPatternMB(szFind, cchCnt); + StringCchCopyA(lpefr->szFind, COUNTOF(lpefr->szFind), szFind); + } + if (!StringCchLenA(szFind, cchCnt)) { return 0; } + + bool bIsRegEx = (lpefr->fuFlags & SCFIND_REGEXP); + if (lpefr->bTransformBS || bIsRegEx) { + TransformBackslashes(szFind, bIsRegEx, Encoding_SciCP, NULL); + } + if (StringCchLenA(szFind, FNDRPL_BUFFER) > 0) { + if (lpefr->bWildcardSearch) + _EscapeWildcards(szFind, lpefr); + } + + return (int)StringCchLenA(szFind, FNDRPL_BUFFER); +} + + + + +//============================================================================= +// +// _FindInTarget() +// +static DocPos __fastcall _FindInTarget(HWND hwnd, LPCSTR szFind, DocPos length, int flags, + DocPos* start, DocPos* end, bool bForceNext, FR_UPD_MODES fMode) +{ + DocPos _start = *start; + DocPos _end = *end; + const bool bFindPrev = (_start > _end); + + EditEnterTargetTransaction(); + + SendMessage(hwnd, SCI_SETSEARCHFLAGS, flags, 0); + SendMessage(hwnd, SCI_SETTARGETRANGE, _start, _end); + DocPos iPos = (DocPos)SendMessage(hwnd, SCI_SEARCHINTARGET, length, (LPARAM)szFind); + // handle next in case of zero-length-matches (regex) ! + if (iPos == _start) { + DocPos nend = (DocPos)SendMessage(hwnd, SCI_GETTARGETEND, 0, 0); + if ((_start == nend) && bForceNext) + { + const DocPos _new_start = (int)(bFindPrev ? + SendMessage(hwnd, SCI_POSITIONBEFORE, _start, 0) : + SendMessage(hwnd, SCI_POSITIONAFTER, _start, 0)); + const bool bProceed = (bFindPrev ? (_new_start >= _end) : (_new_start <= _end)); + if ((_new_start != _start) && bProceed){ + SendMessage(hwnd, SCI_SETTARGETRANGE, _new_start, _end); + iPos = (DocPos)SendMessage(hwnd, SCI_SEARCHINTARGET, length, (LPARAM)szFind); + } + else { + iPos = (DocPos)-1; // already at document begin or end => not found + } + } + } + if (iPos >= 0) { + if (fMode != FRMOD_IGNORE) { + g_FindReplaceMatchFoundState = bFindPrev ? + ((fMode == FRMOD_WRAPED) ? PRV_WRP_FND : PRV_FND) : + ((fMode == FRMOD_WRAPED) ? NXT_WRP_FND : NXT_FND); + } + // found in range, set begin and end of finding + *start = (DocPos)SendMessage(hwnd, SCI_GETTARGETSTART, 0, 0); + *end = (DocPos)SendMessage(hwnd, SCI_GETTARGETEND, 0, 0); + } + else { + if (fMode != FRMOD_IGNORE) { + g_FindReplaceMatchFoundState = (fMode != FRMOD_WRAPED) ? (bFindPrev ? PRV_NOT_FND : NXT_NOT_FND) : FND_NOP; + } + } + EditLeaveTargetTransaction(); + + return iPos; +} + + +//============================================================================= +// +// _FindHasMatch() +// +typedef enum { MATCH = 0, NO_MATCH = 1, INVALID = 2 } RegExResult_t; + +static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bMarkAll, bool bFirstMatchOnly) +{ + char szFind[FNDRPL_BUFFER]; + DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); + + const DocPos iStart = bFirstMatchOnly ? SciCall_GetSelectionStart() : 0; + const DocPos iTextLength = SciCall_GetTextLength(); + + DocPos start = iStart; + DocPos end = iTextLength; + const DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_IGNORE); + + if (bFirstMatchOnly && !bReplaceInitialized) { + if (GetForegroundWindow() == g_hwndDlgFindReplace) { + if (iPos >= 0) { + SciCall_ScrollRange(iPos, iPos); + } + else { + SciCall_ScrollCaret(); + } + } + } + else // mark all matches + { + if (bMarkAll && (iPos >= 0)) { + EditClearAllOccurrenceMarkers(hwnd, (DocPos)0, iTextLength); + EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), (DocPos)0, iTextLength, false, false); + } + } + return ((iPos >= 0) ? MATCH : ((iPos == (DocPos)-1) ? NO_MATCH : INVALID)); +} + + + +//============================================================================= +// +// _DelayMarkAll() +// +// +static void __fastcall _DelayMarkAll(HWND hwnd, int delay) +{ + static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), (LPARAM)0 , 0 }; + mqc.hwnd = hwnd; + _MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay)); +} + + +//============================================================================= +// +// EditFindReplaceDlgProcW() +// +static char g_lastFind[FNDRPL_BUFFER] = { L'\0' }; + +INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static LPEDITFINDREPLACE sg_pefrData = NULL; + + static RegExResult_t regexMatch = INVALID; + + static COLORREF rgbRed = RGB(255, 170, 170); + static COLORREF rgbGreen = RGB(170, 255, 170); + static COLORREF rgbBlue = RGB(170, 200, 255); + static HBRUSH hBrushRed; + static HBRUSH hBrushGreen; + static HBRUSH hBrushBlue; + + static int iSaveMarkOcc = -1; + static bool bSaveOccVisible = false; + + static bool bSaveTFBackSlashes = false; + + WCHAR tchBuf[FNDRPL_BUFFER] = { L'\0' }; + + switch (umsg) + { + case WM_INITDIALOG: + { + // the global static Find/Replace data structure + SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); + //sg_pefrData = (LPEDITFINDREPLACE)lParam; + sg_pefrData = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); + + iReplacedOccurrences = 0; + g_FindReplaceMatchFoundState = FND_NOP; + + iSaveMarkOcc = bSwitchedFindReplace ? iSaveMarkOcc : g_iMarkOccurrences; + bSaveOccVisible = bSwitchedFindReplace ? bSaveOccVisible : g_bMarkOccurrencesMatchVisible; + + //const WORD wTabSpacing = (WORD)SendMessage(sg_pefrData->hwnd, SCI_GETTABWIDTH, 0, 0);; // dialog box units + //SendDlgItemMessage(hwnd, IDC_FINDTEXT, EM_SETTABSTOPS, 1, (LPARAM)&wTabSpacing); + + // Load MRUs + for (int i = 0; i < MRU_Enum(g_pMRUfind, 0, NULL, 0); i++) { + MRU_Enum(g_pMRUfind, i, tchBuf, COUNTOF(tchBuf)); + SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf); + } + for (int i = 0; i < MRU_Enum(g_pMRUreplace, 0, NULL, 0); i++) { + MRU_Enum(g_pMRUreplace, i, tchBuf, COUNTOF(tchBuf)); + SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf); + } + + SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0); + SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_SETEXTENDEDUI, true, 0); + //const HWND hwndItem = (HWND)SendDlgItemMessage(hwnd, IDC_FINDTEXT, CBEM_GETEDITCONTROL, 0, 0); + COMBOBOXINFO infoF = { sizeof(COMBOBOXINFO) }; + GetComboBoxInfo(GetDlgItem(hwnd, IDC_FINDTEXT), &infoF); + //SHAutoComplete(infoF.hwndItem, SHACF_DEFAULT); + SHAutoComplete(infoF.hwndItem, SHACF_FILESYS_ONLY | SHACF_AUTOAPPEND_FORCE_OFF | SHACF_AUTOSUGGEST_FORCE_OFF); + + if (!GetWindowTextLengthW(GetDlgItem(hwnd, IDC_FINDTEXT))) + SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, sg_pefrData->szFind); + + if (GetDlgItem(hwnd, IDC_REPLACETEXT)) + { + SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_LIMITTEXT, FNDRPL_BUFFER, 0); + SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_SETEXTENDEDUI, true, 0); + //const HWND hwndItem = (HWND)SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CBEM_GETEDITCONTROL, 0, 0); + COMBOBOXINFO infoR = { sizeof(COMBOBOXINFO) }; + GetComboBoxInfo(GetDlgItem(hwnd, IDC_REPLACETEXT), &infoR); + //SHAutoComplete(infoR.hwndItem, SHACF_DEFAULT); + SHAutoComplete(infoR.hwndItem, SHACF_FILESYS_ONLY | SHACF_AUTOAPPEND_FORCE_OFF | SHACF_AUTOSUGGEST_FORCE_OFF); + + + SetDlgItemTextMB2W(hwnd, IDC_REPLACETEXT, sg_pefrData->szReplace); + } + + if (sg_pefrData->fuFlags & SCFIND_MATCHCASE) + CheckDlgButton(hwnd, IDC_FINDCASE, BST_CHECKED); + + if (sg_pefrData->fuFlags & SCFIND_WHOLEWORD) + CheckDlgButton(hwnd, IDC_FINDWORD, BST_CHECKED); + + if (sg_pefrData->fuFlags & SCFIND_WORDSTART) + CheckDlgButton(hwnd, IDC_FINDSTART, BST_CHECKED); + + if (sg_pefrData->bTransformBS) { + bSaveTFBackSlashes = sg_pefrData->bTransformBS; + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); + } + else + bSaveTFBackSlashes = false; + + if (sg_pefrData->fuFlags & SCFIND_REGEXP) { + CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_CHECKED); + CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); + } + + if (sg_pefrData->bDotMatchAll) { + CheckDlgButton(hwnd, IDC_DOT_MATCH_ALL, BST_CHECKED); + } + + if (sg_pefrData->bWildcardSearch) { + CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_CHECKED); + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + } + + if (sg_pefrData->bMarkOccurences) { + g_iMarkOccurrences = 0; + g_bMarkOccurrencesMatchVisible = false; + CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, false); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_TOGGLE_VIEW, false); + DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, true); + } + else { + CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_UNCHECKED); + DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + } + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible); + + + if (sg_pefrData->fuFlags & SCFIND_REGEXP) { + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); + DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + } + else { + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + } + + if (sg_pefrData->bNoFindWrap) { + CheckDlgButton(hwnd, IDC_NOWRAP, BST_CHECKED); + } + + if (GetDlgItem(hwnd, IDC_REPLACE)) { + if (bSwitchedFindReplace) { + if (sg_pefrData->bFindClose) + CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); + } + else { + if (sg_pefrData->bReplaceClose) + CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); + } + } + else { + if (bSwitchedFindReplace) { + if (sg_pefrData->bReplaceClose) + CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); + } + else { + if (sg_pefrData->bFindClose) + CheckDlgButton(hwnd, IDC_FINDCLOSE, BST_CHECKED); + } + } + + if (!bSwitchedFindReplace) { + if (xFindReplaceDlg == 0 || yFindReplaceDlg == 0) + CenterDlgInParent(hwnd); + else + SetDlgPos(hwnd, xFindReplaceDlg, yFindReplaceDlg); + } + else { + SetDlgPos(hwnd, xFindReplaceDlgSave, yFindReplaceDlgSave); + bSwitchedFindReplace = false; + CopyMemory(sg_pefrData, &efrSave, sizeof(EDITFINDREPLACE)); + } + + HMENU hmenu = GetSystemMenu(hwnd, false); + GetString(IDS_SAVEPOS, tchBuf, COUNTOF(tchBuf)); + InsertMenu(hmenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_SAVEPOS, tchBuf); + GetString(IDS_RESETPOS, tchBuf, COUNTOF(tchBuf)); + InsertMenu(hmenu, 1, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_RESETPOS, tchBuf); + InsertMenu(hmenu, 2, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + + hBrushRed = CreateSolidBrush(rgbRed); + hBrushGreen = CreateSolidBrush(rgbGreen); + hBrushBlue = CreateSolidBrush(rgbBlue); + + EditEnsureSelectionVisible(hwnd); + + SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext); + + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd, 5); + } + return true; + + + case WM_DESTROY: + { + if (!bSwitchedFindReplace) + { + sg_pefrData->szFind[0] = '\0'; + + g_iMarkOccurrences = iSaveMarkOcc; + g_bMarkOccurrencesMatchVisible = bSaveOccVisible; + + if (g_iMarkOccurrences > 0) { + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_TOGGLE_VIEW, !g_bMarkOccurrencesMatchVisible); + } + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible); + + iReplacedOccurrences = 0; + g_FindReplaceMatchFoundState = FND_NOP; + + if ((g_iMarkOccurrences <= 0) || g_bMarkOccurrencesMatchVisible) { + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + } + } + + EditEnsureSelectionVisible(g_hwndEdit); + + CmdMessageQueue_t* pmqc = NULL; + CmdMessageQueue_t* dummy; + DL_FOREACH_SAFE(MessageQueue, pmqc, dummy) + { + DL_DELETE(MessageQueue, pmqc); + FreeMem(pmqc); + } + } + + KillTimer(hwnd, IDT_TIMER_MRKALL); + DeleteObject(hBrushRed); + DeleteObject(hBrushGreen); + DeleteObject(hBrushBlue); + } + return false; + + case WM_ACTIVATE: + { + DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !SciCall_IsSelectionEmpty()); + + if (sg_pefrData->bMarkOccurences) { + _DelayMarkAll(hwnd,5); + } + + //if (LOWORD(wParam) == WA_INACTIVE) { + // bFindReplCopySelOrClip = true; + //} + } + return false; + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + + case IDC_DOC_MODIFIED: + sg_pefrData->bStateChanged = true; + break; + + case IDC_FINDTEXT: + case IDC_REPLACETEXT: + { + if (bFindReplCopySelOrClip) + { + char *lpszSelection = NULL; + char szFind[FNDRPL_BUFFER] = { '\0' }; + tchBuf[0] = L'\0'; + + DocPos cchSelection = (DocPos)SendMessage(sg_pefrData->hwnd, SCI_GETSELTEXT, 0, (LPARAM)NULL); + if (1 < cchSelection) { + lpszSelection = AllocMem(cchSelection, HEAP_ZERO_MEMORY); + SendMessage(sg_pefrData->hwnd, SCI_GETSELTEXT, 0, (LPARAM)lpszSelection); + } + else if (cchSelection <= 1) { + // nothing is selected in the editor: + // if first time you bring up find/replace dialog, + // copy content clipboard to find box + char* pClip = EditGetClipboardText(hwnd, false, NULL, NULL); + if (pClip) { + int len = lstrlenA(pClip); + if (len > 0) { + lpszSelection = AllocMem(len + 1, HEAP_ZERO_MEMORY); + StringCchCopyNA(lpszSelection, len + 1, pClip, len); + } + LocalFree(pClip); + } + } + + if (lpszSelection) { + // Check lpszSelection and truncate bad chars (CR,LF,VT) + char* lpsz = StrChrA(lpszSelection, 13); + if (lpsz) *lpsz = '\0'; + + lpsz = StrChrA(lpszSelection, 10); + if (lpsz) *lpsz = '\0'; + + lpsz = StrChrA(lpszSelection, 11); + if (lpsz) *lpsz = '\0'; + + StringCchCopyNA(szFind, FNDRPL_BUFFER, lpszSelection, SizeOfMem(lpszSelection)); + + SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, szFind); + FreeMem(lpszSelection); + } + else { + if (tchBuf[0] == L'\0') { + GetFindPattern(tchBuf, FNDRPL_BUFFER); + } + if (tchBuf[0] == L'\0') { + MRU_Enum(g_pMRUfind, 0, tchBuf, COUNTOF(tchBuf)); + } + SetDlgItemText(hwnd, IDC_FINDTEXT, tchBuf); + + GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, szFind, FNDRPL_BUFFER); + } + bFindReplCopySelOrClip = false; + } + + bool bEnableF = (GetWindowTextLengthW(GetDlgItem(hwnd, IDC_FINDTEXT)) || + CB_ERR != SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_GETCURSEL, 0, 0)); + + bool bEnableR = (GetWindowTextLengthW(GetDlgItem(hwnd, IDC_REPLACETEXT)) || + CB_ERR != SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_GETCURSEL, 0, 0)); + + bool bEnableIS = !(bool)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0); + + DialogEnableWindow(hwnd, IDOK, bEnableF); + DialogEnableWindow(hwnd, IDC_FINDPREV, bEnableF); + DialogEnableWindow(hwnd, IDC_REPLACE, bEnableF); + DialogEnableWindow(hwnd, IDC_REPLACEALL, bEnableF); + DialogEnableWindow(hwnd, IDC_REPLACEINSEL, bEnableF && bEnableIS); + DialogEnableWindow(hwnd, IDC_SWAPSTRG, bEnableF || bEnableR); + + if (HIWORD(wParam) == CBN_CLOSEUP) { + LONG lSelEnd; + SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETEDITSEL, 0, (LPARAM)&lSelEnd); + SendDlgItemMessage(hwnd, LOWORD(wParam), CB_SETEDITSEL, 0, MAKELPARAM(lSelEnd, lSelEnd)); + } + + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd, 5); + } + break; + + + case IDT_TIMER_MAIN_MRKALL: + { + if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS)) { + _SetSearchFlags(hwnd, sg_pefrData); + if (sg_pefrData->bMarkOccurences) { + if (sg_pefrData->bStateChanged || (StringCchCompareXA(g_lastFind, sg_pefrData->szFind) != 0)) { + IgnoreNotifyChangeEvent(); + if (EditToggleView(g_hwndEdit, false)) { SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); } + StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), sg_pefrData->szFind); + g_iMarkOccurrencesCount = 0; + RegExResult_t match = _FindHasMatch(g_hwndEdit, sg_pefrData, (sg_pefrData->bMarkOccurences), false); + if (regexMatch != match) { + regexMatch = match; + } + // we have to set Sci's regex instance to first find (have substitution in place) + _FindHasMatch(g_hwndEdit, sg_pefrData, false, true); + sg_pefrData->bStateChanged = false; + InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); + if (EditToggleView(g_hwndEdit, false)) { EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, true); } + ObserveNotifyChangeEvent(); + } + } + TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done + } + } + return false; + + + case IDC_ALL_OCCURRENCES: + { + _SetSearchFlags(hwnd, sg_pefrData); + + if (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED) + { + iSaveMarkOcc = g_iMarkOccurrences; + bSaveOccVisible = g_bMarkOccurrencesMatchVisible; + + g_iMarkOccurrences = 0; + g_bMarkOccurrencesMatchVisible = false; + DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, true); + } + else { // switched OFF + g_iMarkOccurrences = iSaveMarkOcc; + g_bMarkOccurrencesMatchVisible = bSaveOccVisible; + + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + sg_pefrData->bStateChanged = true; + } + DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); + } + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, (g_iMarkOccurrences > 0)); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible); + + _DelayMarkAll(hwnd,0); + } + break; + + + case IDC_TOGGLE_VISIBILITY: + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + sg_pefrData->bStateChanged = true; + _DelayMarkAll(hwnd, 0); + } + else { + EditToggleView(g_hwndEdit, true); + } + break; + + + case IDC_FINDREGEXP: + if (IsDlgButtonChecked(hwnd, IDC_FINDREGEXP) == BST_CHECKED) + { + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true); + CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); // Can not use wildcard search together with regexp + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex + DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + } + else { // unchecked + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED); + } + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_DOT_MATCH_ALL: + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_WILDCARDSEARCH: + if (IsDlgButtonChecked(hwnd, IDC_WILDCARDSEARCH) == BST_CHECKED) + { + CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); + DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false); + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex + DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false); + } + else { // unchecked + DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true); + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED); + } + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_FINDTRANSFORMBS: + if (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) { + bSaveTFBackSlashes = true; + } + else { + bSaveTFBackSlashes = false; + } + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_FINDCASE: + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_FINDWORD: + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + case IDC_FINDSTART: + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,0); + break; + + + case IDC_REPLACE: + case IDC_REPLACEALL: + case IDC_REPLACEINSEL: + iReplacedOccurrences = 0; + case IDOK: + case IDC_FINDPREV: + case IDACC_SELTONEXT: + case IDACC_SELTOPREV: + case IDMSG_SWITCHTOFIND: + case IDMSG_SWITCHTOREPLACE: + { + bool bIsFindDlg = (GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE) == NULL); + + if ((bIsFindDlg && LOWORD(wParam) == IDMSG_SWITCHTOREPLACE || + !bIsFindDlg && LOWORD(wParam) == IDMSG_SWITCHTOFIND)) { + GetDlgPos(hwnd, &xFindReplaceDlgSave, &yFindReplaceDlgSave); + bSwitchedFindReplace = true; + CopyMemory(&efrSave, sg_pefrData, sizeof(EDITFINDREPLACE)); + } + + if (!bSwitchedFindReplace && + !GetDlgItemTextW2MB(hwnd, IDC_FINDTEXT, sg_pefrData->szFind, COUNTOF(sg_pefrData->szFind))) { + DialogEnableWindow(hwnd, IDOK, false); + DialogEnableWindow(hwnd, IDC_FINDPREV, false); + DialogEnableWindow(hwnd, IDC_REPLACE, false); + DialogEnableWindow(hwnd, IDC_REPLACEALL, false); + DialogEnableWindow(hwnd, IDC_REPLACEINSEL, false); + if (!GetDlgItemTextW2MB(hwnd, IDC_REPLACETEXT, sg_pefrData->szReplace, COUNTOF(sg_pefrData->szReplace))) + DialogEnableWindow(hwnd, IDC_SWAPSTRG, false); + return true; + } + + _SetSearchFlags(hwnd, sg_pefrData); + + WCHAR tchBuf2[FNDRPL_BUFFER] = { L'\0' }; + + if (!bSwitchedFindReplace) { + // Save MRUs + if (StringCchLenA(sg_pefrData->szFind, COUNTOF(sg_pefrData->szFind))) { + if (GetDlgItemText(hwnd, IDC_FINDTEXT, tchBuf2, COUNTOF(tchBuf2))) { + MRU_Add(g_pMRUfind, tchBuf2, 0, 0, NULL); + SetFindPattern(tchBuf2); + } + } + if (StringCchLenA(sg_pefrData->szReplace, COUNTOF(sg_pefrData->szReplace))) { + if (GetDlgItemText(hwnd, IDC_REPLACETEXT, tchBuf2, COUNTOF(tchBuf2))) { + MRU_Add(g_pMRUreplace, tchBuf2, 0, 0, NULL); + } + } + } + + // Reload MRUs + SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_RESETCONTENT, 0, 0); + + for (int i = 0; i < MRU_Enum(g_pMRUfind, 0, NULL, 0); i++) { + MRU_Enum(g_pMRUfind, i, tchBuf2, COUNTOF(tchBuf2)); + SendDlgItemMessage(hwnd, IDC_FINDTEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf2); + } + for (int i = 0; i < MRU_Enum(g_pMRUreplace, 0, NULL, 0); i++) { + MRU_Enum(g_pMRUreplace, i, tchBuf2, COUNTOF(tchBuf2)); + SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_ADDSTRING, 0, (LPARAM)tchBuf2); + } + + SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, sg_pefrData->szFind); + SetDlgItemTextMB2W(hwnd, IDC_REPLACETEXT, sg_pefrData->szReplace); + + if (!bSwitchedFindReplace) + SendMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetFocus()), 1); + + bool bCloseDlg = false; + if (bIsFindDlg) { + bCloseDlg = sg_pefrData->bFindClose; + } + else if (LOWORD(wParam) != IDOK) { + bCloseDlg = sg_pefrData->bReplaceClose; + } + + if (bCloseDlg) { + //EndDialog(hwnd,LOWORD(wParam)); + DestroyWindow(hwnd); + } + + switch (LOWORD(wParam)) { + case IDOK: // find next + case IDACC_SELTONEXT: + if (!bIsFindDlg) { bReplaceInitialized = true; } + if (!SciCall_IsSelectionEmpty()) { EditJumpToSelectionEnd(hwnd); } + EditFindNext(sg_pefrData->hwnd, sg_pefrData, (LOWORD(wParam) == IDACC_SELTONEXT), HIBYTE(GetKeyState(VK_F3))); + break; + + case IDC_FINDPREV: // find previous + case IDACC_SELTOPREV: + if (!bIsFindDlg) { bReplaceInitialized = true; } + if (!SciCall_IsSelectionEmpty()) { EditJumpToSelectionStart(hwnd); } + EditFindPrev(sg_pefrData->hwnd, sg_pefrData, (LOWORD(wParam) == IDACC_SELTOPREV), HIBYTE(GetKeyState(VK_F3))); + break; + + case IDC_REPLACE: + { + bReplaceInitialized = true; + int token = BeginUndoAction(); + EditReplace(sg_pefrData->hwnd, sg_pefrData); + EndUndoAction(token); + } + break; + + case IDC_REPLACEALL: + bReplaceInitialized = true; + EditReplaceAll(sg_pefrData->hwnd, sg_pefrData, true); + break; + + case IDC_REPLACEINSEL: + if (!SciCall_IsSelectionEmpty()) { + bReplaceInitialized = true; + EditReplaceAllInSelection(sg_pefrData->hwnd, sg_pefrData, true); + } + break; + } + } + _DelayMarkAll(hwnd,5); + break; + + + case IDCANCEL: + //EndDialog(hwnd,IDCANCEL); + DestroyWindow(hwnd); + break; + + case IDC_SWAPSTRG: + { + WCHAR wszFind[FNDRPL_BUFFER] = { L'\0' }; + WCHAR wszRepl[FNDRPL_BUFFER] = { L'\0' }; + GetDlgItemTextW(hwnd, IDC_FINDTEXT, wszFind, COUNTOF(wszFind)); + GetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszRepl, COUNTOF(wszRepl)); + SetDlgItemTextW(hwnd, IDC_FINDTEXT, wszRepl); + SetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszFind); + g_FindReplaceMatchFoundState = FND_NOP; + _SetSearchFlags(hwnd, sg_pefrData); + _DelayMarkAll(hwnd,5); + } + break; + + case IDACC_FIND: + PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_FIND, 1), 0); + break; + + case IDACC_REPLACE: + PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_REPLACE, 1), 0); + break; + + case IDACC_SAVEPOS: + GetDlgPos(hwnd, &xFindReplaceDlg, &yFindReplaceDlg); + break; + + case IDACC_RESETPOS: + CenterDlgInParent(hwnd); + xFindReplaceDlg = yFindReplaceDlg = 0; + break; + + case IDACC_FINDNEXT: + //SetFocus(g_hwndMain); + //SetForegroundWindow(g_hwndMain); + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDOK, 1), 0); + break; + + case IDACC_FINDPREV: + //SetFocus(g_hwndMain); + //SetForegroundWindow(g_hwndMain); + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_FINDPREV, 1), 0); + break; + + case IDACC_REPLACENEXT: + if (GetDlgItem(hwnd, IDC_REPLACE) != NULL) + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_REPLACE, 1), 0); + break; + + case IDACC_SAVEFIND: + g_FindReplaceMatchFoundState = FND_NOP; + SendMessage(g_hwndMain, WM_COMMAND, MAKELONG(IDM_EDIT_SAVEFIND, 1), 0); + SetDlgItemTextMB2W(hwnd, IDC_FINDTEXT, sg_pefrData->szFind); + CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_DOT_MATCH_ALL, BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_UNCHECKED); + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_FINDTEXT)), 1); + break; + + case IDACC_VIEWSCHEMECONFIG: + PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_VIEW_SCHEMECONFIG, 1), 0); + break; + + default: + //return false; ??? + break; + } + + } // WM_COMMAND: + return true; + + + case WM_SYSCOMMAND: + if (wParam == IDS_SAVEPOS) { + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_SAVEPOS, 0), 0); + return true; + } + else if (wParam == IDS_RESETPOS) { + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_RESETPOS, 0), 0); + return true; + } + else + return false; + + + case WM_NOTIFY: + { + LPNMHDR pnmhdr = (LPNMHDR)lParam; + switch (pnmhdr->code) + { + case NM_CLICK: + case NM_RETURN: + if (pnmhdr->idFrom == IDC_TOGGLEFINDREPLACE) { + if (GetDlgItem(hwnd, IDC_REPLACE)) + PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_FIND, 1), 0); + else + PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDM_EDIT_REPLACE, 1), 0); + } + // Display help messages in the find/replace windows + else if (pnmhdr->idFrom == IDC_BACKSLASHHELP) { + MsgBox(MBINFO, IDS_BACKSLASHHELP); + } + else if (pnmhdr->idFrom == IDC_REGEXPHELP) { + MsgBox(MBINFO, IDS_REGEXPHELP); + } + else if (pnmhdr->idFrom == IDC_WILDCARDHELP) { + MsgBox(MBINFO, IDS_WILDCARDHELP); + } + break; + + default: + return false; + } + } + break; + + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + { + if (sg_pefrData->bMarkOccurences) + { + HWND hCheck = (HWND)lParam; + HDC hDC = (HDC)wParam; + + HWND hComboBox = GetDlgItem(hwnd, IDC_FINDTEXT); + COMBOBOXINFO ci = { sizeof(COMBOBOXINFO) }; + GetComboBoxInfo(hComboBox, &ci); + + //if (hCheck == ci.hwndItem || hCheck == ci.hwndList) + if (hCheck == ci.hwndItem) { + SetBkMode(hDC, TRANSPARENT); + INT_PTR hBrush; + switch (regexMatch) { + case MATCH: + //SetTextColor(hDC, green); + SetBkColor(hDC, rgbGreen); + hBrush = (INT_PTR)hBrushGreen; + break; + case NO_MATCH: + //SetTextColor(hDC, blue); + SetBkColor(hDC, rgbBlue); + hBrush = (INT_PTR)hBrushBlue; + break; + case INVALID: + default: + //SetTextColor(hDC, red); + SetBkColor(hDC, rgbRed); + hBrush = (INT_PTR)hBrushRed; + break; + } + return hBrush; + } + } + } + return DefWindowProc(hwnd, umsg, wParam, lParam); + + default: + break; + + } // switch(umsg) + + return false; +} + + +//============================================================================= +// +// EditFindReplaceDlg() +// +HWND EditFindReplaceDlg(HWND hwnd,LPCEDITFINDREPLACE lpefr,bool bReplace) +{ + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_SPEED_OVER_MEMORY); + + lpefr->hwnd = hwnd; + HWND hDlg = CreateThemedDialogParam(g_hInstance, + (bReplace) ? MAKEINTRESOURCEW(IDD_REPLACE) : MAKEINTRESOURCEW(IDD_FIND), + GetParent(hwnd), + EditFindReplaceDlgProcW, + (LPARAM) lpefr); + + ShowWindow(hDlg,SW_SHOW); + + CoUninitialize(); + return hDlg; +} + + +//============================================================================= +// +// EditFindNext() +// +bool EditFindNext(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bool bFocusWnd) { + + char szFind[FNDRPL_BUFFER]; + bool bSuppressNotFound = false; + + DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); + if (slen <= 0) + return false; + + if (bFocusWnd) + SetFocus(hwnd); + + DocPos iTextLength = SciCall_GetTextLength(); + + DocPos start = SciCall_GetCurrentPos(); + DocPos end = iTextLength; + + if (start >= end) { + if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap1", IDS_FIND_WRAPFW)) { + end = min(start, iTextLength); start = 0; + } + else + bSuppressNotFound = true; + } + + DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, true, FRMOD_NORM); + + if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { + InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); + bSuppressNotFound = true; + } + else if ((iPos < 0) && (start > 0) && !bExtendSelection) + { + UpdateStatusbar(); + if (!lpefr->bNoFindWrap && !bSuppressNotFound) { + if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap2", IDS_FIND_WRAPFW)) { + end = min(start, iTextLength); start = 0; + + iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED); + + if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { + InfoBox(MBWARN, L"MsgInvalidRegex2", IDS_REGEX_INVALID); + bSuppressNotFound = true; + } + } + else + bSuppressNotFound = true; + } + } + + if (iPos < 0) { + if (!bSuppressNotFound) + InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); + return false; + } + + if (bExtendSelection) { + DocPos iSelPos = SciCall_GetCurrentPos(); + DocPos iSelAnchor = SciCall_GetAnchor(); + EditSelectEx(hwnd, min(iSelAnchor, iSelPos), end, -1, -1); + } + else { + EditSelectEx(hwnd, start, end, -1, -1); + } + return true; +} + + +//============================================================================= +// +// EditFindPrev() +// +bool EditFindPrev(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bExtendSelection, bool bFocusWnd) { + + char szFind[FNDRPL_BUFFER]; + bool bSuppressNotFound = false; + + if (bFocusWnd) + SetFocus(hwnd); + + DocPos slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); + if (slen <= 0) + return false; + + const DocPos iTextLength = SciCall_GetTextLength(); + + DocPos start = SciCall_GetCurrentPos(); + DocPos end = 0; + + if (start <= end) { + if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap1", IDS_FIND_WRAPFW)) { + end = start; start = iTextLength; + } + else + bSuppressNotFound = true; + } + + DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, true, FRMOD_NORM); + + if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) + { + InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); + bSuppressNotFound = true; + } + else if ((iPos < 0) && (start <= iTextLength) && !bExtendSelection) + { + UpdateStatusbar(); + if (!lpefr->bNoFindWrap && !bSuppressNotFound) + { + if (IDOK == InfoBox(MBOKCANCEL, L"MsgFindWrap2", IDS_FIND_WRAPRE)) { + end = start; start = iTextLength; + + iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_WRAPED); + + if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { + InfoBox(MBWARN, L"MsgInvalidRegex2", IDS_REGEX_INVALID); + bSuppressNotFound = true; + } + } + else + bSuppressNotFound = true; + } + } + + if (iPos < 0) { + if (!bSuppressNotFound) + InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); + return false; + } + + if (bExtendSelection) { + DocPos iSelPos = SciCall_GetCurrentPos(); + DocPos iSelAnchor = SciCall_GetAnchor(); + EditSelectEx(hwnd, max(iSelPos, iSelAnchor), start, -1, -1); + } + else { + EditSelectEx(hwnd, end, start, -1, -1); + } + return true; +} + + +//============================================================================= +// +// EditMarkAllOccurrences() +// +void EditMarkAllOccurrences() +{ + if (g_iMarkOccurrences <= 0) { + g_iMarkOccurrencesCount = -1; + return; + } + if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure + + bool bWaitCursor = false; + if (g_iMarkOccurrencesCount > 2000) { + BeginWaitCursor(NULL); + bWaitCursor = true; + } + else { + IgnoreNotifyChangeEvent(); + } + EditEnterTargetTransaction(); + + if (g_bMarkOccurrencesMatchVisible) { + // get visible lines for update + DocLn iFirstVisibleLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); + + DocLn iStartLine = max(0, (iFirstVisibleLine - SciCall_LinesOnScreen())); + DocLn iEndLine = min((iFirstVisibleLine + (SciCall_LinesOnScreen() << 1)), (SciCall_GetLineCount() - 1)); + + DocPos iPosStart = SciCall_PositionFromLine(iStartLine); + DocPos iPosEnd = SciCall_GetLineEndPosition(iEndLine); + + // !!! don't clear all marks, else this method is re-called + // !!! on UpdateUI notification on drawing indicator mark + EditMarkAll(g_hwndEdit, NULL, bMarkOccurrencesCurrentWord, iPosStart, iPosEnd, bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords); + } + else { + EditMarkAll(g_hwndEdit, NULL, bMarkOccurrencesCurrentWord, 0, SciCall_GetTextLength(), bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords); + } + EditLeaveTargetTransaction(); + + if (bWaitCursor) { + EndWaitCursor(); + } + else { + ObserveNotifyChangeEvent(); + } +} + + +//============================================================================= +// +// EditUpdateVisibleUrlHotspot() +// +void EditUpdateVisibleUrlHotspot(bool bEnabled) +{ + if (bEnabled) + { + if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure + + BeginWaitCursor(NULL); + EditEnterTargetTransaction(); + + // get visible lines for update + DocLn iFirstVisibleLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); + + DocLn iStartLine = max(0, (iFirstVisibleLine - SciCall_LinesOnScreen())); + DocLn iEndLine = min((iFirstVisibleLine + (SciCall_LinesOnScreen() << 1)), (SciCall_GetLineCount() - 1)); + + DocPos iPosStart = SciCall_PositionFromLine(iStartLine); + DocPos iPosEnd = SciCall_GetLineEndPosition(iEndLine); + + EditUpdateUrlHotspots(g_hwndEdit, iPosStart, iPosEnd, bEnabled); + + EditLeaveTargetTransaction(); + EndWaitCursor(); + } +} + + +//============================================================================= +// +// _GetReplaceString() +// +static char* __fastcall _GetReplaceString(HWND hwnd, LPCEDITFINDREPLACE lpefr, int* iReplaceMsg) +{ + char* pszReplace = NULL; // replace text of arbitrary size + if (StringCchCompareINA(lpefr->szReplace, FNDRPL_BUFFER, "^c", -1) == 0) { + *iReplaceMsg = SCI_REPLACETARGET; + pszReplace = EditGetClipboardText(hwnd, true, NULL, NULL); + } + else { + pszReplace = StrDupA(lpefr->szReplace); + if (!pszReplace) { + pszReplace = StrDupA(""); + } + bool bIsRegEx = (lpefr->fuFlags & SCFIND_REGEXP); + if (lpefr->bTransformBS || bIsRegEx) { + TransformBackslashes(pszReplace, bIsRegEx, Encoding_SciCP, iReplaceMsg); + } + } + return pszReplace; +} + + +//============================================================================= +// +// EditReplace() +// +bool EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) { + + int iReplaceMsg = SCI_REPLACETARGET; + char* pszReplace = _GetReplaceString(hwnd, lpefr, &iReplaceMsg); + if (!pszReplace) + return false; // recoding of clipboard canceled + + // redo find to get group ranges filled + DocPos start = (SciCall_IsSelectionEmpty() ? SciCall_GetCurrentPos() : SciCall_GetSelectionStart()); + DocPos end = SciCall_GetTextLength(); + DocPos _start = start; + iReplacedOccurrences = 0; + + const DocPos iPos = _FindInTarget(hwnd, lpefr->szFind, StringCchLenA(lpefr->szFind, FRMOD_NORM), + (int)(lpefr->fuFlags), &start, &end, false, false); + + // w/o selection, replacement string is put into current position + // but this maybe not intended here + if (SciCall_IsSelectionEmpty()) { + if ((iPos < 0) || (_start != start) || (_start != end)) { + // empty-replace was not intended + LocalFree(pszReplace); + if (iPos < 0) + return EditFindNext(hwnd, lpefr, false, false); + else { + EditSelectEx(hwnd, start, end, -1, -1); + return true; + } + } + } + iReplacedOccurrences = 1; + + EditEnterTargetTransaction(); + + SciCall_TargetFromSelection(); + SendMessage(hwnd, iReplaceMsg, (WPARAM)-1, (LPARAM)pszReplace); + + // move caret behind replacement + + const DocPos after = SciCall_GetTargetEnd(); + SciCall_SetSel(after, after); + + EditLeaveTargetTransaction(); + + LocalFree(pszReplace); + + return EditFindNext(hwnd, lpefr, false, false); +} + + + +//============================================================================= +// +// EditReplaceAllInRange() +// + +typedef struct _replPos +{ + DocPos beg; + DocPos end; +} +ReplPos_t; + +static UT_icd ReplPos_icd = { sizeof(ReplPos_t), NULL, NULL, NULL }; + +// ------------------------------------------------------------------------------------------------------- + +int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, DocPos iStartPos, DocPos iEndPos, DocPos* enlargement) +{ + char szFind[FNDRPL_BUFFER]; + + if (iStartPos > iEndPos) { swapos(&iStartPos, &iEndPos); } + + int slen = _EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind)); + if (slen <= 0) { return 0; } + + int iReplaceMsg = SCI_REPLACETARGET; + char* pszReplace = _GetReplaceString(hwnd, lpefr, &iReplaceMsg); + if (!pszReplace) { + return -1; // recoding of clipboard canceled + } + + UT_array* ReplPosUTArray = NULL; + utarray_new(ReplPosUTArray, &ReplPos_icd); + utarray_reserve(ReplPosUTArray, (2 * SciCall_GetLineCount()) ); + + DocPos start = iStartPos; + DocPos end = iEndPos; + + DocPos iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_NORM); + + if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) { + InfoBox(MBWARN, L"MsgInvalidRegex", IDS_REGEX_INVALID); + } + + // === build array of matches for later replacements === + + ReplPos_t posPair = { 0, 0 }; + + while ((iPos >= 0) && (start <= iEndPos)) + { + posPair.beg = start; + posPair.end = end; + utarray_push_back(ReplPosUTArray, &posPair); + + start = end; + end = iEndPos; + + if (start <= iEndPos) + iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, ((posPair.end - posPair.beg) == 0), FRMOD_IGNORE); + else + iPos = -1; + } + + int iCount = utarray_len(ReplPosUTArray); + + // === iterate over findings and replace strings === + IgnoreNotifyChangeEvent(); + + DocPos offset = 0; + for (ReplPos_t* pPosPair = (ReplPos_t*)utarray_front(ReplPosUTArray); + pPosPair != NULL; + pPosPair = (ReplPos_t*)utarray_next(ReplPosUTArray, pPosPair)) { + + // redo find to get group ranges filled + start = pPosPair->beg + offset; + end = iEndPos + offset; + + iPos = _FindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, false, FRMOD_IGNORE); + + EditEnterTargetTransaction(); + + SciCall_SetTargetRange(start, end); + + offset += ((DocPos)SendMessage(hwnd, iReplaceMsg, (WPARAM)-1, (LPARAM)pszReplace) - pPosPair->end + pPosPair->beg); + + EditLeaveTargetTransaction(); + } + + ObserveNotifyChangeEvent(); + + utarray_clear(ReplPosUTArray); + utarray_free(ReplPosUTArray); + LocalFree(pszReplace); + + *enlargement = offset; + + return iCount; +} + + +//============================================================================= +// +// EditReplaceAll() +// +bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) +{ + const DocPos start = 0; + const DocPos end = SciCall_GetTextLength(); + DocPos enlargement = 0; + + BeginWaitCursor(NULL); + + int token = BeginUndoAction(); + + iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement); + + EndUndoAction(token); + + EndWaitCursor(); + + if (bShowInfo) { + if (iReplacedOccurrences > 0) + InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences); + else + InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); + } + + return (iReplacedOccurrences > 0) ? true : false; +} + + +//============================================================================= +// +// EditReplaceAllInSelection() +// +bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) +{ + if (SciCall_IsSelectionRectangle()) { + MsgBox(MBWARN, IDS_SELRECT); + return false; + } + + const DocPos start = SciCall_GetSelectionStart(); + const DocPos end = SciCall_GetSelectionEnd(); + const DocPos currPos = SciCall_GetCurrentPos(); + const DocPos anchorPos = SciCall_GetAnchor(); + DocPos enlargement = 0; + bool bWaitCursor = false; + + if ((end - start) > (512 * 512)) { + BeginWaitCursor(NULL); + bWaitCursor = true; + } + + int token = BeginUndoAction(); + + iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement); + + if (bWaitCursor) { + EndWaitCursor(); + } + + if (iReplacedOccurrences <= 0) { + EndUndoAction(token); + return false; + } + + if (currPos < anchorPos) + SciCall_SetSel(anchorPos + enlargement, currPos); + else + SciCall_SetSel(anchorPos, currPos + enlargement); + + EndUndoAction(token); + + if (bShowInfo) { + if (iReplacedOccurrences > 0) + InfoBox(0, L"MsgReplaceCount", IDS_REPLCOUNT, iReplacedOccurrences); + else + InfoBox(0, L"MsgNotFound", IDS_NOTFOUND); + } + + return (iReplacedOccurrences > 0) ? true : false; +} + + +//============================================================================= +// +// EditClearAllOccurrenceMarkers() +// +void EditClearAllOccurrenceMarkers(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd) +{ + IgnoreNotifyChangeEvent(); + + bool bClearAll = false; + + if (iRangeStart < 0) { + iRangeStart = 0; + } + if (iRangeEnd <= 0) { + iRangeEnd = SciCall_GetTextLength(); + } + if (iRangeStart > iRangeEnd) { + swapos(&iRangeStart, &iRangeEnd); + } + if (iRangeEnd >= SciCall_GetTextLength()) { + bClearAll = (iRangeStart == 0); + } + SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0); + SendMessage(hwnd, SCI_INDICATORCLEARRANGE, iRangeStart, iRangeEnd); + + // clear occurrences line marker + if (bClearAll) { + SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); + g_iMarkOccurrencesCount = (g_iMarkOccurrences > 0) ? 0 : -1; + } + else { + const int iOccBitMask = (1 << MARKER_NP3_OCCUR_LINE); + const DocLn iEndLine = SciCall_LineFromPosition(iRangeEnd); + for (DocLn iLine = SciCall_LineFromPosition(iRangeStart); iLine <= iEndLine; ++iLine) { + if ((SciCall_MarkerGet(iLine) & iOccBitMask) != 0) { + SciCall_MarkerDelete(iLine, MARKER_NP3_OCCUR_LINE); + if (g_iMarkOccurrencesCount > 0) { --g_iMarkOccurrencesCount; } + } + } + } + ObserveNotifyChangeEvent(); +} + + +//============================================================================= +// +// EditToggleView() +// +bool EditToggleView(HWND hwnd, bool bToggleView) +{ + UNUSED(hwnd); + static bool bHideNonMatchedLines = false; + + static bool bSaveOccVisible = false; + static bool bSaveHyperlinkHotspots = false; + static bool bSaveFoldingAvailable = false; + static bool bSaveShowFolding = false; + + if (bToggleView) { + + BeginWaitCursor(NULL); + + if (!bHideNonMatchedLines) { + bSaveFoldingAvailable = g_bCodeFoldingAvailable; + bSaveShowFolding = g_bShowCodeFolding; + bSaveHyperlinkHotspots = g_bHyperlinkHotspot; + g_bHyperlinkHotspot = false; + } + else { + g_bCodeFoldingAvailable = bSaveFoldingAvailable; + g_bShowCodeFolding = bSaveShowFolding; + g_bHyperlinkHotspot = bSaveHyperlinkHotspots; + } + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_HYPERLINKHOTSPOTS, g_bHyperlinkHotspot); + + bHideNonMatchedLines = bHideNonMatchedLines ? false : true; // toggle + + EditHideNotMarkedLineRange(hwnd, -1, -1, bHideNonMatchedLines); + + if (bHideNonMatchedLines) { + EditScrollTo(hwnd, 0, false); + SciCall_SetReadOnly(true); + } + else { + EditScrollTo(hwnd, Sci_GetCurrentLine(), true); + SciCall_SetReadOnly(false); + } + + EndWaitCursor(); + } + return bHideNonMatchedLines; +} + + + +//============================================================================= +// +// EditMarkAll() +// Mark all occurrences of the matching text in range (by Aleksandar Lekov) +// +void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd, bool bMatchCase, bool bMatchWords) +{ + char* pszText = NULL; + char txtBuffer[HUGE_BUFFER] = { '\0' }; + + DocPos iFindLength = 0; + + if (pszFind != NULL) + pszText = pszFind; + else + pszText = txtBuffer; + + if (pszFind == NULL) { + + if (SciCall_IsSelectionEmpty()) { + if (flags) { // nothing selected, get word under caret if flagged + DocPos iCurrPos = SciCall_GetCurrentPos(); + DocPos iWordStart = (DocPos)SendMessage(hwnd, SCI_WORDSTARTPOSITION, iCurrPos, (LPARAM)1); + DocPos iWordEnd = (DocPos)SendMessage(hwnd, SCI_WORDENDPOSITION, iCurrPos, (LPARAM)1); + iFindLength = (iWordEnd - iWordStart); + StringCchCopyNA(pszText, HUGE_BUFFER, SciCall_GetRangePointer(iWordStart, iFindLength), iFindLength); + } + else { + return; // no selection and no word mark chosen + } + } + else { // selection found + + if (flags) { return; } // no current word matching if we have a selection + + // get current selection + DocPos iSelStart = SciCall_GetSelectionStart(); + DocPos iSelEnd = SciCall_GetSelectionEnd(); + DocPos iSelCount = (iSelEnd - iSelStart); + + // if multiple lines are selected exit + + if ((SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) || (iSelCount >= HUGE_BUFFER)) { + return; + } + + iFindLength = SciCall_GetSelText(pszText) - 1; + + // exit if selection is not a word and Match whole words only is enabled + if (bMatchWords) { + DocPos iSelStart2 = 0; + const char* delims = (bAccelWordNavigation ? DelimCharsAccel : DelimChars); + while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) { + if (StrChrIA(delims, pszText[iSelStart2])) { + return; + } + iSelStart2++; + } + } + } + // set additional flags + flags = flags ? SCFIND_WHOLEWORD : 0; // match current word under caret ? + flags |= (bMatchWords) ? SCFIND_WHOLEWORD : 0; + flags |= (bMatchCase ? SCFIND_MATCHCASE : 0); + } + else { + iFindLength = StringCchLenA(pszFind, FNDRPL_BUFFER); + } + + if (iFindLength > 0) { + + const DocPos iTextLength = SciCall_GetTextLength(); + rangeStart = max(0, rangeStart); + rangeEnd = min(rangeEnd, iTextLength); + + DocPos start = rangeStart; + DocPos end = rangeEnd; + + SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0); + + const int iOccBitMask = (1 << MARKER_NP3_OCCUR_LINE); + + g_iMarkOccurrencesCount = 0; + DocPos iPos = (DocPos)-1; + do { + + iPos = _FindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (start == iPos), FRMOD_IGNORE); + + if (iPos < 0) + break; // not found + + // mark this match if not done before + SciCall_IndicatorFillRange(iPos, (end - start)); + + const DocLn iLine = SciCall_LineFromPosition(iPos); + if (!(SciCall_MarkerGet(iLine) & iOccBitMask)) { + SciCall_MarkerAdd(iLine, MARKER_NP3_OCCUR_LINE); + } + start = end; + end = rangeEnd; + + } while ((++g_iMarkOccurrencesCount < g_iMarkOccurrencesMaxCount) && (start < end)); + } +} + + +//============================================================================= +// +// EditCompleteWord() +// Auto-complete words (by Aleksandar Lekov) +// +struct WLIST { + char* word; + struct WLIST* next; +}; + +void EditCompleteWord(HWND hwnd, bool autoInsert) +{ + const char* NON_WORD = bAccelWordNavigation ? DelimCharsAccel : DelimChars; + + const DocPos iCurrentPos = SciCall_GetCurrentPos(); + const DocLn iLine = SciCall_LineFromPosition(iCurrentPos); + const DocPos iLineStart = SciCall_PositionFromLine(iLine); + const DocPos iCurrentLinePos = iCurrentPos - iLineStart; + + DocPos iLineLen = SciCall_GetLine(iLine, NULL); + const char* pLine = SciCall_GetRangePointer(iLineStart, iLineLen); + + bool bWordAllNumbers = true; + DocPos iStartWordPos = iCurrentLinePos; + while (iStartWordPos > 0 && !StrChrIA(NON_WORD, pLine[iStartWordPos - 1])) { + iStartWordPos--; + if (pLine[iStartWordPos] < '0' || pLine[iStartWordPos] > '9') { + bWordAllNumbers = false; + } + } + + if (iStartWordPos == iCurrentLinePos || bWordAllNumbers || iCurrentLinePos - iStartWordPos < 2) { + return; + } + + char pRoot[256]; + DocPosCR iRootLen = (DocPosCR)(iCurrentLinePos - iStartWordPos); + StringCchCopyNA(pRoot, COUNTOF(pRoot), pLine + iStartWordPos, (size_t)iRootLen); + + const DocPosCR iDocLen = (DocPosCR)SciCall_GetTextLength(); + struct Sci_TextToFind ft = { { 0, 0 }, 0, { 0, 0 } }; + ft.lpstrText = pRoot; + ft.chrg.cpMax = iDocLen; + + DocPos iPosFind = (DocPos)SendMessage(hwnd, SCI_FINDTEXT, SCFIND_WORDSTART, (LPARAM)&ft); + + int iNumWords = 0; + DocPos iWListSize = 0; + struct WLIST* lListHead = NULL; + + char pWord[1024]; + while ((iPosFind >= 0) && (iPosFind < iDocLen)) + { + DocPos wordLength; + DocPos wordEnd = (DocPosCR)(iPosFind + iRootLen); + + if (iPosFind != iCurrentPos - iRootLen) + { + while ((wordEnd < iDocLen) && !StrChrIA(NON_WORD, SciCall_GetCharAt(wordEnd))) { ++wordEnd; } + + wordLength = wordEnd - iPosFind; + if (wordLength > iRootLen) { + struct WLIST* p = lListHead; + struct WLIST* t = NULL; + bool found = false; + + StringCchCopyNA(pWord, COUNTOF(pWord), SciCall_GetRangePointer(iPosFind, wordLength), wordLength); + + while (p) { + int cmp = lstrcmpA(pWord, p->word); + if (!cmp) { + found = true; + break; + } + else if (cmp < 0) { + break; + } + t = p; + p = p->next; + } + if (!found) { + struct WLIST* el = (struct WLIST*)LocalAlloc(LPTR, sizeof(struct WLIST)); + const DocPos wSize = (wordEnd - iPosFind) + 1; + el->word = LocalAlloc(LPTR, wSize+1); + StringCchCopyA(el->word, wSize+1, pWord); + el->next = p; + if (t) { + t->next = el; + } + else { + lListHead = el; + } + ++iNumWords; + iWListSize += wSize; + } + } + } + ft.chrg.cpMin = (DocPosCR)wordEnd; + iPosFind = (DocPos)SendMessage(hwnd, SCI_FINDTEXT, SCFIND_WORDSTART, (LPARAM)&ft); + } + + if (iNumWords > 0) { + char *pList; + struct WLIST* p = lListHead; + struct WLIST* t; + + pList = LocalAlloc(LPTR, iWListSize + 1); + while (p) { + lstrcatA(pList, " "); + lstrcatA(pList, p->word); + LocalFree(p->word); + t = p; + p = p->next; + LocalFree(t); + } + + SendMessage(hwnd, SCI_AUTOCSETIGNORECASE, 1, 0); + SendMessage(hwnd, SCI_AUTOCSETSEPARATOR, ' ', 0); + SendMessage(hwnd, SCI_AUTOCSETFILLUPS, 0, (LPARAM)"\t\n\r"); + SendMessage(hwnd, SCI_AUTOCSETCHOOSESINGLE, autoInsert, 0); + SendMessage(hwnd, SCI_AUTOCSHOW, iRootLen, (LPARAM)(pList + 1)); + LocalFree(pList); + } + +// LocalFree(pRoot); +} + + + +//============================================================================= +// +// EditUpdateUrlHotspots() +// Find and mark all URL hot-spots +// +void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActiveHotspot) +{ + if (endPos < startPos) { + swapos(&startPos, &endPos); + } + + // 1st apply current lexer style + EditFinalizeStyling(hwnd,startPos); + + const char* pszUrlRegEx = "\\b(?:(?:https?|ftp|file)://|www\\.|ftp\\.)" + "(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*" + "(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#/%=~_|$])"; + + const int iRegExLen = (int)strlen(pszUrlRegEx); + + if (startPos < 0) { // current line only + DocPos currPos = SciCall_GetCurrentPos(); + DocLn lineNo = SciCall_LineFromPosition(currPos); + startPos = SciCall_PositionFromLine(lineNo); + endPos = SciCall_GetLineEndPosition(lineNo); + } + if (endPos == startPos) + return; + + DocPos start = startPos; + DocPos end = endPos; + int iStyle = bActiveHotspot ? Style_GetHotspotStyleID() : STYLE_DEFAULT; + + do { + DocPos iPos = _FindInTarget(hwnd, pszUrlRegEx, iRegExLen, SCFIND_NP3_REGEX, &start, &end, false, FRMOD_IGNORE); + + if (iPos < 0) + break; // not found + + DocPos mlen = end - start; + if ((mlen <= 0) || ((iPos + mlen) > endPos)) + break; // wrong match + + // mark this match + SciCall_StartStyling(iPos); + SciCall_SetStyling((DocPosCR)mlen, iStyle); + + // next occurrence + start = end; + end = endPos; + + } while (start < end); + + + if (bActiveHotspot) + SciCall_StartStyling(endPos); + else + SciCall_StartStyling(startPos); +} + + +//============================================================================= +// +// EditHideNotMarkedLineRange() +// +void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, bool bHideLines) +{ + UNUSED(hwnd); + + if (iEndPos < iStartPos) { + swapos(&iStartPos, &iEndPos); + } + + if (iStartPos < 0 || iEndPos < 0) { + iStartPos = 0; + iEndPos = SciCall_GetTextLength(); + } + + IgnoreNotifyChangeEvent(); + + if (!bHideLines) { + SciCall_FoldAll(SC_FOLDACTION_EXPAND); + SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); + if (!g_bCodeFoldingAvailable) { SciCall_SetProperty("fold", "0"); } + Style_SetFolding(hwnd, g_bShowCodeFolding); + EditApplyLexerStyle(hwnd, 0, -1); + ObserveNotifyChangeEvent(); + return; + } + + EditApplyLexerStyle(hwnd, 0, -1); // reset + + // prepare hidde (folding) settings + g_bCodeFoldingAvailable = true; // saved before + g_bShowCodeFolding = true; // saved before + SciCall_SetProperty("fold", "1"); + //SciCall_SetProperty("fold.compact", "1"); + Style_SetFolding(hwnd, true); + SciCall_SetFoldFlags(0); + //SciCall_SetFoldFlags(SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE); // Debug + + + // hide lines without indicator + const int iOccBitMask = (1 << MARKER_NP3_OCCUR_LINE); + const int iStyleHideID = Style_GetInvisibleStyleID(); + + const DocLn iStartLine = SciCall_LineFromPosition(iStartPos); + const DocLn iEndLine = SciCall_LineFromPosition(iEndPos); + + const int baseLevel = SciCall_GetFoldLevel(iStartLine) & SC_FOLDLEVELNUMBERMASK; + + // clear levels to avoid multi rearangements on existing lexer provided levels + for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) + { + SciCall_SetFoldLevel(iLine, baseLevel); + } + + // 1st line + if ((SciCall_MarkerGet(iStartLine) & iOccBitMask) == 0) + { // hide + const DocPos begPos = SciCall_PositionFromLine(iStartLine); + const DocPos lnLen = SciCall_LineLength(iStartLine); + SciCall_StartStyling(begPos); + SciCall_SetStyling((DocPosCR)lnLen, iStyleHideID); + } + + int level = baseLevel; + for (DocLn iLine = iStartLine + 1; iLine <= iEndLine; ++iLine) + { + const int markerSet = SciCall_MarkerGet(iLine); + if (markerSet != -1) + { + if (markerSet & iOccBitMask) // visible + { + while (level > baseLevel) { --level; } + SciCall_SetFoldLevel(iLine, level); + } + else // hide line + { + const DocPos begPos = SciCall_PositionFromLine(iLine); + const DocPos lnLen = SciCall_LineLength(iLine); + SciCall_StartStyling(begPos); + SciCall_SetStyling((DocPosCR)lnLen, iStyleHideID); + + if (level == baseLevel) { + SciCall_SetFoldLevel(iLine - 1, SC_FOLDLEVELHEADERFLAG | level++); + } + SciCall_SetFoldLevel(iLine, SC_FOLDLEVELWHITEFLAG | level); + } + } + } + + if (iEndPos < SciCall_GetTextLength()) { + const DocPos iStartStyling = SciCall_PositionFromLine(iEndLine + 1); + if ((iStartStyling >= 0) && (iStartStyling < SciCall_GetTextLength())) { + SciCall_StartStyling(iStartStyling); + EditFinalizeStyling(hwnd, -1); + } + } + + ObserveNotifyChangeEvent(); + + SciCall_FoldAll(SC_FOLDACTION_CONTRACT); +} + + +//============================================================================= +// +// EditHighlightIfBrace() +// +static bool __fastcall _HighlightIfBrace(HWND hwnd, DocPos iPos) +{ + if (iPos < 0) { + // clear indicator + SendMessage(hwnd, SCI_BRACEBADLIGHT, (WPARAM)INVALID_POSITION, 0); + SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0); + if (!bUseOldStyleBraceMatching) + SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 0, INDIC_NP3_BAD_BRACE); + return true; + } + + char c = SciCall_GetCharAt(iPos); + + if (StrChrA("()[]{}", c)) { + DocPos iBrace2 = (DocPos)SendMessage(hwnd, SCI_BRACEMATCH, iPos, 0); + if (iBrace2 != -1) { + DocPos col1 = SciCall_GetColumn(iPos); + DocPos col2 = SciCall_GetColumn(iBrace2); + SendMessage(hwnd, SCI_BRACEHIGHLIGHT, iPos, iBrace2); + SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, min(col1, col2), 0); + if (!bUseOldStyleBraceMatching) { + SendMessage(hwnd, SCI_BRACEHIGHLIGHTINDICATOR, 1, INDIC_NP3_MATCH_BRACE); + } + } + else { + SendMessage(hwnd, SCI_BRACEBADLIGHT, iPos, 0); + SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0); + if (!bUseOldStyleBraceMatching) { + SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 1, INDIC_NP3_BAD_BRACE); + } + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditApplyLexerStyle() +// +void EditApplyLexerStyle(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd) +{ + UNUSED(hwnd); + SciCall_Colourise(iRangeStart, iRangeEnd); +} + + +//============================================================================= +// +// EditFinalizeStyling() +// +void EditFinalizeStyling(HWND hwnd, DocPos iEndPos) +{ + if (iEndPos <= 0) { + iEndPos = SciCall_GetTextLength(); + } + + const DocPos iEndStyled = SciCall_GetEndStyled(); + + if (iEndStyled < iEndPos) + { + const DocPos iStartStyling = SciCall_PositionFromLine(SciCall_LineFromPosition(iEndStyled)); + EditApplyLexerStyle(hwnd, iStartStyling, iEndPos); + } +} + + +//============================================================================= +// +// EditMatchBrace() +// +void EditMatchBrace(HWND hwnd) +{ + DocPos iPos = SciCall_GetCurrentPos(); + + EditFinalizeStyling(hwnd, iPos); + + if (!_HighlightIfBrace(hwnd, iPos)) { + // try one before + iPos = SciCall_PositionBefore(iPos); + if (!_HighlightIfBrace(hwnd, iPos)) { + // clear mark + _HighlightIfBrace(hwnd, -1); + } + } +} + + + +//============================================================================= +// +// EditLinenumDlgProc() +// +INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + switch(umsg) + { + case WM_INITDIALOG: + { + DocLn iCurLine = SciCall_LineFromPosition(SciCall_GetCurrentPos())+1; + DocPos iCurColumn = SciCall_GetColumn(SciCall_GetCurrentPos()) + 1; + + SetDlgItemInt(hwnd, IDC_LINENUM, (UINT)iCurLine, false); + SetDlgItemInt(hwnd, IDC_COLNUM, (UINT)iCurColumn, false); + SendDlgItemMessage(hwnd,IDC_LINENUM,EM_LIMITTEXT,15,0); + SendDlgItemMessage(hwnd,IDC_COLNUM,EM_LIMITTEXT,15,0); + CenterDlgInParent(hwnd); + } + return true; + + + case WM_COMMAND: + + switch(LOWORD(wParam)) + { + case IDOK: + { + BOOL fTranslated = TRUE; + DocLn iNewLine = (DocLn)GetDlgItemInt(hwnd,IDC_LINENUM,&fTranslated,FALSE); + + DocLn iMaxLine = (DocLn)SendMessage(g_hwndEdit,SCI_GETLINECOUNT,0,0); + + DocPos iNewCol = 1; + BOOL fTranslated2 = TRUE; + if (SendDlgItemMessage(hwnd, IDC_COLNUM, WM_GETTEXTLENGTH, 0, 0) > 0) { + iNewCol = (DocPos)GetDlgItemInt(hwnd, IDC_COLNUM, &fTranslated2, FALSE); + } + + if (!fTranslated || !fTranslated2) + { + PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,(!fTranslated) ? IDC_LINENUM : IDC_COLNUM)),1); + return true; + } + + if ((iNewLine > 0) && (iNewLine <= iMaxLine) && (iNewCol > 0)) + { + EditJumpTo(g_hwndEdit,iNewLine,iNewCol); + EndDialog(hwnd,IDOK); + } + else { + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, (!((iNewLine > 0) && (iNewLine <= iMaxLine))) ? IDC_LINENUM : IDC_COLNUM)), 1); + } + } + break; + + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + + } + return true; + + } + + UNUSED(lParam); + + return false; +} + + +//============================================================================= +// +// EditLinenumDlg() +// +bool EditLinenumDlg(HWND hwnd) +{ + + if (IDOK == ThemedDialogBoxParam(g_hInstance,MAKEINTRESOURCE(IDD_LINENUM), + GetParent(hwnd),EditLinenumDlgProc,(LPARAM)hwnd)) + return true; + + else + return false; + +} + + +//============================================================================= +// +// EditModifyLinesDlg() +// +// Controls: 100 Input +// 101 Input +// +typedef struct _modlinesdata { + LPWSTR pwsz1; + LPWSTR pwsz2; +} MODLINESDATA, *PMODLINESDATA; + + +INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static PMODLINESDATA pdata; + + static int id_hover; + static int id_capture; + + static HFONT hFontNormal; + static HFONT hFontHover; + + static HCURSOR hCursorNormal; + static HCURSOR hCursorHover; + + switch(umsg) + { + case WM_INITDIALOG: + { + LOGFONT lf; + + id_hover = 0; + id_capture = 0; + + if (NULL == (hFontNormal = (HFONT)SendDlgItemMessage(hwnd,200,WM_GETFONT,0,0))) + hFontNormal = GetStockObject(DEFAULT_GUI_FONT); + GetObject(hFontNormal,sizeof(LOGFONT),&lf); + lf.lfUnderline = true; + hFontHover = CreateFontIndirect(&lf); + + hCursorNormal = LoadCursor(NULL,IDC_ARROW); + hCursorHover = LoadCursor(NULL,IDC_HAND); + if (!hCursorHover) + hCursorHover = LoadCursor(g_hInstance, IDC_ARROW); + + pdata = (PMODLINESDATA)lParam; + SetDlgItemTextW(hwnd,100,pdata->pwsz1); + SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0); + SetDlgItemTextW(hwnd,101,pdata->pwsz2); + SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); + CenterDlgInParent(hwnd); + } + return true; + + case WM_DESTROY: + DeleteObject(hFontHover); + return false; + + case WM_NCACTIVATE: + if (!(bool)wParam) { + if (id_hover != 0) { + //int _id_hover = id_hover; + id_hover = 0; + id_capture = 0; + //InvalidateRect(GetDlgItem(hwnd,id_hover),NULL,false); + } + } + return false; + + case WM_CTLCOLORSTATIC: + { + DWORD dwId = GetWindowLong((HWND)lParam,GWL_ID); + HDC hdc = (HDC)wParam; + + if (dwId >= 200 && dwId <= 205) { + SetBkMode(hdc,TRANSPARENT); + if (GetSysColorBrush(COLOR_HOTLIGHT)) + SetTextColor(hdc,GetSysColor(COLOR_HOTLIGHT)); + else + SetTextColor(hdc,RGB(0, 0, 0xFF)); + SelectObject(hdc,/*dwId == id_hover?*/hFontHover/*:hFontNormal*/); + return (INT_PTR)GetSysColorBrush(COLOR_BTNFACE); + } + } + break; + + case WM_MOUSEMOVE: + { + POINT pt; + pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); + HWND hwndHover = ChildWindowFromPoint(hwnd,pt); + DWORD dwId = (DWORD)GetWindowLong(hwndHover,GWL_ID); + + if (GetActiveWindow() == hwnd) { + if (dwId >= 200 && dwId <= 205) { + if (id_capture == (int)dwId || id_capture == 0) { + if (id_hover != id_capture || id_hover == 0) { + id_hover = (int)dwId; + //InvalidateRect(GetDlgItem(hwnd,dwId),NULL,false); + } + } + else if (id_hover != 0) { + //int _id_hover = id_hover; + id_hover = 0; + //InvalidateRect(GetDlgItem(hwnd,_id_hover),NULL,false); + } + } + else if (id_hover != 0) { + //int _id_hover = id_hover; + id_hover = 0; + //InvalidateRect(GetDlgItem(hwnd,_id_hover),NULL,false); + } + SetCursor(id_hover != 0 ? hCursorHover : hCursorNormal); + } + } + break; + + case WM_LBUTTONDOWN: + { + POINT pt; + pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); + HWND hwndHover = ChildWindowFromPoint(hwnd,pt); + DWORD dwId = GetWindowLong(hwndHover,GWL_ID); + + if (dwId >= 200 && dwId <= 205) { + GetCapture(); + id_hover = dwId; + id_capture = dwId; + //InvalidateRect(GetDlgItem(hwnd,dwId),NULL,false); + } + SetCursor(id_hover != 0?hCursorHover:hCursorNormal); + } + break; + + case WM_LBUTTONUP: + { + POINT pt; + pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); + //HWND hwndHover = ChildWindowFromPoint(hwnd,pt); + //DWORD dwId = GetWindowLong(hwndHover,GWL_ID); + if (id_capture != 0) { + ReleaseCapture(); + if (id_hover == id_capture) { + int id_focus = GetWindowLong(GetFocus(),GWL_ID); + if (id_focus == 100 || id_focus == 101) { + WCHAR wch[8]; + GetDlgItemText(hwnd,id_capture,wch,COUNTOF(wch)); + SendDlgItemMessage(hwnd,id_focus,EM_SETSEL,(WPARAM)0,(LPARAM)-1); + SendDlgItemMessage(hwnd,id_focus,EM_REPLACESEL,(WPARAM)true,(LPARAM)wch); + PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetFocus()),1); + } + } + id_capture = 0; + } + SetCursor(id_hover != 0?hCursorHover:hCursorNormal); + } + break; + + case WM_CANCELMODE: + if (id_capture != 0) { + ReleaseCapture(); + id_hover = 0; + id_capture = 0; + SetCursor(hCursorNormal); + } + break; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: { + GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); + GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); + EndDialog(hwnd,IDOK); + } + break; + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditModifyLinesDlg() +// +bool EditModifyLinesDlg(HWND hwnd,LPWSTR pwsz1,LPWSTR pwsz2) +{ + + INT_PTR iResult; + MODLINESDATA data; + data.pwsz1 = pwsz1; data.pwsz2 = pwsz2; + + iResult = ThemedDialogBoxParam( + g_hInstance, + MAKEINTRESOURCEW(IDD_MODIFYLINES), + hwnd, + EditModifyLinesDlgProc, + (LPARAM)&data); + + return (iResult == IDOK) ? true : false; + +} + + +//============================================================================= +// +// EditAlignDlgProc() +// +// Controls: 100 Radio Button +// 101 Radio Button +// 102 Radio Button +// 103 Radio Button +// 104 Radio Button +// +INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static int *piAlignMode; + switch(umsg) + { + case WM_INITDIALOG: + { + piAlignMode = (int*)lParam; + CheckRadioButton(hwnd,100,104,*piAlignMode+100); + CenterDlgInParent(hwnd); + } + return true; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: { + *piAlignMode = 0; + if (IsDlgButtonChecked(hwnd,100) == BST_CHECKED) + *piAlignMode = ALIGN_LEFT; + else if (IsDlgButtonChecked(hwnd,101) == BST_CHECKED) + *piAlignMode = ALIGN_RIGHT; + else if (IsDlgButtonChecked(hwnd,102) == BST_CHECKED) + *piAlignMode = ALIGN_CENTER; + else if (IsDlgButtonChecked(hwnd,103) == BST_CHECKED) + *piAlignMode = ALIGN_JUSTIFY; + else if (IsDlgButtonChecked(hwnd,104) == BST_CHECKED) + *piAlignMode = ALIGN_JUSTIFY_EX; + EndDialog(hwnd,IDOK); + } + break; + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditAlignDlg() +// +bool EditAlignDlg(HWND hwnd,int *piAlignMode) +{ + + INT_PTR iResult; + + iResult = ThemedDialogBoxParam( + g_hInstance, + MAKEINTRESOURCEW(IDD_ALIGN), + hwnd, + EditAlignDlgProc, + (LPARAM)piAlignMode); + + return (iResult == IDOK) ? true : false; + +} + + +//============================================================================= +// +// EditEncloseSelectionDlgProc() +// +// Controls: 100 Input +// 101 Input +// +typedef struct _encloseselectiondata { + LPWSTR pwsz1; + LPWSTR pwsz2; +} ENCLOSESELDATA, *PENCLOSESELDATA; + + +INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static PENCLOSESELDATA pdata; + switch(umsg) + { + case WM_INITDIALOG: + { + pdata = (PENCLOSESELDATA)lParam; + SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0); + SetDlgItemTextW(hwnd,100,pdata->pwsz1); + SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); + SetDlgItemTextW(hwnd,101,pdata->pwsz2); + CenterDlgInParent(hwnd); + } + return true; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: { + GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); + GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); + EndDialog(hwnd,IDOK); + } + break; + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditEncloseSelectionDlg() +// +bool EditEncloseSelectionDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose) +{ + + INT_PTR iResult; + ENCLOSESELDATA data; + data.pwsz1 = pwszOpen; data.pwsz2 = pwszClose; + + iResult = ThemedDialogBoxParam( + g_hInstance, + MAKEINTRESOURCEW(IDD_ENCLOSESELECTION), + hwnd, + EditEncloseSelectionDlgProc, + (LPARAM)&data); + + return (iResult == IDOK) ? true : false; + +} + + +//============================================================================= +// +// EditInsertTagDlgProc() +// +// Controls: 100 Input +// 101 Input +// +typedef struct _tagsdata { + LPWSTR pwsz1; + LPWSTR pwsz2; +} TAGSDATA, *PTAGSDATA; + + +INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static PTAGSDATA pdata; + switch(umsg) + { + case WM_INITDIALOG: + { + pdata = (PTAGSDATA)lParam; + SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,254,0); + SetDlgItemTextW(hwnd,100,L""); + SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0); + SetDlgItemTextW(hwnd,101,L""); + SetFocus(GetDlgItem(hwnd,100)); + PostMessage(GetDlgItem(hwnd,100),EM_SETSEL,1,4); + CenterDlgInParent(hwnd); + } + return false; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case 100: { + if (HIWORD(wParam) == EN_CHANGE) { + + WCHAR wchBuf[256] = { L'\0' }; + WCHAR wchIns[256] = L"= 3) { + + if (wchBuf[0] == L'<') + { + int cchIns = 2; + const WCHAR* pwCur = &wchBuf[1]; + while ( + *pwCur && + *pwCur != L'<' && + *pwCur != L'>' && + *pwCur != L' ' && + *pwCur != L'\t' && + (StrChr(L":_-.",*pwCur) || IsCharAlphaNumericW(*pwCur))) + + wchIns[cchIns++] = *pwCur++; + + while ( + *pwCur && + *pwCur != L'>') + + pwCur++; + + if (*pwCur == L'>' && *(pwCur-1) != L'/') { + wchIns[cchIns++] = L'>'; + wchIns[cchIns] = L'\0'; + + if (cchIns > 3 && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"
",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1) && + StringCchCompareIN(wchIns,COUNTOF(wchIns),L"",-1)) { + + SetDlgItemTextW(hwnd,101,wchIns); + bClear = false; + } + } + } + } + if (bClear) + SetDlgItemTextW(hwnd,101,L""); + } + } + break; + case IDOK: { + GetDlgItemTextW(hwnd,100,pdata->pwsz1,256); + GetDlgItemTextW(hwnd,101,pdata->pwsz2,256); + EndDialog(hwnd,IDOK); + } + break; + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditInsertTagDlg() +// +bool EditInsertTagDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose) +{ + + INT_PTR iResult; + TAGSDATA data; + data.pwsz1 = pwszOpen; data.pwsz2 = pwszClose; + + iResult = ThemedDialogBoxParam( + g_hInstance, + MAKEINTRESOURCEW(IDD_INSERTTAG), + hwnd, + EditInsertTagDlgProc, + (LPARAM)&data); + + return (iResult == IDOK) ? true : false; + +} + + +//============================================================================= +// +// EditSortDlgProc() +// +// Controls: 100-102 Radio Button +// 103-108 Check Box +// +INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static int *piSortFlags; + static bool bEnableLogicalSort; + + switch(umsg) + { + case WM_INITDIALOG: + { + piSortFlags = (int*)lParam; + if (*piSortFlags & SORT_DESCENDING) + CheckRadioButton(hwnd,100,102,101); + else if (*piSortFlags & SORT_SHUFFLE) { + CheckRadioButton(hwnd,100,102,102); + DialogEnableWindow(hwnd,103,false); + DialogEnableWindow(hwnd,104,false); + DialogEnableWindow(hwnd,105,false); + DialogEnableWindow(hwnd,106,false); + DialogEnableWindow(hwnd,107,false); + } + else + CheckRadioButton(hwnd,100,102,100); + if (*piSortFlags & SORT_MERGEDUP) + CheckDlgButton(hwnd,103,BST_CHECKED); + if (*piSortFlags & SORT_UNIQDUP) { + CheckDlgButton(hwnd,104,BST_CHECKED); + DialogEnableWindow(hwnd,103,false); + } + if (*piSortFlags & SORT_UNIQUNIQ) + CheckDlgButton(hwnd,105,BST_CHECKED); + if (*piSortFlags & SORT_NOCASE) + CheckDlgButton(hwnd,106,BST_CHECKED); + if (GetProcAddress(GetModuleHandle(L"shlwapi"),"StrCmpLogicalW")) { + if (*piSortFlags & SORT_LOGICAL) + CheckDlgButton(hwnd,107,BST_CHECKED); + bEnableLogicalSort = true; + } + else { + DialogEnableWindow(hwnd,107,false); + bEnableLogicalSort = false; + } + if (!SciCall_IsSelectionRectangle()) { + *piSortFlags &= ~SORT_COLUMN; + DialogEnableWindow(hwnd,108,false); + } + else { + *piSortFlags |= SORT_COLUMN; + CheckDlgButton(hwnd,108,BST_CHECKED); + } + CenterDlgInParent(hwnd); + } + return true; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: { + *piSortFlags = 0; + if (IsDlgButtonChecked(hwnd,101) == BST_CHECKED) + *piSortFlags |= SORT_DESCENDING; + if (IsDlgButtonChecked(hwnd,102) == BST_CHECKED) + *piSortFlags |= SORT_SHUFFLE; + if (IsDlgButtonChecked(hwnd,103) == BST_CHECKED) + *piSortFlags |= SORT_MERGEDUP; + if (IsDlgButtonChecked(hwnd,104) == BST_CHECKED) + *piSortFlags |= SORT_UNIQDUP; + if (IsDlgButtonChecked(hwnd,105) == BST_CHECKED) + *piSortFlags |= SORT_UNIQUNIQ; + if (IsDlgButtonChecked(hwnd,106) == BST_CHECKED) + *piSortFlags |= SORT_NOCASE; + if (IsDlgButtonChecked(hwnd,107) == BST_CHECKED) + *piSortFlags |= SORT_LOGICAL; + if (IsDlgButtonChecked(hwnd,108) == BST_CHECKED) + *piSortFlags |= SORT_COLUMN; + EndDialog(hwnd,IDOK); + } + break; + case IDCANCEL: + EndDialog(hwnd,IDCANCEL); + break; + case 100: + case 101: + DialogEnableWindow(hwnd,103,IsDlgButtonChecked(hwnd,105) != BST_CHECKED); + DialogEnableWindow(hwnd,104,true); + DialogEnableWindow(hwnd,105,true); + DialogEnableWindow(hwnd,106,true); + DialogEnableWindow(hwnd,107,bEnableLogicalSort); + break; + case 102: + DialogEnableWindow(hwnd,103,false); + DialogEnableWindow(hwnd,104,false); + DialogEnableWindow(hwnd,105,false); + DialogEnableWindow(hwnd,106,false); + DialogEnableWindow(hwnd,107,false); + break; + case 104: + DialogEnableWindow(hwnd,103,IsDlgButtonChecked(hwnd,104) != BST_CHECKED); + break; + } + return true; + } + return false; +} + + +//============================================================================= +// +// EditSortDlg() +// +bool EditSortDlg(HWND hwnd,int *piSortFlags) +{ + + INT_PTR iResult; + + iResult = ThemedDialogBoxParam( + g_hInstance, + MAKEINTRESOURCEW(IDD_SORT), + hwnd, + EditSortDlgProc, + (LPARAM)piSortFlags); + + return (iResult == IDOK) ? true : false; + +} + + +//============================================================================= +// +// EditSortDlg() +// +void EditSetAccelWordNav(HWND hwnd,bool bAccelWordNav) +{ + bAccelWordNavigation = bAccelWordNav; + + if (bAccelWordNavigation) { + SendMessage(hwnd, SCI_SETWORDCHARS, 0, (LPARAM)WordCharsAccelerated); + SendMessage(hwnd, SCI_SETWHITESPACECHARS, 0,(LPARAM)WhiteSpaceCharsAccelerated); + SendMessage(hwnd, SCI_SETPUNCTUATIONCHARS,0,(LPARAM)PunctuationCharsAccelerated); + } + else + SendMessage(hwnd, SCI_SETCHARSDEFAULT, 0, 0); +} + + +//============================================================================= +// +// EditGetBookmarkList() +// +void EditGetBookmarkList(HWND hwnd, LPWSTR pszBookMarks, int cchLength) +{ + WCHAR tchLine[32]; + StringCchCopyW(pszBookMarks, cchLength, L""); + int bitmask = (1 << MARKER_NP3_BOOKMARK); + DocLn iLine = -1; + do { + iLine = (DocLn)SendMessage(hwnd, SCI_MARKERNEXT, iLine + 1, bitmask); + if (iLine >= 0) { + StringCchPrintfW(tchLine, COUNTOF(tchLine), L"%td;", iLine); + StringCchCatW(pszBookMarks, cchLength, tchLine); + } + } while (iLine >= 0); + + StrTrimW(pszBookMarks, L";"); +} + + +//============================================================================= +// +// EditSetBookmarkList() +// +void EditSetBookmarkList(HWND hwnd, LPCWSTR pszBookMarks) +{ + UNUSED(hwnd); + WCHAR lnNum[32]; + const WCHAR* p1 = pszBookMarks; + if (!p1) return; + + const DocLn iLineMax = SciCall_GetLineCount() - 1; + + while (*p1) { + const WCHAR* p2 = StrChr(p1, L';'); + if (!p2) + p2 = StrEnd(p1); + StringCchCopyNW(lnNum, COUNTOF(lnNum), p1, min((int)(p2 - p1), 16)); + long long iLine = 0; + if (swscanf_s(lnNum, L"%lld", &iLine) == 1) { + if (iLine <= iLineMax) { + Sci_SendMsgV2(MARKERADD, iLine, MARKER_NP3_BOOKMARK); + } + } + p1 = (*p2) ? (p2 + 1) : p2; + } +} + + +//============================================================================= +// +// _SetFileVars() +// +extern bool bNoEncodingTags; +extern int flagNoFileVariables; + +static void __fastcall _SetFileVars(char* lpData, char* tch, LPFILEVARS lpfv) +{ + int i; + bool bDisableFileVar = false; + + if (!flagNoFileVariables) { + + if (FileVars_ParseInt(tch, "enable-local-variables", &i) && (!i)) + bDisableFileVar = true; + + if (!bDisableFileVar) { + + if (FileVars_ParseInt(tch, "tab-width", &i)) { + lpfv->iTabWidth = max(min(i, 256), 1); + lpfv->mask |= FV_TABWIDTH; + } + + if (FileVars_ParseInt(tch, "c-basic-indent", &i)) { + lpfv->iIndentWidth = max(min(i, 256), 0); + lpfv->mask |= FV_INDENTWIDTH; + } + + if (FileVars_ParseInt(tch, "indent-tabs-mode", &i)) { + lpfv->bTabsAsSpaces = (i) ? false : true; + lpfv->mask |= FV_TABSASSPACES; + } + + if (FileVars_ParseInt(tch, "c-tab-always-indent", &i)) { + lpfv->bTabIndents = (i) ? true : false; + lpfv->mask |= FV_TABINDENTS; + } + + if (FileVars_ParseInt(tch, "truncate-lines", &i)) { + lpfv->fWordWrap = (i) ? false : true; + lpfv->mask |= FV_WORDWRAP; + } + + if (FileVars_ParseInt(tch, "fill-column", &i)) { + lpfv->iLongLinesLimit = max(min(i, 4096), 0); + lpfv->mask |= FV_LONGLINESLIMIT; + } + } + } + + if (!IsUTF8Signature(lpData) && !bNoEncodingTags && !bDisableFileVar) { + + if (FileVars_ParseStr(tch, "encoding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) + lpfv->mask |= FV_ENCODING; + else if (FileVars_ParseStr(tch, "charset", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) + lpfv->mask |= FV_ENCODING; + else if (FileVars_ParseStr(tch, "coding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding))) + lpfv->mask |= FV_ENCODING; + } + + if (!flagNoFileVariables && !bDisableFileVar) { + if (FileVars_ParseStr(tch, "mode", lpfv->tchMode, COUNTOF(lpfv->tchMode))) + lpfv->mask |= FV_MODE; + } +} + +//============================================================================= +// +// FileVars_Init() +// + +bool FileVars_Init(char *lpData, DWORD cbData, LPFILEVARS lpfv) { + + char tch[LARGE_BUFFER]; + + ZeroMemory(lpfv,sizeof(FILEVARS)); + if ((flagNoFileVariables && bNoEncodingTags) || !lpData || !cbData) + return true; + + StringCchCopyNA(tch,COUNTOF(tch),lpData,min(cbData + 1,COUNTOF(tch))); + _SetFileVars(lpData, tch, lpfv); + + if (lpfv->mask == 0 && cbData > COUNTOF(tch)) { + StringCchCopyNA(tch,COUNTOF(tch),lpData + cbData - COUNTOF(tch) + 1,COUNTOF(tch)); + _SetFileVars(lpData, tch, lpfv); + } + + if (lpfv->mask & FV_ENCODING) + lpfv->iEncoding = Encoding_MatchA(lpfv->tchEncoding); + + return true; +} + + +//============================================================================= +// +// FileVars_Apply() +// +extern bool bTabsAsSpacesG; +extern bool bTabIndentsG; +extern int iTabWidthG; +extern int iIndentWidthG; +extern bool bWordWrap; +extern bool bWordWrapG; +extern int iWordWrapMode; +extern int iLongLinesLimit; +extern int iLongLinesLimitG; +extern int iWrapCol; + +bool FileVars_Apply(HWND hwnd,LPFILEVARS lpfv) { + + if (lpfv->mask & FV_TABWIDTH) + g_iTabWidth = lpfv->iTabWidth; + else + g_iTabWidth = iTabWidthG; + SendMessage(hwnd,SCI_SETTABWIDTH,g_iTabWidth,0); + + if (lpfv->mask & FV_INDENTWIDTH) + g_iIndentWidth = lpfv->iIndentWidth; + else if (lpfv->mask & FV_TABWIDTH) + g_iIndentWidth = 0; + else + g_iIndentWidth = iIndentWidthG; + SendMessage(hwnd,SCI_SETINDENT,g_iIndentWidth,0); + + if (lpfv->mask & FV_TABSASSPACES) + g_bTabsAsSpaces = lpfv->bTabsAsSpaces; + else + g_bTabsAsSpaces = bTabsAsSpacesG; + SendMessage(hwnd,SCI_SETUSETABS,!g_bTabsAsSpaces,0); + + if (lpfv->mask & FV_TABINDENTS) + g_bTabIndents = lpfv->bTabIndents; + else + g_bTabIndents = bTabIndentsG; + SendMessage(g_hwndEdit,SCI_SETTABINDENTS,g_bTabIndents,0); + + if (lpfv->mask & FV_WORDWRAP) + bWordWrap = lpfv->fWordWrap; + else + bWordWrap = bWordWrapG; + + if (!bWordWrap) + SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0); + else + SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0); + + if (lpfv->mask & FV_LONGLINESLIMIT) + iLongLinesLimit = lpfv->iLongLinesLimit; + else + iLongLinesLimit = iLongLinesLimitG; + SendMessage(hwnd,SCI_SETEDGECOLUMN,iLongLinesLimit,0); + + iWrapCol = 0; + + return(true); +} + + +//============================================================================= +// +// FileVars_ParseInt() +// +bool FileVars_ParseInt(char* pszData,char* pszName,int* piValue) { + + char *pvStart = StrStrIA(pszData, pszName); + while (pvStart) { + char chPrev = (pvStart > pszData) ? *(pvStart-1) : 0; + if (!IsCharAlphaNumericA(chPrev) && chPrev != '-' && chPrev != '_') { + pvStart += lstrlenA(pszName); + while (*pvStart == ' ') + pvStart++; + if (*pvStart == ':' || *pvStart == '=') + break; + } + else + pvStart += lstrlenA(pszName); + + pvStart = StrStrIA(pvStart, pszName); // next + } + + if (pvStart) { + + while (*pvStart && StrChrIA(":=\"' \t",*pvStart)) + pvStart++; + + char tch[32] = { L'\0' }; + StringCchCopyNA(tch,COUNTOF(tch),pvStart,COUNTOF(tch)); + + char* pvEnd = tch; + while (*pvEnd && IsCharAlphaNumericA(*pvEnd)) + pvEnd++; + *pvEnd = 0; + StrTrimA(tch," \t:=\"'"); + + int itok = sscanf_s(tch,"%i",piValue); + if (itok == 1) + return(true); + + if (tch[0] == 't') { + *piValue = 1; + return(true); + } + + if (tch[0] == 'n' || tch[0] == 'f') { + *piValue = 0; + return(true); + } + } + return(false); +} + + +//============================================================================= +// +// FileVars_ParseStr() +// +bool FileVars_ParseStr(char* pszData,char* pszName,char* pszValue,int cchValue) { + + char *pvStart = StrStrIA(pszData, pszName); + while (pvStart) { + char chPrev = (pvStart > pszData) ? *(pvStart-1) : 0; + if (!IsCharAlphaNumericA(chPrev) && chPrev != '-' && chPrev != '_') { + pvStart += lstrlenA(pszName); + while (*pvStart == ' ') + pvStart++; + if (*pvStart == ':' || *pvStart == '=') + break; + } + else + pvStart += lstrlenA(pszName); + + pvStart = StrStrIA(pvStart, pszName); // next + } + + if (pvStart) { + + bool bQuoted = false; + while (*pvStart && StrChrIA(":=\"' \t",*pvStart)) { + if (*pvStart == '\'' || *pvStart == '"') + bQuoted = true; + pvStart++; + } + + char tch[32] = { L'\0' }; + StringCchCopyNA(tch,COUNTOF(tch),pvStart,COUNTOF(tch)); + + char* pvEnd = tch; + while (*pvEnd && (IsCharAlphaNumericA(*pvEnd) || StrChrIA("+-/_",*pvEnd) || (bQuoted && *pvEnd == ' '))) + pvEnd++; + *pvEnd = 0; + StrTrimA(tch," \t:=\"'"); + + StringCchCopyNA(pszValue,cchValue,tch,COUNTOF(tch)); + + return(true); + } + return(false); +} + + +//============================================================================= +// +// FileVars_IsUTF8() +// +bool FileVars_IsUTF8(LPFILEVARS lpfv) { + if (lpfv->mask & FV_ENCODING) { + if (StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf-8",-1) == 0 || + StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf8",-1) == 0) + return(true); + } + return(false); +} + + +//============================================================================= +// +// FileVars_IsNonUTF8() +// +bool FileVars_IsNonUTF8(LPFILEVARS lpfv) { + if (lpfv->mask & FV_ENCODING) { + if (StringCchLenA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)) && + StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf-8",-1) != 0 && + StringCchCompareINA(lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding),"utf8",-1) != 0) + return(true); + } + return(false); +} + + +//============================================================================= +// +// FileVars_IsValidEncoding() +// +bool FileVars_IsValidEncoding(LPFILEVARS lpfv) { + CPINFO cpi; + if (lpfv->mask & FV_ENCODING && + lpfv->iEncoding >= 0 && + lpfv->iEncoding < Encoding_CountOf()) { + if ((Encoding_IsINTERNAL(lpfv->iEncoding)) || + IsValidCodePage(Encoding_GetCodePage(lpfv->iEncoding)) && + GetCPInfo(Encoding_GetCodePage(lpfv->iEncoding),&cpi)) { + return(true); + } + } + return(false); +} + +//============================================================================= +// +// FileVars_GetEncoding() +// +int FileVars_GetEncoding(LPFILEVARS lpfv) { + if (lpfv->mask & FV_ENCODING) + return(lpfv->iEncoding); + else + return(-1); +} + + +//============================================================================== +// +// Folding Functions +// +// +#define FOLD_CHILDREN SCMOD_CTRL +#define FOLD_SIBLINGS SCMOD_SHIFT + +bool __stdcall FoldToggleNode(DocLn ln, FOLD_ACTION action) +{ + const bool fExpanded = SciCall_GetFoldExpanded(ln); + + if ((action == FOLD && fExpanded) || (action == EXPAND && !fExpanded)) + { + SciCall_ToggleFold(ln); + return true; + } + else if (action == SNIFF) + { + SciCall_ToggleFold(ln); + return true; + } + return false; +} + + +void __stdcall EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action) +{ + if (action == SNIFF) { + action = SciCall_GetFoldExpanded(ln) ? FOLD : EXPAND; + } + if (mode & (FOLD_CHILDREN | FOLD_SIBLINGS)) + { + // ln/lvNode: line and level of the source of this fold action + DocLn lnNode = ln; + int lvNode = SciCall_GetFoldLevel(lnNode) & SC_FOLDLEVELNUMBERMASK; + DocLn lnTotal = SciCall_GetLineCount(); + + // lvStop: the level over which we should not cross + int lvStop = lvNode; + + if (mode & FOLD_SIBLINGS) + { + ln = SciCall_GetFoldParent(lnNode) + 1; // -1 + 1 = 0 if no parent + --lvStop; + } + + for (; ln < lnTotal; ++ln) + { + int lv = SciCall_GetFoldLevel(ln); + bool fHeader = lv & SC_FOLDLEVELHEADERFLAG; + lv &= SC_FOLDLEVELNUMBERMASK; + + if (lv < lvStop || (lv == lvStop && fHeader && ln != lnNode)) + return; + else if (fHeader && (lv == lvNode || (lv > lvNode && mode & FOLD_CHILDREN))) + FoldToggleNode(ln, action); + } + } + else { + FoldToggleNode(ln, action); + } +} + + +void EditFoldToggleAll(FOLD_ACTION action) +{ + static FOLD_ACTION sLastAction = EXPAND; + + bool fToggled = false; + + DocLn lnTotal = SciCall_GetLineCount(); + + if (action == SNIFF) + { + int cntFolded = 0; + int cntExpanded = 0; + for (int ln = 0; ln < lnTotal; ++ln) + { + if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) + { + if (SciCall_GetFoldExpanded(ln)) + ++cntExpanded; + else + ++cntFolded; + } + } + if (cntFolded == cntExpanded) + action = (sLastAction == FOLD) ? EXPAND : FOLD; + else + action = (cntFolded < cntExpanded) ? FOLD : EXPAND; + } + + for (int ln = 0; ln < lnTotal; ++ln) + { + if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) + { + if (FoldToggleNode(ln, action)) { fToggled = true; } + } + } + if (fToggled) { SciCall_ScrollCaret(); } +} + + +void EditFoldClick(DocLn ln, int mode) +{ + static struct { + DocLn ln; + int mode; + DWORD dwTickCount; + } prev; + + bool fGotoFoldPoint = mode & FOLD_SIBLINGS; + + if (!(SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG)) + { + // Not a fold point: need to look for a double-click + if (prev.ln == ln && prev.mode == mode && + GetTickCount() - prev.dwTickCount <= GetDoubleClickTime()) + { + prev.ln = (DocLn)-1; // Prevent re-triggering on a triple-click + + ln = SciCall_GetFoldParent(ln); + + if (ln >= 0 && SciCall_GetFoldExpanded(ln)) + fGotoFoldPoint = true; + else + return; + } + else + { + // Save the info needed to match this click with the next click + prev.ln = ln; + prev.mode = mode; + prev.dwTickCount = GetTickCount(); + return; + } + } + + EditFoldPerformAction(ln, mode, SNIFF); + + if (fGotoFoldPoint) { + EditJumpTo(g_hwndEdit, ln + 1, 0); + } +} + + +void EditFoldAltArrow(FOLD_MOVE move, FOLD_ACTION action) +{ + if (g_bCodeFoldingAvailable && g_bShowCodeFolding) + { + DocLn ln = SciCall_LineFromPosition(SciCall_GetCurrentPos()); + + // Jump to the next visible fold point + if (move == DOWN) + { + DocLn lnTotal = SciCall_GetLineCount(); + for (ln = ln + 1; ln < lnTotal; ++ln) + { + if ((SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) && SciCall_GetLineVisible(ln)) + { + EditJumpTo(g_hwndEdit, ln + 1, 0); + return; + } + } + } + else if (move == UP) // Jump to the previous visible fold point + { + for (ln = ln - 1; ln >= 0; --ln) + { + if ((SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) && SciCall_GetLineVisible(ln)) + { + EditJumpTo(g_hwndEdit, ln + 1, 0); + return; + } + } + } + + // Perform a fold/unfold operation + if (SciCall_GetFoldLevel(ln) & SC_FOLDLEVELHEADERFLAG) + { + if (action != SNIFF) { + FoldToggleNode(ln, action); + } + } + } +} + + + +//============================================================================= +// +// SciInitThemes() +// +//WNDPROC pfnSciWndProc = NULL; +// +//FARPROC pfnOpenThemeData = NULL; +//FARPROC pfnCloseThemeData = NULL; +//FARPROC pfnDrawThemeBackground = NULL; +//FARPROC pfnGetThemeBackgroundContentRect = NULL; +//FARPROC pfnIsThemeActive = NULL; +//FARPROC pfnDrawThemeParentBackground = NULL; +//FARPROC pfnIsThemeBackgroundPartiallyTransparent = NULL; +// +//bool bThemesPresent = false; +//extern bool bIsAppThemed; +//extern HMODULE hModUxTheme; +// +//void SciInitThemes(HWND hwnd) +//{ +// if (hModUxTheme) { +// +// pfnOpenThemeData = GetProcAddress(hModUxTheme,"OpenThemeData"); +// pfnCloseThemeData = GetProcAddress(hModUxTheme,"CloseThemeData"); +// pfnDrawThemeBackground = GetProcAddress(hModUxTheme,"DrawThemeBackground"); +// pfnGetThemeBackgroundContentRect = GetProcAddress(hModUxTheme,"GetThemeBackgroundContentRect"); +// pfnIsThemeActive = GetProcAddress(hModUxTheme,"IsThemeActive"); +// pfnDrawThemeParentBackground = GetProcAddress(hModUxTheme,"DrawThemeParentBackground"); +// pfnIsThemeBackgroundPartiallyTransparent = GetProcAddress(hModUxTheme,"IsThemeBackgroundPartiallyTransparent"); +// +// pfnSciWndProc = (WNDPROC)SetWindowLongPtrW(hwnd,GWLP_WNDPROC,(LONG_PTR)&SciThemedWndProc); +// bThemesPresent = true; +// } +//} +// +// +////============================================================================= +//// +//// SciThemedWndProc() +//// +//LRESULT CALLBACK SciThemedWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +//{ +// static RECT rcContent; +// +// if (umsg == WM_NCCALCSIZE) { +// if (wParam) { +// LRESULT lresult = CallWindowProcW(pfnSciWndProc,hwnd,WM_NCCALCSIZE,wParam,lParam); +// NCCALCSIZE_PARAMS *csp = (NCCALCSIZE_PARAMS*)lParam; +// +// if (bThemesPresent && bIsAppThemed) { +// HANDLE hTheme = (HANDLE)pfnOpenThemeData(hwnd,L"edit"); +// if(hTheme) { +// bool bSuccess = false; +// RECT rcClient; +// +// if(pfnGetThemeBackgroundContentRect( +// hTheme,NULL,/*EP_EDITTEXT*/1,/*ETS_NORMAL*/1,&csp->rgrc[0],&rcClient) == S_OK) { +// InflateRect(&rcClient,-1,-1); +// +// rcContent.left = rcClient.left-csp->rgrc[0].left; +// rcContent.top = rcClient.top-csp->rgrc[0].top; +// rcContent.right = csp->rgrc[0].right-rcClient.right; +// rcContent.bottom = csp->rgrc[0].bottom-rcClient.bottom; +// +// CopyRect(&csp->rgrc[0],&rcClient); +// bSuccess = true; +// } +// pfnCloseThemeData(hTheme); +// +// if (bSuccess) +// return WVR_REDRAW; +// } +// } +// return lresult; +// } +// } +// +// else if (umsg == WM_NCPAINT) { +// LRESULT lresult = CallWindowProcW(pfnSciWndProc,hwnd,WM_NCPAINT,wParam,lParam); +// if(bThemesPresent && bIsAppThemed) { +// +// HANDLE hTheme = (HANDLE)pfnOpenThemeData(hwnd,L"edit"); +// if(hTheme) { +// RECT rcBorder; +// RECT rcClient; +// int nState; +// +// HDC hdc = GetWindowDC(hwnd); +// +// GetWindowRect(hwnd,&rcBorder); +// OffsetRect(&rcBorder,-rcBorder.left,-rcBorder.top); +// +// CopyRect(&rcClient,&rcBorder); +// rcClient.left += rcContent.left; +// rcClient.top += rcContent.top; +// rcClient.right -= rcContent.right; +// rcClient.bottom -= rcContent.bottom; +// +// ExcludeClipRect(hdc,rcClient.left,rcClient.top,rcClient.right,rcClient.bottom); +// +// if(pfnIsThemeBackgroundPartiallyTransparent(hTheme,/*EP_EDITTEXT*/1,/*ETS_NORMAL*/1)) +// pfnDrawThemeParentBackground(hwnd,hdc,&rcBorder); +// +// /* +// ETS_NORMAL = 1 +// ETS_HOT = 2 +// ETS_SELECTED = 3 +// ETS_DISABLED = 4 +// ETS_FOCUSED = 5 +// ETS_READONLY = 6 +// ETS_ASSIST = 7 +// */ +// +// if(!IsWindowEnabled(hwnd)) +// nState = /*ETS_DISABLED*/4; +// else if (GetFocus() == hwnd) +// nState = /*ETS_FOCUSED*/5; +// else if(SendMessage(hwnd,SCI_GETREADONLY,0,0)) +// nState = /*ETS_READONLY*/6; +// else +// nState = /*ETS_NORMAL*/1; +// +// pfnDrawThemeBackground(hTheme,hdc,/*EP_EDITTEXT*/1,nState,&rcBorder,NULL); +// pfnCloseThemeData(hTheme); +// +// ReleaseDC(hwnd,hdc); +// return 0; +// } +// } +// return lresult; +// } +// +// return CallWindowProcW(pfnSciWndProc,hwnd,umsg,wParam,lParam); +//} + + + +/// End of Edit.c \\\ diff --git a/src/Edit.h b/src/Edit.h index 7da7dbc7d..2fe6fb93e 100644 --- a/src/Edit.h +++ b/src/Edit.h @@ -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 \\\ diff --git a/src/Helpers.c b/src/Helpers.c index 5aec6eb24..c29ccd009 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -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; diff --git a/src/Notepad3.c b/src/Notepad3.c index dfba2ad5e..90ce0e2f3 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1,8848 +1,8961 @@ -/****************************************************************************** -* * -* * -* Notepad3 * -* * -* Notepad3.c * -* Main application window functionality * -* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * -* * -* (c) Rizonesoft 2008-2017 * -* https://rizonesoft.com * -* * -* * -*******************************************************************************/ - -#if !defined(WINVER) -#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(NTDDI_VERSION) -#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ -#endif -#define VC_EXTRALEAN 1 -#define WIN32_LEAN_AND_MEAN 1 - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include - -#include "scintilla.h" -#include "scilexer.h" -#include "edit.h" -#include "styles.h" -#include "dialogs.h" -#include "resource.h" -#include "../crypto/crypto.h" -#include "../uthash/utarray.h" -#include "encoding.h" -#include "helpers.h" -#include "SciCall.h" - -#include "notepad3.h" - - - -/****************************************************************************** -* -* Local and global Variables for Notepad3.c -* -*/ -HWND g_hwndMain = NULL; -HWND g_hwndStatus = NULL; -HWND g_hwndToolbar = NULL; -HWND g_hwndDlgFindReplace = NULL; -HWND g_hwndDlgCustomizeSchemes = NULL; -HWND hwndReBar = NULL; -HWND hwndEditFrame = NULL; -HWND hwndNextCBChain = NULL; - -#define INISECTIONBUFCNT 32 -#define NUMTOOLBITMAPS 25 -#define NUMINITIALTOOLS 30 - -TBBUTTON tbbMainWnd[] = { { 0,IDT_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 1,IDT_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 3,IDT_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 2,IDT_FILE_BROWSE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 4,IDT_EDIT_UNDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 5,IDT_EDIT_REDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 6,IDT_EDIT_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 7,IDT_EDIT_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 8,IDT_EDIT_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 9,IDT_EDIT_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 10,IDT_EDIT_REPLACE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 11,IDT_VIEW_WORDWRAP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 23,IDT_VIEW_TOGGLEFOLDS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 21,IDT_FILE_OPENFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 12,IDT_VIEW_ZOOMIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 13,IDT_VIEW_ZOOMOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 14,IDT_VIEW_SCHEME,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 24,IDT_FILE_LAUNCH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 16,IDT_FILE_EXIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 15,IDT_VIEW_SCHEMECONFIG,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 0,0,0,TBSTYLE_SEP,0,0 }, - { 17,IDT_FILE_SAVEAS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 18,IDT_FILE_SAVECOPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 19,IDT_EDIT_CLEAR,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, - { 20,IDT_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 } -}; - -#define TBBUTTON_DEFAULT_IDS L"1 2 4 3 0 5 6 0 7 8 9 0 10 11 0 12 0 24 0 22 23 0 13 14 0 15 0 25 0 17" - - -WCHAR g_wchIniFile[MAX_PATH] = { L'\0' }; -WCHAR g_wchIniFile2[MAX_PATH] = { L'\0' }; -WCHAR szBufferFile[MAX_PATH] = { L'\0' }; -bool bSaveSettings; -bool bEnableSaveSettings; -bool bSaveRecentFiles; -bool bPreserveCaretPos; -bool bSaveFindReplace; -bool bFindReplCopySelOrClip = true; -WCHAR tchLastSaveCopyDir[MAX_PATH] = { L'\0' }; -WCHAR tchOpenWithDir[MAX_PATH] = { L'\0' }; -WCHAR tchFavoritesDir[MAX_PATH] = { L'\0' }; -WCHAR tchDefaultDir[MAX_PATH] = { L'\0' }; -WCHAR tchDefaultExtension[64] = { L'\0' }; -WCHAR tchFileDlgFilters[5*1024] = { L'\0' }; -WCHAR tchToolbarButtons[512] = { L'\0' }; -WCHAR tchToolbarBitmap[MAX_PATH] = { L'\0' }; -WCHAR tchToolbarBitmapHot[MAX_PATH] = { L'\0' }; -WCHAR tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' }; - -int iPathNameFormat; -bool bWordWrap; -bool bWordWrapG; -int iWordWrapMode; -int iWordWrapIndent; -int iWordWrapSymbols; -bool bShowWordWrapSymbols; -bool bMatchBraces; -bool bAutoIndent; -bool bAutoCloseTags; -bool bShowIndentGuides; -bool bHiliteCurrentLine; -bool bHyperlinkHotspot; -bool bScrollPastEOF; -bool g_bTabsAsSpaces; -bool bTabsAsSpacesG; -bool g_bTabIndents; -bool bTabIndentsG; -bool bBackspaceUnindents; -int g_iTabWidth; -int iTabWidthG; -int g_iIndentWidth; -int iIndentWidthG; -bool bMarkLongLines; -int iLongLinesLimit; -int iLongLinesLimitG; -int iLongLineMode; -int iWrapCol = 0; -bool g_bShowSelectionMargin; -bool bShowLineNumbers; -int iReplacedOccurrences; -int iMarkOccurrences; -int iMarkOccurrencesCount; -int iMarkOccurrencesMaxCount; -bool bMarkOccurrencesMatchVisible; -bool bMarkOccurrencesMatchCase; -bool bMarkOccurrencesMatchWords; -bool bMarkOccurrencesCurrentWord; -bool bUseOldStyleBraceMatching; -bool bAutoCompleteWords; -bool bAccelWordNavigation; -bool bDenyVirtualSpaceAccess; -bool g_bCodeFoldingAvailable; -bool g_bShowCodeFolding; -bool bViewWhiteSpace; -bool bViewEOLs; -bool bUseDefaultForFileEncoding; -bool bSkipUnicodeDetection; -bool bSkipANSICodePageDetection; -bool bLoadASCIIasUTF8; -bool bLoadNFOasOEM; -bool bNoEncodingTags; -bool bFixLineEndings; -bool bAutoStripBlanks; -int iPrintHeader; -int iPrintFooter; -int iPrintColor; -int iPrintZoom; -RECT pagesetupMargin; -bool bSaveBeforeRunningTools; -int iFileWatchingMode; -bool bResetFileWatching; -DWORD dwFileCheckInverval; -DWORD dwAutoReloadTimeout; -int iEscFunction; -bool bAlwaysOnTop; -bool bMinimizeToTray; -bool bTransparentMode; -bool bTransparentModeAvailable; -bool bShowToolbar; -bool bShowStatusbar; -int iSciDirectWriteTech; -int iSciFontQuality; -int iHighDpiToolBar; -int iUpdateDelayHyperlinkStyling; -int iUpdateDelayMarkAllCoccurrences; -int iCurrentLineHorizontalSlop = 0; -int iCurrentLineVerticalSlop = 0; - -const int DirectWriteTechnology[4] = { - SC_TECHNOLOGY_DEFAULT - , SC_TECHNOLOGY_DIRECTWRITE - , SC_TECHNOLOGY_DIRECTWRITERETAIN - , SC_TECHNOLOGY_DIRECTWRITEDC -}; - -const int FontQuality[4] = { - SC_EFF_QUALITY_DEFAULT - , SC_EFF_QUALITY_NON_ANTIALIASED - , SC_EFF_QUALITY_ANTIALIASED - , SC_EFF_QUALITY_LCD_OPTIMIZED -}; - -WININFO g_WinInfo = { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0 }; - -bool bStickyWinPos; - -bool bIsAppThemed; -int cyReBar; -int cyReBarFrame; -int cxEditFrame; -int cyEditFrame; - -int cxEncodingDlg; -int cyEncodingDlg; -int cxRecodeDlg; -int cyRecodeDlg; -int cxFileMRUDlg; -int cyFileMRUDlg; -int cxOpenWithDlg; -int cyOpenWithDlg; -int cxFavoritesDlg; -int cyFavoritesDlg; -int xFindReplaceDlg; -int yFindReplaceDlg; -int xCustomSchemesDlg; -int yCustomSchemesDlg; - - -LPWSTR lpFileList[32] = { NULL }; -int cFileList = 0; -int cchiFileList = 0; -LPWSTR lpFileArg = NULL; -LPWSTR lpSchemeArg = NULL; -LPWSTR lpMatchArg = NULL; -LPWSTR lpEncodingArg = NULL; -LPMRULIST g_pFileMRU; -LPMRULIST g_pMRUfind; -LPMRULIST g_pMRUreplace; - -DWORD dwLastIOError; - -int g_iDefaultNewFileEncoding; -int g_iDefaultCharSet; - -int g_iEOLMode; -int g_iDefaultEOLMode; - -int iInitialLine; -int iInitialColumn; - -int iInitialLexer; - -bool bLastCopyFromMe = false; -DWORD dwLastCopyTime; - -UINT uidsAppTitle = IDS_APPTITLE; -WCHAR szTitleExcerpt[MIDSZ_BUFFER] = { L'\0' }; -int fKeepTitleExcerpt = 0; - -HANDLE hChangeHandle = NULL; -bool bRunningWatch = false; -bool dwChangeNotifyTime = 0; -WIN32_FIND_DATA fdCurFile; - -UINT msgTaskbarCreated = 0; - -HMODULE hModUxTheme = NULL; -HMODULE hRichEdit = NULL; - - -EDITFINDREPLACE g_efrData = EFR_INIT_DATA; -bool bReplaceInitialized = false; - -int iLineEndings[3] = { - SC_EOL_CRLF, - SC_EOL_LF, - SC_EOL_CR -}; - -WCHAR wchPrefixSelection[256] = { L'\0' }; -WCHAR wchAppendSelection[256] = { L'\0' }; - -WCHAR wchPrefixLines[256] = { L'\0' }; -WCHAR wchAppendLines[256] = { L'\0' }; - -int iSortOptions = 0; -int iAlignMode = 0; - -bool flagIsElevated = false; -WCHAR wchWndClass[16] = WC_NOTEPAD3; - - -HINSTANCE g_hInstance = NULL; -HANDLE g_hScintilla = NULL; -HANDLE g_hwndEdit = NULL; - -WCHAR g_wchAppUserModelID[32] = { L'\0' }; -WCHAR g_wchWorkingDirectory[MAX_PATH+2] = { L'\0' }; -WCHAR g_wchCurFile[FILE_ARG_BUF] = { L'\0' }; -FILEVARS fvCurFile; -bool bReadOnly = false; - - -// temporary line buffer for fast line ops -static char g_pTempLineBufferMain[TEMPLINE_BUFFER]; - - -// undo / redo selections -static UT_icd UndoRedoSelection_icd = { sizeof(UndoRedoSelection_t), NULL, NULL, NULL }; -static UT_array* UndoRedoSelectionUTArray = NULL; - - -static CLIPFORMAT cfDrpF = CF_HDROP; -static POINTL ptDummy = { 0, 0 }; -static PDROPTARGET pDropTarget = NULL; -static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyState, POINTL pt, void *pUserData); - -// Timer bitfield -static volatile LONG g_lInterlockBits = 0; -#define BIT_TIMER_MARK_OCC 1L -#define BIT_MARK_OCC_IN_PROGRESS 2L - -#define BIT_TIMER_UPDATE_HYPER 4L -#define BIT_UPDATE_HYPER_IN_PROGRESS 8L - -#define LOCK_NOTIFY_CHANGE 16L - -#define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lInterlockBits, B) -#define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lInterlockBits, B) - - -//============================================================================= -// -// IgnoreNotifyChangeEvent(), ObserveNotifyChangeEvent(), CheckNotifyChangeEvent() -// -void IgnoreNotifyChangeEvent() { - (void)TEST_AND_SET(LOCK_NOTIFY_CHANGE); -} - -void ObserveNotifyChangeEvent() { - (void)TEST_AND_RESET(LOCK_NOTIFY_CHANGE); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); -} - -bool CheckNotifyChangeEvent() { - if (TEST_AND_RESET(LOCK_NOTIFY_CHANGE)) { - (void)TEST_AND_SET(LOCK_NOTIFY_CHANGE); - return false; - } - return true; -} - -// SCN_UPDATEUI notification -#define SC_UPDATE_NP3_INTERNAL_NOTIFY (SC_UPDATE_H_SCROLL << 1) - - -//============================================================================= -// -// Flags -// -int flagNoReuseWindow = 0; -int flagReuseWindow = 0; -int flagMultiFileArg = 0; -int flagSingleFileInstance = 0; -int flagStartAsTrayIcon = 0; -int flagAlwaysOnTop = 0; -int flagRelativeFileMRU = 0; -int flagPortableMyDocs = 0; -int flagNoFadeHidden = 0; -int flagToolbarLook = 0; -int flagSimpleIndentGuides = 0; -int flagNoHTMLGuess = 0; -int flagNoCGIGuess = 0; -int flagNoFileVariables = 0; -int flagPosParam = 0; -int flagDefaultPos = 0; -int flagNewFromClipboard = 0; -int flagPasteBoard = 0; -int flagSetEncoding = 0; -int flagSetEOLMode = 0; -int flagJumpTo = 0; -int flagMatchText = 0; -int flagChangeNotify = 0; -int flagLexerSpecified = 0; -int flagQuietCreate = 0; -int flagUseSystemMRU = 0; -int flagRelaunchElevated = 0; -int flagDisplayHelp = 0; -int flagPrintFileAndLeave = 0; -int flagBufferFile = 0; - - -//============================================================================== -// -// Document Modified Flag -// -// -static bool IsDocumentModified = false; - -static void __fastcall _SetDocumentModified(bool bModified) -{ - if (IsDocumentModified != bModified) { - IsDocumentModified = bModified; - UpdateToolbar(); - } -} - - -//============================================================================= -// -// WinMain() -// -// -int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nCmdShow) -{ - - MSG msg; - HWND hwnd; - HACCEL hAccMain; - HACCEL hAccFindReplace; - HACCEL hAccCoustomizeSchemes; - INITCOMMONCONTROLSEX icex; - //HMODULE hSciLexer; - WCHAR wchAppDir[2*MAX_PATH+4] = { L'\0' }; - - // Set global variable g_hInstance - g_hInstance = hInstance; - - GetModuleFileName(NULL,wchAppDir,COUNTOF(wchAppDir)); - PathRemoveFileSpec(wchAppDir); - PathCanonicalizeEx(wchAppDir,COUNTOF(wchAppDir)); - - if (!GetCurrentDirectory(COUNTOF(g_wchWorkingDirectory),g_wchWorkingDirectory)) { - StringCchCopy(g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory),wchAppDir); - } - - // Don't keep working directory locked - SetCurrentDirectory(wchAppDir); - - SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - - // check if running at least on Windows XP - if (!IsXP()) { - LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER| - FORMAT_MESSAGE_FROM_SYSTEM| - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ERROR_OLD_WIN_VERSION, - MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), // Default language - (LPWSTR)&lpMsgBuf, - 0, - NULL); - MessageBox(NULL,(LPCWSTR)lpMsgBuf,L"Notepad3",MB_OK|MB_ICONEXCLAMATION); - LocalFree(lpMsgBuf); - return(0); - } - - // Check if running with elevated privileges - flagIsElevated = IsUserAdmin() || IsElevated(); - - // Default Encodings (may already be used for command line parsing) - Encoding_InitDefaults(); - - // Command Line, Ini File and Flags - ParseCommandLine(); - FindIniFile(); - TestIniFile(); - CreateIniFile(); - LoadFlags(); - - // set AppUserModelID - PrivateSetCurrentProcessExplicitAppUserModelID(g_wchAppUserModelID); - - // Command Line Help Dialog - if (flagDisplayHelp) { - DisplayCmdLineHelp(NULL); - return(0); - } - - // Adapt window class name - if (flagIsElevated) - StringCchCat(wchWndClass,COUNTOF(wchWndClass),L"U"); - if (flagPasteBoard) - StringCchCat(wchWndClass,COUNTOF(wchWndClass),L"B"); - - // Relaunch with elevated privileges - if (RelaunchElevated(NULL)) - return(0); - - // Try to run multiple instances - if (RelaunchMultiInst()) - return(0); - - // Try to activate another window - if (ActivatePrevInst()) - return(0); - - // Init OLE and Common Controls - OleInitialize(NULL); - - icex.dwSize = sizeof(INITCOMMONCONTROLSEX); - icex.dwICC = ICC_WIN95_CLASSES|ICC_COOL_CLASSES|ICC_BAR_CLASSES|ICC_USEREX_CLASSES; - InitCommonControlsEx(&icex); - - msgTaskbarCreated = RegisterWindowMessage(L"TaskbarCreated"); - - if (!IsWin8()) { - hModUxTheme = LoadLibrary(L"uxtheme.dll"); - } - hRichEdit = LoadLibrary(L"RICHED20.DLL"); // Use "RichEdit20W" for control in .rc - //hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in .rc - - Scintilla_RegisterClasses(hInstance); - - // Load Settings - LoadSettings(); - - if (!InitApplication(hInstance)) - return false; - - hwnd = InitInstance(hInstance, lpCmdLine, nCmdShow); - if (!hwnd) - return false; - - // init DragnDrop handler - DragAndDropInit(NULL); - - if (IsVista()) { - // Current platforms perform window buffering so it is almost always better for this option to be turned off. - // There are some older platforms and unusual modes where buffering may still be useful - so keep it ON - //~SciCall_SetBufferedDraw(true); // default is true - - if (iSciDirectWriteTech >= 0) { - SciCall_SetTechnology(DirectWriteTechnology[iSciDirectWriteTech]); - } - } - - hAccMain = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_MAINWND)); - hAccFindReplace = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCFINDREPLACE)); - hAccCoustomizeSchemes = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCCUSTOMSCHEMES)); - - UpdateLineNumberWidth(); - ObserveNotifyChangeEvent(); - - while (GetMessage(&msg,NULL,0,0)) - { - if (IsWindow(g_hwndDlgFindReplace) && ((msg.hwnd == g_hwndDlgFindReplace) || IsChild(g_hwndDlgFindReplace, msg.hwnd))) - { - const int iTr = TranslateAccelerator(g_hwndDlgFindReplace, hAccFindReplace, &msg); - if (iTr || IsDialogMessage(g_hwndDlgFindReplace, &msg)) - continue; - } - if (IsWindow(g_hwndDlgCustomizeSchemes) && ((msg.hwnd == g_hwndDlgCustomizeSchemes) || IsChild(g_hwndDlgCustomizeSchemes, msg.hwnd))) { - const int iTr = TranslateAccelerator(g_hwndDlgCustomizeSchemes, hAccCoustomizeSchemes, &msg); - if (iTr || IsDialogMessage(g_hwndDlgCustomizeSchemes, &msg)) - continue; - } - if (!TranslateAccelerator(hwnd,hAccMain,&msg)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - // Save Settings is done elsewhere - - Scintilla_ReleaseResources(); - UnregisterClass(wchWndClass,hInstance); - - if (hModUxTheme) - FreeLibrary(hModUxTheme); - - OleUninitialize(); - - UNUSED(hPrevInst); - - return(int)(msg.wParam); -} - - -//============================================================================= -// -// InitApplication() -// -// -bool InitApplication(HINSTANCE hInstance) -{ - - WNDCLASS wc; - - wc.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)MainWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDR_MAINWND)); - wc.hCursor = LoadCursor(NULL,IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); - wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINWND); - wc.lpszClassName = wchWndClass; - - return RegisterClass(&wc); - -} - - -//============================================================================= -// -// InitInstance() -// -// -static void __fastcall _InitWindowPosition(HWND hwnd) -{ - RECT rc; - if (hwnd) { - GetWindowRect(hwnd, &rc); - } - else { - rc.left = g_WinInfo.x; - rc.top = g_WinInfo.y; - rc.right = g_WinInfo.x + g_WinInfo.cx; - rc.bottom = g_WinInfo.y + g_WinInfo.cy; - } - - if (flagDefaultPos == 1) - { - g_WinInfo.x = g_WinInfo.y = g_WinInfo.cx = g_WinInfo.cy = CW_USEDEFAULT; - g_WinInfo.max = 0; - } - else if (flagDefaultPos >= 4) - { - SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); - if (flagDefaultPos & 8) - g_WinInfo.x = (rc.right - rc.left) / 2; - else - g_WinInfo.x = rc.left; - g_WinInfo.cx = rc.right - rc.left; - if (flagDefaultPos & (4 | 8)) - g_WinInfo.cx /= 2; - if (flagDefaultPos & 32) - g_WinInfo.y = (rc.bottom - rc.top) / 2; - else - g_WinInfo.y = rc.top; - g_WinInfo.cy = rc.bottom - rc.top; - if (flagDefaultPos & (16 | 32)) - g_WinInfo.cy /= 2; - if (flagDefaultPos & 64) { - g_WinInfo.x = rc.left; - g_WinInfo.y = rc.top; - g_WinInfo.cx = rc.right - rc.left; - g_WinInfo.cy = rc.bottom - rc.top; - } - if (flagDefaultPos & 128) { - g_WinInfo.x += (flagDefaultPos & 8) ? 4 : 8; - g_WinInfo.cx -= (flagDefaultPos & (4 | 8)) ? 12 : 16; - g_WinInfo.y += (flagDefaultPos & 32) ? 4 : 8; - g_WinInfo.cy -= (flagDefaultPos & (16 | 32)) ? 12 : 16; - g_WinInfo.max = 1; - } - } - else if (flagDefaultPos == 2 || flagDefaultPos == 3) // NP3 default window position - { - SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); - g_WinInfo.y = rc.top + 16; - g_WinInfo.cy = rc.bottom - rc.top - 32; - g_WinInfo.cx = (rc.right - rc.left)/2; //min(rc.right - rc.left - 32, g_WinInfo.cy); - g_WinInfo.x = (flagDefaultPos == 3) ? rc.left + 16 : rc.right - g_WinInfo.cx - 16; - } - else { // fit window into working area of current monitor - - MONITORINFO mi; - mi.cbSize = sizeof(mi); - HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST); - GetMonitorInfo(hMonitor, &mi); - - g_WinInfo.x += (mi.rcWork.left - mi.rcMonitor.left); - g_WinInfo.y += (mi.rcWork.top - mi.rcMonitor.top); - if (g_WinInfo.x < mi.rcWork.left) - g_WinInfo.x = mi.rcWork.left; - if (g_WinInfo.y < mi.rcWork.top) - g_WinInfo.y = mi.rcWork.top; - if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right) { - g_WinInfo.x -= (g_WinInfo.x + g_WinInfo.cx - mi.rcWork.right); - if (g_WinInfo.x < mi.rcWork.left) - g_WinInfo.x = mi.rcWork.left; - if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right) - g_WinInfo.cx = mi.rcWork.right - g_WinInfo.x; - } - if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom) { - g_WinInfo.y -= (g_WinInfo.y + g_WinInfo.cy - mi.rcWork.bottom); - if (g_WinInfo.y < mi.rcWork.top) - g_WinInfo.y = mi.rcWork.top; - if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom) - g_WinInfo.cy = mi.rcWork.bottom - g_WinInfo.y; - } - SetRect(&rc, g_WinInfo.x, g_WinInfo.y, g_WinInfo.x + g_WinInfo.cx, g_WinInfo.y + g_WinInfo.cy); - - RECT rc2; - if (!IntersectRect(&rc2, &rc, &mi.rcWork)) { - g_WinInfo.y = mi.rcWork.top + 16; - g_WinInfo.cy = mi.rcWork.bottom - mi.rcWork.top - 32; - g_WinInfo.cx = min(mi.rcWork.right - mi.rcWork.left - 32, g_WinInfo.cy); - g_WinInfo.x = mi.rcWork.right - g_WinInfo.cx - 16; - } - } -} - - - -//============================================================================= -// -// InitInstance() -// -// -HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow) -{ - g_hwndMain = NULL; - - _InitWindowPosition(g_hwndMain); - - g_hwndMain = CreateWindowEx( - 0, - wchWndClass, - L"Notepad3", - WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, - g_WinInfo.x, - g_WinInfo.y, - g_WinInfo.cx, - g_WinInfo.cy, - NULL, - NULL, - hInstance, - NULL); - - if (g_WinInfo.max) - nCmdShow = SW_SHOWMAXIMIZED; - - if ((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1) - SetWindowPos(g_hwndMain,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); - - if (bTransparentMode) - SetWindowTransparentMode(g_hwndMain,true); - - // Current file information -- moved in front of ShowWindow() - FileLoad(true,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); - - if (!flagStartAsTrayIcon) { - ShowWindow(g_hwndMain,nCmdShow); - UpdateWindow(g_hwndMain); - } - else { - ShowWindow(g_hwndMain,SW_HIDE); // trick ShowWindow() - ShowNotifyIcon(g_hwndMain,true); - } - - // Source Encoding - if (lpEncodingArg) - Encoding_SrcCmdLn(Encoding_MatchW(lpEncodingArg)); - - // Pathname parameter - if (flagBufferFile || (lpFileArg /*&& !flagNewFromClipboard*/)) - { - bool bOpened = false; - - // Open from Directory - if (!flagBufferFile && PathIsDirectory(lpFileArg)) { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), lpFileArg)) - bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); - } - else { - LPCWSTR lpFileToOpen = flagBufferFile ? szBufferFile : lpFileArg; - bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, lpFileToOpen); - if (bOpened) { - if (flagBufferFile) { - if (lpFileArg) { - InstallFileWatching(NULL); // Terminate file watching - StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),lpFileArg); - InstallFileWatching(g_wchCurFile); - } - else - StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),L""); - - if (!flagLexerSpecified) - Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); - - _SetDocumentModified(true); - UpdateLineNumberWidth(); - - // check for temp file and delete - if (flagIsElevated && PathFileExists(szBufferFile)) { - DeleteFile(szBufferFile); - } - } - if (flagJumpTo) { // Jump to position - EditJumpTo(g_hwndEdit,iInitialLine,iInitialColumn); - } - } - } - if (lpFileArg) { - FreeMem(lpFileArg); - lpFileArg = NULL; - } - if (bOpened) { - if (flagChangeNotify == 1) { - iFileWatchingMode = 0; - bResetFileWatching = true; - InstallFileWatching(g_wchCurFile); - } - else if (flagChangeNotify == 2) { - iFileWatchingMode = 2; - bResetFileWatching = true; - InstallFileWatching(g_wchCurFile); - } - } - } - else { - if (Encoding_SrcCmdLn(CPI_GET) != CPI_NONE) { - Encoding_Current(Encoding_SrcCmdLn(CPI_GET)); - Encoding_HasChanged(Encoding_SrcCmdLn(CPI_GET)); - } - } - - // reset - Encoding_SrcCmdLn(CPI_NONE); - flagQuietCreate = 0; - fKeepTitleExcerpt = 0; - - // undo / redo selections - if (UndoRedoSelectionUTArray != NULL) { - utarray_clear(UndoRedoSelectionUTArray); - utarray_free(UndoRedoSelectionUTArray); - UndoRedoSelectionUTArray = NULL; - } - utarray_new(UndoRedoSelectionUTArray, &UndoRedoSelection_icd); - utarray_reserve(UndoRedoSelectionUTArray,256); - - // Check for /c [if no file is specified] -- even if a file is specified - /*else */if (flagNewFromClipboard) { - if (SendMessage(g_hwndEdit, SCI_CANPASTE, 0, 0)) { - bool bAutoIndent2 = bAutoIndent; - bAutoIndent = 0; - EditJumpTo(g_hwndEdit, -1, 0); - SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); - if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) { - SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); - } - SendMessage(g_hwndEdit, SCI_PASTE, 0, 0); - SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); - SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); - bAutoIndent = bAutoIndent2; - if (flagJumpTo) - EditJumpTo(g_hwndEdit, iInitialLine, iInitialColumn); - else - EditEnsureSelectionVisible(g_hwndEdit); - } - } - - // Encoding - if (0 != flagSetEncoding) { - SendMessage( - g_hwndMain, - WM_COMMAND, - MAKELONG(IDM_ENCODING_ANSI + flagSetEncoding -1,1), - 0); - flagSetEncoding = 0; - } - - // EOL mode - if (0 != flagSetEOLMode) { - SendMessage( - g_hwndMain, - WM_COMMAND, - MAKELONG(IDM_LINEENDINGS_CRLF + flagSetEOLMode -1,1), - 0); - flagSetEOLMode = 0; - } - - // Match Text - if (flagMatchText && lpMatchArg) { - if (lstrlen(lpMatchArg) && SendMessage(g_hwndEdit,SCI_GETLENGTH,0,0)) { - - WideCharToMultiByteStrg(Encoding_SciCP,lpMatchArg,g_efrData.szFind); - - if (flagMatchText & 4) - g_efrData.fuFlags |= (SCFIND_REGEXP | SCFIND_POSIX); - else if (flagMatchText & 8) - g_efrData.bTransformBS = true; - - if (flagMatchText & 2) { - if (!flagJumpTo) { SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); } - EditFindPrev(g_hwndEdit,&g_efrData,false,false); - EditEnsureSelectionVisible(g_hwndEdit); - } - else { - if (!flagJumpTo) { SendMessage(g_hwndEdit, SCI_DOCUMENTSTART, 0, 0); } - EditFindNext(g_hwndEdit,&g_efrData,false,false); - EditEnsureSelectionVisible(g_hwndEdit); - } - } - LocalFree(lpMatchArg); - lpMatchArg = NULL; - } - - // Check for Paste Board option -- after loading files - if (flagPasteBoard) { - bLastCopyFromMe = true; - hwndNextCBChain = SetClipboardViewer(g_hwndMain); - uidsAppTitle = IDS_APPTITLE_PASTEBOARD; - bLastCopyFromMe = false; - - dwLastCopyTime = 0; - SetTimer(g_hwndMain,ID_PASTEBOARDTIMER,100,PasteBoardTimer); - } - - // check if a lexer was specified from the command line - if (flagLexerSpecified) { - if (lpSchemeArg) { - Style_SetLexerFromName(g_hwndEdit,g_wchCurFile,lpSchemeArg); - LocalFree(lpSchemeArg); - } - else if (iInitialLexer >=0 && iInitialLexer < NUMLEXERS) - Style_SetLexerFromID(g_hwndEdit,iInitialLexer); - flagLexerSpecified = 0; - } - - // If start as tray icon, set current filename as tooltip - if (flagStartAsTrayIcon) - SetNotifyIconTitle(g_hwndMain); - - iReplacedOccurrences = 0; - iMarkOccurrencesCount = 0; - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - - // print file immediately and quit - if (flagPrintFileAndLeave) - { - SHFILEINFO shfi; - WCHAR *pszTitle; - WCHAR tchUntitled[32] = { L'\0' }; - WCHAR tchPageFmt[32] = { L'\0' }; - - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - SHGetFileInfo2(g_wchCurFile, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(SHFILEINFO), SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); - pszTitle = shfi.szDisplayName; - } - else { - GetString(IDS_UNTITLED, tchUntitled, COUNTOF(tchUntitled)); - pszTitle = tchUntitled; - } - - GetString(IDS_PRINT_PAGENUM, tchPageFmt, COUNTOF(tchPageFmt)); - - if (!EditPrint(g_hwndEdit, pszTitle, tchPageFmt)) - MsgBox(MBWARN, IDS_PRINT_ERROR, pszTitle); - - PostMessage(g_hwndMain, WM_CLOSE, 0, 0); - } - - UNUSED(pszCmdLine); - - return(g_hwndMain); -} - - -//============================================================================= -// -// MainWndProc() -// -// Messages are distributed to the MsgXXX-handlers -// -// -LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - static bool bAltKeyIsDown = false; - - switch(umsg) - { - // Quickly handle painting and sizing messages, found in ScintillaWin.cxx - // Cool idea, don't know if this has any effect... ;-) - case WM_MOVE: - case WM_MOUSEACTIVATE: - case WM_NCHITTEST: - case WM_NCCALCSIZE: - case WM_NCPAINT: - case WM_PAINT: - case WM_ERASEBKGND: - case WM_NCMOUSEMOVE: - case WM_NCLBUTTONDOWN: - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - return DefWindowProc(hwnd,umsg,wParam,lParam); - - case WM_SYSKEYDOWN: - if (GetAsyncKeyState(VK_MENU) & SHRT_MIN) // ALT-KEY DOWN - { - if (!bAltKeyIsDown) { - bAltKeyIsDown = true; - if (!bDenyVirtualSpaceAccess) { - SciCall_SetVirtualSpaceOptions(SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE); - } - } - } - return DefWindowProc(hwnd, umsg, wParam, lParam); - - case WM_SYSKEYUP: - if (!(GetAsyncKeyState(VK_MENU) & SHRT_MIN)) // NOT ALT-KEY DOWN - { - if (bAltKeyIsDown) { - bAltKeyIsDown = false; - SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION); - } - } - return DefWindowProc(hwnd, umsg, wParam, lParam); - - - case WM_CREATE: - return MsgCreate(hwnd,wParam,lParam); - - case WM_DESTROY: - case WM_ENDSESSION: - MsgEndSession(hwnd,umsg); - break; - - case WM_CLOSE: - if (FileSave(false,true,false,false)) - DestroyWindow(hwnd); - break; - - case WM_QUERYENDSESSION: - if (FileSave(false,true,false,false)) - return true; - else - return false; - - // Reinitialize theme-dependent values and resize windows - case WM_THEMECHANGED: - MsgThemeChanged(hwnd,wParam,lParam); - break; - - // update Scintilla colors - case WM_SYSCOLORCHANGE: - UpdateLineNumberWidth(); - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(0); - UpdateVisibleUrlHotspot(0); - return DefWindowProc(hwnd,umsg,wParam,lParam); - - - case WM_TIMER: - { - // The KillTimer function does not remove WM_TIMER messages already posted to the message queue. - if (LOWORD(wParam) == IDT_TIMER_MAIN_MRKALL) - { - if (TEST_AND_RESET(BIT_TIMER_MARK_OCC)) { - KillTimer(hwnd, IDT_TIMER_MAIN_MRKALL); - if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS)) - { - EditMarkAllOccurrences(); - TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done - } - } - return true; - } - else if (LOWORD(wParam) == IDT_TIMER_UPDATE_HOTSPOT) - { - if (TEST_AND_RESET(BIT_TIMER_UPDATE_HYPER)) { - KillTimer(hwnd, IDT_TIMER_UPDATE_HOTSPOT); - if (!TEST_AND_SET(BIT_UPDATE_HYPER_IN_PROGRESS)) - { - EditUpdateVisibleUrlHotspot(bHyperlinkHotspot); - TEST_AND_RESET(BIT_UPDATE_HYPER_IN_PROGRESS); // done - } - } - return true; - } - } - break; - - - case WM_SIZE: - MsgSize(hwnd,wParam,lParam); - break; - - case WM_SETFOCUS: - SetFocus(g_hwndEdit); - //UpdateToolbar(); - //UpdateStatusbar(); - //UpdateLineNumberWidth(); - //if (bPendingChangeNotify) - // PostMessage(hwnd,WM_CHANGENOTIFY,0,0); - break; - - case WM_DROPFILES: - MsgDropFiles(hwnd, wParam, lParam); - break; - - case WM_COPYDATA: - return MsgCopyData(hwnd, wParam, lParam); - - case WM_CONTEXTMENU: - return MsgContextMenu(hwnd, umsg, wParam, lParam); - - case WM_INITMENU: - MsgInitMenu(hwnd,wParam,lParam); - break; - - case WM_NOTIFY: - return MsgNotify(hwnd,wParam,lParam); - - //case WM_PARENTNOTIFY: - // if (LOWORD(wParam) & WM_DESTROY) { - // if (IsWindow(hDlgFindReplace) && (hDlgFindReplace == (HWND)lParam)) { - // hDlgFindReplace = NULL; - // } - // } - // break; - - case WM_COMMAND: - return MsgCommand(hwnd,wParam,lParam); - - case WM_SYSCOMMAND: - return MsgSysCommand(hwnd, umsg, wParam, lParam); - - case WM_CHANGENOTIFY: - MsgChangeNotify(hwnd, wParam, lParam); - break; - - //// This message is posted before Notepad3 reactivates itself - //case WM_CHANGENOTIFYCLEAR: - // bPendingChangeNotify = false; - // break; - - case WM_DRAWCLIPBOARD: - if (!bLastCopyFromMe) - dwLastCopyTime = GetTickCount(); - else - bLastCopyFromMe = false; - - if (hwndNextCBChain) - SendMessage(hwndNextCBChain,WM_DRAWCLIPBOARD,wParam,lParam); - break; - - case WM_CHANGECBCHAIN: - if ((HWND)wParam == hwndNextCBChain) - hwndNextCBChain = (HWND)lParam; - if (hwndNextCBChain) - SendMessage(hwndNextCBChain,WM_CHANGECBCHAIN,lParam,wParam); - break; - - case WM_TRAYMESSAGE: - return MsgTrayMessage(hwnd, wParam, lParam); - - default: - if (umsg == msgTaskbarCreated) { - if (!IsWindowVisible(hwnd)) - ShowNotifyIcon(hwnd,true); - SetNotifyIconTitle(hwnd); - } - return DefWindowProc(hwnd, umsg, wParam, lParam); - } - return 0; // swallow message -} - - - -//============================================================================= -// -// SetWordWrapping() - WordWrapSettings -// -static void __fastcall _SetWordWrapping(HWND hwndEditCtrl) -{ - // Word wrap - if (bWordWrap) - SendMessage(hwndEditCtrl, SCI_SETWRAPMODE, (iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR, 0); - else - SendMessage(hwndEditCtrl, SCI_SETWRAPMODE, SC_WRAP_NONE, 0); - - if (iWordWrapIndent == 5) - SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_SAME, 0); - else if (iWordWrapIndent == 6) - SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_INDENT, 0); - else { - int i = 0; - switch (iWordWrapIndent) { - case 1: i = 1; break; - case 2: i = 2; break; - case 3: i = (g_iIndentWidth) ? 1 * g_iIndentWidth : 1 * g_iTabWidth; break; - case 4: i = (g_iIndentWidth) ? 2 * g_iIndentWidth : 2 * g_iTabWidth; break; - } - SendMessage(hwndEditCtrl, SCI_SETWRAPSTARTINDENT, i, 0); - SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_FIXED, 0); - } - - if (bShowWordWrapSymbols) { - int wrapVisualFlags = 0; - int wrapVisualFlagsLocation = 0; - if (iWordWrapSymbols == 0) - iWordWrapSymbols = 22; - switch (iWordWrapSymbols % 10) { - case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break; - case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break; - } - switch (((iWordWrapSymbols % 100) - (iWordWrapSymbols % 10)) / 10) { - case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break; - case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break; - } - SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0); - SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0); - } - else { - SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGS, 0, 0); - } -} - - -//============================================================================= -// -// InitializeSciEditCtrl() -// -static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl) -{ - Encoding_Current(g_iDefaultNewFileEncoding); - - // general setup - SendMessage(hwndEditCtrl, SCI_SETCODEPAGE, (WPARAM)SC_CP_UTF8, 0); // fixed internal UTF-8 - SendMessage(hwndEditCtrl, SCI_SETEOLMODE, SC_EOL_CRLF, 0); - SendMessage(hwndEditCtrl, SCI_SETPASTECONVERTENDINGS, true, 0); - SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK,/*SC_MODEVENTMASKALL*/SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_CONTAINER, 0); - SendMessage(hwndEditCtrl, SCI_USEPOPUP, false, 0); - SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTH, 1, 0); - SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTHTRACKING, true, 0); - SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, true, 0); - SendMessage(hwndEditCtrl, SCI_SETMOUSESELECTIONRECTANGULARSWITCH, true, 0); - SendMessage(hwndEditCtrl, SCI_SETMULTIPLESELECTION, false, 0); - SendMessage(hwndEditCtrl, SCI_SETADDITIONALSELECTIONTYPING, false, 0); - SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSBLINK, true, 0); - SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0); - SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0); - SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0); - - // 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); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_NEXT + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARADOWNEXTEND); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_PRIOR + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARAUPEXTEND); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_HOME + (0 << 16)), SCI_VCHOMEWRAP); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_END + (0 << 16)), SCI_LINEENDWRAP); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_HOME + (SCMOD_SHIFT << 16)), SCI_VCHOMEWRAPEXTEND); - SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_END + (SCMOD_SHIFT << 16)), SCI_LINEENDWRAPEXTEND); - - // set indicator styles (foreground and alpha maybe overridden by style settings) - SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_MARK_OCCURANCE, INDIC_ROUNDBOX); - SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_MARK_OCCURANCE, RGB(0x00, 0x00, 0xFF)); - SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_MARK_OCCURANCE, 100); - SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MARK_OCCURANCE, 100); - - SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_MATCH_BRACE, INDIC_FULLBOX); - SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_MATCH_BRACE, RGB(0x00, 0xFF, 0x00)); - SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_MATCH_BRACE, 120); - SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MATCH_BRACE, 120); - - SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_BAD_BRACE, INDIC_FULLBOX); - SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_BAD_BRACE, RGB(0xFF, 0x00, 0x00)); - SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_BAD_BRACE, 120); - SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_BAD_BRACE, 120); - - // paste into rectangular selection - SendMessage(hwndEditCtrl, SCI_SETMULTIPASTE, SC_MULTIPASTE_EACH, 0); - - // No SC_AUTOMATICFOLD_CLICK, performed by - SendMessage(hwndEditCtrl, SCI_SETAUTOMATICFOLD, (WPARAM)(SC_AUTOMATICFOLD_SHOW | SC_AUTOMATICFOLD_CHANGE), 0); - - // Properties - SendMessage(hwndEditCtrl, SCI_SETCARETSTICKY, SC_CARETSTICKY_OFF, 0); - //SendMessage(hwndEditCtrl,SCI_SETCARETSTICKY,SC_CARETSTICKY_WHITESPACE,0); - - #define _CARET_SYMETRY CARET_EVEN /// CARET_EVEN or 0 - if (iCurrentLineHorizontalSlop > 0) - SendMessage(hwndEditCtrl, SCI_SETXCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), iCurrentLineHorizontalSlop); - else - SendMessage(hwndEditCtrl, SCI_SETXCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), (LPARAM)0); - - if (iCurrentLineVerticalSlop > 0) - SendMessage(hwndEditCtrl, SCI_SETYCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), iCurrentLineVerticalSlop); - else - SendMessage(hwndEditCtrl, SCI_SETYCARETPOLICY, (WPARAM)(_CARET_SYMETRY), 0); - - SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION), 0); - SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, (WPARAM)((bScrollPastEOF) ? 0 : 1), 0); - - // Tabs - SendMessage(hwndEditCtrl, SCI_SETUSETABS, !g_bTabsAsSpaces, 0); - SendMessage(hwndEditCtrl, SCI_SETTABINDENTS, g_bTabIndents, 0); - SendMessage(hwndEditCtrl, SCI_SETBACKSPACEUNINDENTS, bBackspaceUnindents, 0); - SendMessage(hwndEditCtrl, SCI_SETTABWIDTH, g_iTabWidth, 0); - SendMessage(hwndEditCtrl, SCI_SETINDENT, g_iIndentWidth, 0); - - // Indent Guides - Style_SetIndentGuides(hwndEditCtrl, bShowIndentGuides); - - // Word Wrap - _SetWordWrapping(hwndEditCtrl); - - // Long Lines - if (bMarkLongLines) - SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, (iLongLineMode == EDGE_LINE) ? EDGE_LINE : EDGE_BACKGROUND, 0); - else - SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, EDGE_NONE, 0); - - SendMessage(hwndEditCtrl, SCI_SETEDGECOLUMN, iLongLinesLimit, 0); - - // Nonprinting characters - SendMessage(hwndEditCtrl, SCI_SETVIEWWS, (bViewWhiteSpace) ? SCWS_VISIBLEALWAYS : SCWS_INVISIBLE, 0); - SendMessage(hwndEditCtrl, SCI_SETVIEWEOL, bViewEOLs, 0); - - // word delimiter handling - EditInitWordDelimiter(hwndEditCtrl); - EditSetAccelWordNav(hwndEditCtrl, bAccelWordNavigation); - - // Init default values for printing - EditPrintInit(); - - //SciInitThemes(hwndEditCtrl); - - UpdateLineNumberWidth(); -} - - -//============================================================================= -// -// MsgCreate() - Handles WM_CREATE -// -// -LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam) -{ - - HINSTANCE hInstance = ((LPCREATESTRUCT)lParam)->hInstance; - - // Setup edit control - g_hwndEdit = CreateWindowEx( - WS_EX_CLIENTEDGE, - L"Scintilla", - NULL, - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, - 0, 0, 0, 0, - hwnd, - (HMENU)IDC_EDIT, - hInstance, - NULL); - - g_hScintilla = (HANDLE)SendMessage(g_hwndEdit, SCI_GETDIRECTPOINTER, 0, 0); - - _InitializeSciEditCtrl(g_hwndEdit); - - hwndEditFrame = CreateWindowEx( - WS_EX_CLIENTEDGE, - WC_LISTVIEW, - NULL, - WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, - 0,0,100,100, - hwnd, - (HMENU)IDC_EDITFRAME, - hInstance, - NULL); - - if (PrivateIsAppThemed()) { - - RECT rc, rc2; - - bIsAppThemed = true; - - SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE) & ~WS_EX_CLIENTEDGE); - SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); - - if (IsVista()) { - cxEditFrame = 0; - cyEditFrame = 0; - } - - else { - GetClientRect(hwndEditFrame,&rc); - GetWindowRect(hwndEditFrame,&rc2); - - cxEditFrame = ((rc2.right-rc2.left) - (rc.right-rc.left)) / 2; - cyEditFrame = ((rc2.bottom-rc2.top) - (rc.bottom-rc.top)) / 2; - } - } - else { - bIsAppThemed = false; - - cxEditFrame = 0; - cyEditFrame = 0; - } - - // Create Toolbar and Statusbar - CreateBars(hwnd,hInstance); - - // Window Initialization - - CreateWindow( - WC_STATIC, - NULL, - WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, - 0,0,10,10, - hwnd, - (HMENU)IDC_FILENAME, - hInstance, - NULL); - - SetDlgItemText(hwnd,IDC_FILENAME,g_wchCurFile); - - CreateWindow( - WC_STATIC, - NULL, - WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, - 10,10,10,10, - hwnd, - (HMENU)IDC_REUSELOCK, - hInstance, - NULL); - - SetDlgItemInt(hwnd,IDC_REUSELOCK,GetTickCount(),false); - - // Menu - //SetMenuDefaultItem(GetSubMenu(GetMenu(hwnd),0),0); - - // Drag & Drop - DragAcceptFiles(hwnd,true); - pDropTarget = RegisterDragAndDrop(hwnd, &cfDrpF, 1, WM_NULL, DropFilesProc, (void*)g_hwndEdit); - - // File MRU - g_pFileMRU = MRU_Create(L"Recent Files", MRU_NOCASE, MRU_ITEMSFILE); - MRU_Load(g_pFileMRU); - - g_pMRUfind = MRU_Create(L"Recent Find", (/*IsWindowsNT()*/true) ? MRU_UTF8 : 0, MRU_ITEMSFNDRPL); - MRU_Load(g_pMRUfind); - SetFindPattern(g_pMRUfind->pszItems[0]); - - g_pMRUreplace = MRU_Create(L"Recent Replace", (/*IsWindowsNT()*/true) ? MRU_UTF8 : 0, MRU_ITEMSFNDRPL); - MRU_Load(g_pMRUreplace); - - if (g_hwndEdit == NULL || hwndEditFrame == NULL || - g_hwndStatus == NULL || g_hwndToolbar == NULL || hwndReBar == NULL) - return(-1); - - UNUSED(wParam); - return(0); -} - - -//============================================================================= -// -// CreateBars() - Create Toolbar and Statusbar -// -// -void CreateBars(HWND hwnd,HINSTANCE hInstance) -{ - RECT rc; - - REBARINFO rbi; - REBARBANDINFO rbBand; - - BITMAP bmp; - HBITMAP hbmp, hbmpCopy = NULL; - HIMAGELIST himl; - WCHAR szTmp[MAX_PATH] = { L'\0' }; - bool bExternalBitmap = false; - - DWORD dwToolbarStyle = WS_TOOLBAR; - DWORD dwReBarStyle = WS_REBAR; - - bool bIsPrivAppThemed = PrivateIsAppThemed(); - - int i,n; - WCHAR tchDesc[256] = { L'\0' }; - WCHAR tchIndex[256] = { L'\0' }; - - WCHAR *pIniSection = NULL; - int cchIniSection = 0; - - if (bShowToolbar) - dwReBarStyle |= WS_VISIBLE; - - g_hwndToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,NULL,dwToolbarStyle, - 0,0,0,0,hwnd,(HMENU)IDC_TOOLBAR,hInstance,NULL); - - SendMessage(g_hwndToolbar,TB_BUTTONSTRUCTSIZE,(WPARAM)sizeof(TBBUTTON),0); - - // Add normal Toolbar Bitmap - hbmp = NULL; - if (StringCchLenW(tchToolbarBitmap,COUNTOF(tchToolbarBitmap))) - { - if (!SearchPath(NULL,tchToolbarBitmap,NULL,COUNTOF(szTmp),szTmp,NULL)) - StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmap); - hbmp = LoadImage(NULL,szTmp,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE); - } - - if (hbmp) - bExternalBitmap = true; - else { - LPWSTR toolBarIntRes = (iHighDpiToolBar > 0) ? MAKEINTRESOURCE(IDR_MAINWNDTB2) : MAKEINTRESOURCE(IDR_MAINWNDTB); - hbmp = LoadImage(hInstance, toolBarIntRes, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); - hbmpCopy = CopyImage(hbmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); - } - GetObject(hbmp,sizeof(BITMAP),&bmp); - if (!IsXP()) - BitmapMergeAlpha(hbmp,GetSysColor(COLOR_3DFACE)); - himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); - ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); - DeleteObject(hbmp); - SendMessage(g_hwndToolbar,TB_SETIMAGELIST,0,(LPARAM)himl); - - // Optionally add hot Toolbar Bitmap - hbmp = NULL; - if (StringCchLenW(tchToolbarBitmapHot,COUNTOF(tchToolbarBitmapHot))) - { - if (!SearchPath(NULL,tchToolbarBitmapHot,NULL,COUNTOF(szTmp),szTmp,NULL)) - StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmapHot); - - hbmp = LoadImage(NULL, szTmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); - if (hbmp) - { - GetObject(hbmp,sizeof(BITMAP),&bmp); - himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); - ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); - DeleteObject(hbmp); - SendMessage(g_hwndToolbar,TB_SETHOTIMAGELIST,0,(LPARAM)himl); - } - } - - // Optionally add disabled Toolbar Bitmap - hbmp = NULL; - if (StringCchLenW(tchToolbarBitmapDisabled,COUNTOF(tchToolbarBitmapDisabled))) - { - if (!SearchPath(NULL,tchToolbarBitmapDisabled,NULL,COUNTOF(szTmp),szTmp,NULL)) - StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmapDisabled); - - hbmp = LoadImage(NULL, szTmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); - if (hbmp) - { - GetObject(hbmp,sizeof(BITMAP),&bmp); - himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); - ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); - DeleteObject(hbmp); - SendMessage(g_hwndToolbar,TB_SETDISABLEDIMAGELIST,0,(LPARAM)himl); - bExternalBitmap = true; - } - } - - if (!bExternalBitmap) { - bool fProcessed = false; - if (flagToolbarLook == 1) - fProcessed = BitmapAlphaBlend(hbmpCopy,GetSysColor(COLOR_3DFACE),0x60); - else if (flagToolbarLook == 2 || (!IsXP() && flagToolbarLook == 0)) - fProcessed = BitmapGrayScale(hbmpCopy); - if (fProcessed && !IsXP()) - BitmapMergeAlpha(hbmpCopy,GetSysColor(COLOR_3DFACE)); - if (fProcessed) { - himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); - ImageList_AddMasked(himl,hbmpCopy,CLR_DEFAULT); - SendMessage(g_hwndToolbar,TB_SETDISABLEDIMAGELIST,0,(LPARAM)himl); - } - } - if (hbmpCopy) - DeleteObject(hbmpCopy); - - // Load toolbar labels - pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * 32 * 1024); - cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - LoadIniSection(L"Toolbar Labels",pIniSection,cchIniSection); - for (i = 0; i < COUNTOF(tbbMainWnd); i++) { - - if (tbbMainWnd[i].fsStyle == TBSTYLE_SEP) - continue; - - n = tbbMainWnd[i].iBitmap + 1; - StringCchPrintf(tchIndex,COUNTOF(tchIndex),L"%02i",n); - if (IniSectionGetString(pIniSection,tchIndex,L"",tchDesc,COUNTOF(tchDesc))) - { - tbbMainWnd[i].iString = SendMessage(g_hwndToolbar,TB_ADDSTRING,0,(LPARAM)tchDesc); - tbbMainWnd[i].fsStyle |= BTNS_AUTOSIZE | BTNS_SHOWTEXT; - } - else { - tbbMainWnd[i].fsStyle &= ~(BTNS_AUTOSIZE | BTNS_SHOWTEXT); - } - } - LocalFree(pIniSection); - - SendMessage(g_hwndToolbar,TB_SETEXTENDEDSTYLE,0, - SendMessage(g_hwndToolbar,TB_GETEXTENDEDSTYLE,0,0) | TBSTYLE_EX_MIXEDBUTTONS); - - SendMessage(g_hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd); - - if (Toolbar_SetButtons(g_hwndToolbar, IDT_FILE_NEW, tchToolbarButtons, tbbMainWnd, COUNTOF(tbbMainWnd)) == 0) { - SendMessage(g_hwndToolbar, TB_ADDBUTTONS, NUMINITIALTOOLS, (LPARAM)tbbMainWnd); - } - SendMessage(g_hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc); - //SendMessage(g_hwndToolbar,TB_SETINDENT,2,0); - - DWORD dwStatusbarStyle = WS_CHILD | WS_CLIPSIBLINGS; - - if (bShowStatusbar) - dwStatusbarStyle |= WS_VISIBLE; - - g_hwndStatus = CreateStatusWindow(dwStatusbarStyle,NULL,hwnd,IDC_STATUSBAR); - - // Create ReBar and add Toolbar - hwndReBar = CreateWindowEx(WS_EX_TOOLWINDOW,REBARCLASSNAME,NULL,dwReBarStyle, - 0,0,0,0,hwnd,(HMENU)IDC_REBAR,hInstance,NULL); - - rbi.cbSize = sizeof(REBARINFO); - rbi.fMask = 0; - rbi.himl = (HIMAGELIST)NULL; - SendMessage(hwndReBar,RB_SETBARINFO,0,(LPARAM)&rbi); - - rbBand.cbSize = sizeof(REBARBANDINFO); - rbBand.fMask = /*RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | */ - RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE /*| RBBIM_SIZE*/; - rbBand.fStyle = /*RBBS_CHILDEDGE |*//* RBBS_BREAK |*/ RBBS_FIXEDSIZE /*| RBBS_GRIPPERALWAYS*/; - if (bIsPrivAppThemed) - rbBand.fStyle |= RBBS_CHILDEDGE; - rbBand.hbmBack = NULL; - rbBand.lpText = L"Toolbar"; - rbBand.hwndChild = g_hwndToolbar; - rbBand.cxMinChild = (rc.right - rc.left) * COUNTOF(tbbMainWnd); - rbBand.cyMinChild = (rc.bottom - rc.top) + 2 * rc.top; - rbBand.cx = 0; - SendMessage(hwndReBar,RB_INSERTBAND,(WPARAM)-1,(LPARAM)&rbBand); - - SetWindowPos(hwndReBar,NULL,0,0,0,0,SWP_NOZORDER); - GetWindowRect(hwndReBar,&rc); - cyReBar = rc.bottom - rc.top; - - cyReBarFrame = bIsPrivAppThemed ? 0 : 2; -} - - -//============================================================================= -// -// MsgEndSession() - Handle WM_ENDSESSION,WM_DESTROY -// -// -void MsgEndSession(HWND hwnd, UINT umsg) -{ - static bool bShutdownOK = false; - - if (!bShutdownOK) { - - // Terminate file watching - InstallFileWatching(NULL); - - // GetWindowPlacement - g_WinInfo = GetMyWindowPlacement(hwnd, NULL); - - DragAcceptFiles(hwnd, false); - RevokeDragAndDrop(pDropTarget); - - // Terminate clipboard watching - if (flagPasteBoard) { - KillTimer(hwnd, ID_PASTEBOARDTIMER); - ChangeClipboardChain(hwnd, hwndNextCBChain); - } - - // Destroy find / replace dialog - if (IsWindow(g_hwndDlgFindReplace)) - DestroyWindow(g_hwndDlgFindReplace); - - // Destroy customize schemes - if (IsWindow(g_hwndDlgCustomizeSchemes)) - DestroyWindow(g_hwndDlgCustomizeSchemes); - - // call SaveSettings() when g_hwndToolbar is still valid - SaveSettings(false); - - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) != 0) { - - // Cleanup unwanted MRU's - if (!bSaveRecentFiles) { - MRU_Empty(g_pFileMRU); - MRU_Save(g_pFileMRU); - } - else - MRU_MergeSave(g_pFileMRU, true, flagRelativeFileMRU, flagPortableMyDocs); - - MRU_Destroy(g_pFileMRU); - - if (!bSaveFindReplace) { - MRU_Empty(g_pMRUfind); - MRU_Empty(g_pMRUreplace); - MRU_Save(g_pMRUfind); - MRU_Save(g_pMRUreplace); - } - else { - MRU_MergeSave(g_pMRUfind, false, false, false); - MRU_MergeSave(g_pMRUreplace, false, false, false); - } - MRU_Destroy(g_pMRUfind); - MRU_Destroy(g_pMRUreplace); - } - - // Remove tray icon if necessary - ShowNotifyIcon(hwnd, false); - - bShutdownOK = true; - } - - if (umsg == WM_DESTROY) - PostQuitMessage(0); -} - - -//============================================================================= -// -// MsgThemeChanged() - Handle WM_THEMECHANGED -// -// -void MsgThemeChanged(HWND hwnd,WPARAM wParam,LPARAM lParam) -{ - RECT rc, rc2; - HINSTANCE hInstance = (HINSTANCE)(INT_PTR)GetWindowLongPtr(hwnd,GWLP_HINSTANCE); - - // reinitialize edit frame - - if (PrivateIsAppThemed()) { - bIsAppThemed = true; - - SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE) & ~WS_EX_CLIENTEDGE); - SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE); - - if (IsVista()) { - cxEditFrame = 0; - cyEditFrame = 0; - } - - else { - SetWindowPos(hwndEditFrame,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); - GetClientRect(hwndEditFrame,&rc); - GetWindowRect(hwndEditFrame,&rc2); - - cxEditFrame = ((rc2.right-rc2.left) - (rc.right-rc.left)) / 2; - cyEditFrame = ((rc2.bottom-rc2.top) - (rc.bottom-rc.top)) / 2; - } - } - - else { - bIsAppThemed = false; - - SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,WS_EX_CLIENTEDGE|GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE)); - SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); - - cxEditFrame = 0; - cyEditFrame = 0; - } - - // recreate toolbar and statusbar - Toolbar_GetButtons(g_hwndToolbar,IDT_FILE_NEW,tchToolbarButtons,COUNTOF(tchToolbarButtons)); - - DestroyWindow(g_hwndToolbar); - DestroyWindow(hwndReBar); - DestroyWindow(g_hwndStatus); - CreateBars(hwnd,hInstance); - - GetClientRect(hwnd,&rc); - SendMessage(hwnd,WM_SIZE,SIZE_RESTORED,MAKELONG(rc.right,rc.bottom)); - - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(0); - EditUpdateUrlHotspots(g_hwndEdit, 0, SciCall_GetTextLength(), bHyperlinkHotspot); - EditFinalizeStyling(g_hwndEdit, -1); - - UNUSED(lParam); - UNUSED(wParam); - UNUSED(hwnd); -} - - -//============================================================================= -// -// MsgSize() - Handles WM_SIZE -// -// -void MsgSize(HWND hwnd,WPARAM wParam,LPARAM lParam) -{ - - RECT rc; - int x,y,cx,cy; - HDWP hdwp; - - if (wParam == SIZE_MINIMIZED) - return; - - x = 0; - y = 0; - - cx = LOWORD(lParam); - cy = HIWORD(lParam); - - if (bShowToolbar) - { -/* SendMessage(g_hwndToolbar,WM_SIZE,0,0); - GetWindowRect(g_hwndToolbar,&rc); - y = (rc.bottom - rc.top); - cy -= (rc.bottom - rc.top);*/ - - //SendMessage(g_hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc); - SetWindowPos(hwndReBar,NULL,0,0,LOWORD(lParam),cyReBar,SWP_NOZORDER); - // the ReBar automatically sets the correct height - // calling SetWindowPos() with the height of one toolbar button - // causes the control not to temporarily use the whole client area - // and prevents flickering - - //GetWindowRect(hwndReBar,&rc); - y = cyReBar + cyReBarFrame; // define - cy -= cyReBar + cyReBarFrame; // border - } - - if (bShowStatusbar) - { - SendMessage(g_hwndStatus,WM_SIZE,0,0); - GetWindowRect(g_hwndStatus,&rc); - cy -= (rc.bottom - rc.top); - } - - hdwp = BeginDeferWindowPos(2); - - DeferWindowPos(hdwp,hwndEditFrame,NULL,x,y,cx,cy, - SWP_NOZORDER | SWP_NOACTIVATE); - - DeferWindowPos(hdwp,g_hwndEdit,NULL,x+cxEditFrame,y+cyEditFrame, - cx-2*cxEditFrame,cy-2*cyEditFrame, - SWP_NOZORDER | SWP_NOACTIVATE); - - EndDeferWindowPos(hdwp); - - // Statusbar width - int aWidth[7]; - aWidth[STATUS_DOCPOS] = max(100,min(cx/3, StatusCalcPaneWidth(g_hwndStatus, - L" Ln 9'999'999 : 9'999'999 Col 9'999'999:999 / 999 Sel 9'999'999 (999 Bytes) SelLn 9'999'999 Occ 9'999'999 "))); - aWidth[STATUS_DOCSIZE] = aWidth[STATUS_DOCPOS] + StatusCalcPaneWidth(g_hwndStatus,L" 9999 Bytes [UTF-8] "); - aWidth[STATUS_CODEPAGE] = aWidth[STATUS_DOCSIZE] + StatusCalcPaneWidth(g_hwndStatus,L" Unicode (UTF-8) Signature "); - aWidth[STATUS_EOLMODE] = aWidth[STATUS_CODEPAGE] + StatusCalcPaneWidth(g_hwndStatus,L" CR+LF "); - aWidth[STATUS_OVRMODE] = aWidth[STATUS_EOLMODE] + StatusCalcPaneWidth(g_hwndStatus,L" OVR "); - aWidth[STATUS_2ND_DEF] = aWidth[STATUS_OVRMODE] + StatusCalcPaneWidth(g_hwndStatus, L" 2ND "); - aWidth[STATUS_LEXER] = -1; - - - SendMessage(g_hwndStatus,SB_SETPARTS,COUNTOF(aWidth),(LPARAM)aWidth); - - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - - UNUSED(hwnd); - UNUSED(lParam); -} - - - -//============================================================================= -// -// MsgDropFiles() - Handles WM_DROPFILES -// -// -void MsgDropFiles(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - WCHAR szBuf[MAX_PATH + 40]; - HDROP hDrop = (HDROP)wParam; - - // Reset Change Notify - //bPendingChangeNotify = false; - - if (IsIconic(hwnd)) - ShowWindow(hwnd, SW_RESTORE); - - //SetForegroundWindow(hwnd); - - DragQueryFile(hDrop, 0, szBuf, COUNTOF(szBuf)); - - if (PathIsDirectory(szBuf)) { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), szBuf)) - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); - } - else if (PathFileExists(szBuf)) - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szBuf); - else - // Windows Bug: wParam (HDROP) pointer is corrupted if dropped from 32-bit App - MsgBox(MBWARN, IDS_DROP_NO_FILE); - - if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) - MsgBox(MBWARN, IDS_ERR_DROP); - - DragFinish(hDrop); - - UNUSED(lParam); -} - - - -//============================================================================= -// -// DropFilesProc() - Handles DROPFILES -// -// -static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyState, POINTL pt, void *pUserData) -{ - DWORD dwEffect = DROPEFFECT_NONE; - - //HWND hEditWnd = (HWND)pUserData; - UNUSED(pUserData); - - if (cf == CF_HDROP) - { - WCHAR szBuf[MAX_PATH + 40]; - HDROP hDrop = (HDROP)hData; - - if (IsIconic(hWnd)) - ShowWindow(hWnd, SW_RESTORE); - - DragQueryFile(hDrop, 0, szBuf, COUNTOF(szBuf)); - - if (PathIsDirectory(szBuf)) { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - if (OpenFileDlg(hWnd, tchFile, COUNTOF(tchFile), szBuf)) - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); - } - else - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szBuf); - - if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) - MsgBox(MBWARN, IDS_ERR_DROP); - - dwEffect = DROPEFFECT_COPY; - } - - UNUSED(dwKeyState); - UNUSED(pt); - - return dwEffect; -} - - -//============================================================================= -// -// MsgCopyData() - Handles WM_COPYDATA -// -// -LRESULT MsgCopyData(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; - - // Reset Change Notify - //bPendingChangeNotify = false; - - SetDlgItemInt(hwnd, IDC_REUSELOCK, GetTickCount(), false); - - if (pcds->dwData == DATA_NOTEPAD3_PARAMS) { - LPnp3params params = LocalAlloc(LPTR, pcds->cbData); - CopyMemory(params, pcds->lpData, pcds->cbData); - - if (params->flagLexerSpecified) - flagLexerSpecified = 1; - - if (params->flagQuietCreate) - flagQuietCreate = 1; - - if (params->flagFileSpecified) { - - bool bOpened = false; - Encoding_SrcCmdLn(params->iSrcEncoding); - - if (PathIsDirectory(¶ms->wchData)) { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), ¶ms->wchData)) - bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); - } - - else - bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, ¶ms->wchData); - - if (bOpened) { - - if (params->flagChangeNotify == 1) { - iFileWatchingMode = 0; - bResetFileWatching = true; - InstallFileWatching(g_wchCurFile); - } - else if (params->flagChangeNotify == 2) { - iFileWatchingMode = 2; - bResetFileWatching = true; - InstallFileWatching(g_wchCurFile); - } - - if (0 != params->flagSetEncoding) { - flagSetEncoding = params->flagSetEncoding; - SendMessage( - hwnd, - WM_COMMAND, - MAKELONG(IDM_ENCODING_ANSI + flagSetEncoding - 1, 1), - 0); - flagSetEncoding = 0; - } - - if (0 != params->flagSetEOLMode) { - flagSetEOLMode = params->flagSetEOLMode; - SendMessage(g_hwndMain, WM_COMMAND, MAKELONG(IDM_LINEENDINGS_CRLF + flagSetEOLMode - 1, 1), 0); - flagSetEOLMode = 0; - } - - if (params->flagLexerSpecified) { - if (params->iInitialLexer < 0) { - WCHAR wchExt[32] = L"."; - StringCchCopyN(CharNext(wchExt), 32, StrEnd(¶ms->wchData) + 1, 31); - Style_SetLexerFromName(g_hwndEdit, ¶ms->wchData, wchExt); - } - else if (params->iInitialLexer >= 0 && params->iInitialLexer < NUMLEXERS) - Style_SetLexerFromID(g_hwndEdit, params->iInitialLexer); - } - - if (params->flagTitleExcerpt) { - StringCchCopyN(szTitleExcerpt, COUNTOF(szTitleExcerpt), StrEnd(¶ms->wchData) + 1, COUNTOF(szTitleExcerpt)); - } - } - // reset - Encoding_SrcCmdLn(CPI_NONE); - } - - if (params->flagJumpTo) { - if (params->iInitialLine == 0) - params->iInitialLine = 1; - EditJumpTo(g_hwndEdit, params->iInitialLine, params->iInitialColumn); - } - - flagLexerSpecified = 0; - flagQuietCreate = 0; - - LocalFree(params); - - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - - } - - UNUSED(wParam); - return true; -} - -//============================================================================= -// -// MsgContextMenu() - Handles WM_CONTEXTMENU -// -// -LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) -{ - HMENU hmenu; - int imenu = 0; - POINT pt; - int nID = GetDlgCtrlID((HWND)wParam); - - if ((nID != IDC_EDIT) && (nID != IDC_STATUSBAR) && - (nID != IDC_REBAR) && (nID != IDC_TOOLBAR)) - return DefWindowProc(hwnd, umsg, wParam, lParam); - - hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); - //SetMenuDefaultItem(GetSubMenu(hmenu,1),0,false); - - pt.x = (int)(short)LOWORD(lParam); - pt.y = (int)(short)HIWORD(lParam); - - switch (nID) { - case IDC_EDIT: - { - if (SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0) && (pt.x != -1) && (pt.y != -1)) { - DocPos iNewPos; - POINT ptc; - ptc.x = pt.x; ptc.y = pt.y; - ScreenToClient(g_hwndEdit, &ptc); - iNewPos = (DocPos)SendMessage(g_hwndEdit, SCI_POSITIONFROMPOINT, (WPARAM)ptc.x, (LPARAM)ptc.y); - EditSelectEx(g_hwndEdit, iNewPos, iNewPos, -1, -1); - } - - if (pt.x == -1 && pt.y == -1) { - DocPos iCurrentPos = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); - pt.x = (LONG)SendMessage(g_hwndEdit, SCI_POINTXFROMPOSITION, 0, (LPARAM)iCurrentPos); - pt.y = (LONG)SendMessage(g_hwndEdit, SCI_POINTYFROMPOSITION, 0, (LPARAM)iCurrentPos); - ClientToScreen(g_hwndEdit, &pt); - } - imenu = 0; - } - break; - - case IDC_TOOLBAR: - case IDC_STATUSBAR: - case IDC_REBAR: - if (pt.x == -1 && pt.y == -1) - GetCursorPos(&pt); - imenu = 1; - break; - } - - TrackPopupMenuEx(GetSubMenu(hmenu, imenu), - TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x + 1, pt.y + 1, hwnd, NULL); - - DestroyMenu(hmenu); - return 0; -} - - - -//============================================================================= -// -// MsgChangeNotify() - Handles WM_CHANGENOTIFY -// -// -void MsgChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - if (iFileWatchingMode == 1 || IsDocumentModified || Encoding_HasChanged(CPI_GET)) - SetForegroundWindow(hwnd); - - if (PathFileExists(g_wchCurFile)) { - if ((iFileWatchingMode == 2 && !IsDocumentModified && !Encoding_HasChanged(CPI_GET)) || - MsgBox(MBYESNO,IDS_FILECHANGENOTIFY) == IDYES) { - - FileRevert(g_wchCurFile); - } - } - else { - if (MsgBox(MBYESNO,IDS_FILECHANGENOTIFY2) == IDYES) - FileSave(true,false,false,false); - } - - if (!bRunningWatch) - InstallFileWatching(g_wchCurFile); - - UNUSED(wParam); - UNUSED(lParam); -} - - -//============================================================================= -// -// MsgTrayMessage() - Handles WM_TRAYMESSAGE -// -// -LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - switch (lParam) { - case WM_RBUTTONUP: - { - - HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); - HMENU hMenuPopup = GetSubMenu(hMenu, 2); - - POINT pt; - int iCmd; - - SetForegroundWindow(hwnd); - - GetCursorPos(&pt); - SetMenuDefaultItem(hMenuPopup, IDM_TRAY_RESTORE, false); - iCmd = TrackPopupMenu(hMenuPopup, - TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, - pt.x, pt.y, 0, hwnd, NULL); - - PostMessage(hwnd, WM_NULL, 0, 0); - - DestroyMenu(hMenu); - - if (iCmd == IDM_TRAY_RESTORE) { - ShowNotifyIcon(hwnd, false); - RestoreWndFromTray(hwnd); - ShowOwnedPopups(hwnd, true); - } - - else if (iCmd == IDM_TRAY_EXIT) { - //ShowNotifyIcon(hwnd,false); - SendMessage(hwnd, WM_CLOSE, 0, 0); - } - } - return true; - - case WM_LBUTTONUP: - ShowNotifyIcon(hwnd, false); - RestoreWndFromTray(hwnd); - ShowOwnedPopups(hwnd, true); - return true; - } - - UNUSED(wParam); - return 0; -} - - - -//============================================================================= -// -// MsgInitMenu() - Handles WM_INITMENU -// -// -void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam) -{ - int i; - DocPos p; - bool b; - - HMENU hmenu = (HMENU)wParam; - - i = (int)StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)); - EnableCmd(hmenu,IDM_FILE_REVERT,i); - EnableCmd(hmenu, CMD_RELOADASCIIASUTF8, i); - EnableCmd(hmenu, CMD_RECODEANSI, i); - EnableCmd(hmenu, CMD_RECODEOEM, i); - EnableCmd(hmenu, CMD_RELOADNOFILEVARS, i); - EnableCmd(hmenu, CMD_RECODEDEFAULT, i); - EnableCmd(hmenu, IDM_FILE_LAUNCH, i); - - - EnableCmd(hmenu,IDM_FILE_LAUNCH,i); - EnableCmd(hmenu,IDM_FILE_PROPERTIES,i); - EnableCmd(hmenu,IDM_FILE_CREATELINK,i); - EnableCmd(hmenu,IDM_FILE_ADDTOFAV,i); - - EnableCmd(hmenu,IDM_FILE_READONLY,i); - CheckCmd(hmenu,IDM_FILE_READONLY,bReadOnly); - - //EnableCmd(hmenu,IDM_ENCODING_UNICODEREV,!bReadOnly); - //EnableCmd(hmenu,IDM_ENCODING_UNICODE,!bReadOnly); - //EnableCmd(hmenu,IDM_ENCODING_UTF8SIGN,!bReadOnly); - //EnableCmd(hmenu,IDM_ENCODING_UTF8,!bReadOnly); - //EnableCmd(hmenu,IDM_ENCODING_ANSI,!bReadOnly); - //EnableCmd(hmenu,IDM_LINEENDINGS_CRLF,!bReadOnly); - //EnableCmd(hmenu,IDM_LINEENDINGS_LF,!bReadOnly); - //EnableCmd(hmenu,IDM_LINEENDINGS_CR,!bReadOnly); - - EnableCmd(hmenu,IDM_ENCODING_RECODE,i); - - if (Encoding_IsUNICODE_REVERSE(Encoding_Current(CPI_GET))) - i = IDM_ENCODING_UNICODEREV; - else if (Encoding_IsUNICODE(Encoding_Current(CPI_GET))) - i = IDM_ENCODING_UNICODE; - else if (Encoding_IsUTF8_SIGN(Encoding_Current(CPI_GET))) - i = IDM_ENCODING_UTF8SIGN; - else if (Encoding_IsUTF8(Encoding_Current(CPI_GET))) - i = IDM_ENCODING_UTF8; - else if (Encoding_IsANSI(Encoding_Current(CPI_GET))) - i = IDM_ENCODING_ANSI; - else - i = -1; - CheckMenuRadioItem(hmenu,IDM_ENCODING_ANSI,IDM_ENCODING_UTF8SIGN,i,MF_BYCOMMAND); - - if (g_iEOLMode == SC_EOL_CRLF) - i = IDM_LINEENDINGS_CRLF; - else if (g_iEOLMode == SC_EOL_LF) - i = IDM_LINEENDINGS_LF; - else - i = IDM_LINEENDINGS_CR; - CheckMenuRadioItem(hmenu,IDM_LINEENDINGS_CRLF,IDM_LINEENDINGS_CR,i,MF_BYCOMMAND); - - EnableCmd(hmenu,IDM_FILE_RECENT,(MRU_Enum(g_pFileMRU,0,NULL,0) > 0)); - - EnableCmd(hmenu,IDM_EDIT_UNDO,SendMessage(g_hwndEdit,SCI_CANUNDO,0,0) /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_REDO,SendMessage(g_hwndEdit,SCI_CANREDO,0,0) /*&& !bReadOnly*/); - - - i = !SciCall_IsSelectionEmpty(); - p = SciCall_GetTextLength(); - b = (bool)SendMessage(g_hwndEdit, SCI_CANPASTE, 0, 0); - - EnableCmd(hmenu,IDM_EDIT_CUT,p /*&& !bReadOnly*/); // allow Ctrl-X w/o selection - EnableCmd(hmenu,IDM_EDIT_COPY,p /*&& !bReadOnly*/); // allow Ctrl-C w/o selection - - EnableCmd(hmenu,IDM_EDIT_COPYALL,p /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_COPYADD,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_EDIT_PASTE,b /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_SWAP,i || b /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_CLEAR,i /*&& !bReadOnly*/); - - EnableCmd(hmenu, IDM_EDIT_SELECTALL, p /*&& !bReadOnly*/); - - - OpenClipboard(hwnd); - EnableCmd(hmenu,IDM_EDIT_CLEARCLIPBOARD,CountClipboardFormats()); - CloseClipboard(); - - //EnableCmd(hmenu,IDM_EDIT_MOVELINEUP,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_MOVELINEDOWN,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_DUPLICATELINE,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_CUTLINE,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_COPYLINE,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_DELETELINE,!bReadOnly); - - //EnableCmd(hmenu,IDM_EDIT_INDENT,i /*&& !bReadOnly*/); - //EnableCmd(hmenu,IDM_EDIT_UNINDENT,i /*&& !bReadOnly*/); - - //EnableCmd(hmenu,IDM_EDIT_PADWITHSPACES,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_STRIP1STCHAR,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_STRIPLASTCHAR,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_TRIMLINES,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_MERGEBLANKLINES,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_REMOVEBLANKLINES,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_REMOVEEMPTYLINES,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_REMOVEDUPLICATELINES,!bReadOnly); - - EnableCmd(hmenu, IDM_EDIT_SORTLINES, - (SciCall_LineFromPosition(SciCall_GetSelectionEnd()) - - SciCall_LineFromPosition(SciCall_GetSelectionStart())) >= 1); - - //EnableCmd(hmenu,IDM_EDIT_COLUMNWRAP,i /*&& IsWindowsNT()*/); - EnableCmd(hmenu,IDM_EDIT_SPLITLINES,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_JOINLINES,i /*&& !bReadOnly*/); - EnableCmd(hmenu, IDM_EDIT_JOINLN_NOSP,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_JOINLINES_PARA,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_EDIT_CONVERTUPPERCASE,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_CONVERTLOWERCASE,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_INVERTCASE,i /*&& !bReadOnly*/ /*&& IsWindowsNT()*/); - EnableCmd(hmenu,IDM_EDIT_TITLECASE,i /*&& !bReadOnly*/ /*&& IsWindowsNT()*/); - EnableCmd(hmenu,IDM_EDIT_SENTENCECASE,i /*&& !bReadOnly*/ /*&& IsWindowsNT()*/); - - EnableCmd(hmenu,IDM_EDIT_CONVERTTABS,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_CONVERTSPACES,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_CONVERTTABS2,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_CONVERTSPACES2,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_EDIT_URLENCODE,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_URLDECODE,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_EDIT_ESCAPECCHARS,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_UNESCAPECCHARS,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_EDIT_CHAR2HEX,true /*&& !bReadOnly*/); // Char2Hex allowed for char after curr pos - EnableCmd(hmenu,IDM_EDIT_HEX2CHAR,i /*&& !bReadOnly*/); - - //EnableCmd(hmenu,IDM_EDIT_INCREASENUM,i /*&& !bReadOnly*/); - //EnableCmd(hmenu,IDM_EDIT_DECREASENUM,i /*&& !bReadOnly*/); - - EnableCmd(hmenu,IDM_VIEW_SHOWEXCERPT,i); - - i = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); - EnableCmd(hmenu,IDM_EDIT_LINECOMMENT, - !(i == SCLEX_NULL || i == SCLEX_CSS || i == SCLEX_DIFF || i == SCLEX_MARKDOWN || i == SCLEX_JSON)); - EnableCmd(hmenu,IDM_EDIT_STREAMCOMMENT, - !(i == SCLEX_NULL || i == SCLEX_VBSCRIPT || i == SCLEX_MAKEFILE || i == SCLEX_VB || i == SCLEX_ASM || - i == SCLEX_SQL || i == SCLEX_PERL || i == SCLEX_PYTHON || i == SCLEX_PROPERTIES ||i == SCLEX_CONF || - i == SCLEX_POWERSHELL || i == SCLEX_BATCH || i == SCLEX_DIFF || i == SCLEX_BASH || i == SCLEX_TCL || - i == SCLEX_AU3 || i == SCLEX_LATEX || i == SCLEX_AHK || i == SCLEX_RUBY || i == SCLEX_CMAKE || i == SCLEX_MARKDOWN || - i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIMROD)); - - EnableCmd(hmenu,IDM_EDIT_INSERT_ENCODING, *Encoding_GetParseNames(Encoding_Current(CPI_GET))); - - //EnableCmd(hmenu,IDM_EDIT_INSERT_SHORTDATE,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_INSERT_LONGDATE,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_INSERT_FILENAME,!bReadOnly); - //EnableCmd(hmenu,IDM_EDIT_INSERT_PATHNAME,!bReadOnly); - - i = (int)(SciCall_GetTextLength() != 0); - EnableCmd(hmenu,IDM_EDIT_FIND,i); - EnableCmd(hmenu,IDM_EDIT_SAVEFIND,i); - EnableCmd(hmenu,IDM_EDIT_FINDNEXT,i); - EnableCmd(hmenu,IDM_EDIT_FINDPREV,i); - EnableCmd(hmenu,IDM_EDIT_REPLACE,i /*&& !bReadOnly*/); - EnableCmd(hmenu,IDM_EDIT_REPLACENEXT,i); - EnableCmd(hmenu,IDM_EDIT_SELTONEXT,i); - EnableCmd(hmenu,IDM_EDIT_SELTOPREV,i); - EnableCmd(hmenu,IDM_EDIT_FINDMATCHINGBRACE,i); - EnableCmd(hmenu,IDM_EDIT_SELTOMATCHINGBRACE,i); - - EnableCmd(hmenu,BME_EDIT_BOOKMARKPREV,i); - EnableCmd(hmenu,BME_EDIT_BOOKMARKNEXT,i); - EnableCmd(hmenu,BME_EDIT_BOOKMARKTOGGLE,i); - EnableCmd(hmenu,BME_EDIT_BOOKMARKCLEAR,i); - - EnableCmd(hmenu, IDM_EDIT_DELETELINELEFT, i); - EnableCmd(hmenu, IDM_EDIT_DELETELINERIGHT, i); - EnableCmd(hmenu, CMD_CTRLBACK, i); - EnableCmd(hmenu, CMD_CTRLDEL, i); - EnableCmd(hmenu, CMD_TIMESTAMPS, i); - - EnableCmd(hmenu, IDM_VIEW_FONT, !IsWindow(g_hwndDlgCustomizeSchemes)); - EnableCmd(hmenu, IDM_VIEW_CURRENTSCHEME, !IsWindow(g_hwndDlgCustomizeSchemes)); - - EnableCmd(hmenu,IDM_VIEW_TOGGLEFOLDS,i && (g_bCodeFoldingAvailable && g_bShowCodeFolding)); - CheckCmd(hmenu,IDM_VIEW_FOLDING, (g_bCodeFoldingAvailable && g_bShowCodeFolding)); - EnableCmd(hmenu, IDM_VIEW_FOLDING, g_bCodeFoldingAvailable); - - CheckCmd(hmenu,IDM_VIEW_USE2NDDEFAULT,Style_GetUse2ndDefault()); - - CheckCmd(hmenu,IDM_VIEW_WORDWRAP,bWordWrap); - CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,bMarkLongLines); - CheckCmd(hmenu,IDM_VIEW_TABSASSPACES,g_bTabsAsSpaces); - CheckCmd(hmenu,IDM_VIEW_SHOWINDENTGUIDES,bShowIndentGuides); - CheckCmd(hmenu,IDM_VIEW_AUTOINDENTTEXT,bAutoIndent); - CheckCmd(hmenu,IDM_VIEW_LINENUMBERS,bShowLineNumbers); - CheckCmd(hmenu,IDM_VIEW_MARGIN,g_bShowSelectionMargin); - - EnableCmd(hmenu,IDM_EDIT_COMPLETEWORD,i); - CheckCmd(hmenu,IDM_VIEW_AUTOCOMPLETEWORDS,bAutoCompleteWords); - CheckCmd(hmenu,IDM_VIEW_ACCELWORDNAV,bAccelWordNavigation); - - CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_ONOFF, (iMarkOccurrences > 0)); - CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible); - CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, bMarkOccurrencesMatchCase); - - if (bMarkOccurrencesMatchWords) - i = IDM_VIEW_MARKOCCUR_WORD; - else if (bMarkOccurrencesCurrentWord) - i = IDM_VIEW_MARKOCCUR_CURRENT; - else - i = IDM_VIEW_MARKOCCUR_WNONE; - - CheckMenuRadioItem(hmenu, IDM_VIEW_MARKOCCUR_WNONE, IDM_VIEW_MARKOCCUR_CURRENT, i, MF_BYCOMMAND); - CheckCmdPos(GetSubMenu(GetSubMenu(GetMenu(g_hwndMain), 2), 17), 5, (i != IDM_VIEW_MARKOCCUR_WNONE)); - - i = (int)(iMarkOccurrences > 0); - EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, i); - EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, i); - EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_WNONE, i); - EnableCmd(hmenu,IDM_VIEW_MARKOCCUR_WORD, i); - EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_CURRENT, i); - EnableCmdPos(GetSubMenu(GetSubMenu(GetMenu(g_hwndMain), 2), 17), 5, i); - - - CheckCmd(hmenu,IDM_VIEW_SHOWWHITESPACE,bViewWhiteSpace); - CheckCmd(hmenu,IDM_VIEW_SHOWEOLS,bViewEOLs); - CheckCmd(hmenu,IDM_VIEW_WORDWRAPSYMBOLS,bShowWordWrapSymbols); - CheckCmd(hmenu,IDM_VIEW_MATCHBRACES,bMatchBraces); - CheckCmd(hmenu,IDM_VIEW_TOOLBAR,bShowToolbar); - EnableCmd(hmenu,IDM_VIEW_CUSTOMIZETB,bShowToolbar); - CheckCmd(hmenu,IDM_VIEW_STATUSBAR,bShowStatusbar); - - i = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); - //EnableCmd(hmenu,IDM_VIEW_AUTOCLOSETAGS,(i == SCLEX_HTML || i == SCLEX_XML)); - CheckCmd(hmenu, IDM_VIEW_AUTOCLOSETAGS, bAutoCloseTags /*&& (i == SCLEX_HTML || i == SCLEX_XML)*/); - CheckCmd(hmenu, IDM_VIEW_HILITECURRENTLINE, bHiliteCurrentLine); - CheckCmd(hmenu, IDM_VIEW_HYPERLINKHOTSPOTS, bHyperlinkHotspot); - CheckCmd(hmenu, IDM_VIEW_SCROLLPASTEOF, bScrollPastEOF); - - - i = IniGetInt(L"Settings2",L"ReuseWindow",0); - CheckCmd(hmenu,IDM_VIEW_REUSEWINDOW,i); - i = IniGetInt(L"Settings2",L"SingleFileInstance",0); - CheckCmd(hmenu,IDM_VIEW_SINGLEFILEINSTANCE,i); - bStickyWinPos = IniGetInt(L"Settings2",L"StickyWindowPosition",0); - CheckCmd(hmenu,IDM_VIEW_STICKYWINPOS,bStickyWinPos); - CheckCmd(hmenu,IDM_VIEW_ALWAYSONTOP,((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1)); - CheckCmd(hmenu,IDM_VIEW_MINTOTRAY,bMinimizeToTray); - CheckCmd(hmenu,IDM_VIEW_TRANSPARENT,bTransparentMode && bTransparentModeAvailable); - EnableCmd(hmenu,IDM_VIEW_TRANSPARENT,bTransparentModeAvailable); - - CheckCmd(hmenu,IDM_VIEW_NOSAVERECENT,bSaveRecentFiles); - CheckCmd(hmenu,IDM_VIEW_NOPRESERVECARET, bPreserveCaretPos); - CheckCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,bSaveFindReplace); - CheckCmd(hmenu,IDM_VIEW_SAVEBEFORERUNNINGTOOLS,bSaveBeforeRunningTools); - - CheckCmd(hmenu,IDM_VIEW_CHANGENOTIFY,iFileWatchingMode); - - if (StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt))) - i = IDM_VIEW_SHOWEXCERPT; - else if (iPathNameFormat == 0) - i = IDM_VIEW_SHOWFILENAMEONLY; - else if (iPathNameFormat == 1) - i = IDM_VIEW_SHOWFILENAMEFIRST; - else - i = IDM_VIEW_SHOWFULLPATH; - CheckMenuRadioItem(hmenu,IDM_VIEW_SHOWFILENAMEONLY,IDM_VIEW_SHOWEXCERPT,i,MF_BYCOMMAND); - - if (iEscFunction == 1) - i = IDM_VIEW_ESCMINIMIZE; - else if (iEscFunction == 2) - i = IDM_VIEW_ESCEXIT; - else - i = IDM_VIEW_NOESCFUNC; - CheckMenuRadioItem(hmenu,IDM_VIEW_NOESCFUNC,IDM_VIEW_ESCEXIT,i,MF_BYCOMMAND); - - i = (int)StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)); - CheckCmd(hmenu,IDM_VIEW_SAVESETTINGS,bSaveSettings && i); - - EnableCmd(hmenu,IDM_VIEW_REUSEWINDOW,i); - EnableCmd(hmenu,IDM_VIEW_STICKYWINPOS,i); - EnableCmd(hmenu,IDM_VIEW_SINGLEFILEINSTANCE,i); - EnableCmd(hmenu,IDM_VIEW_NOSAVERECENT,i); - EnableCmd(hmenu,IDM_VIEW_NOPRESERVECARET,i); - EnableCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,i); - EnableCmd(hmenu,IDM_VIEW_SAVESETTINGS,bEnableSaveSettings && i); - - i = (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0 || StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0); - EnableCmd(hmenu,IDM_VIEW_SAVESETTINGSNOW,bEnableSaveSettings && i); - - bool bIsHLink = false; - if ((bool)SendMessage(g_hwndEdit, SCI_STYLEGETHOTSPOT, Style_GetHotspotStyleID(), 0)) - { - bIsHLink = (Style_GetHotspotStyleID() == (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, SciCall_GetCurrentPos(), 0)); - } - EnableCmd(hmenu, CMD_OPEN_HYPERLINK, bIsHLink); - - UNUSED(lParam); -} - - -//============================================================================= -// -// MsgSysCommand() - Handles WM_SYSCOMMAND -// -// -LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) -{ - switch (wParam) { - case SC_MINIMIZE: - ShowOwnedPopups(hwnd, false); - if (bMinimizeToTray) { - MinimizeWndToTray(hwnd); - ShowNotifyIcon(hwnd, true); - SetNotifyIconTitle(hwnd); - return(0); - } - else - return DefWindowProc(hwnd, umsg, wParam, lParam); - - case SC_RESTORE: - { - LRESULT lrv = DefWindowProc(hwnd, umsg, wParam, lParam); - ShowOwnedPopups(hwnd, true); - return(lrv); - } - } - return DefWindowProc(hwnd, umsg, wParam, lParam); -} - - -//============================================================================= -// -// MsgCommand() - Handles WM_COMMAND -// -// -LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - switch(LOWORD(wParam)) - { - case IDM_FILE_NEW: - FileLoad(false,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); - break; - - - case IDM_FILE_OPEN: - FileLoad(false,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); - break; - - - case IDM_FILE_REVERT: - if ((IsDocumentModified || Encoding_HasChanged(CPI_GET)) && MsgBox(MBOKCANCEL,IDS_ASK_REVERT) != IDOK) { - return(0); - } - FileRevert(g_wchCurFile); - break; - - - case IDM_FILE_SAVE: - FileSave(true,false,false,false); - break; - - - case IDM_FILE_SAVEAS: - FileSave(true,false,true,false); - break; - - - case IDM_FILE_SAVECOPY: - FileSave(true,false,true,true); - break; - - - case IDM_FILE_READONLY: - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - { - DWORD dwFileAttributes = GetFileAttributes(g_wchCurFile); - if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) { - if (bReadOnly) - dwFileAttributes = (dwFileAttributes & ~FILE_ATTRIBUTE_READONLY); - else - dwFileAttributes |= FILE_ATTRIBUTE_READONLY; - if (!SetFileAttributes(g_wchCurFile,dwFileAttributes)) - MsgBox(MBWARN,IDS_READONLY_MODIFY,g_wchCurFile); - } - else - MsgBox(MBWARN,IDS_READONLY_MODIFY,g_wchCurFile); - - dwFileAttributes = GetFileAttributes(g_wchCurFile); - if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) - bReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY); - - UpdateToolbar(); - } - break; - - - case IDM_FILE_BROWSE: - DialogFileBrowse(hwnd); - break; - - - case IDM_FILE_NEWWINDOW: - case IDM_FILE_NEWWINDOW2: - DialogNewWindow(hwnd, bSaveBeforeRunningTools, (LOWORD(wParam) != IDM_FILE_NEWWINDOW2)); - break; - - - case IDM_FILE_LAUNCH: - { - WCHAR wchDirectory[MAX_PATH] = { L'\0' }; - - if (!StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - break; - - if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) - break; - - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - StringCchCopy(wchDirectory,COUNTOF(wchDirectory),g_wchCurFile); - PathRemoveFileSpec(wchDirectory); - } - - SHELLEXECUTEINFO sei; - ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = 0; - sei.hwnd = hwnd; - sei.lpVerb = NULL; - sei.lpFile = g_wchCurFile; - sei.lpParameters = NULL; - sei.lpDirectory = wchDirectory; - sei.nShow = SW_SHOWNORMAL; - ShellExecuteEx(&sei); - } - break; - - - case IDM_FILE_RUN: - { - WCHAR tchCmdLine[MAX_PATH+4]; - - if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) - break; - - StringCchCopy(tchCmdLine,COUNTOF(tchCmdLine),g_wchCurFile); - PathQuoteSpaces(tchCmdLine); - - RunDlg(hwnd,tchCmdLine); - } - break; - - - case IDM_FILE_OPENWITH: - if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) - break; - OpenWithDlg(hwnd,g_wchCurFile); - break; - - - case IDM_FILE_PAGESETUP: - EditPrintSetup(g_hwndEdit); - break; - - case IDM_FILE_PRINT: - { - SHFILEINFO shfi; - WCHAR *pszTitle; - WCHAR tchUntitled[32] = { L'\0' }; - WCHAR tchPageFmt[32] = { L'\0' }; - - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); - pszTitle = shfi.szDisplayName; - } - else { - GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); - pszTitle = tchUntitled; - } - - GetString(IDS_PRINT_PAGENUM,tchPageFmt,COUNTOF(tchPageFmt)); - - if (!EditPrint(g_hwndEdit,pszTitle,tchPageFmt)) - MsgBox(MBWARN,IDS_PRINT_ERROR,pszTitle); - } - break; - - - case IDM_FILE_PROPERTIES: - { - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) - break; - - SHELLEXECUTEINFO sei; - ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = SEE_MASK_INVOKEIDLIST; - sei.hwnd = hwnd; - sei.lpVerb = L"properties"; - sei.lpFile = g_wchCurFile; - sei.nShow = SW_SHOWNORMAL; - ShellExecuteEx(&sei); - } - break; - - case IDM_FILE_CREATELINK: - { - if (!StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - break; - - if (!PathCreateDeskLnk(g_wchCurFile)) - MsgBox(MBWARN,IDS_ERR_CREATELINK); - } - break; - - - case IDM_FILE_OPENFAV: - if (FileSave(false,true,false,false)) { - - WCHAR tchSelItem[MAX_PATH] = { L'\0' }; - - if (FavoritesDlg(hwnd,tchSelItem)) - { - if (PathIsLnkToDirectory(tchSelItem,NULL,0)) - PathGetLnkPath(tchSelItem,tchSelItem,COUNTOF(tchSelItem)); - - if (PathIsDirectory(tchSelItem)) - { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - - if (OpenFileDlg(g_hwndMain,tchFile,COUNTOF(tchFile),tchSelItem)) - FileLoad(true,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,tchFile); - } - else - FileLoad(true,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,tchSelItem); - } - } - break; - - - case IDM_FILE_ADDTOFAV: - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - SHFILEINFO shfi; - SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL, - &shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); - AddToFavDlg(hwnd,shfi.szDisplayName,g_wchCurFile); - } - break; - - - case IDM_FILE_MANAGEFAV: - { - SHELLEXECUTEINFO sei; - ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = 0; - sei.hwnd = hwnd; - sei.lpVerb = NULL; - sei.lpFile = tchFavoritesDir; - sei.lpParameters = NULL; - sei.lpDirectory = NULL; - sei.nShow = SW_SHOWNORMAL; - // Run favorites directory - ShellExecuteEx(&sei); - } - break; - - - case IDM_FILE_RECENT: - if (MRU_Enum(g_pFileMRU,0,NULL,0) > 0) { - if (FileSave(false,true,false,false)) { - WCHAR tchFile[MAX_PATH] = { L'\0' }; - if (FileMRUDlg(hwnd,tchFile)) - FileLoad(true,false,false,false,true,tchFile); - } - } - break; - - - case IDM_FILE_EXIT: - SendMessage(hwnd,WM_CLOSE,0,0); - break; - - - case IDM_ENCODING_ANSI: - case IDM_ENCODING_UNICODE: - case IDM_ENCODING_UNICODEREV: - case IDM_ENCODING_UTF8: - case IDM_ENCODING_UTF8SIGN: - case IDM_ENCODING_SELECT: - { - int iNewEncoding = Encoding_Current(CPI_GET); - if (LOWORD(wParam) == IDM_ENCODING_SELECT && !SelectEncodingDlg(hwnd,&iNewEncoding)) - break; - else { - switch (LOWORD(wParam)) { - case IDM_ENCODING_UNICODE: iNewEncoding = CPI_UNICODEBOM; break; - case IDM_ENCODING_UNICODEREV: iNewEncoding = CPI_UNICODEBEBOM; break; - case IDM_ENCODING_UTF8: iNewEncoding = CPI_UTF8; break; - case IDM_ENCODING_UTF8SIGN: iNewEncoding = CPI_UTF8SIGN; break; - case IDM_ENCODING_ANSI: iNewEncoding = CPI_ANSI_DEFAULT; break; - } - } - - BeginWaitCursor(NULL); - if (EditSetNewEncoding(g_hwndEdit, - iNewEncoding, - (flagSetEncoding), - StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0)) { - - if (SendMessage(g_hwndEdit,SCI_GETLENGTH,0,0) == 0) { - Encoding_Current(iNewEncoding); - Encoding_HasChanged(iNewEncoding); - } - else { - if (Encoding_IsANSI(Encoding_Current(CPI_GET)) || Encoding_IsANSI(iNewEncoding)) - Encoding_HasChanged(CPI_NONE); - Encoding_Current(iNewEncoding); - } - UpdateToolbar(); - } - EndWaitCursor(); - - } - break; - - - case IDM_ENCODING_RECODE: - { - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - - int iNewEncoding = Encoding_MapUnicode(Encoding_Current(CPI_GET)); - - if ((IsDocumentModified || Encoding_HasChanged(CPI_GET)) && MsgBox(MBOKCANCEL,IDS_ASK_RECODE) != IDOK) - return(0); - - if (RecodeDlg(hwnd,&iNewEncoding)) - { - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - Encoding_SrcCmdLn(iNewEncoding); - FileLoad(true,false,true,false,true,tchCurFile2); - } - } - } - break; - - - case IDM_ENCODING_SETDEFAULT: - SelectDefEncodingDlg(hwnd,&g_iDefaultNewFileEncoding); - break; - - - case IDM_LINEENDINGS_CRLF: - case IDM_LINEENDINGS_LF: - case IDM_LINEENDINGS_CR: - { - BeginWaitCursor(NULL) - int iNewEOLMode = iLineEndings[LOWORD(wParam)-IDM_LINEENDINGS_CRLF]; - g_iEOLMode = iNewEOLMode; - SendMessage(g_hwndEdit,SCI_SETEOLMODE,g_iEOLMode,0); - SendMessage(g_hwndEdit,SCI_CONVERTEOLS,g_iEOLMode,0); - EditFixPositions(g_hwndEdit); - EndWaitCursor() - UpdateToolbar(); - UpdateStatusbar(); - } - break; - - - case IDM_LINEENDINGS_SETDEFAULT: - SelectDefLineEndingDlg(hwnd,&g_iDefaultEOLMode); - break; - - - case IDM_EDIT_UNDO: - IgnoreNotifyChangeEvent(); - SendMessage(g_hwndEdit, SCI_UNDO, 0, 0); - ObserveNotifyChangeEvent(); - break; - - - case IDM_EDIT_REDO: - IgnoreNotifyChangeEvent(); - SendMessage(g_hwndEdit, SCI_REDO, 0, 0); - ObserveNotifyChangeEvent(); - break; - - - case IDM_EDIT_CUT: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - - int token = BeginUndoAction(); - if (!SciCall_IsSelectionEmpty()) - { - SciCall_Cut(); - } - else { // VisualStudio behavior - SciCall_CopyAllowLine(); - SciCall_LineDelete(); - } - EndUndoAction(token); - UpdateToolbar(); - } - break; - - - case IDM_EDIT_COPY: - case IDM_EDIT_COPYLINE: - if (flagPasteBoard) - bLastCopyFromMe = true; - SciCall_CopyAllowLine(); - UpdateToolbar(); - break; - - - case IDM_EDIT_COPYALL: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - SendMessage(g_hwndEdit,SCI_COPYRANGE,0,(LPARAM)SciCall_GetTextLength()); - UpdateToolbar(); - } - break; - - - case IDM_EDIT_COPYADD: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - EditCopyAppend(g_hwndEdit,true); - UpdateToolbar(); - } - break; - - case IDM_EDIT_PASTE: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - int token = BeginUndoAction(); - EditPasteClipboard(g_hwndEdit, false, bSkipUnicodeDetection); - EndUndoAction(token); - // Updates done by EditPasteClipboard(): - //~UpdateToolbar(); - //~UpdateStatusbar(); - //~UpdateLineNumberWidth(); - } - break; - - case IDM_EDIT_SWAP: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - int token = BeginUndoAction(); - EditPasteClipboard(g_hwndEdit, true, bSkipUnicodeDetection); - EndUndoAction(token); - UpdateToolbar(); - UpdateStatusbar(); - } - break; - - case IDM_EDIT_CLEARCLIPBOARD: - EditClearClipboard(g_hwndEdit); - UpdateToolbar(); - break; - - - case IDM_EDIT_SELECTALL: - SendMessage(g_hwndEdit,SCI_SELECTALL,0,0); - UpdateStatusbar(); - break; - - - case IDM_EDIT_SELECTWORD: - { - DocPos iPos = SciCall_GetCurrentPos(); - - if (SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) { - - DocPos iWordStart = (DocPos)SendMessage(g_hwndEdit,SCI_WORDSTARTPOSITION,iPos,true); - DocPos iWordEnd = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iPos,true); - - if (iWordStart == iWordEnd) // we are in whitespace salad... - { - iWordStart = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iPos,false); - iWordEnd = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iWordStart,true); - if (iWordStart != iWordEnd) { - SciCall_SetSel(iWordStart, iWordEnd); - } - } - else { - SciCall_SetSel(iWordStart, iWordEnd); - } - - if (SciCall_IsSelectionEmpty()) { - const DocLn iLine = SciCall_LineFromPosition(iPos); - const DocPos iLineStart = SciCall_GetLineIndentPosition(iLine); - const DocPos iLineEnd = SciCall_GetLineEndPosition(iLine); - SciCall_SetSel(iLineStart, iLineEnd); - } - } - else { - const DocLn iLine = SciCall_LineFromPosition(iPos); - const DocPos iLineStart = SciCall_GetLineIndentPosition(iLine); - const DocPos iLineEnd = SciCall_GetLineEndPosition(iLine); - SciCall_SetSel(iLineStart, iLineEnd); - } - UpdateStatusbar(); - } - break; - - - case IDM_EDIT_SELECTLINE: - { - const DocPos iSelStart = SciCall_GetSelectionStart(); - const DocPos iSelEnd = SciCall_GetSelectionEnd(); - const DocPos iLineStart = SciCall_LineFromPosition(iSelStart); - const DocPos iLineEnd = SciCall_LineFromPosition(iSelEnd); - SciCall_SetSel(SciCall_PositionFromLine(iLineStart), SciCall_PositionFromLine(iLineEnd + 1)); - SciCall_ChooseCaretX(); - UpdateStatusbar(); - } - break; - - - case IDM_EDIT_MOVELINEUP: - { - int token = BeginUndoAction(); - EditMoveUp(g_hwndEdit); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_MOVELINEDOWN: - { - int token = BeginUndoAction(); - EditMoveDown(g_hwndEdit); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_DUPLICATELINE: - SendMessage(g_hwndEdit,SCI_LINEDUPLICATE,0,0); - break; - - - case IDM_EDIT_CUTLINE: - { - if (flagPasteBoard) - bLastCopyFromMe = true; - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_LINECUT,0,0); - UpdateToolbar(); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_DELETELINE: - { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit, SCI_LINEDELETE, 0, 0); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_DELETELINELEFT: - { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit, SCI_DELLINELEFT, 0, 0); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_DELETELINERIGHT: - { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit, SCI_DELLINERIGHT, 0, 0); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_INDENT: - { - int token = BeginUndoAction(); - EditIndentBlock(g_hwndEdit, SCI_TAB, true); - EndUndoAction(token); - } - break; - - case IDM_EDIT_UNINDENT: - { - int token = BeginUndoAction(); - EditIndentBlock(g_hwndEdit, SCI_BACKTAB, true); - EndUndoAction(token); - } - break; - - case CMD_TAB: - { - int token = BeginUndoAction(); - EditIndentBlock(g_hwndEdit, SCI_TAB, false); - EndUndoAction(token); - } - break; - - case CMD_BACKTAB: - { - int token = BeginUndoAction(); - EditIndentBlock(g_hwndEdit, SCI_BACKTAB, false); - EndUndoAction(token); - } - break; - - case CMD_CTRLTAB: - { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit, SCI_SETUSETABS, true, 0); - SendMessage(g_hwndEdit, SCI_SETTABINDENTS, false, 0); - EditIndentBlock(g_hwndEdit, SCI_TAB, false); - SendMessage(g_hwndEdit, SCI_SETTABINDENTS, g_bTabIndents, 0); - SendMessage(g_hwndEdit, SCI_SETUSETABS, !g_bTabsAsSpaces, 0); - EndUndoAction(token); - } - break; - - case CMD_DELETEBACK: - { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit, SCI_DELETEBACK, 0, 0); - EndUndoAction(token); - } - break; - - case IDM_EDIT_ENCLOSESELECTION: - if (EditEncloseSelectionDlg(hwnd,wchPrefixSelection,wchAppendSelection)) { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit,wchPrefixSelection,wchAppendSelection); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_SELECTIONDUPLICATE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_SELECTIONDUPLICATE,0,0); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_PADWITHSPACES: - { - BeginWaitCursor(NULL); - EditPadWithSpaces(g_hwndEdit,false,false); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_STRIP1STCHAR: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditStripFirstCharacter(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_STRIPLASTCHAR: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditStripLastCharacter(g_hwndEdit, false, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_TRIMLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditStripLastCharacter(g_hwndEdit, false, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_COMPRESSWS: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditCompressSpaces(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_MERGEBLANKLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditRemoveBlankLines(g_hwndEdit, true, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - case IDM_EDIT_MERGEEMPTYLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditRemoveBlankLines(g_hwndEdit, true, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_REMOVEBLANKLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditRemoveBlankLines(g_hwndEdit, false, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_REMOVEEMPTYLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditRemoveBlankLines(g_hwndEdit, false, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_REMOVEDUPLICATELINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditRemoveDuplicateLines(g_hwndEdit, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_MODIFYLINES: - { - if (EditModifyLinesDlg(hwnd,wchPrefixLines,wchAppendLines)) { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditModifyLines(g_hwndEdit,wchPrefixLines,wchAppendLines); - EndUndoAction(token); - EndWaitCursor(); - } - } - break; - - - case IDM_EDIT_ALIGN: - { - if (EditAlignDlg(hwnd,&iAlignMode)) { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditAlignText(g_hwndEdit,iAlignMode); - EndUndoAction(token); - EndWaitCursor(); - } - } - break; - - - case IDM_EDIT_SORTLINES: - { - if (EditSortDlg(hwnd,&iSortOptions)) { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditSortLines(g_hwndEdit,iSortOptions); - EndUndoAction(token); - EndWaitCursor(); - } - } - break; - - - case IDM_EDIT_COLUMNWRAP: - { - if (iWrapCol == 0) { - iWrapCol = iLongLinesLimit; - } - - UINT uWrpCol = 0; - if (ColumnWrapDlg(hwnd,IDD_COLUMNWRAP,&uWrpCol)) - { - iWrapCol = (DocPos)max(min(uWrpCol,(UINT)iLongLinesLimit),1); - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditWrapToColumn(g_hwndEdit,iWrapCol); - EndUndoAction(token); - EndWaitCursor(); - } - } - break; - - - case IDM_EDIT_SPLITLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditEnterTargetTransaction(); - SciCall_TargetFromSelection(); - SendMessage(g_hwndEdit,SCI_LINESSPLIT,0,0); - EditLeaveTargetTransaction(); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_JOINLINES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditJoinLinesEx(g_hwndEdit, false, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - case IDM_EDIT_JOINLN_NOSP: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditJoinLinesEx(g_hwndEdit, false, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - case IDM_EDIT_JOINLINES_PARA: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditJoinLinesEx(g_hwndEdit, true, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTUPPERCASE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_UPPERCASE,0,0); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTLOWERCASE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_LOWERCASE,0,0); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_INVERTCASE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditInvertCase(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_TITLECASE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditTitleCase(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_SENTENCECASE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditSentenceCase(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTTABS: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditTabsToSpaces(g_hwndEdit, g_iTabWidth, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTSPACES: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditSpacesToTabs(g_hwndEdit, g_iTabWidth, false); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTTABS2: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditTabsToSpaces(g_hwndEdit, g_iTabWidth, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CONVERTSPACES2: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditSpacesToTabs(g_hwndEdit, g_iTabWidth, true); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_INSERT_TAG: - { - WCHAR wszOpen[256] = { L'\0' }; - WCHAR wszClose[256] = { L'\0' }; - if (EditInsertTagDlg(hwnd, wszOpen, wszClose)) { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, wszOpen, wszClose); - EndUndoAction(token); - } - } - break; - - - case IDM_EDIT_INSERT_ENCODING: - { - if (*Encoding_GetParseNames(Encoding_Current(CPI_GET))) { - char msz[32] = { '\0' }; - //int iSelStart; - StringCchCopyNA(msz,COUNTOF(msz), Encoding_GetParseNames(Encoding_Current(CPI_GET)),COUNTOF(msz)); - char *p = StrChrA(msz, ','); - if (p) - *p = 0; - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)msz); - EndUndoAction(token); - } - } - break; - - - case IDM_EDIT_INSERT_SHORTDATE: - case IDM_EDIT_INSERT_LONGDATE: - { - WCHAR tchDate[128] = { L'\0' }; - WCHAR tchTime[128] = { L'\0' }; - WCHAR tchDateTime[256] = { L'\0' }; - WCHAR tchTemplate[256] = { L'\0' }; - SYSTEMTIME st; - char mszBuf[MAX_PATH*3] = { '\0' }; - //int iSelStart; - - GetLocalTime(&st); - - if (IniGetString(L"Settings2", - (LOWORD(wParam) == IDM_EDIT_INSERT_SHORTDATE) ? L"DateTimeShort" : L"DateTimeLong", - L"",tchTemplate,COUNTOF(tchTemplate))) { - struct tm sst; - sst.tm_isdst = -1; - sst.tm_sec = (int)st.wSecond; - sst.tm_min = (int)st.wMinute; - sst.tm_hour = (int)st.wHour; - sst.tm_mday = (int)st.wDay; - sst.tm_mon = (int)st.wMonth - 1; - sst.tm_year = (int)st.wYear - 1900; - sst.tm_wday = (int)st.wDayOfWeek; - mktime(&sst); - wcsftime(tchDateTime,COUNTOF(tchDateTime),tchTemplate,&sst); - } - else { - GetDateFormat(LOCALE_USER_DEFAULT,( - LOWORD(wParam) == IDM_EDIT_INSERT_SHORTDATE) ? DATE_SHORTDATE : DATE_LONGDATE, - &st,NULL,tchDate,COUNTOF(tchDate)); - GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,NULL,tchTime,COUNTOF(tchTime)); - - StringCchPrintf(tchDateTime,COUNTOF(tchDateTime),L"%s %s",tchTime,tchDate); - } - - WideCharToMultiByteStrg(Encoding_SciCP,tchDateTime,mszBuf); - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_INSERT_FILENAME: - case IDM_EDIT_INSERT_PATHNAME: - { - SHFILEINFO shfi; - WCHAR *pszInsert; - WCHAR tchUntitled[32]; - char mszBuf[MAX_PATH*3]; - //int iSelStart; - - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - if (LOWORD(wParam) == IDM_EDIT_INSERT_FILENAME) { - SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO), - SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); - pszInsert = shfi.szDisplayName; - } - else - pszInsert = g_wchCurFile; - } - else { - GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); - pszInsert = tchUntitled; - } - - WideCharToMultiByteStrg(Encoding_SciCP,pszInsert,mszBuf); - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_INSERT_GUID: - { - GUID guid; - if (SUCCEEDED(CoCreateGuid(&guid))) { - WCHAR wszGuid[40]; - if (StringFromGUID2(&guid,wszGuid,COUNTOF(wszGuid))) { - WCHAR* pwszGuid = wszGuid + 1; // trim first brace char - wszGuid[wcslen(wszGuid) - 1] = L'\0'; // trim last brace char - char mszGuid[40 * 4]; // UTF-8 max of 4 bytes per char - if (WideCharToMultiByteStrg(Encoding_SciCP,pwszGuid,mszGuid)) { - int token = BeginUndoAction(); - SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszGuid); - EndUndoAction(token); - } - } - } - } - break; - - - case IDM_EDIT_LINECOMMENT: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - - switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) { - default: - case SCLEX_NULL: - case SCLEX_CSS: - case SCLEX_DIFF: - case SCLEX_MARKDOWN: - case SCLEX_JSON: - break; - case SCLEX_HTML: - case SCLEX_XML: - case SCLEX_CPP: - case SCLEX_PASCAL: - EditToggleLineComments(g_hwndEdit, L"//", false); - break; - case SCLEX_VBSCRIPT: - case SCLEX_VB: - EditToggleLineComments(g_hwndEdit, L"'", false); - break; - case SCLEX_MAKEFILE: - case SCLEX_PERL: - case SCLEX_PYTHON: - case SCLEX_CONF: - case SCLEX_BASH: - case SCLEX_TCL: - case SCLEX_RUBY: - case SCLEX_POWERSHELL: - case SCLEX_CMAKE: - case SCLEX_AVS: - case SCLEX_YAML: - case SCLEX_COFFEESCRIPT: - case SCLEX_NIMROD: - EditToggleLineComments(g_hwndEdit, L"#", true); - break; - case SCLEX_ASM: - case SCLEX_PROPERTIES: - case SCLEX_AU3: - case SCLEX_AHK: - case SCLEX_NSIS: // # could also be used instead - case SCLEX_INNOSETUP: - case SCLEX_REGISTRY: - EditToggleLineComments(g_hwndEdit, L";", true); - break; - case SCLEX_SQL: - case SCLEX_LUA: - case SCLEX_VHDL: - EditToggleLineComments(g_hwndEdit, L"--", true); - break; - case SCLEX_BATCH: - EditToggleLineComments(g_hwndEdit, L"rem ", true); - break; - case SCLEX_LATEX: - case SCLEX_MATLAB: - EditToggleLineComments(g_hwndEdit, L"%", true); - break; - } - - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_STREAMCOMMENT: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - - switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) { - default: - case SCLEX_NULL: - case SCLEX_VBSCRIPT: - case SCLEX_MAKEFILE: - case SCLEX_VB: - case SCLEX_ASM: - case SCLEX_SQL: - case SCLEX_PERL: - case SCLEX_PYTHON: - case SCLEX_PROPERTIES: - case SCLEX_CONF: - case SCLEX_POWERSHELL: - case SCLEX_BATCH: - case SCLEX_DIFF: - case SCLEX_BASH: - case SCLEX_TCL: - case SCLEX_AU3: - case SCLEX_LATEX: - case SCLEX_AHK: - case SCLEX_RUBY: - case SCLEX_CMAKE: - case SCLEX_MARKDOWN: - case SCLEX_YAML: - case SCLEX_JSON: - case SCLEX_REGISTRY: - case SCLEX_NIMROD: - break; - case SCLEX_HTML: - case SCLEX_XML: - case SCLEX_CSS: - case SCLEX_CPP: - case SCLEX_NSIS: - case SCLEX_AVS: - case SCLEX_VHDL: - EditEncloseSelection(g_hwndEdit, L"/*", L"*/"); - break; - case SCLEX_PASCAL: - case SCLEX_INNOSETUP: - EditEncloseSelection(g_hwndEdit, L"{", L"}"); - break; - case SCLEX_LUA: - EditEncloseSelection(g_hwndEdit, L"--[[", L"]]"); - break; - case SCLEX_COFFEESCRIPT: - EditEncloseSelection(g_hwndEdit, L"###", L"###"); - break; - case SCLEX_MATLAB: - EditEncloseSelection(g_hwndEdit, L"%{", L"%}"); - } - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_URLENCODE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditURLEncode(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_URLDECODE: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditURLDecode(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_ESCAPECCHARS: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditEscapeCChars(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_UNESCAPECCHARS: - { - BeginWaitCursor(NULL); - int token = BeginUndoAction(); - EditUnescapeCChars(g_hwndEdit); - EndUndoAction(token); - EndWaitCursor(); - } - break; - - - case IDM_EDIT_CHAR2HEX: - { - int token = BeginUndoAction(); - EditChar2Hex(g_hwndEdit); - EndUndoAction(token); - } - break; - - - case IDM_EDIT_HEX2CHAR: - EditHex2Char(g_hwndEdit); - break; - - - case IDM_EDIT_FINDMATCHINGBRACE: - EditFindMatchingBrace(g_hwndEdit); - break; - - - case IDM_EDIT_SELTOMATCHINGBRACE: - { - int token = BeginUndoAction(); - EditSelectToMatchingBrace(g_hwndEdit); - EndUndoAction(token); - } - break; - - - // Main Bookmark Functions - case BME_EDIT_BOOKMARKNEXT: - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - - int bitmask = (1 << MARKER_NP3_BOOKMARK); - DocLn iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERNEXT , iLine+1 , bitmask ); - if (iNextLine == (DocLn)-1) - { - iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERNEXT , 0 , bitmask ); - } - - if (iNextLine != (DocLn)-1) - { - SciCall_EnsureVisible(iNextLine); - SciCall_GotoLine(iNextLine); - SciCall_ScrollCaret(); - } - break; - } - - case BME_EDIT_BOOKMARKPREV: - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - - int bitmask = (1 << MARKER_NP3_BOOKMARK); - DocLn iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERPREVIOUS , iLine-1 , bitmask ); - if (iNextLine == (DocLn)-1) - { - iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERPREVIOUS , SciCall_GetLineCount(), bitmask ); - } - - if (iNextLine != (DocLn)-1) - { - SciCall_EnsureVisible(iNextLine); - SciCall_GotoLine(iNextLine); - SciCall_ScrollCaret(); - } - break; - } - - case BME_EDIT_BOOKMARKTOGGLE: - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - - int bitmask = SciCall_MarkerGet(iLine); - - if (bitmask & (1 << MARKER_NP3_BOOKMARK)) { - // unset - SciCall_MarkerDelete(iLine, MARKER_NP3_BOOKMARK); - } - else { - Style_SetBookmark(g_hwndEdit, g_bShowSelectionMargin); - // set - SciCall_MarkerAdd(iLine, MARKER_NP3_BOOKMARK); - UpdateLineNumberWidth(); - } - break; - } - - case BME_EDIT_BOOKMARKCLEAR: - SciCall_MarkerDeleteAll(MARKER_NP3_BOOKMARK); - break; - - - - case IDM_EDIT_FIND: - if (!IsWindow(g_hwndDlgFindReplace)) { - bFindReplCopySelOrClip = true; - g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, false); - } - else { - bFindReplCopySelOrClip = (GetForegroundWindow() != g_hwndDlgFindReplace); - if (GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE)) { - SendMessage(g_hwndDlgFindReplace, WM_COMMAND, MAKELONG(IDMSG_SWITCHTOFIND, 1), 0); - DestroyWindow(g_hwndDlgFindReplace); - g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, false); - } - else { - SetForegroundWindow(g_hwndDlgFindReplace); - PostMessage(g_hwndDlgFindReplace, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(g_hwndDlgFindReplace, IDC_FINDTEXT)), 1); - } - UpdateStatusbar(); - } - break; - - - case IDM_EDIT_REPLACE: - if (!IsWindow(g_hwndDlgFindReplace)) { - bFindReplCopySelOrClip = true; - g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, true); - } - else { - bFindReplCopySelOrClip = (GetForegroundWindow() != g_hwndDlgFindReplace); - if (!GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE)) { - SendMessage(g_hwndDlgFindReplace, WM_COMMAND, MAKELONG(IDMSG_SWITCHTOREPLACE, 1), 0); - DestroyWindow(g_hwndDlgFindReplace); - g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, true); - } - else { - SetForegroundWindow(g_hwndDlgFindReplace); - PostMessage(g_hwndDlgFindReplace, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(g_hwndDlgFindReplace, IDC_FINDTEXT)), 1); - } - UpdateStatusbar(); - } - break; - - - case IDM_EDIT_FINDNEXT: - case IDM_EDIT_FINDPREV: - case IDM_EDIT_REPLACENEXT: - case IDM_EDIT_SELTONEXT: - case IDM_EDIT_SELTOPREV: - - if (SciCall_GetTextLength() == 0) - break; - - if (IsFindPatternEmpty() && !StringCchLenA(g_efrData.szFind, COUNTOF(g_efrData.szFind))) - { - if (LOWORD(wParam) != IDM_EDIT_REPLACENEXT) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_FIND,1),0); - else - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); - } - else { - - switch (LOWORD(wParam)) { - - case IDM_EDIT_FINDNEXT: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionEnd(g_hwndEdit); - } - EditFindNext(g_hwndEdit,&g_efrData,false,false); - break; - - case IDM_EDIT_FINDPREV: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionStart(g_hwndEdit); - } - EditFindPrev(g_hwndEdit,&g_efrData,false,false); - break; - - case IDM_EDIT_REPLACENEXT: - if (bReplaceInitialized) - EditReplace(g_hwndEdit,&g_efrData); - else - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); - break; - - case IDM_EDIT_SELTONEXT: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionEnd(g_hwndEdit); - } - EditFindNext(g_hwndEdit,&g_efrData,true,false); - break; - - case IDM_EDIT_SELTOPREV: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionStart(g_hwndEdit); - } - EditFindPrev(g_hwndEdit,&g_efrData,true,false); - break; - } - } - break; - - - case CMD_FINDNEXTSEL: - case CMD_FINDPREVSEL: - case IDM_EDIT_SAVEFIND: - { - DocPos cchSelection = SciCall_GetSelText(NULL); - - if (1 >= cchSelection) - { - SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_EDIT_SELECTWORD, 1), 0); - cchSelection = SciCall_GetSelText(NULL); - } - - if ((1 < cchSelection) && (cchSelection < FNDRPL_BUFFER)) - { - char mszSelection[FNDRPL_BUFFER]; - SciCall_GetSelText(mszSelection); - - // Check lpszSelection and truncate newlines - char *lpsz = StrChrA(mszSelection, '\n'); - if (lpsz) *lpsz = '\0'; - - lpsz = StrChrA(mszSelection, '\r'); - if (lpsz) *lpsz = '\0'; - - StringCchCopyA(g_efrData.szFind, COUNTOF(g_efrData.szFind), mszSelection); - g_efrData.fuFlags &= (~(SCFIND_REGEXP | SCFIND_POSIX)); - g_efrData.bTransformBS = false; - - WCHAR wszBuf[FNDRPL_BUFFER]; - MultiByteToWideCharStrg(Encoding_SciCP, mszSelection, wszBuf); - MRU_Add(g_pMRUfind, wszBuf, 0, 0, NULL); - SetFindPattern(wszBuf); - - switch (LOWORD(wParam)) { - - case IDM_EDIT_SAVEFIND: - break; - - case CMD_FINDNEXTSEL: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionEnd(g_hwndEdit); - } - EditFindNext(g_hwndEdit, &g_efrData, false, false); - break; - - case CMD_FINDPREVSEL: - if (!SciCall_IsSelectionEmpty()) { - EditJumpToSelectionStart(g_hwndEdit); - } - EditFindPrev(g_hwndEdit, &g_efrData, false, false); - break; - } - } - } - break; - - - - case IDM_EDIT_COMPLETEWORD: - EditCompleteWord(g_hwndEdit, true); - break; - - - case IDM_EDIT_GOTOLINE: - EditLinenumDlg(g_hwndEdit); - break; - - - case IDM_VIEW_SCHEME: - Style_SelectLexerDlg(g_hwndEdit); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - break; - - - case IDM_VIEW_USE2NDDEFAULT: - Style_ToggleUse2ndDefault(g_hwndEdit); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - break; - - - case IDM_VIEW_SCHEMECONFIG: - if (!IsWindow(g_hwndDlgCustomizeSchemes)) { - g_hwndDlgCustomizeSchemes = Style_CustomizeSchemesDlg(g_hwndEdit); - } - else { - SetForegroundWindow(g_hwndDlgCustomizeSchemes); - } - PostMessage(g_hwndDlgCustomizeSchemes, WM_COMMAND, MAKELONG(IDC_SETCURLEXERTV, 1), 0); - break; - - - case IDM_VIEW_FONT: - if (!IsWindow(g_hwndDlgCustomizeSchemes)) - Style_SetDefaultFont(g_hwndEdit, true); - UpdateToolbar(); - UpdateLineNumberWidth(); - break; - - case IDM_VIEW_CURRENTSCHEME: - if (!IsWindow(g_hwndDlgCustomizeSchemes)) - Style_SetDefaultFont(g_hwndEdit, false); - UpdateToolbar(); - UpdateLineNumberWidth(); - break; - - - case IDM_VIEW_WORDWRAP: - bWordWrap = (bWordWrap) ? false : true; - if (!bWordWrap) - SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0); - else - SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0); - bWordWrapG = bWordWrap; - UpdateToolbar(); - break; - - - case IDM_VIEW_WORDWRAPSETTINGS: - if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent)) { - _SetWordWrapping(g_hwndEdit); - } - break; - - - case IDM_VIEW_WORDWRAPSYMBOLS: - bShowWordWrapSymbols = (bShowWordWrapSymbols) ? false : true; - _SetWordWrapping(g_hwndEdit); - break; - - - case IDM_VIEW_LONGLINEMARKER: - bMarkLongLines = (bMarkLongLines) ? false: true; - if (bMarkLongLines) { - SendMessage(g_hwndEdit,SCI_SETEDGEMODE,(iLongLineMode == EDGE_LINE)?EDGE_LINE:EDGE_BACKGROUND,0); - Style_SetLongLineColors(g_hwndEdit); - } - else - SendMessage(g_hwndEdit,SCI_SETEDGEMODE,EDGE_NONE,0); - - UpdateToolbar(); - UpdateStatusbar(); - break; - - - case IDM_VIEW_LONGLINESETTINGS: - if (LongLineSettingsDlg(hwnd,IDD_LONGLINES,&iLongLinesLimit)) { - bMarkLongLines = true; - SendMessage(g_hwndEdit,SCI_SETEDGEMODE,(iLongLineMode == EDGE_LINE)?EDGE_LINE:EDGE_BACKGROUND,0); - Style_SetLongLineColors(g_hwndEdit); - iLongLinesLimit = max(min(iLongLinesLimit,4096),0); - SendMessage(g_hwndEdit,SCI_SETEDGECOLUMN,iLongLinesLimit,0); - iLongLinesLimitG = iLongLinesLimit; - UpdateToolbar(); - UpdateStatusbar(); - } - break; - - - case IDM_VIEW_TABSASSPACES: - g_bTabsAsSpaces = (g_bTabsAsSpaces) ? false : true; - SendMessage(g_hwndEdit,SCI_SETUSETABS,!g_bTabsAsSpaces,0); - bTabsAsSpacesG = g_bTabsAsSpaces; - break; - - - case IDM_VIEW_TABSETTINGS: - if (TabSettingsDlg(hwnd,IDD_TABSETTINGS,NULL)) - { - SendMessage(g_hwndEdit,SCI_SETUSETABS,!g_bTabsAsSpaces,0); - SendMessage(g_hwndEdit,SCI_SETTABINDENTS,g_bTabIndents,0); - SendMessage(g_hwndEdit,SCI_SETBACKSPACEUNINDENTS,bBackspaceUnindents,0); - g_iTabWidth = max(min(g_iTabWidth,256),1); - g_iIndentWidth = max(min(g_iIndentWidth,256),0); - SendMessage(g_hwndEdit,SCI_SETTABWIDTH,g_iTabWidth,0); - SendMessage(g_hwndEdit,SCI_SETINDENT,g_iIndentWidth,0); - bTabsAsSpacesG = g_bTabsAsSpaces; - bTabIndentsG = g_bTabIndents; - iTabWidthG = g_iTabWidth; - iIndentWidthG = g_iIndentWidth; - if (SendMessage(g_hwndEdit,SCI_GETWRAPINDENTMODE,0,0) == SC_WRAPINDENT_FIXED) { - int i = 0; - switch (iWordWrapIndent) { - case 1: i = 1; break; - case 2: i = 2; break; - case 3: i = (g_iIndentWidth) ? 1 * g_iIndentWidth : 1 * g_iTabWidth; break; - case 4: i = (g_iIndentWidth) ? 2 * g_iIndentWidth : 2 * g_iTabWidth; break; - } - SendMessage(g_hwndEdit,SCI_SETWRAPSTARTINDENT,i,0); - } - } - break; - - - case IDM_VIEW_SHOWINDENTGUIDES: - bShowIndentGuides = (bShowIndentGuides) ? false : true; - Style_SetIndentGuides(g_hwndEdit,bShowIndentGuides); - break; - - - case IDM_VIEW_AUTOINDENTTEXT: - bAutoIndent = (bAutoIndent) ? false : true; - break; - - - case IDM_VIEW_LINENUMBERS: - bShowLineNumbers = (bShowLineNumbers) ? false : true; - UpdateLineNumberWidth(); - break; - - - case IDM_VIEW_MARGIN: - g_bShowSelectionMargin = (g_bShowSelectionMargin) ? false : true; - Style_SetBookmark(g_hwndEdit, g_bShowSelectionMargin); - UpdateLineNumberWidth(); - break; - - case IDM_VIEW_AUTOCOMPLETEWORDS: - bAutoCompleteWords = (bAutoCompleteWords) ? false : true; // toggle - if (!bAutoCompleteWords) - SendMessage(g_hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list - break; - - case IDM_VIEW_ACCELWORDNAV: - bAccelWordNavigation = (bAccelWordNavigation) ? false : true; // toggle - EditSetAccelWordNav(g_hwndEdit,bAccelWordNavigation); - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - break; - - case IDM_VIEW_MARKOCCUR_ONOFF: - iMarkOccurrences = (iMarkOccurrences == 0) ? max(1, IniGetInt(L"Settings", L"MarkOccurrences", 1)) : 0; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(0); - break; - - case IDM_VIEW_MARKOCCUR_VISIBLE: - bMarkOccurrencesMatchVisible = (bMarkOccurrencesMatchVisible) ? false : true; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(0); - break; - - case IDM_VIEW_MARKOCCUR_CASE: - bMarkOccurrencesMatchCase = (bMarkOccurrencesMatchCase) ? false : true; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - break; - - case IDM_VIEW_MARKOCCUR_WNONE: - bMarkOccurrencesMatchWords = false; - bMarkOccurrencesCurrentWord = false; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - break; - - case IDM_VIEW_MARKOCCUR_WORD: - bMarkOccurrencesMatchWords = true; - bMarkOccurrencesCurrentWord = false; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - break; - - case IDM_VIEW_MARKOCCUR_CURRENT: - bMarkOccurrencesMatchWords = false; - bMarkOccurrencesCurrentWord = true; - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - break; - - case IDM_VIEW_FOLDING: - g_bShowCodeFolding = (g_bShowCodeFolding) ? false : true; - Style_SetFolding(g_hwndEdit, g_bShowCodeFolding); - if (!g_bShowCodeFolding) { EditFoldToggleAll(EXPAND); } - UpdateToolbar(); - break; - - - case IDM_VIEW_TOGGLEFOLDS: - EditFoldToggleAll(SNIFF); - break; - - - case IDM_VIEW_SHOWWHITESPACE: - bViewWhiteSpace = (bViewWhiteSpace) ? false : true; - SendMessage(g_hwndEdit,SCI_SETVIEWWS,(bViewWhiteSpace)?SCWS_VISIBLEALWAYS:SCWS_INVISIBLE,0); - break; - - - case IDM_VIEW_SHOWEOLS: - bViewEOLs = (bViewEOLs) ? false : true; - SendMessage(g_hwndEdit,SCI_SETVIEWEOL,bViewEOLs,0); - break; - - - case IDM_VIEW_MATCHBRACES: - bMatchBraces = (bMatchBraces) ? false : true; - if (bMatchBraces) - EditMatchBrace(g_hwndEdit); - else - SendMessage(g_hwndEdit,SCI_BRACEHIGHLIGHT,(WPARAM)-1,(LPARAM)-1); - break; - - - case IDM_VIEW_AUTOCLOSETAGS: - bAutoCloseTags = (bAutoCloseTags) ? false : true; - break; - - - case IDM_VIEW_HILITECURRENTLINE: - bHiliteCurrentLine = (bHiliteCurrentLine) ? false : true; - Style_SetCurrentLineBackground(g_hwndEdit, bHiliteCurrentLine); - break; - - case IDM_VIEW_HYPERLINKHOTSPOTS: - bHyperlinkHotspot = (bHyperlinkHotspot) ? false : true; - Style_SetUrlHotSpot(g_hwndEdit, bHyperlinkHotspot); - if (bHyperlinkHotspot) { - UpdateVisibleUrlHotspot(0); - } - else { - SciCall_StartStyling(0); - Style_ResetCurrentLexer(g_hwndEdit); - } - break; - - case IDM_VIEW_ZOOMIN: - SendMessage(g_hwndEdit,SCI_ZOOMIN,0,0); - UpdateLineNumberWidth(); - break; - - case IDM_VIEW_ZOOMOUT: - SendMessage(g_hwndEdit,SCI_ZOOMOUT,0,0); - UpdateLineNumberWidth(); - break; - - case IDM_VIEW_RESETZOOM: - SendMessage(g_hwndEdit,SCI_SETZOOM,0,0); - UpdateLineNumberWidth(); - break; - - - case IDM_VIEW_SCROLLPASTEOF: - bScrollPastEOF = (bScrollPastEOF) ? false : true; - SciCall_SetEndAtLastLine(!bScrollPastEOF); - break; - - case IDM_VIEW_TOOLBAR: - if (bShowToolbar) { - bShowToolbar = 0; - ShowWindow(hwndReBar,SW_HIDE); - } - else { - bShowToolbar = 1; - UpdateToolbar(); - ShowWindow(hwndReBar,SW_SHOW); - } - SendWMSize(hwnd); - break; - - - case IDM_VIEW_CUSTOMIZETB: - SendMessage(g_hwndToolbar,TB_CUSTOMIZE,0,0); - break; - - - case IDM_VIEW_STATUSBAR: - if (bShowStatusbar) { - bShowStatusbar = 0; - ShowWindow(g_hwndStatus,SW_HIDE); - } - else { - bShowStatusbar = 1; - UpdateStatusbar(); - ShowWindow(g_hwndStatus,SW_SHOW); - } - SendWMSize(hwnd); - break; - - - case IDM_VIEW_STICKYWINPOS: - bStickyWinPos = IniGetInt(L"Settings2",L"StickyWindowPosition",bStickyWinPos); - if (!bStickyWinPos) - { - WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; - - int ResX = GetSystemMetrics(SM_CXSCREEN); - int ResY = GetSystemMetrics(SM_CYSCREEN); - - StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); - StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); - StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); - StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); - StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); - - bStickyWinPos = 1; - IniSetInt(L"Settings2",L"StickyWindowPosition",1); - - // GetWindowPlacement - WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); - IniSetInt(L"Window",tchPosX,wi.x); - IniSetInt(L"Window",tchPosY,wi.y); - IniSetInt(L"Window",tchSizeX,wi.cx); - IniSetInt(L"Window",tchSizeY,wi.cy); - IniSetInt(L"Window",tchMaximized,wi.max); - - InfoBox(0,L"MsgStickyWinPos",IDS_STICKYWINPOS); - } - else { - bStickyWinPos = 0; - IniSetInt(L"Settings2",L"StickyWindowPosition",0); - } - break; - - - case IDM_VIEW_REUSEWINDOW: - if (IniGetInt(L"Settings2",L"ReuseWindow",0)) - IniSetInt(L"Settings2",L"ReuseWindow",0); - else - IniSetInt(L"Settings2",L"ReuseWindow",1); - break; - - - case IDM_VIEW_SINGLEFILEINSTANCE: - if (IniGetInt(L"Settings2",L"SingleFileInstance",0)) - IniSetInt(L"Settings2",L"SingleFileInstance",0); - else - IniSetInt(L"Settings2",L"SingleFileInstance",1); - break; - - - case IDM_VIEW_ALWAYSONTOP: - if ((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1) { - bAlwaysOnTop = 0; - flagAlwaysOnTop = 0; - SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); - } - else { - bAlwaysOnTop = 1; - flagAlwaysOnTop = 0; - SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); - } - break; - - - case IDM_VIEW_MINTOTRAY: - bMinimizeToTray =(bMinimizeToTray) ? false : true; - break; - - - case IDM_VIEW_TRANSPARENT: - bTransparentMode =(bTransparentMode) ? false : true; - SetWindowTransparentMode(hwnd,bTransparentMode); - break; - - - case IDM_VIEW_SHOWFILENAMEONLY: - iPathNameFormat = 0; - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - UpdateToolbar(); - break; - - - case IDM_VIEW_SHOWFILENAMEFIRST: - iPathNameFormat = 1; - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - UpdateToolbar(); - break; - - - case IDM_VIEW_SHOWFULLPATH: - iPathNameFormat = 2; - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - UpdateToolbar(); - break; - - - case IDM_VIEW_SHOWEXCERPT: - EditGetExcerpt(g_hwndEdit,szTitleExcerpt,COUNTOF(szTitleExcerpt)); - UpdateToolbar(); - break; - - - case IDM_VIEW_NOSAVERECENT: - bSaveRecentFiles = (bSaveRecentFiles) ? false : true; - break; - - - case IDM_VIEW_NOPRESERVECARET: - bPreserveCaretPos = (bPreserveCaretPos) ? false : true; - break; - - - case IDM_VIEW_NOSAVEFINDREPL: - bSaveFindReplace = (bSaveFindReplace) ? false : true; - break; - - - case IDM_VIEW_SAVEBEFORERUNNINGTOOLS: - bSaveBeforeRunningTools = (bSaveBeforeRunningTools) ? false : true; - break; - - - case IDM_VIEW_CHANGENOTIFY: - if (ChangeNotifyDlg(hwnd)) - InstallFileWatching(g_wchCurFile); - break; - - - case IDM_VIEW_NOESCFUNC: - iEscFunction = 0; - break; - - - case IDM_VIEW_ESCMINIMIZE: - iEscFunction = 1; - break; - - - case IDM_VIEW_ESCEXIT: - iEscFunction = 2; - break; - - - case IDM_VIEW_SAVESETTINGS: - if (IsCmdEnabled(hwnd, IDM_VIEW_SAVESETTINGS)) - bSaveSettings = (bSaveSettings) ? false : true; - break; - - - case IDM_VIEW_SAVESETTINGSNOW: - if (IsCmdEnabled(hwnd, IDM_VIEW_SAVESETTINGSNOW)) { - - bool bCreateFailure = false; - - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) == 0) { - - if (StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0) { - if (CreateIniFileEx(g_wchIniFile2)) { - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),g_wchIniFile2); - StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),L""); - } - else - bCreateFailure = true; - } - - else - break; - } - - if (!bCreateFailure) { - - if (WritePrivateProfileString(L"Settings",L"WriteTest",L"ok",g_wchIniFile)) { - - BeginWaitCursorID(IDS_SAVINGSETTINGS); - SaveSettings(true); - EndWaitCursor(); - MsgBox(MBINFO,IDS_SAVEDSETTINGS); - } - else { - dwLastIOError = GetLastError(); - MsgBox(MBWARN,IDS_WRITEINI_FAIL); - } - } - else - MsgBox(MBWARN,IDS_CREATEINI_FAIL); - } - break; - - - case IDM_HELP_ONLINEDOCUMENTATION: - ShellExecute(0, 0, ONLINE_HELP_WEBSITE, 0, 0, SW_SHOW); - break; - - case IDM_HELP_ABOUT: - ThemedDialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc); - break; - - case IDM_SETPASS: - if (GetFileKey(g_hwndEdit)) { - _SetDocumentModified(true); - } - break; - - case IDM_HELP_CMD: - DisplayCmdLineHelp(hwnd); - break; - - case CMD_ESCAPE: - //close the autocomplete box - SendMessage(g_hwndEdit,SCI_AUTOCCANCEL,0, 0); - - if (iEscFunction == 1) - SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0); - else if (iEscFunction == 2) - SendMessage(hwnd,WM_CLOSE,0,0); - break; - - - case CMD_SHIFTESC: - if (FileSave(true,false,false,false)) - SendMessage(hwnd,WM_CLOSE,0,0); - break; - - - case CMD_CTRLENTER: - { - int token = BeginUndoAction(); - const DocPos iPos = SciCall_GetCurrentPos(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - if (iLine <= 0) { - SciCall_GotoLine(0); - SciCall_NewLine(); - SciCall_GotoLine(0); - } - else { - SciCall_GotoPos(SciCall_GetLineEndPosition(iLine - 1)); - SciCall_NewLine(); - } - EndUndoAction(token); - } - break; - - - // Newline with toggled auto indent setting - case CMD_SHIFTCTRLENTER: - bAutoIndent = (bAutoIndent) ? 0 : 1; - SciCall_NewLine(); - bAutoIndent = (bAutoIndent) ? 0 : 1; - break; - - - case IDM_EDIT_CLEAR: - case CMD_DEL: - { - int token = BeginUndoAction(); - SciCall_Clear(); - EndUndoAction(token); - } - break; - - - case CMD_CTRLLEFT: - SendMessage(g_hwndEdit, SCI_WORDLEFT, 0, 0); - break; - - - case CMD_CTRLRIGHT: - SendMessage(g_hwndEdit, SCI_WORDRIGHT, 0, 0); - break; - - - case CMD_CTRLBACK: - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocPos iAnchor = SciCall_GetAnchor(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - const DocPos iStartPos = SciCall_PositionFromLine(iLine); - const DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); - - if (iPos != iAnchor) { - int token = BeginUndoAction(); - SciCall_SetSel(iPos, iPos); - EndUndoAction(token); - } - else { - if (iPos == iStartPos) - Sci_SendMsgV0(DELETEBACK); - else if (iPos <= iIndentPos) - Sci_SendMsgV0(DELLINELEFT); - else - Sci_SendMsgV0(DELWORDLEFT); - } - } - break; - - - case CMD_CTRLDEL: - { - const DocPos iPos = SciCall_GetCurrentPos(); - const DocPos iAnchor = SciCall_GetAnchor(); - const DocLn iLine = SciCall_LineFromPosition(iPos); - const DocPos iStartPos = SciCall_PositionFromLine(iLine); - const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); - - if (iPos != iAnchor) { - int token = BeginUndoAction(); - SciCall_SetSel(iPos, iPos); - EndUndoAction(token); - } - else { - if (iStartPos != iEndPos) - Sci_SendMsgV0(DELWORDRIGHT); - else // iStartPos == iEndPos - Sci_SendMsgV0(LINEDELETE); - } - } - break; - - - case CMD_RECODEDEFAULT: - { - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - Encoding_SrcCmdLn(Encoding_MapUnicode(g_iDefaultNewFileEncoding)); - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - FileLoad(false,false,true,true,true,tchCurFile2); - } - } - break; - - - case CMD_RECODEANSI: - { - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - Encoding_SrcCmdLn(CPI_ANSI_DEFAULT); - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - FileLoad(false,false,true,true,bSkipANSICodePageDetection,tchCurFile2); - } - } - break; - - - case CMD_RECODEOEM: - { - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - Encoding_SrcCmdLn(CPI_OEM); - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - FileLoad(false,false,true,true,true,tchCurFile2); - } - } - break; - - - case CMD_RELOADASCIIASUTF8: - { - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - bool _bLoadASCIIasUTF8 = bLoadASCIIasUTF8; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - bLoadASCIIasUTF8 = 1; - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - FileLoad(false,false,true,false,true,tchCurFile2); - bLoadASCIIasUTF8 = _bLoadASCIIasUTF8; - } - } - break; - - - case CMD_RELOADNOFILEVARS: - { - WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - int _fNoFileVariables = flagNoFileVariables; - bool _bNoEncodingTags = bNoEncodingTags; - flagNoFileVariables = 1; - bNoEncodingTags = 1; - StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); - FileLoad(false,false,true, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchCurFile2); - flagNoFileVariables = _fNoFileVariables; - bNoEncodingTags = _bNoEncodingTags; - } - } - break; - - - case CMD_LEXDEFAULT: - Style_SetDefaultLexer(g_hwndEdit); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - break; - - - case CMD_LEXHTML: - Style_SetHTMLLexer(g_hwndEdit); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - break; - - - case CMD_LEXXML: - Style_SetXMLLexer(g_hwndEdit); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - break; - - - case CMD_TIMESTAMPS: - { - WCHAR wchFind[256] = { L'\0' }; - WCHAR wchTemplate[256] = { L'\0' }; - WCHAR wchReplace[256] = { L'\0' }; - - SYSTEMTIME st; - struct tm sst; - - EDITFINDREPLACE efrTS = EFR_INIT_DATA; - efrTS.hwnd = g_hwndEdit; - efrTS.fuFlags = SCFIND_REGEXP; - - IniGetString(L"Settings2",L"TimeStamp",L"\\$Date:[^\\$]+\\$ | $Date: %Y/%m/%d %H:%M:%S $",wchFind,COUNTOF(wchFind)); - - WCHAR *pwchSep = StrChr(wchFind, L'|'); - if (pwchSep) { - StringCchCopy(wchTemplate,COUNTOF(wchTemplate),pwchSep + 1); - *pwchSep = 0; - } - - StrTrim(wchFind,L" "); - StrTrim(wchTemplate,L" "); - - if (StringCchLenW(wchFind,COUNTOF(wchFind)) == 0 || StringCchLenW(wchTemplate,COUNTOF(wchTemplate)) == 0) - break; - - GetLocalTime(&st); - sst.tm_isdst = -1; - sst.tm_sec = (int)st.wSecond; - sst.tm_min = (int)st.wMinute; - sst.tm_hour = (int)st.wHour; - sst.tm_mday = (int)st.wDay; - sst.tm_mon = (int)st.wMonth - 1; - sst.tm_year = (int)st.wYear - 1900; - sst.tm_wday = (int)st.wDayOfWeek; - mktime(&sst); - wcsftime(wchReplace,COUNTOF(wchReplace),wchTemplate,&sst); - - WideCharToMultiByteStrg(Encoding_SciCP,wchFind,efrTS.szFind); - WideCharToMultiByteStrg(Encoding_SciCP,wchReplace,efrTS.szReplace); - - if (!SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) - EditReplaceAllInSelection(g_hwndEdit, &efrTS, true); - else - EditReplaceAll(g_hwndEdit,&efrTS,true); - } - break; - - - case IDM_HELP_UPDATEINSTALLER: - DialogUpdateCheck(hwnd, true); - break; - - case IDM_HELP_UPDATEWEBSITE: - DialogUpdateCheck(hwnd, false); - break; - - case CMD_WEBACTION1: - case CMD_WEBACTION2: - { - WCHAR szCmdTemplate[256] = { L'\0' }; - - LPWSTR lpszTemplateName = (LOWORD(wParam) == CMD_WEBACTION1) ? L"WebTemplate1" : L"WebTemplate2"; - - bool bCmdEnabled = IniGetString(L"Settings2",lpszTemplateName,L"",szCmdTemplate,COUNTOF(szCmdTemplate)); - - if (bCmdEnabled) { - - const DocPos cchSelection = SciCall_GetSelText(NULL); - - char mszSelection[512] = { '\0' }; - if ((1 < cchSelection) && (cchSelection < (DocPos)COUNTOF(mszSelection))) - { - SciCall_GetSelText(mszSelection); - - // Check lpszSelection and truncate bad WCHARs - char* lpsz = StrChrA(mszSelection,13); - if (lpsz) *lpsz = '\0'; - - lpsz = StrChrA(mszSelection,10); - if (lpsz) *lpsz = '\0'; - - lpsz = StrChrA(mszSelection,9); - if (lpsz) *lpsz = '\0'; - - if (StringCchLenA(mszSelection,COUNTOF(mszSelection))) { - - WCHAR wszSelection[512] = { L'\0' }; - MultiByteToWideCharStrg(Encoding_SciCP,mszSelection,wszSelection); - - int cmdsz = (512 + COUNTOF(szCmdTemplate) + MAX_PATH + 32); - LPWSTR lpszCommand = AllocMem(sizeof(WCHAR)*cmdsz, HEAP_ZERO_MEMORY); - StringCchPrintf(lpszCommand,cmdsz,szCmdTemplate,wszSelection); - ExpandEnvironmentStringsEx(lpszCommand, cmdsz); - - WCHAR wchDirectory[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - StringCchCopy(wchDirectory,COUNTOF(wchDirectory),g_wchCurFile); - PathRemoveFileSpec(wchDirectory); - } - - SHELLEXECUTEINFO sei; - ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = SEE_MASK_NOZONECHECKS; - sei.hwnd = NULL; - sei.lpVerb = NULL; - sei.lpFile = lpszCommand; - sei.lpParameters = NULL; - sei.lpDirectory = wchDirectory; - sei.nShow = SW_SHOWNORMAL; - ShellExecuteEx(&sei); - - FreeMem(lpszCommand); - } - } - } - } - break; - - - case CMD_INCLINELIMIT: - case CMD_DECLINELIMIT: - if (!bMarkLongLines) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_LONGLINEMARKER,1),0); - else { - if (LOWORD(wParam) == CMD_INCLINELIMIT) - iLongLinesLimit++; - else - iLongLinesLimit--; - iLongLinesLimit = max(min(iLongLinesLimit,4096),0); - SendMessage(g_hwndEdit,SCI_SETEDGECOLUMN,iLongLinesLimit,0); - UpdateToolbar(); - UpdateStatusbar(); - iLongLinesLimitG = iLongLinesLimit; - } - break; - - case CMD_STRINGIFY: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"'", L"'"); - EndUndoAction(token); - } - break; - - - case CMD_STRINGIFY2: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"\"", L"\""); - EndUndoAction(token); - } - break; - - - case CMD_EMBRACE: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"(", L")"); - EndUndoAction(token); - } - break; - - - case CMD_EMBRACE2: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"[", L"]"); - EndUndoAction(token); - } - break; - - - case CMD_EMBRACE3: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"{", L"}"); - EndUndoAction(token); - } - break; - - - case CMD_EMBRACE4: - { - int token = BeginUndoAction(); - EditEncloseSelection(g_hwndEdit, L"`", L"`"); - EndUndoAction(token); - } - break; - - - case CMD_INCREASENUM: - EditModifyNumber(g_hwndEdit,true); - break; - - - case CMD_DECREASENUM: - EditModifyNumber(g_hwndEdit,false); - break; - - - case CMD_TOGGLETITLE: - EditGetExcerpt(g_hwndEdit,szTitleExcerpt,COUNTOF(szTitleExcerpt)); - UpdateToolbar(); - break; - - - case CMD_JUMP2SELSTART: - EditJumpToSelectionStart(g_hwndEdit); - SciCall_ChooseCaretX(); - break; - - case CMD_JUMP2SELEND: - EditJumpToSelectionEnd(g_hwndEdit); - SciCall_ChooseCaretX(); - break; - - - case CMD_COPYPATHNAME: { - - WCHAR *pszCopy; - WCHAR tchUntitled[32] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - pszCopy = g_wchCurFile; - else { - GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); - pszCopy = tchUntitled; - } - SetClipboardTextW(hwnd, pszCopy); - UpdateToolbar(); - } - break; - - - case CMD_COPYWINPOS: { - - WCHAR wszWinPos[MIDSZ_BUFFER]; - WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); - StringCchPrintf(wszWinPos,COUNTOF(wszWinPos),L"/pos %i,%i,%i,%i,%i",wi.x,wi.y,wi.cx,wi.cy,wi.max); - SetClipboardTextW(hwnd, wszWinPos); - UpdateToolbar(); - } - break; - - - case CMD_DEFAULTWINPOS: - SnapToDefaultPos(hwnd); - break; - - - case CMD_OPENINIFILE: - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile))) { - CreateIniFile(); - FileLoad(false,false,false,false,true,g_wchIniFile); - } - break; - - - case CMD_OPEN_HYPERLINK: - OpenHotSpotURL(SciCall_GetCurrentPos(), false); - break; - - - case CMD_ALTDOWN: - EditFoldAltArrow(DOWN, SNIFF); - break; - - case CMD_ALTUP: - EditFoldAltArrow(UP, SNIFF); - break; - - case CMD_ALTLEFT: - EditFoldAltArrow(NONE, FOLD); - break; - - case CMD_ALTRIGHT: - EditFoldAltArrow(NONE, EXPAND); - break; - - - case IDT_FILE_NEW: - if (IsCmdEnabled(hwnd,IDM_FILE_NEW)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_NEW,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_OPEN: - if (IsCmdEnabled(hwnd,IDM_FILE_OPEN)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_OPEN,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_BROWSE: - if (IsCmdEnabled(hwnd,IDM_FILE_BROWSE)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_BROWSE,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_SAVE: - if (IsCmdEnabled(hwnd,IDM_FILE_SAVE)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVE,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_UNDO: - if (IsCmdEnabled(hwnd,IDM_EDIT_UNDO)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_UNDO,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_REDO: - if (IsCmdEnabled(hwnd,IDM_EDIT_REDO)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REDO,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_CUT: - if (IsCmdEnabled(hwnd,IDM_EDIT_CUT)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CUT,1),0); - else - MessageBeep(0); - //SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CUTLINE,1),0); - break; - - - case IDT_EDIT_COPY: - if (IsCmdEnabled(hwnd,IDM_EDIT_COPY)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_COPY,1),0); - else - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_COPYALL,1),0); // different to Keyboard-Shortcut - break; - - - case IDT_EDIT_PASTE: - if (IsCmdEnabled(hwnd,IDM_EDIT_PASTE)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_PASTE,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_FIND: - if (IsCmdEnabled(hwnd,IDM_EDIT_FIND)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_FIND,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_REPLACE: - if (IsCmdEnabled(hwnd,IDM_EDIT_REPLACE)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_WORDWRAP: - if (IsCmdEnabled(hwnd,IDM_VIEW_WORDWRAP)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_WORDWRAP,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_ZOOMIN: - if (IsCmdEnabled(hwnd,IDM_VIEW_ZOOMIN)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_ZOOMIN,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_ZOOMOUT: - if (IsCmdEnabled(hwnd,IDM_VIEW_ZOOMOUT)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_ZOOMOUT,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_SCHEME: - if (IsCmdEnabled(hwnd,IDM_VIEW_SCHEME)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_SCHEME,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_SCHEMECONFIG: - if (IsCmdEnabled(hwnd,IDM_VIEW_SCHEMECONFIG)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_SCHEMECONFIG,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_EXIT: - SendMessage(hwnd,WM_CLOSE,0,0); - break; - - - case IDT_FILE_SAVEAS: - if (IsCmdEnabled(hwnd,IDM_FILE_SAVEAS)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVEAS,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_SAVECOPY: - if (IsCmdEnabled(hwnd,IDM_FILE_SAVECOPY)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVECOPY,1),0); - else - MessageBeep(0); - break; - - - case IDT_EDIT_CLEAR: - if (IsCmdEnabled(hwnd,IDM_EDIT_CLEAR)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CLEAR,1),0); - else - SendMessage(g_hwndEdit,SCI_CLEARALL,0,0); - break; - - - case IDT_FILE_PRINT: - if (IsCmdEnabled(hwnd,IDM_FILE_PRINT)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_PRINT,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_OPENFAV: - if (IsCmdEnabled(hwnd,IDM_FILE_OPENFAV)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_OPENFAV,1),0); - else - MessageBeep(0); - break; - - - case IDT_FILE_ADDTOFAV: - if (IsCmdEnabled(hwnd,IDM_FILE_ADDTOFAV)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_ADDTOFAV,1),0); - else - MessageBeep(0); - break; - - - case IDT_VIEW_TOGGLEFOLDS: - if (IsCmdEnabled(hwnd,IDM_VIEW_TOGGLEFOLDS)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_TOGGLEFOLDS,1),0); - else - MessageBeep(0); - break; - - case IDT_FILE_LAUNCH: - if (IsCmdEnabled(hwnd,IDM_FILE_LAUNCH)) - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_LAUNCH,1),0); - else - MessageBeep(0); - break; - - } - - UNUSED(wParam); - UNUSED(lParam); - - return(0); -} - - -//============================================================================= -// -// OpenHotSpotURL() -// -// -void OpenHotSpotURL(DocPos position, bool bForceBrowser) -{ - int iStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, position, 0); - - if (Style_GetHotspotStyleID() != iStyle) - return; - - if (!(bool)SendMessage(g_hwndEdit, SCI_STYLEGETHOTSPOT, Style_GetHotspotStyleID(), 0)) - return; - - // get left most position of style - DocPos pos = position; - int iNewStyle = iStyle; - while ((iNewStyle == iStyle) && (--pos > 0)) { - iNewStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, pos, 0); - } - DocPos firstPos = (pos != 0) ? (pos + 1) : 0; - - // get right most position of style - pos = position; - iNewStyle = iStyle; - DocPos posTextLength = SciCall_GetTextLength(); - while ((iNewStyle == iStyle) && (++pos < posTextLength)) { - iNewStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, pos, 0); - } - DocPos lastPos = pos; - DocPos length = (lastPos - firstPos); - - if ((length > 0) && (length < XHUGE_BUFFER)) - { - char chURL[XHUGE_BUFFER] = { '\0' }; - - StringCchCopyNA(chURL, XHUGE_BUFFER, SciCall_GetRangePointer(firstPos, length), length); - StrTrimA(chURL, " \t\n\r"); - - if (!StringCchLenA(chURL, COUNTOF(chURL))) { return; } - - WCHAR wchURL[HUGE_BUFFER] = { L'\0' }; - MultiByteToWideCharStrg(Encoding_SciCP, chURL, wchURL); - - const WCHAR* chkPreFix = L"file://"; - const int len = lstrlen(chkPreFix); - - if (!bForceBrowser && (StrStrIW(wchURL, chkPreFix) == wchURL)) - { - WCHAR* szFileName = &(wchURL[len]); - StrTrimW(szFileName, L"/"); - - PathCanonicalizeEx(szFileName, COUNTOF(wchURL) - len); - - if (PathIsDirectory(szFileName)) - { - WCHAR tchFile[MAX_PATH + 1] = { L'\0' }; - - if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), szFileName)) - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); - } - else - FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szFileName); - - } - else { // open in web browser - - WCHAR wchDirectory[MAX_PATH+1] = { L'\0' }; - if (StringCchLenW(g_wchCurFile, COUNTOF(g_wchCurFile))) { - StringCchCopy(wchDirectory, COUNTOF(wchDirectory), g_wchCurFile); - PathRemoveFileSpec(wchDirectory); - } - - SHELLEXECUTEINFO sei; - ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = SEE_MASK_NOZONECHECKS; - sei.hwnd = NULL; - sei.lpVerb = NULL; - sei.lpFile = wchURL; - sei.lpParameters = NULL; - sei.lpDirectory = wchDirectory; - sei.nShow = SW_SHOWNORMAL; - ShellExecuteEx(&sei); - - } - - } -} - - - -//============================================================================= -// -// MsgNotify() - Handles WM_NOTIFY -// -// -LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) -{ - LPNMHDR pnmh = (LPNMHDR)lParam; - struct SCNotification* scn = (struct SCNotification*)lParam; - - if (!CheckNotifyChangeEvent()) - { - // --- check only mandatory events (must be fast !!!) --- - if (pnmh->idFrom == IDC_EDIT) { - if (pnmh->code == SCN_MODIFIED) { - // check for ADDUNDOACTION step - if (scn->modificationType & SC_MOD_CONTAINER) - { - if (scn->modificationType & SC_PERFORMED_UNDO) { - RestoreAction(scn->token, UNDO); - } - else if (scn->modificationType & SC_PERFORMED_REDO) { - RestoreAction(scn->token, REDO); - } - } - _SetDocumentModified(true); - return true; - } - else if (pnmh->code == SCN_SAVEPOINTREACHED) { - _SetDocumentModified(false); - return true; - } - else if (pnmh->code == SCN_SAVEPOINTLEFT) { - _SetDocumentModified(true); - return true; - } - } - return false; - } - - switch(pnmh->idFrom) - { - case IDC_EDIT: - - switch (pnmh->code) - { - case SCN_HOTSPOTCLICK: - { - if (scn->modifiers & SCMOD_CTRL) { - // open in browser - OpenHotSpotURL((int)scn->position, true); - } - if (scn->modifiers & SCMOD_ALT) { - // open in application, if applicable (file://) - OpenHotSpotURL((int)scn->position, false); - } - } - break; - - - //case SCN_STYLENEEDED: // this event needs SCI_SETLEXER(SCLEX_CONTAINER) - // { - // int lineNumber = SciCall_LineFromPosition(SciCall_GetEndStyled()); - // EditUpdateUrlHotspots(g_hwndEdit, SciCall_PositionFromLine(lineNumber), (int)scn->position, bHyperlinkHotspot); - // } - // break; - - case SCN_UPDATEUI: - - //if (scn->updated & SC_UPDATE_NP3_INTERNAL_NOTIFY) { - // // special case - //} - //else - - if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) - { - //~InvalidateSelections(); // fixed in SCI ? - - // Brace Match - if (bMatchBraces) { - EditMatchBrace(g_hwndEdit); - } - - if (iMarkOccurrences > 0) { - // clear marks only, if caret/selection changed - if (scn->updated & SC_UPDATE_SELECTION) { - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - } - else { - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - } - } - - if (bHyperlinkHotspot) { - UpdateVisibleUrlHotspot(iUpdateDelayHyperlinkStyling); - } - UpdateToolbar(); - UpdateStatusbar(); - } - else if (scn->updated & SC_UPDATE_V_SCROLL) - { - if ((iMarkOccurrences > 0) && bMarkOccurrencesMatchVisible) { - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - } - if (bHyperlinkHotspot) { - UpdateVisibleUrlHotspot(iUpdateDelayHyperlinkStyling); - } - } - break; - - - case SCN_MODIFIED: - { - // check for ADDUNDOACTION step - if (scn->modificationType & SC_MOD_CONTAINER) { - if (scn->modificationType & SC_PERFORMED_UNDO) { - RestoreAction(scn->token, UNDO); - } - else if (scn->modificationType & SC_PERFORMED_REDO) { - RestoreAction(scn->token, REDO); - } - } - else if (scn->modificationType & SC_MOD_CHANGESTYLE) { - const DocPos iStartPos = (DocPos)scn->position; - const DocPos iEndPos = (DocPos)(scn->position + scn->length); - EditUpdateUrlHotspots(g_hwndEdit, iStartPos, iEndPos, bHyperlinkHotspot); - } - - if (iMarkOccurrences > 0) { - EditClearAllMarks(g_hwndEdit, 0, -1); - MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - } - - if (scn->linesAdded != 0) { - UpdateLineNumberWidth(); - } - - _SetDocumentModified(true); - - UpdateToolbar(); - UpdateStatusbar(); - } - break; - - - case SCN_CHARADDED: - { - // Auto indent - if (bAutoIndent && (scn->ch == '\x0D' || scn->ch == '\x0A')) - { - // in CRLF mode handle LF only... - if ((SC_EOL_CRLF == g_iEOLMode && scn->ch != '\x0A') || SC_EOL_CRLF != g_iEOLMode) - { - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocLn iCurLine = SciCall_LineFromPosition(iCurPos); - - // Move bookmark along with line if inserting lines (pressing return within indent area of line) because Scintilla does not do this for us - if (iCurLine > 0) - { - //const DocPos iPrevLineLength = Sci_GetNetLineLength(iCurLine - 1); - if (SciCall_GetLineEndPosition(iCurLine - 1) == SciCall_GetLineIndentPosition(iCurLine - 1)) - { - int bitmask = SciCall_MarkerGet(iCurLine - 1); - if (bitmask & (1 << MARKER_NP3_BOOKMARK)) - { - SciCall_MarkerDelete(iCurLine - 1, MARKER_NP3_BOOKMARK); - SciCall_MarkerAdd(iCurLine, MARKER_NP3_BOOKMARK); - } - } - } - - if (iCurLine > 0/* && iLineLength <= 2*/) - { - const DocPos iPrevLineLength = SciCall_LineLength(iCurLine - 1); - char* pLineBuf = NULL; - bool bAllocLnBuf = false; - if (iPrevLineLength < TEMPLINE_BUFFER) { - pLineBuf = g_pTempLineBufferMain; - } - else { - bAllocLnBuf = true; - pLineBuf = AllocMem(iPrevLineLength + 1, HEAP_ZERO_MEMORY); - } - if (pLineBuf) - { - SendMessage(g_hwndEdit, SCI_GETLINE, iCurLine - 1, (LPARAM)pLineBuf); - *(pLineBuf + iPrevLineLength) = '\0'; - for (char* pPos = pLineBuf; *pPos; pPos++) { - if (*pPos != ' ' && *pPos != '\t') - *pPos = '\0'; - } - if (*pLineBuf) { - SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); - SendMessage(g_hwndEdit, SCI_ADDTEXT, lstrlenA(pLineBuf), (LPARAM)pLineBuf); - SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); - } - if (bAllocLnBuf) { FreeMem(pLineBuf); } - } - } - } - } - // Auto close tags - else if (bAutoCloseTags && scn->ch == '>') - { - //int iLexer = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); - //if (iLexer == SCLEX_HTML || iLexer == SCLEX_XML) - { - const DocPos iCurPos = SciCall_GetCurrentPos(); - const DocPos iHelper = iCurPos - (DocPos)(COUNTOF(g_pTempLineBufferMain) - 1); - const DocPos iStartPos = max(0, iHelper); - const DocPos iSize = iCurPos - iStartPos; - - if (iSize >= 3) - { - const char* pBegin = SciCall_GetRangePointer(iStartPos, iSize); - - if (pBegin[iSize - 2] != '/') { - - const char* pCur = &pBegin[iSize - 2]; - - while (pCur > pBegin && *pCur != '<' && *pCur != '>') - --pCur; - - int cchIns = 2; - StringCchCopyA(g_pTempLineBufferMain, FNDRPL_BUFFER, "'; - g_pTempLineBufferMain[cchIns] = '\0'; - - if (cchIns > 3 && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "
", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && - StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1)) - { - int token = BeginUndoAction(); - SciCall_ReplaceSel(g_pTempLineBufferMain); - SciCall_SetSel(iCurPos, iCurPos); - EndUndoAction(token); - } - } - } - } - } - else if (bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) { - EditCompleteWord(g_hwndEdit, false); - } - } - break; - - - case SCN_NEEDSHOWN: - { - DocLn iFirstLine = SciCall_LineFromPosition((DocPos)scn->position); - DocLn iLastLine = SciCall_LineFromPosition((DocPos)(scn->position + scn->length - 1)); - for (DocLn i = iFirstLine; i <= iLastLine; ++i) { SciCall_EnsureVisible(i); } - } - break; - - - case SCN_MARGINCLICK: - if (scn->margin == MARGIN_SCI_FOLDING) { - EditFoldClick(SciCall_LineFromPosition((DocPos)scn->position), scn->modifiers); - } - break; - - - // ~~~ Not used in Windows ~~~ - // see: CMD_ALTUP / CMD_ALTDOWN - //case SCN_KEY: - // // Also see the corresponding patch in scintilla\src\Editor.cxx - // FoldAltArrow(scn->ch, scn->modifiers); - // break; - - - case SCN_SAVEPOINTREACHED: - SciCall_SetScrollWidth(1); - _SetDocumentModified(false); - break; - - - case SCN_SAVEPOINTLEFT: - _SetDocumentModified(true); - break; - - - case SCN_ZOOM: - UpdateLineNumberWidth(); - break; - - - default: - return false; - } - return true; - - - case IDC_TOOLBAR: - - switch(pnmh->code) - { - case TBN_ENDADJUST: - UpdateToolbar(); - break; - - case TBN_QUERYDELETE: - case TBN_QUERYINSERT: - break; - - case TBN_GETBUTTONINFO: - { - if (((LPTBNOTIFY)lParam)->iItem < COUNTOF(tbbMainWnd)) - { - WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; - GetString(tbbMainWnd[((LPTBNOTIFY)lParam)->iItem].idCommand,tch,COUNTOF(tch)); - StringCchCopyN(((LPTBNOTIFY)lParam)->pszText,((LPTBNOTIFY)lParam)->cchText,tch,((LPTBNOTIFY)lParam)->cchText); - CopyMemory(&((LPTBNOTIFY)lParam)->tbButton,&tbbMainWnd[((LPTBNOTIFY)lParam)->iItem],sizeof(TBBUTTON)); - return true; - } - } - return false; - - case TBN_RESET: - { - int i; int c = (int)SendMessage(g_hwndToolbar,TB_BUTTONCOUNT,0,0); - for (i = 0; i < c; i++) { - SendMessage(g_hwndToolbar, TB_DELETEBUTTON, 0, 0); - } - SendMessage(g_hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd); - return(0); - } - break; - - default: - return false; - } - return true; - - - case IDC_STATUSBAR: - - switch(pnmh->code) - { - - case NM_CLICK: - { - LPNMMOUSE pnmm = (LPNMMOUSE)lParam; - - switch (pnmm->dwItemSpec) - { - case STATUS_EOLMODE: - SendMessage(g_hwndEdit,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); - EditFixPositions(g_hwndEdit); - return true; - - default: - return false; - } - } - - case NM_DBLCLK: - { - int i; - LPNMMOUSE pnmm = (LPNMMOUSE)lParam; - - switch (pnmm->dwItemSpec) - { - case STATUS_CODEPAGE: - SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_ENCODING_SELECT,1),0); - return true; - - case STATUS_EOLMODE: - if (g_iEOLMode == SC_EOL_CRLF) - i = IDM_LINEENDINGS_CRLF; - else if (g_iEOLMode == SC_EOL_LF) - i = IDM_LINEENDINGS_LF; - else - i = IDM_LINEENDINGS_CR; - i++; - if (i > IDM_LINEENDINGS_CR) - i = IDM_LINEENDINGS_CRLF; - SendMessage(hwnd,WM_COMMAND,MAKELONG(i,1),0); - return true; - - case STATUS_OVRMODE: - SendMessage(g_hwndEdit,SCI_EDITTOGGLEOVERTYPE,0,0); - return true; - - case STATUS_2ND_DEF: - SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_USE2NDDEFAULT, 1), 0); - return true; - - case STATUS_LEXER: - SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_SCHEME, 1), 0); - return true; - - default: - return false; - } - } - break; - - } - return true; - - - default: - - switch(pnmh->code) - { - case TTN_NEEDTEXT: - { - if (!(((LPTOOLTIPTEXT)lParam)->uFlags & TTF_IDISHWND)) - { - WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; - GetString((UINT)pnmh->idFrom,tch,COUNTOF(tch)); - StringCchCopyN(((LPTOOLTIPTEXT)lParam)->szText,COUNTOF(((LPTOOLTIPTEXT)lParam)->szText),tch,COUNTOF(((LPTOOLTIPTEXT)lParam)->szText)); - } - } - break; - - } - break; - - } - - UNUSED(wParam); - - return false; -} - - - -//============================================================================= -// -// Set/Get FindPattern() -// -static WCHAR sCurrentFindPattern[FNDRPL_BUFFER] = { L'\0' }; - -bool IsFindPatternEmpty() -{ - return (StringCchLenW(sCurrentFindPattern, COUNTOF(sCurrentFindPattern)) == 0); -} - -//============================================================================= -// -// SetFindPattern() -// -void SetFindPattern(LPCWSTR wchFindPattern) -{ - StringCchCopyW(sCurrentFindPattern, COUNTOF(sCurrentFindPattern), (wchFindPattern ? wchFindPattern : L"")); -} - -//============================================================================= -// -// SetFindPatternMB() -// -void SetFindPatternMB(LPCSTR chFindPattern) -{ - MultiByteToWideChar(Encoding_SciCP, 0, chFindPattern, -1, sCurrentFindPattern, COUNTOF(sCurrentFindPattern)); -} - -//============================================================================= -// -// GetFindPattern() -// -void GetFindPattern(LPWSTR wchFindPattern, size_t bufferSize) -{ - StringCchCopyW(wchFindPattern, bufferSize, sCurrentFindPattern); -} - -//============================================================================= -// -// GetFindPatternMB() -// -void GetFindPatternMB(LPSTR chFindPattern, size_t bufferSize) -{ - WideCharToMultiByte(Encoding_SciCP, 0, sCurrentFindPattern, -1, chFindPattern, (int)bufferSize, NULL, NULL); -} - - -//============================================================================= -// -// LoadSettings() -// -// -void LoadSettings() -{ - WCHAR *pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); - int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - LoadIniSection(L"Settings",pIniSection,cchIniSection); - - bEnableSaveSettings = true; - bSaveSettings = IniSectionGetBool(pIniSection,L"SaveSettings",true); - bSaveRecentFiles = IniSectionGetBool(pIniSection,L"SaveRecentFiles",false); - bPreserveCaretPos = IniSectionGetBool(pIniSection, L"PreserveCaretPos",false); - bSaveFindReplace = IniSectionGetBool(pIniSection,L"SaveFindReplace",false); - - g_efrData.bFindClose = IniSectionGetBool(pIniSection,L"CloseFind", false); - g_efrData.bReplaceClose = IniSectionGetBool(pIniSection,L"CloseReplace", false); - g_efrData.bNoFindWrap = IniSectionGetBool(pIniSection,L"NoFindWrap", false); - g_efrData.bTransformBS = IniSectionGetBool(pIniSection,L"FindTransformBS", false); - g_efrData.bWildcardSearch = IniSectionGetBool(pIniSection,L"WildcardSearch",false); - g_efrData.bMarkOccurences = IniSectionGetBool(pIniSection, L"FindMarkAllOccurrences", false); - g_efrData.bDotMatchAll = IniSectionGetBool(pIniSection, L"RegexDotMatchesAll", false); - g_efrData.fuFlags = IniSectionGetUInt(pIniSection, L"efrData_fuFlags", 0); - - if (!IniSectionGetString(pIniSection, L"OpenWithDir", L"", tchOpenWithDir, COUNTOF(tchOpenWithDir))) { - //SHGetSpecialFolderPath(NULL, tchOpenWithDir, CSIDL_DESKTOPDIRECTORY, true); - GetKnownFolderPath(&FOLDERID_Desktop, tchOpenWithDir, COUNTOF(tchOpenWithDir)); - } - else { - PathAbsoluteFromApp(tchOpenWithDir, NULL, COUNTOF(tchOpenWithDir), true); - } - if (!IniSectionGetString(pIniSection, L"Favorites", L"", tchFavoritesDir, COUNTOF(tchFavoritesDir))) { - //SHGetFolderPath(NULL,CSIDL_PERSONAL,NULL,SHGFP_TYPE_CURRENT,tchFavoritesDir); - GetKnownFolderPath(&FOLDERID_Favorites, tchFavoritesDir, COUNTOF(tchFavoritesDir)); - } - else { - PathAbsoluteFromApp(tchFavoritesDir, NULL, COUNTOF(tchFavoritesDir), true); - } - - iPathNameFormat = IniSectionGetInt(pIniSection,L"PathNameFormat",0); - iPathNameFormat = max(min(iPathNameFormat,2),0); - - bWordWrap = IniSectionGetBool(pIniSection,L"WordWrap",false); - bWordWrapG = bWordWrap; - - iWordWrapMode = IniSectionGetInt(pIniSection,L"WordWrapMode",0); - iWordWrapMode = max(min(iWordWrapMode,1),0); - - iWordWrapIndent = IniSectionGetInt(pIniSection,L"WordWrapIndent",0); - iWordWrapIndent = max(min(iWordWrapIndent,6),0); - - iWordWrapSymbols = IniSectionGetInt(pIniSection,L"WordWrapSymbols",22); - iWordWrapSymbols = max(min(iWordWrapSymbols%10,2),0)+max(min((iWordWrapSymbols%100-iWordWrapSymbols%10)/10,2),0)*10; - - bShowWordWrapSymbols = IniSectionGetBool(pIniSection,L"ShowWordWrapSymbols",0); - - bMatchBraces = IniSectionGetBool(pIniSection,L"MatchBraces",true); - - bAutoCloseTags = IniSectionGetBool(pIniSection,L"AutoCloseTags",false); - - bHiliteCurrentLine = IniSectionGetBool(pIniSection,L"HighlightCurrentLine",false); - - bHyperlinkHotspot = IniSectionGetBool(pIniSection, L"HyperlinkHotspot", false); - - bScrollPastEOF = IniSectionGetBool(pIniSection, L"ScrollPastEOF", false); - - bAutoIndent = IniSectionGetBool(pIniSection,L"AutoIndent",true); - - bAutoCompleteWords = IniSectionGetBool(pIniSection,L"AutoCompleteWords",false); - - bAccelWordNavigation = IniSectionGetBool(pIniSection, L"AccelWordNavigation", false); - - bShowIndentGuides = IniSectionGetBool(pIniSection,L"ShowIndentGuides",false); - - g_bTabsAsSpaces = IniSectionGetBool(pIniSection,L"TabsAsSpaces",true); - bTabsAsSpacesG = g_bTabsAsSpaces; - - g_bTabIndents = IniSectionGetBool(pIniSection,L"TabIndents",true); - bTabIndentsG = g_bTabIndents; - - bBackspaceUnindents = IniSectionGetBool(pIniSection,L"BackspaceUnindents",false); - - g_iTabWidth = IniSectionGetInt(pIniSection,L"TabWidth",2); - g_iTabWidth = max(min(g_iTabWidth,256),1); - iTabWidthG = g_iTabWidth; - - g_iIndentWidth = IniSectionGetInt(pIniSection,L"IndentWidth",0); - g_iIndentWidth = max(min(g_iIndentWidth,256),0); - iIndentWidthG = g_iIndentWidth; - - bMarkLongLines = IniSectionGetBool(pIniSection,L"MarkLongLines",false); - - iLongLinesLimit = IniSectionGetInt(pIniSection,L"LongLinesLimit",72); - iLongLinesLimit = max(min(iLongLinesLimit,4096),0); - iLongLinesLimitG = iLongLinesLimit; - - iLongLineMode = IniSectionGetInt(pIniSection,L"LongLineMode",EDGE_LINE); - iLongLineMode = max(min(iLongLineMode,EDGE_BACKGROUND),EDGE_LINE); - - g_bShowSelectionMargin = IniSectionGetBool(pIniSection,L"ShowSelectionMargin",false); - - bShowLineNumbers = IniSectionGetBool(pIniSection,L"ShowLineNumbers", true); - - g_bShowCodeFolding = IniSectionGetBool(pIniSection,L"ShowCodeFolding", true); - - iMarkOccurrences = IniSectionGetInt(pIniSection,L"MarkOccurrences",1); - iMarkOccurrences = max(min(iMarkOccurrences, 3), 0); - bMarkOccurrencesMatchVisible = IniSectionGetBool(pIniSection, L"MarkOccurrencesMatchVisible", false); - bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchCase",false); - bMarkOccurrencesMatchWords = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchWholeWords",true); - bMarkOccurrencesCurrentWord = IniSectionGetBool(pIniSection, L"MarkOccurrencesCurrentWord", !bMarkOccurrencesMatchWords); - bMarkOccurrencesCurrentWord = bMarkOccurrencesCurrentWord && !bMarkOccurrencesMatchWords; - - bViewWhiteSpace = IniSectionGetBool(pIniSection,L"ViewWhiteSpace", false); - - bViewEOLs = IniSectionGetBool(pIniSection,L"ViewEOLs", false); - - g_iDefaultNewFileEncoding = IniSectionGetInt(pIniSection,L"DefaultEncoding", CPI_NONE); - // if DefaultEncoding is not defined set to system's current code-page - g_iDefaultNewFileEncoding = (g_iDefaultNewFileEncoding == CPI_NONE) ? - Encoding_MapIniSetting(true,(int)GetACP()) : Encoding_MapIniSetting(true,g_iDefaultNewFileEncoding); - - bUseDefaultForFileEncoding = IniSectionGetBool(pIniSection, L"UseDefaultForFileEncoding", false); - - bSkipUnicodeDetection = IniSectionGetBool(pIniSection, L"SkipUnicodeDetection", false); - - bSkipANSICodePageDetection = IniSectionGetBool(pIniSection, L"SkipANSICodePageDetection", true); - - bLoadASCIIasUTF8 = IniSectionGetBool(pIniSection, L"LoadASCIIasUTF8", false); - - bLoadNFOasOEM = IniSectionGetBool(pIniSection,L"LoadNFOasOEM",true); - - bNoEncodingTags = IniSectionGetBool(pIniSection,L"NoEncodingTags", false); - - g_iDefaultEOLMode = IniSectionGetInt(pIniSection,L"DefaultEOLMode",0); - g_iDefaultEOLMode = max(min(g_iDefaultEOLMode,2),0); - - bFixLineEndings = IniSectionGetBool(pIniSection,L"FixLineEndings",true); - - bAutoStripBlanks = IniSectionGetBool(pIniSection,L"FixTrailingBlanks",false); - - iPrintHeader = IniSectionGetInt(pIniSection,L"PrintHeader",1); - iPrintHeader = max(min(iPrintHeader,3),0); - - iPrintFooter = IniSectionGetInt(pIniSection,L"PrintFooter",0); - iPrintFooter = max(min(iPrintFooter,1),0); - - iPrintColor = IniSectionGetInt(pIniSection,L"PrintColorMode",3); - iPrintColor = max(min(iPrintColor,4),0); - - iPrintZoom = IniSectionGetInt(pIniSection,L"PrintZoom",10)-10; - iPrintZoom = max(min(iPrintZoom,20),-10); - - pagesetupMargin.left = IniSectionGetInt(pIniSection,L"PrintMarginLeft",-1); - pagesetupMargin.left = max(pagesetupMargin.left,-1); - - pagesetupMargin.top = IniSectionGetInt(pIniSection,L"PrintMarginTop",-1); - pagesetupMargin.top = max(pagesetupMargin.top,-1); - - pagesetupMargin.right = IniSectionGetInt(pIniSection,L"PrintMarginRight",-1); - pagesetupMargin.right = max(pagesetupMargin.right,-1); - - pagesetupMargin.bottom = IniSectionGetInt(pIniSection,L"PrintMarginBottom",-1); - pagesetupMargin.bottom = max(pagesetupMargin.bottom,-1); - - bSaveBeforeRunningTools = IniSectionGetBool(pIniSection,L"SaveBeforeRunningTools",false); - - iFileWatchingMode = IniSectionGetInt(pIniSection,L"FileWatchingMode",0); - iFileWatchingMode = max(min(iFileWatchingMode,2),0); - - bResetFileWatching = IniSectionGetBool(pIniSection,L"ResetFileWatching",true); - - iEscFunction = IniSectionGetInt(pIniSection,L"EscFunction",0); - iEscFunction = max(min(iEscFunction,2),0); - - bAlwaysOnTop = IniSectionGetBool(pIniSection,L"AlwaysOnTop",false); - - bMinimizeToTray = IniSectionGetBool(pIniSection,L"MinimizeToTray",false); - - bTransparentMode = IniSectionGetBool(pIniSection,L"TransparentMode",false); - - // Check if SetLayeredWindowAttributes() is available - bTransparentModeAvailable = (GetProcAddress(GetModuleHandle(L"User32"),"SetLayeredWindowAttributes") != NULL); - bTransparentModeAvailable = (bTransparentModeAvailable) ? true : false; - - // see TBBUTTON tbbMainWnd[] for initial/reset set of buttons - IniSectionGetString(pIniSection,L"ToolbarButtons", L"", tchToolbarButtons, COUNTOF(tchToolbarButtons)); - - bShowToolbar = IniSectionGetBool(pIniSection,L"ShowToolbar",true); - - bShowStatusbar = IniSectionGetBool(pIniSection,L"ShowStatusbar",true); - - cxEncodingDlg = IniSectionGetInt(pIniSection,L"EncodingDlgSizeX",256); - cxEncodingDlg = max(cxEncodingDlg,0); - - cyEncodingDlg = IniSectionGetInt(pIniSection,L"EncodingDlgSizeY",262); - cyEncodingDlg = max(cyEncodingDlg,0); - - cxRecodeDlg = IniSectionGetInt(pIniSection,L"RecodeDlgSizeX",256); - cxRecodeDlg = max(cxRecodeDlg,0); - - cyRecodeDlg = IniSectionGetInt(pIniSection,L"RecodeDlgSizeY",262); - cyRecodeDlg = max(cyRecodeDlg,0); - - cxFileMRUDlg = IniSectionGetInt(pIniSection,L"FileMRUDlgSizeX",412); - cxFileMRUDlg = max(cxFileMRUDlg,0); - - cyFileMRUDlg = IniSectionGetInt(pIniSection,L"FileMRUDlgSizeY",376); - cyFileMRUDlg = max(cyFileMRUDlg,0); - - cxOpenWithDlg = IniSectionGetInt(pIniSection,L"OpenWithDlgSizeX",384); - cxOpenWithDlg = max(cxOpenWithDlg,0); - - cyOpenWithDlg = IniSectionGetInt(pIniSection,L"OpenWithDlgSizeY",386); - cyOpenWithDlg = max(cyOpenWithDlg,0); - - cxFavoritesDlg = IniSectionGetInt(pIniSection,L"FavoritesDlgSizeX",334); - cxFavoritesDlg = max(cxFavoritesDlg,0); - - cyFavoritesDlg = IniSectionGetInt(pIniSection,L"FavoritesDlgSizeY",316); - cyFavoritesDlg = max(cyFavoritesDlg,0); - - xFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosX",0); - yFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosY",0); - - xCustomSchemesDlg = IniSectionGetInt(pIniSection, L"CustomSchemesDlgPosX", 0); - yCustomSchemesDlg = IniSectionGetInt(pIniSection, L"CustomSchemesDlgPosY", 0); - - LoadIniSection(L"Settings2",pIniSection,cchIniSection); - - bStickyWinPos = IniSectionGetInt(pIniSection,L"StickyWindowPosition",0); - if (bStickyWinPos) bStickyWinPos = 1; - - IniSectionGetString(pIniSection,L"DefaultExtension",L"txt", - tchDefaultExtension,COUNTOF(tchDefaultExtension)); - StrTrim(tchDefaultExtension,L" \t.\""); - - IniSectionGetString(pIniSection,L"DefaultDirectory",L"", - tchDefaultDir,COUNTOF(tchDefaultDir)); - - ZeroMemory(tchFileDlgFilters,sizeof(WCHAR)*COUNTOF(tchFileDlgFilters)); - IniSectionGetString(pIniSection,L"FileDlgFilters",L"", - tchFileDlgFilters,COUNTOF(tchFileDlgFilters)-2); - - dwFileCheckInverval = IniSectionGetInt(pIniSection,L"FileCheckInverval",2000); - dwAutoReloadTimeout = IniSectionGetInt(pIniSection,L"AutoReloadTimeout",2000); - - iSciDirectWriteTech = IniSectionGetInt(pIniSection,L"SciDirectWriteTech", DirectWriteTechnology[0]); - iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); - - iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality", FontQuality[3]); - iSciFontQuality = max(min(iSciFontQuality, 3), 0); - - iMarkOccurrencesMaxCount = IniSectionGetInt(pIniSection,L"MarkOccurrencesMaxCount",2000); - iMarkOccurrencesMaxCount = (iMarkOccurrencesMaxCount <= 0) ? INT_MAX : iMarkOccurrencesMaxCount; - - iUpdateDelayHyperlinkStyling = IniSectionGetInt(pIniSection, L"UpdateDelayHyperlinkStyling", 100); - iUpdateDelayHyperlinkStyling = max(min(iUpdateDelayHyperlinkStyling, 10000), 0); - - iUpdateDelayMarkAllCoccurrences = IniSectionGetInt(pIniSection, L"UpdateDelayMarkAllCoccurrences", 50); - iUpdateDelayMarkAllCoccurrences = max(min(iUpdateDelayMarkAllCoccurrences, 10000), 0); - - bDenyVirtualSpaceAccess = IniSectionGetBool(pIniSection, L"DenyVirtualSpaceAccess", false); - bUseOldStyleBraceMatching = IniSectionGetBool(pIniSection, L"UseOldStyleBraceMatching", false); - - iCurrentLineHorizontalSlop = IniSectionGetInt(pIniSection, L"CurrentLineHorizontalSlop", 0); - iCurrentLineHorizontalSlop = max(min(iCurrentLineHorizontalSlop, 2000), 0); - - iCurrentLineVerticalSlop = IniSectionGetInt(pIniSection, L"CurrentLineVerticalSlop", 0); - iCurrentLineVerticalSlop = max(min(iCurrentLineVerticalSlop, 200), 0); - - LoadIniSection(L"Toolbar Images",pIniSection,cchIniSection); - - IniSectionGetString(pIniSection,L"BitmapDefault",L"", - tchToolbarBitmap,COUNTOF(tchToolbarBitmap)); - IniSectionGetString(pIniSection,L"BitmapHot",L"", - tchToolbarBitmapHot,COUNTOF(tchToolbarBitmap)); - IniSectionGetString(pIniSection,L"BitmapDisabled",L"", - tchToolbarBitmapDisabled,COUNTOF(tchToolbarBitmap)); - - int ResX = GetSystemMetrics(SM_CXSCREEN); - int ResY = GetSystemMetrics(SM_CYSCREEN); - - LoadIniSection(L"Window", pIniSection, cchIniSection); - - WCHAR tchHighDpiToolBar[32] = { L'\0' }; - StringCchPrintf(tchHighDpiToolBar,COUNTOF(tchHighDpiToolBar),L"%ix%i HighDpiToolBar", ResX, ResY); - iHighDpiToolBar = IniSectionGetInt(pIniSection, tchHighDpiToolBar, -1); - iHighDpiToolBar = max(min(iHighDpiToolBar, 1), -1); - if (iHighDpiToolBar < 0) { // undefined: determine high DPI (higher than Full-HD) - if ((ResX > 1920) && (ResY > 1080)) - iHighDpiToolBar = 1; - } - - if (!flagPosParam /*|| bStickyWinPos*/) { // ignore window position if /p was specified - - WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; - - StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); - StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); - StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); - StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); - StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); - - g_WinInfo.x = IniSectionGetInt(pIniSection,tchPosX,CW_USEDEFAULT); - g_WinInfo.y = IniSectionGetInt(pIniSection,tchPosY,CW_USEDEFAULT); - g_WinInfo.cx = IniSectionGetInt(pIniSection,tchSizeX,CW_USEDEFAULT); - g_WinInfo.cy = IniSectionGetInt(pIniSection,tchSizeY,CW_USEDEFAULT); - g_WinInfo.max = IniSectionGetInt(pIniSection,tchMaximized,0); - if (g_WinInfo.max) g_WinInfo.max = 1; - } - - // --- override by resolution specific settings --- - - WCHAR tchSciDirectWriteTech[64]; - StringCchPrintf(tchSciDirectWriteTech,COUNTOF(tchSciDirectWriteTech),L"%ix%i SciDirectWriteTech",ResX,ResY); - iSciDirectWriteTech = IniSectionGetInt(pIniSection,tchSciDirectWriteTech,iSciDirectWriteTech); - iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); - - WCHAR tchSciFontQuality[64]; - StringCchPrintf(tchSciFontQuality,COUNTOF(tchSciFontQuality),L"%ix%i SciFontQuality",ResX,ResY); - iSciFontQuality = IniSectionGetInt(pIniSection,tchSciFontQuality,iSciFontQuality); - iSciFontQuality = max(min(iSciFontQuality, SC_EFF_QUALITY_LCD_OPTIMIZED), SC_TECHNOLOGY_DEFAULT); - - - LocalFree(pIniSection); - - - // define scintilla internal codepage - const int iSciDefaultCodePage = SC_CP_UTF8; // default UTF8 - - // remove internal support for Chinese, Japan, Korean DBCS use UTF-8 instead - /* - if (g_iDefaultNewFileEncoding == CPI_ANSI_DEFAULT) - { - // check for Chinese, Japan, Korean DBCS code pages and switch accordingly - int acp = (int)GetACP(); - if (acp == 932 || acp == 936 || acp == 949 || acp == 950) { - iSciDefaultCodePage = acp; - } - g_iDefaultNewFileEncoding = Encoding_GetByCodePage(iSciDefaultCodePage); - } - */ - - // set flag for encoding default - Encoding_SetDefaultFlag(g_iDefaultNewFileEncoding); - - // define default charset - g_iDefaultCharSet = (int)CharSetFromCodePage((UINT)iSciDefaultCodePage); - - // Scintilla Styles - Style_Load(); - -} - - -//============================================================================= -// -// SaveSettings() -// -// -void SaveSettings(bool bSaveSettingsNow) { - WCHAR *pIniSection = NULL; - - WCHAR wchTmp[MAX_PATH] = { L'\0' }; - - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) == 0) - return; - - if (!bEnableSaveSettings) - return; - - CreateIniFile(); - - if (!bSaveSettings && !bSaveSettingsNow) { - IniSetInt(L"Settings", L"SaveSettings", bSaveSettings); - return; - } - - pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); - //int cchIniSection = (int)LocalSize(pIniSection) / sizeof(WCHAR); - - IniSectionSetBool(pIniSection, L"SaveSettings", bSaveSettings); - IniSectionSetBool(pIniSection, L"SaveRecentFiles", bSaveRecentFiles); - IniSectionSetBool(pIniSection, L"PreserveCaretPos", bPreserveCaretPos); - IniSectionSetBool(pIniSection, L"SaveFindReplace", bSaveFindReplace); - IniSectionSetBool(pIniSection, L"CloseFind", g_efrData.bFindClose); - IniSectionSetBool(pIniSection, L"CloseReplace", g_efrData.bReplaceClose); - IniSectionSetBool(pIniSection, L"NoFindWrap", g_efrData.bNoFindWrap); - IniSectionSetBool(pIniSection, L"FindTransformBS", g_efrData.bTransformBS); - IniSectionSetBool(pIniSection, L"WildcardSearch", g_efrData.bWildcardSearch); - IniSectionSetBool(pIniSection, L"FindMarkAllOccurrences", g_efrData.bMarkOccurences); - IniSectionSetBool(pIniSection, L"RegexDotMatchesAll", g_efrData.bDotMatchAll); - IniSectionSetInt(pIniSection, L"efrData_fuFlags", g_efrData.fuFlags); - PathRelativeToApp(tchOpenWithDir, wchTmp, COUNTOF(wchTmp), false, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); - PathRelativeToApp(tchFavoritesDir, wchTmp, COUNTOF(wchTmp), false, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"Favorites", wchTmp); - IniSectionSetInt(pIniSection, L"PathNameFormat", iPathNameFormat); - IniSectionSetBool(pIniSection, L"WordWrap", bWordWrapG); - IniSectionSetInt(pIniSection, L"WordWrapMode", iWordWrapMode); - IniSectionSetInt(pIniSection, L"WordWrapIndent", iWordWrapIndent); - IniSectionSetInt(pIniSection, L"WordWrapSymbols", iWordWrapSymbols); - IniSectionSetBool(pIniSection, L"ShowWordWrapSymbols", bShowWordWrapSymbols); - IniSectionSetBool(pIniSection, L"MatchBraces", bMatchBraces); - IniSectionSetBool(pIniSection, L"AutoCloseTags", bAutoCloseTags); - IniSectionSetBool(pIniSection, L"HighlightCurrentLine", bHiliteCurrentLine); - IniSectionSetBool(pIniSection, L"HyperlinkHotspot", bHyperlinkHotspot); - IniSectionSetBool(pIniSection, L"ScrollPastEOF", bScrollPastEOF); - IniSectionSetBool(pIniSection, L"AutoIndent", bAutoIndent); - IniSectionSetBool(pIniSection, L"AutoCompleteWords", bAutoCompleteWords); - IniSectionSetBool(pIniSection, L"AccelWordNavigation", bAccelWordNavigation); - IniSectionSetBool(pIniSection, L"ShowIndentGuides", bShowIndentGuides); - IniSectionSetBool(pIniSection, L"TabsAsSpaces", bTabsAsSpacesG); - IniSectionSetBool(pIniSection, L"TabIndents", bTabIndentsG); - IniSectionSetBool(pIniSection, L"BackspaceUnindents", bBackspaceUnindents); - IniSectionSetInt(pIniSection, L"TabWidth", iTabWidthG); - IniSectionSetInt(pIniSection, L"IndentWidth", iIndentWidthG); - IniSectionSetBool(pIniSection, L"MarkLongLines", bMarkLongLines); - IniSectionSetPos(pIniSection, L"LongLinesLimit", iLongLinesLimitG); - IniSectionSetInt(pIniSection, L"LongLineMode", iLongLineMode); - IniSectionSetBool(pIniSection, L"ShowSelectionMargin", g_bShowSelectionMargin); - IniSectionSetBool(pIniSection, L"ShowLineNumbers", bShowLineNumbers); - IniSectionSetBool(pIniSection, L"ShowCodeFolding", g_bShowCodeFolding); - IniSectionSetInt(pIniSection, L"MarkOccurrences", iMarkOccurrences); - IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchVisible", bMarkOccurrencesMatchVisible); - IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchCase", bMarkOccurrencesMatchCase); - IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchWholeWords", bMarkOccurrencesMatchWords); - IniSectionSetBool(pIniSection, L"MarkOccurrencesCurrentWord", bMarkOccurrencesCurrentWord); - IniSectionSetBool(pIniSection, L"ViewWhiteSpace", bViewWhiteSpace); - IniSectionSetBool(pIniSection, L"ViewEOLs", bViewEOLs); - IniSectionSetInt(pIniSection, L"DefaultEncoding", Encoding_MapIniSetting(false, g_iDefaultNewFileEncoding)); - IniSectionSetBool(pIniSection, L"UseDefaultForFileEncoding", bUseDefaultForFileEncoding); - IniSectionSetBool(pIniSection, L"SkipUnicodeDetection", bSkipUnicodeDetection); - IniSectionSetBool(pIniSection, L"SkipANSICodePageDetection", bSkipANSICodePageDetection); - IniSectionSetInt(pIniSection, L"LoadASCIIasUTF8", bLoadASCIIasUTF8); - IniSectionSetBool(pIniSection, L"LoadNFOasOEM", bLoadNFOasOEM); - IniSectionSetBool(pIniSection, L"NoEncodingTags", bNoEncodingTags); - IniSectionSetInt(pIniSection, L"DefaultEOLMode", g_iDefaultEOLMode); - IniSectionSetBool(pIniSection, L"FixLineEndings", bFixLineEndings); - IniSectionSetBool(pIniSection, L"FixTrailingBlanks", bAutoStripBlanks); - IniSectionSetInt(pIniSection, L"PrintHeader", iPrintHeader); - IniSectionSetInt(pIniSection, L"PrintFooter", iPrintFooter); - IniSectionSetInt(pIniSection, L"PrintColorMode", iPrintColor); - IniSectionSetInt(pIniSection, L"PrintZoom", iPrintZoom + 10); - IniSectionSetInt(pIniSection, L"PrintMarginLeft", pagesetupMargin.left); - IniSectionSetInt(pIniSection, L"PrintMarginTop", pagesetupMargin.top); - IniSectionSetInt(pIniSection, L"PrintMarginRight", pagesetupMargin.right); - IniSectionSetInt(pIniSection, L"PrintMarginBottom", pagesetupMargin.bottom); - IniSectionSetBool(pIniSection, L"SaveBeforeRunningTools", bSaveBeforeRunningTools); - IniSectionSetInt(pIniSection, L"FileWatchingMode", iFileWatchingMode); - IniSectionSetBool(pIniSection, L"ResetFileWatching", bResetFileWatching); - IniSectionSetInt(pIniSection, L"EscFunction", iEscFunction); - IniSectionSetBool(pIniSection, L"AlwaysOnTop", bAlwaysOnTop); - IniSectionSetBool(pIniSection, L"MinimizeToTray", bMinimizeToTray); - IniSectionSetBool(pIniSection, L"TransparentMode", bTransparentMode); - IniSectionSetBool(pIniSection, L"ShowToolbar", bShowToolbar); - IniSectionSetBool(pIniSection, L"ShowStatusbar", bShowStatusbar); - IniSectionSetInt(pIniSection, L"EncodingDlgSizeX", cxEncodingDlg); - IniSectionSetInt(pIniSection, L"EncodingDlgSizeY", cyEncodingDlg); - IniSectionSetInt(pIniSection, L"RecodeDlgSizeX", cxRecodeDlg); - IniSectionSetInt(pIniSection, L"RecodeDlgSizeY", cyRecodeDlg); - IniSectionSetInt(pIniSection, L"FileMRUDlgSizeX", cxFileMRUDlg); - IniSectionSetInt(pIniSection, L"FileMRUDlgSizeY", cyFileMRUDlg); - IniSectionSetInt(pIniSection, L"OpenWithDlgSizeX", cxOpenWithDlg); - IniSectionSetInt(pIniSection, L"OpenWithDlgSizeY", cyOpenWithDlg); - IniSectionSetInt(pIniSection, L"FavoritesDlgSizeX", cxFavoritesDlg); - IniSectionSetInt(pIniSection, L"FavoritesDlgSizeY", cyFavoritesDlg); - IniSectionSetInt(pIniSection, L"FindReplaceDlgPosX", xFindReplaceDlg); - IniSectionSetInt(pIniSection, L"FindReplaceDlgPosY", yFindReplaceDlg); - IniSectionSetInt(pIniSection, L"CustomSchemesDlgPosX", xCustomSchemesDlg); - IniSectionSetInt(pIniSection, L"CustomSchemesDlgPosY", yCustomSchemesDlg); - - Toolbar_GetButtons(g_hwndToolbar, IDT_FILE_NEW, tchToolbarButtons, COUNTOF(tchToolbarButtons)); - if (StringCchCompareX(tchToolbarButtons, TBBUTTON_DEFAULT_IDS) == 0) { tchToolbarButtons[0] = L'\0'; } - IniSectionSetString(pIniSection, L"ToolbarButtons", tchToolbarButtons); - - SaveIniSection(L"Settings", pIniSection); - LocalFree(pIniSection); - - /* - SaveSettingsNow(): query Window Dimensions - */ - - if (bSaveSettingsNow) { - // GetWindowPlacement - g_WinInfo = GetMyWindowPlacement(g_hwndMain,NULL); - } - - int ResX = GetSystemMetrics(SM_CXSCREEN); - int ResY = GetSystemMetrics(SM_CYSCREEN); - - WCHAR tchHighDpiToolBar[32]; - StringCchPrintf(tchHighDpiToolBar,COUNTOF(tchHighDpiToolBar),L"%ix%i HighDpiToolBar", ResX, ResY); - IniSetInt(L"Window", tchHighDpiToolBar, iHighDpiToolBar); - - if (!IniGetInt(L"Settings2",L"StickyWindowPosition",0)) { - - WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; - - StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); - StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); - StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); - StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); - StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); - - IniSetInt(L"Window",tchPosX,g_WinInfo.x); - IniSetInt(L"Window",tchPosY,g_WinInfo.y); - IniSetInt(L"Window",tchSizeX,g_WinInfo.cx); - IniSetInt(L"Window",tchSizeY,g_WinInfo.cy); - IniSetInt(L"Window",tchMaximized,g_WinInfo.max); - } - - // Scintilla Styles - Style_Save(); - -} - - - - - - - -//============================================================================= -// -// ParseCommandLine() -// -// -void ParseCommandLine() -{ - - LPWSTR lp1,lp2,lp3; - bool bContinue = true; - bool bIsFileArg = false; - bool bIsNotepadReplacement = false; - - LPWSTR lpCmdLine = GetCommandLine(); - - if (lstrlen(lpCmdLine) == 0) - return; - - // Good old console can also send args separated by Tabs - StrTab2Space(lpCmdLine); - - int len = lstrlen(lpCmdLine) + 2; - lp1 = LocalAlloc(LPTR,sizeof(WCHAR)*len); - lp2 = LocalAlloc(LPTR,sizeof(WCHAR)*len); - lp3 = LocalAlloc(LPTR,sizeof(WCHAR)*len); - - // Start with 2nd argument - ExtractFirstArgument(lpCmdLine,lp1,lp3,len); - - while (bContinue && ExtractFirstArgument(lp3,lp1,lp2,len)) - { - - // options - if (!bIsFileArg && (StringCchCompareN(lp1,len,L"+",-1) == 0)) { - flagMultiFileArg = 2; - bIsFileArg = true; - } - - else if (!bIsFileArg && (StringCchCompareN(lp1,len,L"-",-1) == 0)) { - flagMultiFileArg = 1; - bIsFileArg = true; - } - - else if (!bIsFileArg && ((*lp1 == L'/') || (*lp1 == L'-'))) - { - - // LTrim - StrLTrim(lp1,L"-/"); - - // Encoding - if (StringCchCompareIX(lp1,L"ANSI") == 0 || StringCchCompareIX(lp1,L"A") == 0 || StringCchCompareIX(lp1,L"MBCS") == 0) - flagSetEncoding = IDM_ENCODING_ANSI-IDM_ENCODING_ANSI + 1; - else if (StringCchCompareIX(lp1,L"UNICODE") == 0 || StringCchCompareIX(lp1,L"W") == 0) - flagSetEncoding = IDM_ENCODING_UNICODE-IDM_ENCODING_ANSI + 1; - else if (StringCchCompareIX(lp1,L"UNICODEBE") == 0 || StringCchCompareIX(lp1,L"UNICODE-BE") == 0) - flagSetEncoding = IDM_ENCODING_UNICODEREV-IDM_ENCODING_ANSI + 1; - else if (StringCchCompareIX(lp1,L"UTF8") == 0 || StringCchCompareIX(lp1,L"UTF-8") == 0) - flagSetEncoding = IDM_ENCODING_UTF8-IDM_ENCODING_ANSI + 1; - else if (StringCchCompareIX(lp1,L"UTF8SIG") == 0 || StringCchCompareIX(lp1,L"UTF-8SIG") == 0 || - StringCchCompareIX(lp1,L"UTF8SIGNATURE") == 0 || StringCchCompareIX(lp1,L"UTF-8SIGNATURE") == 0 || - StringCchCompareIX(lp1,L"UTF8-SIGNATURE") == 0 || StringCchCompareIX(lp1,L"UTF-8-SIGNATURE") == 0) - flagSetEncoding = IDM_ENCODING_UTF8SIGN-IDM_ENCODING_ANSI + 1; - - // EOL Mode - else if (StringCchCompareIX(lp1,L"CRLF") == 0 || StringCchCompareIX(lp1,L"CR+LF") == 0) - flagSetEOLMode = IDM_LINEENDINGS_CRLF-IDM_LINEENDINGS_CRLF + 1; - else if (StringCchCompareIX(lp1,L"LF") == 0) - flagSetEOLMode = IDM_LINEENDINGS_LF-IDM_LINEENDINGS_CRLF + 1; - else if (StringCchCompareIX(lp1,L"CR") == 0) - flagSetEOLMode = IDM_LINEENDINGS_CR-IDM_LINEENDINGS_CRLF + 1; - - // Shell integration - else if (StrCmpNI(lp1,L"appid=",CSTRLEN(L"appid=")) == 0) { - StringCchCopyN(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID), - lp1 + CSTRLEN(L"appid="),len - CSTRLEN(L"appid=")); - StrTrim(g_wchAppUserModelID,L" "); - if (StringCchLenW(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)) == 0) - StringCchCopy(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID),L"Notepad3"); - } - - else if (StrCmpNI(lp1,L"sysmru=",CSTRLEN(L"sysmru=")) == 0) { - WCHAR wch[16]; - StringCchCopyN(wch,COUNTOF(wch),lp1 + CSTRLEN(L"sysmru="),COUNTOF(wch)); - StrTrim(wch,L" "); - if (*wch == L'1') - flagUseSystemMRU = 2; - else - flagUseSystemMRU = 1; - } - - // Relaunch elevated - else if (StrCmpNI(lp1,L"tmpfbuf=",CSTRLEN(L"tmpfbuf=")) == 0) { - StringCchCopyN(szBufferFile,COUNTOF(szBufferFile), - lp1 + CSTRLEN(L"tmpfbuf="),len - CSTRLEN(L"tmpfbuf=")); - TrimString(szBufferFile); - PathUnquoteSpaces(szBufferFile); - NormalizePathEx(szBufferFile,COUNTOF(szBufferFile)); - flagBufferFile = 1; - } - - else switch (*CharUpper(lp1)) - { - - case L'N': - flagReuseWindow = 0; - flagNoReuseWindow = 1; - if (*CharUpper(lp1+1) == L'S') - flagSingleFileInstance = 1; - else - flagSingleFileInstance = 0; - break; - - case L'R': - flagReuseWindow = 1; - flagNoReuseWindow = 0; - if (*CharUpper(lp1+1) == L'S') - flagSingleFileInstance = 1; - else - flagSingleFileInstance = 0; - break; - - case L'F': - if (*(lp1+1) == L'0' || *CharUpper(lp1+1) == L'O') - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L"*?"); - else if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - StringCchCopyN(g_wchIniFile,COUNTOF(g_wchIniFile),lp1,len); - TrimString(g_wchIniFile); - PathUnquoteSpaces(g_wchIniFile); - NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); - } - break; - - case L'I': - flagStartAsTrayIcon = 1; - break; - - case L'O': - if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O') - flagAlwaysOnTop = 1; - else - flagAlwaysOnTop = 2; - break; - - case L'P': - { - WCHAR *lp = lp1; - if (StrCmpNI(lp1,L"POS:",CSTRLEN(L"POS:")) == 0) - lp += CSTRLEN(L"POS:") -1; - else if (StrCmpNI(lp1,L"POS",CSTRLEN(L"POS")) == 0) - lp += CSTRLEN(L"POS") -1; - else if (*(lp1+1) == L':') - lp += 1; - else if (bIsNotepadReplacement) { - if (*(lp1+1) == L'T') - ExtractFirstArgument(lp2,lp1,lp2,len); - break; - } - if (*(lp+1) == L'0' || *CharUpper(lp+1) == L'O') { - flagPosParam = 1; - flagDefaultPos = 1; - } - else if (*CharUpper(lp+1) == L'D' || *CharUpper(lp+1) == L'S') { - flagPosParam = 1; - flagDefaultPos = (StrChrI((lp+1),L'L')) ? 3 : 2; - } - else if (StrChrI(L"FLTRBM",*(lp+1))) { - WCHAR *p = (lp+1); - flagPosParam = 1; - flagDefaultPos = 0; - while (*p) { - switch (*CharUpper(p)) { - case L'F': - flagDefaultPos &= ~(4|8|16|32); - flagDefaultPos |= 64; - break; - case L'L': - flagDefaultPos &= ~(8|64); - flagDefaultPos |= 4; - break; - case L'R': - flagDefaultPos &= ~(4|64); - flagDefaultPos |= 8; - break; - case L'T': - flagDefaultPos &= ~(32|64); - flagDefaultPos |= 16; - break; - case L'B': - flagDefaultPos &= ~(16|64); - flagDefaultPos |= 32; - break; - case L'M': - if (flagDefaultPos == 0) - flagDefaultPos |= 64; - flagDefaultPos |= 128; - break; - } - p = CharNext(p); - } - } - else if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - int itok = - swscanf_s(lp1,L"%i,%i,%i,%i,%i",&g_WinInfo.x,&g_WinInfo.y,&g_WinInfo.cx,&g_WinInfo.cy,&g_WinInfo.max); - if (itok == 4 || itok == 5) { // scan successful - flagPosParam = 1; - flagDefaultPos = 0; - - if (g_WinInfo.cx < 1) g_WinInfo.cx = CW_USEDEFAULT; - if (g_WinInfo.cy < 1) g_WinInfo.cy = CW_USEDEFAULT; - if (g_WinInfo.max) g_WinInfo.max = 1; - if (itok == 4) g_WinInfo.max = 0; - } - } - } - break; - - case L'T': - if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - StringCchCopyN(szTitleExcerpt,COUNTOF(szTitleExcerpt),lp1,len); - fKeepTitleExcerpt = 1; - } - break; - - case L'C': - flagNewFromClipboard = 1; - break; - - case L'B': - flagPasteBoard = 1; - break; - - case L'E': - if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - if (lpEncodingArg) - LocalFree(lpEncodingArg); - lpEncodingArg = StrDup(lp1); - } - break; - - case L'G': - if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - int itok = - swscanf_s(lp1,L"%i,%i",&iInitialLine,&iInitialColumn); - if (itok == 1 || itok == 2) { // scan successful - flagJumpTo = 1; - } - } - break; - - case L'M': - { - bool bFindUp = false; - bool bRegex = false; - bool bTransBS = false; - - if (StrChr(lp1,L'-')) - bFindUp = true; - if (StrChr(lp1,L'R')) - bRegex = true; - if (StrChr(lp1,L'B')) - bTransBS = true; - - if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - if (lpMatchArg) - LocalFree(lpMatchArg); - lpMatchArg = StrDup(lp1); - flagMatchText = 1; - - if (bFindUp) - flagMatchText |= 2; - - if (bRegex) { - flagMatchText &= ~8; - flagMatchText |= 4; - } - - if (bTransBS) { - flagMatchText &= ~4; - flagMatchText |= 8; - } - } - } - break; - - case L'L': - if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O') - flagChangeNotify = 1; - else - flagChangeNotify = 2; - break; - - case L'Q': - flagQuietCreate = 1; - break; - - case L'S': - if (ExtractFirstArgument(lp2,lp1,lp2,len)) { - if (lpSchemeArg) - LocalFree(lpSchemeArg); - lpSchemeArg = StrDup(lp1); - flagLexerSpecified = 1; - } - break; - - case L'D': - if (lpSchemeArg) { - LocalFree(lpSchemeArg); - lpSchemeArg = NULL; - } - iInitialLexer = 0; - flagLexerSpecified = 1; - break; - - case L'H': - if (lpSchemeArg) { - LocalFree(lpSchemeArg); - lpSchemeArg = NULL; - } - iInitialLexer = 35; - flagLexerSpecified = 1; - break; - - case L'X': - if (lpSchemeArg) { - LocalFree(lpSchemeArg); - lpSchemeArg = NULL; - } - iInitialLexer = 36; - flagLexerSpecified = 1; - break; - - case L'U': - flagRelaunchElevated = 1; - break; - - case L'Z': - ExtractFirstArgument(lp2,lp1,lp2,len); - flagMultiFileArg = 1; - bIsNotepadReplacement = true; - break; - - case L'?': - flagDisplayHelp = 1; - break; - - case L'V': - flagPrintFileAndLeave = 1; - if (*CharUpper(lp1 + 1) == L'D') - flagPrintFileAndLeave = 2; // open printer dialog - break; - - default: - break; - - } - - } - - // pathname - else - { - LPWSTR lpFileBuf = LocalAlloc(LPTR,sizeof(WCHAR)*len); - - cchiFileList = lstrlen(lpCmdLine) - lstrlen(lp3); - - if (lpFileArg) { - FreeMem(lpFileArg); - //lpFileArg = NULL; - } - lpFileArg = AllocMem(sizeof(WCHAR)*FILE_ARG_BUF, HEAP_ZERO_MEMORY); // changed for ActivatePrevInst() needs - StringCchCopy(lpFileArg,FILE_ARG_BUF,lp3); - - PathFixBackslashes(lpFileArg); - - if (!PathIsRelative(lpFileArg) && !PathIsUNC(lpFileArg) && - PathGetDriveNumber(lpFileArg) == -1 /*&& PathGetDriveNumber(g_wchWorkingDirectory) != -1*/) { - - WCHAR wchPath[FILE_ARG_BUF] = { L'\0' }; - StringCchCopy(wchPath,COUNTOF(wchPath),g_wchWorkingDirectory); - PathStripToRoot(wchPath); - PathCchAppend(wchPath,COUNTOF(wchPath),lpFileArg); - StringCchCopy(lpFileArg,FILE_ARG_BUF,wchPath); - } - - StrTrim(lpFileArg,L" \""); - - while (cFileList < 32 && ExtractFirstArgument(lp3,lpFileBuf,lp3,len)) { - PathQuoteSpaces(lpFileBuf); - lpFileList[cFileList++] = StrDup(lpFileBuf); - } - - bContinue = false; - LocalFree(lpFileBuf); - } - - // Continue with next argument - if (bContinue) - StringCchCopy(lp3,len,lp2); - - } - - LocalFree(lp1); - LocalFree(lp2); - LocalFree(lp3); -} - - -//============================================================================= -// -// LoadFlags() -// -// -void LoadFlags() -{ - WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*32*1024); - int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - LoadIniSection(L"Settings2",pIniSection,cchIniSection); - - if (!flagReuseWindow && !flagNoReuseWindow) { - - if (!IniSectionGetInt(pIniSection,L"ReuseWindow",0)) - flagNoReuseWindow = 1; - - if (IniSectionGetInt(pIniSection,L"SingleFileInstance",0)) - flagSingleFileInstance = 1; - } - - if (flagMultiFileArg == 0) { - if (IniSectionGetInt(pIniSection,L"MultiFileArg",0)) - flagMultiFileArg = 2; - } - - if (IniSectionGetInt(pIniSection,L"RelativeFileMRU",1)) - flagRelativeFileMRU = 1; - - if (IniSectionGetInt(pIniSection,L"PortableMyDocs",flagRelativeFileMRU)) - flagPortableMyDocs = 1; - - if (IniSectionGetInt(pIniSection,L"NoFadeHidden",0)) - flagNoFadeHidden = 1; - - flagToolbarLook = IniSectionGetInt(pIniSection,L"ToolbarLook",IsXP() ? 1 : 2); - flagToolbarLook = max(min(flagToolbarLook,2),0); - - if (IniSectionGetInt(pIniSection,L"SimpleIndentGuides",0)) - flagSimpleIndentGuides = 1; - - if (IniSectionGetInt(pIniSection,L"NoHTMLGuess",0)) - flagNoHTMLGuess = 1; - - if (IniSectionGetInt(pIniSection,L"NoCGIGuess",0)) - flagNoCGIGuess = 1; - - if (IniSectionGetInt(pIniSection,L"NoFileVariables",0)) - flagNoFileVariables = 1; - - if (StringCchLenW(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)) == 0) { - IniSectionGetString(pIniSection,L"ShellAppUserModelID",L"Notepad3", - g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)); - } - - if (flagUseSystemMRU == 0) { - if (IniSectionGetInt(pIniSection,L"ShellUseSystemMRU",0)) - flagUseSystemMRU = 2; - } - - LocalFree(pIniSection); -} - - -//============================================================================= -// -// FindIniFile() -// -// -bool CheckIniFile(LPWSTR lpszFile,LPCWSTR lpszModule) -{ - WCHAR tchFileExpanded[MAX_PATH] = { L'\0' }; - WCHAR tchBuild[MAX_PATH] = { L'\0' }; - ExpandEnvironmentStrings(lpszFile,tchFileExpanded,COUNTOF(tchFileExpanded)); - - if (PathIsRelative(tchFileExpanded)) { - // program directory - StringCchCopy(tchBuild,COUNTOF(tchBuild),lpszModule); - StringCchCopy(PathFindFileName(tchBuild),COUNTOF(tchBuild),tchFileExpanded); - - if (PathFileExists(tchBuild)) { - StringCchCopy(lpszFile,MAX_PATH,tchBuild); - return true; - } - // %appdata% - //if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)) { - if (GetKnownFolderPath(&FOLDERID_RoamingAppData, tchBuild, COUNTOF(tchBuild))) { - PathCchAppend(tchBuild,COUNTOF(tchBuild),tchFileExpanded); - if (PathFileExists(tchBuild)) { - StringCchCopy(lpszFile,MAX_PATH,tchBuild); - return true; - } - } - // general - if (SearchPath(NULL,tchFileExpanded,NULL,COUNTOF(tchBuild),tchBuild,NULL)) { - StringCchCopy(lpszFile,MAX_PATH,tchBuild); - return true; - } - } - - else if (PathFileExists(tchFileExpanded)) { - StringCchCopy(lpszFile,MAX_PATH,tchFileExpanded); - return true; - } - - return false; -} - -bool CheckIniFileRedirect(LPWSTR lpszFile,LPCWSTR lpszModule) -{ - WCHAR tch[MAX_PATH] = { L'\0' }; - if (GetPrivateProfileString(L"Notepad3",L"Notepad3.ini",L"",tch,COUNTOF(tch),lpszFile)) { - if (CheckIniFile(tch,lpszModule)) { - StringCchCopy(lpszFile,MAX_PATH,tch); - return true; - } - else { - WCHAR tchFileExpanded[MAX_PATH] = { L'\0' }; - ExpandEnvironmentStrings(tch,tchFileExpanded,COUNTOF(tchFileExpanded)); - if (PathIsRelative(tchFileExpanded)) { - StringCchCopy(lpszFile,MAX_PATH,lpszModule); - StringCchCopy(PathFindFileName(lpszFile),MAX_PATH,tchFileExpanded); - return true; - } - else { - StringCchCopy(lpszFile,MAX_PATH,tchFileExpanded); - return true; - } - } - } - return false; -} - -int FindIniFile() { - - WCHAR tchTest[MAX_PATH] = { L'\0' }; - WCHAR tchModule[MAX_PATH] = { L'\0' }; - GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); - - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile))) { - if (StringCchCompareIX(g_wchIniFile,L"*?") == 0) - return(0); - else { - if (!CheckIniFile(g_wchIniFile,tchModule)) { - ExpandEnvironmentStringsEx(g_wchIniFile,COUNTOF(g_wchIniFile)); - if (PathIsRelative(g_wchIniFile)) { - StringCchCopy(tchTest,COUNTOF(tchTest),tchModule); - PathRemoveFileSpec(tchTest); - PathCchAppend(tchTest,COUNTOF(tchTest),g_wchIniFile); - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchTest); - } - } - } - } - else { - StringCchCopy(tchTest,COUNTOF(tchTest),PathFindFileName(tchModule)); - PathCchRenameExtension(tchTest,COUNTOF(tchTest),L".ini"); - bool bFound = CheckIniFile(tchTest,tchModule); - - if (!bFound) { - StringCchCopy(tchTest,COUNTOF(tchTest),L"Notepad3.ini"); - bFound = CheckIniFile(tchTest,tchModule); - } - - if (bFound) { - - // allow two redirections: administrator -> user -> custom - if (CheckIniFileRedirect(tchTest,tchModule)) - CheckIniFileRedirect(tchTest,tchModule); - - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchTest); - } - else { - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchModule); - PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); - } - } - - NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); - - return(1); -} - - -int TestIniFile() { - - if (StringCchCompareIX(g_wchIniFile,L"*?") == 0) { - StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),L""); - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L""); - return(0); - } - - if (PathIsDirectory(g_wchIniFile) || *CharPrev(g_wchIniFile,StrEnd(g_wchIniFile)) == L'\\') { - WCHAR wchModule[MAX_PATH] = { L'\0' }; - GetModuleFileName(NULL,wchModule,COUNTOF(wchModule)); - PathCchAppend(g_wchIniFile,COUNTOF(g_wchIniFile),PathFindFileName(wchModule)); - PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); - if (!PathFileExists(g_wchIniFile)) { - StringCchCopy(PathFindFileName(g_wchIniFile),COUNTOF(g_wchIniFile),L"Notepad3.ini"); - if (!PathFileExists(g_wchIniFile)) { - StringCchCopy(PathFindFileName(g_wchIniFile),COUNTOF(g_wchIniFile),PathFindFileName(wchModule)); - PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); - } - } - } - - NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); - - if (!PathFileExists(g_wchIniFile) || PathIsDirectory(g_wchIniFile)) { - StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),g_wchIniFile); - StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L""); - return(0); - } - else - return(1); -} - - -int CreateIniFile() { - - return(CreateIniFileEx(g_wchIniFile)); -} - - -int CreateIniFileEx(LPCWSTR lpszIniFile) { - - if (*lpszIniFile) { - - WCHAR *pwchTail = StrRChrW(lpszIniFile, NULL, L'\\'); - if (pwchTail) { - *pwchTail = 0; - SHCreateDirectoryEx(NULL,lpszIniFile,NULL); - *pwchTail = L'\\'; - } - - HANDLE hFile = CreateFile(lpszIniFile, - GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - dwLastIOError = GetLastError(); - if (hFile != INVALID_HANDLE_VALUE) { - if (GetFileSize(hFile,NULL) == 0) { - DWORD dw; - WriteFile(hFile,(LPCVOID)L"\xFEFF[Notepad3]\r\n",26,&dw,NULL); - } - CloseHandle(hFile); - return(1); - } - else - return(0); - } - - else - return(0); -} - - -//============================================================================= -// -// MarkAllOccurrences() -// -void MarkAllOccurrences(int delay) -{ - TEST_AND_SET(BIT_TIMER_MARK_OCC); // raise flag to swollow next calls - - if (delay < USER_TIMER_MINIMUM) { - PostMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), 0); // direct timer event - } - else { - SetTimer(g_hwndMain, IDT_TIMER_MAIN_MRKALL, delay, NULL); - } -} - - -//============================================================================= -// -// UpdateVisibleUrlHotspot() -// -void UpdateVisibleUrlHotspot(int delay) -{ - TEST_AND_SET(BIT_TIMER_UPDATE_HYPER); // raise flag to swollow next calls - - if (delay < USER_TIMER_MINIMUM) { - PostMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_UPDATE_HOTSPOT, 1), 0); // direct timer event - } - else { - SetTimer(g_hwndMain, IDT_TIMER_UPDATE_HOTSPOT, delay, NULL); - } -} - - -//============================================================================= -// -// UpdateToolbar() -// -#define EnableTool(id,b) SendMessage(g_hwndToolbar,TB_ENABLEBUTTON,id, \ - MAKELONG(((b) ? 1 : 0), 0)) - -#define CheckTool(id,b) SendMessage(g_hwndToolbar,TB_CHECKBUTTON,id, \ - MAKELONG(b,0)) - -void UpdateToolbar() -{ - SetWindowTitle(g_hwndMain, uidsAppTitle, flagIsElevated, IDS_UNTITLED, g_wchCurFile, - iPathNameFormat, IsDocumentModified || Encoding_HasChanged(CPI_GET), - IDS_READONLY, bReadOnly, szTitleExcerpt); - - if (!bShowToolbar) { return; } - - EnableTool(IDT_FILE_ADDTOFAV,StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))); - - EnableTool(IDT_EDIT_UNDO,SendMessage(g_hwndEdit,SCI_CANUNDO,0,0) /*&& !bReadOnly*/); - EnableTool(IDT_EDIT_REDO,SendMessage(g_hwndEdit,SCI_CANREDO,0,0) /*&& !bReadOnly*/); - EnableTool(IDT_EDIT_PASTE,SendMessage(g_hwndEdit,SCI_CANPASTE,0,0) /*&& !bReadOnly*/); - - bool b1 = SciCall_IsSelectionEmpty(); - bool b2 = (bool)(SciCall_GetTextLength() > 0); - - EnableTool(IDT_EDIT_FIND, b2); - //EnableTool(IDT_EDIT_FINDNEXT,b2); - //EnableTool(IDT_EDIT_FINDPREV,b2 && strlen(g_efrData.szFind)); - EnableTool(IDT_EDIT_REPLACE, b2 /*&& !bReadOnly*/); - - EnableTool(IDT_EDIT_CUT, !b1 /*&& !bReadOnly*/); - EnableTool(IDT_EDIT_COPY, !b1 /*&& !bReadOnly*/); - EnableTool(IDT_EDIT_CLEAR, !b1 /*&& !bReadOnly*/); - - EnableTool(IDT_VIEW_TOGGLEFOLDS, b2 && (g_bCodeFoldingAvailable && g_bShowCodeFolding)); - EnableTool(IDT_FILE_LAUNCH, b2); - - EnableTool(IDT_FILE_SAVE, (IsDocumentModified || Encoding_HasChanged(CPI_GET)) /*&& !bReadOnly*/); - - CheckTool(IDT_VIEW_WORDWRAP,bWordWrap); - -} - - -//============================================================================= -// -// UpdateStatusbar() -// -// -const static WCHAR* FR_Status[] = { L"[>--<]", L"[>>--]", L"[>>-+]", L"[+->]>", L"[--<<]", L"[+-<<]", L"<[<-+]"}; - -FR_STATES g_FindReplaceMatchFoundState = FND_NOP; - -void UpdateStatusbar() -{ - static WCHAR tchLn[32] = { L'\0' }; - static WCHAR tchLines[32] = { L'\0' }; - static WCHAR tchCol[32] = { L'\0' }; - static WCHAR tchCols[32] = { L'\0' }; - static WCHAR tchSel[32] = { L'\0' }; - static WCHAR tchSelB[32] = { L'\0' }; - static WCHAR tchOcc[32] = { L'\0' }; - static WCHAR tchReplOccs[32] = { L'\0' }; - static WCHAR tchDocPos[128] = { L'\0' }; - static WCHAR tchFRStatus[128] = { L'\0' }; - - static WCHAR tchBytes[64] = { L'\0' }; - static WCHAR tchDocSize[64] = { L'\0' }; - static WCHAR tchEncoding[64] = { L'\0' }; - - static WCHAR tchEOLMode[32] = { L'\0' }; - static WCHAR tchOvrMode[32] = { L'\0' }; - static WCHAR tch2ndDef[32] = { L'\0' }; - static WCHAR tchLexerName[128] = { L'\0' }; - static WCHAR tchLinesSelected[32] = { L'\0' }; - - static WCHAR tchTmp[32] = { L'\0' }; - - if (!bShowStatusbar) { return; } - - const DocPos iPos = SciCall_GetCurrentPos(); - const DocPos iTextLength = SciCall_GetTextLength(); - const int iEncoding = Encoding_Current(CPI_GET); - - StringCchPrintf(tchLn, COUNTOF(tchLn), L"%td", SciCall_LineFromPosition(iPos) + 1); - FormatNumberStr(tchLn); - - StringCchPrintf(tchLines, COUNTOF(tchLines), L"%td", SciCall_GetLineCount()); - FormatNumberStr(tchLines); - - DocPos iCol = SciCall_GetColumn(iPos) + 1; - iCol += (DocPos)SendMessage(g_hwndEdit, SCI_GETSELECTIONNCARETVIRTUALSPACE, 0, 0); - StringCchPrintf(tchCol, COUNTOF(tchCol), L"%td", iCol); - FormatNumberStr(tchCol); - - if (bMarkLongLines) { - StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", iLongLinesLimit); - FormatNumberStr(tchCols); - } - - // Print number of selected chars in statusbar - const bool bIsSelEmpty = SciCall_IsSelectionEmpty(); - const DocPos iSelStart = (bIsSelEmpty ? 0 : SciCall_GetSelectionStart()); - const DocPos iSelEnd = (bIsSelEmpty ? 0 : SciCall_GetSelectionEnd()); - - if (!bIsSelEmpty && !SciCall_IsSelectionRectangle()) - { - const DocPos iSel = (DocPos)SendMessage(g_hwndEdit, SCI_COUNTCHARACTERS, iSelStart, iSelEnd); - StringCchPrintf(tchSel, COUNTOF(tchSel), L"%td", iSel); - FormatNumberStr(tchSel); - StrFormatByteSize((iSelEnd - iSelStart), tchSelB, COUNTOF(tchSelB)); - } - else { - tchSel[0] = L'-'; tchSel[1] = L'-'; tchSel[2] = L'\0'; - tchSelB[0] = L'0'; tchSelB[1] = L'\0'; - } - - // Print number of occurrence marks found - if ((iMarkOccurrencesCount > 0) && !bMarkOccurrencesMatchVisible) - { - if ((iMarkOccurrencesMaxCount < 0) || (iMarkOccurrencesCount < iMarkOccurrencesMaxCount)) - { - StringCchPrintf(tchOcc, COUNTOF(tchOcc), L"%i", iMarkOccurrencesCount); - FormatNumberStr(tchOcc); - } - else { - StringCchPrintf(tchTmp, COUNTOF(tchTmp), L"%i", iMarkOccurrencesCount); - FormatNumberStr(tchTmp); - StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %s", tchTmp); - } - } - else { - StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--"); - } - - // Print number of selected lines in statusbar - if (bIsSelEmpty) { - tchLinesSelected[0] = L'-'; - tchLinesSelected[1] = L'-'; - tchLinesSelected[2] = L'\0'; - } - else { - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - const DocPos iStartOfLinePos = SciCall_PositionFromLine(iLineEnd); - DocLn iLinesSelected = (iLineEnd - iLineStart); - if ((iSelStart != iSelEnd) && (iStartOfLinePos != iSelEnd)) { iLinesSelected += 1; } - StringCchPrintf(tchLinesSelected, COUNTOF(tchLinesSelected), L"%i", iLinesSelected); - FormatNumberStr(tchLinesSelected); - } - - if (!bMarkLongLines) { - FormatString(tchDocPos, COUNTOF(tchDocPos), IDS_DOCPOS, tchLn, tchLines, tchCol, tchSel, tchSelB, tchLinesSelected, tchOcc); - } - else { - FormatString(tchDocPos, COUNTOF(tchDocPos), IDS_DOCPOS2, tchLn, tchLines, tchCol, tchCols, tchSel, tchSelB, tchLinesSelected, tchOcc); - } - - // update Find/Replace dialog (if any) - if (g_hwndDlgFindReplace) { - if (iReplacedOccurrences > 0) - StringCchPrintf(tchReplOccs, COUNTOF(tchReplOccs), L"%i", iReplacedOccurrences); - else - StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--"); - - FormatString(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT, - tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs, FR_Status[g_FindReplaceMatchFoundState]); - SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus); - } - - // get number of bytes in current encoding - StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes)); - FormatString(tchDocSize, COUNTOF(tchDocSize), IDS_DOCSIZE, tchBytes); - - Encoding_SetLabel(iEncoding); - StringCchPrintf(tchEncoding, COUNTOF(tchEncoding), L" %s ", Encoding_GetLabel(iEncoding)); - - if (g_iEOLMode == SC_EOL_CR) - { - StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR "); - } - else if (g_iEOLMode == SC_EOL_LF) - { - StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" LF "); - } - else { - StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR+LF "); - } - if (SendMessage(g_hwndEdit, SCI_GETOVERTYPE, 0, 0)) - { - StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" OVR "); - } - else { - StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" INS "); - } - if (Style_GetUse2ndDefault()) - { - StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" 2ND "); - } - else { - StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" STD "); - } - Style_GetCurrentLexerName(tchLexerName, COUNTOF(tchLexerName)); - - StatusSetText(g_hwndStatus, STATUS_DOCPOS, tchDocPos); - StatusSetText(g_hwndStatus, STATUS_DOCSIZE, tchDocSize); - StatusSetText(g_hwndStatus, STATUS_CODEPAGE, tchEncoding); - StatusSetText(g_hwndStatus, STATUS_EOLMODE, tchEOLMode); - StatusSetText(g_hwndStatus, STATUS_OVRMODE, tchOvrMode); - StatusSetText(g_hwndStatus, STATUS_2ND_DEF, tch2ndDef); - StatusSetText(g_hwndStatus, STATUS_LEXER, tchLexerName); - - //InvalidateRect(g_hwndStatus,NULL,true); -} - - -//============================================================================= -// -// UpdateLineNumberWidth() -// -// -void UpdateLineNumberWidth() -{ - if (bShowLineNumbers) - { - char chLines[32] = { '\0' }; - StringCchPrintfA(chLines, COUNTOF(chLines), "_%td", (size_t)SciCall_GetLineCount()); - - int iLineMarginWidthNow = (int)SendMessage(g_hwndEdit, SCI_GETMARGINWIDTHN, MARGIN_SCI_LINENUM, 0); - int iLineMarginWidthFit = (int)SendMessage(g_hwndEdit, SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)chLines); - - if (iLineMarginWidthNow != iLineMarginWidthFit) { - SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, iLineMarginWidthFit); - } - } - else { - SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, 0); - } -} - - -//============================================================================= -// -// UpdateSettingsCmds() -// -// -void UpdateSettingsCmds() -{ - HMENU hmenu = GetSystemMenu(g_hwndMain, false); - bool hasIniFile = (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0 || StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0); - CheckCmd(hmenu, IDM_VIEW_SAVESETTINGS, bSaveSettings && bEnableSaveSettings); - EnableCmd(hmenu, IDM_VIEW_SAVESETTINGS, hasIniFile && bEnableSaveSettings); - EnableCmd(hmenu, IDM_VIEW_SAVESETTINGSNOW, hasIniFile && bEnableSaveSettings); -} - - -//============================================================================= -// -// UpdateUI() -// -void UpdateUI() -{ - struct SCNotification scn; - scn.nmhdr.hwndFrom = g_hwndEdit; - scn.nmhdr.idFrom = IDC_EDIT; - scn.nmhdr.code = SCN_UPDATEUI; - scn.updated = (SC_UPDATE_CONTENT | SC_UPDATE_NP3_INTERNAL_NOTIFY); - SendMessage(g_hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); - //PostMessage(g_hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); -} - - -//============================================================================= -// -// BeginUndoAction() -// -// -int BeginUndoAction() -{ - int token = -1; - UndoRedoSelection_t sel = INIT_UNDOREDOSEL; - sel.selMode_undo = (int)SendMessage(g_hwndEdit,SCI_GETSELECTIONMODE,0,0); - - switch (sel.selMode_undo) - { - case SC_SEL_RECTANGLE: - case SC_SEL_THIN: - sel.anchorPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0); - sel.curPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0); - if (!bDenyVirtualSpaceAccess) { - sel.anchorVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0); - sel.curVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0); - } - break; - - case SC_SEL_LINES: - case SC_SEL_STREAM: - default: - sel.anchorPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0); - sel.curPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); - break; - } - token = UndoRedoActionMap(-1, &sel); - if (token >= 0) { - SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); - SendMessage(g_hwndEdit, SCI_ADDUNDOACTION, (WPARAM)token, 0); - } - return token; -} - - - -//============================================================================= -// -// EndUndoAction() -// -// -void EndUndoAction(int token) -{ - if (token >= 0) { - UndoRedoSelection_t sel = INIT_UNDOREDOSEL; - if (UndoRedoActionMap(token, &sel) >= 0) { - - sel.selMode_redo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONMODE, 0, 0); - - switch (sel.selMode_redo) - { - case SC_SEL_RECTANGLE: - case SC_SEL_THIN: - sel.anchorPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0); - sel.curPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0); - if (!bDenyVirtualSpaceAccess) { - sel.anchorVS_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0); - } - break; - - case SC_SEL_LINES: - case SC_SEL_STREAM: - default: - sel.anchorPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0); - sel.curPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); - break; - } - } - UndoRedoActionMap(token,&sel); // set with redo action filled - SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); - } -} - - -//============================================================================= -// -// RestoreAction() -// -// -void RestoreAction(int token, DoAction doAct) -{ - UndoRedoSelection_t sel = INIT_UNDOREDOSEL; - - if (UndoRedoActionMap(token, &sel) >= 0) - { - // we are inside undo/redo transaction, so do delayed PostMessage() instead of SendMessage() - #define ISSUE_MESSAGE PostMessage - - const DocPos _anchorPos = (doAct == UNDO ? sel.anchorPos_undo : sel.anchorPos_redo); - const DocPos _curPos = (doAct == UNDO ? sel.curPos_undo : sel.curPos_redo); - - // Ensure that the first and last lines of a selection are always unfolded - // This needs to be done _before_ the SCI_SETSEL message - const DocLn anchorPosLine = SciCall_LineFromPosition(_anchorPos); - const DocLn currPosLine = SciCall_LineFromPosition(_curPos); - ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, anchorPosLine, 0); - if (anchorPosLine != currPosLine) { ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, currPosLine, 0); } - - - const int selectionMode = (doAct == UNDO ? sel.selMode_undo : sel.selMode_redo); - ISSUE_MESSAGE(g_hwndEdit, SCI_SETSELECTIONMODE, (WPARAM)selectionMode, 0); - - // independent from selection mode - ISSUE_MESSAGE(g_hwndEdit, SCI_SETANCHOR, (WPARAM)_anchorPos, 0); - ISSUE_MESSAGE(g_hwndEdit, SCI_SETCURRENTPOS, (WPARAM)_curPos, 0); - - switch (selectionMode) - { - case SC_SEL_RECTANGLE: - ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHOR, (WPARAM)_anchorPos, 0); - ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARET, (WPARAM)_curPos, 0); - // fall-through - - case SC_SEL_THIN: - { - const DocPos anchorVS = (doAct == UNDO ? sel.anchorVS_undo : sel.anchorVS_redo); - const DocPos currVS = (doAct == UNDO ? sel.curVS_undo : sel.curVS_redo); - if ((anchorVS != 0) || (currVS != 0)) { - ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (WPARAM)anchorVS, 0); - ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, (WPARAM)currVS, 0); - } - } - break; - - case SC_SEL_LINES: - case SC_SEL_STREAM: - default: - // nothing to do here - break; - } - ISSUE_MESSAGE(g_hwndEdit, SCI_SCROLLCARET, 0, 0); - ISSUE_MESSAGE(g_hwndEdit, SCI_CHOOSECARETX, 0, 0); - ISSUE_MESSAGE(g_hwndEdit, SCI_CANCEL, 0, 0); - - #undef ISSUE_MASSAGE - } -} - - -//============================================================================= -// -// UndoSelectionMap() -// -// -int UndoRedoActionMap(int token, UndoRedoSelection_t* selection) -{ - if (UndoRedoSelectionUTArray == NULL) { return -1; } - - static unsigned int iTokenCnt = 0; - - // indexing is unsigned - unsigned int utoken = (token >= 0) ? (unsigned int)token : 0U; - - if (selection == NULL) { - // reset / clear - SendMessage(g_hwndEdit, SCI_EMPTYUNDOBUFFER, 0, 0); - utarray_clear(UndoRedoSelectionUTArray); - utarray_init(UndoRedoSelectionUTArray, &UndoRedoSelection_icd); - iTokenCnt = 0U; - return -1; - } - - if (!SciCall_GetUndoCollection()) { return -1; } - - // get or set map item request ? - if ((token >= 0) && (utoken < iTokenCnt)) - { - if (selection->anchorPos_undo < 0) { - // this is a get request - *selection = *(UndoRedoSelection_t*)utarray_eltptr(UndoRedoSelectionUTArray, utoken); - } - else { - // this is a set request (fill redo pos) - utarray_insert(UndoRedoSelectionUTArray, (void*)selection, utoken); - } - // don't clear map item here (token used in redo/undo again) - } - else if (token < 0) { - // set map new item request - utarray_insert(UndoRedoSelectionUTArray, (void*)selection, iTokenCnt); - token = (int)iTokenCnt; - iTokenCnt = (iTokenCnt < INT_MAX) ? (iTokenCnt + 1) : 0U; // round robin next - } - return token; -} - - -//============================================================================= -// -// FileIO() -// -// -bool FileIO(bool fLoad,LPCWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANSICPDetection, - int *ienc,int *ieol, - bool *pbUnicodeErr,bool *pbFileTooBig, bool* pbUnknownExt, - bool *pbCancelDataLoss,bool bSaveCopy) -{ - WCHAR tch[MAX_PATH+40]; - bool fSuccess; - DWORD dwFileAttributes; - - FormatString(tch,COUNTOF(tch),(fLoad) ? IDS_LOADFILE : IDS_SAVEFILE, PathFindFileName(pszFileName)); - - BeginWaitCursor(tch); - - if (fLoad) { - fSuccess = EditLoadFile(g_hwndEdit,pszFileName,bSkipUnicodeDetect,bSkipANSICPDetection,ienc,ieol,pbUnicodeErr,pbFileTooBig,pbUnknownExt); - } - else { - int idx; - if (MRU_FindFile(g_pFileMRU,pszFileName,&idx)) { - g_pFileMRU->iEncoding[idx] = *ienc; - g_pFileMRU->iCaretPos[idx] = (bPreserveCaretPos ? SciCall_GetCurrentPos() : 0); - WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; - EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); - if (g_pFileMRU->pszBookMarks[idx]) - LocalFree(g_pFileMRU->pszBookMarks[idx]); - g_pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); - } - fSuccess = EditSaveFile(g_hwndEdit,pszFileName,*ienc,pbCancelDataLoss,bSaveCopy); - } - - dwFileAttributes = GetFileAttributes(pszFileName); - bReadOnly = (dwFileAttributes != INVALID_FILE_ATTRIBUTES && dwFileAttributes & FILE_ATTRIBUTE_READONLY); - - EndWaitCursor(); - - return(fSuccess); -} - - -//============================================================================= -// -// FileLoad() -// -// -bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, bool bSkipANSICPDetection, LPCWSTR lpszFile) -{ - WCHAR tch[MAX_PATH] = { L'\0' }; - WCHAR szFileName[MAX_PATH] = { L'\0' }; - bool bUnicodeErr = false; - bool bFileTooBig = false; - bool bUnknownExt = false; - bool fSuccess; - int fileEncoding = CPI_ANSI_DEFAULT; - - if (!bDontSave) - { - if (!FileSave(false,true,false,false)) - return false; - } - - if (!bReload) { ResetEncryption(); } - - if (bNew) { - StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),L""); - SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); - SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); - if (!fKeepTitleExcerpt) - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - FileVars_Init(NULL,0,&fvCurFile); - EditSetNewText(g_hwndEdit,"",0); - Style_SetLexer(g_hwndEdit,NULL); - - g_iEOLMode = iLineEndings[g_iDefaultEOLMode]; - SendMessage(g_hwndEdit,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); - Encoding_Current(g_iDefaultNewFileEncoding); - Encoding_HasChanged(g_iDefaultNewFileEncoding); - EditSetNewText(g_hwndEdit,"",0); - - bReadOnly = false; - _SetDocumentModified(false); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - - // Terminate file watching - if (bResetFileWatching) - iFileWatchingMode = 0; - InstallFileWatching(NULL); - bEnableSaveSettings = true; - UpdateSettingsCmds(); - return true; - } - - if (!lpszFile || lstrlen(lpszFile) == 0) { - if (!OpenFileDlg(g_hwndMain,tch,COUNTOF(tch),NULL)) - return false; - } - else - StringCchCopy(tch,COUNTOF(tch),lpszFile); - - ExpandEnvironmentStringsEx(tch,COUNTOF(tch)); - - if (PathIsRelative(tch)) { - StringCchCopyN(szFileName,COUNTOF(szFileName),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); - PathCchAppend(szFileName,COUNTOF(szFileName),tch); - if (!PathFileExists(szFileName)) { - WCHAR wchFullPath[MAX_PATH] = { L'\0' }; - if (SearchPath(NULL,tch,NULL,COUNTOF(wchFullPath),wchFullPath,NULL)) { - StringCchCopy(szFileName,COUNTOF(szFileName),wchFullPath); - } - } - } - else - StringCchCopy(szFileName,COUNTOF(szFileName),tch); - - NormalizePathEx(szFileName,COUNTOF(szFileName)); - - if (PathIsLnkFile(szFileName)) - PathGetLnkPath(szFileName,szFileName,COUNTOF(szFileName)); - - // change current directory to prevent directory lock on another path - WCHAR szFolder[MAX_PATH+2]; - if (SUCCEEDED(StringCchCopy(szFolder,COUNTOF(szFolder),tch))) { - if (SUCCEEDED(PathCchRemoveFileSpec(szFolder,COUNTOF(szFolder)))) { - SetCurrentDirectory(szFolder); - } - } - - // Ask to create a new file... - if (!bReload && !PathFileExists(szFileName)) - { - if (flagQuietCreate || MsgBox(MBYESNO,IDS_ASK_CREATE,szFileName) == IDYES) { - HANDLE hFile = CreateFile(szFileName, - GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); - dwLastIOError = GetLastError(); - fSuccess = (hFile != INVALID_HANDLE_VALUE); - if (fSuccess) { - FileVars_Init(NULL,0,&fvCurFile); - EditSetNewText(g_hwndEdit,"",0); - Style_SetLexer(g_hwndEdit,NULL); - g_iEOLMode = iLineEndings[g_iDefaultEOLMode]; - SendMessage(g_hwndEdit,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); - if (Encoding_SrcCmdLn(CPI_GET) != CPI_NONE) { - fileEncoding = Encoding_SrcCmdLn(CPI_GET); - Encoding_Current(fileEncoding); - Encoding_HasChanged(fileEncoding); - } - else { - Encoding_Current(g_iDefaultNewFileEncoding); - Encoding_HasChanged(g_iDefaultNewFileEncoding); - } - bReadOnly = false; - EditSetNewText(g_hwndEdit,"",0); - } - if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) { - CloseHandle(hFile); - } - } - else - return false; - } - else { - int idx; - if (!bReload && MRU_FindFile(g_pFileMRU,szFileName,&idx)) { - fileEncoding = g_pFileMRU->iEncoding[idx]; - if (fileEncoding > 0) - Encoding_SrcCmdLn(Encoding_MapUnicode(fileEncoding)); - } - else - fileEncoding = Encoding_Current(CPI_GET); - - fSuccess = FileIO(true,szFileName,bSkipUnicodeDetect,bSkipANSICPDetection,&fileEncoding,&g_iEOLMode,&bUnicodeErr,&bFileTooBig,&bUnknownExt,NULL,false); - if (fSuccess) - Encoding_Current(fileEncoding); // load may change encoding - } - if (fSuccess) { - StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),szFileName); - SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); - SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); - - if (!fKeepTitleExcerpt) - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - - if (!flagLexerSpecified) // flag will be cleared - Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); - - SendMessage(g_hwndEdit,SCI_SETEOLMODE,g_iEOLMode,0); - fileEncoding = Encoding_Current(CPI_GET); - Encoding_HasChanged(fileEncoding); - int idx = 0; - DocPos iCaretPos = 0; - LPCWSTR pszBookMarks = L""; - if (!bReload && MRU_FindFile(g_pFileMRU,szFileName,&idx)) { - iCaretPos = g_pFileMRU->iCaretPos[idx]; - pszBookMarks = g_pFileMRU->pszBookMarks[idx]; - } - MRU_AddFile(g_pFileMRU,szFileName,flagRelativeFileMRU,flagPortableMyDocs,fileEncoding,iCaretPos,pszBookMarks); - - EditSetBookmarkList(g_hwndEdit, pszBookMarks); - SetFindPattern((g_pMRUfind ? g_pMRUfind->pszItems[0] : L"")); - - if (flagUseSystemMRU == 2) - SHAddToRecentDocs(SHARD_PATHW,szFileName); - - // Install watching of the current file - if (!bReload && bResetFileWatching) - iFileWatchingMode = 0; - InstallFileWatching(g_wchCurFile); - - // the .LOG feature ... - if (SciCall_GetTextLength() >= 4) { - char tchLog[5] = { '\0' }; - SendMessage(g_hwndEdit,SCI_GETTEXT,5,(LPARAM)tchLog); - if (StringCchCompareXA(tchLog,".LOG") == 0) { - EditJumpTo(g_hwndEdit,-1,0); - SendMessage(g_hwndEdit,SCI_BEGINUNDOACTION,0,0); - SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); - SendMessage(g_hwndMain,WM_COMMAND,MAKELONG(IDM_EDIT_INSERT_SHORTDATE,1),0); - EditJumpTo(g_hwndEdit,-1,0); - SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); - SendMessage(g_hwndEdit,SCI_ENDUNDOACTION,0,0); - SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); - EditEnsureSelectionVisible(g_hwndEdit); - } - // set historic caret pos - else if (iCaretPos > 0) - { - SendMessage(g_hwndEdit, SCI_GOTOPOS, (WPARAM)iCaretPos, 0); - // adjust view - const DocPos iCurPos = SciCall_GetCurrentPos(); - EditJumpTo(g_hwndEdit, SciCall_LineFromPosition(iCurPos) + 1, SciCall_GetColumn(iCurPos) + 1); - } - } - - //bReadOnly = false; - _SetDocumentModified(false); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - UpdateVisibleUrlHotspot(0); - - // consistent settings file handling (if loaded in editor) - bEnableSaveSettings = (StringCchCompareINW(g_wchCurFile, COUNTOF(g_wchCurFile), g_wchIniFile, COUNTOF(g_wchIniFile)) == 0) ? false : true; - UpdateSettingsCmds(); - - // Show warning: Unicode file loaded as ANSI - if (bUnicodeErr) - MsgBox(MBWARN,IDS_ERR_UNICODE); - } - - else if (!(bFileTooBig || bUnknownExt)) - MsgBox(MBWARN,IDS_ERR_LOADFILE,szFileName); - - return(fSuccess); -} - - - -//============================================================================= -// -// FileRevert() -// -// -bool FileRevert(LPCWSTR szFileName) -{ - if (StringCchLen(szFileName, MAX_PATH) != 0) { - - const DocPos iCurPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionCaret() : SciCall_GetCurrentPos(); - const DocPos iAnchorPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionAnchor() : SciCall_GetAnchor(); - //const int vSpcCaretPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionCaretVirtualSpace() : -1; - //const int vSpcAnchorPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionAnchorVirtualSpace() : -1; - - const DocLn iCurrLine = SciCall_LineFromPosition(iCurPos); - const DocPos iCurColumn = SciCall_GetColumn(iCurPos); - const DocLn iVisTopLine = SciCall_GetFirstVisibleLine(); - const DocLn iDocTopLine = SciCall_DocLineFromVisible(iVisTopLine); - const int iXOffset = SciCall_GetXoffset(); - const bool bIsTail = (iCurPos == iAnchorPos) && (iCurrLine >= (SciCall_GetLineCount() - 1)); - - Encoding_SrcWeak(Encoding_Current(CPI_GET)); - - WCHAR tchFileName2[MAX_PATH] = { L'\0' }; - StringCchCopyW(tchFileName2,COUNTOF(tchFileName2),szFileName); - - if (FileLoad(true,false,true,false,true,tchFileName2)) - { - if (bIsTail && iFileWatchingMode == 2) { - SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); - EditEnsureSelectionVisible(g_hwndEdit); - } - else if (SciCall_GetTextLength() >= 4) { - char tch[5] = { '\0' }; - - SciCall_GetText(5, tch); - if (StringCchCompareXA(tch,".LOG") != 0) { - SciCall_ClearSelections(); - //~EditSelectEx(g_hwndEdit, iAnchorPos, iCurPos, vSpcAnchorPos, vSpcCaretPos); - EditJumpTo(g_hwndEdit, iCurrLine+1, iCurColumn+1); - SciCall_EnsureVisible(iDocTopLine); - const DocLn iNewTopLine = SciCall_GetFirstVisibleLine(); - SciCall_LineScroll(0,iVisTopLine - iNewTopLine); - SciCall_SetXoffset(iXOffset); - } - } - return true; - } - } - return false; -} - - -//============================================================================= -// -// FileSave() -// -// -bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) -{ - WCHAR tchFile[MAX_PATH] = { L'\0' }; - WCHAR tchBase[MAX_PATH] = { L'\0' }; - bool fSuccess = false; - bool bCancelDataLoss = false; - - bool bIsEmptyNewFile = false; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) { - const DocPos cchText = SciCall_GetTextLength(); - if (cchText == 0) - bIsEmptyNewFile = true; - else if (cchText < 1023) { - char tchText[1024]; - SendMessage(g_hwndEdit,SCI_GETTEXT,(WPARAM)1023,(LPARAM)tchText); - StrTrimA(tchText," \t\n\r"); - if (lstrlenA(tchText) == 0) - bIsEmptyNewFile = true; - } - } - - if (!bSaveAlways && (!IsDocumentModified && !Encoding_HasChanged(CPI_GET) || bIsEmptyNewFile) && !bSaveAs) { - int idx; - if (MRU_FindFile(g_pFileMRU,g_wchCurFile,&idx)) { - g_pFileMRU->iEncoding[idx] = Encoding_Current(CPI_GET); - g_pFileMRU->iCaretPos[idx] = (bPreserveCaretPos) ? SciCall_GetCurrentPos() : 0; - WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; - EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); - if (g_pFileMRU->pszBookMarks[idx]) - LocalFree(g_pFileMRU->pszBookMarks[idx]); - g_pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); - } - return true; - } - - if (bAsk) - { - // File or "Untitled" ... - WCHAR tch[MAX_PATH] = { L'\0' }; - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - StringCchCopy(tch,COUNTOF(tch),g_wchCurFile); - else - GetString(IDS_UNTITLED,tch,COUNTOF(tch)); - - switch (MsgBox(MBYESNOCANCEL,IDS_ASK_SAVE,tch)) { - case IDCANCEL: - return false; - case IDNO: - return true; - } - } - - // Read only... - if (!bSaveAs && !bSaveCopy && StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) - { - DWORD dwFileAttributes = GetFileAttributes(g_wchCurFile); - if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) - bReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY); - if (bReadOnly) { - UpdateToolbar(); - if (MsgBox(MBYESNOWARN,IDS_READONLY_SAVE,g_wchCurFile) == IDYES) - bSaveAs = true; - else - return false; - } - } - - // Save As... - if (bSaveAs || bSaveCopy || StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) - { - WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; - if (bSaveCopy && StringCchLenW(tchLastSaveCopyDir,COUNTOF(tchLastSaveCopyDir))) { - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),tchLastSaveCopyDir); - StringCchCopy(tchFile,COUNTOF(tchFile),tchLastSaveCopyDir); - PathCchAppend(tchFile,COUNTOF(tchFile),PathFindFileName(g_wchCurFile)); - } - else - StringCchCopy(tchFile,COUNTOF(tchFile),g_wchCurFile); - - if (SaveFileDlg(g_hwndMain,tchFile,COUNTOF(tchFile),tchInitialDir)) - { - int fileEncoding = Encoding_Current(CPI_GET); - fSuccess = FileIO(false, tchFile, false, true, &fileEncoding, &g_iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, bSaveCopy); - //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding - if (fSuccess) - { - if (!bSaveCopy) - { - StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),tchFile); - SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); - SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); - if (!fKeepTitleExcerpt) - StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); - Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); - UpdateToolbar(); - UpdateStatusbar(); - UpdateLineNumberWidth(); - } - else { - StringCchCopy(tchLastSaveCopyDir,COUNTOF(tchLastSaveCopyDir),tchFile); - PathRemoveFileSpec(tchLastSaveCopyDir); - } - } - } - else - return false; - } - else { - int fileEncoding = Encoding_Current(CPI_GET); - fSuccess = FileIO(false, g_wchCurFile, false, true, &fileEncoding, &g_iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, false); - //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding - } - - if (fSuccess) - { - if (!bSaveCopy) - { - int iCurrEnc = Encoding_Current(CPI_GET); - Encoding_HasChanged(iCurrEnc); - const DocPos iCaretPos = SciCall_GetCurrentPos(); - WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; - EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); - MRU_AddFile(g_pFileMRU,g_wchCurFile,flagRelativeFileMRU,flagPortableMyDocs,iCurrEnc,iCaretPos,wchBookMarks); - if (flagUseSystemMRU == 2) - SHAddToRecentDocs(SHARD_PATHW,g_wchCurFile); - - _SetDocumentModified(false); - // Install watching of the current file - if (bSaveAs && bResetFileWatching) - iFileWatchingMode = 0; - InstallFileWatching(g_wchCurFile); - } - } - else if (!bCancelDataLoss) - { - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) > 0) { - StringCchCopy(tchFile,COUNTOF(tchFile),g_wchCurFile); - StringCchCopy(tchBase,COUNTOF(tchBase),g_wchCurFile); - PathStripPath(tchBase); - } - if (!flagIsElevated && dwLastIOError == ERROR_ACCESS_DENIED) { - if (IDYES == MsgBox(MBYESNOWARN,IDS_ERR_ACCESSDENIED,tchFile)) { - WCHAR lpTempPathBuffer[MAX_PATH]; - WCHAR szTempFileName[MAX_PATH]; - - if (GetTempPath(MAX_PATH,lpTempPathBuffer) && - GetTempFileName(lpTempPathBuffer,TEXT("NP3"),0,szTempFileName)) { - int fileEncoding = Encoding_Current(CPI_GET); - if (FileIO(false,szTempFileName,false,true,&fileEncoding,&g_iEOLMode,NULL,NULL,NULL,&bCancelDataLoss,true)) { - //~Encoding_Current(fileEncoding); // save should not change encoding - WCHAR szArguments[2048] = { L'\0' }; - LPWSTR lpCmdLine = GetCommandLine(); - int wlen = lstrlen(lpCmdLine) + 2; - LPWSTR lpExe = LocalAlloc(LPTR,sizeof(WCHAR)*wlen); - LPWSTR lpArgs = LocalAlloc(LPTR,sizeof(WCHAR)*wlen); - ExtractFirstArgument(lpCmdLine,lpExe,lpArgs,wlen); - // remove relaunch elevated, we are doing this here already - lpArgs = StrCutI(lpArgs,L"/u "); - lpArgs = StrCutI(lpArgs,L"-u "); - WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); - StringCchPrintf(szArguments,COUNTOF(szArguments), - L"/pos %i,%i,%i,%i,%i /tmpfbuf=\"%s\" %s",wi.x,wi.y,wi.cx,wi.cy,wi.max,szTempFileName,lpArgs); - if (StringCchLenW(tchFile,COUNTOF(tchFile))) { - if (!StrStrI(szArguments,tchBase)) { - StringCchPrintf(szArguments,COUNTOF(szArguments),L"%s \"%s\"",szArguments,tchFile); - } - } - flagRelaunchElevated = 1; - if (RelaunchElevated(szArguments)) { - LocalFree(lpExe); - LocalFree(lpArgs); - // set no change and quit - Encoding_HasChanged(Encoding_Current(CPI_GET)); - _SetDocumentModified(false); - PostMessage(g_hwndMain,WM_CLOSE,0,0); - } - else { - if (PathFileExists(szTempFileName)) { - DeleteFile(szTempFileName); - } - UpdateToolbar(); - MsgBox(MBWARN,IDS_ERR_SAVEFILE,tchFile); - } - } - } - } - } - else { - UpdateToolbar(); - MsgBox(MBWARN,IDS_ERR_SAVEFILE,tchFile); - } - } - return(fSuccess); -} - - -//============================================================================= -// -// OpenFileDlg() -// -// -bool OpenFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir) -{ - OPENFILENAME ofn; - WCHAR szFile[MAX_PATH] = { L'\0' }; - WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100]; - WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; - - Style_GetOpenDlgFilterStr(szFilter,COUNTOF(szFilter)); - - if (!lpstrInitialDir) { - if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchCurFile); - PathRemoveFileSpec(tchInitialDir); - } - else if (StringCchLenW(tchDefaultDir,COUNTOF(tchDefaultDir))) { - ExpandEnvironmentStrings(tchDefaultDir,tchInitialDir,COUNTOF(tchInitialDir)); - if (PathIsRelative(tchInitialDir)) { - WCHAR tchModule[MAX_PATH] = { L'\0' }; - GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); - PathRemoveFileSpec(tchModule); - PathCchAppend(tchModule,COUNTOF(tchModule),tchInitialDir); - PathCchCanonicalize(tchInitialDir,COUNTOF(tchInitialDir),tchModule); - } - } - else - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchWorkingDirectory); - } - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = szFilter; - ofn.lpstrFile = szFile; - ofn.lpstrInitialDir = (lpstrInitialDir) ? lpstrInitialDir : tchInitialDir; - ofn.nMaxFile = COUNTOF(szFile); - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | /* OFN_NOCHANGEDIR |*/ - OFN_DONTADDTORECENT | OFN_PATHMUSTEXIST | - OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/; - ofn.lpstrDefExt = (StringCchLenW(tchDefaultExtension,COUNTOF(tchDefaultExtension))) ? tchDefaultExtension : NULL; - - if (GetOpenFileName(&ofn)) { - StringCchCopyN(lpstrFile,cchFile,szFile,COUNTOF(szFile)); - return true; - } - - else - return false; -} - - -//============================================================================= -// -// SaveFileDlg() -// -// -bool SaveFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir) -{ - OPENFILENAME ofn; - WCHAR szNewFile[MAX_PATH] = { L'\0' }; - WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100] = { L'\0' }; - WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; - - StringCchCopy(szNewFile,COUNTOF(szNewFile),lpstrFile); - Style_GetOpenDlgFilterStr(szFilter,COUNTOF(szFilter)); - - if (lstrlen(lpstrInitialDir)) - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),lpstrInitialDir); - else if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchCurFile); - PathRemoveFileSpec(tchInitialDir); - } - else if (StringCchLenW(tchDefaultDir,COUNTOF(tchDefaultDir))) { - ExpandEnvironmentStrings(tchDefaultDir,tchInitialDir,COUNTOF(tchInitialDir)); - if (PathIsRelative(tchInitialDir)) { - WCHAR tchModule[MAX_PATH] = { L'\0' }; - GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); - PathRemoveFileSpec(tchModule); - PathCchAppend(tchModule,COUNTOF(tchModule),tchInitialDir); - PathCchCanonicalize(tchInitialDir,COUNTOF(tchInitialDir),tchModule); - } - } - else - StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchWorkingDirectory); - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = szFilter; - ofn.lpstrFile = szNewFile; - ofn.lpstrInitialDir = tchInitialDir; - ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_HIDEREADONLY /*| OFN_NOCHANGEDIR*/ | - /*OFN_NODEREFERENCELINKS |*/ OFN_OVERWRITEPROMPT | - OFN_DONTADDTORECENT | OFN_PATHMUSTEXIST; - ofn.lpstrDefExt = (StringCchLenW(tchDefaultExtension,COUNTOF(tchDefaultExtension))) ? tchDefaultExtension : NULL; - - if (GetSaveFileName(&ofn)) { - StringCchCopyN(lpstrFile,cchFile,szNewFile,COUNTOF(szNewFile)); - return true; - } - - else - return false; -} - - -/****************************************************************************** -* -* ActivatePrevInst() -* -* Tries to find and activate an already open Notepad3 Window -* -* -******************************************************************************/ -BOOL CALLBACK EnumWndProc(HWND hwnd,LPARAM lParam) -{ - BOOL bContinue = TRUE; - WCHAR szClassName[64] = { L'\0' }; - - if (GetClassName(hwnd,szClassName,COUNTOF(szClassName))) - - if (StringCchCompareINW(szClassName,COUNTOF(szClassName),wchWndClass,COUNTOF(wchWndClass)) == 0) { - - DWORD dwReuseLock = GetDlgItemInt(hwnd,IDC_REUSELOCK,NULL,FALSE); - if (GetTickCount() - dwReuseLock >= REUSEWINDOWLOCKTIMEOUT) { - - *(HWND*)lParam = hwnd; - - if (IsWindowEnabled(hwnd)) - bContinue = FALSE; - } - } - return bContinue; -} - -BOOL CALLBACK EnumWndProc2(HWND hwnd,LPARAM lParam) -{ - BOOL bContinue = TRUE; - WCHAR szClassName[64] = { L'\0' }; - - if (GetClassName(hwnd,szClassName,COUNTOF(szClassName))) - - if (StringCchCompareINW(szClassName,COUNTOF(szClassName),wchWndClass,COUNTOF(wchWndClass)) == 0) { - - DWORD dwReuseLock = GetDlgItemInt(hwnd,IDC_REUSELOCK,NULL,false); - if (GetTickCount() - dwReuseLock >= REUSEWINDOWLOCKTIMEOUT) { - - WCHAR tchFileName[MAX_PATH] = { L'\0' }; - - if (IsWindowEnabled(hwnd)) - bContinue = FALSE; - - GetDlgItemText(hwnd,IDC_FILENAME,tchFileName,COUNTOF(tchFileName)); - if (StringCchCompareIN(tchFileName,COUNTOF(tchFileName),lpFileArg,-1) == 0) - *(HWND*)lParam = hwnd; - else - bContinue = TRUE; - } - } - return bContinue; -} - -bool ActivatePrevInst() -{ - HWND hwnd = NULL; - COPYDATASTRUCT cds; - - if ((flagNoReuseWindow && !flagSingleFileInstance) || flagStartAsTrayIcon || flagNewFromClipboard || flagPasteBoard) - return(false); - - if (flagSingleFileInstance && lpFileArg) { - - // Search working directory from second instance, first! - // lpFileArg is at least MAX_PATH+4 WCHARS - WCHAR tchTmp[FILE_ARG_BUF] = { L'\0' }; - - ExpandEnvironmentStringsEx(lpFileArg,(DWORD)SizeOfMem(lpFileArg)/sizeof(WCHAR)); - - if (PathIsRelative(lpFileArg)) { - StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); - PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); - if (PathFileExists(tchTmp)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - else { - if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - else { - StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); - PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - } - } - } - - else if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - - NormalizePathEx(lpFileArg,FILE_ARG_BUF); - - EnumWindows(EnumWndProc2,(LPARAM)&hwnd); - - if (hwnd != NULL) - { - // Enabled - if (IsWindowEnabled(hwnd)) - { - // Make sure the previous window won't pop up a change notification message - //SendMessage(hwnd,WM_CHANGENOTIFYCLEAR,0,0); - - if (IsIconic(hwnd)) - ShowWindowAsync(hwnd,SW_RESTORE); - - if (!IsWindowVisible(hwnd)) { - SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONDBLCLK); - SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONUP); - } - - SetForegroundWindow(hwnd); - - DWORD cb = sizeof(np3params); - if (lpSchemeArg) - cb += (lstrlen(lpSchemeArg) + 1) * sizeof(WCHAR); - - LPnp3params params = AllocMem(cb, HEAP_ZERO_MEMORY); - params->flagFileSpecified = false; - params->flagChangeNotify = 0; - params->flagQuietCreate = false; - params->flagLexerSpecified = flagLexerSpecified; - if (flagLexerSpecified && lpSchemeArg) { - StringCchCopy(StrEnd(¶ms->wchData)+1,(lstrlen(lpSchemeArg)+1),lpSchemeArg); - params->iInitialLexer = -1; - } - else - params->iInitialLexer = iInitialLexer; - params->flagJumpTo = flagJumpTo; - params->iInitialLine = iInitialLine; - params->iInitialColumn = iInitialColumn; - - params->iSrcEncoding = (lpEncodingArg) ? Encoding_MatchW(lpEncodingArg) : CPI_NONE; - params->flagSetEncoding = flagSetEncoding; - params->flagSetEOLMode = flagSetEOLMode; - params->flagTitleExcerpt = 0; - - cds.dwData = DATA_NOTEPAD3_PARAMS; - cds.cbData = (DWORD)SizeOfMem(params); - cds.lpData = params; - - SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); - FreeMem(params); - - return(true); - } - - else // IsWindowEnabled() - { - // Ask... - if (IDYES == MsgBox(MBYESNO,IDS_ERR_PREVWINDISABLED)) - return(false); - else - return(true); - } - } - } - - if (flagNoReuseWindow) - return(false); - - hwnd = NULL; - EnumWindows(EnumWndProc,(LPARAM)&hwnd); - - // Found a window - if (hwnd != NULL) - { - // Enabled - if (IsWindowEnabled(hwnd)) - { - // Make sure the previous window won't pop up a change notification message - //SendMessage(hwnd,WM_CHANGENOTIFYCLEAR,0,0); - - if (IsIconic(hwnd)) - ShowWindowAsync(hwnd,SW_RESTORE); - - if (!IsWindowVisible(hwnd)) { - SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONDBLCLK); - SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONUP); - } - - SetForegroundWindow(hwnd); - - if (lpFileArg) - { - // Search working directory from second instance, first! - // lpFileArg is at least MAX_PATH+4 WCHAR - WCHAR tchTmp[FILE_ARG_BUF] = { L'\0' }; - - ExpandEnvironmentStringsEx(lpFileArg,(DWORD)SizeOfMem(lpFileArg)/sizeof(WCHAR)); - - if (PathIsRelative(lpFileArg)) { - StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); - PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); - if (PathFileExists(tchTmp)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - else { - if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - } - } - - else if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) - StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); - - DWORD cb = sizeof(np3params); - cb += (lstrlen(lpFileArg) + 1) * sizeof(WCHAR); - - if (lpSchemeArg) - cb += (lstrlen(lpSchemeArg) + 1) * sizeof(WCHAR); - - int cchTitleExcerpt = (int)StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt)); - if (cchTitleExcerpt) - cb += (cchTitleExcerpt + 1) * sizeof(WCHAR); - - LPnp3params params = AllocMem(cb, HEAP_ZERO_MEMORY); - params->flagFileSpecified = true; - StringCchCopy(¶ms->wchData,lstrlen(lpFileArg)+1,lpFileArg); - params->flagChangeNotify = flagChangeNotify; - params->flagQuietCreate = flagQuietCreate; - params->flagLexerSpecified = flagLexerSpecified; - if (flagLexerSpecified && lpSchemeArg) { - StringCchCopy(StrEnd(¶ms->wchData)+1,lstrlen(lpSchemeArg)+1,lpSchemeArg); - params->iInitialLexer = -1; - } - else - params->iInitialLexer = iInitialLexer; - params->flagJumpTo = flagJumpTo; - params->iInitialLine = iInitialLine; - params->iInitialColumn = iInitialColumn; - - params->iSrcEncoding = (lpEncodingArg) ? Encoding_MatchW(lpEncodingArg) : CPI_NONE; - params->flagSetEncoding = flagSetEncoding; - params->flagSetEOLMode = flagSetEOLMode; - - if (cchTitleExcerpt) { - StringCchCopy(StrEnd(¶ms->wchData)+1,cchTitleExcerpt+1,szTitleExcerpt); - params->flagTitleExcerpt = 1; - } - else - params->flagTitleExcerpt = 0; - - cds.dwData = DATA_NOTEPAD3_PARAMS; - cds.cbData = (DWORD)SizeOfMem(params); - cds.lpData = params; - - SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); - FreeMem(params); params = NULL; - FreeMem(lpFileArg); lpFileArg = NULL; - } - return(true); - } - else // IsWindowEnabled() - { - // Ask... - if (IDYES == MsgBox(MBYESNO,IDS_ERR_PREVWINDISABLED)) - return(false); - else - return(true); - } - } - else - return(false); -} - - -//============================================================================= -// -// RelaunchMultiInst() -// -// -bool RelaunchMultiInst() { - - if (flagMultiFileArg == 2 && cFileList > 1) { - - WCHAR *pwch; - int i = 0; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - LPWSTR lpCmdLineNew = StrDup(GetCommandLine()); - int len = lstrlen(lpCmdLineNew) + 1; - LPWSTR lp1 = LocalAlloc(LPTR,sizeof(WCHAR)*len); - LPWSTR lp2 = LocalAlloc(LPTR,sizeof(WCHAR)*len); - - StrTab2Space(lpCmdLineNew); - StringCchCopy(lpCmdLineNew + cchiFileList,2,L""); - - pwch = CharPrev(lpCmdLineNew,StrEnd(lpCmdLineNew)); - while (*pwch == L' ' || *pwch == L'-' || *pwch == L'+') { - *pwch = L' '; - pwch = CharPrev(lpCmdLineNew,pwch); - if (i++ > 1) - cchiFileList--; - } - - for (i = 0; i < cFileList; i++) - { - StringCchCopy(lpCmdLineNew + cchiFileList,8,L" /n - "); - StringCchCat(lpCmdLineNew,len,lpFileList[i]); - LocalFree(lpFileList[i]); - - ZeroMemory(&si,sizeof(STARTUPINFO)); - si.cb = sizeof(STARTUPINFO); - - ZeroMemory(&pi,sizeof(PROCESS_INFORMATION)); - - CreateProcess(NULL,lpCmdLineNew,NULL,NULL,false,0,NULL,g_wchWorkingDirectory,&si,&pi); - } - - LocalFree(lpCmdLineNew); - LocalFree(lp1); - LocalFree(lp2); - FreeMem(lpFileArg); lpFileArg = NULL; - - return true; - } - - else { - int i; - for (i = 0; i < cFileList; i++) - LocalFree(lpFileList[i]); - return false; - } -} - - -//============================================================================= -// -// RelaunchElevated() -// -// -bool RelaunchElevated(LPWSTR lpArgs) { - - bool result = false; - - if (!IsVista() || flagIsElevated || !flagRelaunchElevated || flagDisplayHelp) - return result; - - STARTUPINFO si; - si.cb = sizeof(STARTUPINFO); - GetStartupInfo(&si); - - LPWSTR lpCmdLine = GetCommandLine(); - int wlen = lstrlen(lpCmdLine) + 2; - - WCHAR lpExe[MAX_PATH + 2] = { L'\0' }; - WCHAR szArgs[2032] = { L'\0' }; - WCHAR szArguments[2032] = { L'\0' }; - - ExtractFirstArgument(lpCmdLine,lpExe,szArgs,wlen); - - if (lpArgs) { - StringCchCopy(szArgs,COUNTOF(szArgs),lpArgs); // override - } - - if (StrStrI(szArgs,L"/f ") || StrStrI(szArgs,L"-f ")) { - StringCchCopy(szArguments,COUNTOF(szArguments),szArgs); - } - else { - if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0) - StringCchPrintf(szArguments,COUNTOF(szArguments),L"/f \"%s\" %s",g_wchIniFile,szArgs); - else - StringCchCopy(szArguments,COUNTOF(szArguments),szArgs); - } - - if (lstrlen(szArguments)) { - SHELLEXECUTEINFO sei; - ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); - sei.cbSize = sizeof(SHELLEXECUTEINFO); - sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOZONECHECKS; - sei.hwnd = GetForegroundWindow(); - sei.lpVerb = L"runas"; - sei.lpFile = lpExe; - sei.lpParameters = szArguments; - sei.lpDirectory = g_wchWorkingDirectory; - sei.nShow = si.wShowWindow ? si.wShowWindow : SW_SHOWNORMAL; - result = ShellExecuteEx(&sei); - } - - return result; -} - - -//============================================================================= -// -// SnapToDefaultPos() -// -// Aligns Notepad3 to the default window position on the current screen -// -// -void SnapToDefaultPos(HWND hwnd) -{ - RECT rcOld; GetWindowRect(hwnd, &rcOld); - - RECT rc; SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); - - flagDefaultPos = 2; - _InitWindowPosition(hwnd); - - WINDOWPLACEMENT wndpl; - ZeroMemory(&wndpl, sizeof(WINDOWPLACEMENT)); - wndpl.length = sizeof(WINDOWPLACEMENT); - wndpl.flags = WPF_ASYNCWINDOWPLACEMENT; - wndpl.showCmd = SW_RESTORE; - - wndpl.rcNormalPosition.left = g_WinInfo.x - rc.left; - wndpl.rcNormalPosition.top = g_WinInfo.y - rc.top; - wndpl.rcNormalPosition.right = g_WinInfo.x - rc.left + g_WinInfo.cx; - wndpl.rcNormalPosition.bottom = g_WinInfo.y - rc.top + g_WinInfo.cy; - - if (GetDoAnimateMinimize()) { - DrawAnimatedRects(hwnd,IDANI_CAPTION,&rcOld,&wndpl.rcNormalPosition); - //OffsetRect(&wndpl.rcNormalPosition,mi.rcMonitor.left - mi.rcWork.left,mi.rcMonitor.top - mi.rcWork.top); - } - SetWindowPlacement(hwnd,&wndpl); -} - - -//============================================================================= -// -// ShowNotifyIcon() -// -// -void ShowNotifyIcon(HWND hwnd,bool bAdd) -{ - - static HICON hIcon; - NOTIFYICONDATA nid; - - if (!hIcon) - hIcon = LoadImage(g_hInstance,MAKEINTRESOURCE(IDR_MAINWND),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); - - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - nid.cbSize = sizeof(NOTIFYICONDATA); - nid.hWnd = hwnd; - nid.uID = 0; - nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; - nid.uCallbackMessage = WM_TRAYMESSAGE; - nid.hIcon = hIcon; - StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L"Notepad3"); - - if(bAdd) - Shell_NotifyIcon(NIM_ADD,&nid); - else - Shell_NotifyIcon(NIM_DELETE,&nid); - -} - - -//============================================================================= -// -// SetNotifyIconTitle() -// -// -void SetNotifyIconTitle(HWND hwnd) -{ - - NOTIFYICONDATA nid; - SHFILEINFO shfi; - WCHAR tchTitle[256] = { L'\0' }; - WCHAR tchFormat[32] = { L'\0' }; - - ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); - nid.cbSize = sizeof(NOTIFYICONDATA); - nid.hWnd = hwnd; - nid.uID = 0; - nid.uFlags = NIF_TIP; - - if (StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt))) { - GetString(IDS_TITLEEXCERPT,tchFormat,COUNTOF(tchFormat)); - StringCchPrintf(tchTitle,COUNTOF(tchTitle),tchFormat,szTitleExcerpt); - } - - else if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { - SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL, - &shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); - PathCompactPathEx(tchTitle,shfi.szDisplayName,COUNTOF(tchTitle)-4,0); - } - else - GetString(IDS_UNTITLED,tchTitle,COUNTOF(tchTitle)-4); - - if (IsDocumentModified || Encoding_HasChanged(CPI_GET)) - StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L"* "); - else - StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L""); - - StringCchCat(nid.szTip,COUNTOF(nid.szTip),tchTitle); - - Shell_NotifyIcon(NIM_MODIFY,&nid); -} - - -//============================================================================= -// -// InstallFileWatching() -// -// -void InstallFileWatching(LPCWSTR lpszFile) -{ - - WCHAR tchDirectory[MAX_PATH] = { L'\0' }; - HANDLE hFind; - - // Terminate - if (!iFileWatchingMode || !lpszFile || StringCchLen(lpszFile,MAX_PATH) == 0) - { - if (bRunningWatch) - { - if (hChangeHandle) { - FindCloseChangeNotification(hChangeHandle); - hChangeHandle = NULL; - } - KillTimer(NULL,ID_WATCHTIMER); - bRunningWatch = false; - dwChangeNotifyTime = 0; - } - } - else // Install - { - // Terminate previous watching - if (bRunningWatch) { - if (hChangeHandle) { - FindCloseChangeNotification(hChangeHandle); - hChangeHandle = NULL; - } - dwChangeNotifyTime = 0; - } - - // No previous watching installed, so launch the timer first - else - SetTimer(NULL,ID_WATCHTIMER,dwFileCheckInverval,WatchTimerProc); - - StringCchCopy(tchDirectory,COUNTOF(tchDirectory),lpszFile); - PathRemoveFileSpec(tchDirectory); - - // Save data of current file - hFind = FindFirstFile(g_wchCurFile,&fdCurFile); - if (hFind != INVALID_HANDLE_VALUE) - FindClose(hFind); - else - ZeroMemory(&fdCurFile,sizeof(WIN32_FIND_DATA)); - - hChangeHandle = FindFirstChangeNotification(tchDirectory,false, - FILE_NOTIFY_CHANGE_FILE_NAME | \ - FILE_NOTIFY_CHANGE_DIR_NAME | \ - FILE_NOTIFY_CHANGE_ATTRIBUTES | \ - FILE_NOTIFY_CHANGE_SIZE | \ - FILE_NOTIFY_CHANGE_LAST_WRITE); - - bRunningWatch = true; - dwChangeNotifyTime = 0; - } - UpdateToolbar(); -} - - -//============================================================================= -// -// WatchTimerProc() -// -// -void CALLBACK WatchTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) -{ - if (bRunningWatch) - { - if (dwChangeNotifyTime > 0 && GetTickCount() - dwChangeNotifyTime > dwAutoReloadTimeout) - { - if (hChangeHandle) { - FindCloseChangeNotification(hChangeHandle); - hChangeHandle = NULL; - } - KillTimer(NULL,ID_WATCHTIMER); - bRunningWatch = false; - dwChangeNotifyTime = 0; - SendMessage(g_hwndMain,WM_CHANGENOTIFY,0,0); - } - - // Check Change Notification Handle - else if (WAIT_OBJECT_0 == WaitForSingleObject(hChangeHandle,0)) - { - // Check if the changes affect the current file - WIN32_FIND_DATA fdUpdated; - HANDLE hFind = FindFirstFile(g_wchCurFile,&fdUpdated); - if (INVALID_HANDLE_VALUE != hFind) - FindClose(hFind); - else - // The current file has been removed - ZeroMemory(&fdUpdated,sizeof(WIN32_FIND_DATA)); - - // Check if the file has been changed - if (CompareFileTime(&fdCurFile.ftLastWriteTime,&fdUpdated.ftLastWriteTime) != 0 || - fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow || - fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh) - { - // Shutdown current watching and give control to main window - if (hChangeHandle) { - FindCloseChangeNotification(hChangeHandle); - hChangeHandle = NULL; - } - if (iFileWatchingMode == 2) { - bRunningWatch = true; /* ! */ - dwChangeNotifyTime = GetTickCount(); - } - else { - KillTimer(NULL,ID_WATCHTIMER); - bRunningWatch = false; - dwChangeNotifyTime = 0; - SendMessage(g_hwndMain,WM_CHANGENOTIFY,0,0); - } - } - - else - FindNextChangeNotification(hChangeHandle); - } - } - - UNUSED(dwTime); - UNUSED(idEvent); - UNUSED(uMsg); - UNUSED(hwnd); -} - - -//============================================================================= -// -// PasteBoardTimer() -// -// -void CALLBACK PasteBoardTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) -{ - if ((dwLastCopyTime > 0) && ((GetTickCount() - dwLastCopyTime) > 200)) { - - if (SendMessage(g_hwndEdit,SCI_CANPASTE,0,0)) { - - bool bAutoIndent2 = bAutoIndent; - bAutoIndent = 0; - EditJumpTo(g_hwndEdit,-1,0); - SendMessage(g_hwndEdit,SCI_BEGINUNDOACTION,0,0); - if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) { - SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); - } - SendMessage(g_hwndEdit,SCI_PASTE,0,0); - SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); - SendMessage(g_hwndEdit,SCI_ENDUNDOACTION,0,0); - EditEnsureSelectionVisible(g_hwndEdit); - bAutoIndent = bAutoIndent2; - } - dwLastCopyTime = 0; - } - - UNUSED(dwTime); - UNUSED(idEvent); - UNUSED(uMsg); - UNUSED(hwnd); -} - - - -/// End of Notepad3.c \\\ +/****************************************************************************** +* * +* * +* Notepad3 * +* * +* Notepad3.c * +* Main application window functionality * +* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * +* * +* (c) Rizonesoft 2008-2017 * +* https://rizonesoft.com * +* * +* * +*******************************************************************************/ + +#if !defined(WINVER) +#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(NTDDI_VERSION) +#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ +#endif +#define VC_EXTRALEAN 1 +#define WIN32_LEAN_AND_MEAN 1 + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include + +#include "scintilla.h" +#include "scilexer.h" +#include "edit.h" +#include "styles.h" +#include "dialogs.h" +#include "resource.h" +#include "../crypto/crypto.h" +#include "../uthash/utarray.h" +#include "../uthash/utlist.h" +#include "encoding.h" +#include "helpers.h" +#include "SciCall.h" + +#include "notepad3.h" + + + +/****************************************************************************** +* +* Local and global Variables for Notepad3.c +* +*/ +HWND g_hwndMain = NULL; +HWND g_hwndStatus = NULL; +HWND g_hwndToolbar = NULL; +HWND g_hwndDlgFindReplace = NULL; +HWND g_hwndDlgCustomizeSchemes = NULL; +HWND hwndReBar = NULL; +HWND hwndEditFrame = NULL; +HWND hwndNextCBChain = NULL; + +#define INISECTIONBUFCNT 32 + +TBBUTTON tbbMainWnd[] = { { 0,IDT_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 1,IDT_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 3,IDT_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 2,IDT_FILE_BROWSE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 4,IDT_EDIT_UNDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 5,IDT_EDIT_REDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 6,IDT_EDIT_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 7,IDT_EDIT_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 8,IDT_EDIT_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 9,IDT_EDIT_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 10,IDT_EDIT_REPLACE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 11,IDT_VIEW_WORDWRAP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 23,IDT_VIEW_TOGGLEFOLDS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 25,IDT_VIEW_TOGGLE_VIEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 21,IDT_FILE_OPENFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 12,IDT_VIEW_ZOOMIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 13,IDT_VIEW_ZOOMOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 14,IDT_VIEW_SCHEME,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 24,IDT_FILE_LAUNCH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 16,IDT_FILE_EXIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 15,IDT_VIEW_SCHEMECONFIG,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 0,0,0,TBSTYLE_SEP,0,0 }, + { 17,IDT_FILE_SAVEAS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 18,IDT_FILE_SAVECOPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 19,IDT_EDIT_CLEAR,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }, + { 20,IDT_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 } +}; + +#define NUMTOOLBITMAPS 26 +#define NUMINITIALTOOLS 31 +#define TBBUTTON_DEFAULT_IDS L"1 2 4 3 0 5 6 0 7 8 9 0 10 11 0 12 0 24 26 0 22 23 0 13 14 0 15 0 25 0 17" + + +WCHAR g_wchIniFile[MAX_PATH] = { L'\0' }; +WCHAR g_wchIniFile2[MAX_PATH] = { L'\0' }; +WCHAR szBufferFile[MAX_PATH] = { L'\0' }; +bool bSaveSettings; +bool bEnableSaveSettings; +bool bSaveRecentFiles; +bool bPreserveCaretPos; +bool bSaveFindReplace; +bool bFindReplCopySelOrClip = true; +WCHAR tchLastSaveCopyDir[MAX_PATH] = { L'\0' }; +WCHAR tchOpenWithDir[MAX_PATH] = { L'\0' }; +WCHAR tchFavoritesDir[MAX_PATH] = { L'\0' }; +WCHAR tchDefaultDir[MAX_PATH] = { L'\0' }; +WCHAR tchDefaultExtension[64] = { L'\0' }; +WCHAR tchFileDlgFilters[5*1024] = { L'\0' }; +WCHAR tchToolbarButtons[512] = { L'\0' }; +WCHAR tchToolbarBitmap[MAX_PATH] = { L'\0' }; +WCHAR tchToolbarBitmapHot[MAX_PATH] = { L'\0' }; +WCHAR tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' }; + +int iPathNameFormat; +bool bWordWrap; +bool bWordWrapG; +int iWordWrapMode; +int iWordWrapIndent; +int iWordWrapSymbols; +bool bShowWordWrapSymbols; +bool bMatchBraces; +bool bAutoIndent; +bool bAutoCloseTags; +bool bShowIndentGuides; +bool bHiliteCurrentLine; +bool g_bHyperlinkHotspot; +bool bScrollPastEOF; +bool g_bTabsAsSpaces; +bool bTabsAsSpacesG; +bool g_bTabIndents; +bool bTabIndentsG; +bool bBackspaceUnindents; +int g_iTabWidth; +int iTabWidthG; +int g_iIndentWidth; +int iIndentWidthG; +bool bMarkLongLines; +int iLongLinesLimit; +int iLongLinesLimitG; +int iLongLineMode; +int iWrapCol = 0; +bool g_bShowSelectionMargin; +bool bShowLineNumbers; +int iReplacedOccurrences; +int g_iMarkOccurrences; +int g_iMarkOccurrencesCount; +int g_iMarkOccurrencesMaxCount; +bool g_bMarkOccurrencesMatchVisible; +bool bMarkOccurrencesMatchCase; +bool bMarkOccurrencesMatchWords; +bool bMarkOccurrencesCurrentWord; +bool bUseOldStyleBraceMatching; +bool bAutoCompleteWords; +bool bAccelWordNavigation; +bool bDenyVirtualSpaceAccess; +bool g_bCodeFoldingAvailable; +bool g_bShowCodeFolding; +bool bViewWhiteSpace; +bool bViewEOLs; +bool bUseDefaultForFileEncoding; +bool bSkipUnicodeDetection; +bool bSkipANSICodePageDetection; +bool bLoadASCIIasUTF8; +bool bLoadNFOasOEM; +bool bNoEncodingTags; +bool bFixLineEndings; +bool bAutoStripBlanks; +int iPrintHeader; +int iPrintFooter; +int iPrintColor; +int iPrintZoom; +RECT pagesetupMargin; +bool bSaveBeforeRunningTools; +int iFileWatchingMode; +bool bResetFileWatching; +DWORD dwFileCheckInverval; +DWORD dwAutoReloadTimeout; +int iEscFunction; +bool bAlwaysOnTop; +bool bMinimizeToTray; +bool bTransparentMode; +bool bTransparentModeAvailable; +bool bShowToolbar; +bool bShowStatusbar; +int iSciDirectWriteTech; +int iSciFontQuality; +int iHighDpiToolBar; +int iUpdateDelayHyperlinkStyling; +int iUpdateDelayMarkAllCoccurrences; +int iCurrentLineHorizontalSlop = 0; +int iCurrentLineVerticalSlop = 0; + +const int DirectWriteTechnology[4] = { + SC_TECHNOLOGY_DEFAULT + , SC_TECHNOLOGY_DIRECTWRITE + , SC_TECHNOLOGY_DIRECTWRITERETAIN + , SC_TECHNOLOGY_DIRECTWRITEDC +}; + +const int FontQuality[4] = { + SC_EFF_QUALITY_DEFAULT + , SC_EFF_QUALITY_NON_ANTIALIASED + , SC_EFF_QUALITY_ANTIALIASED + , SC_EFF_QUALITY_LCD_OPTIMIZED +}; + +WININFO g_WinInfo = { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0 }; + +bool bStickyWinPos; + +bool bIsAppThemed; +int cyReBar; +int cyReBarFrame; +int cxEditFrame; +int cyEditFrame; + +int cxEncodingDlg; +int cyEncodingDlg; +int cxRecodeDlg; +int cyRecodeDlg; +int cxFileMRUDlg; +int cyFileMRUDlg; +int cxOpenWithDlg; +int cyOpenWithDlg; +int cxFavoritesDlg; +int cyFavoritesDlg; +int xFindReplaceDlg; +int yFindReplaceDlg; +int xCustomSchemesDlg; +int yCustomSchemesDlg; + + +LPWSTR lpFileList[32] = { NULL }; +int cFileList = 0; +int cchiFileList = 0; +LPWSTR lpFileArg = NULL; +LPWSTR lpSchemeArg = NULL; +LPWSTR lpMatchArg = NULL; +LPWSTR lpEncodingArg = NULL; +LPMRULIST g_pFileMRU; +LPMRULIST g_pMRUfind; +LPMRULIST g_pMRUreplace; + +DWORD dwLastIOError; + +int g_iDefaultNewFileEncoding; +int g_iDefaultCharSet; + +int g_iEOLMode; +int g_iDefaultEOLMode; + +int iInitialLine; +int iInitialColumn; + +int iInitialLexer; + +bool bLastCopyFromMe = false; +DWORD dwLastCopyTime; + +UINT uidsAppTitle = IDS_APPTITLE; +WCHAR szTitleExcerpt[MIDSZ_BUFFER] = { L'\0' }; +int fKeepTitleExcerpt = 0; + +HANDLE hChangeHandle = NULL; +bool bRunningWatch = false; +bool dwChangeNotifyTime = 0; +WIN32_FIND_DATA fdCurFile; + +UINT msgTaskbarCreated = 0; + +HMODULE hModUxTheme = NULL; +HMODULE hRichEdit = NULL; + + +static EDITFINDREPLACE g_efrData = EFR_INIT_DATA; +bool bReplaceInitialized = false; + +int iLineEndings[3] = { + SC_EOL_CRLF, + SC_EOL_LF, + SC_EOL_CR +}; + +WCHAR wchPrefixSelection[256] = { L'\0' }; +WCHAR wchAppendSelection[256] = { L'\0' }; + +WCHAR wchPrefixLines[256] = { L'\0' }; +WCHAR wchAppendLines[256] = { L'\0' }; + +int iSortOptions = 0; +int iAlignMode = 0; + +bool flagIsElevated = false; +WCHAR wchWndClass[16] = WC_NOTEPAD3; + + +HINSTANCE g_hInstance = NULL; +HANDLE g_hScintilla = NULL; +HANDLE g_hwndEdit = NULL; + +WCHAR g_wchAppUserModelID[32] = { L'\0' }; +WCHAR g_wchWorkingDirectory[MAX_PATH+2] = { L'\0' }; +WCHAR g_wchCurFile[FILE_ARG_BUF] = { L'\0' }; +FILEVARS fvCurFile; +bool bReadOnly = false; + + +// temporary line buffer for fast line ops +static char g_pTempLineBufferMain[TEMPLINE_BUFFER]; + + +// undo / redo selections +static UT_icd UndoRedoSelection_icd = { sizeof(UndoRedoSelection_t), NULL, NULL, NULL }; +static UT_array* UndoRedoSelectionUTArray = NULL; + +static CLIPFORMAT cfDrpF = CF_HDROP; +static POINTL ptDummy = { 0, 0 }; +static PDROPTARGET pDropTarget = NULL; +static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyState, POINTL pt, void *pUserData); + +// Timer bitfield +//static volatile LONG g_lInterlockBits = 0; +//#define BIT_TIMER_MARK_OCC 1L +//#define BIT_MARK_OCC_IN_PROGRESS 2L +//#define BIT_TIMER_UPDATE_HYPER 4L +//#define BIT_UPDATE_HYPER_IN_PROGRESS 8L + +//#define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lInterlockBits, B) +//#define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lInterlockBits, B) + + +//============================================================================= +// +// IgnoreNotifyChangeEvent(), ObserveNotifyChangeEvent(), CheckNotifyChangeEvent() +// +static volatile LONG iNotifyChangeStackCounter = 0; + +void IgnoreNotifyChangeEvent() { + InterlockedIncrement(&iNotifyChangeStackCounter); +} + +void ObserveNotifyChangeEvent() { + if (iNotifyChangeStackCounter > 0L) { + InterlockedDecrement(&iNotifyChangeStackCounter); + if (iNotifyChangeStackCounter == 0L) { + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + } + } +} + +bool CheckNotifyChangeEvent() { + return (iNotifyChangeStackCounter == 0L); +} + +// SCN_UPDATEUI notification +#define SC_UPDATE_NP3_INTERNAL_NOTIFY (SC_UPDATE_H_SCROLL << 1) + + +//============================================================================= +// +// Delay Message Queue Handling (TODO: MultiThreading) +// + +static CmdMessageQueue_t* MessageQueue = NULL; + +// ---------------------------------------------------------------------------- + +static int msgcmp(void* mqc1, void* mqc2) +{ + const CmdMessageQueue_t* pMQC1 = (CmdMessageQueue_t*)mqc1; + const CmdMessageQueue_t* pMQC2 = (CmdMessageQueue_t*)mqc2; + + if ((pMQC1->hwnd == pMQC2->hwnd) + && (pMQC1->cmd == pMQC2->cmd) + && (pMQC1->wparam == pMQC2->wparam) + && (pMQC1->lparam == pMQC2->lparam)) + { + return 0; + } + return 1; +} +// ---------------------------------------------------------------------------- + +static void __fastcall _MQ_AppendCmd(CmdMessageQueue_t* pMsgQCmd, int delay) +{ + CmdMessageQueue_t* pmqc = NULL; + DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp); + + if (!pmqc) { // NOT found + pmqc = AllocMem(sizeof(CmdMessageQueue_t), HEAP_ZERO_MEMORY); + pmqc->hwnd = pMsgQCmd->hwnd; + pmqc->cmd = pMsgQCmd->cmd; + pmqc->wparam = pMsgQCmd->wparam; + pmqc->lparam = pMsgQCmd->lparam; + pmqc->delay = 0; + DL_APPEND(MessageQueue, pmqc); + } + + if (delay < 2) { + pmqc->delay = 0; // execute next + PostMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam); + } + else { + pmqc->delay = (pmqc->delay + delay) / 2; // increase delay + } +} + +// ---------------------------------------------------------------------------- +// +// called by Timer(IDT_TIMER_MRKALL) +// +static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + UNUSED(hwnd); // must be main wnd + UNUSED(uMsg); // must be WM_TIMER + UNUSED(idEvent); // must be IDT_TIMER_MRKALL + UNUSED(dwTime); // This is the value returned by the GetTickCount function + + CmdMessageQueue_t* pmqc; + + DL_FOREACH(MessageQueue, pmqc) + { + if (pmqc->delay == 0) { + SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam); + } + if (pmqc->delay >= 0) { + pmqc->delay -= 1; + } + } +} + + +//============================================================================= +// +// Flags +// +int flagNoReuseWindow = 0; +int flagReuseWindow = 0; +int flagMultiFileArg = 0; +int flagSingleFileInstance = 0; +int flagStartAsTrayIcon = 0; +int flagAlwaysOnTop = 0; +int flagRelativeFileMRU = 0; +int flagPortableMyDocs = 0; +int flagNoFadeHidden = 0; +int flagToolbarLook = 0; +int flagSimpleIndentGuides = 0; +int flagNoHTMLGuess = 0; +int flagNoCGIGuess = 0; +int flagNoFileVariables = 0; +int flagPosParam = 0; +int flagDefaultPos = 0; +int flagNewFromClipboard = 0; +int flagPasteBoard = 0; +int flagSetEncoding = 0; +int flagSetEOLMode = 0; +int flagJumpTo = 0; +int flagMatchText = 0; +int flagChangeNotify = 0; +int flagLexerSpecified = 0; +int flagQuietCreate = 0; +int flagUseSystemMRU = 0; +int flagRelaunchElevated = 0; +int flagDisplayHelp = 0; +int flagPrintFileAndLeave = 0; +int flagBufferFile = 0; + + +//============================================================================== +// +// Document Modified Flag +// +// +static bool IsDocumentModified = false; + +static void __fastcall _SetDocumentModified(bool bModified) +{ + if (IsDocumentModified != bModified) { + IsDocumentModified = bModified; + UpdateToolbar(); + } + if (bModified) { + if (IsWindow(g_hwndDlgFindReplace)) { + SendMessage(g_hwndDlgFindReplace, WM_COMMAND, MAKELONG(IDC_DOC_MODIFIED, 1), 0); + } + } +} + + +//============================================================================= +// +// WinMain() +// +// +int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nCmdShow) +{ + + MSG msg; + HWND hwnd; + HACCEL hAccMain; + HACCEL hAccFindReplace; + HACCEL hAccCoustomizeSchemes; + INITCOMMONCONTROLSEX icex; + //HMODULE hSciLexer; + WCHAR wchAppDir[2*MAX_PATH+4] = { L'\0' }; + + // Set global variable g_hInstance + g_hInstance = hInstance; + + GetModuleFileName(NULL,wchAppDir,COUNTOF(wchAppDir)); + PathRemoveFileSpec(wchAppDir); + PathCanonicalizeEx(wchAppDir,COUNTOF(wchAppDir)); + + if (!GetCurrentDirectory(COUNTOF(g_wchWorkingDirectory),g_wchWorkingDirectory)) { + StringCchCopy(g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory),wchAppDir); + } + + // Don't keep working directory locked + SetCurrentDirectory(wchAppDir); + + SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); + + // check if running at least on Windows XP + if (!IsXP()) { + LPVOID lpMsgBuf; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER| + FORMAT_MESSAGE_FROM_SYSTEM| + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ERROR_OLD_WIN_VERSION, + MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), // Default language + (LPWSTR)&lpMsgBuf, + 0, + NULL); + MessageBox(NULL,(LPCWSTR)lpMsgBuf,L"Notepad3",MB_OK|MB_ICONEXCLAMATION); + LocalFree(lpMsgBuf); + return(0); + } + + // Check if running with elevated privileges + flagIsElevated = IsUserAdmin() || IsElevated(); + + // Default Encodings (may already be used for command line parsing) + Encoding_InitDefaults(); + + // Command Line, Ini File and Flags + ParseCommandLine(); + FindIniFile(); + TestIniFile(); + CreateIniFile(); + LoadFlags(); + + // set AppUserModelID + PrivateSetCurrentProcessExplicitAppUserModelID(g_wchAppUserModelID); + + // Command Line Help Dialog + if (flagDisplayHelp) { + DisplayCmdLineHelp(NULL); + return(0); + } + + // Adapt window class name + if (flagIsElevated) + StringCchCat(wchWndClass,COUNTOF(wchWndClass),L"U"); + if (flagPasteBoard) + StringCchCat(wchWndClass,COUNTOF(wchWndClass),L"B"); + + // Relaunch with elevated privileges + if (RelaunchElevated(NULL)) + return(0); + + // Try to run multiple instances + if (RelaunchMultiInst()) + return(0); + + // Try to activate another window + if (ActivatePrevInst()) + return(0); + + // Init OLE and Common Controls + OleInitialize(NULL); + + icex.dwSize = sizeof(INITCOMMONCONTROLSEX); + icex.dwICC = ICC_WIN95_CLASSES|ICC_COOL_CLASSES|ICC_BAR_CLASSES|ICC_USEREX_CLASSES; + InitCommonControlsEx(&icex); + + msgTaskbarCreated = RegisterWindowMessage(L"TaskbarCreated"); + + if (!IsWin8()) { + hModUxTheme = LoadLibrary(L"uxtheme.dll"); + } + hRichEdit = LoadLibrary(L"RICHED20.DLL"); // Use "RichEdit20W" for control in .rc + //hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in .rc + + Scintilla_RegisterClasses(hInstance); + + // Load Settings + LoadSettings(); + + if (!InitApplication(hInstance)) + return false; + + hwnd = InitInstance(hInstance, lpCmdLine, nCmdShow); + if (!hwnd) + return false; + + // init DragnDrop handler + DragAndDropInit(NULL); + + if (IsVista()) { + // Current platforms perform window buffering so it is almost always better for this option to be turned off. + // There are some older platforms and unusual modes where buffering may still be useful - so keep it ON + //~SciCall_SetBufferedDraw(true); // default is true + + if (iSciDirectWriteTech >= 0) { + SciCall_SetTechnology(DirectWriteTechnology[iSciDirectWriteTech]); + } + } + + hAccMain = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_MAINWND)); + hAccFindReplace = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCFINDREPLACE)); + hAccCoustomizeSchemes = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCCUSTOMSCHEMES)); + + UpdateLineNumberWidth(); + ObserveNotifyChangeEvent(); + + SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext); + + while (GetMessage(&msg,NULL,0,0)) + { + if (IsWindow(g_hwndDlgFindReplace) && ((msg.hwnd == g_hwndDlgFindReplace) || IsChild(g_hwndDlgFindReplace, msg.hwnd))) + { + const int iTr = TranslateAccelerator(g_hwndDlgFindReplace, hAccFindReplace, &msg); + if (iTr || IsDialogMessage(g_hwndDlgFindReplace, &msg)) + continue; + } + if (IsWindow(g_hwndDlgCustomizeSchemes) && ((msg.hwnd == g_hwndDlgCustomizeSchemes) || IsChild(g_hwndDlgCustomizeSchemes, msg.hwnd))) { + const int iTr = TranslateAccelerator(g_hwndDlgCustomizeSchemes, hAccCoustomizeSchemes, &msg); + if (iTr || IsDialogMessage(g_hwndDlgCustomizeSchemes, &msg)) + continue; + } + if (!TranslateAccelerator(hwnd,hAccMain,&msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + //MQ_ExecuteNext(); // delayed messages + } + + CmdMessageQueue_t* pmqc = NULL; + CmdMessageQueue_t* dummy; + DL_FOREACH_SAFE(MessageQueue, pmqc, dummy) + { + DL_DELETE(MessageQueue, pmqc); + FreeMem(pmqc); + } + KillTimer(hwnd, IDT_TIMER_MRKALL); + + // Save Settings is done elsewhere + + Scintilla_ReleaseResources(); + UnregisterClass(wchWndClass,hInstance); + + if (hModUxTheme) + FreeLibrary(hModUxTheme); + + OleUninitialize(); + + UNUSED(hPrevInst); + + return(int)(msg.wParam); +} + + +//============================================================================= +// +// InitApplication() +// +// +bool InitApplication(HINSTANCE hInstance) +{ + + WNDCLASS wc; + + wc.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS; + wc.lpfnWndProc = (WNDPROC)MainWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDR_MAINWND)); + wc.hCursor = LoadCursor(NULL,IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); + wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINWND); + wc.lpszClassName = wchWndClass; + + return RegisterClass(&wc); + +} + + +//============================================================================= +// +// InitInstance() +// +// +static void __fastcall _InitWindowPosition(HWND hwnd) +{ + RECT rc; + if (hwnd) { + GetWindowRect(hwnd, &rc); + } + else { + rc.left = g_WinInfo.x; + rc.top = g_WinInfo.y; + rc.right = g_WinInfo.x + g_WinInfo.cx; + rc.bottom = g_WinInfo.y + g_WinInfo.cy; + } + + if (flagDefaultPos == 1) + { + g_WinInfo.x = g_WinInfo.y = g_WinInfo.cx = g_WinInfo.cy = CW_USEDEFAULT; + g_WinInfo.max = 0; + } + else if (flagDefaultPos >= 4) + { + SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); + if (flagDefaultPos & 8) + g_WinInfo.x = (rc.right - rc.left) / 2; + else + g_WinInfo.x = rc.left; + g_WinInfo.cx = rc.right - rc.left; + if (flagDefaultPos & (4 | 8)) + g_WinInfo.cx /= 2; + if (flagDefaultPos & 32) + g_WinInfo.y = (rc.bottom - rc.top) / 2; + else + g_WinInfo.y = rc.top; + g_WinInfo.cy = rc.bottom - rc.top; + if (flagDefaultPos & (16 | 32)) + g_WinInfo.cy /= 2; + if (flagDefaultPos & 64) { + g_WinInfo.x = rc.left; + g_WinInfo.y = rc.top; + g_WinInfo.cx = rc.right - rc.left; + g_WinInfo.cy = rc.bottom - rc.top; + } + if (flagDefaultPos & 128) { + g_WinInfo.x += (flagDefaultPos & 8) ? 4 : 8; + g_WinInfo.cx -= (flagDefaultPos & (4 | 8)) ? 12 : 16; + g_WinInfo.y += (flagDefaultPos & 32) ? 4 : 8; + g_WinInfo.cy -= (flagDefaultPos & (16 | 32)) ? 12 : 16; + g_WinInfo.max = 1; + } + } + else if (flagDefaultPos == 2 || flagDefaultPos == 3) // NP3 default window position + { + SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); + g_WinInfo.y = rc.top + 16; + g_WinInfo.cy = rc.bottom - rc.top - 32; + g_WinInfo.cx = (rc.right - rc.left)/2; //min(rc.right - rc.left - 32, g_WinInfo.cy); + g_WinInfo.x = (flagDefaultPos == 3) ? rc.left + 16 : rc.right - g_WinInfo.cx - 16; + } + else { // fit window into working area of current monitor + + MONITORINFO mi; + mi.cbSize = sizeof(mi); + HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST); + GetMonitorInfo(hMonitor, &mi); + + g_WinInfo.x += (mi.rcWork.left - mi.rcMonitor.left); + g_WinInfo.y += (mi.rcWork.top - mi.rcMonitor.top); + if (g_WinInfo.x < mi.rcWork.left) + g_WinInfo.x = mi.rcWork.left; + if (g_WinInfo.y < mi.rcWork.top) + g_WinInfo.y = mi.rcWork.top; + if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right) { + g_WinInfo.x -= (g_WinInfo.x + g_WinInfo.cx - mi.rcWork.right); + if (g_WinInfo.x < mi.rcWork.left) + g_WinInfo.x = mi.rcWork.left; + if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right) + g_WinInfo.cx = mi.rcWork.right - g_WinInfo.x; + } + if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom) { + g_WinInfo.y -= (g_WinInfo.y + g_WinInfo.cy - mi.rcWork.bottom); + if (g_WinInfo.y < mi.rcWork.top) + g_WinInfo.y = mi.rcWork.top; + if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom) + g_WinInfo.cy = mi.rcWork.bottom - g_WinInfo.y; + } + SetRect(&rc, g_WinInfo.x, g_WinInfo.y, g_WinInfo.x + g_WinInfo.cx, g_WinInfo.y + g_WinInfo.cy); + + RECT rc2; + if (!IntersectRect(&rc2, &rc, &mi.rcWork)) { + g_WinInfo.y = mi.rcWork.top + 16; + g_WinInfo.cy = mi.rcWork.bottom - mi.rcWork.top - 32; + g_WinInfo.cx = min(mi.rcWork.right - mi.rcWork.left - 32, g_WinInfo.cy); + g_WinInfo.x = mi.rcWork.right - g_WinInfo.cx - 16; + } + } +} + + + +//============================================================================= +// +// InitInstance() +// +// +HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow) +{ + g_hwndMain = NULL; + + _InitWindowPosition(g_hwndMain); + + g_hwndMain = CreateWindowEx( + 0, + wchWndClass, + L"Notepad3", + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, + g_WinInfo.x, + g_WinInfo.y, + g_WinInfo.cx, + g_WinInfo.cy, + NULL, + NULL, + hInstance, + NULL); + + if (g_WinInfo.max) + nCmdShow = SW_SHOWMAXIMIZED; + + if ((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1) + SetWindowPos(g_hwndMain,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + + if (bTransparentMode) + SetWindowTransparentMode(g_hwndMain,true); + + // Current file information -- moved in front of ShowWindow() + FileLoad(true,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); + + if (!flagStartAsTrayIcon) { + ShowWindow(g_hwndMain,nCmdShow); + UpdateWindow(g_hwndMain); + } + else { + ShowWindow(g_hwndMain,SW_HIDE); // trick ShowWindow() + ShowNotifyIcon(g_hwndMain,true); + } + + // Source Encoding + if (lpEncodingArg) + Encoding_SrcCmdLn(Encoding_MatchW(lpEncodingArg)); + + // Pathname parameter + if (flagBufferFile || (lpFileArg /*&& !flagNewFromClipboard*/)) + { + bool bOpened = false; + + // Open from Directory + if (!flagBufferFile && PathIsDirectory(lpFileArg)) { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), lpFileArg)) + bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); + } + else { + LPCWSTR lpFileToOpen = flagBufferFile ? szBufferFile : lpFileArg; + bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, lpFileToOpen); + if (bOpened) { + if (flagBufferFile) { + if (lpFileArg) { + InstallFileWatching(NULL); // Terminate file watching + StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),lpFileArg); + InstallFileWatching(g_wchCurFile); + } + else + StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),L""); + + if (!flagLexerSpecified) + Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); + + _SetDocumentModified(true); + UpdateLineNumberWidth(); + + // check for temp file and delete + if (flagIsElevated && PathFileExists(szBufferFile)) { + DeleteFile(szBufferFile); + } + } + if (flagJumpTo) { // Jump to position + EditJumpTo(g_hwndEdit,iInitialLine,iInitialColumn); + } + } + } + if (lpFileArg) { + FreeMem(lpFileArg); + lpFileArg = NULL; + } + if (bOpened) { + if (flagChangeNotify == 1) { + iFileWatchingMode = 0; + bResetFileWatching = true; + InstallFileWatching(g_wchCurFile); + } + else if (flagChangeNotify == 2) { + iFileWatchingMode = 2; + bResetFileWatching = true; + InstallFileWatching(g_wchCurFile); + } + } + } + else { + if (Encoding_SrcCmdLn(CPI_GET) != CPI_NONE) { + Encoding_Current(Encoding_SrcCmdLn(CPI_GET)); + Encoding_HasChanged(Encoding_SrcCmdLn(CPI_GET)); + } + } + + // reset + Encoding_SrcCmdLn(CPI_NONE); + flagQuietCreate = 0; + fKeepTitleExcerpt = 0; + + // undo / redo selections + if (UndoRedoSelectionUTArray != NULL) { + utarray_clear(UndoRedoSelectionUTArray); + utarray_free(UndoRedoSelectionUTArray); + UndoRedoSelectionUTArray = NULL; + } + utarray_new(UndoRedoSelectionUTArray, &UndoRedoSelection_icd); + utarray_reserve(UndoRedoSelectionUTArray,256); + + // Check for /c [if no file is specified] -- even if a file is specified + /*else */if (flagNewFromClipboard) { + if (SendMessage(g_hwndEdit, SCI_CANPASTE, 0, 0)) { + bool bAutoIndent2 = bAutoIndent; + bAutoIndent = 0; + EditJumpTo(g_hwndEdit, -1, 0); + SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); + if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) { + SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); + } + SendMessage(g_hwndEdit, SCI_PASTE, 0, 0); + SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); + SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); + bAutoIndent = bAutoIndent2; + if (flagJumpTo) + EditJumpTo(g_hwndEdit, iInitialLine, iInitialColumn); + else + EditEnsureSelectionVisible(g_hwndEdit); + } + } + + // Encoding + if (0 != flagSetEncoding) { + SendMessage( + g_hwndMain, + WM_COMMAND, + MAKELONG(IDM_ENCODING_ANSI + flagSetEncoding -1,1), + 0); + flagSetEncoding = 0; + } + + // EOL mode + if (0 != flagSetEOLMode) { + SendMessage( + g_hwndMain, + WM_COMMAND, + MAKELONG(IDM_LINEENDINGS_CRLF + flagSetEOLMode -1,1), + 0); + flagSetEOLMode = 0; + } + + // Match Text + if (flagMatchText && lpMatchArg) { + if (lstrlen(lpMatchArg) && SendMessage(g_hwndEdit,SCI_GETLENGTH,0,0)) { + + WideCharToMultiByteStrg(Encoding_SciCP,lpMatchArg,g_efrData.szFind); + + if (flagMatchText & 4) + g_efrData.fuFlags |= (SCFIND_REGEXP | SCFIND_POSIX); + else if (flagMatchText & 8) + g_efrData.bTransformBS = true; + + if (flagMatchText & 2) { + if (!flagJumpTo) { SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); } + EditFindPrev(g_hwndEdit,&g_efrData,false,false); + EditEnsureSelectionVisible(g_hwndEdit); + } + else { + if (!flagJumpTo) { SendMessage(g_hwndEdit, SCI_DOCUMENTSTART, 0, 0); } + EditFindNext(g_hwndEdit,&g_efrData,false,false); + EditEnsureSelectionVisible(g_hwndEdit); + } + } + LocalFree(lpMatchArg); + lpMatchArg = NULL; + } + + // Check for Paste Board option -- after loading files + if (flagPasteBoard) { + bLastCopyFromMe = true; + hwndNextCBChain = SetClipboardViewer(g_hwndMain); + uidsAppTitle = IDS_APPTITLE_PASTEBOARD; + bLastCopyFromMe = false; + + dwLastCopyTime = 0; + SetTimer(g_hwndMain,ID_PASTEBOARDTIMER,100,PasteBoardTimer); + } + + // check if a lexer was specified from the command line + if (flagLexerSpecified) { + if (lpSchemeArg) { + Style_SetLexerFromName(g_hwndEdit,g_wchCurFile,lpSchemeArg); + LocalFree(lpSchemeArg); + } + else if (iInitialLexer >=0 && iInitialLexer < NUMLEXERS) + Style_SetLexerFromID(g_hwndEdit,iInitialLexer); + flagLexerSpecified = 0; + } + + // If start as tray icon, set current filename as tooltip + if (flagStartAsTrayIcon) + SetNotifyIconTitle(g_hwndMain); + + iReplacedOccurrences = 0; + g_iMarkOccurrencesCount = (g_iMarkOccurrences > 0) ? 0 : -1; + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + + // print file immediately and quit + if (flagPrintFileAndLeave) + { + SHFILEINFO shfi; + WCHAR *pszTitle; + WCHAR tchUntitled[32] = { L'\0' }; + WCHAR tchPageFmt[32] = { L'\0' }; + + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + SHGetFileInfo2(g_wchCurFile, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(SHFILEINFO), SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + pszTitle = shfi.szDisplayName; + } + else { + GetString(IDS_UNTITLED, tchUntitled, COUNTOF(tchUntitled)); + pszTitle = tchUntitled; + } + + GetString(IDS_PRINT_PAGENUM, tchPageFmt, COUNTOF(tchPageFmt)); + + if (!EditPrint(g_hwndEdit, pszTitle, tchPageFmt)) + MsgBox(MBWARN, IDS_PRINT_ERROR, pszTitle); + + PostMessage(g_hwndMain, WM_CLOSE, 0, 0); + } + + UNUSED(pszCmdLine); + + return(g_hwndMain); +} + + +//============================================================================= +// +// MainWndProc() +// +// Messages are distributed to the MsgXXX-handlers +// +// +LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + static bool bAltKeyIsDown = false; + + switch(umsg) + { + // Quickly handle painting and sizing messages, found in ScintillaWin.cxx + // Cool idea, don't know if this has any effect... ;-) + case WM_MOVE: + case WM_MOUSEACTIVATE: + case WM_NCHITTEST: + case WM_NCCALCSIZE: + case WM_NCPAINT: + case WM_PAINT: + case WM_ERASEBKGND: + case WM_NCMOUSEMOVE: + case WM_NCLBUTTONDOWN: + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + return DefWindowProc(hwnd,umsg,wParam,lParam); + + case WM_SYSKEYDOWN: + if (GetAsyncKeyState(VK_MENU) & SHRT_MIN) // ALT-KEY DOWN + { + if (!bAltKeyIsDown) { + bAltKeyIsDown = true; + if (!bDenyVirtualSpaceAccess) { + SciCall_SetVirtualSpaceOptions(SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE); + } + } + } + return DefWindowProc(hwnd, umsg, wParam, lParam); + + case WM_SYSKEYUP: + if (!(GetAsyncKeyState(VK_MENU) & SHRT_MIN)) // NOT ALT-KEY DOWN + { + if (bAltKeyIsDown) { + bAltKeyIsDown = false; + SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION); + } + } + return DefWindowProc(hwnd, umsg, wParam, lParam); + + + case WM_CREATE: + return MsgCreate(hwnd,wParam,lParam); + + case WM_DESTROY: + case WM_ENDSESSION: + MsgEndSession(hwnd,umsg); + break; + + case WM_CLOSE: + if (FileSave(false,true,false,false)) + DestroyWindow(hwnd); + break; + + case WM_QUERYENDSESSION: + if (FileSave(false,true,false,false)) + return true; + else + return false; + + // Reinitialize theme-dependent values and resize windows + case WM_THEMECHANGED: + MsgThemeChanged(hwnd,wParam,lParam); + break; + + // update Scintilla colors + case WM_SYSCOLORCHANGE: + UpdateLineNumberWidth(); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(0); + UpdateVisibleUrlHotspot(0); + return DefWindowProc(hwnd,umsg,wParam,lParam); + + case WM_SIZE: + MsgSize(hwnd,wParam,lParam); + break; + + case WM_SETFOCUS: + SetFocus(g_hwndEdit); + //UpdateToolbar(); + //UpdateStatusbar(); + //UpdateLineNumberWidth(); + //if (bPendingChangeNotify) + // PostMessage(hwnd,WM_CHANGENOTIFY,0,0); + break; + + case WM_DROPFILES: + MsgDropFiles(hwnd, wParam, lParam); + break; + + case WM_COPYDATA: + return MsgCopyData(hwnd, wParam, lParam); + + case WM_CONTEXTMENU: + return MsgContextMenu(hwnd, umsg, wParam, lParam); + + case WM_INITMENU: + MsgInitMenu(hwnd,wParam,lParam); + break; + + case WM_NOTIFY: + return MsgNotify(hwnd,wParam,lParam); + + //case WM_PARENTNOTIFY: + // if (LOWORD(wParam) & WM_DESTROY) { + // if (IsWindow(hDlgFindReplace) && (hDlgFindReplace == (HWND)lParam)) { + // hDlgFindReplace = NULL; + // } + // } + // break; + + case WM_COMMAND: + return MsgCommand(hwnd,wParam,lParam); + + case WM_SYSCOMMAND: + return MsgSysCommand(hwnd, umsg, wParam, lParam); + + case WM_CHANGENOTIFY: + MsgChangeNotify(hwnd, wParam, lParam); + break; + + //// This message is posted before Notepad3 reactivates itself + //case WM_CHANGENOTIFYCLEAR: + // bPendingChangeNotify = false; + // break; + + case WM_DRAWCLIPBOARD: + if (!bLastCopyFromMe) + dwLastCopyTime = GetTickCount(); + else + bLastCopyFromMe = false; + + if (hwndNextCBChain) + SendMessage(hwndNextCBChain,WM_DRAWCLIPBOARD,wParam,lParam); + break; + + case WM_CHANGECBCHAIN: + if ((HWND)wParam == hwndNextCBChain) + hwndNextCBChain = (HWND)lParam; + if (hwndNextCBChain) + SendMessage(hwndNextCBChain,WM_CHANGECBCHAIN,lParam,wParam); + break; + + case WM_TRAYMESSAGE: + return MsgTrayMessage(hwnd, wParam, lParam); + + default: + if (umsg == msgTaskbarCreated) { + if (!IsWindowVisible(hwnd)) + ShowNotifyIcon(hwnd,true); + SetNotifyIconTitle(hwnd); + } + return DefWindowProc(hwnd, umsg, wParam, lParam); + } + return 0; // swallow message +} + + + +//============================================================================= +// +// SetWordWrapping() - WordWrapSettings +// +static void __fastcall _SetWordWrapping(HWND hwndEditCtrl) +{ + // Word wrap + if (bWordWrap) + SendMessage(hwndEditCtrl, SCI_SETWRAPMODE, (iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR, 0); + else + SendMessage(hwndEditCtrl, SCI_SETWRAPMODE, SC_WRAP_NONE, 0); + + if (iWordWrapIndent == 5) + SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_SAME, 0); + else if (iWordWrapIndent == 6) + SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_INDENT, 0); + else { + int i = 0; + switch (iWordWrapIndent) { + case 1: i = 1; break; + case 2: i = 2; break; + case 3: i = (g_iIndentWidth) ? 1 * g_iIndentWidth : 1 * g_iTabWidth; break; + case 4: i = (g_iIndentWidth) ? 2 * g_iIndentWidth : 2 * g_iTabWidth; break; + } + SendMessage(hwndEditCtrl, SCI_SETWRAPSTARTINDENT, i, 0); + SendMessage(hwndEditCtrl, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_FIXED, 0); + } + + if (bShowWordWrapSymbols) { + int wrapVisualFlags = 0; + int wrapVisualFlagsLocation = 0; + if (iWordWrapSymbols == 0) + iWordWrapSymbols = 22; + switch (iWordWrapSymbols % 10) { + case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break; + case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break; + } + switch (((iWordWrapSymbols % 100) - (iWordWrapSymbols % 10)) / 10) { + case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break; + case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break; + } + SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0); + SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0); + } + else { + SendMessage(hwndEditCtrl, SCI_SETWRAPVISUALFLAGS, 0, 0); + } +} + + +//============================================================================= +// +// InitializeSciEditCtrl() +// +static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl) +{ + Encoding_Current(g_iDefaultNewFileEncoding); + + // general setup + SendMessage(hwndEditCtrl, SCI_SETCODEPAGE, (WPARAM)SC_CP_UTF8, 0); // fixed internal UTF-8 + SendMessage(hwndEditCtrl, SCI_SETEOLMODE, SC_EOL_CRLF, 0); + SendMessage(hwndEditCtrl, SCI_SETPASTECONVERTENDINGS, true, 0); + SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK,/*SC_MODEVENTMASKALL*/SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_CONTAINER, 0); + SendMessage(hwndEditCtrl, SCI_USEPOPUP, false, 0); + SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTH, 1, 0); + SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTHTRACKING, true, 0); + SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, true, 0); + SendMessage(hwndEditCtrl, SCI_SETMOUSESELECTIONRECTANGULARSWITCH, true, 0); + SendMessage(hwndEditCtrl, SCI_SETMULTIPLESELECTION, false, 0); + SendMessage(hwndEditCtrl, SCI_SETADDITIONALSELECTIONTYPING, false, 0); + SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSBLINK, true, 0); + SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0); + SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0); + SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0); + + // 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); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_NEXT + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARADOWNEXTEND); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_PRIOR + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARAUPEXTEND); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_HOME + (0 << 16)), SCI_VCHOMEWRAP); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_END + (0 << 16)), SCI_LINEENDWRAP); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_HOME + (SCMOD_SHIFT << 16)), SCI_VCHOMEWRAPEXTEND); + SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_END + (SCMOD_SHIFT << 16)), SCI_LINEENDWRAPEXTEND); + + // set indicator styles (foreground and alpha maybe overridden by style settings) + SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_MARK_OCCURANCE, INDIC_ROUNDBOX); + SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_MARK_OCCURANCE, RGB(0x00, 0x00, 0xFF)); + SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_MARK_OCCURANCE, 100); + SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MARK_OCCURANCE, 100); + + SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_MATCH_BRACE, INDIC_FULLBOX); + SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_MATCH_BRACE, RGB(0x00, 0xFF, 0x00)); + SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_MATCH_BRACE, 120); + SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MATCH_BRACE, 120); + + SendMessage(hwndEditCtrl, SCI_INDICSETSTYLE, INDIC_NP3_BAD_BRACE, INDIC_FULLBOX); + SendMessage(hwndEditCtrl, SCI_INDICSETFORE, INDIC_NP3_BAD_BRACE, RGB(0xFF, 0x00, 0x00)); + SendMessage(hwndEditCtrl, SCI_INDICSETALPHA, INDIC_NP3_BAD_BRACE, 120); + SendMessage(hwndEditCtrl, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_BAD_BRACE, 120); + + // paste into rectangular selection + SendMessage(hwndEditCtrl, SCI_SETMULTIPASTE, SC_MULTIPASTE_EACH, 0); + + // No SC_AUTOMATICFOLD_CLICK, performed by + SendMessage(hwndEditCtrl, SCI_SETAUTOMATICFOLD, (WPARAM)(SC_AUTOMATICFOLD_SHOW | SC_AUTOMATICFOLD_CHANGE), 0); + + // Properties + SendMessage(hwndEditCtrl, SCI_SETCARETSTICKY, SC_CARETSTICKY_OFF, 0); + //SendMessage(hwndEditCtrl,SCI_SETCARETSTICKY,SC_CARETSTICKY_WHITESPACE,0); + + #define _CARET_SYMETRY CARET_EVEN /// CARET_EVEN or 0 + if (iCurrentLineHorizontalSlop > 0) + SendMessage(hwndEditCtrl, SCI_SETXCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), iCurrentLineHorizontalSlop); + else + SendMessage(hwndEditCtrl, SCI_SETXCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), (LPARAM)0); + + if (iCurrentLineVerticalSlop > 0) + SendMessage(hwndEditCtrl, SCI_SETYCARETPOLICY, (WPARAM)(CARET_SLOP | _CARET_SYMETRY | CARET_STRICT), iCurrentLineVerticalSlop); + else + SendMessage(hwndEditCtrl, SCI_SETYCARETPOLICY, (WPARAM)(_CARET_SYMETRY), 0); + + SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION), 0); + SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, (WPARAM)((bScrollPastEOF) ? 0 : 1), 0); + + // Tabs + SendMessage(hwndEditCtrl, SCI_SETUSETABS, !g_bTabsAsSpaces, 0); + SendMessage(hwndEditCtrl, SCI_SETTABINDENTS, g_bTabIndents, 0); + SendMessage(hwndEditCtrl, SCI_SETBACKSPACEUNINDENTS, bBackspaceUnindents, 0); + SendMessage(hwndEditCtrl, SCI_SETTABWIDTH, g_iTabWidth, 0); + SendMessage(hwndEditCtrl, SCI_SETINDENT, g_iIndentWidth, 0); + + // Indent Guides + Style_SetIndentGuides(hwndEditCtrl, bShowIndentGuides); + + // Word Wrap + _SetWordWrapping(hwndEditCtrl); + + // Long Lines + if (bMarkLongLines) + SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, (iLongLineMode == EDGE_LINE) ? EDGE_LINE : EDGE_BACKGROUND, 0); + else + SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, EDGE_NONE, 0); + + SendMessage(hwndEditCtrl, SCI_SETEDGECOLUMN, iLongLinesLimit, 0); + + // Nonprinting characters + SendMessage(hwndEditCtrl, SCI_SETVIEWWS, (bViewWhiteSpace) ? SCWS_VISIBLEALWAYS : SCWS_INVISIBLE, 0); + SendMessage(hwndEditCtrl, SCI_SETVIEWEOL, bViewEOLs, 0); + + // word delimiter handling + EditInitWordDelimiter(hwndEditCtrl); + EditSetAccelWordNav(hwndEditCtrl, bAccelWordNavigation); + + // Init default values for printing + EditPrintInit(); + + //SciInitThemes(hwndEditCtrl); + + UpdateLineNumberWidth(); +} + + +//============================================================================= +// +// MsgCreate() - Handles WM_CREATE +// +// +LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam) +{ + + HINSTANCE hInstance = ((LPCREATESTRUCT)lParam)->hInstance; + + // Setup edit control + g_hwndEdit = CreateWindowEx( + WS_EX_CLIENTEDGE, + L"Scintilla", + NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, + 0, 0, 0, 0, + hwnd, + (HMENU)IDC_EDIT, + hInstance, + NULL); + + g_hScintilla = (HANDLE)SendMessage(g_hwndEdit, SCI_GETDIRECTPOINTER, 0, 0); + + _InitializeSciEditCtrl(g_hwndEdit); + + hwndEditFrame = CreateWindowEx( + WS_EX_CLIENTEDGE, + WC_LISTVIEW, + NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, + 0,0,100,100, + hwnd, + (HMENU)IDC_EDITFRAME, + hInstance, + NULL); + + if (PrivateIsAppThemed()) { + + RECT rc, rc2; + + bIsAppThemed = true; + + SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE) & ~WS_EX_CLIENTEDGE); + SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); + + if (IsVista()) { + cxEditFrame = 0; + cyEditFrame = 0; + } + + else { + GetClientRect(hwndEditFrame,&rc); + GetWindowRect(hwndEditFrame,&rc2); + + cxEditFrame = ((rc2.right-rc2.left) - (rc.right-rc.left)) / 2; + cyEditFrame = ((rc2.bottom-rc2.top) - (rc.bottom-rc.top)) / 2; + } + } + else { + bIsAppThemed = false; + + cxEditFrame = 0; + cyEditFrame = 0; + } + + // Create Toolbar and Statusbar + CreateBars(hwnd,hInstance); + + // Window Initialization + + CreateWindow( + WC_STATIC, + NULL, + WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, + 0,0,10,10, + hwnd, + (HMENU)IDC_FILENAME, + hInstance, + NULL); + + SetDlgItemText(hwnd,IDC_FILENAME,g_wchCurFile); + + CreateWindow( + WC_STATIC, + NULL, + WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, + 10,10,10,10, + hwnd, + (HMENU)IDC_REUSELOCK, + hInstance, + NULL); + + SetDlgItemInt(hwnd,IDC_REUSELOCK,GetTickCount(),false); + + // Menu + //SetMenuDefaultItem(GetSubMenu(GetMenu(hwnd),0),0); + + // Drag & Drop + DragAcceptFiles(hwnd,true); + pDropTarget = RegisterDragAndDrop(hwnd, &cfDrpF, 1, WM_NULL, DropFilesProc, (void*)g_hwndEdit); + + // File MRU + g_pFileMRU = MRU_Create(L"Recent Files", MRU_NOCASE, MRU_ITEMSFILE); + MRU_Load(g_pFileMRU); + + g_pMRUfind = MRU_Create(L"Recent Find", (/*IsWindowsNT()*/true) ? MRU_UTF8 : 0, MRU_ITEMSFNDRPL); + MRU_Load(g_pMRUfind); + SetFindPattern(g_pMRUfind->pszItems[0]); + + g_pMRUreplace = MRU_Create(L"Recent Replace", (/*IsWindowsNT()*/true) ? MRU_UTF8 : 0, MRU_ITEMSFNDRPL); + MRU_Load(g_pMRUreplace); + + if (g_hwndEdit == NULL || hwndEditFrame == NULL || + g_hwndStatus == NULL || g_hwndToolbar == NULL || hwndReBar == NULL) + return(-1); + + UNUSED(wParam); + return(0); +} + + +//============================================================================= +// +// CreateBars() - Create Toolbar and Statusbar +// +// +void CreateBars(HWND hwnd,HINSTANCE hInstance) +{ + RECT rc; + + REBARINFO rbi; + REBARBANDINFO rbBand; + + BITMAP bmp; + HBITMAP hbmp, hbmpCopy = NULL; + HIMAGELIST himl; + WCHAR szTmp[MAX_PATH] = { L'\0' }; + bool bExternalBitmap = false; + + DWORD dwToolbarStyle = WS_TOOLBAR; + DWORD dwReBarStyle = WS_REBAR; + + bool bIsPrivAppThemed = PrivateIsAppThemed(); + + int i,n; + WCHAR tchDesc[256] = { L'\0' }; + WCHAR tchIndex[256] = { L'\0' }; + + WCHAR *pIniSection = NULL; + int cchIniSection = 0; + + if (bShowToolbar) + dwReBarStyle |= WS_VISIBLE; + + g_hwndToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,NULL,dwToolbarStyle, + 0,0,0,0,hwnd,(HMENU)IDC_TOOLBAR,hInstance,NULL); + + SendMessage(g_hwndToolbar,TB_BUTTONSTRUCTSIZE,(WPARAM)sizeof(TBBUTTON),0); + + // Add normal Toolbar Bitmap + hbmp = NULL; + if (StringCchLenW(tchToolbarBitmap,COUNTOF(tchToolbarBitmap))) + { + if (!SearchPath(NULL,tchToolbarBitmap,NULL,COUNTOF(szTmp),szTmp,NULL)) + StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmap); + hbmp = LoadImage(NULL,szTmp,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE); + } + + if (hbmp) + bExternalBitmap = true; + else { + LPWSTR toolBarIntRes = (iHighDpiToolBar > 0) ? MAKEINTRESOURCE(IDR_MAINWNDTB2) : MAKEINTRESOURCE(IDR_MAINWNDTB); + hbmp = LoadImage(hInstance, toolBarIntRes, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + hbmpCopy = CopyImage(hbmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + } + GetObject(hbmp,sizeof(BITMAP),&bmp); + if (!IsXP()) + BitmapMergeAlpha(hbmp,GetSysColor(COLOR_3DFACE)); + himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); + ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); + DeleteObject(hbmp); + SendMessage(g_hwndToolbar,TB_SETIMAGELIST,0,(LPARAM)himl); + + // Optionally add hot Toolbar Bitmap + hbmp = NULL; + if (StringCchLenW(tchToolbarBitmapHot,COUNTOF(tchToolbarBitmapHot))) + { + if (!SearchPath(NULL,tchToolbarBitmapHot,NULL,COUNTOF(szTmp),szTmp,NULL)) + StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmapHot); + + hbmp = LoadImage(NULL, szTmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); + if (hbmp) + { + GetObject(hbmp,sizeof(BITMAP),&bmp); + himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); + ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); + DeleteObject(hbmp); + SendMessage(g_hwndToolbar,TB_SETHOTIMAGELIST,0,(LPARAM)himl); + } + } + + // Optionally add disabled Toolbar Bitmap + hbmp = NULL; + if (StringCchLenW(tchToolbarBitmapDisabled,COUNTOF(tchToolbarBitmapDisabled))) + { + if (!SearchPath(NULL,tchToolbarBitmapDisabled,NULL,COUNTOF(szTmp),szTmp,NULL)) + StringCchCopy(szTmp,COUNTOF(szTmp),tchToolbarBitmapDisabled); + + hbmp = LoadImage(NULL, szTmp, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); + if (hbmp) + { + GetObject(hbmp,sizeof(BITMAP),&bmp); + himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); + ImageList_AddMasked(himl,hbmp,CLR_DEFAULT); + DeleteObject(hbmp); + SendMessage(g_hwndToolbar,TB_SETDISABLEDIMAGELIST,0,(LPARAM)himl); + bExternalBitmap = true; + } + } + + if (!bExternalBitmap) { + bool fProcessed = false; + if (flagToolbarLook == 1) + fProcessed = BitmapAlphaBlend(hbmpCopy,GetSysColor(COLOR_3DFACE),0x60); + else if (flagToolbarLook == 2 || (!IsXP() && flagToolbarLook == 0)) + fProcessed = BitmapGrayScale(hbmpCopy); + if (fProcessed && !IsXP()) + BitmapMergeAlpha(hbmpCopy,GetSysColor(COLOR_3DFACE)); + if (fProcessed) { + himl = ImageList_Create(bmp.bmWidth/NUMTOOLBITMAPS,bmp.bmHeight,ILC_COLOR32|ILC_MASK,0,0); + ImageList_AddMasked(himl,hbmpCopy,CLR_DEFAULT); + SendMessage(g_hwndToolbar,TB_SETDISABLEDIMAGELIST,0,(LPARAM)himl); + } + } + if (hbmpCopy) + DeleteObject(hbmpCopy); + + // Load toolbar labels + pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * 32 * 1024); + cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + LoadIniSection(L"Toolbar Labels",pIniSection,cchIniSection); + for (i = 0; i < COUNTOF(tbbMainWnd); i++) { + + if (tbbMainWnd[i].fsStyle == TBSTYLE_SEP) + continue; + + n = tbbMainWnd[i].iBitmap + 1; + StringCchPrintf(tchIndex,COUNTOF(tchIndex),L"%02i",n); + if (IniSectionGetString(pIniSection,tchIndex,L"",tchDesc,COUNTOF(tchDesc))) + { + tbbMainWnd[i].iString = SendMessage(g_hwndToolbar,TB_ADDSTRING,0,(LPARAM)tchDesc); + tbbMainWnd[i].fsStyle |= BTNS_AUTOSIZE | BTNS_SHOWTEXT; + } + else { + tbbMainWnd[i].fsStyle &= ~(BTNS_AUTOSIZE | BTNS_SHOWTEXT); + } + } + LocalFree(pIniSection); + + SendMessage(g_hwndToolbar,TB_SETEXTENDEDSTYLE,0, + SendMessage(g_hwndToolbar,TB_GETEXTENDEDSTYLE,0,0) | TBSTYLE_EX_MIXEDBUTTONS); + + SendMessage(g_hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd); + + if (Toolbar_SetButtons(g_hwndToolbar, IDT_FILE_NEW, tchToolbarButtons, tbbMainWnd, COUNTOF(tbbMainWnd)) == 0) { + SendMessage(g_hwndToolbar, TB_ADDBUTTONS, NUMINITIALTOOLS, (LPARAM)tbbMainWnd); + } + SendMessage(g_hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc); + //SendMessage(g_hwndToolbar,TB_SETINDENT,2,0); + + DWORD dwStatusbarStyle = WS_CHILD | WS_CLIPSIBLINGS; + + if (bShowStatusbar) + dwStatusbarStyle |= WS_VISIBLE; + + g_hwndStatus = CreateStatusWindow(dwStatusbarStyle,NULL,hwnd,IDC_STATUSBAR); + + // Create ReBar and add Toolbar + hwndReBar = CreateWindowEx(WS_EX_TOOLWINDOW,REBARCLASSNAME,NULL,dwReBarStyle, + 0,0,0,0,hwnd,(HMENU)IDC_REBAR,hInstance,NULL); + + rbi.cbSize = sizeof(REBARINFO); + rbi.fMask = 0; + rbi.himl = (HIMAGELIST)NULL; + SendMessage(hwndReBar,RB_SETBARINFO,0,(LPARAM)&rbi); + + rbBand.cbSize = sizeof(REBARBANDINFO); + rbBand.fMask = /*RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | */ + RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE /*| RBBIM_SIZE*/; + rbBand.fStyle = /*RBBS_CHILDEDGE |*//* RBBS_BREAK |*/ RBBS_FIXEDSIZE /*| RBBS_GRIPPERALWAYS*/; + if (bIsPrivAppThemed) + rbBand.fStyle |= RBBS_CHILDEDGE; + rbBand.hbmBack = NULL; + rbBand.lpText = L"Toolbar"; + rbBand.hwndChild = g_hwndToolbar; + rbBand.cxMinChild = (rc.right - rc.left) * COUNTOF(tbbMainWnd); + rbBand.cyMinChild = (rc.bottom - rc.top) + 2 * rc.top; + rbBand.cx = 0; + SendMessage(hwndReBar,RB_INSERTBAND,(WPARAM)-1,(LPARAM)&rbBand); + + SetWindowPos(hwndReBar,NULL,0,0,0,0,SWP_NOZORDER); + GetWindowRect(hwndReBar,&rc); + cyReBar = rc.bottom - rc.top; + + cyReBarFrame = bIsPrivAppThemed ? 0 : 2; +} + + +//============================================================================= +// +// MsgEndSession() - Handle WM_ENDSESSION,WM_DESTROY +// +// +void MsgEndSession(HWND hwnd, UINT umsg) +{ + static bool bShutdownOK = false; + + if (!bShutdownOK) { + + // Terminate file watching + InstallFileWatching(NULL); + + // GetWindowPlacement + g_WinInfo = GetMyWindowPlacement(hwnd, NULL); + + DragAcceptFiles(hwnd, false); + RevokeDragAndDrop(pDropTarget); + + // Terminate clipboard watching + if (flagPasteBoard) { + KillTimer(hwnd, ID_PASTEBOARDTIMER); + ChangeClipboardChain(hwnd, hwndNextCBChain); + } + + // Destroy find / replace dialog + if (IsWindow(g_hwndDlgFindReplace)) + DestroyWindow(g_hwndDlgFindReplace); + + // Destroy customize schemes + if (IsWindow(g_hwndDlgCustomizeSchemes)) + DestroyWindow(g_hwndDlgCustomizeSchemes); + + // call SaveSettings() when g_hwndToolbar is still valid + SaveSettings(false); + + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) != 0) { + + // Cleanup unwanted MRU's + if (!bSaveRecentFiles) { + MRU_Empty(g_pFileMRU); + MRU_Save(g_pFileMRU); + } + else + MRU_MergeSave(g_pFileMRU, true, flagRelativeFileMRU, flagPortableMyDocs); + + MRU_Destroy(g_pFileMRU); + + if (!bSaveFindReplace) { + MRU_Empty(g_pMRUfind); + MRU_Empty(g_pMRUreplace); + MRU_Save(g_pMRUfind); + MRU_Save(g_pMRUreplace); + } + else { + MRU_MergeSave(g_pMRUfind, false, false, false); + MRU_MergeSave(g_pMRUreplace, false, false, false); + } + MRU_Destroy(g_pMRUfind); + MRU_Destroy(g_pMRUreplace); + } + + // Remove tray icon if necessary + ShowNotifyIcon(hwnd, false); + + bShutdownOK = true; + } + + if (umsg == WM_DESTROY) + PostQuitMessage(0); +} + + +//============================================================================= +// +// MsgThemeChanged() - Handle WM_THEMECHANGED +// +// +void MsgThemeChanged(HWND hwnd,WPARAM wParam,LPARAM lParam) +{ + RECT rc, rc2; + HINSTANCE hInstance = (HINSTANCE)(INT_PTR)GetWindowLongPtr(hwnd,GWLP_HINSTANCE); + + // reinitialize edit frame + + if (PrivateIsAppThemed()) { + bIsAppThemed = true; + + SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE) & ~WS_EX_CLIENTEDGE); + SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE); + + if (IsVista()) { + cxEditFrame = 0; + cyEditFrame = 0; + } + + else { + SetWindowPos(hwndEditFrame,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); + GetClientRect(hwndEditFrame,&rc); + GetWindowRect(hwndEditFrame,&rc2); + + cxEditFrame = ((rc2.right-rc2.left) - (rc.right-rc.left)) / 2; + cyEditFrame = ((rc2.bottom-rc2.top) - (rc.bottom-rc.top)) / 2; + } + } + + else { + bIsAppThemed = false; + + SetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE,WS_EX_CLIENTEDGE|GetWindowLongPtr(g_hwndEdit,GWL_EXSTYLE)); + SetWindowPos(g_hwndEdit,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); + + cxEditFrame = 0; + cyEditFrame = 0; + } + + // recreate toolbar and statusbar + Toolbar_GetButtons(g_hwndToolbar,IDT_FILE_NEW,tchToolbarButtons,COUNTOF(tchToolbarButtons)); + + DestroyWindow(g_hwndToolbar); + DestroyWindow(hwndReBar); + DestroyWindow(g_hwndStatus); + CreateBars(hwnd,hInstance); + + GetClientRect(hwnd,&rc); + SendMessage(hwnd,WM_SIZE,SIZE_RESTORED,MAKELONG(rc.right,rc.bottom)); + + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(0); + EditUpdateUrlHotspots(g_hwndEdit, 0, SciCall_GetTextLength(), g_bHyperlinkHotspot); + EditFinalizeStyling(g_hwndEdit, -1); + + UNUSED(lParam); + UNUSED(wParam); + UNUSED(hwnd); +} + + +//============================================================================= +// +// MsgSize() - Handles WM_SIZE +// +// +void MsgSize(HWND hwnd,WPARAM wParam,LPARAM lParam) +{ + + RECT rc; + int x,y,cx,cy; + HDWP hdwp; + + if (wParam == SIZE_MINIMIZED) + return; + + x = 0; + y = 0; + + cx = LOWORD(lParam); + cy = HIWORD(lParam); + + if (bShowToolbar) + { +/* SendMessage(g_hwndToolbar,WM_SIZE,0,0); + GetWindowRect(g_hwndToolbar,&rc); + y = (rc.bottom - rc.top); + cy -= (rc.bottom - rc.top);*/ + + //SendMessage(g_hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc); + SetWindowPos(hwndReBar,NULL,0,0,LOWORD(lParam),cyReBar,SWP_NOZORDER); + // the ReBar automatically sets the correct height + // calling SetWindowPos() with the height of one toolbar button + // causes the control not to temporarily use the whole client area + // and prevents flickering + + //GetWindowRect(hwndReBar,&rc); + y = cyReBar + cyReBarFrame; // define + cy -= cyReBar + cyReBarFrame; // border + } + + if (bShowStatusbar) + { + SendMessage(g_hwndStatus,WM_SIZE,0,0); + GetWindowRect(g_hwndStatus,&rc); + cy -= (rc.bottom - rc.top); + } + + hdwp = BeginDeferWindowPos(2); + + DeferWindowPos(hdwp,hwndEditFrame,NULL,x,y,cx,cy, + SWP_NOZORDER | SWP_NOACTIVATE); + + DeferWindowPos(hdwp,g_hwndEdit,NULL,x+cxEditFrame,y+cyEditFrame, + cx-2*cxEditFrame,cy-2*cyEditFrame, + SWP_NOZORDER | SWP_NOACTIVATE); + + EndDeferWindowPos(hdwp); + + // Statusbar width + int aWidth[7]; + aWidth[STATUS_DOCPOS] = max(120,min(cx*4/10, StatusCalcPaneWidth(g_hwndStatus, + L" Ln 9'999'999 : 9'999'999 Col 9'999'999:999 / 999 Sel 9'999'999 (999 Bytes) SelLn 9'999'999 Occ 9'999'999 "))); + aWidth[STATUS_DOCSIZE] = aWidth[STATUS_DOCPOS] + StatusCalcPaneWidth(g_hwndStatus,L" 9999 Bytes [UTF-8] "); + aWidth[STATUS_CODEPAGE] = aWidth[STATUS_DOCSIZE] + StatusCalcPaneWidth(g_hwndStatus,L" Unicode (UTF-8) Signature "); + aWidth[STATUS_EOLMODE] = aWidth[STATUS_CODEPAGE] + StatusCalcPaneWidth(g_hwndStatus,L" CR+LF "); + aWidth[STATUS_OVRMODE] = aWidth[STATUS_EOLMODE] + StatusCalcPaneWidth(g_hwndStatus,L" OVR "); + aWidth[STATUS_2ND_DEF] = aWidth[STATUS_OVRMODE] + StatusCalcPaneWidth(g_hwndStatus, L" 2ND "); + aWidth[STATUS_LEXER] = -1; + + + SendMessage(g_hwndStatus,SB_SETPARTS,COUNTOF(aWidth),(LPARAM)aWidth); + + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + + UNUSED(hwnd); + UNUSED(lParam); +} + + + +//============================================================================= +// +// MsgDropFiles() - Handles WM_DROPFILES +// +// +void MsgDropFiles(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + WCHAR szBuf[MAX_PATH + 40]; + HDROP hDrop = (HDROP)wParam; + + // Reset Change Notify + //bPendingChangeNotify = false; + + if (IsIconic(hwnd)) + ShowWindow(hwnd, SW_RESTORE); + + //SetForegroundWindow(hwnd); + + DragQueryFile(hDrop, 0, szBuf, COUNTOF(szBuf)); + + if (PathIsDirectory(szBuf)) { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), szBuf)) + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); + } + else if (PathFileExists(szBuf)) + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szBuf); + else + // Windows Bug: wParam (HDROP) pointer is corrupted if dropped from 32-bit App + MsgBox(MBWARN, IDS_DROP_NO_FILE); + + if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) + MsgBox(MBWARN, IDS_ERR_DROP); + + DragFinish(hDrop); + + UNUSED(lParam); +} + + + +//============================================================================= +// +// DropFilesProc() - Handles DROPFILES +// +// +static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyState, POINTL pt, void *pUserData) +{ + DWORD dwEffect = DROPEFFECT_NONE; + + //HWND hEditWnd = (HWND)pUserData; + UNUSED(pUserData); + + if (cf == CF_HDROP) + { + WCHAR szBuf[MAX_PATH + 40]; + HDROP hDrop = (HDROP)hData; + + if (IsIconic(hWnd)) + ShowWindow(hWnd, SW_RESTORE); + + DragQueryFile(hDrop, 0, szBuf, COUNTOF(szBuf)); + + if (PathIsDirectory(szBuf)) { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + if (OpenFileDlg(hWnd, tchFile, COUNTOF(tchFile), szBuf)) + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); + } + else + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szBuf); + + if (DragQueryFile(hDrop, (UINT)(-1), NULL, 0) > 1) + MsgBox(MBWARN, IDS_ERR_DROP); + + dwEffect = DROPEFFECT_COPY; + } + + UNUSED(dwKeyState); + UNUSED(pt); + + return dwEffect; +} + + +//============================================================================= +// +// MsgCopyData() - Handles WM_COPYDATA +// +// +LRESULT MsgCopyData(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; + + // Reset Change Notify + //bPendingChangeNotify = false; + + SetDlgItemInt(hwnd, IDC_REUSELOCK, GetTickCount(), false); + + if (pcds->dwData == DATA_NOTEPAD3_PARAMS) { + LPnp3params params = LocalAlloc(LPTR, pcds->cbData); + CopyMemory(params, pcds->lpData, pcds->cbData); + + if (params->flagLexerSpecified) + flagLexerSpecified = 1; + + if (params->flagQuietCreate) + flagQuietCreate = 1; + + if (params->flagFileSpecified) { + + bool bOpened = false; + Encoding_SrcCmdLn(params->iSrcEncoding); + + if (PathIsDirectory(¶ms->wchData)) { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), ¶ms->wchData)) + bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); + } + + else + bOpened = FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, ¶ms->wchData); + + if (bOpened) { + + if (params->flagChangeNotify == 1) { + iFileWatchingMode = 0; + bResetFileWatching = true; + InstallFileWatching(g_wchCurFile); + } + else if (params->flagChangeNotify == 2) { + iFileWatchingMode = 2; + bResetFileWatching = true; + InstallFileWatching(g_wchCurFile); + } + + if (0 != params->flagSetEncoding) { + flagSetEncoding = params->flagSetEncoding; + SendMessage( + hwnd, + WM_COMMAND, + MAKELONG(IDM_ENCODING_ANSI + flagSetEncoding - 1, 1), + 0); + flagSetEncoding = 0; + } + + if (0 != params->flagSetEOLMode) { + flagSetEOLMode = params->flagSetEOLMode; + SendMessage(g_hwndMain, WM_COMMAND, MAKELONG(IDM_LINEENDINGS_CRLF + flagSetEOLMode - 1, 1), 0); + flagSetEOLMode = 0; + } + + if (params->flagLexerSpecified) { + if (params->iInitialLexer < 0) { + WCHAR wchExt[32] = L"."; + StringCchCopyN(CharNext(wchExt), 32, StrEnd(¶ms->wchData) + 1, 31); + Style_SetLexerFromName(g_hwndEdit, ¶ms->wchData, wchExt); + } + else if (params->iInitialLexer >= 0 && params->iInitialLexer < NUMLEXERS) + Style_SetLexerFromID(g_hwndEdit, params->iInitialLexer); + } + + if (params->flagTitleExcerpt) { + StringCchCopyN(szTitleExcerpt, COUNTOF(szTitleExcerpt), StrEnd(¶ms->wchData) + 1, COUNTOF(szTitleExcerpt)); + } + } + // reset + Encoding_SrcCmdLn(CPI_NONE); + } + + if (params->flagJumpTo) { + if (params->iInitialLine == 0) + params->iInitialLine = 1; + EditJumpTo(g_hwndEdit, params->iInitialLine, params->iInitialColumn); + } + + flagLexerSpecified = 0; + flagQuietCreate = 0; + + LocalFree(params); + + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + + } + + UNUSED(wParam); + return true; +} + +//============================================================================= +// +// MsgContextMenu() - Handles WM_CONTEXTMENU +// +// +LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) +{ + HMENU hmenu; + int imenu = 0; + POINT pt; + int nID = GetDlgCtrlID((HWND)wParam); + + if ((nID != IDC_EDIT) && (nID != IDC_STATUSBAR) && + (nID != IDC_REBAR) && (nID != IDC_TOOLBAR)) + return DefWindowProc(hwnd, umsg, wParam, lParam); + + hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); + //SetMenuDefaultItem(GetSubMenu(hmenu,1),0,false); + + pt.x = (int)(short)LOWORD(lParam); + pt.y = (int)(short)HIWORD(lParam); + + switch (nID) { + case IDC_EDIT: + { + if (SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0) && (pt.x != -1) && (pt.y != -1)) { + DocPos iNewPos; + POINT ptc; + ptc.x = pt.x; ptc.y = pt.y; + ScreenToClient(g_hwndEdit, &ptc); + iNewPos = (DocPos)SendMessage(g_hwndEdit, SCI_POSITIONFROMPOINT, (WPARAM)ptc.x, (LPARAM)ptc.y); + EditSelectEx(g_hwndEdit, iNewPos, iNewPos, -1, -1); + } + + if (pt.x == -1 && pt.y == -1) { + DocPos iCurrentPos = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); + pt.x = (LONG)SendMessage(g_hwndEdit, SCI_POINTXFROMPOSITION, 0, (LPARAM)iCurrentPos); + pt.y = (LONG)SendMessage(g_hwndEdit, SCI_POINTYFROMPOSITION, 0, (LPARAM)iCurrentPos); + ClientToScreen(g_hwndEdit, &pt); + } + imenu = 0; + } + break; + + case IDC_TOOLBAR: + case IDC_STATUSBAR: + case IDC_REBAR: + if (pt.x == -1 && pt.y == -1) + GetCursorPos(&pt); + imenu = 1; + break; + } + + TrackPopupMenuEx(GetSubMenu(hmenu, imenu), + TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x + 1, pt.y + 1, hwnd, NULL); + + DestroyMenu(hmenu); + return 0; +} + + + +//============================================================================= +// +// MsgChangeNotify() - Handles WM_CHANGENOTIFY +// +// +void MsgChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + if (iFileWatchingMode == 1 || IsDocumentModified || Encoding_HasChanged(CPI_GET)) + SetForegroundWindow(hwnd); + + if (PathFileExists(g_wchCurFile)) { + if ((iFileWatchingMode == 2 && !IsDocumentModified && !Encoding_HasChanged(CPI_GET)) || + MsgBox(MBYESNOWARN,IDS_FILECHANGENOTIFY) == IDYES) { + + FileRevert(g_wchCurFile); + } + } + else { + if (MsgBox(MBYESNOWARN,IDS_FILECHANGENOTIFY2) == IDYES) + FileSave(true,false,false,false); + } + + if (!bRunningWatch) + InstallFileWatching(g_wchCurFile); + + UNUSED(wParam); + UNUSED(lParam); +} + + +//============================================================================= +// +// MsgTrayMessage() - Handles WM_TRAYMESSAGE +// +// +LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + switch (lParam) { + case WM_RBUTTONUP: + { + + HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); + HMENU hMenuPopup = GetSubMenu(hMenu, 2); + + POINT pt; + int iCmd; + + SetForegroundWindow(hwnd); + + GetCursorPos(&pt); + SetMenuDefaultItem(hMenuPopup, IDM_TRAY_RESTORE, false); + iCmd = TrackPopupMenu(hMenuPopup, + TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, + pt.x, pt.y, 0, hwnd, NULL); + + PostMessage(hwnd, WM_NULL, 0, 0); + + DestroyMenu(hMenu); + + if (iCmd == IDM_TRAY_RESTORE) { + ShowNotifyIcon(hwnd, false); + RestoreWndFromTray(hwnd); + ShowOwnedPopups(hwnd, true); + } + + else if (iCmd == IDM_TRAY_EXIT) { + //ShowNotifyIcon(hwnd,false); + SendMessage(hwnd, WM_CLOSE, 0, 0); + } + } + return true; + + case WM_LBUTTONUP: + ShowNotifyIcon(hwnd, false); + RestoreWndFromTray(hwnd); + ShowOwnedPopups(hwnd, true); + return true; + } + + UNUSED(wParam); + return 0; +} + + + +//============================================================================= +// +// MsgInitMenu() - Handles WM_INITMENU +// +// +void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam) +{ + //DocPos p; + bool b,e,s; + + HMENU hmenu = (HMENU)wParam; + + bool ro = SciCall_GetReadOnly(); + + int i = (int)StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)); + EnableCmd(hmenu,IDM_FILE_REVERT,i); + EnableCmd(hmenu, CMD_RELOADASCIIASUTF8, i); + EnableCmd(hmenu, CMD_RECODEANSI, i); + EnableCmd(hmenu, CMD_RECODEOEM, i); + EnableCmd(hmenu, CMD_RELOADNOFILEVARS, i); + EnableCmd(hmenu, CMD_RECODEDEFAULT, i); + EnableCmd(hmenu, IDM_FILE_LAUNCH, i); + + EnableCmd(hmenu,IDM_FILE_LAUNCH,i); + EnableCmd(hmenu,IDM_FILE_PROPERTIES,i); + EnableCmd(hmenu,IDM_FILE_CREATELINK,i); + EnableCmd(hmenu,IDM_FILE_ADDTOFAV,i); + + EnableCmd(hmenu,IDM_FILE_READONLY,i); + CheckCmd(hmenu,IDM_FILE_READONLY,bReadOnly); + + EnableCmd(hmenu,IDM_ENCODING_UNICODEREV,!ro); + EnableCmd(hmenu,IDM_ENCODING_UNICODE,!ro); + EnableCmd(hmenu,IDM_ENCODING_UTF8SIGN,!ro); + EnableCmd(hmenu,IDM_ENCODING_UTF8,!ro); + EnableCmd(hmenu,IDM_ENCODING_ANSI,!ro); + EnableCmd(hmenu,IDM_LINEENDINGS_CRLF,!ro); + EnableCmd(hmenu,IDM_LINEENDINGS_LF,!ro); + EnableCmd(hmenu,IDM_LINEENDINGS_CR,!ro); + + EnableCmd(hmenu,IDM_ENCODING_RECODE,i); + + if (Encoding_IsUNICODE_REVERSE(Encoding_Current(CPI_GET))) + i = IDM_ENCODING_UNICODEREV; + else if (Encoding_IsUNICODE(Encoding_Current(CPI_GET))) + i = IDM_ENCODING_UNICODE; + else if (Encoding_IsUTF8_SIGN(Encoding_Current(CPI_GET))) + i = IDM_ENCODING_UTF8SIGN; + else if (Encoding_IsUTF8(Encoding_Current(CPI_GET))) + i = IDM_ENCODING_UTF8; + else if (Encoding_IsANSI(Encoding_Current(CPI_GET))) + i = IDM_ENCODING_ANSI; + else + i = -1; + CheckMenuRadioItem(hmenu,IDM_ENCODING_ANSI,IDM_ENCODING_UTF8SIGN,i,MF_BYCOMMAND); + + if (g_iEOLMode == SC_EOL_CRLF) + i = IDM_LINEENDINGS_CRLF; + else if (g_iEOLMode == SC_EOL_LF) + i = IDM_LINEENDINGS_LF; + else + i = IDM_LINEENDINGS_CR; + CheckMenuRadioItem(hmenu,IDM_LINEENDINGS_CRLF,IDM_LINEENDINGS_CR,i,MF_BYCOMMAND); + + EnableCmd(hmenu,IDM_FILE_RECENT,(MRU_Enum(g_pFileMRU,0,NULL,0) > 0)); + + EnableCmd(hmenu,IDM_EDIT_UNDO,SciCall_CanUndo() && !ro); + EnableCmd(hmenu,IDM_EDIT_REDO,SciCall_CanRedo() && !ro); + + s = SciCall_IsSelectionEmpty(); + e = (SciCall_GetTextLength() == 0); + b = SciCall_CanPaste(); + + EnableCmd(hmenu,IDM_EDIT_CUT, !e && !ro); // allow Ctrl-X w/o selection + EnableCmd(hmenu,IDM_EDIT_COPY, !e); // allow Ctrl-C w/o selection + + EnableCmd(hmenu,IDM_EDIT_COPYALL, !e); + EnableCmd(hmenu,IDM_EDIT_COPYADD, !s); + + EnableCmd(hmenu,IDM_EDIT_PASTE, b && !ro); + EnableCmd(hmenu,IDM_EDIT_SWAP, (!s || b) && !ro); + EnableCmd(hmenu,IDM_EDIT_CLEAR, !s && !ro); + + EnableCmd(hmenu, IDM_EDIT_SELECTALL, !e); + + OpenClipboard(hwnd); + EnableCmd(hmenu,IDM_EDIT_CLEARCLIPBOARD,CountClipboardFormats()); + CloseClipboard(); + + EnableCmd(hmenu,IDM_EDIT_MOVELINEUP,!ro); + EnableCmd(hmenu,IDM_EDIT_MOVELINEDOWN,!ro); + EnableCmd(hmenu,IDM_EDIT_DUPLICATELINE,!ro); + EnableCmd(hmenu,IDM_EDIT_CUTLINE,!ro); + EnableCmd(hmenu,IDM_EDIT_COPYLINE,true); + EnableCmd(hmenu,IDM_EDIT_DELETELINE,!ro); + + EnableCmd(hmenu, IDM_EDIT_MERGEBLANKLINES, !ro); + EnableCmd(hmenu, IDM_EDIT_MERGEEMPTYLINES, !ro); + EnableCmd(hmenu, IDM_EDIT_REMOVEBLANKLINES, !ro); + EnableCmd(hmenu, IDM_EDIT_REMOVEEMPTYLINES, !ro); + EnableCmd(hmenu, IDM_EDIT_REMOVEDUPLICATELINES, !ro); + + EnableCmd(hmenu,IDM_EDIT_INDENT, !s && !ro); + EnableCmd(hmenu,IDM_EDIT_UNINDENT, !s && !ro); + + EnableCmd(hmenu,IDM_EDIT_PADWITHSPACES,!ro); + EnableCmd(hmenu,IDM_EDIT_STRIP1STCHAR,!ro); + EnableCmd(hmenu,IDM_EDIT_STRIPLASTCHAR,!ro); + EnableCmd(hmenu,IDM_EDIT_TRIMLINES,!ro); + EnableCmd(hmenu, IDM_EDIT_SELECTIONDUPLICATE, !ro); + EnableCmd(hmenu, IDM_EDIT_COMPRESSWS, !ro); + + EnableCmd(hmenu, IDM_EDIT_MODIFYLINES, !ro); + EnableCmd(hmenu, IDM_EDIT_ALIGN, !ro); + EnableCmd(hmenu, IDM_EDIT_SORTLINES, + (SciCall_LineFromPosition(SciCall_GetSelectionEnd()) - + SciCall_LineFromPosition(SciCall_GetSelectionStart())) >= 1); + + //EnableCmd(hmenu,IDM_EDIT_COLUMNWRAP,i /*&& IsWindowsNT()*/); + EnableCmd(hmenu,IDM_EDIT_SPLITLINES,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_JOINLINES,!s && !ro); + EnableCmd(hmenu, IDM_EDIT_JOINLN_NOSP,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_JOINLINES_PARA,!s && !ro); + + EnableCmd(hmenu,IDM_EDIT_CONVERTUPPERCASE,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_CONVERTLOWERCASE,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_INVERTCASE,!s && !ro /*&& IsWindowsNT()*/); + EnableCmd(hmenu,IDM_EDIT_TITLECASE,!s && !ro /*&& IsWindowsNT()*/); + EnableCmd(hmenu,IDM_EDIT_SENTENCECASE,!s && !ro /*&& IsWindowsNT()*/); + + EnableCmd(hmenu,IDM_EDIT_CONVERTTABS,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_CONVERTSPACES,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_CONVERTTABS2,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_CONVERTSPACES2,!s && !ro); + + EnableCmd(hmenu,IDM_EDIT_URLENCODE,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_URLDECODE,!s && !ro); + + EnableCmd(hmenu,IDM_EDIT_ESCAPECCHARS,!s && !ro); + EnableCmd(hmenu,IDM_EDIT_UNESCAPECCHARS,!s && !ro); + + EnableCmd(hmenu,IDM_EDIT_CHAR2HEX, !ro); // Char2Hex allowed for char after curr pos + EnableCmd(hmenu,IDM_EDIT_HEX2CHAR, !s && !ro); + + //EnableCmd(hmenu,IDM_EDIT_INCREASENUM,!s && !ro); + //EnableCmd(hmenu,IDM_EDIT_DECREASENUM,!s && !ro); + + EnableCmd(hmenu,IDM_VIEW_SHOWEXCERPT, !s); + + i = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); + + EnableCmd(hmenu,IDM_EDIT_LINECOMMENT, + !(i == SCLEX_NULL || i == SCLEX_CSS || i == SCLEX_DIFF || i == SCLEX_MARKDOWN || i == SCLEX_JSON) && !ro); + EnableCmd(hmenu,IDM_EDIT_STREAMCOMMENT, + !(i == SCLEX_NULL || i == SCLEX_VBSCRIPT || i == SCLEX_MAKEFILE || i == SCLEX_VB || i == SCLEX_ASM || + i == SCLEX_SQL || i == SCLEX_PERL || i == SCLEX_PYTHON || i == SCLEX_PROPERTIES ||i == SCLEX_CONF || + i == SCLEX_POWERSHELL || i == SCLEX_BATCH || i == SCLEX_DIFF || i == SCLEX_BASH || i == SCLEX_TCL || + i == SCLEX_AU3 || i == SCLEX_LATEX || i == SCLEX_AHK || i == SCLEX_RUBY || i == SCLEX_CMAKE || i == SCLEX_MARKDOWN || + i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIMROD) && !ro); + + EnableCmd(hmenu, CMD_CTRLENTER, !ro); + EnableCmd(hmenu, IDM_EDIT_INSERT_TAG, !ro); + EnableCmd(hmenu,IDM_EDIT_INSERT_ENCODING, *Encoding_GetParseNames(Encoding_Current(CPI_GET) && !ro)); + + EnableCmd(hmenu,IDM_EDIT_INSERT_SHORTDATE,!ro); + EnableCmd(hmenu,IDM_EDIT_INSERT_LONGDATE,!ro); + EnableCmd(hmenu,IDM_EDIT_INSERT_FILENAME,!ro); + EnableCmd(hmenu,IDM_EDIT_INSERT_PATHNAME,!ro); + + EnableCmd(hmenu, IDM_EDIT_INSERT_GUID, !ro); + + e = (SciCall_GetTextLength() == 0); + + EnableCmd(hmenu,IDM_EDIT_FIND, !e); + EnableCmd(hmenu,IDM_EDIT_SAVEFIND, !e); + EnableCmd(hmenu,IDM_EDIT_FINDNEXT, !e); + EnableCmd(hmenu,IDM_EDIT_FINDPREV, !e); + EnableCmd(hmenu,IDM_EDIT_REPLACE, !e && !ro); + EnableCmd(hmenu,IDM_EDIT_REPLACENEXT, !e && !ro); + EnableCmd(hmenu,IDM_EDIT_SELTONEXT, !e); + EnableCmd(hmenu,IDM_EDIT_SELTOPREV, !e); + EnableCmd(hmenu,IDM_EDIT_FINDMATCHINGBRACE, !e); + EnableCmd(hmenu,IDM_EDIT_SELTOMATCHINGBRACE, !e); + + EnableCmd(hmenu,BME_EDIT_BOOKMARKPREV, !e); + EnableCmd(hmenu,BME_EDIT_BOOKMARKNEXT, !e); + EnableCmd(hmenu,BME_EDIT_BOOKMARKTOGGLE, !e); + EnableCmd(hmenu,BME_EDIT_BOOKMARKCLEAR, !e); + + EnableCmd(hmenu, IDM_EDIT_DELETELINELEFT, !e && !ro); + EnableCmd(hmenu, IDM_EDIT_DELETELINERIGHT, !e && !ro); + EnableCmd(hmenu, CMD_CTRLBACK, !e && !ro); + EnableCmd(hmenu, CMD_CTRLDEL, !e && !ro); + EnableCmd(hmenu, CMD_TIMESTAMPS, !e && !ro); + + EnableCmd(hmenu, IDM_VIEW_FONT, !IsWindow(g_hwndDlgCustomizeSchemes)); + EnableCmd(hmenu, IDM_VIEW_CURRENTSCHEME, !IsWindow(g_hwndDlgCustomizeSchemes)); + + EnableCmd(hmenu,IDM_VIEW_TOGGLEFOLDS,!e && (g_bCodeFoldingAvailable && g_bShowCodeFolding)); + CheckCmd(hmenu,IDM_VIEW_FOLDING, (g_bCodeFoldingAvailable && g_bShowCodeFolding)); + EnableCmd(hmenu, IDM_VIEW_FOLDING, g_bCodeFoldingAvailable); + + CheckCmd(hmenu,IDM_VIEW_USE2NDDEFAULT,Style_GetUse2ndDefault()); + + CheckCmd(hmenu,IDM_VIEW_WORDWRAP,bWordWrap); + CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,bMarkLongLines); + CheckCmd(hmenu,IDM_VIEW_TABSASSPACES,g_bTabsAsSpaces); + CheckCmd(hmenu,IDM_VIEW_SHOWINDENTGUIDES,bShowIndentGuides); + CheckCmd(hmenu,IDM_VIEW_AUTOINDENTTEXT,bAutoIndent); + CheckCmd(hmenu,IDM_VIEW_LINENUMBERS,bShowLineNumbers); + CheckCmd(hmenu,IDM_VIEW_MARGIN,g_bShowSelectionMargin); + + EnableCmd(hmenu,IDM_EDIT_COMPLETEWORD,!e && !ro); + CheckCmd(hmenu,IDM_VIEW_AUTOCOMPLETEWORDS,bAutoCompleteWords && !ro); + CheckCmd(hmenu,IDM_VIEW_ACCELWORDNAV,bAccelWordNavigation); + + CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_ONOFF, (g_iMarkOccurrences > 0)); + CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible); + CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, bMarkOccurrencesMatchCase); + + EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible); + + if (bMarkOccurrencesMatchWords) + i = IDM_VIEW_MARKOCCUR_WORD; + else if (bMarkOccurrencesCurrentWord) + i = IDM_VIEW_MARKOCCUR_CURRENT; + else + i = IDM_VIEW_MARKOCCUR_WNONE; + + CheckMenuRadioItem(hmenu, IDM_VIEW_MARKOCCUR_WNONE, IDM_VIEW_MARKOCCUR_CURRENT, i, MF_BYCOMMAND); + CheckCmdPos(GetSubMenu(GetSubMenu(GetMenu(g_hwndMain), 2), 17), 5, (i != IDM_VIEW_MARKOCCUR_WNONE)); + + i = (int)(g_iMarkOccurrences > 0); + EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, i); + EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, i); + EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_WNONE, i); + EnableCmd(hmenu,IDM_VIEW_MARKOCCUR_WORD, i); + EnableCmd(hmenu, IDM_VIEW_MARKOCCUR_CURRENT, i); + EnableCmdPos(GetSubMenu(GetSubMenu(GetMenu(g_hwndMain), 2), 17), 5, i); + + + CheckCmd(hmenu,IDM_VIEW_SHOWWHITESPACE,bViewWhiteSpace); + CheckCmd(hmenu,IDM_VIEW_SHOWEOLS,bViewEOLs); + CheckCmd(hmenu,IDM_VIEW_WORDWRAPSYMBOLS,bShowWordWrapSymbols); + CheckCmd(hmenu,IDM_VIEW_MATCHBRACES,bMatchBraces); + CheckCmd(hmenu,IDM_VIEW_TOOLBAR,bShowToolbar); + EnableCmd(hmenu,IDM_VIEW_CUSTOMIZETB,bShowToolbar); + CheckCmd(hmenu,IDM_VIEW_STATUSBAR,bShowStatusbar); + + i = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); + //EnableCmd(hmenu,IDM_VIEW_AUTOCLOSETAGS,(i == SCLEX_HTML || i == SCLEX_XML)); + CheckCmd(hmenu, IDM_VIEW_AUTOCLOSETAGS, bAutoCloseTags /*&& (i == SCLEX_HTML || i == SCLEX_XML)*/); + CheckCmd(hmenu, IDM_VIEW_HILITECURRENTLINE, bHiliteCurrentLine); + CheckCmd(hmenu, IDM_VIEW_HYPERLINKHOTSPOTS, g_bHyperlinkHotspot); + CheckCmd(hmenu, IDM_VIEW_SCROLLPASTEOF, bScrollPastEOF); + + + i = IniGetInt(L"Settings2",L"ReuseWindow",0); + CheckCmd(hmenu,IDM_VIEW_REUSEWINDOW,i); + i = IniGetInt(L"Settings2",L"SingleFileInstance",0); + CheckCmd(hmenu,IDM_VIEW_SINGLEFILEINSTANCE,i); + bStickyWinPos = IniGetInt(L"Settings2",L"StickyWindowPosition",0); + CheckCmd(hmenu,IDM_VIEW_STICKYWINPOS,bStickyWinPos); + CheckCmd(hmenu,IDM_VIEW_ALWAYSONTOP,((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1)); + CheckCmd(hmenu,IDM_VIEW_MINTOTRAY,bMinimizeToTray); + CheckCmd(hmenu,IDM_VIEW_TRANSPARENT,bTransparentMode && bTransparentModeAvailable); + EnableCmd(hmenu,IDM_VIEW_TRANSPARENT,bTransparentModeAvailable); + + CheckCmd(hmenu,IDM_VIEW_NOSAVERECENT,bSaveRecentFiles); + CheckCmd(hmenu,IDM_VIEW_NOPRESERVECARET, bPreserveCaretPos); + CheckCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,bSaveFindReplace); + CheckCmd(hmenu,IDM_VIEW_SAVEBEFORERUNNINGTOOLS,bSaveBeforeRunningTools); + + CheckCmd(hmenu,IDM_VIEW_CHANGENOTIFY,iFileWatchingMode); + + if (StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt))) + i = IDM_VIEW_SHOWEXCERPT; + else if (iPathNameFormat == 0) + i = IDM_VIEW_SHOWFILENAMEONLY; + else if (iPathNameFormat == 1) + i = IDM_VIEW_SHOWFILENAMEFIRST; + else + i = IDM_VIEW_SHOWFULLPATH; + CheckMenuRadioItem(hmenu,IDM_VIEW_SHOWFILENAMEONLY,IDM_VIEW_SHOWEXCERPT,i,MF_BYCOMMAND); + + if (iEscFunction == 1) + i = IDM_VIEW_ESCMINIMIZE; + else if (iEscFunction == 2) + i = IDM_VIEW_ESCEXIT; + else + i = IDM_VIEW_NOESCFUNC; + CheckMenuRadioItem(hmenu,IDM_VIEW_NOESCFUNC,IDM_VIEW_ESCEXIT,i,MF_BYCOMMAND); + + i = (int)StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)); + CheckCmd(hmenu,IDM_VIEW_SAVESETTINGS,bSaveSettings && i); + + EnableCmd(hmenu,IDM_VIEW_REUSEWINDOW,i); + EnableCmd(hmenu,IDM_VIEW_STICKYWINPOS,i); + EnableCmd(hmenu,IDM_VIEW_SINGLEFILEINSTANCE,i); + EnableCmd(hmenu,IDM_VIEW_NOSAVERECENT,i); + EnableCmd(hmenu,IDM_VIEW_NOPRESERVECARET,i); + EnableCmd(hmenu,IDM_VIEW_NOSAVEFINDREPL,i); + EnableCmd(hmenu,IDM_VIEW_SAVESETTINGS,bEnableSaveSettings && i); + + i = (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0 || StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0); + EnableCmd(hmenu,IDM_VIEW_SAVESETTINGSNOW,bEnableSaveSettings && i); + + bool bIsHLink = false; + if ((bool)SendMessage(g_hwndEdit, SCI_STYLEGETHOTSPOT, Style_GetHotspotStyleID(), 0)) + { + bIsHLink = (Style_GetHotspotStyleID() == (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, SciCall_GetCurrentPos(), 0)); + } + EnableCmd(hmenu, CMD_OPEN_HYPERLINK, bIsHLink); + + UNUSED(lParam); +} + + +//============================================================================= +// +// MsgSysCommand() - Handles WM_SYSCOMMAND +// +// +LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) +{ + switch (wParam) { + case SC_MINIMIZE: + ShowOwnedPopups(hwnd, false); + if (bMinimizeToTray) { + MinimizeWndToTray(hwnd); + ShowNotifyIcon(hwnd, true); + SetNotifyIconTitle(hwnd); + return(0); + } + else + return DefWindowProc(hwnd, umsg, wParam, lParam); + + case SC_RESTORE: + { + LRESULT lrv = DefWindowProc(hwnd, umsg, wParam, lParam); + ShowOwnedPopups(hwnd, true); + return(lrv); + } + } + return DefWindowProc(hwnd, umsg, wParam, lParam); +} + + +//============================================================================= +// +// MsgCommand() - Handles WM_COMMAND +// +// +LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + switch(LOWORD(wParam)) + { + + case IDT_TIMER_MAIN_MRKALL: + EditMarkAllOccurrences(); + break; + + + case IDT_TIMER_UPDATE_HOTSPOT: + EditUpdateVisibleUrlHotspot(g_bHyperlinkHotspot); + break; + + + case IDM_FILE_NEW: + FileLoad(false,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); + break; + + + case IDM_FILE_OPEN: + FileLoad(false,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); + break; + + + case IDM_FILE_REVERT: + if ((IsDocumentModified || Encoding_HasChanged(CPI_GET)) && MsgBox(MBOKCANCEL,IDS_ASK_REVERT) != IDOK) { + return(0); + } + FileRevert(g_wchCurFile); + break; + + + case IDM_FILE_SAVE: + FileSave(true,false,false,false); + break; + + + case IDM_FILE_SAVEAS: + FileSave(true,false,true,false); + break; + + + case IDM_FILE_SAVECOPY: + FileSave(true,false,true,true); + break; + + + case IDM_FILE_READONLY: + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + { + DWORD dwFileAttributes = GetFileAttributes(g_wchCurFile); + if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) { + if (bReadOnly) + dwFileAttributes = (dwFileAttributes & ~FILE_ATTRIBUTE_READONLY); + else + dwFileAttributes |= FILE_ATTRIBUTE_READONLY; + if (!SetFileAttributes(g_wchCurFile,dwFileAttributes)) + MsgBox(MBWARN,IDS_READONLY_MODIFY,g_wchCurFile); + } + else + MsgBox(MBWARN,IDS_READONLY_MODIFY,g_wchCurFile); + + dwFileAttributes = GetFileAttributes(g_wchCurFile); + if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) + bReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY); + + UpdateToolbar(); + } + break; + + + case IDM_FILE_BROWSE: + DialogFileBrowse(hwnd); + break; + + + case IDM_FILE_NEWWINDOW: + case IDM_FILE_NEWWINDOW2: + DialogNewWindow(hwnd, bSaveBeforeRunningTools, (LOWORD(wParam) != IDM_FILE_NEWWINDOW2)); + break; + + + case IDM_FILE_LAUNCH: + { + WCHAR wchDirectory[MAX_PATH] = { L'\0' }; + + if (!StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + break; + + if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) + break; + + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + StringCchCopy(wchDirectory,COUNTOF(wchDirectory),g_wchCurFile); + PathRemoveFileSpec(wchDirectory); + } + + SHELLEXECUTEINFO sei; + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = 0; + sei.hwnd = hwnd; + sei.lpVerb = NULL; + sei.lpFile = g_wchCurFile; + sei.lpParameters = NULL; + sei.lpDirectory = wchDirectory; + sei.nShow = SW_SHOWNORMAL; + ShellExecuteEx(&sei); + } + break; + + + case IDM_FILE_RUN: + { + WCHAR tchCmdLine[MAX_PATH+4]; + + if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) + break; + + StringCchCopy(tchCmdLine,COUNTOF(tchCmdLine),g_wchCurFile); + PathQuoteSpaces(tchCmdLine); + + RunDlg(hwnd,tchCmdLine); + } + break; + + + case IDM_FILE_OPENWITH: + if (bSaveBeforeRunningTools && !FileSave(false,true,false,false)) + break; + OpenWithDlg(hwnd,g_wchCurFile); + break; + + + case IDM_FILE_PAGESETUP: + EditPrintSetup(g_hwndEdit); + break; + + case IDM_FILE_PRINT: + { + SHFILEINFO shfi; + WCHAR *pszTitle; + WCHAR tchUntitled[32] = { L'\0' }; + WCHAR tchPageFmt[32] = { L'\0' }; + + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + pszTitle = shfi.szDisplayName; + } + else { + GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); + pszTitle = tchUntitled; + } + + GetString(IDS_PRINT_PAGENUM,tchPageFmt,COUNTOF(tchPageFmt)); + + if (!EditPrint(g_hwndEdit,pszTitle,tchPageFmt)) + MsgBox(MBWARN,IDS_PRINT_ERROR,pszTitle); + } + break; + + + case IDM_FILE_PROPERTIES: + { + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) + break; + + SHELLEXECUTEINFO sei; + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = SEE_MASK_INVOKEIDLIST; + sei.hwnd = hwnd; + sei.lpVerb = L"properties"; + sei.lpFile = g_wchCurFile; + sei.nShow = SW_SHOWNORMAL; + ShellExecuteEx(&sei); + } + break; + + case IDM_FILE_CREATELINK: + { + if (!StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + break; + + if (!PathCreateDeskLnk(g_wchCurFile)) + MsgBox(MBWARN,IDS_ERR_CREATELINK); + } + break; + + + case IDM_FILE_OPENFAV: + if (FileSave(false,true,false,false)) { + + WCHAR tchSelItem[MAX_PATH] = { L'\0' }; + + if (FavoritesDlg(hwnd,tchSelItem)) + { + if (PathIsLnkToDirectory(tchSelItem,NULL,0)) + PathGetLnkPath(tchSelItem,tchSelItem,COUNTOF(tchSelItem)); + + if (PathIsDirectory(tchSelItem)) + { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + + if (OpenFileDlg(g_hwndMain,tchFile,COUNTOF(tchFile),tchSelItem)) + FileLoad(true,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,tchFile); + } + else + FileLoad(true,false,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,tchSelItem); + } + } + break; + + + case IDM_FILE_ADDTOFAV: + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + SHFILEINFO shfi; + SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL, + &shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + AddToFavDlg(hwnd,shfi.szDisplayName,g_wchCurFile); + } + break; + + + case IDM_FILE_MANAGEFAV: + { + SHELLEXECUTEINFO sei; + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = 0; + sei.hwnd = hwnd; + sei.lpVerb = NULL; + sei.lpFile = tchFavoritesDir; + sei.lpParameters = NULL; + sei.lpDirectory = NULL; + sei.nShow = SW_SHOWNORMAL; + // Run favorites directory + ShellExecuteEx(&sei); + } + break; + + + case IDM_FILE_RECENT: + if (MRU_Enum(g_pFileMRU,0,NULL,0) > 0) { + if (FileSave(false,true,false,false)) { + WCHAR tchFile[MAX_PATH] = { L'\0' }; + if (FileMRUDlg(hwnd,tchFile)) + FileLoad(true,false,false,false,true,tchFile); + } + } + break; + + + case IDM_FILE_EXIT: + SendMessage(hwnd,WM_CLOSE,0,0); + break; + + + case IDM_ENCODING_ANSI: + case IDM_ENCODING_UNICODE: + case IDM_ENCODING_UNICODEREV: + case IDM_ENCODING_UTF8: + case IDM_ENCODING_UTF8SIGN: + case IDM_ENCODING_SELECT: + { + int iNewEncoding = Encoding_Current(CPI_GET); + if (LOWORD(wParam) == IDM_ENCODING_SELECT && !SelectEncodingDlg(hwnd,&iNewEncoding)) + break; + else { + switch (LOWORD(wParam)) { + case IDM_ENCODING_UNICODE: iNewEncoding = CPI_UNICODEBOM; break; + case IDM_ENCODING_UNICODEREV: iNewEncoding = CPI_UNICODEBEBOM; break; + case IDM_ENCODING_UTF8: iNewEncoding = CPI_UTF8; break; + case IDM_ENCODING_UTF8SIGN: iNewEncoding = CPI_UTF8SIGN; break; + case IDM_ENCODING_ANSI: iNewEncoding = CPI_ANSI_DEFAULT; break; + } + } + + BeginWaitCursor(NULL); + if (EditSetNewEncoding(g_hwndEdit, + iNewEncoding, + (flagSetEncoding), + StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0)) { + + if (SendMessage(g_hwndEdit,SCI_GETLENGTH,0,0) == 0) { + Encoding_Current(iNewEncoding); + Encoding_HasChanged(iNewEncoding); + } + else { + if (Encoding_IsANSI(Encoding_Current(CPI_GET)) || Encoding_IsANSI(iNewEncoding)) + Encoding_HasChanged(CPI_NONE); + Encoding_Current(iNewEncoding); + } + UpdateToolbar(); + } + EndWaitCursor(); + + } + break; + + + case IDM_ENCODING_RECODE: + { + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + + int iNewEncoding = Encoding_MapUnicode(Encoding_Current(CPI_GET)); + + if ((IsDocumentModified || Encoding_HasChanged(CPI_GET)) && MsgBox(MBOKCANCEL,IDS_ASK_RECODE) != IDOK) + return(0); + + if (RecodeDlg(hwnd,&iNewEncoding)) + { + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + Encoding_SrcCmdLn(iNewEncoding); + FileLoad(true,false,true,false,true,tchCurFile2); + } + } + } + break; + + + case IDM_ENCODING_SETDEFAULT: + SelectDefEncodingDlg(hwnd,&g_iDefaultNewFileEncoding); + break; + + + case IDM_LINEENDINGS_CRLF: + case IDM_LINEENDINGS_LF: + case IDM_LINEENDINGS_CR: + { + BeginWaitCursor(NULL) + int iNewEOLMode = iLineEndings[LOWORD(wParam)-IDM_LINEENDINGS_CRLF]; + g_iEOLMode = iNewEOLMode; + SendMessage(g_hwndEdit,SCI_SETEOLMODE,g_iEOLMode,0); + SendMessage(g_hwndEdit,SCI_CONVERTEOLS,g_iEOLMode,0); + EditFixPositions(g_hwndEdit); + EndWaitCursor() + UpdateToolbar(); + UpdateStatusbar(); + } + break; + + + case IDM_LINEENDINGS_SETDEFAULT: + SelectDefLineEndingDlg(hwnd,&g_iDefaultEOLMode); + break; + + + case IDM_EDIT_UNDO: + IgnoreNotifyChangeEvent(); + SendMessage(g_hwndEdit, SCI_UNDO, 0, 0); + ObserveNotifyChangeEvent(); + break; + + + case IDM_EDIT_REDO: + IgnoreNotifyChangeEvent(); + SendMessage(g_hwndEdit, SCI_REDO, 0, 0); + ObserveNotifyChangeEvent(); + break; + + + case IDM_EDIT_CUT: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + + int token = BeginUndoAction(); + if (!SciCall_IsSelectionEmpty()) + { + SciCall_Cut(); + } + else { // VisualStudio behavior + SciCall_CopyAllowLine(); + SciCall_LineDelete(); + } + EndUndoAction(token); + UpdateToolbar(); + } + break; + + + case IDM_EDIT_COPY: + case IDM_EDIT_COPYLINE: + if (flagPasteBoard) + bLastCopyFromMe = true; + SciCall_CopyAllowLine(); + UpdateToolbar(); + break; + + + case IDM_EDIT_COPYALL: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + SendMessage(g_hwndEdit,SCI_COPYRANGE,0,(LPARAM)SciCall_GetTextLength()); + UpdateToolbar(); + } + break; + + + case IDM_EDIT_COPYADD: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + EditCopyAppend(g_hwndEdit,true); + UpdateToolbar(); + } + break; + + case IDM_EDIT_PASTE: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + int token = BeginUndoAction(); + EditPasteClipboard(g_hwndEdit, false, bSkipUnicodeDetection); + EndUndoAction(token); + // Updates done by EditPasteClipboard(): + //~UpdateToolbar(); + //~UpdateStatusbar(); + //~UpdateLineNumberWidth(); + } + break; + + case IDM_EDIT_SWAP: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + int token = BeginUndoAction(); + EditPasteClipboard(g_hwndEdit, true, bSkipUnicodeDetection); + EndUndoAction(token); + UpdateToolbar(); + UpdateStatusbar(); + } + break; + + case IDM_EDIT_CLEARCLIPBOARD: + EditClearClipboard(g_hwndEdit); + UpdateToolbar(); + break; + + + case IDM_EDIT_SELECTALL: + SendMessage(g_hwndEdit,SCI_SELECTALL,0,0); + UpdateStatusbar(); + break; + + + case IDM_EDIT_SELECTWORD: + { + DocPos iPos = SciCall_GetCurrentPos(); + + if (SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) { + + DocPos iWordStart = (DocPos)SendMessage(g_hwndEdit,SCI_WORDSTARTPOSITION,iPos,true); + DocPos iWordEnd = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iPos,true); + + if (iWordStart == iWordEnd) // we are in whitespace salad... + { + iWordStart = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iPos,false); + iWordEnd = (DocPos)SendMessage(g_hwndEdit,SCI_WORDENDPOSITION,iWordStart,true); + if (iWordStart != iWordEnd) { + SciCall_SetSel(iWordStart, iWordEnd); + } + } + else { + SciCall_SetSel(iWordStart, iWordEnd); + } + + if (SciCall_IsSelectionEmpty()) { + const DocLn iLine = SciCall_LineFromPosition(iPos); + const DocPos iLineStart = SciCall_GetLineIndentPosition(iLine); + const DocPos iLineEnd = SciCall_GetLineEndPosition(iLine); + SciCall_SetSel(iLineStart, iLineEnd); + } + } + else { + const DocLn iLine = SciCall_LineFromPosition(iPos); + const DocPos iLineStart = SciCall_GetLineIndentPosition(iLine); + const DocPos iLineEnd = SciCall_GetLineEndPosition(iLine); + SciCall_SetSel(iLineStart, iLineEnd); + } + UpdateStatusbar(); + } + break; + + + case IDM_EDIT_SELECTLINE: + { + const DocPos iSelStart = SciCall_GetSelectionStart(); + const DocPos iSelEnd = SciCall_GetSelectionEnd(); + const DocPos iLineStart = SciCall_LineFromPosition(iSelStart); + const DocPos iLineEnd = SciCall_LineFromPosition(iSelEnd); + SciCall_SetSel(SciCall_PositionFromLine(iLineStart), SciCall_PositionFromLine(iLineEnd + 1)); + SciCall_ChooseCaretX(); + UpdateStatusbar(); + } + break; + + + case IDM_EDIT_MOVELINEUP: + { + int token = BeginUndoAction(); + EditMoveUp(g_hwndEdit); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_MOVELINEDOWN: + { + int token = BeginUndoAction(); + EditMoveDown(g_hwndEdit); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_DUPLICATELINE: + SendMessage(g_hwndEdit,SCI_LINEDUPLICATE,0,0); + break; + + + case IDM_EDIT_CUTLINE: + { + if (flagPasteBoard) + bLastCopyFromMe = true; + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_LINECUT,0,0); + UpdateToolbar(); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_DELETELINE: + { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit, SCI_LINEDELETE, 0, 0); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_DELETELINELEFT: + { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit, SCI_DELLINELEFT, 0, 0); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_DELETELINERIGHT: + { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit, SCI_DELLINERIGHT, 0, 0); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_INDENT: + { + int token = BeginUndoAction(); + EditIndentBlock(g_hwndEdit, SCI_TAB, true); + EndUndoAction(token); + } + break; + + case IDM_EDIT_UNINDENT: + { + int token = BeginUndoAction(); + EditIndentBlock(g_hwndEdit, SCI_BACKTAB, true); + EndUndoAction(token); + } + break; + + case CMD_TAB: + { + int token = BeginUndoAction(); + EditIndentBlock(g_hwndEdit, SCI_TAB, false); + EndUndoAction(token); + } + break; + + case CMD_BACKTAB: + { + int token = BeginUndoAction(); + EditIndentBlock(g_hwndEdit, SCI_BACKTAB, false); + EndUndoAction(token); + } + break; + + case CMD_CTRLTAB: + { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit, SCI_SETUSETABS, true, 0); + SendMessage(g_hwndEdit, SCI_SETTABINDENTS, false, 0); + EditIndentBlock(g_hwndEdit, SCI_TAB, false); + SendMessage(g_hwndEdit, SCI_SETTABINDENTS, g_bTabIndents, 0); + SendMessage(g_hwndEdit, SCI_SETUSETABS, !g_bTabsAsSpaces, 0); + EndUndoAction(token); + } + break; + + case CMD_DELETEBACK: + { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit, SCI_DELETEBACK, 0, 0); + EndUndoAction(token); + } + break; + + case IDM_EDIT_ENCLOSESELECTION: + if (EditEncloseSelectionDlg(hwnd,wchPrefixSelection,wchAppendSelection)) { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit,wchPrefixSelection,wchAppendSelection); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_SELECTIONDUPLICATE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_SELECTIONDUPLICATE,0,0); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_PADWITHSPACES: + { + BeginWaitCursor(NULL); + EditPadWithSpaces(g_hwndEdit,false,false); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_STRIP1STCHAR: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditStripFirstCharacter(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_STRIPLASTCHAR: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditStripLastCharacter(g_hwndEdit, false, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_TRIMLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditStripLastCharacter(g_hwndEdit, false, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_COMPRESSWS: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditCompressSpaces(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_MERGEBLANKLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditRemoveBlankLines(g_hwndEdit, true, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + case IDM_EDIT_MERGEEMPTYLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditRemoveBlankLines(g_hwndEdit, true, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_REMOVEBLANKLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditRemoveBlankLines(g_hwndEdit, false, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_REMOVEEMPTYLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditRemoveBlankLines(g_hwndEdit, false, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_REMOVEDUPLICATELINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditRemoveDuplicateLines(g_hwndEdit, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_MODIFYLINES: + { + if (EditModifyLinesDlg(hwnd,wchPrefixLines,wchAppendLines)) { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditModifyLines(g_hwndEdit,wchPrefixLines,wchAppendLines); + EndUndoAction(token); + EndWaitCursor(); + } + } + break; + + + case IDM_EDIT_ALIGN: + { + if (EditAlignDlg(hwnd,&iAlignMode)) { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditAlignText(g_hwndEdit,iAlignMode); + EndUndoAction(token); + EndWaitCursor(); + } + } + break; + + + case IDM_EDIT_SORTLINES: + { + if (EditSortDlg(hwnd,&iSortOptions)) { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditSortLines(g_hwndEdit,iSortOptions); + EndUndoAction(token); + EndWaitCursor(); + } + } + break; + + + case IDM_EDIT_COLUMNWRAP: + { + if (iWrapCol == 0) { + iWrapCol = iLongLinesLimit; + } + + UINT uWrpCol = 0; + if (ColumnWrapDlg(hwnd,IDD_COLUMNWRAP,&uWrpCol)) + { + iWrapCol = (DocPos)max(min(uWrpCol,(UINT)iLongLinesLimit),1); + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditWrapToColumn(g_hwndEdit,iWrapCol); + EndUndoAction(token); + EndWaitCursor(); + } + } + break; + + + case IDM_EDIT_SPLITLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditEnterTargetTransaction(); + SciCall_TargetFromSelection(); + SendMessage(g_hwndEdit,SCI_LINESSPLIT,0,0); + EditLeaveTargetTransaction(); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_JOINLINES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditJoinLinesEx(g_hwndEdit, false, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + case IDM_EDIT_JOINLN_NOSP: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditJoinLinesEx(g_hwndEdit, false, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + case IDM_EDIT_JOINLINES_PARA: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditJoinLinesEx(g_hwndEdit, true, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTUPPERCASE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_UPPERCASE,0,0); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTLOWERCASE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_LOWERCASE,0,0); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_INVERTCASE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditInvertCase(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_TITLECASE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditTitleCase(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_SENTENCECASE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditSentenceCase(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTTABS: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditTabsToSpaces(g_hwndEdit, g_iTabWidth, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTSPACES: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditSpacesToTabs(g_hwndEdit, g_iTabWidth, false); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTTABS2: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditTabsToSpaces(g_hwndEdit, g_iTabWidth, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CONVERTSPACES2: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditSpacesToTabs(g_hwndEdit, g_iTabWidth, true); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_INSERT_TAG: + { + WCHAR wszOpen[256] = { L'\0' }; + WCHAR wszClose[256] = { L'\0' }; + if (EditInsertTagDlg(hwnd, wszOpen, wszClose)) { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, wszOpen, wszClose); + EndUndoAction(token); + } + } + break; + + + case IDM_EDIT_INSERT_ENCODING: + { + if (*Encoding_GetParseNames(Encoding_Current(CPI_GET))) { + char msz[32] = { '\0' }; + //int iSelStart; + StringCchCopyNA(msz,COUNTOF(msz), Encoding_GetParseNames(Encoding_Current(CPI_GET)),COUNTOF(msz)); + char *p = StrChrA(msz, ','); + if (p) + *p = 0; + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)msz); + EndUndoAction(token); + } + } + break; + + + case IDM_EDIT_INSERT_SHORTDATE: + case IDM_EDIT_INSERT_LONGDATE: + { + WCHAR tchDate[128] = { L'\0' }; + WCHAR tchTime[128] = { L'\0' }; + WCHAR tchDateTime[256] = { L'\0' }; + WCHAR tchTemplate[256] = { L'\0' }; + SYSTEMTIME st; + char mszBuf[MAX_PATH*3] = { '\0' }; + //int iSelStart; + + GetLocalTime(&st); + + if (IniGetString(L"Settings2", + (LOWORD(wParam) == IDM_EDIT_INSERT_SHORTDATE) ? L"DateTimeShort" : L"DateTimeLong", + L"",tchTemplate,COUNTOF(tchTemplate))) { + struct tm sst; + sst.tm_isdst = -1; + sst.tm_sec = (int)st.wSecond; + sst.tm_min = (int)st.wMinute; + sst.tm_hour = (int)st.wHour; + sst.tm_mday = (int)st.wDay; + sst.tm_mon = (int)st.wMonth - 1; + sst.tm_year = (int)st.wYear - 1900; + sst.tm_wday = (int)st.wDayOfWeek; + mktime(&sst); + wcsftime(tchDateTime,COUNTOF(tchDateTime),tchTemplate,&sst); + } + else { + GetDateFormat(LOCALE_USER_DEFAULT,( + LOWORD(wParam) == IDM_EDIT_INSERT_SHORTDATE) ? DATE_SHORTDATE : DATE_LONGDATE, + &st,NULL,tchDate,COUNTOF(tchDate)); + GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,NULL,tchTime,COUNTOF(tchTime)); + + StringCchPrintf(tchDateTime,COUNTOF(tchDateTime),L"%s %s",tchTime,tchDate); + } + + WideCharToMultiByteStrg(Encoding_SciCP,tchDateTime,mszBuf); + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_INSERT_FILENAME: + case IDM_EDIT_INSERT_PATHNAME: + { + SHFILEINFO shfi; + WCHAR *pszInsert; + WCHAR tchUntitled[32]; + char mszBuf[MAX_PATH*3]; + //int iSelStart; + + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + if (LOWORD(wParam) == IDM_EDIT_INSERT_FILENAME) { + SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO), + SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + pszInsert = shfi.szDisplayName; + } + else + pszInsert = g_wchCurFile; + } + else { + GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); + pszInsert = tchUntitled; + } + + WideCharToMultiByteStrg(Encoding_SciCP,pszInsert,mszBuf); + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_INSERT_GUID: + { + GUID guid; + if (SUCCEEDED(CoCreateGuid(&guid))) { + WCHAR wszGuid[40]; + if (StringFromGUID2(&guid,wszGuid,COUNTOF(wszGuid))) { + WCHAR* pwszGuid = wszGuid + 1; // trim first brace char + wszGuid[wcslen(wszGuid) - 1] = L'\0'; // trim last brace char + char mszGuid[40 * 4]; // UTF-8 max of 4 bytes per char + if (WideCharToMultiByteStrg(Encoding_SciCP,pwszGuid,mszGuid)) { + int token = BeginUndoAction(); + SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszGuid); + EndUndoAction(token); + } + } + } + } + break; + + + case IDM_EDIT_LINECOMMENT: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + + switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) { + default: + case SCLEX_NULL: + case SCLEX_CSS: + case SCLEX_DIFF: + case SCLEX_MARKDOWN: + case SCLEX_JSON: + break; + case SCLEX_HTML: + case SCLEX_XML: + case SCLEX_CPP: + case SCLEX_PASCAL: + EditToggleLineComments(g_hwndEdit, L"//", false); + break; + case SCLEX_VBSCRIPT: + case SCLEX_VB: + EditToggleLineComments(g_hwndEdit, L"'", false); + break; + case SCLEX_MAKEFILE: + case SCLEX_PERL: + case SCLEX_PYTHON: + case SCLEX_CONF: + case SCLEX_BASH: + case SCLEX_TCL: + case SCLEX_RUBY: + case SCLEX_POWERSHELL: + case SCLEX_CMAKE: + case SCLEX_AVS: + case SCLEX_YAML: + case SCLEX_COFFEESCRIPT: + case SCLEX_NIMROD: + EditToggleLineComments(g_hwndEdit, L"#", true); + break; + case SCLEX_ASM: + case SCLEX_PROPERTIES: + case SCLEX_AU3: + case SCLEX_AHK: + case SCLEX_NSIS: // # could also be used instead + case SCLEX_INNOSETUP: + case SCLEX_REGISTRY: + EditToggleLineComments(g_hwndEdit, L";", true); + break; + case SCLEX_SQL: + case SCLEX_LUA: + case SCLEX_VHDL: + EditToggleLineComments(g_hwndEdit, L"--", true); + break; + case SCLEX_BATCH: + EditToggleLineComments(g_hwndEdit, L"rem ", true); + break; + case SCLEX_LATEX: + case SCLEX_MATLAB: + EditToggleLineComments(g_hwndEdit, L"%", true); + break; + } + + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_STREAMCOMMENT: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + + switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) { + default: + case SCLEX_NULL: + case SCLEX_VBSCRIPT: + case SCLEX_MAKEFILE: + case SCLEX_VB: + case SCLEX_ASM: + case SCLEX_SQL: + case SCLEX_PERL: + case SCLEX_PYTHON: + case SCLEX_PROPERTIES: + case SCLEX_CONF: + case SCLEX_POWERSHELL: + case SCLEX_BATCH: + case SCLEX_DIFF: + case SCLEX_BASH: + case SCLEX_TCL: + case SCLEX_AU3: + case SCLEX_LATEX: + case SCLEX_AHK: + case SCLEX_RUBY: + case SCLEX_CMAKE: + case SCLEX_MARKDOWN: + case SCLEX_YAML: + case SCLEX_JSON: + case SCLEX_REGISTRY: + case SCLEX_NIMROD: + break; + case SCLEX_HTML: + case SCLEX_XML: + case SCLEX_CSS: + case SCLEX_CPP: + case SCLEX_NSIS: + case SCLEX_AVS: + case SCLEX_VHDL: + EditEncloseSelection(g_hwndEdit, L"/*", L"*/"); + break; + case SCLEX_PASCAL: + case SCLEX_INNOSETUP: + EditEncloseSelection(g_hwndEdit, L"{", L"}"); + break; + case SCLEX_LUA: + EditEncloseSelection(g_hwndEdit, L"--[[", L"]]"); + break; + case SCLEX_COFFEESCRIPT: + EditEncloseSelection(g_hwndEdit, L"###", L"###"); + break; + case SCLEX_MATLAB: + EditEncloseSelection(g_hwndEdit, L"%{", L"%}"); + } + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_URLENCODE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditURLEncode(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_URLDECODE: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditURLDecode(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_ESCAPECCHARS: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditEscapeCChars(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_UNESCAPECCHARS: + { + BeginWaitCursor(NULL); + int token = BeginUndoAction(); + EditUnescapeCChars(g_hwndEdit); + EndUndoAction(token); + EndWaitCursor(); + } + break; + + + case IDM_EDIT_CHAR2HEX: + { + int token = BeginUndoAction(); + EditChar2Hex(g_hwndEdit); + EndUndoAction(token); + } + break; + + + case IDM_EDIT_HEX2CHAR: + EditHex2Char(g_hwndEdit); + break; + + + case IDM_EDIT_FINDMATCHINGBRACE: + EditFindMatchingBrace(g_hwndEdit); + break; + + + case IDM_EDIT_SELTOMATCHINGBRACE: + { + int token = BeginUndoAction(); + EditSelectToMatchingBrace(g_hwndEdit); + EndUndoAction(token); + } + break; + + + // Main Bookmark Functions + case BME_EDIT_BOOKMARKNEXT: + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + + int bitmask = (1 << MARKER_NP3_BOOKMARK); + DocLn iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERNEXT , iLine+1 , bitmask ); + if (iNextLine == (DocLn)-1) + { + iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERNEXT , 0 , bitmask ); + } + + if (iNextLine != (DocLn)-1) + { + SciCall_EnsureVisible(iNextLine); + SciCall_GotoLine(iNextLine); + SciCall_ScrollCaret(); + } + break; + } + + case BME_EDIT_BOOKMARKPREV: + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + + int bitmask = (1 << MARKER_NP3_BOOKMARK); + DocLn iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERPREVIOUS , iLine-1 , bitmask ); + if (iNextLine == (DocLn)-1) + { + iNextLine = (DocLn)SendMessage( g_hwndEdit , SCI_MARKERPREVIOUS , SciCall_GetLineCount(), bitmask ); + } + + if (iNextLine != (DocLn)-1) + { + SciCall_EnsureVisible(iNextLine); + SciCall_GotoLine(iNextLine); + SciCall_ScrollCaret(); + } + break; + } + + case BME_EDIT_BOOKMARKTOGGLE: + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + + int bitmask = SciCall_MarkerGet(iLine); + + if (bitmask & (1 << MARKER_NP3_BOOKMARK)) { + // unset + SciCall_MarkerDelete(iLine, MARKER_NP3_BOOKMARK); + } + else { + Style_SetBookmark(g_hwndEdit, g_bShowSelectionMargin); + // set + SciCall_MarkerAdd(iLine, MARKER_NP3_BOOKMARK); + UpdateLineNumberWidth(); + } + break; + } + + case BME_EDIT_BOOKMARKCLEAR: + SciCall_MarkerDeleteAll(MARKER_NP3_BOOKMARK); + break; + + + + case IDM_EDIT_FIND: + if (!IsWindow(g_hwndDlgFindReplace)) { + bFindReplCopySelOrClip = true; + g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, false); + } + else { + bFindReplCopySelOrClip = (GetForegroundWindow() != g_hwndDlgFindReplace); + if (GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE)) { + SendMessage(g_hwndDlgFindReplace, WM_COMMAND, MAKELONG(IDMSG_SWITCHTOFIND, 1), 0); + DestroyWindow(g_hwndDlgFindReplace); + g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, false); + } + else { + SetForegroundWindow(g_hwndDlgFindReplace); + PostMessage(g_hwndDlgFindReplace, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(g_hwndDlgFindReplace, IDC_FINDTEXT)), 1); + } + UpdateStatusbar(); + } + break; + + + case IDM_EDIT_REPLACE: + if (!IsWindow(g_hwndDlgFindReplace)) { + bFindReplCopySelOrClip = true; + g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, true); + } + else { + bFindReplCopySelOrClip = (GetForegroundWindow() != g_hwndDlgFindReplace); + if (!GetDlgItem(g_hwndDlgFindReplace, IDC_REPLACE)) { + SendMessage(g_hwndDlgFindReplace, WM_COMMAND, MAKELONG(IDMSG_SWITCHTOREPLACE, 1), 0); + DestroyWindow(g_hwndDlgFindReplace); + g_hwndDlgFindReplace = EditFindReplaceDlg(g_hwndEdit, &g_efrData, true); + } + else { + SetForegroundWindow(g_hwndDlgFindReplace); + PostMessage(g_hwndDlgFindReplace, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(g_hwndDlgFindReplace, IDC_FINDTEXT)), 1); + } + UpdateStatusbar(); + } + break; + + + case IDM_EDIT_FINDNEXT: + case IDM_EDIT_FINDPREV: + case IDM_EDIT_REPLACENEXT: + case IDM_EDIT_SELTONEXT: + case IDM_EDIT_SELTOPREV: + + if (SciCall_GetTextLength() == 0) + break; + + if (IsFindPatternEmpty() && !StringCchLenA(g_efrData.szFind, COUNTOF(g_efrData.szFind))) + { + if (LOWORD(wParam) != IDM_EDIT_REPLACENEXT) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_FIND,1),0); + else + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); + } + else { + + switch (LOWORD(wParam)) { + + case IDM_EDIT_FINDNEXT: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionEnd(g_hwndEdit); + } + EditFindNext(g_hwndEdit,&g_efrData,false,false); + break; + + case IDM_EDIT_FINDPREV: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionStart(g_hwndEdit); + } + EditFindPrev(g_hwndEdit,&g_efrData,false,false); + break; + + case IDM_EDIT_REPLACENEXT: + if (bReplaceInitialized) + EditReplace(g_hwndEdit,&g_efrData); + else + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); + break; + + case IDM_EDIT_SELTONEXT: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionEnd(g_hwndEdit); + } + EditFindNext(g_hwndEdit,&g_efrData,true,false); + break; + + case IDM_EDIT_SELTOPREV: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionStart(g_hwndEdit); + } + EditFindPrev(g_hwndEdit,&g_efrData,true,false); + break; + } + } + break; + + + case CMD_FINDNEXTSEL: + case CMD_FINDPREVSEL: + case IDM_EDIT_SAVEFIND: + { + DocPos cchSelection = SciCall_GetSelText(NULL); + + if (1 >= cchSelection) + { + SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_EDIT_SELECTWORD, 1), 0); + cchSelection = SciCall_GetSelText(NULL); + } + + if ((1 < cchSelection) && (cchSelection < FNDRPL_BUFFER)) + { + char mszSelection[FNDRPL_BUFFER]; + SciCall_GetSelText(mszSelection); + + // Check lpszSelection and truncate newlines + char *lpsz = StrChrA(mszSelection, '\n'); + if (lpsz) *lpsz = '\0'; + + lpsz = StrChrA(mszSelection, '\r'); + if (lpsz) *lpsz = '\0'; + + StringCchCopyA(g_efrData.szFind, COUNTOF(g_efrData.szFind), mszSelection); + g_efrData.fuFlags &= (~(SCFIND_REGEXP | SCFIND_POSIX)); + g_efrData.bTransformBS = false; + + WCHAR wszBuf[FNDRPL_BUFFER]; + MultiByteToWideCharStrg(Encoding_SciCP, mszSelection, wszBuf); + MRU_Add(g_pMRUfind, wszBuf, 0, 0, NULL); + SetFindPattern(wszBuf); + + switch (LOWORD(wParam)) { + + case IDM_EDIT_SAVEFIND: + break; + + case CMD_FINDNEXTSEL: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionEnd(g_hwndEdit); + } + EditFindNext(g_hwndEdit, &g_efrData, false, false); + break; + + case CMD_FINDPREVSEL: + if (!SciCall_IsSelectionEmpty()) { + EditJumpToSelectionStart(g_hwndEdit); + } + EditFindPrev(g_hwndEdit, &g_efrData, false, false); + break; + } + } + } + break; + + + + case IDM_EDIT_COMPLETEWORD: + EditCompleteWord(g_hwndEdit, true); + break; + + + case IDM_EDIT_GOTOLINE: + EditLinenumDlg(g_hwndEdit); + break; + + + case IDM_VIEW_SCHEME: + Style_SelectLexerDlg(g_hwndEdit); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + break; + + + case IDM_VIEW_USE2NDDEFAULT: + Style_ToggleUse2ndDefault(g_hwndEdit); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + break; + + + case IDM_VIEW_SCHEMECONFIG: + if (!IsWindow(g_hwndDlgCustomizeSchemes)) { + g_hwndDlgCustomizeSchemes = Style_CustomizeSchemesDlg(g_hwndEdit); + } + else { + SetForegroundWindow(g_hwndDlgCustomizeSchemes); + } + PostMessage(g_hwndDlgCustomizeSchemes, WM_COMMAND, MAKELONG(IDC_SETCURLEXERTV, 1), 0); + break; + + + case IDM_VIEW_FONT: + if (!IsWindow(g_hwndDlgCustomizeSchemes)) + Style_SetDefaultFont(g_hwndEdit, true); + UpdateToolbar(); + UpdateLineNumberWidth(); + break; + + case IDM_VIEW_CURRENTSCHEME: + if (!IsWindow(g_hwndDlgCustomizeSchemes)) + Style_SetDefaultFont(g_hwndEdit, false); + UpdateToolbar(); + UpdateLineNumberWidth(); + break; + + + case IDM_VIEW_WORDWRAP: + bWordWrap = (bWordWrap) ? false : true; + if (!bWordWrap) + SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0); + else + SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0); + bWordWrapG = bWordWrap; + UpdateToolbar(); + break; + + + case IDM_VIEW_WORDWRAPSETTINGS: + if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent)) { + _SetWordWrapping(g_hwndEdit); + } + break; + + + case IDM_VIEW_WORDWRAPSYMBOLS: + bShowWordWrapSymbols = (bShowWordWrapSymbols) ? false : true; + _SetWordWrapping(g_hwndEdit); + break; + + + case IDM_VIEW_LONGLINEMARKER: + bMarkLongLines = (bMarkLongLines) ? false: true; + if (bMarkLongLines) { + SendMessage(g_hwndEdit,SCI_SETEDGEMODE,(iLongLineMode == EDGE_LINE)?EDGE_LINE:EDGE_BACKGROUND,0); + Style_SetLongLineColors(g_hwndEdit); + } + else + SendMessage(g_hwndEdit,SCI_SETEDGEMODE,EDGE_NONE,0); + + UpdateToolbar(); + UpdateStatusbar(); + break; + + + case IDM_VIEW_LONGLINESETTINGS: + if (LongLineSettingsDlg(hwnd,IDD_LONGLINES,&iLongLinesLimit)) { + bMarkLongLines = true; + SendMessage(g_hwndEdit,SCI_SETEDGEMODE,(iLongLineMode == EDGE_LINE)?EDGE_LINE:EDGE_BACKGROUND,0); + Style_SetLongLineColors(g_hwndEdit); + iLongLinesLimit = max(min(iLongLinesLimit,4096),0); + SendMessage(g_hwndEdit,SCI_SETEDGECOLUMN,iLongLinesLimit,0); + iLongLinesLimitG = iLongLinesLimit; + UpdateToolbar(); + UpdateStatusbar(); + } + break; + + + case IDM_VIEW_TABSASSPACES: + g_bTabsAsSpaces = (g_bTabsAsSpaces) ? false : true; + SendMessage(g_hwndEdit,SCI_SETUSETABS,!g_bTabsAsSpaces,0); + bTabsAsSpacesG = g_bTabsAsSpaces; + break; + + + case IDM_VIEW_TABSETTINGS: + if (TabSettingsDlg(hwnd,IDD_TABSETTINGS,NULL)) + { + SendMessage(g_hwndEdit,SCI_SETUSETABS,!g_bTabsAsSpaces,0); + SendMessage(g_hwndEdit,SCI_SETTABINDENTS,g_bTabIndents,0); + SendMessage(g_hwndEdit,SCI_SETBACKSPACEUNINDENTS,bBackspaceUnindents,0); + g_iTabWidth = max(min(g_iTabWidth,256),1); + g_iIndentWidth = max(min(g_iIndentWidth,256),0); + SendMessage(g_hwndEdit,SCI_SETTABWIDTH,g_iTabWidth,0); + SendMessage(g_hwndEdit,SCI_SETINDENT,g_iIndentWidth,0); + bTabsAsSpacesG = g_bTabsAsSpaces; + bTabIndentsG = g_bTabIndents; + iTabWidthG = g_iTabWidth; + iIndentWidthG = g_iIndentWidth; + if (SendMessage(g_hwndEdit,SCI_GETWRAPINDENTMODE,0,0) == SC_WRAPINDENT_FIXED) { + int i = 0; + switch (iWordWrapIndent) { + case 1: i = 1; break; + case 2: i = 2; break; + case 3: i = (g_iIndentWidth) ? 1 * g_iIndentWidth : 1 * g_iTabWidth; break; + case 4: i = (g_iIndentWidth) ? 2 * g_iIndentWidth : 2 * g_iTabWidth; break; + } + SendMessage(g_hwndEdit,SCI_SETWRAPSTARTINDENT,i,0); + } + } + break; + + + case IDM_VIEW_SHOWINDENTGUIDES: + bShowIndentGuides = (bShowIndentGuides) ? false : true; + Style_SetIndentGuides(g_hwndEdit,bShowIndentGuides); + break; + + + case IDM_VIEW_AUTOINDENTTEXT: + bAutoIndent = (bAutoIndent) ? false : true; + break; + + + case IDM_VIEW_LINENUMBERS: + bShowLineNumbers = (bShowLineNumbers) ? false : true; + UpdateLineNumberWidth(); + break; + + + case IDM_VIEW_MARGIN: + g_bShowSelectionMargin = (g_bShowSelectionMargin) ? false : true; + Style_SetBookmark(g_hwndEdit, g_bShowSelectionMargin); + UpdateLineNumberWidth(); + break; + + case IDM_VIEW_AUTOCOMPLETEWORDS: + bAutoCompleteWords = (bAutoCompleteWords) ? false : true; // toggle + if (!bAutoCompleteWords) + SendMessage(g_hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list + break; + + case IDM_VIEW_ACCELWORDNAV: + bAccelWordNavigation = (bAccelWordNavigation) ? false : true; // toggle + EditSetAccelWordNav(g_hwndEdit,bAccelWordNavigation); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + break; + + case IDM_VIEW_MARKOCCUR_ONOFF: + g_iMarkOccurrences = (g_iMarkOccurrences == 0) ? max(1, IniGetInt(L"Settings", L"MarkOccurrences", 1)) : 0; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(0); + EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible); + break; + + case IDM_VIEW_MARKOCCUR_VISIBLE: + g_bMarkOccurrencesMatchVisible = (g_bMarkOccurrencesMatchVisible) ? false : true; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(0); + EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible); + break; + + case IDM_VIEW_TOGGLE_VIEW: + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(0); + } + else { + EditToggleView(g_hwndEdit, true); + } + break; + + case IDM_VIEW_MARKOCCUR_CASE: + bMarkOccurrencesMatchCase = (bMarkOccurrencesMatchCase) ? false : true; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + break; + + case IDM_VIEW_MARKOCCUR_WNONE: + bMarkOccurrencesMatchWords = false; + bMarkOccurrencesCurrentWord = false; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + break; + + case IDM_VIEW_MARKOCCUR_WORD: + bMarkOccurrencesMatchWords = true; + bMarkOccurrencesCurrentWord = false; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + break; + + case IDM_VIEW_MARKOCCUR_CURRENT: + bMarkOccurrencesMatchWords = false; + bMarkOccurrencesCurrentWord = true; + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + break; + + case IDM_VIEW_FOLDING: + g_bShowCodeFolding = (g_bShowCodeFolding) ? false : true; + Style_SetFolding(g_hwndEdit, g_bShowCodeFolding); + if (!g_bShowCodeFolding) { EditFoldToggleAll(EXPAND); } + UpdateToolbar(); + break; + + + case IDM_VIEW_TOGGLEFOLDS: + EditFoldToggleAll(SNIFF); + break; + + + case IDM_VIEW_SHOWWHITESPACE: + bViewWhiteSpace = (bViewWhiteSpace) ? false : true; + SendMessage(g_hwndEdit,SCI_SETVIEWWS,(bViewWhiteSpace)?SCWS_VISIBLEALWAYS:SCWS_INVISIBLE,0); + break; + + + case IDM_VIEW_SHOWEOLS: + bViewEOLs = (bViewEOLs) ? false : true; + SendMessage(g_hwndEdit,SCI_SETVIEWEOL,bViewEOLs,0); + break; + + + case IDM_VIEW_MATCHBRACES: + bMatchBraces = (bMatchBraces) ? false : true; + if (bMatchBraces) + EditMatchBrace(g_hwndEdit); + else + SendMessage(g_hwndEdit,SCI_BRACEHIGHLIGHT,(WPARAM)-1,(LPARAM)-1); + break; + + + case IDM_VIEW_AUTOCLOSETAGS: + bAutoCloseTags = (bAutoCloseTags) ? false : true; + break; + + case IDM_VIEW_HILITECURRENTLINE: + bHiliteCurrentLine = (bHiliteCurrentLine) ? false : true; + Style_SetCurrentLineBackground(g_hwndEdit, bHiliteCurrentLine); + break; + + case IDM_VIEW_HYPERLINKHOTSPOTS: + g_bHyperlinkHotspot = (g_bHyperlinkHotspot) ? false : true; + Style_SetUrlHotSpot(g_hwndEdit, g_bHyperlinkHotspot); + if (g_bHyperlinkHotspot) { + UpdateVisibleUrlHotspot(0); + } + else { + SciCall_StartStyling(0); + Style_ResetCurrentLexer(g_hwndEdit); + } + break; + + case IDM_VIEW_ZOOMIN: + SendMessage(g_hwndEdit,SCI_ZOOMIN,0,0); + UpdateLineNumberWidth(); + break; + + case IDM_VIEW_ZOOMOUT: + SendMessage(g_hwndEdit,SCI_ZOOMOUT,0,0); + UpdateLineNumberWidth(); + break; + + case IDM_VIEW_RESETZOOM: + SendMessage(g_hwndEdit,SCI_SETZOOM,0,0); + UpdateLineNumberWidth(); + break; + + + case IDM_VIEW_SCROLLPASTEOF: + bScrollPastEOF = (bScrollPastEOF) ? false : true; + SciCall_SetEndAtLastLine(!bScrollPastEOF); + break; + + case IDM_VIEW_TOOLBAR: + if (bShowToolbar) { + bShowToolbar = 0; + ShowWindow(hwndReBar,SW_HIDE); + } + else { + bShowToolbar = 1; + UpdateToolbar(); + ShowWindow(hwndReBar,SW_SHOW); + } + SendWMSize(hwnd); + break; + + + case IDM_VIEW_CUSTOMIZETB: + SendMessage(g_hwndToolbar,TB_CUSTOMIZE,0,0); + break; + + + case IDM_VIEW_STATUSBAR: + if (bShowStatusbar) { + bShowStatusbar = 0; + ShowWindow(g_hwndStatus,SW_HIDE); + } + else { + bShowStatusbar = 1; + UpdateStatusbar(); + ShowWindow(g_hwndStatus,SW_SHOW); + } + SendWMSize(hwnd); + break; + + + case IDM_VIEW_STICKYWINPOS: + bStickyWinPos = IniGetInt(L"Settings2",L"StickyWindowPosition",bStickyWinPos); + if (!bStickyWinPos) + { + WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; + + int ResX = GetSystemMetrics(SM_CXSCREEN); + int ResY = GetSystemMetrics(SM_CYSCREEN); + + StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); + StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); + StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); + StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); + StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); + + bStickyWinPos = 1; + IniSetInt(L"Settings2",L"StickyWindowPosition",1); + + // GetWindowPlacement + WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); + IniSetInt(L"Window",tchPosX,wi.x); + IniSetInt(L"Window",tchPosY,wi.y); + IniSetInt(L"Window",tchSizeX,wi.cx); + IniSetInt(L"Window",tchSizeY,wi.cy); + IniSetInt(L"Window",tchMaximized,wi.max); + + InfoBox(0,L"MsgStickyWinPos",IDS_STICKYWINPOS); + } + else { + bStickyWinPos = 0; + IniSetInt(L"Settings2",L"StickyWindowPosition",0); + } + break; + + + case IDM_VIEW_REUSEWINDOW: + if (IniGetInt(L"Settings2",L"ReuseWindow",0)) + IniSetInt(L"Settings2",L"ReuseWindow",0); + else + IniSetInt(L"Settings2",L"ReuseWindow",1); + break; + + + case IDM_VIEW_SINGLEFILEINSTANCE: + if (IniGetInt(L"Settings2",L"SingleFileInstance",0)) + IniSetInt(L"Settings2",L"SingleFileInstance",0); + else + IniSetInt(L"Settings2",L"SingleFileInstance",1); + break; + + + case IDM_VIEW_ALWAYSONTOP: + if ((bAlwaysOnTop || flagAlwaysOnTop == 2) && flagAlwaysOnTop != 1) { + bAlwaysOnTop = 0; + flagAlwaysOnTop = 0; + SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + } + else { + bAlwaysOnTop = 1; + flagAlwaysOnTop = 0; + SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + } + break; + + + case IDM_VIEW_MINTOTRAY: + bMinimizeToTray =(bMinimizeToTray) ? false : true; + break; + + + case IDM_VIEW_TRANSPARENT: + bTransparentMode =(bTransparentMode) ? false : true; + SetWindowTransparentMode(hwnd,bTransparentMode); + break; + + + case IDM_VIEW_SHOWFILENAMEONLY: + iPathNameFormat = 0; + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + UpdateToolbar(); + break; + + + case IDM_VIEW_SHOWFILENAMEFIRST: + iPathNameFormat = 1; + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + UpdateToolbar(); + break; + + + case IDM_VIEW_SHOWFULLPATH: + iPathNameFormat = 2; + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + UpdateToolbar(); + break; + + + case IDM_VIEW_SHOWEXCERPT: + EditGetExcerpt(g_hwndEdit,szTitleExcerpt,COUNTOF(szTitleExcerpt)); + UpdateToolbar(); + break; + + + case IDM_VIEW_NOSAVERECENT: + bSaveRecentFiles = (bSaveRecentFiles) ? false : true; + break; + + + case IDM_VIEW_NOPRESERVECARET: + bPreserveCaretPos = (bPreserveCaretPos) ? false : true; + break; + + + case IDM_VIEW_NOSAVEFINDREPL: + bSaveFindReplace = (bSaveFindReplace) ? false : true; + break; + + + case IDM_VIEW_SAVEBEFORERUNNINGTOOLS: + bSaveBeforeRunningTools = (bSaveBeforeRunningTools) ? false : true; + break; + + + case IDM_VIEW_CHANGENOTIFY: + if (ChangeNotifyDlg(hwnd)) + InstallFileWatching(g_wchCurFile); + break; + + + case IDM_VIEW_NOESCFUNC: + iEscFunction = 0; + break; + + + case IDM_VIEW_ESCMINIMIZE: + iEscFunction = 1; + break; + + + case IDM_VIEW_ESCEXIT: + iEscFunction = 2; + break; + + + case IDM_VIEW_SAVESETTINGS: + if (IsCmdEnabled(hwnd, IDM_VIEW_SAVESETTINGS)) + bSaveSettings = (bSaveSettings) ? false : true; + break; + + + case IDM_VIEW_SAVESETTINGSNOW: + if (IsCmdEnabled(hwnd, IDM_VIEW_SAVESETTINGSNOW)) { + + bool bCreateFailure = false; + + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) == 0) { + + if (StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0) { + if (CreateIniFileEx(g_wchIniFile2)) { + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),g_wchIniFile2); + StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),L""); + } + else + bCreateFailure = true; + } + + else + break; + } + + if (!bCreateFailure) { + + if (WritePrivateProfileString(L"Settings",L"WriteTest",L"ok",g_wchIniFile)) { + + BeginWaitCursorID(IDS_SAVINGSETTINGS); + SaveSettings(true); + EndWaitCursor(); + MsgBox(MBINFO,IDS_SAVEDSETTINGS); + } + else { + dwLastIOError = GetLastError(); + MsgBox(MBWARN,IDS_WRITEINI_FAIL); + } + } + else + MsgBox(MBWARN,IDS_CREATEINI_FAIL); + } + break; + + + case IDM_HELP_ONLINEDOCUMENTATION: + ShellExecute(0, 0, ONLINE_HELP_WEBSITE, 0, 0, SW_SHOW); + break; + + case IDM_HELP_ABOUT: + ThemedDialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc); + break; + + case IDM_SETPASS: + if (GetFileKey(g_hwndEdit)) { + _SetDocumentModified(true); + } + break; + + case IDM_HELP_CMD: + DisplayCmdLineHelp(hwnd); + break; + + case CMD_ESCAPE: + //close the autocomplete box + SendMessage(g_hwndEdit,SCI_AUTOCCANCEL,0, 0); + + if (iEscFunction == 1) + SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0); + else if (iEscFunction == 2) + SendMessage(hwnd,WM_CLOSE,0,0); + break; + + + case CMD_SHIFTESC: + if (FileSave(true,false,false,false)) + SendMessage(hwnd,WM_CLOSE,0,0); + break; + + + case CMD_CTRLENTER: + { + int token = BeginUndoAction(); + const DocPos iPos = SciCall_GetCurrentPos(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + if (iLine <= 0) { + SciCall_GotoLine(0); + SciCall_NewLine(); + SciCall_GotoLine(0); + } + else { + SciCall_GotoPos(SciCall_GetLineEndPosition(iLine - 1)); + SciCall_NewLine(); + } + EndUndoAction(token); + } + break; + + + // Newline with toggled auto indent setting + case CMD_SHIFTCTRLENTER: + bAutoIndent = (bAutoIndent) ? 0 : 1; + SciCall_NewLine(); + bAutoIndent = (bAutoIndent) ? 0 : 1; + break; + + + case IDM_EDIT_CLEAR: + case CMD_DEL: + { + int token = BeginUndoAction(); + SciCall_Clear(); + EndUndoAction(token); + } + break; + + + case CMD_CTRLLEFT: + SendMessage(g_hwndEdit, SCI_WORDLEFT, 0, 0); + break; + + + case CMD_CTRLRIGHT: + SendMessage(g_hwndEdit, SCI_WORDRIGHT, 0, 0); + break; + + + case CMD_CTRLBACK: + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocPos iAnchor = SciCall_GetAnchor(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + const DocPos iStartPos = SciCall_PositionFromLine(iLine); + const DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine); + + if (iPos != iAnchor) { + int token = BeginUndoAction(); + SciCall_SetSel(iPos, iPos); + EndUndoAction(token); + } + else { + if (iPos == iStartPos) + Sci_SendMsgV0(DELETEBACK); + else if (iPos <= iIndentPos) + Sci_SendMsgV0(DELLINELEFT); + else + Sci_SendMsgV0(DELWORDLEFT); + } + } + break; + + + case CMD_CTRLDEL: + { + const DocPos iPos = SciCall_GetCurrentPos(); + const DocPos iAnchor = SciCall_GetAnchor(); + const DocLn iLine = SciCall_LineFromPosition(iPos); + const DocPos iStartPos = SciCall_PositionFromLine(iLine); + const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); + + if (iPos != iAnchor) { + int token = BeginUndoAction(); + SciCall_SetSel(iPos, iPos); + EndUndoAction(token); + } + else { + if (iStartPos != iEndPos) + Sci_SendMsgV0(DELWORDRIGHT); + else // iStartPos == iEndPos + Sci_SendMsgV0(LINEDELETE); + } + } + break; + + + case CMD_RECODEDEFAULT: + { + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + Encoding_SrcCmdLn(Encoding_MapUnicode(g_iDefaultNewFileEncoding)); + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + FileLoad(false,false,true,true,true,tchCurFile2); + } + } + break; + + + case CMD_RECODEANSI: + { + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + Encoding_SrcCmdLn(CPI_ANSI_DEFAULT); + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + FileLoad(false,false,true,true,bSkipANSICodePageDetection,tchCurFile2); + } + } + break; + + + case CMD_RECODEOEM: + { + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + Encoding_SrcCmdLn(CPI_OEM); + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + FileLoad(false,false,true,true,true,tchCurFile2); + } + } + break; + + + case CMD_RELOADASCIIASUTF8: + { + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + bool _bLoadASCIIasUTF8 = bLoadASCIIasUTF8; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + bLoadASCIIasUTF8 = 1; + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + FileLoad(false,false,true,false,true,tchCurFile2); + bLoadASCIIasUTF8 = _bLoadASCIIasUTF8; + } + } + break; + + + case CMD_RELOADNOFILEVARS: + { + WCHAR tchCurFile2[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + int _fNoFileVariables = flagNoFileVariables; + bool _bNoEncodingTags = bNoEncodingTags; + flagNoFileVariables = 1; + bNoEncodingTags = 1; + StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile); + FileLoad(false,false,true, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchCurFile2); + flagNoFileVariables = _fNoFileVariables; + bNoEncodingTags = _bNoEncodingTags; + } + } + break; + + + case CMD_LEXDEFAULT: + Style_SetDefaultLexer(g_hwndEdit); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + break; + + + case CMD_LEXHTML: + Style_SetHTMLLexer(g_hwndEdit); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + break; + + + case CMD_LEXXML: + Style_SetXMLLexer(g_hwndEdit); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + break; + + + case CMD_TIMESTAMPS: + { + WCHAR wchFind[256] = { L'\0' }; + WCHAR wchTemplate[256] = { L'\0' }; + WCHAR wchReplace[256] = { L'\0' }; + + SYSTEMTIME st; + struct tm sst; + + EDITFINDREPLACE efrTS = EFR_INIT_DATA; + efrTS.hwnd = g_hwndEdit; + efrTS.fuFlags = SCFIND_REGEXP; + + IniGetString(L"Settings2",L"TimeStamp",L"\\$Date:[^\\$]+\\$ | $Date: %Y/%m/%d %H:%M:%S $",wchFind,COUNTOF(wchFind)); + + WCHAR *pwchSep = StrChr(wchFind, L'|'); + if (pwchSep) { + StringCchCopy(wchTemplate,COUNTOF(wchTemplate),pwchSep + 1); + *pwchSep = 0; + } + + StrTrim(wchFind,L" "); + StrTrim(wchTemplate,L" "); + + if (StringCchLenW(wchFind,COUNTOF(wchFind)) == 0 || StringCchLenW(wchTemplate,COUNTOF(wchTemplate)) == 0) + break; + + GetLocalTime(&st); + sst.tm_isdst = -1; + sst.tm_sec = (int)st.wSecond; + sst.tm_min = (int)st.wMinute; + sst.tm_hour = (int)st.wHour; + sst.tm_mday = (int)st.wDay; + sst.tm_mon = (int)st.wMonth - 1; + sst.tm_year = (int)st.wYear - 1900; + sst.tm_wday = (int)st.wDayOfWeek; + mktime(&sst); + wcsftime(wchReplace,COUNTOF(wchReplace),wchTemplate,&sst); + + WideCharToMultiByteStrg(Encoding_SciCP,wchFind,efrTS.szFind); + WideCharToMultiByteStrg(Encoding_SciCP,wchReplace,efrTS.szReplace); + + if (!SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) + EditReplaceAllInSelection(g_hwndEdit, &efrTS, true); + else + EditReplaceAll(g_hwndEdit,&efrTS,true); + } + break; + + + case IDM_HELP_UPDATEINSTALLER: + DialogUpdateCheck(hwnd, true); + break; + + case IDM_HELP_UPDATEWEBSITE: + DialogUpdateCheck(hwnd, false); + break; + + case CMD_WEBACTION1: + case CMD_WEBACTION2: + { + WCHAR szCmdTemplate[256] = { L'\0' }; + + LPWSTR lpszTemplateName = (LOWORD(wParam) == CMD_WEBACTION1) ? L"WebTemplate1" : L"WebTemplate2"; + + bool bCmdEnabled = IniGetString(L"Settings2",lpszTemplateName,L"",szCmdTemplate,COUNTOF(szCmdTemplate)); + + if (bCmdEnabled) { + + const DocPos cchSelection = SciCall_GetSelText(NULL); + + char mszSelection[512] = { '\0' }; + if ((1 < cchSelection) && (cchSelection < (DocPos)COUNTOF(mszSelection))) + { + SciCall_GetSelText(mszSelection); + + // Check lpszSelection and truncate bad WCHARs + char* lpsz = StrChrA(mszSelection,13); + if (lpsz) *lpsz = '\0'; + + lpsz = StrChrA(mszSelection,10); + if (lpsz) *lpsz = '\0'; + + lpsz = StrChrA(mszSelection,9); + if (lpsz) *lpsz = '\0'; + + if (StringCchLenA(mszSelection,COUNTOF(mszSelection))) { + + WCHAR wszSelection[512] = { L'\0' }; + MultiByteToWideCharStrg(Encoding_SciCP,mszSelection,wszSelection); + + int cmdsz = (512 + COUNTOF(szCmdTemplate) + MAX_PATH + 32); + LPWSTR lpszCommand = AllocMem(sizeof(WCHAR)*cmdsz, HEAP_ZERO_MEMORY); + StringCchPrintf(lpszCommand,cmdsz,szCmdTemplate,wszSelection); + ExpandEnvironmentStringsEx(lpszCommand, cmdsz); + + WCHAR wchDirectory[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + StringCchCopy(wchDirectory,COUNTOF(wchDirectory),g_wchCurFile); + PathRemoveFileSpec(wchDirectory); + } + + SHELLEXECUTEINFO sei; + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = SEE_MASK_NOZONECHECKS; + sei.hwnd = NULL; + sei.lpVerb = NULL; + sei.lpFile = lpszCommand; + sei.lpParameters = NULL; + sei.lpDirectory = wchDirectory; + sei.nShow = SW_SHOWNORMAL; + ShellExecuteEx(&sei); + + FreeMem(lpszCommand); + } + } + } + } + break; + + + case CMD_INCLINELIMIT: + case CMD_DECLINELIMIT: + if (!bMarkLongLines) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_LONGLINEMARKER,1),0); + else { + if (LOWORD(wParam) == CMD_INCLINELIMIT) + iLongLinesLimit++; + else + iLongLinesLimit--; + iLongLinesLimit = max(min(iLongLinesLimit,4096),0); + SendMessage(g_hwndEdit,SCI_SETEDGECOLUMN,iLongLinesLimit,0); + UpdateToolbar(); + UpdateStatusbar(); + iLongLinesLimitG = iLongLinesLimit; + } + break; + + case CMD_STRINGIFY: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"'", L"'"); + EndUndoAction(token); + } + break; + + + case CMD_STRINGIFY2: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"\"", L"\""); + EndUndoAction(token); + } + break; + + + case CMD_EMBRACE: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"(", L")"); + EndUndoAction(token); + } + break; + + + case CMD_EMBRACE2: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"[", L"]"); + EndUndoAction(token); + } + break; + + + case CMD_EMBRACE3: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"{", L"}"); + EndUndoAction(token); + } + break; + + + case CMD_EMBRACE4: + { + int token = BeginUndoAction(); + EditEncloseSelection(g_hwndEdit, L"`", L"`"); + EndUndoAction(token); + } + break; + + + case CMD_INCREASENUM: + EditModifyNumber(g_hwndEdit,true); + break; + + + case CMD_DECREASENUM: + EditModifyNumber(g_hwndEdit,false); + break; + + + case CMD_TOGGLETITLE: + EditGetExcerpt(g_hwndEdit,szTitleExcerpt,COUNTOF(szTitleExcerpt)); + UpdateToolbar(); + break; + + + case CMD_JUMP2SELSTART: + EditJumpToSelectionStart(g_hwndEdit); + SciCall_ChooseCaretX(); + break; + + case CMD_JUMP2SELEND: + EditJumpToSelectionEnd(g_hwndEdit); + SciCall_ChooseCaretX(); + break; + + + case CMD_COPYPATHNAME: { + + WCHAR *pszCopy; + WCHAR tchUntitled[32] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + pszCopy = g_wchCurFile; + else { + GetString(IDS_UNTITLED,tchUntitled,COUNTOF(tchUntitled)); + pszCopy = tchUntitled; + } + SetClipboardTextW(hwnd, pszCopy); + UpdateToolbar(); + } + break; + + + case CMD_COPYWINPOS: { + + WCHAR wszWinPos[MIDSZ_BUFFER]; + WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); + StringCchPrintf(wszWinPos,COUNTOF(wszWinPos),L"/pos %i,%i,%i,%i,%i",wi.x,wi.y,wi.cx,wi.cy,wi.max); + SetClipboardTextW(hwnd, wszWinPos); + UpdateToolbar(); + } + break; + + + case CMD_DEFAULTWINPOS: + SnapToDefaultPos(hwnd); + break; + + + case CMD_OPENINIFILE: + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile))) { + CreateIniFile(); + FileLoad(false,false,false,false,true,g_wchIniFile); + } + break; + + + case CMD_OPEN_HYPERLINK: + OpenHotSpotURL(SciCall_GetCurrentPos(), false); + break; + + + case CMD_ALTDOWN: + EditFoldAltArrow(DOWN, SNIFF); + break; + + case CMD_ALTUP: + EditFoldAltArrow(UP, SNIFF); + break; + + case CMD_ALTLEFT: + EditFoldAltArrow(NONE, FOLD); + break; + + case CMD_ALTRIGHT: + EditFoldAltArrow(NONE, EXPAND); + break; + + + case IDT_FILE_NEW: + if (IsCmdEnabled(hwnd,IDM_FILE_NEW)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_NEW,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_OPEN: + if (IsCmdEnabled(hwnd,IDM_FILE_OPEN)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_OPEN,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_BROWSE: + if (IsCmdEnabled(hwnd,IDM_FILE_BROWSE)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_BROWSE,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_SAVE: + if (IsCmdEnabled(hwnd,IDM_FILE_SAVE)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVE,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_UNDO: + if (IsCmdEnabled(hwnd,IDM_EDIT_UNDO)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_UNDO,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_REDO: + if (IsCmdEnabled(hwnd,IDM_EDIT_REDO)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REDO,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_CUT: + if (IsCmdEnabled(hwnd,IDM_EDIT_CUT)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CUT,1),0); + else + MessageBeep(0); + //SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CUTLINE,1),0); + break; + + + case IDT_EDIT_COPY: + if (IsCmdEnabled(hwnd,IDM_EDIT_COPY)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_COPY,1),0); + else + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_COPYALL,1),0); // different to Keyboard-Shortcut + break; + + + case IDT_EDIT_PASTE: + if (IsCmdEnabled(hwnd,IDM_EDIT_PASTE)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_PASTE,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_FIND: + if (IsCmdEnabled(hwnd,IDM_EDIT_FIND)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_FIND,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_REPLACE: + if (IsCmdEnabled(hwnd,IDM_EDIT_REPLACE)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_REPLACE,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_WORDWRAP: + if (IsCmdEnabled(hwnd,IDM_VIEW_WORDWRAP)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_WORDWRAP,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_ZOOMIN: + if (IsCmdEnabled(hwnd,IDM_VIEW_ZOOMIN)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_ZOOMIN,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_ZOOMOUT: + if (IsCmdEnabled(hwnd,IDM_VIEW_ZOOMOUT)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_ZOOMOUT,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_SCHEME: + if (IsCmdEnabled(hwnd,IDM_VIEW_SCHEME)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_SCHEME,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_SCHEMECONFIG: + if (IsCmdEnabled(hwnd,IDM_VIEW_SCHEMECONFIG)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_SCHEMECONFIG,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_EXIT: + SendMessage(hwnd,WM_CLOSE,0,0); + break; + + + case IDT_FILE_SAVEAS: + if (IsCmdEnabled(hwnd,IDM_FILE_SAVEAS)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVEAS,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_SAVECOPY: + if (IsCmdEnabled(hwnd,IDM_FILE_SAVECOPY)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_SAVECOPY,1),0); + else + MessageBeep(0); + break; + + + case IDT_EDIT_CLEAR: + if (IsCmdEnabled(hwnd,IDM_EDIT_CLEAR)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_EDIT_CLEAR,1),0); + else + SendMessage(g_hwndEdit,SCI_CLEARALL,0,0); + break; + + + case IDT_FILE_PRINT: + if (IsCmdEnabled(hwnd,IDM_FILE_PRINT)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_PRINT,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_OPENFAV: + if (IsCmdEnabled(hwnd,IDM_FILE_OPENFAV)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_OPENFAV,1),0); + else + MessageBeep(0); + break; + + + case IDT_FILE_ADDTOFAV: + if (IsCmdEnabled(hwnd,IDM_FILE_ADDTOFAV)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_ADDTOFAV,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_TOGGLEFOLDS: + if (IsCmdEnabled(hwnd,IDM_VIEW_TOGGLEFOLDS)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_TOGGLEFOLDS,1),0); + else + MessageBeep(0); + break; + + + case IDT_VIEW_TOGGLE_VIEW: + if (IsCmdEnabled(hwnd, IDM_VIEW_TOGGLE_VIEW)) + SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_TOGGLE_VIEW, 1), 0); + else + MessageBeep(0); + break; + + + case IDT_FILE_LAUNCH: + if (IsCmdEnabled(hwnd,IDM_FILE_LAUNCH)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_LAUNCH,1),0); + else + MessageBeep(0); + break; + + } + + UNUSED(wParam); + UNUSED(lParam); + + return(0); +} + + +//============================================================================= +// +// OpenHotSpotURL() +// +// +void OpenHotSpotURL(DocPos position, bool bForceBrowser) +{ + int iStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, position, 0); + + if (Style_GetHotspotStyleID() != iStyle) + return; + + if (!(bool)SendMessage(g_hwndEdit, SCI_STYLEGETHOTSPOT, Style_GetHotspotStyleID(), 0)) + return; + + // get left most position of style + DocPos pos = position; + int iNewStyle = iStyle; + while ((iNewStyle == iStyle) && (--pos > 0)) { + iNewStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, pos, 0); + } + DocPos firstPos = (pos != 0) ? (pos + 1) : 0; + + // get right most position of style + pos = position; + iNewStyle = iStyle; + DocPos posTextLength = SciCall_GetTextLength(); + while ((iNewStyle == iStyle) && (++pos < posTextLength)) { + iNewStyle = (int)SendMessage(g_hwndEdit, SCI_GETSTYLEAT, pos, 0); + } + DocPos lastPos = pos; + DocPos length = (lastPos - firstPos); + + if ((length > 0) && (length < XHUGE_BUFFER)) + { + char chURL[XHUGE_BUFFER] = { '\0' }; + + StringCchCopyNA(chURL, XHUGE_BUFFER, SciCall_GetRangePointer(firstPos, length), length); + StrTrimA(chURL, " \t\n\r"); + + if (!StringCchLenA(chURL, COUNTOF(chURL))) { return; } + + WCHAR wchURL[HUGE_BUFFER] = { L'\0' }; + MultiByteToWideCharStrg(Encoding_SciCP, chURL, wchURL); + + const WCHAR* chkPreFix = L"file://"; + const int len = lstrlen(chkPreFix); + + if (!bForceBrowser && (StrStrIW(wchURL, chkPreFix) == wchURL)) + { + WCHAR* szFileName = &(wchURL[len]); + StrTrimW(szFileName, L"/"); + + PathCanonicalizeEx(szFileName, COUNTOF(wchURL) - len); + + if (PathIsDirectory(szFileName)) + { + WCHAR tchFile[MAX_PATH + 1] = { L'\0' }; + + if (OpenFileDlg(g_hwndMain, tchFile, COUNTOF(tchFile), szFileName)) + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, tchFile); + } + else + FileLoad(false, false, false, bSkipUnicodeDetection, bSkipANSICodePageDetection, szFileName); + + } + else { // open in web browser + + WCHAR wchDirectory[MAX_PATH+1] = { L'\0' }; + if (StringCchLenW(g_wchCurFile, COUNTOF(g_wchCurFile))) { + StringCchCopy(wchDirectory, COUNTOF(wchDirectory), g_wchCurFile); + PathRemoveFileSpec(wchDirectory); + } + + SHELLEXECUTEINFO sei; + ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = SEE_MASK_NOZONECHECKS; + sei.hwnd = NULL; + sei.lpVerb = NULL; + sei.lpFile = wchURL; + sei.lpParameters = NULL; + sei.lpDirectory = wchDirectory; + sei.nShow = SW_SHOWNORMAL; + ShellExecuteEx(&sei); + + } + + } +} + + + +//============================================================================= +// +// MsgNotify() - Handles WM_NOTIFY +// +// +LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) +{ + LPNMHDR pnmh = (LPNMHDR)lParam; + struct SCNotification* scn = (struct SCNotification*)lParam; + + if (!CheckNotifyChangeEvent()) + { + // --- check only mandatory events (must be fast !!!) --- + if (pnmh->idFrom == IDC_EDIT) { + if (pnmh->code == SCN_MODIFIED) { + // check for ADDUNDOACTION step + if (scn->modificationType & SC_MOD_CONTAINER) + { + if (scn->modificationType & SC_PERFORMED_UNDO) { + RestoreAction(scn->token, UNDO); + } + else if (scn->modificationType & SC_PERFORMED_REDO) { + RestoreAction(scn->token, REDO); + } + } + _SetDocumentModified(true); + return true; + } + else if (pnmh->code == SCN_SAVEPOINTREACHED) { + _SetDocumentModified(false); + return true; + } + else if (pnmh->code == SCN_SAVEPOINTLEFT) { + _SetDocumentModified(true); + return true; + } + else if (pnmh->code == SCN_MODIFYATTEMPTRO) { + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + } + return true; + } + } + return false; + } + + switch(pnmh->idFrom) + { + case IDC_EDIT: + + switch (pnmh->code) + { + case SCN_HOTSPOTCLICK: + { + if (scn->modifiers & SCMOD_CTRL) { + // open in browser + OpenHotSpotURL((int)scn->position, true); + } + if (scn->modifiers & SCMOD_ALT) { + // open in application, if applicable (file://) + OpenHotSpotURL((int)scn->position, false); + } + } + break; + + + //case SCN_STYLENEEDED: // this event needs SCI_SETLEXER(SCLEX_CONTAINER) + // { + // int lineNumber = SciCall_LineFromPosition(SciCall_GetEndStyled()); + // EditUpdateUrlHotspots(g_hwndEdit, SciCall_PositionFromLine(lineNumber), (int)scn->position, bHyperlinkHotspot); + // EditUpdateHiddenLineRange(hwnd, &g_efrData, 0, SciCall_GetLineCount()); + // } + // break; + + case SCN_UPDATEUI: + + //if (scn->updated & SC_UPDATE_NP3_INTERNAL_NOTIFY) { + // // special case + //} + //else + + if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) + { + //~InvalidateSelections(); // fixed in SCI ? + + // Brace Match + if (bMatchBraces) { + EditMatchBrace(g_hwndEdit); + } + + if (g_iMarkOccurrences > 0) { + // clear marks only, if selection changed + if (scn->updated & SC_UPDATE_SELECTION) { + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + if (!SciCall_IsSelectionEmpty()) { + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + } + } + else if (scn->updated & SC_UPDATE_CONTENT) { + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + } + //else { + // //MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + //} + } + + if (g_bHyperlinkHotspot) { + UpdateVisibleUrlHotspot(iUpdateDelayHyperlinkStyling); + } + UpdateToolbar(); + UpdateStatusbar(); + } + else if (scn->updated & SC_UPDATE_V_SCROLL) + { + if ((g_iMarkOccurrences > 0) && g_bMarkOccurrencesMatchVisible) { + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + } + if (g_bHyperlinkHotspot) { + UpdateVisibleUrlHotspot(iUpdateDelayHyperlinkStyling); + } + } + break; + + + case SCN_MODIFIED: + { + // check for ADDUNDOACTION step + if (scn->modificationType & SC_MOD_CONTAINER) { + if (scn->modificationType & SC_PERFORMED_UNDO) { + RestoreAction(scn->token, UNDO); + } + else if (scn->modificationType & SC_PERFORMED_REDO) { + RestoreAction(scn->token, REDO); + } + } + else if (scn->modificationType & SC_MOD_CHANGESTYLE) { + const DocPos iStartPos = (DocPos)scn->position; + const DocPos iEndPos = (DocPos)(scn->position + scn->length); + EditUpdateUrlHotspots(g_hwndEdit, iStartPos, iEndPos, g_bHyperlinkHotspot); + } + + if (g_iMarkOccurrences > 0) { + EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1); + MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + } + + if (scn->linesAdded != 0) { + UpdateLineNumberWidth(); + } + + _SetDocumentModified(true); + + UpdateToolbar(); + UpdateStatusbar(); + } + break; + + + case SCN_CHARADDED: + { + // Auto indent + if (bAutoIndent && (scn->ch == '\x0D' || scn->ch == '\x0A')) + { + // in CRLF mode handle LF only... + if ((SC_EOL_CRLF == g_iEOLMode && scn->ch != '\x0A') || SC_EOL_CRLF != g_iEOLMode) + { + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocLn iCurLine = SciCall_LineFromPosition(iCurPos); + + // Move bookmark along with line if inserting lines (pressing return within indent area of line) because Scintilla does not do this for us + if (iCurLine > 0) + { + //const DocPos iPrevLineLength = Sci_GetNetLineLength(iCurLine - 1); + if (SciCall_GetLineEndPosition(iCurLine - 1) == SciCall_GetLineIndentPosition(iCurLine - 1)) + { + int bitmask = SciCall_MarkerGet(iCurLine - 1); + if (bitmask & (1 << MARKER_NP3_BOOKMARK)) + { + SciCall_MarkerDelete(iCurLine - 1, MARKER_NP3_BOOKMARK); + SciCall_MarkerAdd(iCurLine, MARKER_NP3_BOOKMARK); + } + } + } + + if (iCurLine > 0/* && iLineLength <= 2*/) + { + const DocPos iPrevLineLength = SciCall_LineLength(iCurLine - 1); + char* pLineBuf = NULL; + bool bAllocLnBuf = false; + if (iPrevLineLength < TEMPLINE_BUFFER) { + pLineBuf = g_pTempLineBufferMain; + } + else { + bAllocLnBuf = true; + pLineBuf = AllocMem(iPrevLineLength + 1, HEAP_ZERO_MEMORY); + } + if (pLineBuf) + { + SendMessage(g_hwndEdit, SCI_GETLINE, iCurLine - 1, (LPARAM)pLineBuf); + *(pLineBuf + iPrevLineLength) = '\0'; + for (char* pPos = pLineBuf; *pPos; pPos++) { + if (*pPos != ' ' && *pPos != '\t') + *pPos = '\0'; + } + if (*pLineBuf) { + SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); + SendMessage(g_hwndEdit, SCI_ADDTEXT, lstrlenA(pLineBuf), (LPARAM)pLineBuf); + SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); + } + if (bAllocLnBuf) { FreeMem(pLineBuf); } + } + } + } + } + // Auto close tags + else if (bAutoCloseTags && scn->ch == '>') + { + //int iLexer = (int)SendMessage(g_hwndEdit,SCI_GETLEXER,0,0); + //if (iLexer == SCLEX_HTML || iLexer == SCLEX_XML) + { + const DocPos iCurPos = SciCall_GetCurrentPos(); + const DocPos iHelper = iCurPos - (DocPos)(COUNTOF(g_pTempLineBufferMain) - 1); + const DocPos iStartPos = max(0, iHelper); + const DocPos iSize = iCurPos - iStartPos; + + if (iSize >= 3) + { + const char* pBegin = SciCall_GetRangePointer(iStartPos, iSize); + + if (pBegin[iSize - 2] != '/') { + + const char* pCur = &pBegin[iSize - 2]; + + while (pCur > pBegin && *pCur != '<' && *pCur != '>') + --pCur; + + int cchIns = 2; + StringCchCopyA(g_pTempLineBufferMain, FNDRPL_BUFFER, "'; + g_pTempLineBufferMain[cchIns] = '\0'; + + if (cchIns > 3 && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "
", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1) && + StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "", -1)) + { + int token = BeginUndoAction(); + SciCall_ReplaceSel(g_pTempLineBufferMain); + SciCall_SetSel(iCurPos, iCurPos); + EndUndoAction(token); + } + } + } + } + } + else if (bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) { + EditCompleteWord(g_hwndEdit, false); + } + } + break; + + + case SCN_NEEDSHOWN: + { + DocLn iFirstLine = SciCall_LineFromPosition((DocPos)scn->position); + DocLn iLastLine = SciCall_LineFromPosition((DocPos)(scn->position + scn->length - 1)); + for (DocLn i = iFirstLine; i <= iLastLine; ++i) { SciCall_EnsureVisible(i); } + } + break; + + + case SCN_MARGINCLICK: + if (scn->margin == MARGIN_SCI_FOLDING) { + EditFoldClick(SciCall_LineFromPosition((DocPos)scn->position), scn->modifiers); + } + break; + + + // ~~~ Not used in Windows ~~~ + // see: CMD_ALTUP / CMD_ALTDOWN + //case SCN_KEY: + // // Also see the corresponding patch in scintilla\src\Editor.cxx + // FoldAltArrow(scn->ch, scn->modifiers); + // break; + + + case SCN_SAVEPOINTREACHED: + SciCall_SetScrollWidth(1); + _SetDocumentModified(false); + break; + + + case SCN_SAVEPOINTLEFT: + _SetDocumentModified(true); + break; + + + case SCN_ZOOM: + UpdateLineNumberWidth(); + break; + + + default: + return false; + } + return true; + + + case IDC_TOOLBAR: + + switch(pnmh->code) + { + case TBN_ENDADJUST: + UpdateToolbar(); + break; + + case TBN_QUERYDELETE: + case TBN_QUERYINSERT: + break; + + case TBN_GETBUTTONINFO: + { + if (((LPTBNOTIFY)lParam)->iItem < COUNTOF(tbbMainWnd)) + { + WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; + GetString(tbbMainWnd[((LPTBNOTIFY)lParam)->iItem].idCommand,tch,COUNTOF(tch)); + StringCchCopyN(((LPTBNOTIFY)lParam)->pszText,((LPTBNOTIFY)lParam)->cchText,tch,((LPTBNOTIFY)lParam)->cchText); + CopyMemory(&((LPTBNOTIFY)lParam)->tbButton,&tbbMainWnd[((LPTBNOTIFY)lParam)->iItem],sizeof(TBBUTTON)); + return true; + } + } + return false; + + case TBN_RESET: + { + int i; int c = (int)SendMessage(g_hwndToolbar,TB_BUTTONCOUNT,0,0); + for (i = 0; i < c; i++) { + SendMessage(g_hwndToolbar, TB_DELETEBUTTON, 0, 0); + } + SendMessage(g_hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd); + return(0); + } + break; + + default: + return false; + } + return true; + + + case IDC_STATUSBAR: + + switch(pnmh->code) + { + + case NM_CLICK: + { + LPNMMOUSE pnmm = (LPNMMOUSE)lParam; + + switch (pnmm->dwItemSpec) + { + case STATUS_EOLMODE: + SendMessage(g_hwndEdit,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); + EditFixPositions(g_hwndEdit); + return true; + + default: + return false; + } + } + + case NM_DBLCLK: + { + int i; + LPNMMOUSE pnmm = (LPNMMOUSE)lParam; + + switch (pnmm->dwItemSpec) + { + case STATUS_CODEPAGE: + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_ENCODING_SELECT,1),0); + return true; + + case STATUS_EOLMODE: + if (g_iEOLMode == SC_EOL_CRLF) + i = IDM_LINEENDINGS_CRLF; + else if (g_iEOLMode == SC_EOL_LF) + i = IDM_LINEENDINGS_LF; + else + i = IDM_LINEENDINGS_CR; + i++; + if (i > IDM_LINEENDINGS_CR) + i = IDM_LINEENDINGS_CRLF; + SendMessage(hwnd,WM_COMMAND,MAKELONG(i,1),0); + return true; + + case STATUS_OVRMODE: + SendMessage(g_hwndEdit,SCI_EDITTOGGLEOVERTYPE,0,0); + return true; + + case STATUS_2ND_DEF: + SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_USE2NDDEFAULT, 1), 0); + return true; + + case STATUS_LEXER: + SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_SCHEME, 1), 0); + return true; + + default: + return false; + } + } + break; + + } + return true; + + + default: + + switch(pnmh->code) + { + case TTN_NEEDTEXT: + { + if (!(((LPTOOLTIPTEXT)lParam)->uFlags & TTF_IDISHWND)) + { + WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; + GetString((UINT)pnmh->idFrom,tch,COUNTOF(tch)); + StringCchCopyN(((LPTOOLTIPTEXT)lParam)->szText,COUNTOF(((LPTOOLTIPTEXT)lParam)->szText),tch,COUNTOF(((LPTOOLTIPTEXT)lParam)->szText)); + } + } + break; + + } + break; + + } + + UNUSED(wParam); + + return false; +} + + + +//============================================================================= +// +// Set/Get FindPattern() +// +static WCHAR sCurrentFindPattern[FNDRPL_BUFFER] = { L'\0' }; + +bool IsFindPatternEmpty() +{ + return (StringCchLenW(sCurrentFindPattern, COUNTOF(sCurrentFindPattern)) == 0); +} + +//============================================================================= +// +// SetFindPattern() +// +void SetFindPattern(LPCWSTR wchFindPattern) +{ + StringCchCopyW(sCurrentFindPattern, COUNTOF(sCurrentFindPattern), (wchFindPattern ? wchFindPattern : L"")); +} + +//============================================================================= +// +// SetFindPatternMB() +// +void SetFindPatternMB(LPCSTR chFindPattern) +{ + MultiByteToWideChar(Encoding_SciCP, 0, chFindPattern, -1, sCurrentFindPattern, COUNTOF(sCurrentFindPattern)); +} + +//============================================================================= +// +// GetFindPattern() +// +void GetFindPattern(LPWSTR wchFindPattern, size_t bufferSize) +{ + StringCchCopyW(wchFindPattern, bufferSize, sCurrentFindPattern); +} + +//============================================================================= +// +// GetFindPatternMB() +// +void GetFindPatternMB(LPSTR chFindPattern, size_t bufferSize) +{ + WideCharToMultiByte(Encoding_SciCP, 0, sCurrentFindPattern, -1, chFindPattern, (int)bufferSize, NULL, NULL); +} + + +//============================================================================= +// +// LoadSettings() +// +// +void LoadSettings() +{ + WCHAR *pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); + int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + LoadIniSection(L"Settings",pIniSection,cchIniSection); + + bEnableSaveSettings = true; + bSaveSettings = IniSectionGetBool(pIniSection,L"SaveSettings",true); + bSaveRecentFiles = IniSectionGetBool(pIniSection,L"SaveRecentFiles",false); + bPreserveCaretPos = IniSectionGetBool(pIniSection, L"PreserveCaretPos",false); + bSaveFindReplace = IniSectionGetBool(pIniSection,L"SaveFindReplace",false); + + g_efrData.bFindClose = IniSectionGetBool(pIniSection,L"CloseFind", false); + g_efrData.bReplaceClose = IniSectionGetBool(pIniSection,L"CloseReplace", false); + g_efrData.bNoFindWrap = IniSectionGetBool(pIniSection,L"NoFindWrap", false); + g_efrData.bTransformBS = IniSectionGetBool(pIniSection,L"FindTransformBS", false); + g_efrData.bWildcardSearch = IniSectionGetBool(pIniSection,L"WildcardSearch",false); + g_efrData.bMarkOccurences = IniSectionGetBool(pIniSection, L"FindMarkAllOccurrences", false); + g_efrData.bHideNonMatchedLines = IniSectionGetBool(pIniSection, L"HideNonMatchedLines", false); + g_efrData.bDotMatchAll = IniSectionGetBool(pIniSection, L"RegexDotMatchesAll", false); + g_efrData.fuFlags = IniSectionGetUInt(pIniSection, L"efrData_fuFlags", 0); + + if (!IniSectionGetString(pIniSection, L"OpenWithDir", L"", tchOpenWithDir, COUNTOF(tchOpenWithDir))) { + //SHGetSpecialFolderPath(NULL, tchOpenWithDir, CSIDL_DESKTOPDIRECTORY, true); + GetKnownFolderPath(&FOLDERID_Desktop, tchOpenWithDir, COUNTOF(tchOpenWithDir)); + } + else { + PathAbsoluteFromApp(tchOpenWithDir, NULL, COUNTOF(tchOpenWithDir), true); + } + if (!IniSectionGetString(pIniSection, L"Favorites", L"", tchFavoritesDir, COUNTOF(tchFavoritesDir))) { + //SHGetFolderPath(NULL,CSIDL_PERSONAL,NULL,SHGFP_TYPE_CURRENT,tchFavoritesDir); + GetKnownFolderPath(&FOLDERID_Favorites, tchFavoritesDir, COUNTOF(tchFavoritesDir)); + } + else { + PathAbsoluteFromApp(tchFavoritesDir, NULL, COUNTOF(tchFavoritesDir), true); + } + + iPathNameFormat = IniSectionGetInt(pIniSection,L"PathNameFormat",0); + iPathNameFormat = max(min(iPathNameFormat,2),0); + + bWordWrap = IniSectionGetBool(pIniSection,L"WordWrap",false); + bWordWrapG = bWordWrap; + + iWordWrapMode = IniSectionGetInt(pIniSection,L"WordWrapMode",0); + iWordWrapMode = max(min(iWordWrapMode,1),0); + + iWordWrapIndent = IniSectionGetInt(pIniSection,L"WordWrapIndent",0); + iWordWrapIndent = max(min(iWordWrapIndent,6),0); + + iWordWrapSymbols = IniSectionGetInt(pIniSection,L"WordWrapSymbols",22); + iWordWrapSymbols = max(min(iWordWrapSymbols%10,2),0)+max(min((iWordWrapSymbols%100-iWordWrapSymbols%10)/10,2),0)*10; + + bShowWordWrapSymbols = IniSectionGetBool(pIniSection,L"ShowWordWrapSymbols",0); + + bMatchBraces = IniSectionGetBool(pIniSection,L"MatchBraces",true); + + bAutoCloseTags = IniSectionGetBool(pIniSection,L"AutoCloseTags",false); + + bHiliteCurrentLine = IniSectionGetBool(pIniSection,L"HighlightCurrentLine",false); + + g_bHyperlinkHotspot = IniSectionGetBool(pIniSection, L"HyperlinkHotspot", false); + + bScrollPastEOF = IniSectionGetBool(pIniSection, L"ScrollPastEOF", false); + + bAutoIndent = IniSectionGetBool(pIniSection,L"AutoIndent",true); + + bAutoCompleteWords = IniSectionGetBool(pIniSection,L"AutoCompleteWords",false); + + bAccelWordNavigation = IniSectionGetBool(pIniSection, L"AccelWordNavigation", false); + + bShowIndentGuides = IniSectionGetBool(pIniSection,L"ShowIndentGuides",false); + + g_bTabsAsSpaces = IniSectionGetBool(pIniSection,L"TabsAsSpaces",true); + bTabsAsSpacesG = g_bTabsAsSpaces; + + g_bTabIndents = IniSectionGetBool(pIniSection,L"TabIndents",true); + bTabIndentsG = g_bTabIndents; + + bBackspaceUnindents = IniSectionGetBool(pIniSection,L"BackspaceUnindents",false); + + g_iTabWidth = IniSectionGetInt(pIniSection,L"TabWidth",2); + g_iTabWidth = max(min(g_iTabWidth,256),1); + iTabWidthG = g_iTabWidth; + + g_iIndentWidth = IniSectionGetInt(pIniSection,L"IndentWidth",0); + g_iIndentWidth = max(min(g_iIndentWidth,256),0); + iIndentWidthG = g_iIndentWidth; + + bMarkLongLines = IniSectionGetBool(pIniSection,L"MarkLongLines",false); + + iLongLinesLimit = IniSectionGetInt(pIniSection,L"LongLinesLimit",72); + iLongLinesLimit = max(min(iLongLinesLimit,4096),0); + iLongLinesLimitG = iLongLinesLimit; + + iLongLineMode = IniSectionGetInt(pIniSection,L"LongLineMode",EDGE_LINE); + iLongLineMode = max(min(iLongLineMode,EDGE_BACKGROUND),EDGE_LINE); + + g_bShowSelectionMargin = IniSectionGetBool(pIniSection,L"ShowSelectionMargin",false); + + bShowLineNumbers = IniSectionGetBool(pIniSection,L"ShowLineNumbers", true); + + g_bShowCodeFolding = IniSectionGetBool(pIniSection,L"ShowCodeFolding", true); + + g_iMarkOccurrences = IniSectionGetInt(pIniSection,L"MarkOccurrences",1); + g_iMarkOccurrences = max(min(g_iMarkOccurrences, 3), 0); + g_bMarkOccurrencesMatchVisible = IniSectionGetBool(pIniSection, L"MarkOccurrencesMatchVisible", false); + bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchCase",false); + bMarkOccurrencesMatchWords = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchWholeWords",true); + bMarkOccurrencesCurrentWord = IniSectionGetBool(pIniSection, L"MarkOccurrencesCurrentWord", !bMarkOccurrencesMatchWords); + bMarkOccurrencesCurrentWord = bMarkOccurrencesCurrentWord && !bMarkOccurrencesMatchWords; + + bViewWhiteSpace = IniSectionGetBool(pIniSection,L"ViewWhiteSpace", false); + + bViewEOLs = IniSectionGetBool(pIniSection,L"ViewEOLs", false); + + g_iDefaultNewFileEncoding = IniSectionGetInt(pIniSection,L"DefaultEncoding", CPI_NONE); + // if DefaultEncoding is not defined set to system's current code-page + g_iDefaultNewFileEncoding = (g_iDefaultNewFileEncoding == CPI_NONE) ? + Encoding_MapIniSetting(true,(int)GetACP()) : Encoding_MapIniSetting(true,g_iDefaultNewFileEncoding); + + bUseDefaultForFileEncoding = IniSectionGetBool(pIniSection, L"UseDefaultForFileEncoding", false); + + bSkipUnicodeDetection = IniSectionGetBool(pIniSection, L"SkipUnicodeDetection", false); + + bSkipANSICodePageDetection = IniSectionGetBool(pIniSection, L"SkipANSICodePageDetection", true); + + bLoadASCIIasUTF8 = IniSectionGetBool(pIniSection, L"LoadASCIIasUTF8", false); + + bLoadNFOasOEM = IniSectionGetBool(pIniSection,L"LoadNFOasOEM",true); + + bNoEncodingTags = IniSectionGetBool(pIniSection,L"NoEncodingTags", false); + + g_iDefaultEOLMode = IniSectionGetInt(pIniSection,L"DefaultEOLMode",0); + g_iDefaultEOLMode = max(min(g_iDefaultEOLMode,2),0); + + bFixLineEndings = IniSectionGetBool(pIniSection,L"FixLineEndings",true); + + bAutoStripBlanks = IniSectionGetBool(pIniSection,L"FixTrailingBlanks",false); + + iPrintHeader = IniSectionGetInt(pIniSection,L"PrintHeader",1); + iPrintHeader = max(min(iPrintHeader,3),0); + + iPrintFooter = IniSectionGetInt(pIniSection,L"PrintFooter",0); + iPrintFooter = max(min(iPrintFooter,1),0); + + iPrintColor = IniSectionGetInt(pIniSection,L"PrintColorMode",3); + iPrintColor = max(min(iPrintColor,4),0); + + iPrintZoom = IniSectionGetInt(pIniSection,L"PrintZoom",10)-10; + iPrintZoom = max(min(iPrintZoom,20),-10); + + pagesetupMargin.left = IniSectionGetInt(pIniSection,L"PrintMarginLeft",-1); + pagesetupMargin.left = max(pagesetupMargin.left,-1); + + pagesetupMargin.top = IniSectionGetInt(pIniSection,L"PrintMarginTop",-1); + pagesetupMargin.top = max(pagesetupMargin.top,-1); + + pagesetupMargin.right = IniSectionGetInt(pIniSection,L"PrintMarginRight",-1); + pagesetupMargin.right = max(pagesetupMargin.right,-1); + + pagesetupMargin.bottom = IniSectionGetInt(pIniSection,L"PrintMarginBottom",-1); + pagesetupMargin.bottom = max(pagesetupMargin.bottom,-1); + + bSaveBeforeRunningTools = IniSectionGetBool(pIniSection,L"SaveBeforeRunningTools",false); + + iFileWatchingMode = IniSectionGetInt(pIniSection,L"FileWatchingMode",0); + iFileWatchingMode = max(min(iFileWatchingMode,2),0); + + bResetFileWatching = IniSectionGetBool(pIniSection,L"ResetFileWatching",true); + + iEscFunction = IniSectionGetInt(pIniSection,L"EscFunction",0); + iEscFunction = max(min(iEscFunction,2),0); + + bAlwaysOnTop = IniSectionGetBool(pIniSection,L"AlwaysOnTop",false); + + bMinimizeToTray = IniSectionGetBool(pIniSection,L"MinimizeToTray",false); + + bTransparentMode = IniSectionGetBool(pIniSection,L"TransparentMode",false); + + // Check if SetLayeredWindowAttributes() is available + bTransparentModeAvailable = (GetProcAddress(GetModuleHandle(L"User32"),"SetLayeredWindowAttributes") != NULL); + bTransparentModeAvailable = (bTransparentModeAvailable) ? true : false; + + // see TBBUTTON tbbMainWnd[] for initial/reset set of buttons + IniSectionGetString(pIniSection,L"ToolbarButtons", L"", tchToolbarButtons, COUNTOF(tchToolbarButtons)); + + bShowToolbar = IniSectionGetBool(pIniSection,L"ShowToolbar",true); + + bShowStatusbar = IniSectionGetBool(pIniSection,L"ShowStatusbar",true); + + cxEncodingDlg = IniSectionGetInt(pIniSection,L"EncodingDlgSizeX",256); + cxEncodingDlg = max(cxEncodingDlg,0); + + cyEncodingDlg = IniSectionGetInt(pIniSection,L"EncodingDlgSizeY",262); + cyEncodingDlg = max(cyEncodingDlg,0); + + cxRecodeDlg = IniSectionGetInt(pIniSection,L"RecodeDlgSizeX",256); + cxRecodeDlg = max(cxRecodeDlg,0); + + cyRecodeDlg = IniSectionGetInt(pIniSection,L"RecodeDlgSizeY",262); + cyRecodeDlg = max(cyRecodeDlg,0); + + cxFileMRUDlg = IniSectionGetInt(pIniSection,L"FileMRUDlgSizeX",412); + cxFileMRUDlg = max(cxFileMRUDlg,0); + + cyFileMRUDlg = IniSectionGetInt(pIniSection,L"FileMRUDlgSizeY",376); + cyFileMRUDlg = max(cyFileMRUDlg,0); + + cxOpenWithDlg = IniSectionGetInt(pIniSection,L"OpenWithDlgSizeX",384); + cxOpenWithDlg = max(cxOpenWithDlg,0); + + cyOpenWithDlg = IniSectionGetInt(pIniSection,L"OpenWithDlgSizeY",386); + cyOpenWithDlg = max(cyOpenWithDlg,0); + + cxFavoritesDlg = IniSectionGetInt(pIniSection,L"FavoritesDlgSizeX",334); + cxFavoritesDlg = max(cxFavoritesDlg,0); + + cyFavoritesDlg = IniSectionGetInt(pIniSection,L"FavoritesDlgSizeY",316); + cyFavoritesDlg = max(cyFavoritesDlg,0); + + xFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosX",0); + yFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosY",0); + + xCustomSchemesDlg = IniSectionGetInt(pIniSection, L"CustomSchemesDlgPosX", 0); + yCustomSchemesDlg = IniSectionGetInt(pIniSection, L"CustomSchemesDlgPosY", 0); + + LoadIniSection(L"Settings2",pIniSection,cchIniSection); + + bStickyWinPos = IniSectionGetInt(pIniSection,L"StickyWindowPosition",0); + if (bStickyWinPos) bStickyWinPos = 1; + + IniSectionGetString(pIniSection,L"DefaultExtension",L"txt", + tchDefaultExtension,COUNTOF(tchDefaultExtension)); + StrTrim(tchDefaultExtension,L" \t.\""); + + IniSectionGetString(pIniSection,L"DefaultDirectory",L"", + tchDefaultDir,COUNTOF(tchDefaultDir)); + + ZeroMemory(tchFileDlgFilters,sizeof(WCHAR)*COUNTOF(tchFileDlgFilters)); + IniSectionGetString(pIniSection,L"FileDlgFilters",L"", + tchFileDlgFilters,COUNTOF(tchFileDlgFilters)-2); + + dwFileCheckInverval = IniSectionGetInt(pIniSection,L"FileCheckInverval",2000); + dwAutoReloadTimeout = IniSectionGetInt(pIniSection,L"AutoReloadTimeout",2000); + + iSciDirectWriteTech = IniSectionGetInt(pIniSection,L"SciDirectWriteTech", DirectWriteTechnology[0]); + iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); + + iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality", FontQuality[3]); + iSciFontQuality = max(min(iSciFontQuality, 3), 0); + + g_iMarkOccurrencesMaxCount = IniSectionGetInt(pIniSection,L"MarkOccurrencesMaxCount",2000); + g_iMarkOccurrencesMaxCount = (g_iMarkOccurrencesMaxCount <= 0) ? INT_MAX : g_iMarkOccurrencesMaxCount; + + iUpdateDelayHyperlinkStyling = IniSectionGetInt(pIniSection, L"UpdateDelayHyperlinkStyling", 100); + iUpdateDelayHyperlinkStyling = max(min(iUpdateDelayHyperlinkStyling, 10000), 10) / (int)USER_TIMER_MINIMUM; + + iUpdateDelayMarkAllCoccurrences = IniSectionGetInt(pIniSection, L"UpdateDelayMarkAllCoccurrences", 50); + iUpdateDelayMarkAllCoccurrences = max(min(iUpdateDelayMarkAllCoccurrences, 10000), 10) / (int)USER_TIMER_MINIMUM; + + bDenyVirtualSpaceAccess = IniSectionGetBool(pIniSection, L"DenyVirtualSpaceAccess", false); + bUseOldStyleBraceMatching = IniSectionGetBool(pIniSection, L"UseOldStyleBraceMatching", false); + + iCurrentLineHorizontalSlop = IniSectionGetInt(pIniSection, L"CurrentLineHorizontalSlop", 0); + iCurrentLineHorizontalSlop = max(min(iCurrentLineHorizontalSlop, 2000), 0); + + iCurrentLineVerticalSlop = IniSectionGetInt(pIniSection, L"CurrentLineVerticalSlop", 0); + iCurrentLineVerticalSlop = max(min(iCurrentLineVerticalSlop, 200), 0); + + LoadIniSection(L"Toolbar Images",pIniSection,cchIniSection); + + IniSectionGetString(pIniSection,L"BitmapDefault",L"", + tchToolbarBitmap,COUNTOF(tchToolbarBitmap)); + IniSectionGetString(pIniSection,L"BitmapHot",L"", + tchToolbarBitmapHot,COUNTOF(tchToolbarBitmap)); + IniSectionGetString(pIniSection,L"BitmapDisabled",L"", + tchToolbarBitmapDisabled,COUNTOF(tchToolbarBitmap)); + + int ResX = GetSystemMetrics(SM_CXSCREEN); + int ResY = GetSystemMetrics(SM_CYSCREEN); + + LoadIniSection(L"Window", pIniSection, cchIniSection); + + WCHAR tchHighDpiToolBar[32] = { L'\0' }; + StringCchPrintf(tchHighDpiToolBar,COUNTOF(tchHighDpiToolBar),L"%ix%i HighDpiToolBar", ResX, ResY); + iHighDpiToolBar = IniSectionGetInt(pIniSection, tchHighDpiToolBar, -1); + iHighDpiToolBar = max(min(iHighDpiToolBar, 1), -1); + if (iHighDpiToolBar < 0) { // undefined: determine high DPI (higher than Full-HD) + if ((ResX > 1920) && (ResY > 1080)) + iHighDpiToolBar = 1; + } + + if (!flagPosParam /*|| bStickyWinPos*/) { // ignore window position if /p was specified + + WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; + + StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); + StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); + StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); + StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); + StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); + + g_WinInfo.x = IniSectionGetInt(pIniSection,tchPosX,CW_USEDEFAULT); + g_WinInfo.y = IniSectionGetInt(pIniSection,tchPosY,CW_USEDEFAULT); + g_WinInfo.cx = IniSectionGetInt(pIniSection,tchSizeX,CW_USEDEFAULT); + g_WinInfo.cy = IniSectionGetInt(pIniSection,tchSizeY,CW_USEDEFAULT); + g_WinInfo.max = IniSectionGetInt(pIniSection,tchMaximized,0); + if (g_WinInfo.max) g_WinInfo.max = 1; + } + + // --- override by resolution specific settings --- + + WCHAR tchSciDirectWriteTech[64]; + StringCchPrintf(tchSciDirectWriteTech,COUNTOF(tchSciDirectWriteTech),L"%ix%i SciDirectWriteTech",ResX,ResY); + iSciDirectWriteTech = IniSectionGetInt(pIniSection,tchSciDirectWriteTech,iSciDirectWriteTech); + iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); + + WCHAR tchSciFontQuality[64]; + StringCchPrintf(tchSciFontQuality,COUNTOF(tchSciFontQuality),L"%ix%i SciFontQuality",ResX,ResY); + iSciFontQuality = IniSectionGetInt(pIniSection,tchSciFontQuality,iSciFontQuality); + iSciFontQuality = max(min(iSciFontQuality, SC_EFF_QUALITY_LCD_OPTIMIZED), SC_TECHNOLOGY_DEFAULT); + + + LocalFree(pIniSection); + + + // define scintilla internal codepage + const int iSciDefaultCodePage = SC_CP_UTF8; // default UTF8 + + // remove internal support for Chinese, Japan, Korean DBCS use UTF-8 instead + /* + if (g_iDefaultNewFileEncoding == CPI_ANSI_DEFAULT) + { + // check for Chinese, Japan, Korean DBCS code pages and switch accordingly + int acp = (int)GetACP(); + if (acp == 932 || acp == 936 || acp == 949 || acp == 950) { + iSciDefaultCodePage = acp; + } + g_iDefaultNewFileEncoding = Encoding_GetByCodePage(iSciDefaultCodePage); + } + */ + + // set flag for encoding default + Encoding_SetDefaultFlag(g_iDefaultNewFileEncoding); + + // define default charset + g_iDefaultCharSet = (int)CharSetFromCodePage((UINT)iSciDefaultCodePage); + + // Scintilla Styles + Style_Load(); + +} + + +//============================================================================= +// +// SaveSettings() +// +// +void SaveSettings(bool bSaveSettingsNow) { + WCHAR *pIniSection = NULL; + + WCHAR wchTmp[MAX_PATH] = { L'\0' }; + + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) == 0) + return; + + if (!bEnableSaveSettings) + return; + + CreateIniFile(); + + if (!bSaveSettings && !bSaveSettingsNow) { + IniSetInt(L"Settings", L"SaveSettings", bSaveSettings); + return; + } + + pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); + //int cchIniSection = (int)LocalSize(pIniSection) / sizeof(WCHAR); + + IniSectionSetBool(pIniSection, L"SaveSettings", bSaveSettings); + IniSectionSetBool(pIniSection, L"SaveRecentFiles", bSaveRecentFiles); + IniSectionSetBool(pIniSection, L"PreserveCaretPos", bPreserveCaretPos); + IniSectionSetBool(pIniSection, L"SaveFindReplace", bSaveFindReplace); + IniSectionSetBool(pIniSection, L"CloseFind", g_efrData.bFindClose); + IniSectionSetBool(pIniSection, L"CloseReplace", g_efrData.bReplaceClose); + IniSectionSetBool(pIniSection, L"NoFindWrap", g_efrData.bNoFindWrap); + IniSectionSetBool(pIniSection, L"FindTransformBS", g_efrData.bTransformBS); + IniSectionSetBool(pIniSection, L"WildcardSearch", g_efrData.bWildcardSearch); + IniSectionSetBool(pIniSection, L"FindMarkAllOccurrences", g_efrData.bMarkOccurences); + IniSectionSetBool(pIniSection, L"HideNonMatchedLines", g_efrData.bHideNonMatchedLines); + IniSectionSetBool(pIniSection, L"RegexDotMatchesAll", g_efrData.bDotMatchAll); + IniSectionSetInt(pIniSection, L"efrData_fuFlags", g_efrData.fuFlags); + PathRelativeToApp(tchOpenWithDir, wchTmp, COUNTOF(wchTmp), false, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); + PathRelativeToApp(tchFavoritesDir, wchTmp, COUNTOF(wchTmp), false, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"Favorites", wchTmp); + IniSectionSetInt(pIniSection, L"PathNameFormat", iPathNameFormat); + IniSectionSetBool(pIniSection, L"WordWrap", bWordWrapG); + IniSectionSetInt(pIniSection, L"WordWrapMode", iWordWrapMode); + IniSectionSetInt(pIniSection, L"WordWrapIndent", iWordWrapIndent); + IniSectionSetInt(pIniSection, L"WordWrapSymbols", iWordWrapSymbols); + IniSectionSetBool(pIniSection, L"ShowWordWrapSymbols", bShowWordWrapSymbols); + IniSectionSetBool(pIniSection, L"MatchBraces", bMatchBraces); + IniSectionSetBool(pIniSection, L"AutoCloseTags", bAutoCloseTags); + IniSectionSetBool(pIniSection, L"HighlightCurrentLine", bHiliteCurrentLine); + IniSectionSetBool(pIniSection, L"HyperlinkHotspot", g_bHyperlinkHotspot); + IniSectionSetBool(pIniSection, L"ScrollPastEOF", bScrollPastEOF); + IniSectionSetBool(pIniSection, L"AutoIndent", bAutoIndent); + IniSectionSetBool(pIniSection, L"AutoCompleteWords", bAutoCompleteWords); + IniSectionSetBool(pIniSection, L"AccelWordNavigation", bAccelWordNavigation); + IniSectionSetBool(pIniSection, L"ShowIndentGuides", bShowIndentGuides); + IniSectionSetBool(pIniSection, L"TabsAsSpaces", bTabsAsSpacesG); + IniSectionSetBool(pIniSection, L"TabIndents", bTabIndentsG); + IniSectionSetBool(pIniSection, L"BackspaceUnindents", bBackspaceUnindents); + IniSectionSetInt(pIniSection, L"TabWidth", iTabWidthG); + IniSectionSetInt(pIniSection, L"IndentWidth", iIndentWidthG); + IniSectionSetBool(pIniSection, L"MarkLongLines", bMarkLongLines); + IniSectionSetPos(pIniSection, L"LongLinesLimit", iLongLinesLimitG); + IniSectionSetInt(pIniSection, L"LongLineMode", iLongLineMode); + IniSectionSetBool(pIniSection, L"ShowSelectionMargin", g_bShowSelectionMargin); + IniSectionSetBool(pIniSection, L"ShowLineNumbers", bShowLineNumbers); + IniSectionSetBool(pIniSection, L"ShowCodeFolding", g_bShowCodeFolding); + IniSectionSetInt(pIniSection, L"MarkOccurrences", g_iMarkOccurrences); + IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchVisible", g_bMarkOccurrencesMatchVisible); + IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchCase", bMarkOccurrencesMatchCase); + IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchWholeWords", bMarkOccurrencesMatchWords); + IniSectionSetBool(pIniSection, L"MarkOccurrencesCurrentWord", bMarkOccurrencesCurrentWord); + IniSectionSetBool(pIniSection, L"ViewWhiteSpace", bViewWhiteSpace); + IniSectionSetBool(pIniSection, L"ViewEOLs", bViewEOLs); + IniSectionSetInt(pIniSection, L"DefaultEncoding", Encoding_MapIniSetting(false, g_iDefaultNewFileEncoding)); + IniSectionSetBool(pIniSection, L"UseDefaultForFileEncoding", bUseDefaultForFileEncoding); + IniSectionSetBool(pIniSection, L"SkipUnicodeDetection", bSkipUnicodeDetection); + IniSectionSetBool(pIniSection, L"SkipANSICodePageDetection", bSkipANSICodePageDetection); + IniSectionSetInt(pIniSection, L"LoadASCIIasUTF8", bLoadASCIIasUTF8); + IniSectionSetBool(pIniSection, L"LoadNFOasOEM", bLoadNFOasOEM); + IniSectionSetBool(pIniSection, L"NoEncodingTags", bNoEncodingTags); + IniSectionSetInt(pIniSection, L"DefaultEOLMode", g_iDefaultEOLMode); + IniSectionSetBool(pIniSection, L"FixLineEndings", bFixLineEndings); + IniSectionSetBool(pIniSection, L"FixTrailingBlanks", bAutoStripBlanks); + IniSectionSetInt(pIniSection, L"PrintHeader", iPrintHeader); + IniSectionSetInt(pIniSection, L"PrintFooter", iPrintFooter); + IniSectionSetInt(pIniSection, L"PrintColorMode", iPrintColor); + IniSectionSetInt(pIniSection, L"PrintZoom", iPrintZoom + 10); + IniSectionSetInt(pIniSection, L"PrintMarginLeft", pagesetupMargin.left); + IniSectionSetInt(pIniSection, L"PrintMarginTop", pagesetupMargin.top); + IniSectionSetInt(pIniSection, L"PrintMarginRight", pagesetupMargin.right); + IniSectionSetInt(pIniSection, L"PrintMarginBottom", pagesetupMargin.bottom); + IniSectionSetBool(pIniSection, L"SaveBeforeRunningTools", bSaveBeforeRunningTools); + IniSectionSetInt(pIniSection, L"FileWatchingMode", iFileWatchingMode); + IniSectionSetBool(pIniSection, L"ResetFileWatching", bResetFileWatching); + IniSectionSetInt(pIniSection, L"EscFunction", iEscFunction); + IniSectionSetBool(pIniSection, L"AlwaysOnTop", bAlwaysOnTop); + IniSectionSetBool(pIniSection, L"MinimizeToTray", bMinimizeToTray); + IniSectionSetBool(pIniSection, L"TransparentMode", bTransparentMode); + IniSectionSetBool(pIniSection, L"ShowToolbar", bShowToolbar); + IniSectionSetBool(pIniSection, L"ShowStatusbar", bShowStatusbar); + IniSectionSetInt(pIniSection, L"EncodingDlgSizeX", cxEncodingDlg); + IniSectionSetInt(pIniSection, L"EncodingDlgSizeY", cyEncodingDlg); + IniSectionSetInt(pIniSection, L"RecodeDlgSizeX", cxRecodeDlg); + IniSectionSetInt(pIniSection, L"RecodeDlgSizeY", cyRecodeDlg); + IniSectionSetInt(pIniSection, L"FileMRUDlgSizeX", cxFileMRUDlg); + IniSectionSetInt(pIniSection, L"FileMRUDlgSizeY", cyFileMRUDlg); + IniSectionSetInt(pIniSection, L"OpenWithDlgSizeX", cxOpenWithDlg); + IniSectionSetInt(pIniSection, L"OpenWithDlgSizeY", cyOpenWithDlg); + IniSectionSetInt(pIniSection, L"FavoritesDlgSizeX", cxFavoritesDlg); + IniSectionSetInt(pIniSection, L"FavoritesDlgSizeY", cyFavoritesDlg); + IniSectionSetInt(pIniSection, L"FindReplaceDlgPosX", xFindReplaceDlg); + IniSectionSetInt(pIniSection, L"FindReplaceDlgPosY", yFindReplaceDlg); + IniSectionSetInt(pIniSection, L"CustomSchemesDlgPosX", xCustomSchemesDlg); + IniSectionSetInt(pIniSection, L"CustomSchemesDlgPosY", yCustomSchemesDlg); + + Toolbar_GetButtons(g_hwndToolbar, IDT_FILE_NEW, tchToolbarButtons, COUNTOF(tchToolbarButtons)); + if (StringCchCompareX(tchToolbarButtons, TBBUTTON_DEFAULT_IDS) == 0) { tchToolbarButtons[0] = L'\0'; } + IniSectionSetString(pIniSection, L"ToolbarButtons", tchToolbarButtons); + + SaveIniSection(L"Settings", pIniSection); + LocalFree(pIniSection); + + /* + SaveSettingsNow(): query Window Dimensions + */ + + if (bSaveSettingsNow) { + // GetWindowPlacement + g_WinInfo = GetMyWindowPlacement(g_hwndMain,NULL); + } + + int ResX = GetSystemMetrics(SM_CXSCREEN); + int ResY = GetSystemMetrics(SM_CYSCREEN); + + WCHAR tchHighDpiToolBar[32]; + StringCchPrintf(tchHighDpiToolBar,COUNTOF(tchHighDpiToolBar),L"%ix%i HighDpiToolBar", ResX, ResY); + IniSetInt(L"Window", tchHighDpiToolBar, iHighDpiToolBar); + + if (!IniGetInt(L"Settings2",L"StickyWindowPosition",0)) { + + WCHAR tchPosX[32], tchPosY[32], tchSizeX[32], tchSizeY[32], tchMaximized[32]; + + StringCchPrintf(tchPosX,COUNTOF(tchPosX),L"%ix%i PosX",ResX,ResY); + StringCchPrintf(tchPosY,COUNTOF(tchPosY),L"%ix%i PosY",ResX,ResY); + StringCchPrintf(tchSizeX,COUNTOF(tchSizeX),L"%ix%i SizeX",ResX,ResY); + StringCchPrintf(tchSizeY,COUNTOF(tchSizeY),L"%ix%i SizeY",ResX,ResY); + StringCchPrintf(tchMaximized,COUNTOF(tchMaximized),L"%ix%i Maximized",ResX,ResY); + + IniSetInt(L"Window",tchPosX,g_WinInfo.x); + IniSetInt(L"Window",tchPosY,g_WinInfo.y); + IniSetInt(L"Window",tchSizeX,g_WinInfo.cx); + IniSetInt(L"Window",tchSizeY,g_WinInfo.cy); + IniSetInt(L"Window",tchMaximized,g_WinInfo.max); + } + + // Scintilla Styles + Style_Save(); + +} + + + + + + + +//============================================================================= +// +// ParseCommandLine() +// +// +void ParseCommandLine() +{ + + LPWSTR lp1,lp2,lp3; + bool bContinue = true; + bool bIsFileArg = false; + bool bIsNotepadReplacement = false; + + LPWSTR lpCmdLine = GetCommandLine(); + + if (lstrlen(lpCmdLine) == 0) + return; + + // Good old console can also send args separated by Tabs + StrTab2Space(lpCmdLine); + + int len = lstrlen(lpCmdLine) + 2; + lp1 = LocalAlloc(LPTR,sizeof(WCHAR)*len); + lp2 = LocalAlloc(LPTR,sizeof(WCHAR)*len); + lp3 = LocalAlloc(LPTR,sizeof(WCHAR)*len); + + // Start with 2nd argument + ExtractFirstArgument(lpCmdLine,lp1,lp3,len); + + while (bContinue && ExtractFirstArgument(lp3,lp1,lp2,len)) + { + + // options + if (!bIsFileArg && (StringCchCompareN(lp1,len,L"+",-1) == 0)) { + flagMultiFileArg = 2; + bIsFileArg = true; + } + + else if (!bIsFileArg && (StringCchCompareN(lp1,len,L"-",-1) == 0)) { + flagMultiFileArg = 1; + bIsFileArg = true; + } + + else if (!bIsFileArg && ((*lp1 == L'/') || (*lp1 == L'-'))) + { + + // LTrim + StrLTrim(lp1,L"-/"); + + // Encoding + if (StringCchCompareIX(lp1,L"ANSI") == 0 || StringCchCompareIX(lp1,L"A") == 0 || StringCchCompareIX(lp1,L"MBCS") == 0) + flagSetEncoding = IDM_ENCODING_ANSI-IDM_ENCODING_ANSI + 1; + else if (StringCchCompareIX(lp1,L"UNICODE") == 0 || StringCchCompareIX(lp1,L"W") == 0) + flagSetEncoding = IDM_ENCODING_UNICODE-IDM_ENCODING_ANSI + 1; + else if (StringCchCompareIX(lp1,L"UNICODEBE") == 0 || StringCchCompareIX(lp1,L"UNICODE-BE") == 0) + flagSetEncoding = IDM_ENCODING_UNICODEREV-IDM_ENCODING_ANSI + 1; + else if (StringCchCompareIX(lp1,L"UTF8") == 0 || StringCchCompareIX(lp1,L"UTF-8") == 0) + flagSetEncoding = IDM_ENCODING_UTF8-IDM_ENCODING_ANSI + 1; + else if (StringCchCompareIX(lp1,L"UTF8SIG") == 0 || StringCchCompareIX(lp1,L"UTF-8SIG") == 0 || + StringCchCompareIX(lp1,L"UTF8SIGNATURE") == 0 || StringCchCompareIX(lp1,L"UTF-8SIGNATURE") == 0 || + StringCchCompareIX(lp1,L"UTF8-SIGNATURE") == 0 || StringCchCompareIX(lp1,L"UTF-8-SIGNATURE") == 0) + flagSetEncoding = IDM_ENCODING_UTF8SIGN-IDM_ENCODING_ANSI + 1; + + // EOL Mode + else if (StringCchCompareIX(lp1,L"CRLF") == 0 || StringCchCompareIX(lp1,L"CR+LF") == 0) + flagSetEOLMode = IDM_LINEENDINGS_CRLF-IDM_LINEENDINGS_CRLF + 1; + else if (StringCchCompareIX(lp1,L"LF") == 0) + flagSetEOLMode = IDM_LINEENDINGS_LF-IDM_LINEENDINGS_CRLF + 1; + else if (StringCchCompareIX(lp1,L"CR") == 0) + flagSetEOLMode = IDM_LINEENDINGS_CR-IDM_LINEENDINGS_CRLF + 1; + + // Shell integration + else if (StrCmpNI(lp1,L"appid=",CSTRLEN(L"appid=")) == 0) { + StringCchCopyN(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID), + lp1 + CSTRLEN(L"appid="),len - CSTRLEN(L"appid=")); + StrTrim(g_wchAppUserModelID,L" "); + if (StringCchLenW(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)) == 0) + StringCchCopy(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID),L"Notepad3"); + } + + else if (StrCmpNI(lp1,L"sysmru=",CSTRLEN(L"sysmru=")) == 0) { + WCHAR wch[16]; + StringCchCopyN(wch,COUNTOF(wch),lp1 + CSTRLEN(L"sysmru="),COUNTOF(wch)); + StrTrim(wch,L" "); + if (*wch == L'1') + flagUseSystemMRU = 2; + else + flagUseSystemMRU = 1; + } + + // Relaunch elevated + else if (StrCmpNI(lp1,L"tmpfbuf=",CSTRLEN(L"tmpfbuf=")) == 0) { + StringCchCopyN(szBufferFile,COUNTOF(szBufferFile), + lp1 + CSTRLEN(L"tmpfbuf="),len - CSTRLEN(L"tmpfbuf=")); + TrimString(szBufferFile); + PathUnquoteSpaces(szBufferFile); + NormalizePathEx(szBufferFile,COUNTOF(szBufferFile)); + flagBufferFile = 1; + } + + else switch (*CharUpper(lp1)) + { + + case L'N': + flagReuseWindow = 0; + flagNoReuseWindow = 1; + if (*CharUpper(lp1+1) == L'S') + flagSingleFileInstance = 1; + else + flagSingleFileInstance = 0; + break; + + case L'R': + flagReuseWindow = 1; + flagNoReuseWindow = 0; + if (*CharUpper(lp1+1) == L'S') + flagSingleFileInstance = 1; + else + flagSingleFileInstance = 0; + break; + + case L'F': + if (*(lp1+1) == L'0' || *CharUpper(lp1+1) == L'O') + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L"*?"); + else if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + StringCchCopyN(g_wchIniFile,COUNTOF(g_wchIniFile),lp1,len); + TrimString(g_wchIniFile); + PathUnquoteSpaces(g_wchIniFile); + NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); + } + break; + + case L'I': + flagStartAsTrayIcon = 1; + break; + + case L'O': + if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O') + flagAlwaysOnTop = 1; + else + flagAlwaysOnTop = 2; + break; + + case L'P': + { + WCHAR *lp = lp1; + if (StrCmpNI(lp1,L"POS:",CSTRLEN(L"POS:")) == 0) + lp += CSTRLEN(L"POS:") -1; + else if (StrCmpNI(lp1,L"POS",CSTRLEN(L"POS")) == 0) + lp += CSTRLEN(L"POS") -1; + else if (*(lp1+1) == L':') + lp += 1; + else if (bIsNotepadReplacement) { + if (*(lp1+1) == L'T') + ExtractFirstArgument(lp2,lp1,lp2,len); + break; + } + if (*(lp+1) == L'0' || *CharUpper(lp+1) == L'O') { + flagPosParam = 1; + flagDefaultPos = 1; + } + else if (*CharUpper(lp+1) == L'D' || *CharUpper(lp+1) == L'S') { + flagPosParam = 1; + flagDefaultPos = (StrChrI((lp+1),L'L')) ? 3 : 2; + } + else if (StrChrI(L"FLTRBM",*(lp+1))) { + WCHAR *p = (lp+1); + flagPosParam = 1; + flagDefaultPos = 0; + while (*p) { + switch (*CharUpper(p)) { + case L'F': + flagDefaultPos &= ~(4|8|16|32); + flagDefaultPos |= 64; + break; + case L'L': + flagDefaultPos &= ~(8|64); + flagDefaultPos |= 4; + break; + case L'R': + flagDefaultPos &= ~(4|64); + flagDefaultPos |= 8; + break; + case L'T': + flagDefaultPos &= ~(32|64); + flagDefaultPos |= 16; + break; + case L'B': + flagDefaultPos &= ~(16|64); + flagDefaultPos |= 32; + break; + case L'M': + if (flagDefaultPos == 0) + flagDefaultPos |= 64; + flagDefaultPos |= 128; + break; + } + p = CharNext(p); + } + } + else if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + int itok = + swscanf_s(lp1,L"%i,%i,%i,%i,%i",&g_WinInfo.x,&g_WinInfo.y,&g_WinInfo.cx,&g_WinInfo.cy,&g_WinInfo.max); + if (itok == 4 || itok == 5) { // scan successful + flagPosParam = 1; + flagDefaultPos = 0; + + if (g_WinInfo.cx < 1) g_WinInfo.cx = CW_USEDEFAULT; + if (g_WinInfo.cy < 1) g_WinInfo.cy = CW_USEDEFAULT; + if (g_WinInfo.max) g_WinInfo.max = 1; + if (itok == 4) g_WinInfo.max = 0; + } + } + } + break; + + case L'T': + if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + StringCchCopyN(szTitleExcerpt,COUNTOF(szTitleExcerpt),lp1,len); + fKeepTitleExcerpt = 1; + } + break; + + case L'C': + flagNewFromClipboard = 1; + break; + + case L'B': + flagPasteBoard = 1; + break; + + case L'E': + if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + if (lpEncodingArg) + LocalFree(lpEncodingArg); + lpEncodingArg = StrDup(lp1); + } + break; + + case L'G': + if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + int itok = + swscanf_s(lp1,L"%i,%i",&iInitialLine,&iInitialColumn); + if (itok == 1 || itok == 2) { // scan successful + flagJumpTo = 1; + } + } + break; + + case L'M': + { + bool bFindUp = false; + bool bRegex = false; + bool bTransBS = false; + + if (StrChr(lp1,L'-')) + bFindUp = true; + if (StrChr(lp1,L'R')) + bRegex = true; + if (StrChr(lp1,L'B')) + bTransBS = true; + + if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + if (lpMatchArg) + LocalFree(lpMatchArg); + lpMatchArg = StrDup(lp1); + flagMatchText = 1; + + if (bFindUp) + flagMatchText |= 2; + + if (bRegex) { + flagMatchText &= ~8; + flagMatchText |= 4; + } + + if (bTransBS) { + flagMatchText &= ~4; + flagMatchText |= 8; + } + } + } + break; + + case L'L': + if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O') + flagChangeNotify = 1; + else + flagChangeNotify = 2; + break; + + case L'Q': + flagQuietCreate = 1; + break; + + case L'S': + if (ExtractFirstArgument(lp2,lp1,lp2,len)) { + if (lpSchemeArg) + LocalFree(lpSchemeArg); + lpSchemeArg = StrDup(lp1); + flagLexerSpecified = 1; + } + break; + + case L'D': + if (lpSchemeArg) { + LocalFree(lpSchemeArg); + lpSchemeArg = NULL; + } + iInitialLexer = 0; + flagLexerSpecified = 1; + break; + + case L'H': + if (lpSchemeArg) { + LocalFree(lpSchemeArg); + lpSchemeArg = NULL; + } + iInitialLexer = 35; + flagLexerSpecified = 1; + break; + + case L'X': + if (lpSchemeArg) { + LocalFree(lpSchemeArg); + lpSchemeArg = NULL; + } + iInitialLexer = 36; + flagLexerSpecified = 1; + break; + + case L'U': + flagRelaunchElevated = 1; + break; + + case L'Z': + ExtractFirstArgument(lp2,lp1,lp2,len); + flagMultiFileArg = 1; + bIsNotepadReplacement = true; + break; + + case L'?': + flagDisplayHelp = 1; + break; + + case L'V': + flagPrintFileAndLeave = 1; + if (*CharUpper(lp1 + 1) == L'D') + flagPrintFileAndLeave = 2; // open printer dialog + break; + + default: + break; + + } + + } + + // pathname + else + { + LPWSTR lpFileBuf = LocalAlloc(LPTR,sizeof(WCHAR)*len); + + cchiFileList = lstrlen(lpCmdLine) - lstrlen(lp3); + + if (lpFileArg) { + FreeMem(lpFileArg); + //lpFileArg = NULL; + } + lpFileArg = AllocMem(sizeof(WCHAR)*FILE_ARG_BUF, HEAP_ZERO_MEMORY); // changed for ActivatePrevInst() needs + StringCchCopy(lpFileArg,FILE_ARG_BUF,lp3); + + PathFixBackslashes(lpFileArg); + + if (!PathIsRelative(lpFileArg) && !PathIsUNC(lpFileArg) && + PathGetDriveNumber(lpFileArg) == -1 /*&& PathGetDriveNumber(g_wchWorkingDirectory) != -1*/) { + + WCHAR wchPath[FILE_ARG_BUF] = { L'\0' }; + StringCchCopy(wchPath,COUNTOF(wchPath),g_wchWorkingDirectory); + PathStripToRoot(wchPath); + PathCchAppend(wchPath,COUNTOF(wchPath),lpFileArg); + StringCchCopy(lpFileArg,FILE_ARG_BUF,wchPath); + } + + StrTrim(lpFileArg,L" \""); + + while (cFileList < 32 && ExtractFirstArgument(lp3,lpFileBuf,lp3,len)) { + PathQuoteSpaces(lpFileBuf); + lpFileList[cFileList++] = StrDup(lpFileBuf); + } + + bContinue = false; + LocalFree(lpFileBuf); + } + + // Continue with next argument + if (bContinue) + StringCchCopy(lp3,len,lp2); + + } + + LocalFree(lp1); + LocalFree(lp2); + LocalFree(lp3); +} + + +//============================================================================= +// +// LoadFlags() +// +// +void LoadFlags() +{ + WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*32*1024); + int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + LoadIniSection(L"Settings2",pIniSection,cchIniSection); + + if (!flagReuseWindow && !flagNoReuseWindow) { + + if (!IniSectionGetInt(pIniSection,L"ReuseWindow",0)) + flagNoReuseWindow = 1; + + if (IniSectionGetInt(pIniSection,L"SingleFileInstance",0)) + flagSingleFileInstance = 1; + } + + if (flagMultiFileArg == 0) { + if (IniSectionGetInt(pIniSection,L"MultiFileArg",0)) + flagMultiFileArg = 2; + } + + if (IniSectionGetInt(pIniSection,L"RelativeFileMRU",1)) + flagRelativeFileMRU = 1; + + if (IniSectionGetInt(pIniSection,L"PortableMyDocs",flagRelativeFileMRU)) + flagPortableMyDocs = 1; + + if (IniSectionGetInt(pIniSection,L"NoFadeHidden",0)) + flagNoFadeHidden = 1; + + flagToolbarLook = IniSectionGetInt(pIniSection,L"ToolbarLook",IsXP() ? 1 : 2); + flagToolbarLook = max(min(flagToolbarLook,2),0); + + if (IniSectionGetInt(pIniSection,L"SimpleIndentGuides",0)) + flagSimpleIndentGuides = 1; + + if (IniSectionGetInt(pIniSection,L"NoHTMLGuess",0)) + flagNoHTMLGuess = 1; + + if (IniSectionGetInt(pIniSection,L"NoCGIGuess",0)) + flagNoCGIGuess = 1; + + if (IniSectionGetInt(pIniSection,L"NoFileVariables",0)) + flagNoFileVariables = 1; + + if (StringCchLenW(g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)) == 0) { + IniSectionGetString(pIniSection,L"ShellAppUserModelID",L"Notepad3", + g_wchAppUserModelID,COUNTOF(g_wchAppUserModelID)); + } + + if (flagUseSystemMRU == 0) { + if (IniSectionGetInt(pIniSection,L"ShellUseSystemMRU",0)) + flagUseSystemMRU = 2; + } + + LocalFree(pIniSection); +} + + +//============================================================================= +// +// FindIniFile() +// +// +bool CheckIniFile(LPWSTR lpszFile,LPCWSTR lpszModule) +{ + WCHAR tchFileExpanded[MAX_PATH] = { L'\0' }; + WCHAR tchBuild[MAX_PATH] = { L'\0' }; + ExpandEnvironmentStrings(lpszFile,tchFileExpanded,COUNTOF(tchFileExpanded)); + + if (PathIsRelative(tchFileExpanded)) { + // program directory + StringCchCopy(tchBuild,COUNTOF(tchBuild),lpszModule); + StringCchCopy(PathFindFileName(tchBuild),COUNTOF(tchBuild),tchFileExpanded); + + if (PathFileExists(tchBuild)) { + StringCchCopy(lpszFile,MAX_PATH,tchBuild); + return true; + } + // %appdata% + //if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)) { + if (GetKnownFolderPath(&FOLDERID_RoamingAppData, tchBuild, COUNTOF(tchBuild))) { + PathCchAppend(tchBuild,COUNTOF(tchBuild),tchFileExpanded); + if (PathFileExists(tchBuild)) { + StringCchCopy(lpszFile,MAX_PATH,tchBuild); + return true; + } + } + // general + if (SearchPath(NULL,tchFileExpanded,NULL,COUNTOF(tchBuild),tchBuild,NULL)) { + StringCchCopy(lpszFile,MAX_PATH,tchBuild); + return true; + } + } + + else if (PathFileExists(tchFileExpanded)) { + StringCchCopy(lpszFile,MAX_PATH,tchFileExpanded); + return true; + } + + return false; +} + +bool CheckIniFileRedirect(LPWSTR lpszFile,LPCWSTR lpszModule) +{ + WCHAR tch[MAX_PATH] = { L'\0' }; + if (GetPrivateProfileString(L"Notepad3",L"Notepad3.ini",L"",tch,COUNTOF(tch),lpszFile)) { + if (CheckIniFile(tch,lpszModule)) { + StringCchCopy(lpszFile,MAX_PATH,tch); + return true; + } + else { + WCHAR tchFileExpanded[MAX_PATH] = { L'\0' }; + ExpandEnvironmentStrings(tch,tchFileExpanded,COUNTOF(tchFileExpanded)); + if (PathIsRelative(tchFileExpanded)) { + StringCchCopy(lpszFile,MAX_PATH,lpszModule); + StringCchCopy(PathFindFileName(lpszFile),MAX_PATH,tchFileExpanded); + return true; + } + else { + StringCchCopy(lpszFile,MAX_PATH,tchFileExpanded); + return true; + } + } + } + return false; +} + +int FindIniFile() { + + WCHAR tchTest[MAX_PATH] = { L'\0' }; + WCHAR tchModule[MAX_PATH] = { L'\0' }; + GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); + + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile))) { + if (StringCchCompareIX(g_wchIniFile,L"*?") == 0) + return(0); + else { + if (!CheckIniFile(g_wchIniFile,tchModule)) { + ExpandEnvironmentStringsEx(g_wchIniFile,COUNTOF(g_wchIniFile)); + if (PathIsRelative(g_wchIniFile)) { + StringCchCopy(tchTest,COUNTOF(tchTest),tchModule); + PathRemoveFileSpec(tchTest); + PathCchAppend(tchTest,COUNTOF(tchTest),g_wchIniFile); + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchTest); + } + } + } + } + else { + StringCchCopy(tchTest,COUNTOF(tchTest),PathFindFileName(tchModule)); + PathCchRenameExtension(tchTest,COUNTOF(tchTest),L".ini"); + bool bFound = CheckIniFile(tchTest,tchModule); + + if (!bFound) { + StringCchCopy(tchTest,COUNTOF(tchTest),L"Notepad3.ini"); + bFound = CheckIniFile(tchTest,tchModule); + } + + if (bFound) { + + // allow two redirections: administrator -> user -> custom + if (CheckIniFileRedirect(tchTest,tchModule)) + CheckIniFileRedirect(tchTest,tchModule); + + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchTest); + } + else { + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),tchModule); + PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); + } + } + + NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); + + return(1); +} + + +int TestIniFile() { + + if (StringCchCompareIX(g_wchIniFile,L"*?") == 0) { + StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),L""); + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L""); + return(0); + } + + if (PathIsDirectory(g_wchIniFile) || *CharPrev(g_wchIniFile,StrEnd(g_wchIniFile)) == L'\\') { + WCHAR wchModule[MAX_PATH] = { L'\0' }; + GetModuleFileName(NULL,wchModule,COUNTOF(wchModule)); + PathCchAppend(g_wchIniFile,COUNTOF(g_wchIniFile),PathFindFileName(wchModule)); + PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); + if (!PathFileExists(g_wchIniFile)) { + StringCchCopy(PathFindFileName(g_wchIniFile),COUNTOF(g_wchIniFile),L"Notepad3.ini"); + if (!PathFileExists(g_wchIniFile)) { + StringCchCopy(PathFindFileName(g_wchIniFile),COUNTOF(g_wchIniFile),PathFindFileName(wchModule)); + PathCchRenameExtension(g_wchIniFile,COUNTOF(g_wchIniFile),L".ini"); + } + } + } + + NormalizePathEx(g_wchIniFile,COUNTOF(g_wchIniFile)); + + if (!PathFileExists(g_wchIniFile) || PathIsDirectory(g_wchIniFile)) { + StringCchCopy(g_wchIniFile2,COUNTOF(g_wchIniFile2),g_wchIniFile); + StringCchCopy(g_wchIniFile,COUNTOF(g_wchIniFile),L""); + return(0); + } + else + return(1); +} + + +int CreateIniFile() { + + return(CreateIniFileEx(g_wchIniFile)); +} + + +int CreateIniFileEx(LPCWSTR lpszIniFile) { + + if (*lpszIniFile) { + + WCHAR *pwchTail = StrRChrW(lpszIniFile, NULL, L'\\'); + if (pwchTail) { + *pwchTail = 0; + SHCreateDirectoryEx(NULL,lpszIniFile,NULL); + *pwchTail = L'\\'; + } + + HANDLE hFile = CreateFile(lpszIniFile, + GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); + dwLastIOError = GetLastError(); + if (hFile != INVALID_HANDLE_VALUE) { + if (GetFileSize(hFile,NULL) == 0) { + DWORD dw; + WriteFile(hFile,(LPCVOID)L"\xFEFF[Notepad3]\r\n",26,&dw,NULL); + } + CloseHandle(hFile); + return(1); + } + else + return(0); + } + + else + return(0); +} + + +//============================================================================= +// +// MarkAllOccurrences() +// +void MarkAllOccurrences(int delay) +{ + static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), (LPARAM)0 , 0 }; + mqc.hwnd = g_hwndMain; + _MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay)); +} + + +//============================================================================= +// +// UpdateVisibleUrlHotspot() +// +void UpdateVisibleUrlHotspot(int delay) +{ + static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_UPDATE_HOTSPOT, 1), (LPARAM)0 , 0 }; + mqc.hwnd = g_hwndMain; + _MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay)); +} + + +//============================================================================= +// +// UpdateToolbar() +// +#define EnableTool(id,b) SendMessage(g_hwndToolbar,TB_ENABLEBUTTON,id, \ + MAKELONG(((b) ? 1 : 0), 0)) + +#define CheckTool(id,b) SendMessage(g_hwndToolbar,TB_CHECKBUTTON,id, \ + MAKELONG(b,0)) + +void UpdateToolbar() +{ + SetWindowTitle(g_hwndMain, uidsAppTitle, flagIsElevated, IDS_UNTITLED, g_wchCurFile, + iPathNameFormat, IsDocumentModified || Encoding_HasChanged(CPI_GET), + IDS_READONLY, bReadOnly, szTitleExcerpt); + + if (!bShowToolbar) { return; } + + EnableTool(IDT_FILE_ADDTOFAV,StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))); + + EnableTool(IDT_EDIT_UNDO,SendMessage(g_hwndEdit,SCI_CANUNDO,0,0) /*&& !bReadOnly*/); + EnableTool(IDT_EDIT_REDO,SendMessage(g_hwndEdit,SCI_CANREDO,0,0) /*&& !bReadOnly*/); + EnableTool(IDT_EDIT_PASTE,SendMessage(g_hwndEdit,SCI_CANPASTE,0,0) /*&& !bReadOnly*/); + + bool b1 = SciCall_IsSelectionEmpty(); + bool b2 = (bool)(SciCall_GetTextLength() > 0); + + EnableTool(IDT_EDIT_FIND, b2); + //EnableTool(IDT_EDIT_FINDNEXT,b2); + //EnableTool(IDT_EDIT_FINDPREV,b2 && strlen(g_efrData.szFind)); + EnableTool(IDT_EDIT_REPLACE, b2 /*&& !bReadOnly*/); + + EnableTool(IDT_EDIT_CUT, !b1 /*&& !bReadOnly*/); + EnableTool(IDT_EDIT_COPY, !b1 /*&& !bReadOnly*/); + EnableTool(IDT_EDIT_CLEAR, !b1 /*&& !bReadOnly*/); + + EnableTool(IDT_VIEW_TOGGLEFOLDS, b2 && (g_bCodeFoldingAvailable && g_bShowCodeFolding)); + EnableTool(IDT_VIEW_TOGGLE_VIEW, b2 && ((g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible)); + + EnableTool(IDT_FILE_LAUNCH, b2); + + EnableTool(IDT_FILE_SAVE, (IsDocumentModified || Encoding_HasChanged(CPI_GET)) /*&& !bReadOnly*/); + + CheckTool(IDT_VIEW_WORDWRAP,bWordWrap); + +} + + +//============================================================================= +// +// UpdateStatusbar() +// +// +const static WCHAR* FR_Status[] = { L"[>--<]", L"[>>--]", L"[>>-+]", L"[+->]>", L"[--<<]", L"[+-<<]", L"<[<-+]"}; + +FR_STATES g_FindReplaceMatchFoundState = FND_NOP; + +void UpdateStatusbar() +{ + static WCHAR tchLn[32] = { L'\0' }; + static WCHAR tchLines[32] = { L'\0' }; + static WCHAR tchCol[32] = { L'\0' }; + static WCHAR tchCols[32] = { L'\0' }; + static WCHAR tchSel[32] = { L'\0' }; + static WCHAR tchSelB[32] = { L'\0' }; + static WCHAR tchOcc[32] = { L'\0' }; + static WCHAR tchReplOccs[32] = { L'\0' }; + static WCHAR tchDocPos[128] = { L'\0' }; + static WCHAR tchFRStatus[128] = { L'\0' }; + + static WCHAR tchBytes[64] = { L'\0' }; + static WCHAR tchDocSize[64] = { L'\0' }; + static WCHAR tchEncoding[64] = { L'\0' }; + + static WCHAR tchEOLMode[32] = { L'\0' }; + static WCHAR tchOvrMode[32] = { L'\0' }; + static WCHAR tch2ndDef[32] = { L'\0' }; + static WCHAR tchLexerName[128] = { L'\0' }; + static WCHAR tchLinesSelected[32] = { L'\0' }; + + static WCHAR tchTmp[32] = { L'\0' }; + + if (!bShowStatusbar) { return; } + + const DocPos iPos = SciCall_GetCurrentPos(); + const DocPos iTextLength = SciCall_GetTextLength(); + const int iEncoding = Encoding_Current(CPI_GET); + + StringCchPrintf(tchLn, COUNTOF(tchLn), L"%td", SciCall_LineFromPosition(iPos) + 1); + FormatNumberStr(tchLn); + + StringCchPrintf(tchLines, COUNTOF(tchLines), L"%td", SciCall_GetLineCount()); + FormatNumberStr(tchLines); + + DocPos iCol = SciCall_GetColumn(iPos) + 1; + iCol += (DocPos)SendMessage(g_hwndEdit, SCI_GETSELECTIONNCARETVIRTUALSPACE, 0, 0); + StringCchPrintf(tchCol, COUNTOF(tchCol), L"%td", iCol); + FormatNumberStr(tchCol); + + if (bMarkLongLines) { + StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", iLongLinesLimit); + FormatNumberStr(tchCols); + } + + // Print number of selected chars in statusbar + const bool bIsSelEmpty = SciCall_IsSelectionEmpty(); + const DocPos iSelStart = (bIsSelEmpty ? 0 : SciCall_GetSelectionStart()); + const DocPos iSelEnd = (bIsSelEmpty ? 0 : SciCall_GetSelectionEnd()); + + if (!bIsSelEmpty && !SciCall_IsSelectionRectangle()) + { + const DocPos iSel = (DocPos)SendMessage(g_hwndEdit, SCI_COUNTCHARACTERS, iSelStart, iSelEnd); + StringCchPrintf(tchSel, COUNTOF(tchSel), L"%td", iSel); + FormatNumberStr(tchSel); + StrFormatByteSize((iSelEnd - iSelStart), tchSelB, COUNTOF(tchSelB)); + } + else { + tchSel[0] = L'-'; tchSel[1] = L'-'; tchSel[2] = L'\0'; + tchSelB[0] = L'0'; tchSelB[1] = L'\0'; + } + + // Print number of occurrence marks found + if ((g_iMarkOccurrencesCount >= 0) && !g_bMarkOccurrencesMatchVisible) + { + if ((g_iMarkOccurrencesMaxCount < 0) || (g_iMarkOccurrencesCount < g_iMarkOccurrencesMaxCount)) + { + StringCchPrintf(tchOcc, COUNTOF(tchOcc), L"%i", g_iMarkOccurrencesCount); + FormatNumberStr(tchOcc); + } + else { + StringCchPrintf(tchTmp, COUNTOF(tchTmp), L"%i", g_iMarkOccurrencesCount); + FormatNumberStr(tchTmp); + StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %s", tchTmp); + } + } + else { + StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--"); + } + + // Print number of selected lines in statusbar + if (bIsSelEmpty) { + tchLinesSelected[0] = L'-'; + tchLinesSelected[1] = L'-'; + tchLinesSelected[2] = L'\0'; + } + else { + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + const DocPos iStartOfLinePos = SciCall_PositionFromLine(iLineEnd); + DocLn iLinesSelected = (iLineEnd - iLineStart); + if ((iSelStart != iSelEnd) && (iStartOfLinePos != iSelEnd)) { iLinesSelected += 1; } + StringCchPrintf(tchLinesSelected, COUNTOF(tchLinesSelected), L"%i", iLinesSelected); + FormatNumberStr(tchLinesSelected); + } + + if (!bMarkLongLines) { + FormatString(tchDocPos, COUNTOF(tchDocPos), IDS_DOCPOS, tchLn, tchLines, tchCol, tchSel, tchSelB, tchLinesSelected, tchOcc); + } + else { + FormatString(tchDocPos, COUNTOF(tchDocPos), IDS_DOCPOS2, tchLn, tchLines, tchCol, tchCols, tchSel, tchSelB, tchLinesSelected, tchOcc); + } + + // update Find/Replace dialog (if any) + if (g_hwndDlgFindReplace) { + if (iReplacedOccurrences > 0) + StringCchPrintf(tchReplOccs, COUNTOF(tchReplOccs), L"%i", iReplacedOccurrences); + else + StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--"); + + FormatString(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT, + tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs, FR_Status[g_FindReplaceMatchFoundState]); + SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus); + } + + // get number of bytes in current encoding + StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes)); + FormatString(tchDocSize, COUNTOF(tchDocSize), IDS_DOCSIZE, tchBytes); + + Encoding_SetLabel(iEncoding); + StringCchPrintf(tchEncoding, COUNTOF(tchEncoding), L" %s ", Encoding_GetLabel(iEncoding)); + + if (g_iEOLMode == SC_EOL_CR) + { + StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR "); + } + else if (g_iEOLMode == SC_EOL_LF) + { + StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" LF "); + } + else { + StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR+LF "); + } + if (SendMessage(g_hwndEdit, SCI_GETOVERTYPE, 0, 0)) + { + StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" OVR "); + } + else { + StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" INS "); + } + if (Style_GetUse2ndDefault()) + { + StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" 2ND "); + } + else { + StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" STD "); + } + Style_GetCurrentLexerName(tchLexerName, COUNTOF(tchLexerName)); + + StatusSetText(g_hwndStatus, STATUS_DOCPOS, tchDocPos); + StatusSetText(g_hwndStatus, STATUS_DOCSIZE, tchDocSize); + StatusSetText(g_hwndStatus, STATUS_CODEPAGE, tchEncoding); + StatusSetText(g_hwndStatus, STATUS_EOLMODE, tchEOLMode); + StatusSetText(g_hwndStatus, STATUS_OVRMODE, tchOvrMode); + StatusSetText(g_hwndStatus, STATUS_2ND_DEF, tch2ndDef); + StatusSetText(g_hwndStatus, STATUS_LEXER, tchLexerName); + + //InvalidateRect(g_hwndStatus,NULL,true); +} + + +//============================================================================= +// +// UpdateLineNumberWidth() +// +// +void UpdateLineNumberWidth() +{ + if (bShowLineNumbers) + { + char chLines[32] = { '\0' }; + StringCchPrintfA(chLines, COUNTOF(chLines), "_%td", (size_t)SciCall_GetLineCount()); + + int iLineMarginWidthNow = (int)SendMessage(g_hwndEdit, SCI_GETMARGINWIDTHN, MARGIN_SCI_LINENUM, 0); + int iLineMarginWidthFit = (int)SendMessage(g_hwndEdit, SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)chLines); + + if (iLineMarginWidthNow != iLineMarginWidthFit) { + SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, iLineMarginWidthFit); + } + } + else { + SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, 0); + } +} + + +//============================================================================= +// +// UpdateSettingsCmds() +// +// +void UpdateSettingsCmds() +{ + HMENU hmenu = GetSystemMenu(g_hwndMain, false); + bool hasIniFile = (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0 || StringCchLenW(g_wchIniFile2,COUNTOF(g_wchIniFile2)) > 0); + CheckCmd(hmenu, IDM_VIEW_SAVESETTINGS, bSaveSettings && bEnableSaveSettings); + EnableCmd(hmenu, IDM_VIEW_SAVESETTINGS, hasIniFile && bEnableSaveSettings); + EnableCmd(hmenu, IDM_VIEW_SAVESETTINGSNOW, hasIniFile && bEnableSaveSettings); +} + + +//============================================================================= +// +// UpdateUI() +// +void UpdateUI() +{ + struct SCNotification scn; + scn.nmhdr.hwndFrom = g_hwndEdit; + scn.nmhdr.idFrom = IDC_EDIT; + scn.nmhdr.code = SCN_UPDATEUI; + scn.updated = (SC_UPDATE_CONTENT | SC_UPDATE_NP3_INTERNAL_NOTIFY); + SendMessage(g_hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); + //PostMessage(g_hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); +} + + +//============================================================================= +// +// BeginUndoAction() +// +// +int BeginUndoAction() +{ + int token = -1; + UndoRedoSelection_t sel = INIT_UNDOREDOSEL; + sel.selMode_undo = (int)SendMessage(g_hwndEdit,SCI_GETSELECTIONMODE,0,0); + + switch (sel.selMode_undo) + { + case SC_SEL_RECTANGLE: + case SC_SEL_THIN: + sel.anchorPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0); + sel.curPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0); + if (!bDenyVirtualSpaceAccess) { + sel.anchorVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0); + sel.curVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0); + } + break; + + case SC_SEL_LINES: + case SC_SEL_STREAM: + default: + sel.anchorPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0); + sel.curPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); + break; + } + token = UndoRedoActionMap(-1, &sel); + if (token >= 0) { + SendMessage(g_hwndEdit, SCI_BEGINUNDOACTION, 0, 0); + SendMessage(g_hwndEdit, SCI_ADDUNDOACTION, (WPARAM)token, 0); + } + return token; +} + + + +//============================================================================= +// +// EndUndoAction() +// +// +void EndUndoAction(int token) +{ + if (token >= 0) { + UndoRedoSelection_t sel = INIT_UNDOREDOSEL; + if (UndoRedoActionMap(token, &sel) >= 0) { + + sel.selMode_redo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONMODE, 0, 0); + + switch (sel.selMode_redo) + { + case SC_SEL_RECTANGLE: + case SC_SEL_THIN: + sel.anchorPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0); + sel.curPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0); + if (!bDenyVirtualSpaceAccess) { + sel.anchorVS_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0); + } + break; + + case SC_SEL_LINES: + case SC_SEL_STREAM: + default: + sel.anchorPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0); + sel.curPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0); + break; + } + } + UndoRedoActionMap(token,&sel); // set with redo action filled + SendMessage(g_hwndEdit, SCI_ENDUNDOACTION, 0, 0); + } +} + + +//============================================================================= +// +// RestoreAction() +// +// +void RestoreAction(int token, DoAction doAct) +{ + UndoRedoSelection_t sel = INIT_UNDOREDOSEL; + + if (UndoRedoActionMap(token, &sel) >= 0) + { + // we are inside undo/redo transaction, so do delayed PostMessage() instead of SendMessage() + #define ISSUE_MESSAGE PostMessage + + const DocPos _anchorPos = (doAct == UNDO ? sel.anchorPos_undo : sel.anchorPos_redo); + const DocPos _curPos = (doAct == UNDO ? sel.curPos_undo : sel.curPos_redo); + + // Ensure that the first and last lines of a selection are always unfolded + // This needs to be done _before_ the SCI_SETSEL message + const DocLn anchorPosLine = SciCall_LineFromPosition(_anchorPos); + const DocLn currPosLine = SciCall_LineFromPosition(_curPos); + ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, anchorPosLine, 0); + if (anchorPosLine != currPosLine) { ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, currPosLine, 0); } + + + const int selectionMode = (doAct == UNDO ? sel.selMode_undo : sel.selMode_redo); + ISSUE_MESSAGE(g_hwndEdit, SCI_SETSELECTIONMODE, (WPARAM)selectionMode, 0); + + // independent from selection mode + ISSUE_MESSAGE(g_hwndEdit, SCI_SETANCHOR, (WPARAM)_anchorPos, 0); + ISSUE_MESSAGE(g_hwndEdit, SCI_SETCURRENTPOS, (WPARAM)_curPos, 0); + + switch (selectionMode) + { + case SC_SEL_RECTANGLE: + ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHOR, (WPARAM)_anchorPos, 0); + ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARET, (WPARAM)_curPos, 0); + // fall-through + + case SC_SEL_THIN: + { + const DocPos anchorVS = (doAct == UNDO ? sel.anchorVS_undo : sel.anchorVS_redo); + const DocPos currVS = (doAct == UNDO ? sel.curVS_undo : sel.curVS_redo); + if ((anchorVS != 0) || (currVS != 0)) { + ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (WPARAM)anchorVS, 0); + ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, (WPARAM)currVS, 0); + } + } + break; + + case SC_SEL_LINES: + case SC_SEL_STREAM: + default: + // nothing to do here + break; + } + ISSUE_MESSAGE(g_hwndEdit, SCI_SCROLLCARET, 0, 0); + ISSUE_MESSAGE(g_hwndEdit, SCI_CHOOSECARETX, 0, 0); + ISSUE_MESSAGE(g_hwndEdit, SCI_CANCEL, 0, 0); + + #undef ISSUE_MASSAGE + } +} + + +//============================================================================= +// +// UndoSelectionMap() +// +// +int UndoRedoActionMap(int token, UndoRedoSelection_t* selection) +{ + if (UndoRedoSelectionUTArray == NULL) { return -1; } + + static unsigned int iTokenCnt = 0; + + // indexing is unsigned + unsigned int utoken = (token >= 0) ? (unsigned int)token : 0U; + + if (selection == NULL) { + // reset / clear + SendMessage(g_hwndEdit, SCI_EMPTYUNDOBUFFER, 0, 0); + utarray_clear(UndoRedoSelectionUTArray); + utarray_init(UndoRedoSelectionUTArray, &UndoRedoSelection_icd); + iTokenCnt = 0U; + return -1; + } + + if (!SciCall_GetUndoCollection()) { return -1; } + + // get or set map item request ? + if ((token >= 0) && (utoken < iTokenCnt)) + { + if (selection->anchorPos_undo < 0) { + // this is a get request + *selection = *(UndoRedoSelection_t*)utarray_eltptr(UndoRedoSelectionUTArray, utoken); + } + else { + // this is a set request (fill redo pos) + utarray_insert(UndoRedoSelectionUTArray, (void*)selection, utoken); + } + // don't clear map item here (token used in redo/undo again) + } + else if (token < 0) { + // set map new item request + utarray_insert(UndoRedoSelectionUTArray, (void*)selection, iTokenCnt); + token = (int)iTokenCnt; + iTokenCnt = (iTokenCnt < INT_MAX) ? (iTokenCnt + 1) : 0U; // round robin next + } + return token; +} + + +//============================================================================= +// +// FileIO() +// +// +bool FileIO(bool fLoad,LPCWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANSICPDetection, + int *ienc,int *ieol, + bool *pbUnicodeErr,bool *pbFileTooBig, bool* pbUnknownExt, + bool *pbCancelDataLoss,bool bSaveCopy) +{ + WCHAR tch[MAX_PATH+40]; + bool fSuccess; + DWORD dwFileAttributes; + + FormatString(tch,COUNTOF(tch),(fLoad) ? IDS_LOADFILE : IDS_SAVEFILE, PathFindFileName(pszFileName)); + + BeginWaitCursor(tch); + + if (fLoad) { + fSuccess = EditLoadFile(g_hwndEdit,pszFileName,bSkipUnicodeDetect,bSkipANSICPDetection,ienc,ieol,pbUnicodeErr,pbFileTooBig,pbUnknownExt); + } + else { + int idx; + if (MRU_FindFile(g_pFileMRU,pszFileName,&idx)) { + g_pFileMRU->iEncoding[idx] = *ienc; + g_pFileMRU->iCaretPos[idx] = (bPreserveCaretPos ? SciCall_GetCurrentPos() : 0); + WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; + EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); + if (g_pFileMRU->pszBookMarks[idx]) + LocalFree(g_pFileMRU->pszBookMarks[idx]); + g_pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); + } + fSuccess = EditSaveFile(g_hwndEdit,pszFileName,*ienc,pbCancelDataLoss,bSaveCopy); + } + + dwFileAttributes = GetFileAttributes(pszFileName); + bReadOnly = (dwFileAttributes != INVALID_FILE_ATTRIBUTES && dwFileAttributes & FILE_ATTRIBUTE_READONLY); + + EndWaitCursor(); + + return(fSuccess); +} + + +//============================================================================= +// +// FileLoad() +// +// +bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, bool bSkipANSICPDetection, LPCWSTR lpszFile) +{ + WCHAR tch[MAX_PATH] = { L'\0' }; + WCHAR szFileName[MAX_PATH] = { L'\0' }; + bool bUnicodeErr = false; + bool bFileTooBig = false; + bool bUnknownExt = false; + bool fSuccess; + int fileEncoding = CPI_ANSI_DEFAULT; + + if (bNew || bReload) { + if (EditToggleView(g_hwndEdit, false)) { + EditToggleView(g_hwndEdit, true); + } + } + + if (!bDontSave) + { + if (!FileSave(false,true,false,false)) + return false; + } + + if (!bReload) { ResetEncryption(); } + + if (bNew) { + StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),L""); + SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); + SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); + if (!fKeepTitleExcerpt) + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + FileVars_Init(NULL,0,&fvCurFile); + EditSetNewText(g_hwndEdit,"",0); + Style_SetLexer(g_hwndEdit,NULL); + + g_iEOLMode = iLineEndings[g_iDefaultEOLMode]; + SendMessage(g_hwndEdit,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); + Encoding_Current(g_iDefaultNewFileEncoding); + Encoding_HasChanged(g_iDefaultNewFileEncoding); + EditSetNewText(g_hwndEdit,"",0); + + bReadOnly = false; + _SetDocumentModified(false); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + + // Terminate file watching + if (bResetFileWatching) { + iFileWatchingMode = 0; + } + InstallFileWatching(NULL); + bEnableSaveSettings = true; + UpdateSettingsCmds(); + return true; + } + + if (!lpszFile || lstrlen(lpszFile) == 0) { + if (!OpenFileDlg(g_hwndMain,tch,COUNTOF(tch),NULL)) + return false; + } + else + StringCchCopy(tch,COUNTOF(tch),lpszFile); + + ExpandEnvironmentStringsEx(tch,COUNTOF(tch)); + + if (PathIsRelative(tch)) { + StringCchCopyN(szFileName,COUNTOF(szFileName),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); + PathCchAppend(szFileName,COUNTOF(szFileName),tch); + if (!PathFileExists(szFileName)) { + WCHAR wchFullPath[MAX_PATH] = { L'\0' }; + if (SearchPath(NULL,tch,NULL,COUNTOF(wchFullPath),wchFullPath,NULL)) { + StringCchCopy(szFileName,COUNTOF(szFileName),wchFullPath); + } + } + } + else + StringCchCopy(szFileName,COUNTOF(szFileName),tch); + + NormalizePathEx(szFileName,COUNTOF(szFileName)); + + if (PathIsLnkFile(szFileName)) + PathGetLnkPath(szFileName,szFileName,COUNTOF(szFileName)); + + // change current directory to prevent directory lock on another path + WCHAR szFolder[MAX_PATH+2]; + if (SUCCEEDED(StringCchCopy(szFolder,COUNTOF(szFolder),tch))) { + if (SUCCEEDED(PathCchRemoveFileSpec(szFolder,COUNTOF(szFolder)))) { + SetCurrentDirectory(szFolder); + } + } + + // Ask to create a new file... + if (!bReload && !PathFileExists(szFileName)) + { + if (flagQuietCreate || MsgBox(MBYESNO,IDS_ASK_CREATE,szFileName) == IDYES) { + HANDLE hFile = CreateFile(szFileName, + GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); + dwLastIOError = GetLastError(); + fSuccess = (hFile != INVALID_HANDLE_VALUE); + if (fSuccess) { + FileVars_Init(NULL,0,&fvCurFile); + EditSetNewText(g_hwndEdit,"",0); + Style_SetLexer(g_hwndEdit,NULL); + g_iEOLMode = iLineEndings[g_iDefaultEOLMode]; + SendMessage(g_hwndEdit,SCI_SETEOLMODE,iLineEndings[g_iDefaultEOLMode],0); + if (Encoding_SrcCmdLn(CPI_GET) != CPI_NONE) { + fileEncoding = Encoding_SrcCmdLn(CPI_GET); + Encoding_Current(fileEncoding); + Encoding_HasChanged(fileEncoding); + } + else { + Encoding_Current(g_iDefaultNewFileEncoding); + Encoding_HasChanged(g_iDefaultNewFileEncoding); + } + bReadOnly = false; + EditSetNewText(g_hwndEdit,"",0); + } + if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) { + CloseHandle(hFile); + } + } + else + return false; + } + else { + int idx; + if (!bReload && MRU_FindFile(g_pFileMRU,szFileName,&idx)) { + fileEncoding = g_pFileMRU->iEncoding[idx]; + if (fileEncoding > 0) + Encoding_SrcCmdLn(Encoding_MapUnicode(fileEncoding)); + } + else + fileEncoding = Encoding_Current(CPI_GET); + + fSuccess = FileIO(true,szFileName,bSkipUnicodeDetect,bSkipANSICPDetection,&fileEncoding,&g_iEOLMode,&bUnicodeErr,&bFileTooBig,&bUnknownExt,NULL,false); + if (fSuccess) + Encoding_Current(fileEncoding); // load may change encoding + } + if (fSuccess) { + StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),szFileName); + SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); + SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); + + if (!fKeepTitleExcerpt) + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + + if (!flagLexerSpecified) // flag will be cleared + Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); + + SendMessage(g_hwndEdit,SCI_SETEOLMODE,g_iEOLMode,0); + fileEncoding = Encoding_Current(CPI_GET); + Encoding_HasChanged(fileEncoding); + int idx = 0; + DocPos iCaretPos = 0; + LPCWSTR pszBookMarks = L""; + if (!bReload && MRU_FindFile(g_pFileMRU,szFileName,&idx)) { + iCaretPos = g_pFileMRU->iCaretPos[idx]; + pszBookMarks = g_pFileMRU->pszBookMarks[idx]; + } + MRU_AddFile(g_pFileMRU,szFileName,flagRelativeFileMRU,flagPortableMyDocs,fileEncoding,iCaretPos,pszBookMarks); + + EditSetBookmarkList(g_hwndEdit, pszBookMarks); + SetFindPattern((g_pMRUfind ? g_pMRUfind->pszItems[0] : L"")); + + if (flagUseSystemMRU == 2) + SHAddToRecentDocs(SHARD_PATHW,szFileName); + + // Install watching of the current file + if (!bReload && bResetFileWatching) + iFileWatchingMode = 0; + InstallFileWatching(g_wchCurFile); + + // the .LOG feature ... + if (SciCall_GetTextLength() >= 4) { + char tchLog[5] = { '\0' }; + SendMessage(g_hwndEdit,SCI_GETTEXT,5,(LPARAM)tchLog); + if (StringCchCompareXA(tchLog,".LOG") == 0) { + EditJumpTo(g_hwndEdit,-1,0); + SendMessage(g_hwndEdit,SCI_BEGINUNDOACTION,0,0); + SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); + SendMessage(g_hwndMain,WM_COMMAND,MAKELONG(IDM_EDIT_INSERT_SHORTDATE,1),0); + EditJumpTo(g_hwndEdit,-1,0); + SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); + SendMessage(g_hwndEdit,SCI_ENDUNDOACTION,0,0); + SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); + EditEnsureSelectionVisible(g_hwndEdit); + } + // set historic caret pos + else if (iCaretPos > 0) + { + SendMessage(g_hwndEdit, SCI_GOTOPOS, (WPARAM)iCaretPos, 0); + // adjust view + const DocPos iCurPos = SciCall_GetCurrentPos(); + EditJumpTo(g_hwndEdit, SciCall_LineFromPosition(iCurPos) + 1, SciCall_GetColumn(iCurPos) + 1); + } + } + + //bReadOnly = false; + _SetDocumentModified(false); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + UpdateVisibleUrlHotspot(0); + + // consistent settings file handling (if loaded in editor) + bEnableSaveSettings = (StringCchCompareINW(g_wchCurFile, COUNTOF(g_wchCurFile), g_wchIniFile, COUNTOF(g_wchIniFile)) == 0) ? false : true; + UpdateSettingsCmds(); + + // Show warning: Unicode file loaded as ANSI + if (bUnicodeErr) + MsgBox(MBWARN,IDS_ERR_UNICODE); + } + + else if (!(bFileTooBig || bUnknownExt)) + MsgBox(MBWARN,IDS_ERR_LOADFILE,szFileName); + + return(fSuccess); +} + + + +//============================================================================= +// +// FileRevert() +// +// +bool FileRevert(LPCWSTR szFileName) +{ + if (StringCchLen(szFileName, MAX_PATH) != 0) { + + const DocPos iCurPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionCaret() : SciCall_GetCurrentPos(); + const DocPos iAnchorPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionAnchor() : SciCall_GetAnchor(); + //const int vSpcCaretPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionCaretVirtualSpace() : -1; + //const int vSpcAnchorPos = SciCall_IsSelectionRectangle() ? SciCall_GetRectangularSelectionAnchorVirtualSpace() : -1; + + const DocLn iCurrLine = SciCall_LineFromPosition(iCurPos); + const DocPos iCurColumn = SciCall_GetColumn(iCurPos); + const DocLn iVisTopLine = SciCall_GetFirstVisibleLine(); + const DocLn iDocTopLine = SciCall_DocLineFromVisible(iVisTopLine); + const int iXOffset = SciCall_GetXoffset(); + const bool bIsTail = (iCurPos == iAnchorPos) && (iCurrLine >= (SciCall_GetLineCount() - 1)); + + Encoding_SrcWeak(Encoding_Current(CPI_GET)); + + WCHAR tchFileName2[MAX_PATH] = { L'\0' }; + StringCchCopyW(tchFileName2,COUNTOF(tchFileName2),szFileName); + + if (FileLoad(true,false,true,false,true,tchFileName2)) + { + if (bIsTail && iFileWatchingMode == 2) { + SendMessage(g_hwndEdit, SCI_DOCUMENTEND, 0, 0); + EditEnsureSelectionVisible(g_hwndEdit); + } + else if (SciCall_GetTextLength() >= 4) { + char tch[5] = { '\0' }; + + SciCall_GetText(5, tch); + if (StringCchCompareXA(tch,".LOG") != 0) { + SciCall_ClearSelections(); + //~EditSelectEx(g_hwndEdit, iAnchorPos, iCurPos, vSpcAnchorPos, vSpcCaretPos); + EditJumpTo(g_hwndEdit, iCurrLine+1, iCurColumn+1); + SciCall_EnsureVisible(iDocTopLine); + const DocLn iNewTopLine = SciCall_GetFirstVisibleLine(); + SciCall_LineScroll(0,iVisTopLine - iNewTopLine); + SciCall_SetXoffset(iXOffset); + } + } + return true; + } + } + return false; +} + + +//============================================================================= +// +// FileSave() +// +// +bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) +{ + WCHAR tchFile[MAX_PATH] = { L'\0' }; + WCHAR tchBase[MAX_PATH] = { L'\0' }; + bool fSuccess = false; + bool bCancelDataLoss = false; + + bool bIsEmptyNewFile = false; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) { + const DocPos cchText = SciCall_GetTextLength(); + if (cchText == 0) + bIsEmptyNewFile = true; + else if (cchText < 1023) { + char tchText[1024]; + SendMessage(g_hwndEdit,SCI_GETTEXT,(WPARAM)1023,(LPARAM)tchText); + StrTrimA(tchText," \t\n\r"); + if (lstrlenA(tchText) == 0) + bIsEmptyNewFile = true; + } + } + + if (!bSaveAlways && (!IsDocumentModified && !Encoding_HasChanged(CPI_GET) || bIsEmptyNewFile) && !bSaveAs) { + int idx; + if (MRU_FindFile(g_pFileMRU,g_wchCurFile,&idx)) { + g_pFileMRU->iEncoding[idx] = Encoding_Current(CPI_GET); + g_pFileMRU->iCaretPos[idx] = (bPreserveCaretPos) ? SciCall_GetCurrentPos() : 0; + WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; + EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); + if (g_pFileMRU->pszBookMarks[idx]) + LocalFree(g_pFileMRU->pszBookMarks[idx]); + g_pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); + } + return true; + } + + if (bAsk) + { + // File or "Untitled" ... + WCHAR tch[MAX_PATH] = { L'\0' }; + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + StringCchCopy(tch,COUNTOF(tch),g_wchCurFile); + else + GetString(IDS_UNTITLED,tch,COUNTOF(tch)); + + switch (MsgBox(MBYESNOCANCEL,IDS_ASK_SAVE,tch)) { + case IDCANCEL: + return false; + case IDNO: + return true; + } + } + + // Read only... + if (!bSaveAs && !bSaveCopy && StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) + { + DWORD dwFileAttributes = GetFileAttributes(g_wchCurFile); + if (dwFileAttributes != INVALID_FILE_ATTRIBUTES) + bReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY); + if (bReadOnly) { + UpdateToolbar(); + if (MsgBox(MBYESNOWARN,IDS_READONLY_SAVE,g_wchCurFile) == IDYES) + bSaveAs = true; + else + return false; + } + } + + // Save As... + if (bSaveAs || bSaveCopy || StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) == 0) + { + WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; + if (bSaveCopy && StringCchLenW(tchLastSaveCopyDir,COUNTOF(tchLastSaveCopyDir))) { + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),tchLastSaveCopyDir); + StringCchCopy(tchFile,COUNTOF(tchFile),tchLastSaveCopyDir); + PathCchAppend(tchFile,COUNTOF(tchFile),PathFindFileName(g_wchCurFile)); + } + else + StringCchCopy(tchFile,COUNTOF(tchFile),g_wchCurFile); + + if (SaveFileDlg(g_hwndMain,tchFile,COUNTOF(tchFile),tchInitialDir)) + { + int fileEncoding = Encoding_Current(CPI_GET); + fSuccess = FileIO(false, tchFile, false, true, &fileEncoding, &g_iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, bSaveCopy); + //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding + if (fSuccess) + { + if (!bSaveCopy) + { + StringCchCopy(g_wchCurFile,COUNTOF(g_wchCurFile),tchFile); + SetDlgItemText(g_hwndMain,IDC_FILENAME,g_wchCurFile); + SetDlgItemInt(g_hwndMain,IDC_REUSELOCK,GetTickCount(),false); + if (!fKeepTitleExcerpt) + StringCchCopy(szTitleExcerpt,COUNTOF(szTitleExcerpt),L""); + Style_SetLexerFromFile(g_hwndEdit,g_wchCurFile); + UpdateToolbar(); + UpdateStatusbar(); + UpdateLineNumberWidth(); + } + else { + StringCchCopy(tchLastSaveCopyDir,COUNTOF(tchLastSaveCopyDir),tchFile); + PathRemoveFileSpec(tchLastSaveCopyDir); + } + } + } + else + return false; + } + else { + int fileEncoding = Encoding_Current(CPI_GET); + fSuccess = FileIO(false, g_wchCurFile, false, true, &fileEncoding, &g_iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, false); + //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding + } + + if (fSuccess) + { + if (!bSaveCopy) + { + int iCurrEnc = Encoding_Current(CPI_GET); + Encoding_HasChanged(iCurrEnc); + const DocPos iCaretPos = SciCall_GetCurrentPos(); + WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; + EditGetBookmarkList(g_hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); + MRU_AddFile(g_pFileMRU,g_wchCurFile,flagRelativeFileMRU,flagPortableMyDocs,iCurrEnc,iCaretPos,wchBookMarks); + if (flagUseSystemMRU == 2) + SHAddToRecentDocs(SHARD_PATHW,g_wchCurFile); + + _SetDocumentModified(false); + // Install watching of the current file + if (bSaveAs && bResetFileWatching) + iFileWatchingMode = 0; + InstallFileWatching(g_wchCurFile); + } + } + else if (!bCancelDataLoss) + { + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile)) > 0) { + StringCchCopy(tchFile,COUNTOF(tchFile),g_wchCurFile); + StringCchCopy(tchBase,COUNTOF(tchBase),g_wchCurFile); + PathStripPath(tchBase); + } + if (!flagIsElevated && dwLastIOError == ERROR_ACCESS_DENIED) { + if (IDYES == MsgBox(MBYESNOWARN,IDS_ERR_ACCESSDENIED,tchFile)) { + WCHAR lpTempPathBuffer[MAX_PATH]; + WCHAR szTempFileName[MAX_PATH]; + + if (GetTempPath(MAX_PATH,lpTempPathBuffer) && + GetTempFileName(lpTempPathBuffer,TEXT("NP3"),0,szTempFileName)) { + int fileEncoding = Encoding_Current(CPI_GET); + if (FileIO(false,szTempFileName,false,true,&fileEncoding,&g_iEOLMode,NULL,NULL,NULL,&bCancelDataLoss,true)) { + //~Encoding_Current(fileEncoding); // save should not change encoding + WCHAR szArguments[2048] = { L'\0' }; + LPWSTR lpCmdLine = GetCommandLine(); + int wlen = lstrlen(lpCmdLine) + 2; + LPWSTR lpExe = LocalAlloc(LPTR,sizeof(WCHAR)*wlen); + LPWSTR lpArgs = LocalAlloc(LPTR,sizeof(WCHAR)*wlen); + ExtractFirstArgument(lpCmdLine,lpExe,lpArgs,wlen); + // remove relaunch elevated, we are doing this here already + lpArgs = StrCutI(lpArgs,L"/u "); + lpArgs = StrCutI(lpArgs,L"-u "); + WININFO wi = GetMyWindowPlacement(g_hwndMain,NULL); + StringCchPrintf(szArguments,COUNTOF(szArguments), + L"/pos %i,%i,%i,%i,%i /tmpfbuf=\"%s\" %s",wi.x,wi.y,wi.cx,wi.cy,wi.max,szTempFileName,lpArgs); + if (StringCchLenW(tchFile,COUNTOF(tchFile))) { + if (!StrStrI(szArguments,tchBase)) { + StringCchPrintf(szArguments,COUNTOF(szArguments),L"%s \"%s\"",szArguments,tchFile); + } + } + flagRelaunchElevated = 1; + if (RelaunchElevated(szArguments)) { + LocalFree(lpExe); + LocalFree(lpArgs); + // set no change and quit + Encoding_HasChanged(Encoding_Current(CPI_GET)); + _SetDocumentModified(false); + PostMessage(g_hwndMain,WM_CLOSE,0,0); + } + else { + if (PathFileExists(szTempFileName)) { + DeleteFile(szTempFileName); + } + UpdateToolbar(); + MsgBox(MBWARN,IDS_ERR_SAVEFILE,tchFile); + } + } + } + } + } + else { + UpdateToolbar(); + MsgBox(MBWARN,IDS_ERR_SAVEFILE,tchFile); + } + } + return(fSuccess); +} + + +//============================================================================= +// +// OpenFileDlg() +// +// +bool OpenFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir) +{ + OPENFILENAME ofn; + WCHAR szFile[MAX_PATH] = { L'\0' }; + WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100]; + WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; + + Style_GetOpenDlgFilterStr(szFilter,COUNTOF(szFilter)); + + if (!lpstrInitialDir) { + if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchCurFile); + PathRemoveFileSpec(tchInitialDir); + } + else if (StringCchLenW(tchDefaultDir,COUNTOF(tchDefaultDir))) { + ExpandEnvironmentStrings(tchDefaultDir,tchInitialDir,COUNTOF(tchInitialDir)); + if (PathIsRelative(tchInitialDir)) { + WCHAR tchModule[MAX_PATH] = { L'\0' }; + GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); + PathRemoveFileSpec(tchModule); + PathCchAppend(tchModule,COUNTOF(tchModule),tchInitialDir); + PathCchCanonicalize(tchInitialDir,COUNTOF(tchInitialDir),tchModule); + } + } + else + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchWorkingDirectory); + } + + ZeroMemory(&ofn,sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrFile = szFile; + ofn.lpstrInitialDir = (lpstrInitialDir) ? lpstrInitialDir : tchInitialDir; + ofn.nMaxFile = COUNTOF(szFile); + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | /* OFN_NOCHANGEDIR |*/ + OFN_DONTADDTORECENT | OFN_PATHMUSTEXIST | + OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/; + ofn.lpstrDefExt = (StringCchLenW(tchDefaultExtension,COUNTOF(tchDefaultExtension))) ? tchDefaultExtension : NULL; + + if (GetOpenFileName(&ofn)) { + StringCchCopyN(lpstrFile,cchFile,szFile,COUNTOF(szFile)); + return true; + } + + else + return false; +} + + +//============================================================================= +// +// SaveFileDlg() +// +// +bool SaveFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir) +{ + OPENFILENAME ofn; + WCHAR szNewFile[MAX_PATH] = { L'\0' }; + WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100] = { L'\0' }; + WCHAR tchInitialDir[MAX_PATH] = { L'\0' }; + + StringCchCopy(szNewFile,COUNTOF(szNewFile),lpstrFile); + Style_GetOpenDlgFilterStr(szFilter,COUNTOF(szFilter)); + + if (lstrlen(lpstrInitialDir)) + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),lpstrInitialDir); + else if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchCurFile); + PathRemoveFileSpec(tchInitialDir); + } + else if (StringCchLenW(tchDefaultDir,COUNTOF(tchDefaultDir))) { + ExpandEnvironmentStrings(tchDefaultDir,tchInitialDir,COUNTOF(tchInitialDir)); + if (PathIsRelative(tchInitialDir)) { + WCHAR tchModule[MAX_PATH] = { L'\0' }; + GetModuleFileName(NULL,tchModule,COUNTOF(tchModule)); + PathRemoveFileSpec(tchModule); + PathCchAppend(tchModule,COUNTOF(tchModule),tchInitialDir); + PathCchCanonicalize(tchInitialDir,COUNTOF(tchInitialDir),tchModule); + } + } + else + StringCchCopy(tchInitialDir,COUNTOF(tchInitialDir),g_wchWorkingDirectory); + + ZeroMemory(&ofn,sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrFile = szNewFile; + ofn.lpstrInitialDir = tchInitialDir; + ofn.nMaxFile = MAX_PATH; + ofn.Flags = OFN_HIDEREADONLY /*| OFN_NOCHANGEDIR*/ | + /*OFN_NODEREFERENCELINKS |*/ OFN_OVERWRITEPROMPT | + OFN_DONTADDTORECENT | OFN_PATHMUSTEXIST; + ofn.lpstrDefExt = (StringCchLenW(tchDefaultExtension,COUNTOF(tchDefaultExtension))) ? tchDefaultExtension : NULL; + + if (GetSaveFileName(&ofn)) { + StringCchCopyN(lpstrFile,cchFile,szNewFile,COUNTOF(szNewFile)); + return true; + } + + else + return false; +} + + +/****************************************************************************** +* +* ActivatePrevInst() +* +* Tries to find and activate an already open Notepad3 Window +* +* +******************************************************************************/ +BOOL CALLBACK EnumWndProc(HWND hwnd,LPARAM lParam) +{ + BOOL bContinue = TRUE; + WCHAR szClassName[64] = { L'\0' }; + + if (GetClassName(hwnd,szClassName,COUNTOF(szClassName))) + + if (StringCchCompareINW(szClassName,COUNTOF(szClassName),wchWndClass,COUNTOF(wchWndClass)) == 0) { + + DWORD dwReuseLock = GetDlgItemInt(hwnd,IDC_REUSELOCK,NULL,FALSE); + if (GetTickCount() - dwReuseLock >= REUSEWINDOWLOCKTIMEOUT) { + + *(HWND*)lParam = hwnd; + + if (IsWindowEnabled(hwnd)) + bContinue = FALSE; + } + } + return bContinue; +} + +BOOL CALLBACK EnumWndProc2(HWND hwnd,LPARAM lParam) +{ + BOOL bContinue = TRUE; + WCHAR szClassName[64] = { L'\0' }; + + if (GetClassName(hwnd,szClassName,COUNTOF(szClassName))) + + if (StringCchCompareINW(szClassName,COUNTOF(szClassName),wchWndClass,COUNTOF(wchWndClass)) == 0) { + + DWORD dwReuseLock = GetDlgItemInt(hwnd,IDC_REUSELOCK,NULL,false); + if (GetTickCount() - dwReuseLock >= REUSEWINDOWLOCKTIMEOUT) { + + WCHAR tchFileName[MAX_PATH] = { L'\0' }; + + if (IsWindowEnabled(hwnd)) + bContinue = FALSE; + + GetDlgItemText(hwnd,IDC_FILENAME,tchFileName,COUNTOF(tchFileName)); + if (StringCchCompareIN(tchFileName,COUNTOF(tchFileName),lpFileArg,-1) == 0) + *(HWND*)lParam = hwnd; + else + bContinue = TRUE; + } + } + return bContinue; +} + +bool ActivatePrevInst() +{ + HWND hwnd = NULL; + COPYDATASTRUCT cds; + + if ((flagNoReuseWindow && !flagSingleFileInstance) || flagStartAsTrayIcon || flagNewFromClipboard || flagPasteBoard) + return(false); + + if (flagSingleFileInstance && lpFileArg) { + + // Search working directory from second instance, first! + // lpFileArg is at least MAX_PATH+4 WCHARS + WCHAR tchTmp[FILE_ARG_BUF] = { L'\0' }; + + ExpandEnvironmentStringsEx(lpFileArg,(DWORD)SizeOfMem(lpFileArg)/sizeof(WCHAR)); + + if (PathIsRelative(lpFileArg)) { + StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); + PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); + if (PathFileExists(tchTmp)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + else { + if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + else { + StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); + PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + } + } + } + + else if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + + NormalizePathEx(lpFileArg,FILE_ARG_BUF); + + EnumWindows(EnumWndProc2,(LPARAM)&hwnd); + + if (hwnd != NULL) + { + // Enabled + if (IsWindowEnabled(hwnd)) + { + // Make sure the previous window won't pop up a change notification message + //SendMessage(hwnd,WM_CHANGENOTIFYCLEAR,0,0); + + if (IsIconic(hwnd)) + ShowWindowAsync(hwnd,SW_RESTORE); + + if (!IsWindowVisible(hwnd)) { + SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONDBLCLK); + SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONUP); + } + + SetForegroundWindow(hwnd); + + DWORD cb = sizeof(np3params); + if (lpSchemeArg) + cb += (lstrlen(lpSchemeArg) + 1) * sizeof(WCHAR); + + LPnp3params params = AllocMem(cb, HEAP_ZERO_MEMORY); + params->flagFileSpecified = false; + params->flagChangeNotify = 0; + params->flagQuietCreate = false; + params->flagLexerSpecified = flagLexerSpecified; + if (flagLexerSpecified && lpSchemeArg) { + StringCchCopy(StrEnd(¶ms->wchData)+1,(lstrlen(lpSchemeArg)+1),lpSchemeArg); + params->iInitialLexer = -1; + } + else + params->iInitialLexer = iInitialLexer; + params->flagJumpTo = flagJumpTo; + params->iInitialLine = iInitialLine; + params->iInitialColumn = iInitialColumn; + + params->iSrcEncoding = (lpEncodingArg) ? Encoding_MatchW(lpEncodingArg) : CPI_NONE; + params->flagSetEncoding = flagSetEncoding; + params->flagSetEOLMode = flagSetEOLMode; + params->flagTitleExcerpt = 0; + + cds.dwData = DATA_NOTEPAD3_PARAMS; + cds.cbData = (DWORD)SizeOfMem(params); + cds.lpData = params; + + SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); + FreeMem(params); + + return(true); + } + + else // IsWindowEnabled() + { + // Ask... + if (IDYES == MsgBox(MBYESNOWARN,IDS_ERR_PREVWINDISABLED)) + return(false); + else + return(true); + } + } + } + + if (flagNoReuseWindow) + return(false); + + hwnd = NULL; + EnumWindows(EnumWndProc,(LPARAM)&hwnd); + + // Found a window + if (hwnd != NULL) + { + // Enabled + if (IsWindowEnabled(hwnd)) + { + // Make sure the previous window won't pop up a change notification message + //SendMessage(hwnd,WM_CHANGENOTIFYCLEAR,0,0); + + if (IsIconic(hwnd)) + ShowWindowAsync(hwnd,SW_RESTORE); + + if (!IsWindowVisible(hwnd)) { + SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONDBLCLK); + SendMessage(hwnd,WM_TRAYMESSAGE,0,WM_LBUTTONUP); + } + + SetForegroundWindow(hwnd); + + if (lpFileArg) + { + // Search working directory from second instance, first! + // lpFileArg is at least MAX_PATH+4 WCHAR + WCHAR tchTmp[FILE_ARG_BUF] = { L'\0' }; + + ExpandEnvironmentStringsEx(lpFileArg,(DWORD)SizeOfMem(lpFileArg)/sizeof(WCHAR)); + + if (PathIsRelative(lpFileArg)) { + StringCchCopyN(tchTmp,COUNTOF(tchTmp),g_wchWorkingDirectory,COUNTOF(g_wchWorkingDirectory)); + PathCchAppend(tchTmp,COUNTOF(tchTmp),lpFileArg); + if (PathFileExists(tchTmp)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + else { + if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + } + } + + else if (SearchPath(NULL,lpFileArg,NULL,COUNTOF(tchTmp),tchTmp,NULL)) + StringCchCopy(lpFileArg,FILE_ARG_BUF,tchTmp); + + DWORD cb = sizeof(np3params); + cb += (lstrlen(lpFileArg) + 1) * sizeof(WCHAR); + + if (lpSchemeArg) + cb += (lstrlen(lpSchemeArg) + 1) * sizeof(WCHAR); + + int cchTitleExcerpt = (int)StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt)); + if (cchTitleExcerpt) + cb += (cchTitleExcerpt + 1) * sizeof(WCHAR); + + LPnp3params params = AllocMem(cb, HEAP_ZERO_MEMORY); + params->flagFileSpecified = true; + StringCchCopy(¶ms->wchData,lstrlen(lpFileArg)+1,lpFileArg); + params->flagChangeNotify = flagChangeNotify; + params->flagQuietCreate = flagQuietCreate; + params->flagLexerSpecified = flagLexerSpecified; + if (flagLexerSpecified && lpSchemeArg) { + StringCchCopy(StrEnd(¶ms->wchData)+1,lstrlen(lpSchemeArg)+1,lpSchemeArg); + params->iInitialLexer = -1; + } + else + params->iInitialLexer = iInitialLexer; + params->flagJumpTo = flagJumpTo; + params->iInitialLine = iInitialLine; + params->iInitialColumn = iInitialColumn; + + params->iSrcEncoding = (lpEncodingArg) ? Encoding_MatchW(lpEncodingArg) : CPI_NONE; + params->flagSetEncoding = flagSetEncoding; + params->flagSetEOLMode = flagSetEOLMode; + + if (cchTitleExcerpt) { + StringCchCopy(StrEnd(¶ms->wchData)+1,cchTitleExcerpt+1,szTitleExcerpt); + params->flagTitleExcerpt = 1; + } + else + params->flagTitleExcerpt = 0; + + cds.dwData = DATA_NOTEPAD3_PARAMS; + cds.cbData = (DWORD)SizeOfMem(params); + cds.lpData = params; + + SendMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); + FreeMem(params); params = NULL; + FreeMem(lpFileArg); lpFileArg = NULL; + } + return(true); + } + else // IsWindowEnabled() + { + // Ask... + return ((IDYES == MsgBox(MBYESNOWARN, IDS_ERR_PREVWINDISABLED)) ? false : true); + } + } + else + return(false); +} + + +//============================================================================= +// +// RelaunchMultiInst() +// +// +bool RelaunchMultiInst() { + + if (flagMultiFileArg == 2 && cFileList > 1) { + + WCHAR *pwch; + int i = 0; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + LPWSTR lpCmdLineNew = StrDup(GetCommandLine()); + int len = lstrlen(lpCmdLineNew) + 1; + LPWSTR lp1 = LocalAlloc(LPTR,sizeof(WCHAR)*len); + LPWSTR lp2 = LocalAlloc(LPTR,sizeof(WCHAR)*len); + + StrTab2Space(lpCmdLineNew); + StringCchCopy(lpCmdLineNew + cchiFileList,2,L""); + + pwch = CharPrev(lpCmdLineNew,StrEnd(lpCmdLineNew)); + while (*pwch == L' ' || *pwch == L'-' || *pwch == L'+') { + *pwch = L' '; + pwch = CharPrev(lpCmdLineNew,pwch); + if (i++ > 1) + cchiFileList--; + } + + for (i = 0; i < cFileList; i++) + { + StringCchCopy(lpCmdLineNew + cchiFileList,8,L" /n - "); + StringCchCat(lpCmdLineNew,len,lpFileList[i]); + LocalFree(lpFileList[i]); + + ZeroMemory(&si,sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + + ZeroMemory(&pi,sizeof(PROCESS_INFORMATION)); + + CreateProcess(NULL,lpCmdLineNew,NULL,NULL,false,0,NULL,g_wchWorkingDirectory,&si,&pi); + } + + LocalFree(lpCmdLineNew); + LocalFree(lp1); + LocalFree(lp2); + FreeMem(lpFileArg); lpFileArg = NULL; + + return true; + } + + else { + int i; + for (i = 0; i < cFileList; i++) + LocalFree(lpFileList[i]); + return false; + } +} + + +//============================================================================= +// +// RelaunchElevated() +// +// +bool RelaunchElevated(LPWSTR lpArgs) { + + bool result = false; + + if (!IsVista() || flagIsElevated || !flagRelaunchElevated || flagDisplayHelp) + return result; + + STARTUPINFO si; + si.cb = sizeof(STARTUPINFO); + GetStartupInfo(&si); + + LPWSTR lpCmdLine = GetCommandLine(); + int wlen = lstrlen(lpCmdLine) + 2; + + WCHAR lpExe[MAX_PATH + 2] = { L'\0' }; + WCHAR szArgs[2032] = { L'\0' }; + WCHAR szArguments[2032] = { L'\0' }; + + ExtractFirstArgument(lpCmdLine,lpExe,szArgs,wlen); + + if (lpArgs) { + StringCchCopy(szArgs,COUNTOF(szArgs),lpArgs); // override + } + + if (StrStrI(szArgs,L"/f ") || StrStrI(szArgs,L"-f ")) { + StringCchCopy(szArguments,COUNTOF(szArguments),szArgs); + } + else { + if (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) > 0) + StringCchPrintf(szArguments,COUNTOF(szArguments),L"/f \"%s\" %s",g_wchIniFile,szArgs); + else + StringCchCopy(szArguments,COUNTOF(szArguments),szArgs); + } + + if (lstrlen(szArguments)) { + SHELLEXECUTEINFO sei; + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOZONECHECKS; + sei.hwnd = GetForegroundWindow(); + sei.lpVerb = L"runas"; + sei.lpFile = lpExe; + sei.lpParameters = szArguments; + sei.lpDirectory = g_wchWorkingDirectory; + sei.nShow = si.wShowWindow ? si.wShowWindow : SW_SHOWNORMAL; + result = ShellExecuteEx(&sei); + } + + return result; +} + + +//============================================================================= +// +// SnapToDefaultPos() +// +// Aligns Notepad3 to the default window position on the current screen +// +// +void SnapToDefaultPos(HWND hwnd) +{ + RECT rcOld; GetWindowRect(hwnd, &rcOld); + + RECT rc; SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); + + flagDefaultPos = 2; + _InitWindowPosition(hwnd); + + WINDOWPLACEMENT wndpl; + ZeroMemory(&wndpl, sizeof(WINDOWPLACEMENT)); + wndpl.length = sizeof(WINDOWPLACEMENT); + wndpl.flags = WPF_ASYNCWINDOWPLACEMENT; + wndpl.showCmd = SW_RESTORE; + + wndpl.rcNormalPosition.left = g_WinInfo.x - rc.left; + wndpl.rcNormalPosition.top = g_WinInfo.y - rc.top; + wndpl.rcNormalPosition.right = g_WinInfo.x - rc.left + g_WinInfo.cx; + wndpl.rcNormalPosition.bottom = g_WinInfo.y - rc.top + g_WinInfo.cy; + + if (GetDoAnimateMinimize()) { + DrawAnimatedRects(hwnd,IDANI_CAPTION,&rcOld,&wndpl.rcNormalPosition); + //OffsetRect(&wndpl.rcNormalPosition,mi.rcMonitor.left - mi.rcWork.left,mi.rcMonitor.top - mi.rcWork.top); + } + SetWindowPlacement(hwnd,&wndpl); +} + + +//============================================================================= +// +// ShowNotifyIcon() +// +// +void ShowNotifyIcon(HWND hwnd,bool bAdd) +{ + + static HICON hIcon; + NOTIFYICONDATA nid; + + if (!hIcon) + hIcon = LoadImage(g_hInstance,MAKEINTRESOURCE(IDR_MAINWND),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); + + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + nid.cbSize = sizeof(NOTIFYICONDATA); + nid.hWnd = hwnd; + nid.uID = 0; + nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; + nid.uCallbackMessage = WM_TRAYMESSAGE; + nid.hIcon = hIcon; + StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L"Notepad3"); + + if(bAdd) + Shell_NotifyIcon(NIM_ADD,&nid); + else + Shell_NotifyIcon(NIM_DELETE,&nid); + +} + + +//============================================================================= +// +// SetNotifyIconTitle() +// +// +void SetNotifyIconTitle(HWND hwnd) +{ + + NOTIFYICONDATA nid; + SHFILEINFO shfi; + WCHAR tchTitle[256] = { L'\0' }; + WCHAR tchFormat[32] = { L'\0' }; + + ZeroMemory(&nid,sizeof(NOTIFYICONDATA)); + nid.cbSize = sizeof(NOTIFYICONDATA); + nid.hWnd = hwnd; + nid.uID = 0; + nid.uFlags = NIF_TIP; + + if (StringCchLenW(szTitleExcerpt,COUNTOF(szTitleExcerpt))) { + GetString(IDS_TITLEEXCERPT,tchFormat,COUNTOF(tchFormat)); + StringCchPrintf(tchTitle,COUNTOF(tchTitle),tchFormat,szTitleExcerpt); + } + + else if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) { + SHGetFileInfo2(g_wchCurFile,FILE_ATTRIBUTE_NORMAL, + &shfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + PathCompactPathEx(tchTitle,shfi.szDisplayName,COUNTOF(tchTitle)-4,0); + } + else + GetString(IDS_UNTITLED,tchTitle,COUNTOF(tchTitle)-4); + + if (IsDocumentModified || Encoding_HasChanged(CPI_GET)) + StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L"* "); + else + StringCchCopy(nid.szTip,COUNTOF(nid.szTip),L""); + + StringCchCat(nid.szTip,COUNTOF(nid.szTip),tchTitle); + + Shell_NotifyIcon(NIM_MODIFY,&nid); +} + + +//============================================================================= +// +// InstallFileWatching() +// +// +void InstallFileWatching(LPCWSTR lpszFile) +{ + + WCHAR tchDirectory[MAX_PATH] = { L'\0' }; + HANDLE hFind; + + // Terminate + if (!iFileWatchingMode || !lpszFile || StringCchLen(lpszFile,MAX_PATH) == 0) + { + if (bRunningWatch) + { + if (hChangeHandle) { + FindCloseChangeNotification(hChangeHandle); + hChangeHandle = NULL; + } + KillTimer(NULL,ID_WATCHTIMER); + bRunningWatch = false; + dwChangeNotifyTime = 0; + } + } + else // Install + { + // Terminate previous watching + if (bRunningWatch) { + if (hChangeHandle) { + FindCloseChangeNotification(hChangeHandle); + hChangeHandle = NULL; + } + dwChangeNotifyTime = 0; + } + + // No previous watching installed, so launch the timer first + else + SetTimer(NULL,ID_WATCHTIMER,dwFileCheckInverval,WatchTimerProc); + + StringCchCopy(tchDirectory,COUNTOF(tchDirectory),lpszFile); + PathRemoveFileSpec(tchDirectory); + + // Save data of current file + hFind = FindFirstFile(g_wchCurFile,&fdCurFile); + if (hFind != INVALID_HANDLE_VALUE) + FindClose(hFind); + else + ZeroMemory(&fdCurFile,sizeof(WIN32_FIND_DATA)); + + hChangeHandle = FindFirstChangeNotification(tchDirectory,false, + FILE_NOTIFY_CHANGE_FILE_NAME | \ + FILE_NOTIFY_CHANGE_DIR_NAME | \ + FILE_NOTIFY_CHANGE_ATTRIBUTES | \ + FILE_NOTIFY_CHANGE_SIZE | \ + FILE_NOTIFY_CHANGE_LAST_WRITE); + + bRunningWatch = true; + dwChangeNotifyTime = 0; + } + UpdateToolbar(); +} + + +//============================================================================= +// +// WatchTimerProc() +// +// +void CALLBACK WatchTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) +{ + if (bRunningWatch) + { + if (dwChangeNotifyTime > 0 && GetTickCount() - dwChangeNotifyTime > dwAutoReloadTimeout) + { + if (hChangeHandle) { + FindCloseChangeNotification(hChangeHandle); + hChangeHandle = NULL; + } + KillTimer(NULL,ID_WATCHTIMER); + bRunningWatch = false; + dwChangeNotifyTime = 0; + SendMessage(g_hwndMain,WM_CHANGENOTIFY,0,0); + } + + // Check Change Notification Handle + else if (WAIT_OBJECT_0 == WaitForSingleObject(hChangeHandle,0)) + { + // Check if the changes affect the current file + WIN32_FIND_DATA fdUpdated; + HANDLE hFind = FindFirstFile(g_wchCurFile,&fdUpdated); + if (INVALID_HANDLE_VALUE != hFind) + FindClose(hFind); + else + // The current file has been removed + ZeroMemory(&fdUpdated,sizeof(WIN32_FIND_DATA)); + + // Check if the file has been changed + if (CompareFileTime(&fdCurFile.ftLastWriteTime,&fdUpdated.ftLastWriteTime) != 0 || + fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow || + fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh) + { + // Shutdown current watching and give control to main window + if (hChangeHandle) { + FindCloseChangeNotification(hChangeHandle); + hChangeHandle = NULL; + } + if (iFileWatchingMode == 2) { + bRunningWatch = true; /* ! */ + dwChangeNotifyTime = GetTickCount(); + } + else { + KillTimer(NULL,ID_WATCHTIMER); + bRunningWatch = false; + dwChangeNotifyTime = 0; + SendMessage(g_hwndMain,WM_CHANGENOTIFY,0,0); + } + } + + else + FindNextChangeNotification(hChangeHandle); + } + } + + UNUSED(dwTime); + UNUSED(idEvent); + UNUSED(uMsg); + UNUSED(hwnd); +} + + +//============================================================================= +// +// PasteBoardTimer() +// +// +void CALLBACK PasteBoardTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) +{ + if ((dwLastCopyTime > 0) && ((GetTickCount() - dwLastCopyTime) > 200)) { + + if (SendMessage(g_hwndEdit,SCI_CANPASTE,0,0)) { + + bool bAutoIndent2 = bAutoIndent; + bAutoIndent = 0; + EditJumpTo(g_hwndEdit,-1,0); + SendMessage(g_hwndEdit,SCI_BEGINUNDOACTION,0,0); + if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) { + SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0); + } + SendMessage(g_hwndEdit,SCI_PASTE,0,0); + SendMessage(g_hwndEdit,SCI_NEWLINE,0,0); + SendMessage(g_hwndEdit,SCI_ENDUNDOACTION,0,0); + EditEnsureSelectionVisible(g_hwndEdit); + bAutoIndent = bAutoIndent2; + } + dwLastCopyTime = 0; + } + + UNUSED(dwTime); + UNUSED(idEvent); + UNUSED(uMsg); + UNUSED(hwnd); +} + + + +/// End of Notepad3.c \\\ diff --git a/src/Notepad3.rc b/src/Notepad3.rc index b89772c6c..aba07e17f 100644 --- a/src/Notepad3.rc +++ b/src/Notepad3.rc @@ -1,2030 +1,2042 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINWND ICON "..\\res\\Notepad3.ico" - -IDI_RUN ICON "..\\res\\Run.ico" - -IDR_MAINWND128 ICON "..\\res\\Notepad3_128.ico" - -IDI_STYLES ICON "..\\res\\Styles.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_MAINWNDTB BITMAP "..\\res\\Toolbar.bmp" - -IDB_OPEN BITMAP "..\\res\\Open.bmp" - -IDB_NEXT BITMAP "..\\res\\Next.bmp" - -IDB_PREV BITMAP "..\\res\\Prev.bmp" - -IDB_PICK BITMAP "..\\res\\Pick.bmp" - -IDB_ENCODING BITMAP "..\\res\\Encoding.bmp" - -IDR_MAINWNDTB2 BITMAP "..\\res\\Toolbar2.bmp" - -IDR_RIZBITMAP BITMAP "..\\res\\rizonesoft.bmp" - - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -IDC_COPY CURSOR "..\\res\\Copy.cur" - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINWND MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New\tCtrl+N", IDM_FILE_NEW - MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN - MENUITEM "Re&vert\tF5", IDM_FILE_REVERT - MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE - MENUITEM "Save &As...\tF6", IDM_FILE_SAVEAS - MENUITEM "Save &Copy...\tCtrl+F6", IDM_FILE_SAVECOPY - MENUITEM "&Read Only", IDM_FILE_READONLY - MENUITEM SEPARATOR - MENUITEM "Set Encr&yption Passphrase", IDM_SETPASS - MENUITEM SEPARATOR - POPUP "&Launch" - BEGIN - MENUITEM "&New Window\tAlt+N", IDM_FILE_NEWWINDOW - MENUITEM "&Empty Window\tAlt+Shift+N", IDM_FILE_NEWWINDOW2 - MENUITEM SEPARATOR - MENUITEM "Execute &Document\tCtrl+L", IDM_FILE_LAUNCH - MENUITEM "&Open with...\tAlt+L", IDM_FILE_OPENWITH - MENUITEM "&Command...\tCtrl+R", IDM_FILE_RUN - MENUITEM SEPARATOR - MENUITEM "Web Template &1\tCtrl+Shift+1", CMD_WEBACTION1 - MENUITEM "Web Template &2\tCtrl+Shift+2", CMD_WEBACTION2 - END - MENUITEM SEPARATOR - POPUP "&Encoding" - BEGIN - MENUITEM "&ANSI", IDM_ENCODING_ANSI - MENUITEM "&Unicode", IDM_ENCODING_UNICODE - MENUITEM "Unicode &Big Endian", IDM_ENCODING_UNICODEREV - MENUITEM "UTF-&8\tShift+F8", IDM_ENCODING_UTF8 - MENUITEM "UTF-8 with &Signature", IDM_ENCODING_UTF8SIGN - MENUITEM "&More...\tF9", IDM_ENCODING_SELECT - MENUITEM SEPARATOR - MENUITEM "Recode to &Default\tCtrl-Alt-F", CMD_RECODEDEFAULT - MENUITEM "Recode to &ANSI\tCtrl-Shift+A", CMD_RECODEANSI - MENUITEM "Recode to &OEM\tCtrl+Shift+O", CMD_RECODEOEM - MENUITEM "ASCII as UTF-&8\tCtrl+Shift+F8", CMD_RELOADASCIIASUTF8 - MENUITEM "Ignore Encoding &Tags\tAlt+F8", CMD_RELOADNOFILEVARS - MENUITEM "&Recode...\tF8", IDM_ENCODING_RECODE - MENUITEM SEPARATOR - MENUITEM "Set &Default...", IDM_ENCODING_SETDEFAULT - END - POPUP "Line Endin&gs" - BEGIN - MENUITEM "&Windows (CR+LF)", IDM_LINEENDINGS_CRLF - MENUITEM "&Unix (LF)", IDM_LINEENDINGS_LF - MENUITEM "&Mac (CR)", IDM_LINEENDINGS_CR - MENUITEM SEPARATOR - MENUITEM "&Default...", IDM_LINEENDINGS_SETDEFAULT - END - MENUITEM SEPARATOR - MENUITEM "Page Se&tup...", IDM_FILE_PAGESETUP - MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT - MENUITEM SEPARATOR - MENUITEM "Propert&ies...", IDM_FILE_PROPERTIES - MENUITEM "Create &Desktop Link", IDM_FILE_CREATELINK - MENUITEM SEPARATOR - MENUITEM "&Browse...\tCtrl+M", IDM_FILE_BROWSE - POPUP "&Favorites" - BEGIN - MENUITEM "&Open Favorites...\tAlt+I", IDM_FILE_OPENFAV - MENUITEM "&Add Current File...\tAlt+K", IDM_FILE_ADDTOFAV - MENUITEM "&Manage...\tAlt+F9", IDM_FILE_MANAGEFAV - END - MENUITEM "Recent (&History)...\tAlt+H", IDM_FILE_RECENT - MENUITEM SEPARATOR - MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT - END - POPUP "&Edit" - BEGIN - MENUITEM "&Undo\tCtrl+Z", IDM_EDIT_UNDO - MENUITEM "&Redo\tCtrl+Y", IDM_EDIT_REDO - MENUITEM SEPARATOR - MENUITEM "Cu&t\tCtrl+X", IDM_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", IDM_EDIT_COPY - MENUITEM "Copy &All\tAlt+C", IDM_EDIT_COPYALL - MENUITEM "Cop&y Add\tCtrl+E", IDM_EDIT_COPYADD - MENUITEM "&Paste\tCtrl+V", IDM_EDIT_PASTE - MENUITEM "S&wap\tCtrl+K", IDM_EDIT_SWAP - MENUITEM "&Delete\tDel", IDM_EDIT_CLEAR - MENUITEM "Cl&ear Clipboard", IDM_EDIT_CLEARCLIPBOARD - MENUITEM "&Select All\tCtrl+A", IDM_EDIT_SELECTALL - MENUITEM SEPARATOR - POPUP "W&ords" - BEGIN - MENUITEM "&Complete Word\tCtrl+Alt+Enter", IDM_EDIT_COMPLETEWORD - MENUITEM SEPARATOR - MENUITEM "Cursor Word &Left\tCtrl+Left", CMD_CTRLLEFT - MENUITEM "Cursor Word &Right\tCtrl+Right", CMD_CTRLRIGHT - MENUITEM "&Delete Word Left\tCtrl+Back", CMD_CTRLBACK - MENUITEM "Delete &Word Right\tCtrl+Del", CMD_CTRLDEL - END - POPUP "&Lines" - BEGIN - MENUITEM "Move &Up\tCtrl+Shift+Up", IDM_EDIT_MOVELINEUP - MENUITEM "&Move Down\tCtrl+Shift+Down", IDM_EDIT_MOVELINEDOWN - MENUITEM SEPARATOR - MENUITEM "Cut &Line\tCtrl[+Shift]+X", IDM_EDIT_CUTLINE - MENUITEM "&Copy Line\tCtrl[+Shift]+C", IDM_EDIT_COPYLINE - MENUITEM "&Duplicate Line\tCtrl+D", IDM_EDIT_DUPLICATELINE - MENUITEM "D&elete Line\tCtrl+Shift+D", IDM_EDIT_DELETELINE - MENUITEM SEPARATOR - MENUITEM "Delete Line Left\tCtrl+Shift+Back", IDM_EDIT_DELETELINELEFT - MENUITEM "Delete Line Right\tCtrl+Shift+Del", IDM_EDIT_DELETELINERIGHT - MENUITEM SEPARATOR - MENUITEM "Column &Wrap...\tCtrl+Shift+W", IDM_EDIT_COLUMNWRAP - MENUITEM "&Split Lines\tCtrl+I", IDM_EDIT_SPLITLINES - MENUITEM "&Join Lines\tCtrl+J", IDM_EDIT_JOINLINES - MENUITEM "&Fuse Lines\tCtrl+Alt+J", IDM_EDIT_JOINLN_NOSP - MENUITEM "&Preserve Paragraphs\tCtrl+Shift+J", IDM_EDIT_JOINLINES_PARA - MENUITEM SEPARATOR - MENUITEM "Mer&ge Empty Lines\tAlt+Y", IDM_EDIT_MERGEEMPTYLINES - MENUITEM "Merge Whitespace Lines\tCtrl+Alt+Y", IDM_EDIT_MERGEBLANKLINES - MENUITEM "&Remove Empty Lines\tAlt+R", IDM_EDIT_REMOVEEMPTYLINES - MENUITEM "Remove Whitespace Lines\tCtrl+Alt+B", IDM_EDIT_REMOVEBLANKLINES - MENUITEM "Rem&ove Duplicate Lines\tCtrl+Alt+D", IDM_EDIT_REMOVEDUPLICATELINES - END - POPUP "&Block" - BEGIN - MENUITEM "&Indent", IDM_EDIT_INDENT - MENUITEM "&Unindent", IDM_EDIT_UNINDENT - MENUITEM SEPARATOR - POPUP "&Enclose Selection" - BEGIN - MENUITEM "&Single Quotes\tCtrl+1", CMD_STRINGIFY - MENUITEM "&Double Quotes\tCtrl+2", CMD_STRINGIFY2 - MENUITEM SEPARATOR - MENUITEM "( )\tCtrl+3", CMD_EMBRACE - MENUITEM "[ ]\tCtrl+4", CMD_EMBRACE2 - MENUITEM "{ }\tCtrl+5", CMD_EMBRACE3 - MENUITEM SEPARATOR - MENUITEM "&Backticks\tCtrl+6", CMD_EMBRACE4 - MENUITEM SEPARATOR - MENUITEM "&With...\tAlt+Q", IDM_EDIT_ENCLOSESELECTION - END - MENUITEM "&Duplicate Selection\tAlt+D", IDM_EDIT_SELECTIONDUPLICATE - MENUITEM SEPARATOR - MENUITEM "&Pad With Spaces\tAlt+B", IDM_EDIT_PADWITHSPACES - MENUITEM "Strip &First Character\tAlt+Z", IDM_EDIT_STRIP1STCHAR - MENUITEM "Strip &Last Character\tAlt+U", IDM_EDIT_STRIPLASTCHAR - MENUITEM "Strip &Trailing Whitespaces\tAlt+W", IDM_EDIT_TRIMLINES - MENUITEM "Compress &Whitespace\tAlt+P", IDM_EDIT_COMPRESSWS - MENUITEM SEPARATOR - MENUITEM "&Modify Lines...\tAlt+M", IDM_EDIT_MODIFYLINES - MENUITEM "&Align Lines...\tAlt+J", IDM_EDIT_ALIGN - MENUITEM "&Sort Lines...\tAlt+O", IDM_EDIT_SORTLINES - END - POPUP "Co&nvert" - BEGIN - MENUITEM "&Uppercase\tCtrl+Shift+U", IDM_EDIT_CONVERTUPPERCASE - MENUITEM "&Lowercase\tCtrl+U", IDM_EDIT_CONVERTLOWERCASE - MENUITEM SEPARATOR - MENUITEM "&Invert Case\tCtrl+Alt+U", IDM_EDIT_INVERTCASE - MENUITEM "Title &Case\tCtrl+Alt+I", IDM_EDIT_TITLECASE - MENUITEM "&Sentence Case\tCtrl+Alt+O", IDM_EDIT_SENTENCECASE - MENUITEM SEPARATOR - MENUITEM "&Tabify Selection\tCtrl+Shift+T", IDM_EDIT_CONVERTSPACES - MENUITEM "U&ntabify Selection\tCtrl+Shift+S", IDM_EDIT_CONVERTTABS - MENUITEM SEPARATOR - MENUITEM "Ta&bify Indent\tCtrl+Alt+T", IDM_EDIT_CONVERTSPACES2 - MENUITEM "Untabi&fy Indent\tCtrl+Alt+S", IDM_EDIT_CONVERTTABS2 - END - POPUP "&Insert" - BEGIN - MENUITEM "&New Line Above\tCtrl+Enter", CMD_CTRLENTER - MENUITEM SEPARATOR - MENUITEM "&HTML/XML Tag...\tAlt+X", IDM_EDIT_INSERT_TAG - MENUITEM SEPARATOR - MENUITEM "&Encoding Identifier\tCtrl+F8", IDM_EDIT_INSERT_ENCODING - MENUITEM SEPARATOR - MENUITEM "&Time/Date (Short Form)\tCtrl+F5", IDM_EDIT_INSERT_SHORTDATE - MENUITEM "Time/Date (&Long Form)\tCtrl+Shift+F5", IDM_EDIT_INSERT_LONGDATE - MENUITEM "&Update Timestamps\tShift+F5", CMD_TIMESTAMPS - MENUITEM SEPARATOR - MENUITEM "&Filename\tCtrl+F9", IDM_EDIT_INSERT_FILENAME - MENUITEM "&Path and Filename\tCtrl+Shift+F9", IDM_EDIT_INSERT_PATHNAME - MENUITEM SEPARATOR - MENUITEM "&GUID\tCtrl+Shift+.", IDM_EDIT_INSERT_GUID - END - POPUP "&Miscellaneous" - BEGIN - MENUITEM "&Line Comment (Toggle)\tCtrl+Q", IDM_EDIT_LINECOMMENT - MENUITEM "&Stream Comment\tCtrl+Shift+Q", IDM_EDIT_STREAMCOMMENT - MENUITEM SEPARATOR - MENUITEM "&URL Encode\tCtrl+Shift+E", IDM_EDIT_URLENCODE - MENUITEM "URL &Decode\tCtrl+Shift+R", IDM_EDIT_URLDECODE - MENUITEM SEPARATOR - MENUITEM "&Escape C Chars\tCtrl+Alt+E", IDM_EDIT_ESCAPECCHARS - MENUITEM "&Unescape C Chars\tCtrl+Alt+R", IDM_EDIT_UNESCAPECCHARS - MENUITEM SEPARATOR - MENUITEM "&Char To Hex\tCtrl+Alt+X", IDM_EDIT_CHAR2HEX - MENUITEM "&Hex To Char\tCtrl+Alt+C", IDM_EDIT_HEX2CHAR - MENUITEM SEPARATOR - MENUITEM "&Find Matching Brace\tCtrl+B", IDM_EDIT_FINDMATCHINGBRACE - MENUITEM "Select To &Matching Brace\tCtrl+Shift+B", IDM_EDIT_SELTOMATCHINGBRACE - MENUITEM SEPARATOR - MENUITEM "Select To &Next\tCtrl+Alt+F2", IDM_EDIT_SELTONEXT - MENUITEM "Select To &Previous\tCtrl+Alt+Shift+F2", IDM_EDIT_SELTOPREV - END - MENUITEM SEPARATOR - POPUP "Boo&kmarks" - BEGIN - MENUITEM "&Toggle\tCtrl+F2", BME_EDIT_BOOKMARKTOGGLE - MENUITEM SEPARATOR - MENUITEM "Goto &Next\tF2", BME_EDIT_BOOKMARKNEXT - MENUITEM "Goto &Previous\tShift+F2", BME_EDIT_BOOKMARKPREV - MENUITEM SEPARATOR - MENUITEM "&Clear All\tAlt+F2", BME_EDIT_BOOKMARKCLEAR - END - MENUITEM SEPARATOR - MENUITEM "&Find...\tCtrl+F", IDM_EDIT_FIND - MENUITEM "Save Find Text\tAlt+F3", IDM_EDIT_SAVEFIND - MENUITEM "Find Ne&xt\tF3", IDM_EDIT_FINDNEXT - MENUITEM "Find Pre&vious\tShift+F3", IDM_EDIT_FINDPREV - MENUITEM "Find Next Selected\tCtrl+F3", CMD_FINDNEXTSEL - MENUITEM "Find Previous Selected\tCtrl+Shift+F3", CMD_FINDPREVSEL - MENUITEM "&Replace...\tCtrl+H", IDM_EDIT_REPLACE - MENUITEM "Replace Ne&xt\tF4", IDM_EDIT_REPLACENEXT - MENUITEM "&Goto...\tCtrl+G", IDM_EDIT_GOTOLINE - END - POPUP "&View" - BEGIN - MENUITEM "Synta&x Scheme...\tF12", IDM_VIEW_SCHEME - MENUITEM "&2nd Default Scheme\tShift+F12", IDM_VIEW_USE2NDDEFAULT - MENUITEM "&Customize Schemes...\tCtrl+F12", IDM_VIEW_SCHEMECONFIG - MENUITEM "Global &Default Font...\tAlt+F12", IDM_VIEW_FONT - MENUITEM "Current Sc&heme's Default Font...\tCtrl+Alt+F12", IDM_VIEW_CURRENTSCHEME - MENUITEM SEPARATOR - MENUITEM "Word W&rap\tCtrl+W", IDM_VIEW_WORDWRAP - MENUITEM "&Long Line Marker\tCtrl+Shift+L", IDM_VIEW_LONGLINEMARKER - MENUITEM "Indent&ation Guides\tCtrl+Shift+G", IDM_VIEW_SHOWINDENTGUIDES - MENUITEM SEPARATOR - MENUITEM "Show &Whitespace\tCtrl+Shift+8", IDM_VIEW_SHOWWHITESPACE - MENUITEM "Show Line &Endings\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS - MENUITEM "Show Wra&p Symbols\tCtrl+Shift+0", IDM_VIEW_WORDWRAPSYMBOLS - MENUITEM SEPARATOR - MENUITEM "H&yperlink Hotspots\tCtrl+Alt+H", IDM_VIEW_HYPERLINKHOTSPOTS - MENUITEM "&Visual Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES - MENUITEM "Hi&ghlight Current Line\tCtrl+Shift+I", IDM_VIEW_HILITECURRENTLINE - POPUP "Mar&k Occurrences" - BEGIN - MENUITEM "&Active\tAlt+A", IDM_VIEW_MARKOCCUR_ONOFF - MENUITEM SEPARATOR - MENUITEM "Match Visible Only", IDM_VIEW_MARKOCCUR_VISIBLE - MENUITEM SEPARATOR - MENUITEM "Match &Case Sensitive", IDM_VIEW_MARKOCCUR_CASE - POPUP "Match &Whole Word Only" - BEGIN - MENUITEM "OFF", IDM_VIEW_MARKOCCUR_WNONE - MENUITEM "Match &Selected Word", IDM_VIEW_MARKOCCUR_WORD - MENUITEM "Match &Current Word", IDM_VIEW_MARKOCCUR_CURRENT - END - END - MENUITEM SEPARATOR - MENUITEM "Line &Numbers\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS - MENUITEM "Selection &Margin\tCtrl+Shift+M", IDM_VIEW_MARGIN - MENUITEM SEPARATOR - MENUITEM "Code &Folding\tCtrl+Shift+Alt+F", IDM_VIEW_FOLDING - MENUITEM "&Toggle All Folds\tCtrl+Shift+F", IDM_VIEW_TOGGLEFOLDS - MENUITEM SEPARATOR - MENUITEM "Show Tool&bar", IDM_VIEW_TOOLBAR - MENUITEM "C&ustomize Toolbar...", IDM_VIEW_CUSTOMIZETB - MENUITEM "Show &Statusbar", IDM_VIEW_STATUSBAR - MENUITEM SEPARATOR - MENUITEM "Zoom &In\tCtrl++", IDM_VIEW_ZOOMIN - MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT - MENUITEM "Reset &Zoom\tCtrl+0", IDM_VIEW_RESETZOOM - MENUITEM SEPARATOR - MENUITEM "Copy Position Args\tCtrl+Shift+K", CMD_COPYWINPOS - MENUITEM "Snap to Default Position\tCtrl+Shift+P", CMD_DEFAULTWINPOS - MENUITEM "Scroll Past End of &File", IDM_VIEW_SCROLLPASTEOF - END - POPUP "&Settings" - BEGIN - MENUITEM "Insert Tabs as &Spaces", IDM_VIEW_TABSASSPACES - MENUITEM "&Tab Settings...\tCtrl+T", IDM_VIEW_TABSETTINGS - MENUITEM "&Word Wrap Settings...", IDM_VIEW_WORDWRAPSETTINGS - MENUITEM "&Long Line Settings...", IDM_VIEW_LONGLINESETTINGS - MENUITEM "Auto In&dent Text", IDM_VIEW_AUTOINDENTTEXT - MENUITEM "Auto Close &HTML/XML\tCtrl+Shift+H", IDM_VIEW_AUTOCLOSETAGS - MENUITEM "A&uto Complete Words", IDM_VIEW_AUTOCOMPLETEWORDS - MENUITEM "Accelerated Word Navi&gation", IDM_VIEW_ACCELWORDNAV - MENUITEM SEPARATOR - MENUITEM "&Reuse Window", IDM_VIEW_REUSEWINDOW - MENUITEM "Sticky Window &Position", IDM_VIEW_STICKYWINPOS - MENUITEM "&Always On Top\tAlt+T", IDM_VIEW_ALWAYSONTOP - MENUITEM "Minimi&ze To Tray", IDM_VIEW_MINTOTRAY - MENUITEM "Transparent &Mode\tAlt+G", IDM_VIEW_TRANSPARENT - MENUITEM SEPARATOR - MENUITEM "Single &File Instance", IDM_VIEW_SINGLEFILEINSTANCE - MENUITEM "File &Change Notification...\tAlt+F5", IDM_VIEW_CHANGENOTIFY - POPUP "Window Title Displa&y" - BEGIN - MENUITEM "Filename &Only", IDM_VIEW_SHOWFILENAMEONLY - MENUITEM "Filename and &Directory", IDM_VIEW_SHOWFILENAMEFIRST - MENUITEM "Full &Pathname", IDM_VIEW_SHOWFULLPATH - MENUITEM "&Text Excerpt\tCtrl+9", IDM_VIEW_SHOWEXCERPT - END - POPUP "Esc &Key Function" - BEGIN - MENUITEM "&None", IDM_VIEW_NOESCFUNC - MENUITEM "&Minimize Notepad3", IDM_VIEW_ESCMINIMIZE - MENUITEM "E&xit Notepad3", IDM_VIEW_ESCEXIT - END - MENUITEM "Save &Before Running Tools", IDM_VIEW_SAVEBEFORERUNNINGTOOLS - MENUITEM "Remember Recent F&iles", IDM_VIEW_NOSAVERECENT - MENUITEM "Preser&ve Caret Position", IDM_VIEW_NOPRESERVECARET - MENUITEM "Remember S&earch Pattern", IDM_VIEW_NOSAVEFINDREPL - MENUITEM SEPARATOR - MENUITEM "Save Settings On E&xit", IDM_VIEW_SAVESETTINGS - MENUITEM "Save Settings &Now\tF7", IDM_VIEW_SAVESETTINGSNOW - MENUITEM "&Open Settings File\tCtrl+F7", CMD_OPENINIFILE - END - POPUP "&?" - BEGIN - MENUITEM "&Online Documentation\tF1", IDM_HELP_ONLINEDOCUMENTATION - MENUITEM SEPARATOR - MENUITEM "Launch &Update Installer", IDM_HELP_UPDATEINSTALLER - MENUITEM "Check &Website for Update", IDM_HELP_UPDATEWEBSITE - MENUITEM SEPARATOR - MENUITEM "&Command Line Help...", IDM_HELP_CMD - MENUITEM "&About...\tShift+F1", IDM_HELP_ABOUT - END -END - -IDR_POPUPMENU MENU -BEGIN - POPUP "+" - BEGIN - MENUITEM "&Undo", IDM_EDIT_UNDO - MENUITEM "&Redo", IDM_EDIT_REDO - MENUITEM SEPARATOR - MENUITEM "Cu&t", IDM_EDIT_CUT - MENUITEM "&Copy", IDM_EDIT_COPY - MENUITEM "&Paste", IDM_EDIT_PASTE - MENUITEM "&Delete", IDM_EDIT_CLEAR - MENUITEM SEPARATOR - MENUITEM "&Select All", IDM_EDIT_SELECTALL - MENUITEM SEPARATOR - MENUITEM "Open &Hyperlink", CMD_OPEN_HYPERLINK - END - POPUP "+" - BEGIN - MENUITEM "Show &Toolbar", IDM_VIEW_TOOLBAR - MENUITEM "&Customize Toolbar...", IDM_VIEW_CUSTOMIZETB - MENUITEM "Show &Statusbar", IDM_VIEW_STATUSBAR - END - POPUP "+" - BEGIN - MENUITEM "Open Notepad3", IDM_TRAY_RESTORE - MENUITEM "Exit Notepad3", IDM_TRAY_EXIT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINWND ACCELERATORS -BEGIN - "0", IDM_VIEW_RESETZOOM, VIRTKEY, CONTROL, NOINVERT - "0", IDM_VIEW_WORDWRAPSYMBOLS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "1", CMD_STRINGIFY, VIRTKEY, CONTROL, NOINVERT - "1", CMD_WEBACTION1, VIRTKEY, SHIFT, CONTROL, NOINVERT - "2", CMD_STRINGIFY2, VIRTKEY, CONTROL, NOINVERT - "2", CMD_WEBACTION2, VIRTKEY, SHIFT, CONTROL, NOINVERT - "3", CMD_EMBRACE, VIRTKEY, CONTROL, NOINVERT - "4", CMD_EMBRACE2, VIRTKEY, CONTROL, NOINVERT - "5", CMD_EMBRACE3, VIRTKEY, CONTROL, NOINVERT - "6", CMD_EMBRACE4, VIRTKEY, CONTROL, NOINVERT - "8", IDM_VIEW_SHOWWHITESPACE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "9", CMD_TOGGLETITLE, VIRTKEY, CONTROL, NOINVERT - "9", IDM_VIEW_SHOWEOLS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "A", IDM_EDIT_SELECTALL, VIRTKEY, CONTROL, NOINVERT - "A", IDM_VIEW_MARKOCCUR_ONOFF, VIRTKEY, ALT, NOINVERT - "A", CMD_RECODEANSI, VIRTKEY, SHIFT, CONTROL, NOINVERT - "B", IDM_EDIT_FINDMATCHINGBRACE, VIRTKEY, CONTROL, NOINVERT - "B", IDM_EDIT_PADWITHSPACES, VIRTKEY, ALT, NOINVERT - "B", IDM_EDIT_SELTOMATCHINGBRACE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "B", IDM_EDIT_REMOVEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT - "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - "C", IDM_EDIT_COPYALL, VIRTKEY, ALT, NOINVERT - "C", IDM_EDIT_HEX2CHAR, VIRTKEY, CONTROL, ALT, NOINVERT - "C", IDM_EDIT_COPY, VIRTKEY, SHIFT, CONTROL, NOINVERT - "D", IDM_EDIT_DUPLICATELINE, VIRTKEY, CONTROL, NOINVERT - "D", IDM_EDIT_SELECTIONDUPLICATE, VIRTKEY, ALT, NOINVERT - "D", IDM_EDIT_DELETELINE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "D", IDM_EDIT_REMOVEDUPLICATELINES, VIRTKEY, CONTROL, ALT, NOINVERT - "E", IDM_EDIT_COPYADD, VIRTKEY, CONTROL, NOINVERT - "E", IDM_EDIT_ESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT - "E", IDM_EDIT_URLENCODE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "F", IDM_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT - "F", CMD_RECODEDEFAULT, VIRTKEY, CONTROL, ALT, NOINVERT - "F", IDM_VIEW_FOLDING, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT - "F", IDM_VIEW_TOGGLEFOLDS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "G", IDM_EDIT_GOTOLINE, VIRTKEY, CONTROL, NOINVERT - "G", IDM_VIEW_SHOWINDENTGUIDES, VIRTKEY, SHIFT, CONTROL, NOINVERT - "G", IDM_VIEW_TRANSPARENT, VIRTKEY, ALT, NOINVERT - "H", IDM_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT - "H", IDM_FILE_RECENT, VIRTKEY, ALT, NOINVERT - "H", IDM_VIEW_AUTOCLOSETAGS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "H", IDM_VIEW_HYPERLINKHOTSPOTS, VIRTKEY, CONTROL, ALT, NOINVERT - "I", IDM_EDIT_SPLITLINES, VIRTKEY, CONTROL, NOINVERT - "I", IDM_FILE_OPENFAV, VIRTKEY, ALT, NOINVERT - "I", IDM_EDIT_TITLECASE, VIRTKEY, CONTROL, ALT, NOINVERT - "I", IDM_VIEW_HILITECURRENTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "J", IDM_EDIT_JOINLINES, VIRTKEY, CONTROL, NOINVERT - "J", IDM_EDIT_JOINLN_NOSP, VIRTKEY, CONTROL, ALT, NOINVERT - "J", IDM_EDIT_JOINLINES_PARA, VIRTKEY, SHIFT, CONTROL, NOINVERT - "J", IDM_EDIT_ALIGN, VIRTKEY, ALT, NOINVERT - "K", IDM_EDIT_SWAP, VIRTKEY, CONTROL, NOINVERT - "K", IDM_FILE_ADDTOFAV, VIRTKEY, ALT, NOINVERT - "K", CMD_COPYWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "L", IDM_FILE_LAUNCH, VIRTKEY, CONTROL, NOINVERT - "L", IDM_FILE_OPENWITH, VIRTKEY, ALT, NOINVERT - "L", IDM_VIEW_LONGLINEMARKER, VIRTKEY, SHIFT, CONTROL, NOINVERT - "M", IDM_FILE_BROWSE, VIRTKEY, CONTROL, NOINVERT - "M", IDM_EDIT_MODIFYLINES, VIRTKEY, ALT, NOINVERT - "M", IDM_VIEW_MARGIN, VIRTKEY, SHIFT, CONTROL, NOINVERT - "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - "N", IDM_FILE_NEWWINDOW, VIRTKEY, ALT, NOINVERT - "N", IDM_FILE_NEWWINDOW2, VIRTKEY, SHIFT, ALT, NOINVERT - "N", IDM_VIEW_LINENUMBERS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT - "O", IDM_EDIT_SORTLINES, VIRTKEY, ALT, NOINVERT - "O", IDM_EDIT_SENTENCECASE, VIRTKEY, CONTROL, ALT, NOINVERT - "O", CMD_RECODEOEM, VIRTKEY, SHIFT, CONTROL, NOINVERT - "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT - "P", IDM_EDIT_COMPRESSWS, VIRTKEY, ALT, NOINVERT - "P", CMD_DEFAULTWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "Q", IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT - "Q", IDM_EDIT_ENCLOSESELECTION, VIRTKEY, ALT, NOINVERT - "Q", IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT - "R", IDM_FILE_RUN, VIRTKEY, CONTROL, NOINVERT - "R", IDM_EDIT_REMOVEEMPTYLINES, VIRTKEY, ALT, NOINVERT - "R", IDM_EDIT_UNESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT - "R", IDM_EDIT_URLDECODE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT - "S", IDM_EDIT_CONVERTTABS2, VIRTKEY, CONTROL, ALT, NOINVERT - "S", IDM_EDIT_CONVERTTABS, VIRTKEY, SHIFT, CONTROL, NOINVERT - "T", IDM_VIEW_TABSETTINGS, VIRTKEY, CONTROL, NOINVERT - "T", IDM_VIEW_ALWAYSONTOP, VIRTKEY, ALT, NOINVERT - "T", IDM_EDIT_CONVERTSPACES2, VIRTKEY, CONTROL, ALT, NOINVERT - "T", IDM_EDIT_CONVERTSPACES, VIRTKEY, SHIFT, CONTROL, NOINVERT - "U", IDM_EDIT_CONVERTLOWERCASE, VIRTKEY, CONTROL, NOINVERT - "U", IDM_EDIT_STRIPLASTCHAR, VIRTKEY, ALT, NOINVERT - "U", IDM_EDIT_INVERTCASE, VIRTKEY, CONTROL, ALT, NOINVERT - "U", IDM_EDIT_CONVERTUPPERCASE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT - "V", IDM_VIEW_MATCHBRACES, VIRTKEY, SHIFT, CONTROL, NOINVERT - "W", IDM_VIEW_WORDWRAP, VIRTKEY, CONTROL, NOINVERT - "W", IDM_EDIT_TRIMLINES, VIRTKEY, ALT, NOINVERT - "W", IDM_EDIT_COLUMNWRAP, VIRTKEY, SHIFT, CONTROL, NOINVERT - "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT - "X", IDM_EDIT_INSERT_TAG, VIRTKEY, ALT, NOINVERT - "X", IDM_EDIT_CHAR2HEX, VIRTKEY, CONTROL, ALT, NOINVERT - "X", IDM_EDIT_CUTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT - "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT - "Y", IDM_EDIT_MERGEEMPTYLINES, VIRTKEY, ALT, NOINVERT - "Y", IDM_EDIT_UNDO, VIRTKEY, SHIFT, CONTROL, NOINVERT - "Y", IDM_EDIT_MERGEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT - "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT - "Z", IDM_EDIT_STRIP1STCHAR, VIRTKEY, ALT, NOINVERT - "Z", IDM_EDIT_REDO, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_LEFT, CMD_CTRLLEFT, VIRTKEY, CONTROL, NOINVERT - VK_LEFT, CMD_ALTLEFT, VIRTKEY, ALT, NOINVERT - VK_RIGHT, CMD_CTRLRIGHT, VIRTKEY, CONTROL, NOINVERT - VK_RIGHT, CMD_ALTRIGHT, VIRTKEY, ALT, NOINVERT - VK_ADD, IDM_VIEW_ZOOMIN, VIRTKEY, CONTROL, NOINVERT - VK_ADD, CMD_INCLINELIMIT, VIRTKEY, ALT, NOINVERT - VK_ADD, CMD_INCREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT - VK_BACK, CMD_DELETEBACK, VIRTKEY, NOINVERT - VK_BACK, CMD_CTRLBACK, VIRTKEY, CONTROL, NOINVERT - VK_BACK, IDM_EDIT_UNDO, VIRTKEY, ALT, NOINVERT - VK_BACK, IDM_EDIT_DELETELINELEFT, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_DELETE, CMD_DEL, VIRTKEY, NOINVERT - VK_DELETE, CMD_CTRLDEL, VIRTKEY, CONTROL, NOINVERT - VK_DELETE, IDM_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT - VK_DELETE, IDM_EDIT_DELETELINERIGHT, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_DOWN, CMD_ALTDOWN, VIRTKEY, ALT, NOINVERT - VK_DOWN, IDM_EDIT_MOVELINEDOWN, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_ESCAPE, CMD_ESCAPE, VIRTKEY, NOINVERT - VK_ESCAPE, CMD_SHIFTESC, VIRTKEY, SHIFT, NOINVERT - VK_F1, IDM_HELP_ONLINEDOCUMENTATION, VIRTKEY, NOINVERT - VK_F1, IDM_HELP_ABOUT, VIRTKEY, SHIFT, NOINVERT - VK_F11, CMD_LEXDEFAULT, VIRTKEY, NOINVERT - VK_F11, CMD_LEXHTML, VIRTKEY, CONTROL, NOINVERT - VK_F11, CMD_LEXXML, VIRTKEY, SHIFT, NOINVERT - VK_F12, IDM_VIEW_SCHEME, VIRTKEY, NOINVERT - VK_F12, IDM_VIEW_SCHEMECONFIG, VIRTKEY, CONTROL, NOINVERT - VK_F12, IDM_VIEW_FONT, VIRTKEY, ALT, NOINVERT - VK_F12, IDM_VIEW_USE2NDDEFAULT, VIRTKEY, SHIFT, NOINVERT - VK_F12, IDM_VIEW_CURRENTSCHEME, VIRTKEY, CONTROL, ALT - VK_F2, IDM_EDIT_SELTONEXT, VIRTKEY, CONTROL, ALT, NOINVERT - VK_F2, IDM_EDIT_SELTOPREV, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT - VK_F2, BME_EDIT_BOOKMARKNEXT, VIRTKEY, NOINVERT - VK_F2, BME_EDIT_BOOKMARKTOGGLE, VIRTKEY, CONTROL, NOINVERT - VK_F2, BME_EDIT_BOOKMARKCLEAR, VIRTKEY, ALT, NOINVERT - VK_F2, BME_EDIT_BOOKMARKPREV, VIRTKEY, SHIFT, NOINVERT - VK_F3, IDM_EDIT_FINDNEXT, VIRTKEY, NOINVERT - VK_F3, CMD_FINDNEXTSEL, VIRTKEY, CONTROL, NOINVERT - VK_F3, IDM_EDIT_SAVEFIND, VIRTKEY, ALT, NOINVERT - VK_F3, IDM_EDIT_FINDPREV, VIRTKEY, SHIFT, NOINVERT - VK_F3, CMD_FINDPREVSEL, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_F4, IDM_EDIT_REPLACENEXT, VIRTKEY, NOINVERT - VK_F4, IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - VK_F4, IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - VK_F5, IDM_FILE_REVERT, VIRTKEY, NOINVERT - VK_F5, IDM_EDIT_INSERT_SHORTDATE, VIRTKEY, CONTROL, NOINVERT - VK_F5, IDM_VIEW_CHANGENOTIFY, VIRTKEY, ALT, NOINVERT - VK_F5, CMD_TIMESTAMPS, VIRTKEY, SHIFT, NOINVERT - VK_F5, IDM_EDIT_INSERT_LONGDATE, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_F6, IDM_FILE_SAVEAS, VIRTKEY, NOINVERT - VK_F6, IDM_FILE_SAVECOPY, VIRTKEY, CONTROL, NOINVERT - VK_F7, IDM_VIEW_SAVESETTINGSNOW, VIRTKEY, NOINVERT - VK_F7, CMD_OPENINIFILE, VIRTKEY, CONTROL, NOINVERT - VK_F8, IDM_ENCODING_RECODE, VIRTKEY, NOINVERT - VK_F8, IDM_EDIT_INSERT_ENCODING, VIRTKEY, CONTROL, NOINVERT - VK_F8, CMD_RELOADNOFILEVARS, VIRTKEY, ALT, NOINVERT - VK_F8, IDM_ENCODING_UTF8, VIRTKEY, SHIFT, NOINVERT - VK_F8, CMD_RELOADASCIIASUTF8, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_F9, IDM_ENCODING_SELECT, VIRTKEY, NOINVERT - VK_F9, IDM_EDIT_INSERT_FILENAME, VIRTKEY, CONTROL, NOINVERT - VK_F9, IDM_FILE_MANAGEFAV, VIRTKEY, ALT, NOINVERT - VK_F9, CMD_COPYPATHNAME, VIRTKEY, SHIFT, NOINVERT - VK_F9, IDM_EDIT_INSERT_PATHNAME, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_OEM_2, IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT - VK_OEM_2, IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_DIVIDE, IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT - VK_DIVIDE, IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_NUMPAD0, IDM_VIEW_RESETZOOM, VIRTKEY, CONTROL, NOINVERT - VK_OEM_COMMA, CMD_JUMP2SELSTART, VIRTKEY, CONTROL, NOINVERT - VK_OEM_MINUS, IDM_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT - VK_OEM_MINUS, CMD_DECREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT - VK_OEM_PERIOD, CMD_JUMP2SELEND, VIRTKEY, CONTROL, NOINVERT - VK_OEM_PERIOD, IDM_EDIT_INSERT_GUID, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_OEM_PLUS, IDM_VIEW_ZOOMIN, VIRTKEY, CONTROL, NOINVERT - VK_OEM_PLUS, CMD_INCREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT - VK_RETURN, CMD_CTRLENTER, VIRTKEY, CONTROL, NOINVERT - VK_RETURN, CMD_SHIFTCTRLENTER, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_RETURN, IDM_EDIT_COMPLETEWORD, VIRTKEY, CONTROL, ALT, NOINVERT - VK_SPACE, IDM_EDIT_SELECTWORD, VIRTKEY, CONTROL, NOINVERT - VK_SPACE, IDM_EDIT_SELECTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT - VK_SUBTRACT, IDM_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT - VK_SUBTRACT, CMD_DECLINELIMIT, VIRTKEY, ALT, NOINVERT - VK_SUBTRACT, CMD_DECREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT - VK_TAB, CMD_TAB, VIRTKEY, NOINVERT - VK_TAB, CMD_BACKTAB, VIRTKEY, SHIFT, NOINVERT - VK_TAB, CMD_CTRLTAB, VIRTKEY, CONTROL, NOINVERT - VK_UP, CMD_ALTUP, VIRTKEY, ALT, NOINVERT - VK_UP, IDM_EDIT_MOVELINEUP, VIRTKEY, SHIFT, CONTROL, NOINVERT -END - -IDR_ACCFINDREPLACE ACCELERATORS -BEGIN - "F", IDACC_FIND, VIRTKEY, CONTROL, NOINVERT - "H", IDACC_REPLACE, VIRTKEY, CONTROL, NOINVERT - "S", IDACC_SAVEPOS, VIRTKEY, CONTROL, NOINVERT - "R", IDACC_RESETPOS, VIRTKEY, CONTROL, NOINVERT - VK_F2, IDACC_SELTONEXT, VIRTKEY, CONTROL, ALT, NOINVERT - VK_F2, IDACC_SELTOPREV, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT - VK_F3, IDACC_FINDNEXT, VIRTKEY, NOINVERT - VK_F3, IDACC_SAVEFIND, VIRTKEY, ALT, NOINVERT - VK_F3, IDACC_FINDPREV, VIRTKEY, SHIFT, NOINVERT - VK_F4, IDACC_REPLACENEXT, VIRTKEY, NOINVERT -END - -IDR_ACCCUSTOMSCHEMES ACCELERATORS -BEGIN - "S", IDACC_SAVEPOS, VIRTKEY, CONTROL, NOINVERT - "R", IDACC_RESETPOS, VIRTKEY, CONTROL, NOINVERT - "S", IDACC_PREVIEW, VIRTKEY, CONTROL, NOINVERT - VK_F12, IDACC_VIEWSCHEMECONFIG, VIRTKEY, CONTROL, NOINVERT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUT DIALOGEX 0, 0, 400, 274 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About Notepad3" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "OK",IDOK,330,256,50,14 - ICON IDR_MAINWND128,IDC_STATIC,4,5,20,20,SS_REALSIZEIMAGE,WS_EX_TRANSPARENT - LTEXT "IDC_VERSION",IDC_VERSION,80,7,288,15 - LTEXT "Scintilla Library Version:",IDC_SCI_VERSION,80,24,280,8 - LTEXT "Build with:",IDC_COMPILER,80,35,210,8 - LTEXT "IDC_COPYRIGHT",IDC_COPYRIGHT,80,55,180,8 - LTEXT "",IDC_WEBPAGE2,190,55,100,8,NOT WS_VISIBLE | WS_DISABLED - CONTROL "",IDC_WEBPAGE,"SysLink",WS_TABSTOP,220,55,100,10 - CONTROL IDR_RIZBITMAP,IDC_RIZONEBMP,"Static",SS_BITMAP | SS_NOTIFY | SS_REALSIZEIMAGE,305,7,130,20,WS_EX_TRANSPARENT - PUSHBUTTON "Copy Version Text",IDC_COPYVERSTRG,304,35,76,14,BS_FLAT - CONTROL "",IDC_RICHEDITABOUT,"RichEdit20W",WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | 0x29c4,20,80,360,168 -END - -IDD_FIND DIALOGEX 0, 0, 273, 129 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Find Text" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "Search Strin&g:",IDC_STATIC,7,7,46,8 - COMBOBOX IDC_FINDTEXT,7,17,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - CONTROL "Match &case",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,53,10 - CONTROL "Match &whole word only",IDC_FINDWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,49,89,10 - CONTROL "Match &beginning of word only",IDC_FINDSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,61,110,10 - CONTROL "&Transform backslashes",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,73,85,10 - CONTROL "Regular &expression search",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,96,10 - CONTROL "Dot &matches all",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,96,65,10 - CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,37,75,10 - CONTROL "C&lose after find",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,49,65,10 - CONTROL "Mark &Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,61,73,10 - CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,63,10 - DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 - PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14 - PUSHBUTTON "Close",IDCANCEL,212,99,54,14 - CONTROL "Goto Replace (Ctrl+H)",IDC_TOGGLEFINDREPLACE, - "SysLink",0x0,125,103,74,10 - CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,106,85,14,10 - CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,106,73,14,10 - CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,85,14,10 - CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,117,259,9,WS_EX_STATICEDGE -END - -IDD_REPLACE DIALOGEX 0, 0, 273, 156 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Replace Text" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "Search Strin&g:",IDC_STATIC,7,7,46,8 - COMBOBOX IDC_FINDTEXT,7,17,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Replace wit&h:",IDC_STATIC,7,36,44,8 - COMBOBOX IDC_REPLACETEXT,7,47,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - CONTROL "Match &case",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,66,53,10 - CONTROL "Match &whole word only",IDC_FINDWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,78,89,10 - CONTROL "Match &beginning of word only",IDC_FINDSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,110,10 - CONTROL "&Transform backslashes",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,102,89,10 - CONTROL "Regular &expression search",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,114,97,10 - CONTROL "Dot &matches all",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,125,65,10 - CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,66,75,10 - CONTROL "C&lose after replace",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 - CONTROL "Mark &Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10 - CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,63,10 - DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 - PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14 - PUSHBUTTON "&Replace",IDC_REPLACE,211,53,55,14 - PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,70,55,14 - PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,88,55,14 - PUSHBUTTON "Swap Strings",IDC_SWAPSTRG,149,32,49,12 - PUSHBUTTON "Close",IDCANCEL,211,126,55,14 - CONTROL "Goto Find (Ctrl+F)",IDC_TOGGLEFINDREPLACE, - "SysLink",0x0,125,130,74,10 - CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,107,102,14,10 - CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,107,114,14,10 - CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,114,14,10 - CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,144,259,9,WS_EX_STATICEDGE -END - -IDD_RUN DIALOGEX 0, 0, 229, 96 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Run" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - ICON IDI_RUN,IDC_STATIC,10,7,21,20 - LTEXT "Type the name of a program, folder, document, or internet resource, and Windows will open it for you.",IDC_STATIC,39,7,179,17 - EDITTEXT IDC_COMMANDLINE,10,35,208,13,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",IDC_SEARCHEXE,163,69,55,16 - DEFPUSHBUTTON "OK",IDOK,47,69,55,16 - PUSHBUTTON "Cancel",IDCANCEL,105,69,55,16 -END - -IDD_OPENWITH DIALOGEX 0, 0, 165, 129 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Open with..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_OPENWITHDIR,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,69 - PUSHBUTTON "",IDC_GETOPENWITHDIR,7,83,13,13 - LTEXT "Click here to specify the directory with links to your favorite applications.",IDC_OPENWITHDESCR,26,83,132,18 - DEFPUSHBUTTON "OK",IDOK,52,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,108,108,50,14 - SCROLLBAR IDC_RESIZEGRIP3,7,112,10,10 -END - -IDD_DEFENCODING DIALOGEX 0, 0, 197, 159 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Encoding" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Default Encoding (new file):",IDC_STATIC,7,7,183,48,0,WS_EX_TRANSPARENT - CONTROL "",IDC_ENCODINGLIST,"ComboBoxEx32",CBS_DROPDOWNLIST | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,14,19,167,128 - CONTROL "Use as &fallback on detection failure.",IDC_USEASREADINGFALLBACK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,38,155,10 - GROUPBOX "Encoding Detection: ",IDC_STATIC,7,58,183,77,0,WS_EX_TRANSPARENT - CONTROL "Skip &ANSI Code Page detection.",IDC_NOANSICPDETECTION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,122,10 - CONTROL "Skip &UNICODE detection.",IDC_NOUNICODEDETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,83,122,10 - CONTROL "Open 7-bit &ASCII files in UTF-8 mode.",IDC_ASCIIASUTF8, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,96,136,10 - CONTROL "Open 8-bit *.&nfo/diz files in DOS-437 mode.",IDC_NFOASOEM, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,109,155,10 - CONTROL "Don't parse encoding file &tags.",IDC_ENCODINGFROMFILEVARS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,126,10 - DEFPUSHBUTTON "OK",IDOK,87,138,50,14 - PUSHBUTTON "Cancel",IDCANCEL,140,138,50,14 -END - -IDD_DEFEOLMODE DIALOGEX 0, 0, 180, 78 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Line Endings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "&Default line ending mode:",IDC_STATIC,7,7,82,8 - COMBOBOX 100,7,20,98,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "&Ensure consistent line endings when saving.",IDC_CONSISTENTEOLS, - "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,7,48,157,10 - CONTROL "&Strip trailing blanks when saving.",IDC_AUTOSTRIPBLANKS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,60,121,10 - DEFPUSHBUTTON "OK",IDOK,123,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,123,24,50,14 -END - -IDD_LINENUM DIALOGEX 0, 0, 186, 47 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Goto" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Line:",IDC_STATIC,7,7,16,8 - EDITTEXT IDC_LINENUM,7,24,46,14,ES_AUTOHSCROLL - LTEXT "&Column:",IDC_STATIC,63,7,27,8 - EDITTEXT IDC_COLNUM,63,24,46,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 -END - -IDD_FILEMRU DIALOGEX 0, 0, 269, 160 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Open Recent File" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_FILEMRU,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,255,97 - CONTROL "&Preserve caret position.",IDC_PRESERVECARET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,96,10 - CONTROL "&Save recent file list on exit.",IDC_SAVEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,107,96,10 - PUSHBUTTON "Discard",IDC_REMOVE,212,107,50,14,WS_DISABLED - DEFPUSHBUTTON "OK",IDOK,154,139,50,14,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,212,139,50,14 - SCROLLBAR IDC_RESIZEGRIP,7,143,10,10 - CONTROL "&Remember search pattern.",IDC_REMEMBERSEARCHPATTERN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,130,96,10 -END - -IDD_CHANGENOTIFY DIALOGEX 0, 0, 184, 65 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "File Change Notification" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - CONTROL "&None.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,35,10 - CONTROL "&Display message.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,71,10 - CONTROL "&Auto-reload (unmodified).",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,31,99,10 - CONTROL "&Reset if a new file is opened.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,48,109,10 - DEFPUSHBUTTON "OK",IDOK,127,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 -END - -IDD_STYLESELECT DIALOGEX 0, 0, 165, 134 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Select Scheme" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_STYLELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,70 - CONTROL "Set selected scheme as &default.",IDC_DEFAULTSCHEME, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,118,10 - CONTROL "&Auto-select by filename extension.",IDC_AUTOSELECT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,95,127,10 - DEFPUSHBUTTON "OK",IDOK,53,113,50,14,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,108,113,50,14 - SCROLLBAR IDC_RESIZEGRIP3,7,117,10,10 -END - -IDD_STYLECONFIG DIALOGEX 0, 0, 467, 254 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Customize Schemes" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,240 - LTEXT "",IDC_STYLELABEL_ROOT,181,141,279,8 - EDITTEXT IDC_STYLEEDIT_ROOT,181,152,279,12,ES_AUTOHSCROLL - LTEXT "",IDC_STYLELABEL,181,171,279,8 - EDITTEXT IDC_STYLEEDIT,181,183,279,12,ES_AUTOHSCROLL - PUSHBUTTON "For&e...",IDC_STYLEFORE,181,201,46,14 - PUSHBUTTON "&Back...",IDC_STYLEBACK,232,201,46,14 - PUSHBUTTON "&Font...",IDC_STYLEFONT,283,201,42,14 - PUSHBUTTON "&Preview",IDC_PREVIEW,330,201,42,14 - PUSHBUTTON "&Reset",IDC_STYLEDEFAULT,377,201,42,14 - PUSHBUTTON "",IDC_PREVSTYLE,426,201,15,14 - PUSHBUTTON "",IDC_NEXTSTYLE,445,201,15,14 - PUSHBUTTON "&Import...",IDC_IMPORT,181,233,50,14 - PUSHBUTTON "E&xport...",IDC_EXPORT,237,233,50,14 - DEFPUSHBUTTON "OK",IDOK,355,233,50,14 - PUSHBUTTON "Cancel",IDCANCEL,410,233,50,14 - GROUPBOX "Info",IDC_STATIC,180,7,280,127 - ICON IDI_STYLES,IDC_STATIC,189,19,20,20 - LTEXT "Customize Schemes",IDC_TITLE,220,25,200,12 - LTEXT "Filename extensions must be separated by ;\n\nStyle format:\nfont:Name;size:nn;bold;italic;underline;fore:#ffffff;back:#bbbbbb;eolfilled\n\nStyle properties can be copied using copy and paste or drag and drop.\n\nThe ""Preview"" button will not apply any changes.",IDC_STATIC,197,50,252,70 -END - -IDD_TABSETTINGS DIALOGEX 0, 0, 174, 90 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Tab Settings" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Tabulator width:",IDC_STATIC,7,10,54,8 - EDITTEXT 100,67,7,30,14,ES_AUTOHSCROLL - LTEXT "&Indentation size:",IDC_STATIC,7,30,55,8 - EDITTEXT 101,67,27,30,14,ES_AUTOHSCROLL - CONTROL "Insert tabs as &spaces.",102,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,87,10 - CONTROL "Tab &key reformats indentation.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,59,115,10 - CONTROL "&Backspace key reformats indentation.",104,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,71,137,10 - DEFPUSHBUTTON "OK",IDOK,117,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,117,24,50,14 -END - -IDD_LONGLINES DIALOGEX 0, 0, 184, 55 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Long Lines" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Limit for long lines:",IDC_STATIC,7,10,60,8 - EDITTEXT 100,77,7,30,14,ES_AUTOHSCROLL - CONTROL "Show &edge line.",101,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,27,67,10 - CONTROL "Change &background color.",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,38,100,10 - DEFPUSHBUTTON "OK",IDOK,127,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 -END - -IDD_WORDWRAP DIALOGEX 0, 0, 196, 100 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Word Wrap Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - COMBOBOX 100,7,7,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 101,7,24,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 102,7,41,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 103,7,58,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,83,79,50,14 - PUSHBUTTON "Cancel",IDCANCEL,139,79,50,14 - LTEXT "No wrap indent|Wrap indent by 1 character|Wrap indent by 2 characters|Wrap indent by 1 level|Wrap indent by 2 levels|Wrap indent as first subline|Wrap indent 1 level more than first subline",200,0,0,615,8,NOT WS_VISIBLE - LTEXT "No visual indicators before wrap|Show visual indicators before wrap (near text)|Show visual indicators before wrap (near borders)",201,0,0,418,8,NOT WS_VISIBLE - LTEXT "No visual indicators after wrap|Show visual indicators after wrap (near text)|Show visual indicators after wrap (near borders)",202,0,0,402,8,NOT WS_VISIBLE - LTEXT "Wrap text between words|Wrap text between any glyphs",203,0,0,187,8,NOT WS_VISIBLE -END - -IDD_PAGESETUP DIALOGEX 5, 5, 356, 260 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Page Setup" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Paper",1073,8,8,224,56,WS_GROUP - LTEXT "Si&ze:",1089,16,24,36,8 - COMBOBOX 1137,64,23,160,160,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT "&Source:",1090,16,45,36,8 - COMBOBOX 1138,64,42,160,160,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - GROUPBOX "Orientation",1072,8,69,64,56,WS_GROUP - CONTROL "P&ortrait",1056,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,82,52,12 - CONTROL "L&andscape",1057,"Button",BS_AUTORADIOBUTTON,16,103,52,12 - GROUPBOX "Margins",1075,80,69,152,56,WS_GROUP - LTEXT "&Left:",1102,88,85,32,8 - EDITTEXT 1155,120,82,28,12,WS_GROUP - LTEXT "&Right:",1103,164,85,32,8 - EDITTEXT 1157,196,82,28,12,WS_GROUP - LTEXT "&Top:",1104,88,104,32,8 - EDITTEXT 1156,120,103,28,12,WS_GROUP - LTEXT "&Bottom:",1105,164,104,32,8 - EDITTEXT 1158,196,103,28,12,WS_GROUP - GROUPBOX "Headers and Footers",1074,8,130,224,56,WS_GROUP - LTEXT "&Header:",IDC_STATIC,16,146,36,8 - COMBOBOX 32,64,145,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT "&Footer:",IDC_STATIC,16,167,36,8 - COMBOBOX 33,64,164,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP - GROUPBOX "Print Colors",1076,8,191,224,37,WS_GROUP - LTEXT "Mo&de:",IDC_STATIC,16,207,36,8 - COMBOBOX 34,64,206,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP - GROUPBOX "Zoom",IDC_STATIC,240,170,108,58,WS_GROUP - LTEXT "Print zoo&m (-10 to +20):",IDC_STATIC,248,188,92,8 - EDITTEXT 30,298,206,42,12,ES_AUTOHSCROLL - CONTROL "",31,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,282,205,11,14 - DEFPUSHBUTTON "OK",IDOK,190,237,50,14,WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,244,237,50,14 - PUSHBUTTON "&Printer...",IDC_PRINTER,298,237,50,14 - GROUPBOX "Preview",IDC_STATIC,240,8,108,157 - CONTROL "",1080,"Static",SS_WHITERECT,254,47,80,80 - CONTROL "",1081,"Static",SS_GRAYRECT,334,51,4,80 - CONTROL "",1082,"Static",SS_GRAYRECT,262,123,80,4 -END - -IDD_FAVORITES DIALOGEX 0, 0, 165, 129 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Favorites" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_FAVORITESDIR,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,69 - PUSHBUTTON "",IDC_GETFAVORITESDIR,7,83,13,13 - LTEXT "Click here to specify the directory with links to your favorite files.",IDC_FAVORITESDESCR,26,83,132,18 - DEFPUSHBUTTON "OK",IDOK,52,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,108,108,50,14 - SCROLLBAR IDC_RESIZEGRIP3,7,112,10,10 -END - -IDD_ADDTOFAV DIALOGEX 0, 0, 172, 66 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Add to Favorites" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Enter the name for the new favorites item:",IDC_STATIC,7,7,158,8 - EDITTEXT 100,7,22,158,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,59,45,50,14,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,115,45,50,14 -END - -IDD_PASSWORDS DIALOG 0, 0, 311, 122 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Encryption" -FONT 8, "MS Shell Dlg" -BEGIN - DEFPUSHBUTTON "OK",IDOK,245,94,50,14 - PUSHBUTTON "Cancel",IDCANCEL,184,94,50,14 - CONTROL "Set New Master Key",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,60,84,10 - EDITTEXT IDC_EDIT1,17,35,276,14,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_EDIT2,17,74,277,14 - LTEXT "Optional Master Key",IDC_STATIC,18,61,66,10,SS_SUNKEN | NOT WS_GROUP - CONTROL "Encrypt using Passphrase",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,21,98,10 - CONTROL "Reuse Master Key",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,60,76,10 - GROUPBOX "Passphrase",IDC_STATIC,7,7,297,108 -END - -IDD_READPW DIALOG 0, 0, 299, 84 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Decrypt File" -FONT 8, "MS Shell Dlg" -BEGIN - DEFPUSHBUTTON "OK",IDOK,233,54,50,14 - PUSHBUTTON "Cancel",IDCANCEL,175,54,50,14 - EDITTEXT IDC_EDIT3,16,24,267,14,ES_PASSWORD | ES_AUTOHSCROLL | WS_GROUP - CONTROL "decrypt using the master key",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,60,148,10 - LTEXT "This file has a master key",IDC_STATICPW,16,47,89,11,NOT WS_GROUP - GROUPBOX "Passphrase",IDC_STATIC,7,7,285,70 -END - -IDD_COLUMNWRAP DIALOGEX 0, 0, 130, 47 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Column Wrap" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Boundary:",IDC_STATIC,7,7,34,8 - EDITTEXT IDC_COLUMNWRAP,7,24,46,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,73,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,73,24,50,14 -END - -IDD_MODIFYLINES DIALOGEX 0, 0, 182, 110 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Modify Lines" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Prefix text to lines:",IDC_STATIC,7,7,62,8 - EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL - LTEXT "&Append text to lines:",IDC_STATIC,7,37,68,8 - EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,125,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 - LTEXT "$(L)",200,7,72,14,8 - LTEXT "$(0L)",201,30,72,18,8 - LTEXT "Document line number.",IDC_STATIC,57,72,74,8 - LTEXT "$(N)",202,7,82,15,8 - LTEXT "$(0N)",203,30,82,19,8 - LTEXT "Continuous number.",IDC_STATIC,57,82,66,8 - LTEXT "$(I)",204,7,92,13,8 - LTEXT "$(0I)",205,30,92,17,8 - LTEXT "Continuous number (zero-based).",IDC_STATIC,57,92,109,8 -END - -IDD_INSERTTAG DIALOGEX 0, 0, 182, 70 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Insert HTML/XML Tag" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "&Opening tag (with attributes):",IDC_STATIC,7,7,97,8 - EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL - LTEXT "&Closing tag (can be edited):",IDC_STATIC,7,37,90,8 - EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,125,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 -END - -IDD_ENCLOSESELECTION DIALOGEX 0, 0, 182, 70 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Enclose Selection" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - LTEXT "Insert &before selection:",IDC_STATIC,7,7,76,8 - EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL - LTEXT "Insert &after selection:",IDC_STATIC,7,37,71,8 - EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,125,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 -END - -IDD_INFOBOX DIALOGEX 0, 0, 244, 71 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Notepad3" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 - LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 - DEFPUSHBUTTON "OK",IDOK,187,50,50,14 - CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 -END - -IDD_INFOBOX2 DIALOGEX 0, 0, 244, 71 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Notepad3" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 - LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 - PUSHBUTTON "&Yes",IDYES,131,50,50,14 - PUSHBUTTON "&No",IDNO,187,50,50,14 - CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 -END - -IDD_INFOBOX3 DIALOGEX 0, 0, 244, 71 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Notepad3" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 - LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 - DEFPUSHBUTTON "OK",IDOK,131,50,50,14 - PUSHBUTTON "Cancel",IDCANCEL,187,50,50,14 - CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 -END - -IDD_SORT DIALOGEX 0, 0, 184, 140 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Sort Lines" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - CONTROL "Sort &ascending.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,66,10 - CONTROL "Sort &descending.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,70,10 - CONTROL "Shu&ffle lines.",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,31,57,10 - CONTROL "&Merge duplicate lines.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,85,10 - CONTROL "&Remove duplicate lines.",104,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,62,91,10 - CONTROL "Remove &unique lines.",105,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,74,84,10 - CONTROL "&Case insensitive.",106,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,92,70,10 - CONTROL "Logical &number comparison.",107,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,104,104,10 - CONTROL "Column &sort (rectangular selection).",108,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,131,10 - DEFPUSHBUTTON "OK",IDOK,127,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 -END - -IDD_RECODE DIALOGEX 0, 0, 165, 135 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Recode" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Select source &encoding to reload file:",IDC_STATIC,7,7,119,8 - CONTROL "",IDC_ENCODINGLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,19,151,87 - DEFPUSHBUTTON "OK",IDOK,53,114,50,14,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,108,114,50,14 - SCROLLBAR IDC_RESIZEGRIP4,7,118,10,10 -END - -IDD_ENCODING DIALOGEX 0, 0, 165, 135 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Encoding" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Select current file &encoding:",IDC_STATIC,7,7,90,8 - CONTROL "",IDC_ENCODINGLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,19,151,87 - DEFPUSHBUTTON "OK",IDOK,53,114,50,14,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,108,114,50,14 - SCROLLBAR IDC_RESIZEGRIP4,7,118,10,10 -END - -IDD_ALIGN DIALOGEX 0, 0, 184, 74 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Align Lines" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - CONTROL "&Left.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,31,10 - CONTROL "&Right.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,35,10 - CONTROL "&Center.",102,"Button",BS_AUTORADIOBUTTON,7,31,41,10 - CONTROL "&Justify.",103,"Button",BS_AUTORADIOBUTTON,7,43,40,10 - CONTROL "Justify (&Paragraph mode).",104,"Button",BS_AUTORADIOBUTTON,7,55,100,10 - DEFPUSHBUTTON "OK",IDOK,127,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 4 - VERTGUIDE, 19 - VERTGUIDE, 340 - TOPMARGIN, 7 - BOTTOMMARGIN, 270 - END - - IDD_FIND, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 266 - VERTGUIDE, 7 - TOPMARGIN, 7 - BOTTOMMARGIN, 113 - END - - IDD_REPLACE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 266 - VERTGUIDE, 7 - TOPMARGIN, 7 - BOTTOMMARGIN, 140 - END - - IDD_RUN, DIALOG - BEGIN - LEFTMARGIN, 10 - RIGHTMARGIN, 218 - BOTTOMMARGIN, 85 - END - - IDD_OPENWITH, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 158 - TOPMARGIN, 7 - BOTTOMMARGIN, 122 - END - - IDD_DEFENCODING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 190 - TOPMARGIN, 7 - BOTTOMMARGIN, 152 - END - - IDD_DEFEOLMODE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 173 - TOPMARGIN, 7 - BOTTOMMARGIN, 71 - END - - IDD_LINENUM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 40 - END - - IDD_FILEMRU, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 262 - TOPMARGIN, 7 - BOTTOMMARGIN, 153 - END - - IDD_CHANGENOTIFY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 177 - TOPMARGIN, 7 - BOTTOMMARGIN, 58 - END - - IDD_STYLESELECT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 158 - TOPMARGIN, 7 - BOTTOMMARGIN, 127 - END - - IDD_STYLECONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 460 - TOPMARGIN, 7 - BOTTOMMARGIN, 247 - END - - IDD_TABSETTINGS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 167 - TOPMARGIN, 7 - BOTTOMMARGIN, 83 - END - - IDD_LONGLINES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 177 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END - - IDD_WORDWRAP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 189 - TOPMARGIN, 7 - BOTTOMMARGIN, 93 - END - - IDD_PAGESETUP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 349 - TOPMARGIN, 7 - BOTTOMMARGIN, 253 - END - - IDD_FAVORITES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 158 - TOPMARGIN, 7 - BOTTOMMARGIN, 122 - END - - IDD_ADDTOFAV, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 165 - TOPMARGIN, 7 - BOTTOMMARGIN, 59 - END - - IDD_PASSWORDS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 304 - TOPMARGIN, 7 - BOTTOMMARGIN, 115 - END - - IDD_COLUMNWRAP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 123 - TOPMARGIN, 7 - BOTTOMMARGIN, 40 - END - - IDD_MODIFYLINES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 175 - TOPMARGIN, 7 - BOTTOMMARGIN, 103 - END - - IDD_INSERTTAG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 175 - TOPMARGIN, 7 - BOTTOMMARGIN, 63 - END - - IDD_ENCLOSESELECTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 175 - TOPMARGIN, 7 - BOTTOMMARGIN, 63 - END - - IDD_INFOBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 237 - TOPMARGIN, 7 - BOTTOMMARGIN, 64 - END - - IDD_INFOBOX2, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 237 - TOPMARGIN, 7 - BOTTOMMARGIN, 64 - END - - IDD_INFOBOX3, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 237 - TOPMARGIN, 7 - BOTTOMMARGIN, 64 - END - - IDD_SORT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 177 - TOPMARGIN, 7 - BOTTOMMARGIN, 133 - END - - IDD_RECODE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 158 - TOPMARGIN, 7 - BOTTOMMARGIN, 128 - END - - IDD_ENCODING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 158 - TOPMARGIN, 7 - BOTTOMMARGIN, 128 - END - - IDD_ALIGN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 177 - TOPMARGIN, 7 - BOTTOMMARGIN, 67 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_PASS_FAILURE "The passphrase is incorrect." -END - -STRINGTABLE -BEGIN - IDS_NOPASS "Cancelled - no passphrase." -END - -STRINGTABLE -BEGIN - IDS_APPTITLE "Notepad3" - IDS_APPTITLE_ELEVATED "%s (Administrator)" - IDS_APPTITLE_PASTEBOARD "Notepad3 : Paste Board" - IDS_UNTITLED "Untitled" - IDS_TITLEEXCERPT """%s""" - IDS_READONLY "(Read Only)" - IDS_DOCPOS " Ln %s / %s Col %s Sel %s (%s) SelLn %s Occ %s " - IDS_DOCPOS2 " Ln %s / %s Col %s / %s Sel %s (%s) SelLn %s Occ %s " - IDS_DOCSIZE " %s [UTF-8]" - IDS_LOADFILE "Loading ""%s""..." - IDS_SAVEFILE "Saving ""%s""..." - IDS_PRINTFILE "Printing page %i..." - IDS_SAVINGSETTINGS "Saving settings..." - IDS_LINKDESCRIPTION "Edit with Notepad3" - IDS_FILTER_ALL "All files (*.*)|*.*|" - IDS_FILTER_EXE "Executable files (*.exe;*.com;*.bat;*.cmd;*.lnk;*.pif)|*.exe;*.com;*.bat;*.cmd;*.lnk;*.pif|All files (*.*)|*.*|" -END - -STRINGTABLE -BEGIN - IDS_FILTER_INI "Configuration files (*.ini)|*.ini|All files (*.*)|*.*|" - IDS_OPENWITH "Select the directory with links to your favorite applications." - IDS_FAVORITES "Select the directory with links to your favorite files." - IDS_BACKSLASHHELP "Backslash Transformations\n\n\\a\tAlert (BEL, Ascii 7)\n\\b\tBackspace (BS, Ascii 8)\n\\f\tFormfeed (FF, Ascii 12)\n\\n\tNewline (LF, Ascii 10)\n\\r\tCarriage return (CR, Ascii 13)\n\\t\tHorizontal Tab (HT, Ascii 9)\n\\v\tVertical Tab (VT, Ascii 11)\n\\0oo\tOctal Value\n\\u####\tHexadecimal Value\n\\xhh\tHexadecimal Value\n\\\\\tBackslash" - IDS_REGEXPHELP "RegExp Matching Syntax (Multi Lines)\n\n.\tMatches any character\n^\tEmpty string immediately after Newline\n$\tEmpty string immediately before End of Line\n\\<\tStart of a word\n\\>\tEnd of a word\n\\b\tWord boundary\n[...]\tA set of chars ([abc]) or a range ([a-z])\n[^...]\tChars NOT in the set or range\n\\d\tAny decimal digit\n\\D\tAny non-digit char\n\\s\tAny whitespace char\n\\S\tNot a whitespace char\n\\w\tAny ""word"" char\n\\W\tAny ""non-word"" char\n\\x\tEscape character with otherwise special meaning\n\\xHH\tChar with hex code HH\n?\tMatches preceding 0 or 1 times\n*\tMatches preceding 0 or more times\n+\tMatches preceding 1 or more times\n*? or +?\tNon greedy matching of quantifiers ""?"" and ""+""\n(\tStart of a region\n)\tEnd of a region\n\\n\tRefers to a region when replacing (n is 1-9)\n" - IDS_WILDCARDHELP "Wildcard Search\n\n*\tMatches zero or more characters.\n?\tMatches exactly one character. " - IDS_FR_STATUS_FMT " Ln %s / %s Col %s Sel %s Occ %s Repl %s ( %s ) " -END - -STRINGTABLE -BEGIN - IDT_FILE_NEW "New" - IDT_FILE_OPEN "Open" - IDT_FILE_BROWSE "Browse" - IDT_FILE_SAVE "Save" -END - -STRINGTABLE -BEGIN - IDT_EDIT_UNDO "Undo" - IDT_EDIT_REDO "Redo" - IDT_EDIT_CUT "Cut" - IDT_EDIT_COPY "Copy" - IDT_EDIT_PASTE "Paste" - IDT_EDIT_FIND "Find" - IDT_EDIT_REPLACE "Replace" - IDT_VIEW_WORDWRAP "Word Wrap" - IDT_VIEW_ZOOMIN "Zoom In" - IDT_VIEW_ZOOMOUT "Zoom Out" - IDT_VIEW_SCHEME "Select Scheme" - IDT_VIEW_SCHEMECONFIG "Customize Schemes" - IDT_FILE_EXIT "Exit" - IDT_FILE_SAVEAS "Save As" - IDT_FILE_SAVECOPY "Save Copy" - IDT_EDIT_CLEAR "Delete" -END - -STRINGTABLE -BEGIN - IDT_FILE_PRINT "Print" - IDT_FILE_OPENFAV "Favorites" - IDT_FILE_ADDTOFAV "Add to Favorites" - IDT_VIEW_TOGGLEFOLDS "Toggle All Folds" - IDT_FILE_LAUNCH "Execute Document" -END - -STRINGTABLE -BEGIN - IDS_ERR_LOADFILE "Error loading ""%s""." - IDS_ERR_SAVEFILE "Error saving ""%s""." - IDS_ERR_BROWSE "No file browser plugin was found.\nThe MiniPath file browser plugin can be downloaded from https://rizonesoft.com." - IDS_ERR_MRUDLG "No access to the selected file!\nWould you like to remove it from the list?" - IDS_ERR_CREATELINK "Error creating the Desktop link." - IDS_ERR_PREVWINDISABLED "Existing Notepad3 window is busy or has an active dialog box.\nWould you like to open another Notepad3 window?" - IDS_SELRECT "This operation can't be perfomed within a rectangular selection." - IDS_BUFFERTOOSMALL "This operation can't be performed (lines too long)." - IDS_FIND_WRAPFW "Reached the end of the document, restarting search at the beginning." - IDS_FIND_WRAPRE "Reached the beginning of the document, restarting search at the end." - IDS_NOTFOUND "The specified text was not found." - IDS_REPLCOUNT "%i occurrences of the specified text have been replaced." - IDS_ASK_ENCODING "Switching the file encoding from one encoding to another may replace unsupported text with default characters, and the undo history will be cleared. Continue?" - IDS_ASK_ENCODING2 "You are about to change the encoding of an empty file. Note that this will clear the undo history, as it can't be synchronized with the new encoding. Continue?" - IDS_ERR_ENCODINGNA "Code page conversion tables for the selected encoding are not available on your system." - IDS_ERR_UNICODE "Error converting this Unicode file.\nData will be lost if the file is saved!" -END - -STRINGTABLE -BEGIN - IDS_READONLY_SAVE """%s"" is read only. Save to a different file?" - IDS_FILECHANGENOTIFY "The current file has been modified by an external program. Reload?" - IDS_FILECHANGENOTIFY2 "The current file has been deleted. Save now?" - IDS_STICKYWINPOS "Sticky Window Position is enabled. Any new Notepad3 windows will use the current window placement settings." - IDS_SAVEDSETTINGS "The current program settings have been saved." - IDS_CREATEINI_FAIL "Error creating configuration file." - IDS_WRITEINI_FAIL "Error writing settings to configuration file." - IDS_SETTINGSNOTSAVED "No existing configuration file was found.\nTo keep your style modifications, save settings now (F7) or go back to scheme configuration (Ctrl+F12) and export your styles." - IDS_EXPORT_FAIL "Error exporting style settings to ""%s""." - IDS_ERR_ACCESSDENIED "The file ""%s"" cannot be saved and may be protected.\n\nDo you want to launch Notepad3 as Administrator?" - IDS_WARN_UNKNOWN_EXT "Unknown file name extension (%s) !\nLoading data anyway ?" - IDS_REGEX_INVALID "Error evaluating regular expression. Expression is invalid!" - IDS_DROP_NO_FILE "No valid filename retrieved.\nIf dropping from 32-bit application,\nplease drag and drop to Notepad3's tool bar." - IDS_APPLY_DEFAULT_FONT "Apply these font settings to current ('%s') scheme's default text also?" - IDS_ERR_UPDATECHECKER "No update installer executable found.\nCheck for update on website https://rizonesoft.com ?" -END - -STRINGTABLE -BEGIN - IDS_CMDLINEHELP "Command Line Help\n\nfile\tMust be the last argument, no quoted spaces by default.\n+\tAccept multiple file arguments (with quoted spaces).\n-\tAccept single file argument (without quoted spaces).\n…\tEncoding (/ansi, /unicode, /unicodebe, /utf8, /utf8sig).\n…\tLine ending mode (/crlf, /lf, /cr).\n/e\tFile source encoding.\n/g\tJump to specified position (/g -1 end of file).\n/m\tMatch specified text (/m- last, /mr regex, /mb backslash).\n/l\tAuto-reload modified files.\n/q\tForce creation of new files without prompt.\n/s\tSelect specified syntax scheme.\n/d\tSelect default text scheme.\n/h\tSelect Web Source Code scheme.\n/x\tSelect XML Document scheme.\n/c\tOpen new window and paste clipboard contents.\n/b\tOpen new paste board to collect clipboard entries.\n/n\tAlways open a new window (/ns single file instance).\n/r\tReuse window (/rs single file instance).\n/p\tSet window position and size (/p0, /ps, /pf,l,t,r,b,m).\n/t\tSet window title.\n/i\tStart as tray icon.\n/o\tKeep window on top.\n/f\tSpecify ini-file (/f0 no ini-file).\n/u\tLaunch with elevated privileges.\n/v\tPrint file immediately and quit.\n/vd\tPrint file (open printer dialog).\n/z\tSkip next (usable for registry-based Notepad replacement)." -END - -STRINGTABLE -BEGIN - IDS_ERR_UNICODE2 "Certain characters in the current text are not supported by the selected encoding, and may be replaced by default placeholders when saving. It's recommended to choose another file encoding. Continue?" - IDS_WARN_LOAD_BIG_FILE "Are you sure you want to open this large file?" - IDS_ERR_DROP "Only one file can be dropped at the same time!" - IDS_ASK_SAVE "Save changes to ""%s""?" - IDS_ASK_REVERT "Revert file to last saved state? Your changes will be lost!" - IDS_ASK_RECODE "Recoding requires reloading file from disk, unsaved changes will be lost!" - IDS_ASK_CREATE """%s"" not found.\nWould you like to create this file?" - IDS_PRINT_HEADER "Filename, Current Date and Time|Filename, Current Date|Filename|Leave blank" - IDS_PRINT_FOOTER "Page Number|Leave blank" - IDS_PRINT_COLOR "Normal|Invert light (dark background)|Black on white|Color on white|Color on white (except line numbers)" - IDS_PRINT_PAGENUM "Page %i" - IDS_PRINT_EMPTY "This document doesn't contain any text to be printed." - IDS_PRINT_ERROR "Error printing ""%s""!" - IDS_FAV_SUCCESS "A shortcut to the current file has been created in the favorites directory." - IDS_FAV_FAILURE "The shortcut to the current file could not be created.\nMake sure there's no other file with the same name." - IDS_READONLY_MODIFY "The attributes of ""%s"" could not be modified." -END - -STRINGTABLE -BEGIN - IDS_SAVEPOS "&Save Position\tCtrl+S" - IDS_RESETPOS "&Reset Position\tCtrl+R" - IDS_PREVIEW "&Preview Settings\tCtrl+P" -END - -STRINGTABLE -BEGIN - 61000 "A0;ANSI;ANSI" - 61001 "A1;OEM;OEM" - 61002 "A2;Unicode (UTF-16 LE BOM);Unicode (UTF-16) LE BOM" - 61003 "A3;Unicode (UTF-16 BE BOM);Unicode (UTF-16) BE BOM" - 61004 "A4;Unicode (UTF-16 LE);Unicode (UTF-16) LE" - 61005 "A5;Unicode (UTF-16 BE);Unicode (UTF-16) BE" - 61006 "A6;UTF-8;Unicode (UTF-8)" - 61007 "A7;UTF-8 Signature;Unicode (UTF-8) Signature" -END - -STRINGTABLE -BEGIN - 61008 "A8;UTF-7;Unicode (UTF-7)" - 61009 "C;Arabic (DOS-720);DOS-720" - 61010 "C;Arabic (ISO-8859-6);ISO-8859-6" - 61011 "C;Arabic (Mac);Mac (Arabic)" - 61012 "C;Arabic (Windows-1256);Windows-1256" - 61013 "C;Baltic (DOS-775);DOS-775" - 61014 "C;Baltic (ISO-8859-4);ISO-8859-4" - 61015 "C;Baltic (Windows-1257);Windows-1257" - 61016 "C;Central European (DOS-852);DOS-852" - 61017 "C;Central European (ISO-8859-2);ISO-8859-2" - 61018 "C;Central European (Mac);Mac (Central)" - 61019 "C;Central European (Windows-1250);Windows-1250" - 61020 "C;Chinese Simplified (GBK-2312);GBK-2312" - 61021 "C;Chinese Simplified (Mac);Mac (zh-cn)" - 61022 "C;Chinese Traditional (Big5);Big5" - 61023 "C;Chinese Traditional (Mac);Mac (zh-tw)" -END - -STRINGTABLE -BEGIN - 61024 "C;Croatian (Mac);Mac (Croatian)" - 61025 "C;Cyrillic (DOS-866);DOS-866" - 61026 "C;Cyrillic (ISO-8859-5);ISO-8859-5" - 61027 "C;Cyrillic (KOI8-R);KOI8-R" - 61028 "C;Cyrillic (KOI8-U);KOI8-U" - 61029 "C;Cyrillic (Mac);Mac (Cyrillic)" - 61030 "C;Cyrillic (Windows-1251);Windows-1251" - 61031 "C;Estonian (ISO-8859-13);ISO-8859-13" - 61032 "C;French Canadian (DOS-863);DOS-863" - 61033 "C;Greek (DOS-737);DOS-737" - 61034 "C;Greek (ISO-8859-7);ISO-8859-7" - 61035 "C;Greek (Mac);Mac (Greek)" - 61036 "C;Greek (Windows-1253);Windows-1253" - 61037 "C;Greek, Modern (DOS-869);DOS-869" - 61038 "C;Hebrew (DOS-862);DOS-862" - 61039 "C;Hebrew (ISO-8859-8-I);ISO-8859-8-I" -END - -STRINGTABLE -BEGIN - 61040 "C;Hebrew (ISO-8859-8);ISO-8859-8" - 61041 "C;Hebrew (Mac);Mac (Hebrew)" - 61042 "C;Hebrew (Windows-1255);Windows-1255" - 61043 "C;Icelandic (DOS-861);DOS-861" - 61044 "C;Icelandic (Mac);Mac (Icelandic)" - 61045 "C;Japanese (Mac);Mac (Japanese)" - 61046 "C;Japanese (Shift-JIS);Shift-JIS" - 61047 "C;Korean (Mac);Mac (Korean)" - 61048 "C;Korean (Windows-949);Windows-949" - 61049 "C;Latin 3 (ISO-8859-3);ISO-8859-3" - 61050 "C;Latin 9 (ISO-8859-15);ISO-8859-15" - 61051 "C;Nordic (DOS-865);DOS-865" - 61052 "C;OEM United States (DOS-437);DOS-437" - 61053 "C;OEM Multilingual Latin 1 (DOS-858);DOS-858" - 61054 "C;Portuguese (DOS-860);DOS-860" - 61055 "C;Romanian (Mac);Mac (Romanian)" -END - -STRINGTABLE -BEGIN - 61056 "C;Thai (Mac);Mac (Thai)" - 61057 "C;Thai (Windows-874);Windows-874" - 61058 "C;Turkish (DOS-857);DOS-857" - 61059 "C;Turkish (ISO-8859-9);ISO-8859-9" - 61060 "C;Turkish (Mac);Mac (Turkish)" - 61061 "C;Turkish (Windows-1254);Windows-1254" - 61062 "C;Ukrainian (Mac);Mac (Ukrainian)" - 61063 "C;Vietnamese (Windows-1258);Windows-1258" - 61064 "B;Western European (DOS-850);DOS-850" - 61065 "B;Western European (ISO-8859-1);ISO-8859-1" - 61066 "B;Western European (Mac);Mac (Western)" - 61067 "B;Western European (Windows-1252);Windows-1252" - 61068 "D0;IBM EBCDIC (US-Canada);EBCDIC (US)" - 61069 "D1;IBM EBCDIC (International);EBCDIC (Int.)" - 61070 "D2;IBM EBCDIC (Greek Modern);EBCDIC (GR)" - 61071 "D3;IBM EBCDIC (Turkish Latin-5);EBCDIC (Latin-5)" -END - -STRINGTABLE -BEGIN - 61072 "C;Chinese Simplified (GB18030);GB18030" - 61073 "C;Japanese (EUC);Japanese (EUC)" - 61074 "C;Korean (EUC);Korean (EUC)" - 61075 "C;Chinese Traditional (ISO-2022);ISO-2022-CN" - 61076 "C;Chinese Simplified (HZ-GB2312);HZ-GB2312" - 61077 "C;Japanese (ISO-2022);ISO-2022-JP" - 61078 "C;Korean (ISO-2022);ISO-2022-KR" - 61079 "C;Chinese Traditional (CNS);x-chinese-cns" -END - -STRINGTABLE -BEGIN - 62000 "Windows (CR+LF)" - 62001 "Unix (LF)" - 62002 "Mac (CR)" -END - -STRINGTABLE -BEGIN - 63000 "Default Text" - 63001 "Web Source Code" - 63002 "XML Document" - 63003 "CSS Style Sheets" - 63004 "C/C++ Source Code" - 63005 "C# Source Code" - 63006 "Resource Script" - 63007 "Makefiles" -END - -STRINGTABLE -BEGIN - 63008 "VBScript" - 63009 "Visual Basic" - 63010 "JavaScript" - 63011 "Java Source Code" - 63012 "Pascal Source Code" - 63013 "Assembly Script" - 63014 "Perl Script" - 63015 "Configuration Files" - 63016 "Batch Files" - 63017 "Diff Files" - 63018 "SQL Query" - 63019 "Python Script" - 63020 "Apache Config Files" - 63021 "PowerShell Script" - 63022 "D Source Code" - 63023 "Go Source Code" -END - -STRINGTABLE -BEGIN - 63024 "Awk Script" - 63025 "ANSI Art" - 63026 "Shell Script" - 63027 "Registry Files" - 63028 "VHDL" - 63029 "JSON" - 63030 "NSIS" - 63031 "Inno Setup Script" - 63032 "Ruby Script" - 63033 "Lua Script" - 63034 "Tcl Script" - 63035 "AutoIt3 Script" - 63036 "LaTeX Files" - 63037 "AutoHotkey Script" - 63038 "Cmake Script" - 63039 "AviSynth Script" -END - -STRINGTABLE -BEGIN - 63040 "Markdown" - 63041 "YAML" - 63042 "Coffeescript" - 63043 "MATLAB" - 63044 "Nim Source Code" - 63045 "R-S-SPlus Statistics Code" -END - -STRINGTABLE -BEGIN - 63100 "Default Style" - 63101 "Margins and Line Numbers" - 63102 "Matching Braces (Indicator)" - 63103 "Matching Braces Error (Indicator)" -END - -STRINGTABLE -BEGIN - 63104 "Control Characters (Font)" - 63105 "Indentation Guide (Color)" - 63106 "Selected Text (Colors)" - 63107 "Whitespace (Colors, Size 0-5)" - 63108 "Current Line Background (Color)" - 63109 "Caret (Color, Size 1-3)" - 63110 "Long Line Marker (Colors)" - 63111 "Extra Line Spacing (Size)" - 63112 "2nd Default Style" - 63113 "2nd Margins and Line Numbers" - 63114 "2nd Matching Braces (Indicator)" - 63115 "2nd Matching Braces Error (Indicator)" - 63116 "2nd Control Characters (Font)" - 63117 "2nd Indentation Guide (Color)" - 63118 "2nd Selected Text (Colors)" - 63119 "2nd Whitespace (Colors, Size 0-5)" -END - -STRINGTABLE -BEGIN - 63120 "2nd Current Line Background (Color)" - 63121 "2nd Caret (Color, Size 1-3)" - 63122 "2nd Long Line Marker (Colors)" - 63123 "2nd Extra Line Spacing (Size)" - 63124 "Bookmarks and Folding (Colors)" - 63125 "2nd Bookmarks and Folding (Colors)" - 63126 "Default" - 63127 "Comment" - 63128 "Keyword" - 63129 "Identifier" - 63130 "Number" - 63131 "String" - 63132 "Operator" - 63133 "Preprocessor" - 63134 "Verbatim String" - 63135 "Regex" -END - -STRINGTABLE -BEGIN - 63136 "HTML Tag" - 63137 "HTML Unknown Tag" - 63138 "HTML Attribute" - 63139 "HTML Unknown Attribute" - 63140 "HTML Value" - 63141 "HTML String" - 63142 "HTML Other Inside Tag" - 63143 "HTML Comment" - 63144 "HTML Entity" - 63145 "XML Identifier" - 63146 "ASP Start Tag" - 63147 "CDATA" - 63148 "PHP Start Tag" - 63149 "PHP Default" - 63150 "PHP String" - 63151 "PHP Simple String" -END - -STRINGTABLE -BEGIN - 63152 "PHP Keyword" - 63153 "PHP Number" - 63154 "PHP Variable" - 63155 "PHP String Variable" - 63156 "PHP Complex Variable" - 63157 "PHP Comment" - 63158 "PHP Operator" - 63159 "JS Default" - 63160 "JS Comment" - 63161 "JS Number" - 63162 "JS Identifier" - 63163 "JS Keyword" - 63164 "JS String" - 63165 "JS Symbols" - 63166 "JS Regex" - 63167 "ASP JS Default" -END - -STRINGTABLE -BEGIN - 63168 "ASP JS Comment" - 63169 "ASP JS Number" - 63170 "ASP JS Identifier" - 63171 "ASP JS Keyword" - 63172 "ASP JS String" - 63173 "ASP JS Symbols" - 63174 "ASP JS Regex" - 63175 "VBS Default" - 63176 "VBS Comment" - 63177 "VBS Number" - 63178 "VBS Keyword" - 63179 "VBS String" - 63180 "VBS Identifier" - 63181 "ASP VBS Default" - 63182 "ASP VBS Comment" - 63183 "ASP VBS Number" -END - -STRINGTABLE -BEGIN - 63184 "ASP VBS Keyword" - 63185 "ASP VBS String" - 63186 "ASP VBS Identifier" - 63187 "XML Tag" - 63188 "XML Attribute" - 63189 "XML Value" - 63190 "XML String" - 63191 "XML Other Inside Tag" - 63192 "XML Comment" - 63193 "XML Entity" - 63194 "Tag-Class" - 63195 "Tag-ID" - 63196 "Tag-Attribute" - 63197 "Pseudo-Class" - 63198 "Unknown Pseudo-Class" - 63199 "CSS Property" -END - -STRINGTABLE -BEGIN - 63200 "Unknown Property" - 63201 "Value" - 63202 "Important" - 63203 "Directive" - 63204 "Target" - 63205 "Inline Asm" - 63206 "CPU Instruction" - 63207 "FPU Instruction" - 63208 "Register" - 63209 "Directive Operand" - 63210 "Extended Instruction" - 63211 "String Double Quoted" - 63212 "String Single Quoted" - 63213 "POD (Common)" - 63214 "POD (Verbatim)" - 63215 "Scalar $var" -END - -STRINGTABLE -BEGIN - 63216 "Array @var" - 63217 "Hash %var" - 63218 "Symbol Table *var" - 63219 "Regex /re/ or m{re}" - 63220 "Substitution s/re/ore/" - 63221 "Back Ticks" - 63222 "Data Section" - 63223 "Here-Doc (Delimiter)" - 63224 "Here-Doc (Single Quoted, q)" - 63225 "Here-Doc (Double Quoted, qq)" - 63226 "Here-Doc (Back Ticks, qx)" - 63227 "Single Quoted String (Generic, q)" - 63228 "Double Quoted String (qq)" - 63229 "Back Ticks (qx)" - 63230 "Regex (qr)" - 63231 "Array (qw)" -END - -STRINGTABLE -BEGIN - 63232 "Section" - 63233 "Assignment" - 63234 "Default Value" - 63235 "Label" - 63236 "Command" - 63237 "SGML" - 63238 "Source and Destination" - 63239 "Position Setting" - 63240 "Line Addition" - 63241 "Line Removal" - 63242 "Line Change" - 63243 "Quoted Identifier" - 63244 "String Triple Double Quotes" - 63245 "String Triple Single Quotes" - 63246 "Class Name" - 63247 "Function Name" -END - -STRINGTABLE -BEGIN - 63248 "IP Address" - 63249 "Variable" - 63250 "Cmdlet" - 63251 "Alias" - 63252 "Parsing Error" - 63253 "Prototype" - 63254 "Format Identifier" - 63255 "Format Body" - 63256 "HTML Element Text" - 63257 "XML Element Text" - 63258 "Typedefs/Classes" - 63259 "Comment Doc" - 63260 "Keyword 2nd" - 63261 "Error" - 63262 "Mark Occurrences (Indicator)" - 63263 "2nd Mark Occurrences (Indicator)" -END - -STRINGTABLE -BEGIN - 63264 "Hyperlink Hotspots" - 63265 "2nd Hyperlink Hotspots" - 63266 "2nd Default Text" - 63267 "Variable within String" - 63268 "Ordered List" - 63269 "Infix" - 63270 "Infix EOL" - 63271 "Base Package Functions" - 63272 "Other Package Functions" -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// German (Switzerland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DES) -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_SWISS -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""Notepad3.ver""\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // German (Switzerland) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "Notepad3.ver" -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINWND ICON "..\\res\\Notepad3.ico" + +IDI_RUN ICON "..\\res\\Run.ico" + +IDR_MAINWND128 ICON "..\\res\\Notepad3_128.ico" + +IDI_STYLES ICON "..\\res\\Styles.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINWNDTB BITMAP "..\\res\\Toolbar.bmp" + +IDB_OPEN BITMAP "..\\res\\Open.bmp" + +IDB_NEXT BITMAP "..\\res\\Next.bmp" + +IDB_PREV BITMAP "..\\res\\Prev.bmp" + +IDB_PICK BITMAP "..\\res\\Pick.bmp" + +IDB_ENCODING BITMAP "..\\res\\Encoding.bmp" + +IDR_MAINWNDTB2 BITMAP "..\\res\\Toolbar2.bmp" + +IDR_RIZBITMAP BITMAP "..\\res\\rizonesoft.bmp" + + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDC_COPY CURSOR "..\\res\\Copy.cur" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINWND MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", IDM_FILE_NEW + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN + MENUITEM "Re&vert\tF5", IDM_FILE_REVERT + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE + MENUITEM "Save &As...\tF6", IDM_FILE_SAVEAS + MENUITEM "Save &Copy...\tCtrl+F6", IDM_FILE_SAVECOPY + MENUITEM "&Read Only", IDM_FILE_READONLY + MENUITEM SEPARATOR + MENUITEM "Set Encr&yption Passphrase...", IDM_SETPASS + MENUITEM SEPARATOR + POPUP "&Launch" + BEGIN + MENUITEM "&New Window\tAlt+N", IDM_FILE_NEWWINDOW + MENUITEM "&Empty Window\tAlt+Shift+N", IDM_FILE_NEWWINDOW2 + MENUITEM SEPARATOR + MENUITEM "Execute &Document\tCtrl+L", IDM_FILE_LAUNCH + MENUITEM "&Open with...\tAlt+L", IDM_FILE_OPENWITH + MENUITEM "&Command...\tCtrl+R", IDM_FILE_RUN + MENUITEM SEPARATOR + MENUITEM "Web Template &1\tCtrl+Shift+1", CMD_WEBACTION1 + MENUITEM "Web Template &2\tCtrl+Shift+2", CMD_WEBACTION2 + END + MENUITEM SEPARATOR + POPUP "&Encoding" + BEGIN + MENUITEM "&ANSI", IDM_ENCODING_ANSI + MENUITEM "&Unicode", IDM_ENCODING_UNICODE + MENUITEM "Unicode &Big Endian", IDM_ENCODING_UNICODEREV + MENUITEM "UTF-&8\tShift+F8", IDM_ENCODING_UTF8 + MENUITEM "UTF-8 with &Signature", IDM_ENCODING_UTF8SIGN + MENUITEM "&More...\tF9", IDM_ENCODING_SELECT + MENUITEM SEPARATOR + MENUITEM "Recode to &Default\tCtrl-Alt-F", CMD_RECODEDEFAULT + MENUITEM "Recode to &ANSI\tCtrl-Shift+A", CMD_RECODEANSI + MENUITEM "Recode to &OEM\tCtrl+Shift+O", CMD_RECODEOEM + MENUITEM "ASCII as UTF-&8\tCtrl+Shift+F8", CMD_RELOADASCIIASUTF8 + MENUITEM "Ignore Encoding &Tags\tAlt+F8", CMD_RELOADNOFILEVARS + MENUITEM "&Recode...\tF8", IDM_ENCODING_RECODE + MENUITEM SEPARATOR + MENUITEM "Set &Default...", IDM_ENCODING_SETDEFAULT + END + POPUP "Line Endin&gs" + BEGIN + MENUITEM "&Windows (CR+LF)", IDM_LINEENDINGS_CRLF + MENUITEM "&Unix (LF)", IDM_LINEENDINGS_LF + MENUITEM "&Mac (CR)", IDM_LINEENDINGS_CR + MENUITEM SEPARATOR + MENUITEM "&Default...", IDM_LINEENDINGS_SETDEFAULT + END + MENUITEM SEPARATOR + MENUITEM "Page Se&tup...", IDM_FILE_PAGESETUP + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM SEPARATOR + MENUITEM "Propert&ies...", IDM_FILE_PROPERTIES + MENUITEM "Create &Desktop Link", IDM_FILE_CREATELINK + MENUITEM SEPARATOR + MENUITEM "&Browse...\tCtrl+M", IDM_FILE_BROWSE + POPUP "&Favorites" + BEGIN + MENUITEM "&Open Favorites...\tAlt+I", IDM_FILE_OPENFAV + MENUITEM "&Add Current File...\tAlt+K", IDM_FILE_ADDTOFAV + MENUITEM "&Manage...\tAlt+F9", IDM_FILE_MANAGEFAV + END + MENUITEM "Recent (&History)...\tAlt+H", IDM_FILE_RECENT + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "&Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", IDM_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Copy &All\tAlt+C", IDM_EDIT_COPYALL + MENUITEM "Cop&y Add\tCtrl+E", IDM_EDIT_COPYADD + MENUITEM "&Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "S&wap\tCtrl+K", IDM_EDIT_SWAP + MENUITEM "&Delete\tDel", IDM_EDIT_CLEAR + MENUITEM "Cl&ear Clipboard", IDM_EDIT_CLEARCLIPBOARD + MENUITEM "&Select All\tCtrl+A", IDM_EDIT_SELECTALL + MENUITEM SEPARATOR + POPUP "W&ords" + BEGIN + MENUITEM "&Complete Word\tCtrl+Alt+Enter", IDM_EDIT_COMPLETEWORD + MENUITEM SEPARATOR + MENUITEM "Cursor Word &Left\tCtrl+Left", CMD_CTRLLEFT + MENUITEM "Cursor Word &Right\tCtrl+Right", CMD_CTRLRIGHT + MENUITEM "&Delete Word Left\tCtrl+Back", CMD_CTRLBACK + MENUITEM "Delete &Word Right\tCtrl+Del", CMD_CTRLDEL + END + POPUP "&Lines" + BEGIN + MENUITEM "Move &Up\tCtrl+Shift+Up", IDM_EDIT_MOVELINEUP + MENUITEM "&Move Down\tCtrl+Shift+Down", IDM_EDIT_MOVELINEDOWN + MENUITEM SEPARATOR + MENUITEM "Cut &Line\tCtrl[+Shift]+X", IDM_EDIT_CUTLINE + MENUITEM "&Copy Line\tCtrl[+Shift]+C", IDM_EDIT_COPYLINE + MENUITEM "&Duplicate Line\tCtrl+D", IDM_EDIT_DUPLICATELINE + MENUITEM "D&elete Line\tCtrl+Shift+D", IDM_EDIT_DELETELINE + MENUITEM SEPARATOR + MENUITEM "Delete Line Left\tCtrl+Shift+Back", IDM_EDIT_DELETELINELEFT + MENUITEM "Delete Line Right\tCtrl+Shift+Del", IDM_EDIT_DELETELINERIGHT + MENUITEM SEPARATOR + MENUITEM "Column &Wrap...\tCtrl+Shift+W", IDM_EDIT_COLUMNWRAP + MENUITEM "&Split Lines\tCtrl+I", IDM_EDIT_SPLITLINES + MENUITEM "&Join Lines\tCtrl+J", IDM_EDIT_JOINLINES + MENUITEM "&Fuse Lines\tCtrl+Alt+J", IDM_EDIT_JOINLN_NOSP + MENUITEM "&Preserve Paragraphs\tCtrl+Shift+J", IDM_EDIT_JOINLINES_PARA + MENUITEM SEPARATOR + MENUITEM "Mer&ge Empty Lines\tAlt+Y", IDM_EDIT_MERGEEMPTYLINES + MENUITEM "Merge Whitespace Lines\tCtrl+Alt+Y", IDM_EDIT_MERGEBLANKLINES + MENUITEM "&Remove Empty Lines\tAlt+R", IDM_EDIT_REMOVEEMPTYLINES + MENUITEM "Remove Whitespace Lines\tCtrl+Alt+B", IDM_EDIT_REMOVEBLANKLINES + MENUITEM "Rem&ove Duplicate Lines\tCtrl+Alt+D", IDM_EDIT_REMOVEDUPLICATELINES + END + POPUP "&Block" + BEGIN + MENUITEM "&Indent", IDM_EDIT_INDENT + MENUITEM "&Unindent", IDM_EDIT_UNINDENT + MENUITEM SEPARATOR + POPUP "&Enclose Selection" + BEGIN + MENUITEM "&Single Quotes\tCtrl+1", CMD_STRINGIFY + MENUITEM "&Double Quotes\tCtrl+2", CMD_STRINGIFY2 + MENUITEM SEPARATOR + MENUITEM "( )\tCtrl+3", CMD_EMBRACE + MENUITEM "[ ]\tCtrl+4", CMD_EMBRACE2 + MENUITEM "{ }\tCtrl+5", CMD_EMBRACE3 + MENUITEM SEPARATOR + MENUITEM "&Backticks\tCtrl+6", CMD_EMBRACE4 + MENUITEM SEPARATOR + MENUITEM "&With...\tAlt+Q", IDM_EDIT_ENCLOSESELECTION + END + MENUITEM "&Duplicate Selection\tAlt+D", IDM_EDIT_SELECTIONDUPLICATE + MENUITEM SEPARATOR + MENUITEM "&Pad With Spaces\tAlt+B", IDM_EDIT_PADWITHSPACES + MENUITEM "Strip &First Character\tAlt+Z", IDM_EDIT_STRIP1STCHAR + MENUITEM "Strip &Last Character\tAlt+U", IDM_EDIT_STRIPLASTCHAR + MENUITEM "Strip &Trailing Whitespaces\tAlt+W", IDM_EDIT_TRIMLINES + MENUITEM "Compress &Whitespace\tAlt+P", IDM_EDIT_COMPRESSWS + MENUITEM SEPARATOR + MENUITEM "&Modify Lines...\tAlt+M", IDM_EDIT_MODIFYLINES + MENUITEM "&Align Lines...\tAlt+J", IDM_EDIT_ALIGN + MENUITEM "&Sort Lines...\tAlt+O", IDM_EDIT_SORTLINES + END + POPUP "Co&nvert" + BEGIN + MENUITEM "&Uppercase\tCtrl+Shift+U", IDM_EDIT_CONVERTUPPERCASE + MENUITEM "&Lowercase\tCtrl+U", IDM_EDIT_CONVERTLOWERCASE + MENUITEM SEPARATOR + MENUITEM "&Invert Case\tCtrl+Alt+U", IDM_EDIT_INVERTCASE + MENUITEM "Title &Case\tCtrl+Alt+I", IDM_EDIT_TITLECASE + MENUITEM "&Sentence Case\tCtrl+Alt+O", IDM_EDIT_SENTENCECASE + MENUITEM SEPARATOR + MENUITEM "&Tabify Selection\tCtrl+Shift+T", IDM_EDIT_CONVERTSPACES + MENUITEM "U&ntabify Selection\tCtrl+Shift+S", IDM_EDIT_CONVERTTABS + MENUITEM SEPARATOR + MENUITEM "Ta&bify Indent\tCtrl+Alt+T", IDM_EDIT_CONVERTSPACES2 + MENUITEM "Untabi&fy Indent\tCtrl+Alt+S", IDM_EDIT_CONVERTTABS2 + END + POPUP "&Insert" + BEGIN + MENUITEM "&New Line Above\tCtrl+Enter", CMD_CTRLENTER + MENUITEM SEPARATOR + MENUITEM "&HTML/XML Tag...\tAlt+X", IDM_EDIT_INSERT_TAG + MENUITEM SEPARATOR + MENUITEM "&Encoding Identifier\tCtrl+F8", IDM_EDIT_INSERT_ENCODING + MENUITEM SEPARATOR + MENUITEM "&Time/Date (Short Form)\tCtrl+F5", IDM_EDIT_INSERT_SHORTDATE + MENUITEM "Time/Date (&Long Form)\tCtrl+Shift+F5", IDM_EDIT_INSERT_LONGDATE + MENUITEM "&Update Timestamps\tShift+F5", CMD_TIMESTAMPS + MENUITEM SEPARATOR + MENUITEM "&Filename\tCtrl+F9", IDM_EDIT_INSERT_FILENAME + MENUITEM "&Path and Filename\tCtrl+Shift+F9", IDM_EDIT_INSERT_PATHNAME + MENUITEM SEPARATOR + MENUITEM "&GUID\tCtrl+Shift+.", IDM_EDIT_INSERT_GUID + END + POPUP "&Miscellaneous" + BEGIN + MENUITEM "&Line Comment (Toggle)\tCtrl+Q", IDM_EDIT_LINECOMMENT + MENUITEM "&Stream Comment\tCtrl+Shift+Q", IDM_EDIT_STREAMCOMMENT + MENUITEM SEPARATOR + MENUITEM "&URL Encode\tCtrl+Shift+E", IDM_EDIT_URLENCODE + MENUITEM "URL &Decode\tCtrl+Shift+R", IDM_EDIT_URLDECODE + MENUITEM SEPARATOR + MENUITEM "&Escape C Chars\tCtrl+Alt+E", IDM_EDIT_ESCAPECCHARS + MENUITEM "&Unescape C Chars\tCtrl+Alt+R", IDM_EDIT_UNESCAPECCHARS + MENUITEM SEPARATOR + MENUITEM "&Char To Hex\tCtrl+Alt+X", IDM_EDIT_CHAR2HEX + MENUITEM "&Hex To Char\tCtrl+Alt+C", IDM_EDIT_HEX2CHAR + MENUITEM SEPARATOR + MENUITEM "&Find Matching Brace\tCtrl+B", IDM_EDIT_FINDMATCHINGBRACE + MENUITEM "Select To &Matching Brace\tCtrl+Shift+B", IDM_EDIT_SELTOMATCHINGBRACE + MENUITEM SEPARATOR + MENUITEM "Select To &Next\tCtrl+Alt+F2", IDM_EDIT_SELTONEXT + MENUITEM "Select To &Previous\tCtrl+Alt+Shift+F2", IDM_EDIT_SELTOPREV + END + MENUITEM SEPARATOR + POPUP "Boo&kmarks" + BEGIN + MENUITEM "&Toggle\tCtrl+F2", BME_EDIT_BOOKMARKTOGGLE + MENUITEM SEPARATOR + MENUITEM "Goto &Next\tF2", BME_EDIT_BOOKMARKNEXT + MENUITEM "Goto &Previous\tShift+F2", BME_EDIT_BOOKMARKPREV + MENUITEM SEPARATOR + MENUITEM "&Clear All\tAlt+F2", BME_EDIT_BOOKMARKCLEAR + END + MENUITEM SEPARATOR + MENUITEM "&Find...\tCtrl+F", IDM_EDIT_FIND + MENUITEM "Save Find Text\tAlt+F3", IDM_EDIT_SAVEFIND + MENUITEM "Find Ne&xt\tF3", IDM_EDIT_FINDNEXT + MENUITEM "Find Pre&vious\tShift+F3", IDM_EDIT_FINDPREV + MENUITEM "Find Next Selected\tCtrl+F3", CMD_FINDNEXTSEL + MENUITEM "Find Previous Selected\tCtrl+Shift+F3", CMD_FINDPREVSEL + MENUITEM "&Replace...\tCtrl+H", IDM_EDIT_REPLACE + MENUITEM "Replace Ne&xt\tF4", IDM_EDIT_REPLACENEXT + MENUITEM "&Goto...\tCtrl+G", IDM_EDIT_GOTOLINE + END + POPUP "&View" + BEGIN + MENUITEM "Synta&x Scheme...\tF12", IDM_VIEW_SCHEME + MENUITEM "&2nd Default Scheme\tShift+F12", IDM_VIEW_USE2NDDEFAULT + MENUITEM "&Customize Schemes...\tCtrl+F12", IDM_VIEW_SCHEMECONFIG + MENUITEM "Global &Default Font...\tAlt+F12", IDM_VIEW_FONT + MENUITEM "Current Sc&heme's Default Font...\tCtrl+Alt+F12", IDM_VIEW_CURRENTSCHEME + MENUITEM SEPARATOR + MENUITEM "Word W&rap\tCtrl+W", IDM_VIEW_WORDWRAP + MENUITEM "&Long Line Marker\tCtrl+Shift+L", IDM_VIEW_LONGLINEMARKER + MENUITEM "Indent&ation Guides\tCtrl+Shift+G", IDM_VIEW_SHOWINDENTGUIDES + MENUITEM SEPARATOR + MENUITEM "Show &Whitespace\tCtrl+Shift+8", IDM_VIEW_SHOWWHITESPACE + MENUITEM "Show Line &Endings\tCtrl+Shift+9", IDM_VIEW_SHOWEOLS + MENUITEM "Show Wra&p Symbols\tCtrl+Shift+0", IDM_VIEW_WORDWRAPSYMBOLS + MENUITEM SEPARATOR + MENUITEM "H&yperlink Hotspots\tCtrl+Alt+H", IDM_VIEW_HYPERLINKHOTSPOTS + MENUITEM "&Visual Brace Matching\tCtrl+Shift+V", IDM_VIEW_MATCHBRACES + MENUITEM "Hi&ghlight Current Line\tCtrl+Shift+I", IDM_VIEW_HILITECURRENTLINE + POPUP "Mar&k Occurrences" + BEGIN + MENUITEM "&Active\tAlt+A", IDM_VIEW_MARKOCCUR_ONOFF + MENUITEM SEPARATOR + MENUITEM "Match Visible Only", IDM_VIEW_MARKOCCUR_VISIBLE + MENUITEM SEPARATOR + MENUITEM "Match &Case Sensitive", IDM_VIEW_MARKOCCUR_CASE + POPUP "Match &Whole Word Only" + BEGIN + MENUITEM "OFF", IDM_VIEW_MARKOCCUR_WNONE + MENUITEM "Match &Selected Word", IDM_VIEW_MARKOCCUR_WORD + MENUITEM "Match &Current Word", IDM_VIEW_MARKOCCUR_CURRENT + END + END + MENUITEM SEPARATOR + MENUITEM "Toggle View\tCtrl+Alt+V", IDM_VIEW_TOGGLE_VIEW + MENUITEM SEPARATOR + MENUITEM "Line &Numbers\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS + MENUITEM "Selection &Margin\tCtrl+Shift+M", IDM_VIEW_MARGIN + MENUITEM SEPARATOR + MENUITEM "Code &Folding\tCtrl+Shift+Alt+F", IDM_VIEW_FOLDING + MENUITEM "&Toggle All Folds\tCtrl+Shift+F", IDM_VIEW_TOGGLEFOLDS + MENUITEM SEPARATOR + MENUITEM "Show Tool&bar", IDM_VIEW_TOOLBAR + MENUITEM "C&ustomize Toolbar...", IDM_VIEW_CUSTOMIZETB + MENUITEM "Show &Statusbar", IDM_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "Zoom &In\tCtrl++", IDM_VIEW_ZOOMIN + MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT + MENUITEM "Reset &Zoom\tCtrl+0", IDM_VIEW_RESETZOOM + MENUITEM SEPARATOR + MENUITEM "Copy Position Args\tCtrl+Shift+K", CMD_COPYWINPOS + MENUITEM "Snap to Default Position\tCtrl+Shift+P", CMD_DEFAULTWINPOS + MENUITEM "Scroll Past End of &File", IDM_VIEW_SCROLLPASTEOF + END + POPUP "&Settings" + BEGIN + MENUITEM "Insert Tabs as &Spaces", IDM_VIEW_TABSASSPACES + MENUITEM "&Tab Settings...\tCtrl+T", IDM_VIEW_TABSETTINGS + MENUITEM "&Word Wrap Settings...", IDM_VIEW_WORDWRAPSETTINGS + MENUITEM "&Long Line Settings...", IDM_VIEW_LONGLINESETTINGS + MENUITEM "Auto In&dent Text", IDM_VIEW_AUTOINDENTTEXT + MENUITEM "Auto Close &HTML/XML\tCtrl+Shift+H", IDM_VIEW_AUTOCLOSETAGS + MENUITEM "A&uto Complete Words", IDM_VIEW_AUTOCOMPLETEWORDS + MENUITEM "Accelerated Word Navi&gation", IDM_VIEW_ACCELWORDNAV + MENUITEM SEPARATOR + MENUITEM "&Reuse Window", IDM_VIEW_REUSEWINDOW + MENUITEM "Sticky Window &Position", IDM_VIEW_STICKYWINPOS + MENUITEM "&Always On Top\tAlt+T", IDM_VIEW_ALWAYSONTOP + MENUITEM "Minimi&ze To Tray", IDM_VIEW_MINTOTRAY + MENUITEM "Transparent &Mode\tAlt+G", IDM_VIEW_TRANSPARENT + MENUITEM SEPARATOR + MENUITEM "Single &File Instance", IDM_VIEW_SINGLEFILEINSTANCE + MENUITEM "File &Change Notification...\tAlt+F5", IDM_VIEW_CHANGENOTIFY + POPUP "Window Title Displa&y" + BEGIN + MENUITEM "Filename &Only", IDM_VIEW_SHOWFILENAMEONLY + MENUITEM "Filename and &Directory", IDM_VIEW_SHOWFILENAMEFIRST + MENUITEM "Full &Pathname", IDM_VIEW_SHOWFULLPATH + MENUITEM "&Text Excerpt\tCtrl+9", IDM_VIEW_SHOWEXCERPT + END + POPUP "Esc &Key Function" + BEGIN + MENUITEM "&None", IDM_VIEW_NOESCFUNC + MENUITEM "&Minimize Notepad3", IDM_VIEW_ESCMINIMIZE + MENUITEM "E&xit Notepad3", IDM_VIEW_ESCEXIT + END + MENUITEM "Save &Before Running Tools", IDM_VIEW_SAVEBEFORERUNNINGTOOLS + MENUITEM "Remember Recent F&iles", IDM_VIEW_NOSAVERECENT + MENUITEM "Preser&ve Caret Position", IDM_VIEW_NOPRESERVECARET + MENUITEM "Remember S&earch Pattern", IDM_VIEW_NOSAVEFINDREPL + MENUITEM SEPARATOR + MENUITEM "Save Settings On E&xit", IDM_VIEW_SAVESETTINGS + MENUITEM "Save Settings &Now\tF7", IDM_VIEW_SAVESETTINGSNOW + MENUITEM "&Open Settings File\tCtrl+F7", CMD_OPENINIFILE + END + POPUP "&?" + BEGIN + MENUITEM "&Online Documentation\tF1", IDM_HELP_ONLINEDOCUMENTATION + MENUITEM SEPARATOR + MENUITEM "Launch &Update Installer...", IDM_HELP_UPDATEINSTALLER + MENUITEM "Check &Website for Update", IDM_HELP_UPDATEWEBSITE + MENUITEM SEPARATOR + MENUITEM "&Command Line Help...", IDM_HELP_CMD + MENUITEM "&About...\tShift+F1", IDM_HELP_ABOUT + END +END + +IDR_POPUPMENU MENU +BEGIN + POPUP "+" + BEGIN + MENUITEM "&Undo", IDM_EDIT_UNDO + MENUITEM "&Redo", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cu&t", IDM_EDIT_CUT + MENUITEM "&Copy", IDM_EDIT_COPY + MENUITEM "&Paste", IDM_EDIT_PASTE + MENUITEM "&Delete", IDM_EDIT_CLEAR + MENUITEM SEPARATOR + MENUITEM "&Select All", IDM_EDIT_SELECTALL + MENUITEM SEPARATOR + MENUITEM "Open &Hyperlink", CMD_OPEN_HYPERLINK + END + POPUP "+" + BEGIN + MENUITEM "Show &Toolbar", IDM_VIEW_TOOLBAR + MENUITEM "&Customize Toolbar...", IDM_VIEW_CUSTOMIZETB + MENUITEM "Show &Statusbar", IDM_VIEW_STATUSBAR + END + POPUP "+" + BEGIN + MENUITEM "Open Notepad3", IDM_TRAY_RESTORE + MENUITEM "Exit Notepad3", IDM_TRAY_EXIT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINWND ACCELERATORS +BEGIN + "0", IDM_VIEW_RESETZOOM, VIRTKEY, CONTROL, NOINVERT + "0", IDM_VIEW_WORDWRAPSYMBOLS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "1", CMD_STRINGIFY, VIRTKEY, CONTROL, NOINVERT + "1", CMD_WEBACTION1, VIRTKEY, SHIFT, CONTROL, NOINVERT + "2", CMD_STRINGIFY2, VIRTKEY, CONTROL, NOINVERT + "2", CMD_WEBACTION2, VIRTKEY, SHIFT, CONTROL, NOINVERT + "3", CMD_EMBRACE, VIRTKEY, CONTROL, NOINVERT + "4", CMD_EMBRACE2, VIRTKEY, CONTROL, NOINVERT + "5", CMD_EMBRACE3, VIRTKEY, CONTROL, NOINVERT + "6", CMD_EMBRACE4, VIRTKEY, CONTROL, NOINVERT + "8", IDM_VIEW_SHOWWHITESPACE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "9", CMD_TOGGLETITLE, VIRTKEY, CONTROL, NOINVERT + "9", IDM_VIEW_SHOWEOLS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "A", IDM_EDIT_SELECTALL, VIRTKEY, CONTROL, NOINVERT + "A", IDM_VIEW_MARKOCCUR_ONOFF, VIRTKEY, ALT, NOINVERT + "A", CMD_RECODEANSI, VIRTKEY, SHIFT, CONTROL, NOINVERT + "B", IDM_EDIT_FINDMATCHINGBRACE, VIRTKEY, CONTROL, NOINVERT + "B", IDM_EDIT_PADWITHSPACES, VIRTKEY, ALT, NOINVERT + "B", IDM_EDIT_SELTOMATCHINGBRACE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "B", IDM_EDIT_REMOVEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPYALL, VIRTKEY, ALT, NOINVERT + "C", IDM_EDIT_HEX2CHAR, VIRTKEY, CONTROL, ALT, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, SHIFT, CONTROL, NOINVERT + "D", IDM_EDIT_DUPLICATELINE, VIRTKEY, CONTROL, NOINVERT + "D", IDM_EDIT_SELECTIONDUPLICATE, VIRTKEY, ALT, NOINVERT + "D", IDM_EDIT_DELETELINE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "D", IDM_EDIT_REMOVEDUPLICATELINES, VIRTKEY, CONTROL, ALT, NOINVERT + "E", IDM_EDIT_COPYADD, VIRTKEY, CONTROL, NOINVERT + "E", IDM_EDIT_ESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT + "E", IDM_EDIT_URLENCODE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "F", IDM_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT + "F", CMD_RECODEDEFAULT, VIRTKEY, CONTROL, ALT, NOINVERT + "F", IDM_VIEW_FOLDING, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT + "F", IDM_VIEW_TOGGLEFOLDS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "G", IDM_EDIT_GOTOLINE, VIRTKEY, CONTROL, NOINVERT + "G", IDM_VIEW_SHOWINDENTGUIDES, VIRTKEY, SHIFT, CONTROL, NOINVERT + "G", IDM_VIEW_TRANSPARENT, VIRTKEY, ALT, NOINVERT + "H", IDM_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT + "H", IDM_FILE_RECENT, VIRTKEY, ALT, NOINVERT + "H", IDM_VIEW_AUTOCLOSETAGS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "H", IDM_VIEW_HYPERLINKHOTSPOTS, VIRTKEY, CONTROL, ALT, NOINVERT + "I", IDM_EDIT_SPLITLINES, VIRTKEY, CONTROL, NOINVERT + "I", IDM_FILE_OPENFAV, VIRTKEY, ALT, NOINVERT + "I", IDM_EDIT_TITLECASE, VIRTKEY, CONTROL, ALT, NOINVERT + "I", IDM_VIEW_HILITECURRENTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "J", IDM_EDIT_JOINLINES, VIRTKEY, CONTROL, NOINVERT + "J", IDM_EDIT_JOINLN_NOSP, VIRTKEY, CONTROL, ALT, NOINVERT + "J", IDM_EDIT_JOINLINES_PARA, VIRTKEY, SHIFT, CONTROL, NOINVERT + "J", IDM_EDIT_ALIGN, VIRTKEY, ALT, NOINVERT + "K", IDM_EDIT_SWAP, VIRTKEY, CONTROL, NOINVERT + "K", IDM_FILE_ADDTOFAV, VIRTKEY, ALT, NOINVERT + "K", CMD_COPYWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "L", IDM_FILE_LAUNCH, VIRTKEY, CONTROL, NOINVERT + "L", IDM_FILE_OPENWITH, VIRTKEY, ALT, NOINVERT + "L", IDM_VIEW_LONGLINEMARKER, VIRTKEY, SHIFT, CONTROL, NOINVERT + "M", IDM_FILE_BROWSE, VIRTKEY, CONTROL, NOINVERT + "M", IDM_EDIT_MODIFYLINES, VIRTKEY, ALT, NOINVERT + "M", IDM_VIEW_MARGIN, VIRTKEY, SHIFT, CONTROL, NOINVERT + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "N", IDM_FILE_NEWWINDOW, VIRTKEY, ALT, NOINVERT + "N", IDM_FILE_NEWWINDOW2, VIRTKEY, SHIFT, ALT, NOINVERT + "N", IDM_VIEW_LINENUMBERS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "O", IDM_EDIT_SORTLINES, VIRTKEY, ALT, NOINVERT + "O", IDM_EDIT_SENTENCECASE, VIRTKEY, CONTROL, ALT, NOINVERT + "O", CMD_RECODEOEM, VIRTKEY, SHIFT, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "P", IDM_EDIT_COMPRESSWS, VIRTKEY, ALT, NOINVERT + "P", CMD_DEFAULTWINPOS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "Q", IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_EDIT_ENCLOSESELECTION, VIRTKEY, ALT, NOINVERT + "Q", IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT + "R", IDM_FILE_RUN, VIRTKEY, CONTROL, NOINVERT + "R", IDM_EDIT_REMOVEEMPTYLINES, VIRTKEY, ALT, NOINVERT + "R", IDM_EDIT_UNESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT + "R", IDM_EDIT_URLDECODE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "S", IDM_EDIT_CONVERTTABS2, VIRTKEY, CONTROL, ALT, NOINVERT + "S", IDM_EDIT_CONVERTTABS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "T", IDM_VIEW_TABSETTINGS, VIRTKEY, CONTROL, NOINVERT + "T", IDM_VIEW_ALWAYSONTOP, VIRTKEY, ALT, NOINVERT + "T", IDM_EDIT_CONVERTSPACES2, VIRTKEY, CONTROL, ALT, NOINVERT + "T", IDM_EDIT_CONVERTSPACES, VIRTKEY, SHIFT, CONTROL, NOINVERT + "U", IDM_EDIT_CONVERTLOWERCASE, VIRTKEY, CONTROL, NOINVERT + "U", IDM_EDIT_STRIPLASTCHAR, VIRTKEY, ALT, NOINVERT + "U", IDM_EDIT_INVERTCASE, VIRTKEY, CONTROL, ALT, NOINVERT + "U", IDM_EDIT_CONVERTUPPERCASE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "V", IDM_VIEW_MATCHBRACES, VIRTKEY, SHIFT, CONTROL, NOINVERT + "V", IDM_VIEW_TOGGLE_VIEW, VIRTKEY, CONTROL, ALT, NOINVERT + "W", IDM_VIEW_WORDWRAP, VIRTKEY, CONTROL, NOINVERT + "W", IDM_EDIT_TRIMLINES, VIRTKEY, ALT, NOINVERT + "W", IDM_EDIT_COLUMNWRAP, VIRTKEY, SHIFT, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_INSERT_TAG, VIRTKEY, ALT, NOINVERT + "X", IDM_EDIT_CHAR2HEX, VIRTKEY, CONTROL, ALT, NOINVERT + "X", IDM_EDIT_CUTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_MERGEEMPTYLINES, VIRTKEY, ALT, NOINVERT + "Y", IDM_EDIT_UNDO, VIRTKEY, SHIFT, CONTROL, NOINVERT + "Y", IDM_EDIT_MERGEBLANKLINES, VIRTKEY, CONTROL, ALT, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_STRIP1STCHAR, VIRTKEY, ALT, NOINVERT + "Z", IDM_EDIT_REDO, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_LEFT, CMD_CTRLLEFT, VIRTKEY, CONTROL, NOINVERT + VK_LEFT, CMD_ALTLEFT, VIRTKEY, ALT, NOINVERT + VK_RIGHT, CMD_CTRLRIGHT, VIRTKEY, CONTROL, NOINVERT + VK_RIGHT, CMD_ALTRIGHT, VIRTKEY, ALT, NOINVERT + VK_ADD, IDM_VIEW_ZOOMIN, VIRTKEY, CONTROL, NOINVERT + VK_ADD, CMD_INCLINELIMIT, VIRTKEY, ALT, NOINVERT + VK_ADD, CMD_INCREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT + VK_BACK, CMD_DELETEBACK, VIRTKEY, NOINVERT + VK_BACK, CMD_CTRLBACK, VIRTKEY, CONTROL, NOINVERT + VK_BACK, IDM_EDIT_UNDO, VIRTKEY, ALT, NOINVERT + VK_BACK, IDM_EDIT_DELETELINELEFT, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_DELETE, CMD_DEL, VIRTKEY, NOINVERT + VK_DELETE, CMD_CTRLDEL, VIRTKEY, CONTROL, NOINVERT + VK_DELETE, IDM_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_DELETE, IDM_EDIT_DELETELINERIGHT, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_DOWN, CMD_ALTDOWN, VIRTKEY, ALT, NOINVERT + VK_DOWN, IDM_EDIT_MOVELINEDOWN, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_ESCAPE, CMD_ESCAPE, VIRTKEY, NOINVERT + VK_ESCAPE, CMD_SHIFTESC, VIRTKEY, SHIFT, NOINVERT + VK_F1, IDM_HELP_ONLINEDOCUMENTATION, VIRTKEY, NOINVERT + VK_F1, IDM_HELP_ABOUT, VIRTKEY, SHIFT, NOINVERT + VK_F11, CMD_LEXDEFAULT, VIRTKEY, NOINVERT + VK_F11, CMD_LEXHTML, VIRTKEY, CONTROL, NOINVERT + VK_F11, CMD_LEXXML, VIRTKEY, SHIFT, NOINVERT + VK_F12, IDM_VIEW_SCHEME, VIRTKEY, NOINVERT + VK_F12, IDM_VIEW_SCHEMECONFIG, VIRTKEY, CONTROL, NOINVERT + VK_F12, IDM_VIEW_FONT, VIRTKEY, ALT, NOINVERT + VK_F12, IDM_VIEW_USE2NDDEFAULT, VIRTKEY, SHIFT, NOINVERT + VK_F12, IDM_VIEW_CURRENTSCHEME, VIRTKEY, CONTROL, ALT + VK_F2, IDM_EDIT_SELTONEXT, VIRTKEY, CONTROL, ALT, NOINVERT + VK_F2, IDM_EDIT_SELTOPREV, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT + VK_F2, BME_EDIT_BOOKMARKNEXT, VIRTKEY, NOINVERT + VK_F2, BME_EDIT_BOOKMARKTOGGLE, VIRTKEY, CONTROL, NOINVERT + VK_F2, BME_EDIT_BOOKMARKCLEAR, VIRTKEY, ALT, NOINVERT + VK_F2, BME_EDIT_BOOKMARKPREV, VIRTKEY, SHIFT, NOINVERT + VK_F3, IDM_EDIT_FINDNEXT, VIRTKEY, NOINVERT + VK_F3, CMD_FINDNEXTSEL, VIRTKEY, CONTROL, NOINVERT + VK_F3, IDM_EDIT_SAVEFIND, VIRTKEY, ALT, NOINVERT + VK_F3, IDM_EDIT_FINDPREV, VIRTKEY, SHIFT, NOINVERT + VK_F3, CMD_FINDPREVSEL, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_F4, IDM_EDIT_REPLACENEXT, VIRTKEY, NOINVERT + VK_F4, IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + VK_F4, IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + VK_F5, IDM_FILE_REVERT, VIRTKEY, NOINVERT + VK_F5, IDM_EDIT_INSERT_SHORTDATE, VIRTKEY, CONTROL, NOINVERT + VK_F5, IDM_VIEW_CHANGENOTIFY, VIRTKEY, ALT, NOINVERT + VK_F5, CMD_TIMESTAMPS, VIRTKEY, SHIFT, NOINVERT + VK_F5, IDM_EDIT_INSERT_LONGDATE, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_F6, IDM_FILE_SAVEAS, VIRTKEY, NOINVERT + VK_F6, IDM_FILE_SAVECOPY, VIRTKEY, CONTROL, NOINVERT + VK_F7, IDM_VIEW_SAVESETTINGSNOW, VIRTKEY, NOINVERT + VK_F7, CMD_OPENINIFILE, VIRTKEY, CONTROL, NOINVERT + VK_F8, IDM_ENCODING_RECODE, VIRTKEY, NOINVERT + VK_F8, IDM_EDIT_INSERT_ENCODING, VIRTKEY, CONTROL, NOINVERT + VK_F8, CMD_RELOADNOFILEVARS, VIRTKEY, ALT, NOINVERT + VK_F8, IDM_ENCODING_UTF8, VIRTKEY, SHIFT, NOINVERT + VK_F8, CMD_RELOADASCIIASUTF8, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_F9, IDM_ENCODING_SELECT, VIRTKEY, NOINVERT + VK_F9, IDM_EDIT_INSERT_FILENAME, VIRTKEY, CONTROL, NOINVERT + VK_F9, IDM_FILE_MANAGEFAV, VIRTKEY, ALT, NOINVERT + VK_F9, CMD_COPYPATHNAME, VIRTKEY, SHIFT, NOINVERT + VK_F9, IDM_EDIT_INSERT_PATHNAME, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_OEM_2, IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT + VK_OEM_2, IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_DIVIDE, IDM_EDIT_LINECOMMENT, VIRTKEY, CONTROL, NOINVERT + VK_DIVIDE, IDM_EDIT_STREAMCOMMENT, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_NUMPAD0, IDM_VIEW_RESETZOOM, VIRTKEY, CONTROL, NOINVERT + VK_OEM_COMMA, CMD_JUMP2SELSTART, VIRTKEY, CONTROL, NOINVERT + VK_OEM_MINUS, IDM_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT + VK_OEM_MINUS, CMD_DECREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT + VK_OEM_PERIOD, CMD_JUMP2SELEND, VIRTKEY, CONTROL, NOINVERT + VK_OEM_PERIOD, IDM_EDIT_INSERT_GUID, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_OEM_PLUS, IDM_VIEW_ZOOMIN, VIRTKEY, CONTROL, NOINVERT + VK_OEM_PLUS, CMD_INCREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT + VK_RETURN, CMD_CTRLENTER, VIRTKEY, CONTROL, NOINVERT + VK_RETURN, CMD_SHIFTCTRLENTER, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_RETURN, IDM_EDIT_COMPLETEWORD, VIRTKEY, CONTROL, ALT, NOINVERT + VK_SPACE, IDM_EDIT_SELECTWORD, VIRTKEY, CONTROL, NOINVERT + VK_SPACE, IDM_EDIT_SELECTLINE, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_SUBTRACT, IDM_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT + VK_SUBTRACT, CMD_DECLINELIMIT, VIRTKEY, ALT, NOINVERT + VK_SUBTRACT, CMD_DECREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT + VK_TAB, CMD_TAB, VIRTKEY, NOINVERT + VK_TAB, CMD_BACKTAB, VIRTKEY, SHIFT, NOINVERT + VK_TAB, CMD_CTRLTAB, VIRTKEY, CONTROL, NOINVERT + VK_UP, CMD_ALTUP, VIRTKEY, ALT, NOINVERT + VK_UP, IDM_EDIT_MOVELINEUP, VIRTKEY, SHIFT, CONTROL, NOINVERT +END + +IDR_ACCFINDREPLACE ACCELERATORS +BEGIN + "F", IDACC_FIND, VIRTKEY, CONTROL, NOINVERT + "H", IDACC_REPLACE, VIRTKEY, CONTROL, NOINVERT + "S", IDACC_SAVEPOS, VIRTKEY, CONTROL, NOINVERT + "R", IDACC_RESETPOS, VIRTKEY, CONTROL, NOINVERT + VK_F2, IDACC_SELTONEXT, VIRTKEY, CONTROL, ALT, NOINVERT + VK_F2, IDACC_SELTOPREV, VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT + VK_F3, IDACC_FINDNEXT, VIRTKEY, NOINVERT + VK_F3, IDACC_SAVEFIND, VIRTKEY, ALT, NOINVERT + VK_F3, IDACC_FINDPREV, VIRTKEY, SHIFT, NOINVERT + VK_F4, IDACC_REPLACENEXT, VIRTKEY, NOINVERT +END + +IDR_ACCCUSTOMSCHEMES ACCELERATORS +BEGIN + "S", IDACC_SAVEPOS, VIRTKEY, CONTROL, NOINVERT + "R", IDACC_RESETPOS, VIRTKEY, CONTROL, NOINVERT + "S", IDACC_PREVIEW, VIRTKEY, CONTROL, NOINVERT + VK_F12, IDACC_VIEWSCHEMECONFIG, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUT DIALOGEX 0, 0, 400, 274 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About Notepad3" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,330,256,50,14 + ICON IDR_MAINWND128,IDC_STATIC,4,5,20,20,SS_REALSIZEIMAGE,WS_EX_TRANSPARENT + EDITTEXT IDC_VERSION,77,7,220,14,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP + LTEXT "Scintilla Library Version:",IDC_SCI_VERSION,80,24,219,8 + LTEXT "Build with:",IDC_COMPILER,80,35,218,8 + LTEXT "IDC_COPYRIGHT",IDC_COPYRIGHT,80,55,218,8 + LTEXT "",IDC_WEBPAGE2,190,55,100,8,NOT WS_VISIBLE | WS_DISABLED + CONTROL "",IDC_WEBPAGE,"SysLink",WS_TABSTOP,220,55,100,10 + CONTROL IDR_RIZBITMAP,IDC_RIZONEBMP,"Static",SS_BITMAP | SS_NOTIFY | SS_REALSIZEIMAGE,305,7,130,20,WS_EX_TRANSPARENT + PUSHBUTTON "Copy Version Text",IDC_COPYVERSTRG,304,35,76,14,BS_FLAT + CONTROL "",IDC_RICHEDITABOUT,"RichEdit20W",ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_NOHIDESEL | ES_READONLY | ES_NUMBER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,20,80,360,168 +END + +IDD_FIND DIALOGEX 0, 0, 273, 130 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Find Text" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Search Strin&g:",IDC_STATIC,7,7,46,8 + COMBOBOX IDC_FINDTEXT,7,17,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + CONTROL "Match &case",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,53,10 + CONTROL "Match &whole word only",IDC_FINDWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,49,89,10 + CONTROL "Match &beginning of word only",IDC_FINDSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,61,110,10 + CONTROL "&Transform backslashes",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,73,85,10 + CONTROL "Regular &expression search",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,96,10 + CONTROL "Dot &matches all",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,96,65,10 + CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,37,75,10 + CONTROL "C&lose after find",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,49,65,10 + CONTROL "Mark &Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,61,73,10 + CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,85,63,10 + DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 + PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14 + PUSHBUTTON "Close",IDCANCEL,212,99,54,14 + CONTROL "Goto Replace (Ctrl+H)",IDC_TOGGLEFINDREPLACE, + "SysLink",0x0,125,103,74,10 + CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,106,85,14,10 + CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,106,73,14,10 + CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,85,14,10 + CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,117,259,9,WS_EX_STATICEDGE + PUSHBUTTON "Toggle &View",IDC_TOGGLE_VISIBILITY,211,65,55,14 +END + +IDD_REPLACE DIALOGEX 0, 0, 273, 156 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_NOFAILCREATE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Replace Text" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Search Strin&g:",IDC_STATIC,7,7,46,8 + COMBOBOX IDC_FINDTEXT,7,17,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + LTEXT "Replace wit&h:",IDC_STATIC,7,36,44,8 + COMBOBOX IDC_REPLACETEXT,7,47,192,116,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + CONTROL "Match &case",IDC_FINDCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,66,53,10 + CONTROL "Match &whole word only",IDC_FINDWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,78,89,10 + CONTROL "Match &beginning of word only",IDC_FINDSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,110,10 + CONTROL "&Transform backslashes",IDC_FINDTRANSFORMBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,102,89,10 + CONTROL "Regular &expression search",IDC_FINDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,114,97,10 + CONTROL "Dot &matches all",IDC_DOT_MATCH_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,125,65,10 + CONTROL "&Don't wrap around",IDC_NOWRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,66,75,10 + CONTROL "C&lose after replace",IDC_FINDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,78,77,10 + CONTROL "Mark &Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10 + CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,63,10 + DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14 + PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,23,55,14 + PUSHBUTTON "&Replace",IDC_REPLACE,211,43,55,14 + PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,59,55,14 + PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,75,55,14 + PUSHBUTTON "Swap Strings",IDC_SWAPSTRG,150,32,49,12 + PUSHBUTTON "Close",IDCANCEL,211,126,55,14 + CONTROL "Goto Find (Ctrl+F)",IDC_TOGGLEFINDREPLACE, + "SysLink",0x0,125,130,74,10 + CONTROL "(?)",IDC_BACKSLASHHELP,"SysLink",0x0,107,102,14,10 + CONTROL "(?)",IDC_REGEXPHELP,"SysLink",0x0,107,114,14,10 + CONTROL "(?)",IDC_WILDCARDHELP,"SysLink",0x0,191,114,14,10 + CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,144,259,9,WS_EX_STATICEDGE + PUSHBUTTON "Toggle &View",IDC_TOGGLE_VISIBILITY,211,94,55,14 +END + +IDD_RUN DIALOGEX 0, 0, 229, 96 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Run" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_RUN,IDC_STATIC,10,7,21,20 + LTEXT "Type the name of a program, folder, document, or internet resource, and Windows will open it for you.",IDC_STATIC,39,7,179,17 + EDITTEXT IDC_COMMANDLINE,10,35,208,13,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_SEARCHEXE,163,69,55,16 + DEFPUSHBUTTON "OK",IDOK,47,69,55,16 + PUSHBUTTON "Cancel",IDCANCEL,105,69,55,16 +END + +IDD_OPENWITH DIALOGEX 0, 0, 165, 129 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Open with..." +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_OPENWITHDIR,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,69 + PUSHBUTTON "",IDC_GETOPENWITHDIR,7,83,13,13 + LTEXT "Click here to specify the directory with links to your favorite applications.",IDC_OPENWITHDESCR,26,83,132,18 + DEFPUSHBUTTON "OK",IDOK,52,108,50,14 + PUSHBUTTON "Cancel",IDCANCEL,108,108,50,14 + SCROLLBAR IDC_RESIZEGRIP3,7,112,10,10 +END + +IDD_DEFENCODING DIALOGEX 0, 0, 197, 159 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Encoding" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Default Encoding (new file):",IDC_STATIC,7,7,183,48,0,WS_EX_TRANSPARENT + CONTROL "",IDC_ENCODINGLIST,"ComboBoxEx32",CBS_DROPDOWNLIST | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,14,19,167,128 + CONTROL "Use as &fallback on detection failure.",IDC_USEASREADINGFALLBACK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,38,155,10 + GROUPBOX "Encoding Detection: ",IDC_STATIC,7,58,183,77,0,WS_EX_TRANSPARENT + CONTROL "Skip &ANSI Code Page detection.",IDC_NOANSICPDETECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,122,10 + CONTROL "Skip &UNICODE detection.",IDC_NOUNICODEDETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,83,122,10 + CONTROL "Open 7-bit &ASCII files in UTF-8 mode.",IDC_ASCIIASUTF8, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,96,136,10 + CONTROL "Open 8-bit *.&nfo/diz files in DOS-437 mode.",IDC_NFOASOEM, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,109,155,10 + CONTROL "Don't parse encoding file &tags.",IDC_ENCODINGFROMFILEVARS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,126,10 + DEFPUSHBUTTON "OK",IDOK,87,138,50,14 + PUSHBUTTON "Cancel",IDCANCEL,140,138,50,14 +END + +IDD_DEFEOLMODE DIALOGEX 0, 0, 180, 78 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Line Endings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "&Default line ending mode:",IDC_STATIC,7,7,82,8 + COMBOBOX 100,7,20,98,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "&Ensure consistent line endings when saving.",IDC_CONSISTENTEOLS, + "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,7,48,157,10 + CONTROL "&Strip trailing blanks when saving.",IDC_AUTOSTRIPBLANKS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,60,121,10 + DEFPUSHBUTTON "OK",IDOK,123,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,123,24,50,14 +END + +IDD_LINENUM DIALOGEX 0, 0, 186, 47 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Goto" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Line:",IDC_STATIC,7,7,16,8 + EDITTEXT IDC_LINENUM,7,24,46,14,ES_AUTOHSCROLL + LTEXT "&Column:",IDC_STATIC,63,7,27,8 + EDITTEXT IDC_COLNUM,63,24,46,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,129,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 +END + +IDD_FILEMRU DIALOGEX 0, 0, 269, 160 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Open Recent File" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_FILEMRU,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,255,97 + CONTROL "&Preserve caret position.",IDC_PRESERVECARET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,96,10 + CONTROL "&Save recent file list on exit.",IDC_SAVEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,107,96,10 + PUSHBUTTON "Discard",IDC_REMOVE,212,107,50,14,WS_DISABLED + DEFPUSHBUTTON "OK",IDOK,154,139,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,212,139,50,14 + SCROLLBAR IDC_RESIZEGRIP,7,143,10,10 + CONTROL "&Remember search pattern.",IDC_REMEMBERSEARCHPATTERN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,130,96,10 +END + +IDD_CHANGENOTIFY DIALOGEX 0, 0, 184, 65 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "File Change Notification" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + CONTROL "&None.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,35,10 + CONTROL "&Display message.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,71,10 + CONTROL "&Auto-reload (unmodified).",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,31,99,10 + CONTROL "&Reset if a new file is opened.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,48,109,10 + DEFPUSHBUTTON "OK",IDOK,127,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 +END + +IDD_STYLESELECT DIALOGEX 0, 0, 165, 134 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Scheme" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_STYLELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,70 + CONTROL "Set selected scheme as &default.",IDC_DEFAULTSCHEME, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,118,10 + CONTROL "&Auto-select by filename extension.",IDC_AUTOSELECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,95,127,10 + DEFPUSHBUTTON "OK",IDOK,53,113,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,108,113,50,14 + SCROLLBAR IDC_RESIZEGRIP3,7,117,10,10 +END + +IDD_STYLECONFIG DIALOGEX 0, 0, 467, 254 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Customize Schemes" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,240 + LTEXT "",IDC_STYLELABEL_ROOT,181,141,279,8 + EDITTEXT IDC_STYLEEDIT_ROOT,181,152,279,12,ES_AUTOHSCROLL + LTEXT "",IDC_STYLELABEL,181,171,279,8 + EDITTEXT IDC_STYLEEDIT,181,183,279,12,ES_AUTOHSCROLL + PUSHBUTTON "For&e...",IDC_STYLEFORE,181,201,46,14 + PUSHBUTTON "&Back...",IDC_STYLEBACK,232,201,46,14 + PUSHBUTTON "&Font...",IDC_STYLEFONT,283,201,42,14 + PUSHBUTTON "&Preview",IDC_PREVIEW,330,201,42,14 + PUSHBUTTON "&Reset",IDC_STYLEDEFAULT,377,201,42,14 + PUSHBUTTON "",IDC_PREVSTYLE,426,201,15,14 + PUSHBUTTON "",IDC_NEXTSTYLE,445,201,15,14 + PUSHBUTTON "&Import...",IDC_IMPORT,181,233,50,14 + PUSHBUTTON "E&xport...",IDC_EXPORT,237,233,50,14 + DEFPUSHBUTTON "OK",IDOK,355,233,50,14 + PUSHBUTTON "Cancel",IDCANCEL,410,233,50,14 + GROUPBOX "Info",IDC_STATIC,180,7,280,127 + ICON IDI_STYLES,IDC_STATIC,189,19,20,20 + LTEXT "Customize Schemes",IDC_TITLE,220,25,200,12 + LTEXT "Filename extensions must be separated by ;\n\nStyle format:\nfont:Name;size:nn;bold;italic;underline;fore:#ffffff;back:#bbbbbb;eolfilled\n\nStyle properties can be copied using copy and paste or drag and drop.\n\nThe ""Preview"" button will not apply any changes.",IDC_STATIC,197,50,252,70 +END + +IDD_TABSETTINGS DIALOGEX 0, 0, 174, 90 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Tab Settings" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Tabulator width:",IDC_STATIC,7,10,54,8 + EDITTEXT 100,67,7,30,14,ES_AUTOHSCROLL + LTEXT "&Indentation size:",IDC_STATIC,7,30,55,8 + EDITTEXT 101,67,27,30,14,ES_AUTOHSCROLL + CONTROL "Insert tabs as &spaces.",102,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,87,10 + CONTROL "Tab &key reformats indentation.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,59,115,10 + CONTROL "&Backspace key reformats indentation.",104,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,71,137,10 + DEFPUSHBUTTON "OK",IDOK,117,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,117,24,50,14 +END + +IDD_LONGLINES DIALOGEX 0, 0, 184, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Long Lines" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Limit for long lines:",IDC_STATIC,7,10,60,8 + EDITTEXT 100,77,7,30,14,ES_AUTOHSCROLL + CONTROL "Show &edge line.",101,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,27,67,10 + CONTROL "Change &background color.",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,38,100,10 + DEFPUSHBUTTON "OK",IDOK,127,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 +END + +IDD_WORDWRAP DIALOGEX 0, 0, 196, 100 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Word Wrap Settings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + COMBOBOX 100,7,7,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX 101,7,24,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX 102,7,41,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX 103,7,58,182,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,83,79,50,14 + PUSHBUTTON "Cancel",IDCANCEL,139,79,50,14 + LTEXT "No wrap indent|Wrap indent by 1 character|Wrap indent by 2 characters|Wrap indent by 1 level|Wrap indent by 2 levels|Wrap indent as first subline|Wrap indent 1 level more than first subline",200,0,0,615,8,NOT WS_VISIBLE + LTEXT "No visual indicators before wrap|Show visual indicators before wrap (near text)|Show visual indicators before wrap (near borders)",201,0,0,418,8,NOT WS_VISIBLE + LTEXT "No visual indicators after wrap|Show visual indicators after wrap (near text)|Show visual indicators after wrap (near borders)",202,0,0,402,8,NOT WS_VISIBLE + LTEXT "Wrap text between words|Wrap text between any glyphs",203,0,0,187,8,NOT WS_VISIBLE +END + +IDD_PAGESETUP DIALOGEX 5, 5, 356, 260 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Page Setup" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Paper",1073,8,8,224,56,WS_GROUP + LTEXT "Si&ze:",1089,16,24,36,8 + COMBOBOX 1137,64,23,160,160,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP + LTEXT "&Source:",1090,16,45,36,8 + COMBOBOX 1138,64,42,160,160,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP + GROUPBOX "Orientation",1072,8,69,64,56,WS_GROUP + CONTROL "P&ortrait",1056,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,82,52,12 + CONTROL "L&andscape",1057,"Button",BS_AUTORADIOBUTTON,16,103,52,12 + GROUPBOX "Margins",1075,80,69,152,56,WS_GROUP + LTEXT "&Left:",1102,88,85,32,8 + EDITTEXT 1155,120,82,28,12,WS_GROUP + LTEXT "&Right:",1103,164,85,32,8 + EDITTEXT 1157,196,82,28,12,WS_GROUP + LTEXT "&Top:",1104,88,104,32,8 + EDITTEXT 1156,120,103,28,12,WS_GROUP + LTEXT "&Bottom:",1105,164,104,32,8 + EDITTEXT 1158,196,103,28,12,WS_GROUP + GROUPBOX "Headers and Footers",1074,8,130,224,56,WS_GROUP + LTEXT "&Header:",IDC_STATIC,16,146,36,8 + COMBOBOX 32,64,145,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP + LTEXT "&Footer:",IDC_STATIC,16,167,36,8 + COMBOBOX 33,64,164,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP + GROUPBOX "Print Colors",1076,8,191,224,37,WS_GROUP + LTEXT "Mo&de:",IDC_STATIC,16,207,36,8 + COMBOBOX 34,64,206,160,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP + GROUPBOX "Zoom",IDC_STATIC,240,170,108,58,WS_GROUP + LTEXT "Print zoo&m (-10 to +20):",IDC_STATIC,248,188,92,8 + EDITTEXT 30,298,206,42,12,ES_AUTOHSCROLL + CONTROL "",31,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,282,205,11,14 + DEFPUSHBUTTON "OK",IDOK,190,237,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,244,237,50,14 + PUSHBUTTON "&Printer...",IDC_PRINTER,298,237,50,14 + GROUPBOX "Preview",IDC_STATIC,240,8,108,157 + CONTROL "",1080,"Static",SS_WHITERECT,254,47,80,80 + CONTROL "",1081,"Static",SS_GRAYRECT,334,51,4,80 + CONTROL "",1082,"Static",SS_GRAYRECT,262,123,80,4 +END + +IDD_FAVORITES DIALOGEX 0, 0, 165, 129 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Favorites" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_FAVORITESDIR,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,7,151,69 + PUSHBUTTON "",IDC_GETFAVORITESDIR,7,83,13,13 + LTEXT "Click here to specify the directory with links to your favorite files.",IDC_FAVORITESDESCR,26,83,132,18 + DEFPUSHBUTTON "OK",IDOK,52,108,50,14 + PUSHBUTTON "Cancel",IDCANCEL,108,108,50,14 + SCROLLBAR IDC_RESIZEGRIP3,7,112,10,10 +END + +IDD_ADDTOFAV DIALOGEX 0, 0, 172, 66 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add to Favorites" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "Enter the name for the new favorites item:",IDC_STATIC,7,7,158,8 + EDITTEXT 100,7,22,158,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,59,45,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,115,45,50,14 +END + +IDD_PASSWORDS DIALOGEX 0, 0, 311, 122 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Encryption" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,245,98,50,14 + PUSHBUTTON "Cancel",IDCANCEL,184,98,50,14 + CONTROL "Set New Master Key",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,60,84,10 + EDITTEXT IDC_EDIT1,17,35,276,12,ES_PASSWORD | ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_EDIT2,17,74,277,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Optional Master Key:",IDC_STATIC,17,61,72,10,NOT WS_GROUP + CONTROL "Encrypt using Passphrase",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,21,98,10 + CONTROL "Reuse Master Key",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,60,76,10 + GROUPBOX "Passphrase",IDC_STATIC,7,7,297,108 + CONTROL "show passphrases",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,97,75,10 +END + +IDD_READPW DIALOGEX 0, 0, 299, 81 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Decrypt File" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,233,58,50,14 + PUSHBUTTON "Cancel",IDCANCEL,175,58,50,14 + EDITTEXT IDC_EDIT3,16,23,267,12,ES_PASSWORD | ES_AUTOHSCROLL | WS_GROUP + CONTROL "decrypt using the master key",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,40,117,10 + LTEXT "This file has a master key",IDC_STATICPW,16,41,89,11,NOT WS_GROUP + GROUPBOX "Passphrase",IDC_STATIC,8,6,283,69 + CONTROL "show passphrase",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,60,75,10 +END + +IDD_COLUMNWRAP DIALOGEX 0, 0, 130, 47 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Column Wrap" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Boundary:",IDC_STATIC,7,7,34,8 + EDITTEXT IDC_COLUMNWRAP,7,24,46,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,73,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,73,24,50,14 +END + +IDD_MODIFYLINES DIALOGEX 0, 0, 182, 110 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Modify Lines" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Prefix text to lines:",IDC_STATIC,7,7,62,8 + EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL + LTEXT "&Append text to lines:",IDC_STATIC,7,37,68,8 + EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,125,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 + LTEXT "$(L)",200,7,72,14,8 + LTEXT "$(0L)",201,30,72,18,8 + LTEXT "Document line number.",IDC_STATIC,57,72,74,8 + LTEXT "$(N)",202,7,82,15,8 + LTEXT "$(0N)",203,30,82,19,8 + LTEXT "Continuous number.",IDC_STATIC,57,82,66,8 + LTEXT "$(I)",204,7,92,13,8 + LTEXT "$(0I)",205,30,92,17,8 + LTEXT "Continuous number (zero-based).",IDC_STATIC,57,92,109,8 +END + +IDD_INSERTTAG DIALOGEX 0, 0, 182, 70 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Insert HTML/XML Tag" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "&Opening tag (with attributes):",IDC_STATIC,7,7,97,8 + EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL + LTEXT "&Closing tag (can be edited):",IDC_STATIC,7,37,90,8 + EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,125,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 +END + +IDD_ENCLOSESELECTION DIALOGEX 0, 0, 182, 70 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Enclose Selection" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Insert &before selection:",IDC_STATIC,7,7,76,8 + EDITTEXT 100,7,18,98,14,ES_AUTOHSCROLL + LTEXT "Insert &after selection:",IDC_STATIC,7,37,71,8 + EDITTEXT 101,7,48,98,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,125,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,125,24,50,14 +END + +IDD_INFOBOX DIALOGEX 0, 0, 244, 71 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Notepad3" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 + LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 + DEFPUSHBUTTON "OK",IDOK,187,50,50,14 + CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 +END + +IDD_INFOBOX2 DIALOGEX 0, 0, 244, 71 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Notepad3" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 + LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 + PUSHBUTTON "&Yes",IDYES,131,50,50,14 + PUSHBUTTON "&No",IDNO,187,50,50,14 + CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 +END + +IDD_INFOBOX3 DIALOGEX 0, 0, 244, 71 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Notepad3" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20 + LTEXT "",IDC_INFOBOXTEXT,35,7,202,34 + DEFPUSHBUTTON "OK",IDOK,131,50,50,14 + PUSHBUTTON "Cancel",IDCANCEL,187,50,50,14 + CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10 +END + +IDD_SORT DIALOGEX 0, 0, 184, 140 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Sort Lines" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + CONTROL "Sort &ascending.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,66,10 + CONTROL "Sort &descending.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,70,10 + CONTROL "Shu&ffle lines.",102,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,31,57,10 + CONTROL "&Merge duplicate lines.",103,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,85,10 + CONTROL "&Remove duplicate lines.",104,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,62,91,10 + CONTROL "Remove &unique lines.",105,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,74,84,10 + CONTROL "&Case insensitive.",106,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,92,70,10 + CONTROL "Logical &number comparison.",107,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,104,104,10 + CONTROL "Column &sort (rectangular selection).",108,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,131,10 + DEFPUSHBUTTON "OK",IDOK,127,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 +END + +IDD_RECODE DIALOGEX 0, 0, 165, 135 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Recode" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "Select source &encoding to reload file:",IDC_STATIC,7,7,119,8 + CONTROL "",IDC_ENCODINGLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,19,151,87 + DEFPUSHBUTTON "OK",IDOK,53,114,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,108,114,50,14 + SCROLLBAR IDC_RESIZEGRIP4,7,118,10,10 +END + +IDD_ENCODING DIALOGEX 0, 0, 165, 135 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Encoding" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "Select current file &encoding:",IDC_STATIC,7,7,90,8 + CONTROL "",IDC_ENCODINGLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,19,151,87 + DEFPUSHBUTTON "OK",IDOK,53,114,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,108,114,50,14 + SCROLLBAR IDC_RESIZEGRIP4,7,118,10,10 +END + +IDD_ALIGN DIALOGEX 0, 0, 184, 74 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Align Lines" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + CONTROL "&Left.",100,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,7,31,10 + CONTROL "&Right.",101,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,35,10 + CONTROL "&Center.",102,"Button",BS_AUTORADIOBUTTON,7,31,41,10 + CONTROL "&Justify.",103,"Button",BS_AUTORADIOBUTTON,7,43,40,10 + CONTROL "Justify (&Paragraph mode).",104,"Button",BS_AUTORADIOBUTTON,7,55,100,10 + DEFPUSHBUTTON "OK",IDOK,127,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,127,24,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 4 + VERTGUIDE, 19 + VERTGUIDE, 340 + TOPMARGIN, 7 + BOTTOMMARGIN, 270 + END + + IDD_FIND, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 266 + VERTGUIDE, 7 + TOPMARGIN, 7 + BOTTOMMARGIN, 113 + END + + IDD_REPLACE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 266 + VERTGUIDE, 7 + TOPMARGIN, 7 + BOTTOMMARGIN, 140 + END + + IDD_RUN, DIALOG + BEGIN + LEFTMARGIN, 10 + RIGHTMARGIN, 218 + BOTTOMMARGIN, 85 + END + + IDD_OPENWITH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 158 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_DEFENCODING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 190 + TOPMARGIN, 7 + BOTTOMMARGIN, 152 + END + + IDD_DEFEOLMODE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 173 + TOPMARGIN, 7 + BOTTOMMARGIN, 71 + END + + IDD_LINENUM, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 40 + END + + IDD_FILEMRU, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 262 + TOPMARGIN, 7 + BOTTOMMARGIN, 153 + END + + IDD_CHANGENOTIFY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 177 + TOPMARGIN, 7 + BOTTOMMARGIN, 58 + END + + IDD_STYLESELECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 158 + TOPMARGIN, 7 + BOTTOMMARGIN, 127 + END + + IDD_STYLECONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 460 + TOPMARGIN, 7 + BOTTOMMARGIN, 247 + END + + IDD_TABSETTINGS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 167 + TOPMARGIN, 7 + BOTTOMMARGIN, 83 + END + + IDD_LONGLINES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 177 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_WORDWRAP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 189 + TOPMARGIN, 7 + BOTTOMMARGIN, 93 + END + + IDD_PAGESETUP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 349 + TOPMARGIN, 7 + BOTTOMMARGIN, 253 + END + + IDD_FAVORITES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 158 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ADDTOFAV, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 165 + TOPMARGIN, 7 + BOTTOMMARGIN, 59 + END + + IDD_PASSWORDS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 7 + BOTTOMMARGIN, 115 + END + + IDD_READPW, DIALOG + BEGIN + END + + IDD_COLUMNWRAP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 123 + TOPMARGIN, 7 + BOTTOMMARGIN, 40 + END + + IDD_MODIFYLINES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 103 + END + + IDD_INSERTTAG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 63 + END + + IDD_ENCLOSESELECTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 63 + END + + IDD_INFOBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 64 + END + + IDD_INFOBOX2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 64 + END + + IDD_INFOBOX3, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 64 + END + + IDD_SORT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 177 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_RECODE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 158 + TOPMARGIN, 7 + BOTTOMMARGIN, 128 + END + + IDD_ENCODING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 158 + TOPMARGIN, 7 + BOTTOMMARGIN, 128 + END + + IDD_ALIGN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 177 + TOPMARGIN, 7 + BOTTOMMARGIN, 67 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_PASS_FAILURE "The Passphrase is incorrect.\nRetry another Passphrase?" +END + +STRINGTABLE +BEGIN + IDS_NOPASS "Decryption Cancelled!\nRead encrypted raw data?" +END + +STRINGTABLE +BEGIN + IDS_APPTITLE "Notepad3" + IDS_APPTITLE_ELEVATED "%s (Administrator)" + IDS_APPTITLE_PASTEBOARD "Notepad3 : Paste Board" + IDS_UNTITLED "Untitled" + IDS_TITLEEXCERPT """%s""" + IDS_READONLY "(Read Only)" + IDS_DOCPOS " Ln %s / %s Col %s Sel %s (%s) SelLn %s Occ %s " + IDS_DOCPOS2 " Ln %s / %s Col %s / %s Sel %s (%s) SelLn %s Occ %s " + IDS_DOCSIZE " %s [UTF-8]" + IDS_LOADFILE "Loading ""%s""..." + IDS_SAVEFILE "Saving ""%s""..." + IDS_PRINTFILE "Printing page %i..." + IDS_SAVINGSETTINGS "Saving settings..." + IDS_LINKDESCRIPTION "Edit with Notepad3" + IDS_FILTER_ALL "All files (*.*)|*.*|" + IDS_FILTER_EXE "Executable files (*.exe;*.com;*.bat;*.cmd;*.lnk;*.pif)|*.exe;*.com;*.bat;*.cmd;*.lnk;*.pif|All files (*.*)|*.*|" +END + +STRINGTABLE +BEGIN + IDS_FILTER_INI "Configuration files (*.ini)|*.ini|All files (*.*)|*.*|" + IDS_OPENWITH "Select the directory with links to your favorite applications." + IDS_FAVORITES "Select the directory with links to your favorite files." + IDS_BACKSLASHHELP "Backslash Transformations\n\n\\a\tAlert (BEL, Ascii 7)\n\\b\tBackspace (BS, Ascii 8)\n\\f\tFormfeed (FF, Ascii 12)\n\\n\tNewline (LF, Ascii 10)\n\\r\tCarriage return (CR, Ascii 13)\n\\t\tHorizontal Tab (HT, Ascii 9)\n\\v\tVertical Tab (VT, Ascii 11)\n\\0oo\tOctal Value\n\\u####\tHexadecimal Value\n\\xhh\tHexadecimal Value\n\\\\\tBackslash" + IDS_REGEXPHELP "RegExp Matching Syntax (Multi Lines)\n\n.\tMatches any character\n^\tEmpty string immediately after Newline\n$\tEmpty string immediately before End of Line\n\\<\tStart of a word\n\\>\tEnd of a word\n\\b\tWord boundary\n[...]\tA set of chars ([abc]) or a range ([a-z])\n[^...]\tChars NOT in the set or range\n\\d\tAny decimal digit\n\\D\tAny non-digit char\n\\s\tAny whitespace char\n\\S\tNot a whitespace char\n\\w\tAny ""word"" char\n\\W\tAny ""non-word"" char\n\\x\tEscape character with otherwise special meaning\n\\xHH\tChar with hex code HH\n?\tMatches preceding 0 or 1 times\n*\tMatches preceding 0 or more times\n+\tMatches preceding 1 or more times\n*? or +?\tNon greedy matching of quantifiers ""?"" and ""+""\n(\tStart of a region\n)\tEnd of a region\n\\n\tRefers to a region when replacing (n is 1-9)\n" + IDS_WILDCARDHELP "Wildcard Search\n\n*\tMatches zero or more characters.\n?\tMatches exactly one character. " + IDS_FR_STATUS_FMT " Ln %s / %s Col %s Sel %s Occ %s Repl %s ( %s ) " +END + +STRINGTABLE +BEGIN + IDT_FILE_NEW "New" + IDT_FILE_OPEN "Open" + IDT_FILE_BROWSE "Browse" + IDT_FILE_SAVE "Save" +END + +STRINGTABLE +BEGIN + IDT_EDIT_UNDO "Undo" + IDT_EDIT_REDO "Redo" + IDT_EDIT_CUT "Cut" + IDT_EDIT_COPY "Copy" + IDT_EDIT_PASTE "Paste" + IDT_EDIT_FIND "Find" + IDT_EDIT_REPLACE "Replace" + IDT_VIEW_WORDWRAP "Word Wrap" + IDT_VIEW_ZOOMIN "Zoom In" + IDT_VIEW_ZOOMOUT "Zoom Out" + IDT_VIEW_SCHEME "Select Scheme" + IDT_VIEW_SCHEMECONFIG "Customize Schemes" + IDT_FILE_EXIT "Exit" + IDT_FILE_SAVEAS "Save As" + IDT_FILE_SAVECOPY "Save Copy" + IDT_EDIT_CLEAR "Delete" +END + +STRINGTABLE +BEGIN + IDT_FILE_PRINT "Print" + IDT_FILE_OPENFAV "Favorites" + IDT_FILE_ADDTOFAV "Add to Favorites" + IDT_VIEW_TOGGLEFOLDS "Toggle All Folds" + IDT_FILE_LAUNCH "Execute Document" + IDT_VIEW_TOGGLE_VIEW "Toggle View" +END + +STRINGTABLE +BEGIN + IDS_ERR_LOADFILE "Error loading ""%s""." + IDS_ERR_SAVEFILE "Error saving ""%s""." + IDS_ERR_BROWSE "No file browser plugin was found.\nThe MiniPath file browser plugin can be downloaded from https://rizonesoft.com." + IDS_ERR_MRUDLG "No access to the selected file!\nWould you like to remove it from the list?" + IDS_ERR_CREATELINK "Error creating the Desktop link." + IDS_ERR_PREVWINDISABLED "Existing Notepad3 window is busy or has an active dialog box.\nWould you like to open another Notepad3 window?" + IDS_SELRECT "This operation can't be perfomed within a rectangular selection." + IDS_BUFFERTOOSMALL "This operation can't be performed (lines too long)." + IDS_FIND_WRAPFW "Reached the end of the document, restarting search at the beginning." + IDS_FIND_WRAPRE "Reached the beginning of the document, restarting search at the end." + IDS_NOTFOUND "The specified text was not found." + IDS_REPLCOUNT "%i occurrences of the specified text have been replaced." + IDS_ASK_ENCODING "Switching the file encoding from one encoding to another may replace unsupported text with default characters, and the undo history will be cleared. Continue?" + IDS_ASK_ENCODING2 "You are about to change the encoding of an empty file. Note that this will clear the undo history, as it can't be synchronized with the new encoding. Continue?" + IDS_ERR_ENCODINGNA "Code page conversion tables for the selected encoding are not available on your system." + IDS_ERR_UNICODE "Error converting this Unicode file.\nData will be lost if the file is saved!" +END + +STRINGTABLE +BEGIN + IDS_READONLY_SAVE """%s"" is read only. Save to a different file?" + IDS_FILECHANGENOTIFY "The current file has been modified by an external program. Reload?" + IDS_FILECHANGENOTIFY2 "The current file has been deleted. Save now?" + IDS_STICKYWINPOS "Sticky Window Position is enabled. Any new Notepad3 windows will use the current window placement settings." + IDS_SAVEDSETTINGS "The current program settings have been saved." + IDS_CREATEINI_FAIL "Error creating configuration file." + IDS_WRITEINI_FAIL "Error writing settings to configuration file." + IDS_SETTINGSNOTSAVED "No existing configuration file was found.\nTo keep your style modifications, save settings now (F7) or go back to scheme configuration (Ctrl+F12) and export your styles." + IDS_EXPORT_FAIL "Error exporting style settings to ""%s""." + IDS_ERR_ACCESSDENIED "The file ""%s"" cannot be saved and may be protected.\n\nDo you want to launch Notepad3 as Administrator?" + IDS_WARN_UNKNOWN_EXT "Unknown file name extension (%s) !\nLoading data anyway ?" + IDS_REGEX_INVALID "Error evaluating regular expression. Expression is invalid!" + IDS_DROP_NO_FILE "No valid filename retrieved.\nIf dropping from 32-bit application,\nplease drag and drop to Notepad3's tool bar." + IDS_APPLY_DEFAULT_FONT "Apply these font settings to current ('%s') scheme's default text also?" + IDS_ERR_UPDATECHECKER "No update installer executable found.\nCheck for update on website https://rizonesoft.com ?" +END + +STRINGTABLE +BEGIN + IDS_CMDLINEHELP "Command Line Help\n\nfile\tMust be the last argument, no quoted spaces by default.\n+\tAccept multiple file arguments (with quoted spaces).\n-\tAccept single file argument (without quoted spaces).\n…\tEncoding (/ansi, /unicode, /unicodebe, /utf8, /utf8sig).\n…\tLine ending mode (/crlf, /lf, /cr).\n/e\tFile source encoding.\n/g\tJump to specified position (/g -1 end of file).\n/m\tMatch specified text (/m- last, /mr regex, /mb backslash).\n/l\tAuto-reload modified files.\n/q\tForce creation of new files without prompt.\n/s\tSelect specified syntax scheme.\n/d\tSelect default text scheme.\n/h\tSelect Web Source Code scheme.\n/x\tSelect XML Document scheme.\n/c\tOpen new window and paste clipboard contents.\n/b\tOpen new paste board to collect clipboard entries.\n/n\tAlways open a new window (/ns single file instance).\n/r\tReuse window (/rs single file instance).\n/p\tSet window position and size (/p0, /ps, /pf,l,t,r,b,m).\n/t\tSet window title.\n/i\tStart as tray icon.\n/o\tKeep window on top.\n/f\tSpecify ini-file (/f0 no ini-file).\n/u\tLaunch with elevated privileges.\n/v\tPrint file immediately and quit.\n/vd\tPrint file (open printer dialog).\n/z\tSkip next (usable for registry-based Notepad replacement)." +END + +STRINGTABLE +BEGIN + IDS_ERR_UNICODE2 "Certain characters in the current text are not supported by the selected encoding, and may be replaced by default placeholders when saving. It's recommended to choose another file encoding. Continue?" + IDS_WARN_LOAD_BIG_FILE "Are you sure you want to open this large file?" + IDS_ERR_DROP "Only one file can be dropped at the same time!" + IDS_ASK_SAVE "Save changes to ""%s""?" + IDS_ASK_REVERT "Revert file to last saved state? Your changes will be lost!" + IDS_ASK_RECODE "Recoding requires reloading file from disk, unsaved changes will be lost!" + IDS_ASK_CREATE """%s"" not found.\nWould you like to create this file?" + IDS_PRINT_HEADER "Filename, Current Date and Time|Filename, Current Date|Filename|Leave blank" + IDS_PRINT_FOOTER "Page Number|Leave blank" + IDS_PRINT_COLOR "Normal|Invert light (dark background)|Black on white|Color on white|Color on white (except line numbers)" + IDS_PRINT_PAGENUM "Page %i" + IDS_PRINT_EMPTY "This document doesn't contain any text to be printed." + IDS_PRINT_ERROR "Error printing ""%s""!" + IDS_FAV_SUCCESS "A shortcut to the current file has been created in the favorites directory." + IDS_FAV_FAILURE "The shortcut to the current file could not be created.\nMake sure there's no other file with the same name." + IDS_READONLY_MODIFY "The attributes of ""%s"" could not be modified." +END + +STRINGTABLE +BEGIN + IDS_SAVEPOS "&Save Position\tCtrl+S" + IDS_RESETPOS "&Reset Position\tCtrl+R" + IDS_PREVIEW "&Preview Settings\tCtrl+P" +END + +STRINGTABLE +BEGIN + 61000 "A0;ANSI;ANSI" + 61001 "A1;OEM;OEM" + 61002 "A2;Unicode (UTF-16 LE BOM);Unicode (UTF-16) LE BOM" + 61003 "A3;Unicode (UTF-16 BE BOM);Unicode (UTF-16) BE BOM" + 61004 "A4;Unicode (UTF-16 LE);Unicode (UTF-16) LE" + 61005 "A5;Unicode (UTF-16 BE);Unicode (UTF-16) BE" + 61006 "A6;UTF-8;Unicode (UTF-8)" + 61007 "A7;UTF-8 Signature;Unicode (UTF-8) Signature" +END + +STRINGTABLE +BEGIN + 61008 "A8;UTF-7;Unicode (UTF-7)" + 61009 "C;Arabic (DOS-720);DOS-720" + 61010 "C;Arabic (ISO-8859-6);ISO-8859-6" + 61011 "C;Arabic (Mac);Mac (Arabic)" + 61012 "C;Arabic (Windows-1256);Windows-1256" + 61013 "C;Baltic (DOS-775);DOS-775" + 61014 "C;Baltic (ISO-8859-4);ISO-8859-4" + 61015 "C;Baltic (Windows-1257);Windows-1257" + 61016 "C;Central European (DOS-852);DOS-852" + 61017 "C;Central European (ISO-8859-2);ISO-8859-2" + 61018 "C;Central European (Mac);Mac (Central)" + 61019 "C;Central European (Windows-1250);Windows-1250" + 61020 "C;Chinese Simplified (GBK-2312);GBK-2312" + 61021 "C;Chinese Simplified (Mac);Mac (zh-cn)" + 61022 "C;Chinese Traditional (Big5);Big5" + 61023 "C;Chinese Traditional (Mac);Mac (zh-tw)" +END + +STRINGTABLE +BEGIN + 61024 "C;Croatian (Mac);Mac (Croatian)" + 61025 "C;Cyrillic (DOS-866);DOS-866" + 61026 "C;Cyrillic (ISO-8859-5);ISO-8859-5" + 61027 "C;Cyrillic (KOI8-R);KOI8-R" + 61028 "C;Cyrillic (KOI8-U);KOI8-U" + 61029 "C;Cyrillic (Mac);Mac (Cyrillic)" + 61030 "C;Cyrillic (Windows-1251);Windows-1251" + 61031 "C;Estonian (ISO-8859-13);ISO-8859-13" + 61032 "C;French Canadian (DOS-863);DOS-863" + 61033 "C;Greek (DOS-737);DOS-737" + 61034 "C;Greek (ISO-8859-7);ISO-8859-7" + 61035 "C;Greek (Mac);Mac (Greek)" + 61036 "C;Greek (Windows-1253);Windows-1253" + 61037 "C;Greek, Modern (DOS-869);DOS-869" + 61038 "C;Hebrew (DOS-862);DOS-862" + 61039 "C;Hebrew (ISO-8859-8-I);ISO-8859-8-I" +END + +STRINGTABLE +BEGIN + 61040 "C;Hebrew (ISO-8859-8);ISO-8859-8" + 61041 "C;Hebrew (Mac);Mac (Hebrew)" + 61042 "C;Hebrew (Windows-1255);Windows-1255" + 61043 "C;Icelandic (DOS-861);DOS-861" + 61044 "C;Icelandic (Mac);Mac (Icelandic)" + 61045 "C;Japanese (Mac);Mac (Japanese)" + 61046 "C;Japanese (Shift-JIS);Shift-JIS" + 61047 "C;Korean (Mac);Mac (Korean)" + 61048 "C;Korean (Windows-949);Windows-949" + 61049 "C;Latin 3 (ISO-8859-3);ISO-8859-3" + 61050 "C;Latin 9 (ISO-8859-15);ISO-8859-15" + 61051 "C;Nordic (DOS-865);DOS-865" + 61052 "C;OEM United States (DOS-437);DOS-437" + 61053 "C;OEM Multilingual Latin 1 (DOS-858);DOS-858" + 61054 "C;Portuguese (DOS-860);DOS-860" + 61055 "C;Romanian (Mac);Mac (Romanian)" +END + +STRINGTABLE +BEGIN + 61056 "C;Thai (Mac);Mac (Thai)" + 61057 "C;Thai (Windows-874);Windows-874" + 61058 "C;Turkish (DOS-857);DOS-857" + 61059 "C;Turkish (ISO-8859-9);ISO-8859-9" + 61060 "C;Turkish (Mac);Mac (Turkish)" + 61061 "C;Turkish (Windows-1254);Windows-1254" + 61062 "C;Ukrainian (Mac);Mac (Ukrainian)" + 61063 "C;Vietnamese (Windows-1258);Windows-1258" + 61064 "B;Western European (DOS-850);DOS-850" + 61065 "B;Western European (ISO-8859-1);ISO-8859-1" + 61066 "B;Western European (Mac);Mac (Western)" + 61067 "B;Western European (Windows-1252);Windows-1252" + 61068 "D0;IBM EBCDIC (US-Canada);EBCDIC (US)" + 61069 "D1;IBM EBCDIC (International);EBCDIC (Int.)" + 61070 "D2;IBM EBCDIC (Greek Modern);EBCDIC (GR)" + 61071 "D3;IBM EBCDIC (Turkish Latin-5);EBCDIC (Latin-5)" +END + +STRINGTABLE +BEGIN + 61072 "C;Chinese Simplified (GB18030);GB18030" + 61073 "C;Japanese (EUC);Japanese (EUC)" + 61074 "C;Korean (EUC);Korean (EUC)" + 61075 "C;Chinese Traditional (ISO-2022);ISO-2022-CN" + 61076 "C;Chinese Simplified (HZ-GB2312);HZ-GB2312" + 61077 "C;Japanese (ISO-2022);ISO-2022-JP" + 61078 "C;Korean (ISO-2022);ISO-2022-KR" + 61079 "C;Chinese Traditional (CNS);x-chinese-cns" +END + +STRINGTABLE +BEGIN + 62000 "Windows (CR+LF)" + 62001 "Unix (LF)" + 62002 "Mac (CR)" +END + +STRINGTABLE +BEGIN + 63000 "Default Text" + 63001 "Web Source Code" + 63002 "XML Document" + 63003 "CSS Style Sheets" + 63004 "C/C++ Source Code" + 63005 "C# Source Code" + 63006 "Resource Script" + 63007 "Makefiles" +END + +STRINGTABLE +BEGIN + 63008 "VBScript" + 63009 "Visual Basic" + 63010 "JavaScript" + 63011 "Java Source Code" + 63012 "Pascal Source Code" + 63013 "Assembly Script" + 63014 "Perl Script" + 63015 "Configuration Files" + 63016 "Batch Files" + 63017 "Diff Files" + 63018 "SQL Query" + 63019 "Python Script" + 63020 "Apache Config Files" + 63021 "PowerShell Script" + 63022 "D Source Code" + 63023 "Go Source Code" +END + +STRINGTABLE +BEGIN + 63024 "Awk Script" + 63025 "ANSI Art" + 63026 "Shell Script" + 63027 "Registry Files" + 63028 "VHDL" + 63029 "JSON" + 63030 "NSIS" + 63031 "Inno Setup Script" + 63032 "Ruby Script" + 63033 "Lua Script" + 63034 "Tcl Script" + 63035 "AutoIt3 Script" + 63036 "LaTeX Files" + 63037 "AutoHotkey Script" + 63038 "Cmake Script" + 63039 "AviSynth Script" +END + +STRINGTABLE +BEGIN + 63040 "Markdown" + 63041 "YAML" + 63042 "Coffeescript" + 63043 "MATLAB" + 63044 "Nim Source Code" + 63045 "R-S-SPlus Statistics Code" +END + +STRINGTABLE +BEGIN + 63100 "Default Style" + 63101 "Margins and Line Numbers" + 63102 "Matching Braces (Indicator)" + 63103 "Matching Braces Error (Indicator)" +END + +STRINGTABLE +BEGIN + 63104 "Control Characters (Font)" + 63105 "Indentation Guide (Color)" + 63106 "Selected Text (Colors)" + 63107 "Whitespace (Colors, Size 0-5)" + 63108 "Current Line Background (Color)" + 63109 "Caret (Color, Size 1-3)" + 63110 "Long Line Marker (Colors)" + 63111 "Extra Line Spacing (Size)" + 63112 "2nd Default Style" + 63113 "2nd Margins and Line Numbers" + 63114 "2nd Matching Braces (Indicator)" + 63115 "2nd Matching Braces Error (Indicator)" + 63116 "2nd Control Characters (Font)" + 63117 "2nd Indentation Guide (Color)" + 63118 "2nd Selected Text (Colors)" + 63119 "2nd Whitespace (Colors, Size 0-5)" +END + +STRINGTABLE +BEGIN + 63120 "2nd Current Line Background (Color)" + 63121 "2nd Caret (Color, Size 1-3)" + 63122 "2nd Long Line Marker (Colors)" + 63123 "2nd Extra Line Spacing (Size)" + 63124 "Bookmarks and Folding (Colors)" + 63125 "2nd Bookmarks and Folding (Colors)" + 63126 "Default" + 63127 "Comment" + 63128 "Keyword" + 63129 "Identifier" + 63130 "Number" + 63131 "String" + 63132 "Operator" + 63133 "Preprocessor" + 63134 "Verbatim String" + 63135 "Regex" +END + +STRINGTABLE +BEGIN + 63136 "HTML Tag" + 63137 "HTML Unknown Tag" + 63138 "HTML Attribute" + 63139 "HTML Unknown Attribute" + 63140 "HTML Value" + 63141 "HTML String" + 63142 "HTML Other Inside Tag" + 63143 "HTML Comment" + 63144 "HTML Entity" + 63145 "XML Identifier" + 63146 "ASP Start Tag" + 63147 "CDATA" + 63148 "PHP Start Tag" + 63149 "PHP Default" + 63150 "PHP String" + 63151 "PHP Simple String" +END + +STRINGTABLE +BEGIN + 63152 "PHP Keyword" + 63153 "PHP Number" + 63154 "PHP Variable" + 63155 "PHP String Variable" + 63156 "PHP Complex Variable" + 63157 "PHP Comment" + 63158 "PHP Operator" + 63159 "JS Default" + 63160 "JS Comment" + 63161 "JS Number" + 63162 "JS Identifier" + 63163 "JS Keyword" + 63164 "JS String" + 63165 "JS Symbols" + 63166 "JS Regex" + 63167 "ASP JS Default" +END + +STRINGTABLE +BEGIN + 63168 "ASP JS Comment" + 63169 "ASP JS Number" + 63170 "ASP JS Identifier" + 63171 "ASP JS Keyword" + 63172 "ASP JS String" + 63173 "ASP JS Symbols" + 63174 "ASP JS Regex" + 63175 "VBS Default" + 63176 "VBS Comment" + 63177 "VBS Number" + 63178 "VBS Keyword" + 63179 "VBS String" + 63180 "VBS Identifier" + 63181 "ASP VBS Default" + 63182 "ASP VBS Comment" + 63183 "ASP VBS Number" +END + +STRINGTABLE +BEGIN + 63184 "ASP VBS Keyword" + 63185 "ASP VBS String" + 63186 "ASP VBS Identifier" + 63187 "XML Tag" + 63188 "XML Attribute" + 63189 "XML Value" + 63190 "XML String" + 63191 "XML Other Inside Tag" + 63192 "XML Comment" + 63193 "XML Entity" + 63194 "Tag-Class" + 63195 "Tag-ID" + 63196 "Tag-Attribute" + 63197 "Pseudo-Class" + 63198 "Unknown Pseudo-Class" + 63199 "CSS Property" +END + +STRINGTABLE +BEGIN + 63200 "Unknown Property" + 63201 "Value" + 63202 "Important" + 63203 "Directive" + 63204 "Target" + 63205 "Inline Asm" + 63206 "CPU Instruction" + 63207 "FPU Instruction" + 63208 "Register" + 63209 "Directive Operand" + 63210 "Extended Instruction" + 63211 "String Double Quoted" + 63212 "String Single Quoted" + 63213 "POD (Common)" + 63214 "POD (Verbatim)" + 63215 "Scalar $var" +END + +STRINGTABLE +BEGIN + 63216 "Array @var" + 63217 "Hash %var" + 63218 "Symbol Table *var" + 63219 "Regex /re/ or m{re}" + 63220 "Substitution s/re/ore/" + 63221 "Back Ticks" + 63222 "Data Section" + 63223 "Here-Doc (Delimiter)" + 63224 "Here-Doc (Single Quoted, q)" + 63225 "Here-Doc (Double Quoted, qq)" + 63226 "Here-Doc (Back Ticks, qx)" + 63227 "Single Quoted String (Generic, q)" + 63228 "Double Quoted String (qq)" + 63229 "Back Ticks (qx)" + 63230 "Regex (qr)" + 63231 "Array (qw)" +END + +STRINGTABLE +BEGIN + 63232 "Section" + 63233 "Assignment" + 63234 "Default Value" + 63235 "Label" + 63236 "Command" + 63237 "SGML" + 63238 "Source and Destination" + 63239 "Position Setting" + 63240 "Line Addition" + 63241 "Line Removal" + 63242 "Line Change" + 63243 "Quoted Identifier" + 63244 "String Triple Double Quotes" + 63245 "String Triple Single Quotes" + 63246 "Class Name" + 63247 "Function Name" +END + +STRINGTABLE +BEGIN + 63248 "IP Address" + 63249 "Variable" + 63250 "Cmdlet" + 63251 "Alias" + 63252 "Parsing Error" + 63253 "Prototype" + 63254 "Format Identifier" + 63255 "Format Body" + 63256 "HTML Element Text" + 63257 "XML Element Text" + 63258 "Typedefs/Classes" + 63259 "Comment Doc" + 63260 "Keyword 2nd" + 63261 "Error" + 63262 "Mark Occurrences (Indicator)" + 63263 "2nd Mark Occurrences (Indicator)" +END + +STRINGTABLE +BEGIN + 63264 "Hyperlink Hotspots" + 63265 "2nd Hyperlink Hotspots" + 63266 "2nd Default Text" + 63267 "Variable within String" + 63268 "Ordered List" + 63269 "Infix" + 63270 "Infix EOL" + 63271 "Base Package Functions" + 63272 "Other Package Functions" +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// German (Switzerland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DES) +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_SWISS +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""Notepad3.ver""\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // German (Switzerland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "Notepad3.ver" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/SciCall.h b/src/SciCall.h index 5f9c9a3e8..8cdd679e6 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -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_ diff --git a/src/Styles.c b/src/Styles.c index 98f0f04f5..77d2e7232 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1,6564 +1,6614 @@ -/****************************************************************************** -* * -* * -* Notepad3 * -* * -* Styles.c * -* Scintilla Style Management * -* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * -* Mostly taken from SciTE, (c) Neil Hodgson * -* * -* (c) Rizonesoft 2008-2016 * -* http://www.rizonesoft.com * -* * -* * -*******************************************************************************/ -#if !defined(WINVER) -#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ -#endif -#if !defined(NTDDI_VERSION) -#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ -#endif -#define VC_EXTRALEAN 1 - -#include -#include -#include -#include -#include -#include - -#include "scintilla.h" -#include "scilexer.h" -#include "notepad3.h" -#include "edit.h" -#include "dialogs.h" -#include "resource.h" -#include "encoding.h" -#include "helpers.h" -#include "SciCall.h" - -#include "styles.h" - -extern HINSTANCE g_hInstance; - -extern HWND g_hwndMain; -extern HWND g_hwndDlgCustomizeSchemes; - -extern int iSciFontQuality; -extern const int FontQuality[4]; - -extern bool g_bCodeFoldingAvailable; -extern bool g_bShowCodeFolding; -extern bool g_bShowSelectionMargin; - -extern int iMarkOccurrences; -extern bool bUseOldStyleBraceMatching; - -extern int xCustomSchemesDlg; -extern int yCustomSchemesDlg; - - -#define MULTI_STYLE(a,b,c,d) ((a)|(b<<8)|(c<<16)|(d<<24)) - -#define INITIAL_BASE_FONT_SIZE (10) - -KEYWORDLIST KeyWords_NULL = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexStandard = { SCLEX_NULL, 63000, L"Default Text", L"txt; text; wtx; log; asc; doc", L"", &KeyWords_NULL, { - /* 0 */ { STYLE_DEFAULT, 63100, L"Default Style", L"font:Default; size:10", L"" }, - /* 1 */ { STYLE_LINENUMBER, 63101, L"Margins and Line Numbers", L"size:-2; fore:#FF0000", L"" }, - /* 2 */ { STYLE_BRACELIGHT, 63102, L"Matching Braces (Indicator)", L"fore:#00FF40; alpha:40; alpha2:40; indic_roundbox", L"" }, - /* 3 */ { STYLE_BRACEBAD, 63103, L"Matching Braces Error (Indicator)", L"fore:#FF0080; alpha:140; alpha2:140; indic_roundbox", L"" }, - /* 4 */ { STYLE_CONTROLCHAR, 63104, L"Control Characters (Font)", L"size:-1", L"" }, - /* 5 */ { STYLE_INDENTGUIDE, 63105, L"Indentation Guide (Color)", L"fore:#A0A0A0", L"" }, - /* 6 */ { SCI_SETSELFORE+SCI_SETSELBACK, 63106, L"Selected Text (Colors)", L"back:#0A246A; eolfilled; alpha:95", L"" }, - /* 7 */ { SCI_SETWHITESPACEFORE+SCI_SETWHITESPACEBACK+SCI_SETWHITESPACESIZE, 63107, L"Whitespace (Colors, Size 0-5)", L"fore:#FF4000", L"" }, - /* 8 */ { SCI_SETCARETLINEBACK, 63108, L"Current Line Background (Color)", L"back:#FFFF00; alpha:50", L"" }, - /* 9 */ { SCI_SETCARETFORE+SCI_SETCARETWIDTH, 63109, L"Caret (Color, Size 1-3)", L"", L"" }, - /* 10 */ { SCI_SETEDGECOLOUR, 63110, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" }, - /* 11 */ { SCI_SETEXTRAASCENT+SCI_SETEXTRADESCENT, 63111, L"Extra Line Spacing (Size)", L"size:2", L"" }, - /* 12 */ { SCI_FOLDALL+SCI_MARKERSETALPHA, 63124, L"Bookmarks and Folding (Colors)", L"fore:#000000; back:#808080; alpha:80", L"" }, - /* 13 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, 63262, L"Mark Occurrences (Indicator)", L"indic_roundbox", L"" }, - /* 14 */ { SCI_SETHOTSPOTACTIVEFORE, 63264, L"Hyperlink Hotspots", L"italic; fore:#0000FF", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -EDITLEXER lexStandard2nd = { SCLEX_NULL, 63266, L"2nd Default Text", L"txt; text; wtx; log; asc; doc", L"", &KeyWords_NULL,{ - /* 0 */ { STYLE_DEFAULT, 63112, L"2nd Default Style", L"font:Courier New; size:10", L"" }, - /* 1 */ { STYLE_LINENUMBER, 63113, L"2nd Margins and Line Numbers", L"font:Tahoma; size:-2; fore:#FF0000", L"" }, - /* 2 */ { STYLE_BRACELIGHT, 63114, L"2nd Matching Braces (Indicator)", L"fore:#00FF40; alpha:80; alpha2:220; indic_roundbox", L"" }, - /* 3 */ { STYLE_BRACEBAD, 63115, L"2nd Matching Braces Error (Indicator)", L"fore:#FF0080; alpha:140; alpha2:220; indic_roundbox", L"" }, - /* 4 */ { STYLE_CONTROLCHAR, 63116, L"2nd Control Characters (Font)", L"size:-1", L"" }, - /* 5 */ { STYLE_INDENTGUIDE, 63117, L"2nd Indentation Guide (Color)", L"fore:#A0A0A0", L"" }, - /* 6 */ { SCI_SETSELFORE + SCI_SETSELBACK, 63118, L"2nd Selected Text (Colors)", L"eolfilled", L"" }, - /* 7 */ { SCI_SETWHITESPACEFORE + SCI_SETWHITESPACEBACK + SCI_SETWHITESPACESIZE, 63119, L"2nd Whitespace (Colors, Size 0-5)", L"fore:#FF4000", L"" }, - /* 8 */ { SCI_SETCARETLINEBACK, 63120, L"2nd Current Line Background (Color)", L"back:#FFFF00; alpha:50", L"" }, - /* 9 */ { SCI_SETCARETFORE + SCI_SETCARETWIDTH, 63121, L"2nd Caret (Color, Size 1-3)", L"", L"" }, - /* 10 */ { SCI_SETEDGECOLOUR, 63122, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" }, - /* 11 */ { SCI_SETEXTRAASCENT + SCI_SETEXTRADESCENT, 63123, L"2nd Extra Line Spacing (Size)", L"", L"" }, - /* 12 */ { SCI_FOLDALL + SCI_MARKERSETALPHA, 63125, L"2nd Bookmarks and Folding (Colors)", L"fore:#000000; back:#808080; alpha:80; charset:2; case:U", L"" }, - /* 13 */ { SCI_MARKERSETBACK + SCI_MARKERSETALPHA, 63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0x000000; alpha:100; alpha2:220; indic_box", L"" }, - /* 14 */ { SCI_SETHOTSPOTACTIVEFORE, 63265, L"2nd Hyperlink Hotspots", L"bold; fore:#FF0000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -enum LexDefaultStyles { - STY_DEFAULT = 0, - STY_MARGIN = 1, - STY_BRACE_OK = 2, - STY_BRACE_BAD = 3, - STY_CTRL_CHR = 4, - STY_INDENT_GUIDE = 5, - STY_SEL_TXT = 6, - STY_WHITESPACE = 7, - STY_CUR_LN_BCK = 8, - STY_CARET = 9, - STY_LONG_LN_MRK = 10, - STY_X_LN_SPACE = 11, - STY_BOOK_MARK = 12, - STY_MARK_OCC = 13, - STY_URL_HOTSPOT = 14 -}; - - -// ---------------------------------------------------------------------------- - -KEYWORDLIST KeyWords_HTML = { -"!doctype ^aria- ^data- a abbr accept accept-charset accesskey acronym action address align alink " -"alt and applet archive area article aside async audio autocomplete autofocus autoplay axis b " -"background base basefont bb bdi bdo bgcolor big blockquote body border bordercolor br buffered button " -"canvas caption cellpadding cellspacing center challenge char charoff charset checkbox checked " -"cite class classid clear code codebase codetype col colgroup color cols colspan command compact " -"content contenteditable contextmenu controls coords crossorigin data datafld dataformatas datagrid " -"datalist datapagesize datasrc datetime dd declare default defer del details dfn dialog dir dirname " -"disabled div dl download draggable dropzone dt em embed enctype event eventsource face fieldset " -"figcaption figure file font footer for form formaction formenctype formmethod formnovalidate " -"formtarget frame frameborder frameset h1 h2 h3 h4 h5 h6 head header headers height hgroup hidden " -"high hr href hreflang hspace html http-equiv i icon id iframe image img input ins integrity isindex " -"ismap itemprop itemscope itemtype kbd keygen keytype kind label lang language leftmargin legend li link " -"list longdesc loop low main manifest map marginheight marginwidth mark max maxlength media mediagroup " -"menu menuitem meta meter method min multiple muted name nav noframes nohref noresize noscript noshade " -"novalidate nowrap object ol onabort onafterprint onbeforeprint onbeforeunload onblur oncancel oncanplay " -"oncanplaythrough onchange onclick onclose oncontextmenu oncuechange ondblclick ondrag ondragend ondragenter " -"ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange " -"onforminput onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata " -"onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel " -"onoffline ononline onpagehide onpageshow onpause onplay onplaying onpopstate onprogress " -"onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking onselect " -"onshow onstalled onstorage onsubmit onsuspend ontimeupdate onundo onunload onvolumechange " -"onwaiting open optgroup optimum option output p param password pattern ping placeholder poster " -"pre prefix preload profile progress prompt property pubdate public q radio radiogroup readonly rel " -"required reset rev reversed role rows rowspan rp rt ruby rules s samp sandbox scheme scope scoped script " -"scrolling seamless section select selected shape size sizes small source span spellcheck src " -"srcdoc srclang standby start step strike strong style sub submit summary sup tabindex table " -"target tbody td text textarea tfoot th thead time title topmargin tr track translate tt type " -"typemustmatch u ul usemap valign value valuetype var version video vlink vspace wbr width wrap xml " -"xmlns", -"abstract boolean break byte case catch char class const continue debugger default delete do " -"double else enum export extends false final finally float for function goto if implements " -"import in instanceof int interface long native new null package private protected public " -"return short static super switch synchronized this throw throws transient true try typeof var " -"void volatile while with", -"alias and as attribute begin boolean byref byte byval call case class compare const continue " -"currency date declare dim do double each else elseif empty end enum eqv erase error event exit " -"explicit false for friend function get global gosub goto if imp implement in integer is let lib " -"load long loop lset me mid mod module new next not nothing null object on option optional or " -"preserve private property public raiseevent redim rem resume return rset select set single " -"static stop string sub then to true type unload until variant wend while with withevents xor", -"", -"__callstatic __class__ __compiler_halt_offset__ __dir__ __file__ __function__ __get __halt_compiler " -"__isset __line__ __method__ __namespace__ __set __sleep __trait__ __unset __wakeup " -"abstract and argc argv array as break callable case catch cfunction class clone closure const continue " -"declare default define die directory do e_all e_compile_error e_compile_warning e_core_error e_core_warning " -"e_deprecated e_error e_fatal e_notice e_parse e_strict e_user_deprecated e_user_error e_user_notice " -"e_user_warning e_warning echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile " -"eval exception exit extends false final for foreach function global goto http_cookie_vars http_env_vars " -"http_get_vars http_post_files http_post_vars http_server_vars if implements include include_once " -"instanceof insteadof interface isset list namespace new not null old_function or parent php_self " -"print private protected public require require_once return static stdclass switch this throw trait " -"true try unset use var virtual while xor", -"", "", "", "" }; - - -EDITLEXER lexHTML = { SCLEX_HTML, 63001, L"Web Source Code", L"html; htm; asp; aspx; shtml; htd; xhtml; php; php3; phtml; htt; cfm; tpl; dtd; hta; htc", L"", &KeyWords_HTML, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_H_TAG,SCE_H_TAGEND,0,0), 63136, L"HTML Tag", L"fore:#648000", L"" }, - { SCE_H_TAGUNKNOWN, 63137, L"HTML Unknown Tag", L"fore:#C80000; back:#FFFF80", L"" }, - { SCE_H_ATTRIBUTE, 63138, L"HTML Attribute", L"fore:#FF4000", L"" }, - { SCE_H_ATTRIBUTEUNKNOWN, 63139, L"HTML Unknown Attribute", L"fore:#C80000; back:#FFFF80", L"" }, - { SCE_H_VALUE, 63140, L"HTML Value", L"fore:#3A6EA5", L"" }, - { MULTI_STYLE(SCE_H_DOUBLESTRING,SCE_H_SINGLESTRING,0,0), 63141, L"HTML String", L"fore:#3A6EA5", L"" }, - { SCE_H_OTHER, 63142, L"HTML Other Inside Tag", L"fore:#3A6EA5", L"" }, - { MULTI_STYLE(SCE_H_COMMENT,SCE_H_XCCOMMENT,0,0), 63143, L"HTML Comment", L"fore:#646464", L"" }, - { SCE_H_ENTITY, 63144, L"HTML Entity", L"fore:#B000B0", L"" }, - { SCE_H_DEFAULT, 63256, L"HTML Element Text", L"", L"" }, - { MULTI_STYLE(SCE_H_XMLSTART,SCE_H_XMLEND,0,0), 63145, L"XML Identifier", L"bold; fore:#881280", L"" }, - { SCE_H_SGML_DEFAULT, 63237, L"SGML", L"fore:#881280", L"" }, - { SCE_H_CDATA, 63147, L"CDATA", L"fore:#646464", L"" }, - { MULTI_STYLE(SCE_H_ASP,SCE_H_ASPAT,0,0), 63146, L"ASP Start Tag", L"bold; fore:#000080", L"" }, - //{ SCE_H_SCRIPT, L"Script", L"", L"" }, - { SCE_H_QUESTION, 63148, L"PHP Start Tag", L"bold; fore:#000080", L"" }, - { SCE_HPHP_DEFAULT, 63149, L"PHP Default", L"", L"" }, - { MULTI_STYLE(SCE_HPHP_COMMENT,SCE_HPHP_COMMENTLINE,0,0), 63157, L"PHP Comment", L"fore:#FF8000", L"" }, - { SCE_HPHP_WORD, 63152, L"PHP Keyword", L"bold; fore:#A46000", L"" }, - { SCE_HPHP_HSTRING, 63150, L"PHP String", L"fore:#008000", L"" }, - { SCE_HPHP_SIMPLESTRING, 63151, L"PHP Simple String", L"fore:#008000", L"" }, - { SCE_HPHP_NUMBER, 63153, L"PHP Number", L"fore:#FF0000", L"" }, - { SCE_HPHP_OPERATOR, 63158, L"PHP Operator", L"fore:#B000B0", L"" }, - { SCE_HPHP_VARIABLE, 63154, L"PHP Variable", L"italic; fore:#000080", L"" }, - { SCE_HPHP_HSTRING_VARIABLE, 63155, L"PHP String Variable", L"italic; fore:#000080", L"" }, - { SCE_HPHP_COMPLEX_VARIABLE, 63156, L"PHP Complex Variable", L"italic; fore:#000080", L"" }, - { MULTI_STYLE(SCE_HJ_DEFAULT,SCE_HJ_START,0,0), 63159, L"JS Default", L"", L"" }, - { MULTI_STYLE(SCE_HJ_COMMENT,SCE_HJ_COMMENTLINE,SCE_HJ_COMMENTDOC,0), 63160, L"JS Comment", L"fore:#646464", L"" }, - { SCE_HJ_KEYWORD, 63163, L"JS Keyword", L"bold; fore:#A46000", L"" }, - { SCE_HJ_WORD, 63162, L"JS Identifier", L"", L"" }, - { MULTI_STYLE(SCE_HJ_DOUBLESTRING,SCE_HJ_SINGLESTRING,SCE_HJ_STRINGEOL,0), 63164, L"JS String", L"fore:#008000", L"" }, - { SCE_HJ_REGEX, 63166, L"JS Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_HJ_NUMBER, 63161, L"JS Number", L"fore:#FF0000", L"" }, - { SCE_HJ_SYMBOLS, 63165, L"JS Symbols", L"fore:#B000B0", L"" }, - { MULTI_STYLE(SCE_HJA_DEFAULT,SCE_HJA_START,0,0), 63167, L"ASP JS Default", L"", L"" }, - { MULTI_STYLE(SCE_HJA_COMMENT,SCE_HJA_COMMENTLINE,SCE_HJA_COMMENTDOC,0), 63168, L"ASP JS Comment", L"fore:#646464", L"" }, - { SCE_HJA_KEYWORD, 63171, L"ASP JS Keyword", L"bold; fore:#A46000", L"" }, - { SCE_HJA_WORD, 63170, L"ASP JS Identifier", L"", L"" }, - { MULTI_STYLE(SCE_HJA_DOUBLESTRING,SCE_HJA_SINGLESTRING,SCE_HJA_STRINGEOL,0), 63172, L"ASP JS String", L"fore:#008000", L"" }, - { SCE_HJA_REGEX, 63174, L"ASP JS Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_HJA_NUMBER, 63169, L"ASP JS Number", L"fore:#FF0000", L"" }, - { SCE_HJA_SYMBOLS, 63173, L"ASP JS Symbols", L"fore:#B000B0", L"" }, - { MULTI_STYLE(SCE_HB_DEFAULT,SCE_HB_START,0,0), 63175, L"VBS Default", L"", L"" }, - { SCE_HB_COMMENTLINE, 63176, L"VBS Comment", L"fore:#646464", L"" }, - { SCE_HB_WORD, 63178, L"VBS Keyword", L"bold; fore:#B000B0", L"" }, - { SCE_HB_IDENTIFIER, 63180, L"VBS Identifier", L"", L"" }, - { MULTI_STYLE(SCE_HB_STRING,SCE_HB_STRINGEOL,0,0), 63179, L"VBS String", L"fore:#008000", L"" }, - { SCE_HB_NUMBER, 63177, L"VBS Number", L"fore:#FF0000", L"" }, - { MULTI_STYLE(SCE_HBA_DEFAULT,SCE_HBA_START,0,0), 63181, L"ASP VBS Default", L"", L"" }, - { SCE_HBA_COMMENTLINE, 63182, L"ASP VBS Comment", L"fore:#646464", L"" }, - { SCE_HBA_WORD, 63184, L"ASP VBS Keyword", L"bold; fore:#B000B0", L"" }, - { SCE_HBA_IDENTIFIER, 63186, L"ASP VBS Identifier", L"", L"" }, - { MULTI_STYLE(SCE_HBA_STRING,SCE_HBA_STRINGEOL,0,0), 63185, L"ASP VBS String", L"fore:#008000", L"" }, - { SCE_HBA_NUMBER, 63183, L"ASP VBS Number", L"fore:#FF0000", L"" }, - //{ SCE_HP_START, L"Phyton Start", L"", L"" }, - //{ SCE_HP_DEFAULT, L"Phyton Default", L"", L"" }, - //{ SCE_HP_COMMENTLINE, L"Phyton Comment Line", L"", L"" }, - //{ SCE_HP_NUMBER, L"Phyton Number", L"", L"" }, - //{ SCE_HP_STRING, L"Phyton String", L"", L"" }, - //{ SCE_HP_CHARACTER, L"Phyton Character", L"", L"" }, - //{ SCE_HP_WORD, L"Phyton Keyword", L"", L"" }, - //{ SCE_HP_TRIPLE, L"Phyton Triple", L"", L"" }, - //{ SCE_HP_TRIPLEDOUBLE, L"Phyton Triple Double", L"", L"" }, - //{ SCE_HP_CLASSNAME, L"Phyton Class Name", L"", L"" }, - //{ SCE_HP_DEFNAME, L"Phyton Def Name", L"", L"" }, - //{ SCE_HP_OPERATOR, L"Phyton Operator", L"", L"" }, - //{ SCE_HP_IDENTIFIER, L"Phyton Identifier", L"", L"" }, - //{ SCE_HPA_START, L"ASP Phyton Start", L"", L"" }, - //{ SCE_HPA_DEFAULT, L"ASP Phyton Default", L"", L"" }, - //{ SCE_HPA_COMMENTLINE, L"ASP Phyton Comment Line", L"", L"" }, - //{ SCE_HPA_NUMBER, L"ASP Phyton Number", L"", L"" }, - //{ SCE_HPA_STRING, L"ASP Phyton String", L"", L"" }, - //{ SCE_HPA_CHARACTER, L"ASP Phyton Character", L"", L"" }, - //{ SCE_HPA_WORD, L"ASP Phyton Keyword", L"", L"" }, - //{ SCE_HPA_TRIPLE, L"ASP Phyton Triple", L"", L"" }, - //{ SCE_HPA_TRIPLEDOUBLE, L"ASP Phyton Triple Double", L"", L"" }, - //{ SCE_HPA_CLASSNAME, L"ASP Phyton Class Name", L"", L"" }, - //{ SCE_HPA_DEFNAME, L"ASP Phyton Def Name", L"", L"" }, - //{ SCE_HPA_OPERATOR, L"ASP Phyton Operator", L"", L"" }, - //{ SCE_HPA_IDENTIFIER, L"ASP Phyton Identifier", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_XML = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexXML = { SCLEX_XML, 63002, L"XML Document", L"xml; xsl; rss; svg; xul; xsd; xslt; axl; rdf; xaml; vcproj", L"", &KeyWords_XML, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_H_TAG,SCE_H_TAGUNKNOWN,SCE_H_TAGEND,0), 63187, L"XML Tag", L"fore:#881280", L"" }, - { MULTI_STYLE(SCE_H_ATTRIBUTE,SCE_H_ATTRIBUTEUNKNOWN,0,0), 63188, L"XML Attribute", L"fore:#994500", L"" }, - { SCE_H_VALUE, 63189, L"XML Value", L"fore:#1A1AA6", L"" }, - { MULTI_STYLE(SCE_H_DOUBLESTRING,SCE_H_SINGLESTRING,0,0), 63190, L"XML String", L"fore:#1A1AA6", L"" }, - { SCE_H_OTHER, 63191, L"XML Other Inside Tag", L"fore:#1A1AA6", L"" }, - { MULTI_STYLE(SCE_H_COMMENT,SCE_H_XCCOMMENT,0,0), 63192, L"XML Comment", L"fore:#646464", L"" }, - { SCE_H_ENTITY, 63193, L"XML Entity", L"fore:#B000B0", L"" }, - { SCE_H_DEFAULT, 63257, L"XML Element Text", L"", L"" }, - { MULTI_STYLE(SCE_H_XMLSTART,SCE_H_XMLEND,0,0), 63145, L"XML Identifier", L"bold; fore:#881280", L"" }, - { SCE_H_SGML_DEFAULT, 63237, L"SGML", L"fore:#881280", L"" }, - { SCE_H_CDATA, 63147, L"CDATA", L"fore:#646464", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_CSS = { -"align-content align-items align-self alignment-adjust alignment-baseline animation animation-delay " -"animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name " -"animation-play-state animation-timing-function appearance ascent azimuth backface-visibility " -"background background-attachment background-blend-mode background-break background-clip background-color " -"background-image background-origin background-position background-repeat background-size " -"baseline baseline-shift bbox binding bleed bookmark-label bookmark-level bookmark-state " -"bookmark-target border border-bottom border-bottom-color border-bottom-left-radius " -"border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color " -"border-image border-image-outset border-image-repeat border-image-slice border-image-source " -"border-image-width border-left border-left-color border-left-style border-left-width " -"border-length border-radius border-right border-right-color border-right-style " -"border-right-width border-spacing border-style border-top border-top-color " -"border-top-left-radius border-top-right-radius border-top-style border-top-width border-width " -"bottom box-align box-decoration-break box-direction box-flex box-flex-group box-lines " -"box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before " -"break-inside cap-height caption-side centerline change-bar change-bar-class change-bar-offset " -"change-bar-side clear clip clip-path clip-rule color color-profile column-count column-fill column-gap " -"column-rule column-rule-color column-rule-style column-rule-width columns column-span column-width " -"content counter-increment counter-reset crop cue cue-after cue-before cursor definition-src descent " -"direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align " -"drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value " -"elevation empty-cells fill fit fit-position flex flex-basis flex-direction flex-flow flex-grow flex-shrink " -"flex-wrap float float-offset flow-from flow-into font font-family font-feature-settings font-kerning font-size " -"font-size-adjust font-stretch font-style font-synthesis font-variant font-weight grid-columns grid-rows " -"hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-limit-chars " -"hyphenate-limit-last hyphenate-limit-zone hyphenate-lines hyphenate-resource hyphens icon image-orientation " -"image-resolution ime-mode inline-box-align insert-position interpret-as justify-content left letter-spacing " -"line-height line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy list-style " -"list-style-image list-style-position list-style-type make-element margin margin-bottom margin-left " -"margin-right margin-top mark mark-after mark-before marker-offset marks marquee-direction marquee-play-count " -"marquee-speed marquee-style mask mask-type mathline max-height max-width media min-height min-width " -"move-to nav-down nav-index nav-left nav-right nav-up object-fit object-position opacity order orphans " -"outline outline-color outline-offset outline-style outline-width overflow overflow-style overflow-wrap " -"overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after " -"page-break-before page-break-inside page-policy panose-1 pause pause-after pause-before perspective " -"perspective-origin phonemes pitch pitch-range play-during pointer-events position presentation-level prototype " -"prototype-insert-policy prototype-insert-position punctuation-trim quotes region-overflow " -"rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align " -"ruby-overhang ruby-position ruby-span shape-image-threshold shape-inside shape-outside size slope speak " -"speak-header speak-numeral speak-punctuation speech-rate src stemh stemv stress string-set tab-size table-layout " -"target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color " -"text-decoration-line text-decoration-style text-emphasis text-height text-indent text-justify text-outline " -"text-overflow text-rendering text-replace text-shadow text-transform text-underline-position text-wrap top topline " -"transform transform-origin transform-style transition transition-delay transition-duration transition-property " -"transition-timing-function unicode-bidi unicode-range units-per-em vertical-align visibility " -"voice-balance voice-duration voice-family voice-pitch voice-pitch-range voice-rate voice-stress " -"voice-volume volume white-space white-space-collapse widows width widths will-change word-break word-spacing " -"word-wrap wrap wrap-flow wrap-margin wrap-padding wrap-through writing-mode x-height z-index", -"active after before checked choices default disabled empty enabled first first-child first-letter " -"first-line first-of-type focus hover indeterminate in-range invalid lang last-child last-of-type left " -"link not nth-child nth-last-child nth-last-of-type nth-of-type only-child only-of-type optional " -"out-of-range read-only read-write repeat-index repeat-item required right root target valid visited", -"", "", -"after before first-letter first-line selection", -"^-moz- ^-ms- ^-o- ^-webkit-", -"^-moz- ^-ms- ^-o- ^-webkit-", -"^-moz- ^-ms- ^-o- ^-webkit-", -"" }; - - -EDITLEXER lexCSS = { SCLEX_CSS, 63003, L"CSS Style Sheets", L"css; less; sass; scss", L"", &KeyWords_CSS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_CSS_DEFAULT, 63126, L"CSS Default", L"", L"" }, - { SCE_CSS_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_CSS_TAG, 63136, L"HTML Tag", L"bold; fore:#0A246A", L"" }, - { SCE_CSS_CLASS, 63194, L"Tag-Class", L"fore:#648000", L"" }, - { SCE_CSS_ID, 63195, L"Tag-ID", L"fore:#648000", L"" }, - { SCE_CSS_ATTRIBUTE, 63196, L"Tag-Attribute", L"italic; fore:#648000", L"" }, - { MULTI_STYLE(SCE_CSS_PSEUDOCLASS,SCE_CSS_EXTENDED_PSEUDOCLASS,0,0), 63197, L"Pseudo-Class", L"fore:#B000B0", L"" }, - { MULTI_STYLE(SCE_CSS_PSEUDOELEMENT,SCE_CSS_EXTENDED_PSEUDOELEMENT,0,0), 63361, L"Pseudo-Element", L"fore:#B00050", L"" }, - { MULTI_STYLE(SCE_CSS_IDENTIFIER,SCE_CSS_IDENTIFIER2,SCE_CSS_IDENTIFIER3,SCE_CSS_EXTENDED_IDENTIFIER), 63199, L"CSS Property", L"fore:#FF4000", L"" }, - { MULTI_STYLE(SCE_CSS_DOUBLESTRING,SCE_CSS_SINGLESTRING,0,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_CSS_VALUE, 63201, L"Value", L"fore:#3A6EA5", L"" }, - { SCE_CSS_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_CSS_IMPORTANT, 63202, L"Important", L"bold; fore:#C80000", L"" }, - { SCE_CSS_DIRECTIVE, 63203, L"Directive", L"bold; fore:#000000; back:#FFF1A8", L"" }, - { SCE_CSS_MEDIA, 63382, L"Media", L"bold; fore:#0A246A", L"" }, - { SCE_CSS_VARIABLE, 63249, L"Variable", L"bold; fore:#FF4000", L"" }, - { SCE_CSS_UNKNOWN_PSEUDOCLASS, 63198, L"Unknown Pseudo-Class", L"fore:#C80000; back:#FFFF80", L"" }, - { SCE_CSS_UNKNOWN_IDENTIFIER, 63200, L"Unknown Property", L"fore:#C80000; back:#FFFF80", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_CPP = { - // Primary keywords - "alignas auto bool break case catch char char16_t char32_t class const constexpr const_cast " - "continue decltype default delete do double dynamic_cast else enum explicit export extern false float " - "for friend goto if inline int long mutable namespace new noexcept nullptr operator " - "private protected public register reinterpret_cast restrict return short signed sizeof static " - "static_assert static_cast struct switch template this thread_local throw true try typedef typeid typename " - "union unsigned using virtual void volatile wchar_t while " - "alignof defined naked noreturn", - // Secondary keywords - "asm __abstract __alignof __asm __assume __based __box __cdecl __declspec __delegate __event " - "__except __except__try __fastcall __finally __forceinline __gc __hook __identifier " - "__if_exists __if_not_exists __inline __interface __leave " - "__multiple_inheritance __nogc __noop __pin __property __raise " - "__sealed __single_inheritance __stdcall __super __try __try_cast __unhook __uuidof __value " - "__virtual_inheritance", - // Documentation comment keywords - "", - // Global classes and typedefs - "complex imaginary int8_t int16_t int32_t int64_t intptr_t intmax_t ptrdiff_t size_t " - "uint8_t uint16_t uint32_t uint64_t uintptr_t uintmax_t" - "__int16 __int32 __int64 __int8 __m128 __m128d __m128i __m64 __wchar_t " - "_Alignas _Alignof _Atomic _Bool _Complex _Generic _Imaginary _Noreturn _Pragma _Static_assert _Thread_local", - // Preprocessor definitions - "DEBUG NDEBUG UNICODE _DEBUG _UNICODE _MSC_VER", - // Task marker and error marker keywords - "", - "", - "", - "" -}; - -EDITLEXER lexCPP = { SCLEX_CPP, 63004, L"C/C++ Source Code", L"c; cpp; cxx; cc; h; hpp; hxx; hh; m; mm; idl; inl; odl", L"", &KeyWords_CPP, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_C_WORD2, 63260, L"Keyword 2nd", L"bold; italic; fore:#3C6CDD", L"" }, - { SCE_C_GLOBALCLASS, 63258, L"Typedefs/Classes", L"bold; italic; fore:#800000", L"" }, - { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { MULTI_STYLE(SCE_C_PREPROCESSOR,SCE_C_PREPROCESSORCOMMENT,SCE_C_PREPROCESSORCOMMENTDOC,0), 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - //{ SCE_C_UUID, L"UUID", L"", L"" }, - //{ SCE_C_REGEX, L"Regex", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_CS = { -"abstract add alias as ascending async await base bool break by byte case catch char checked " -"class const continue decimal default delegate descending do double dynamic else " -"enum equals event explicit extern false finally fixed float for foreach from get " -"global goto group if implicit in int interface internal into is join lock let long " -"namespace new null object on operator orderby out override params partial private " -"protected public readonly ref remove return sbyte sealed select set short sizeof " -"stackalloc static string struct switch this throw true try typeof uint ulong " -"unchecked unsafe ushort using value var virtual void volatile where while yield", -"", "", -"AccessViolationException Action ActivationContext Activator AggregateException AppDomain " -"AppDomainInitializer AppDomainManager AppDomainManagerInitializationOptions AppDomainSetup " -"AppDomainUnloadedException ApplicationException ApplicationId ApplicationIdentity ArgIterator " -"ArgumentException ArgumentNullException ArgumentOutOfRangeException ArithmeticException Array " -"ArrayList ArraySegment ArrayTypeMismatchException AssemblyLoadEventArgs " -"AssemblyLoadEventHandler AsyncCallback Attribute AttributeTargets AttributeUsage " -"AttributeUsageAttribute BadImageFormatException Base64FormattingOptions BinaryReader " -"BinaryWriter BitArray BitConverter BlockingCollection Boolean Buffer BufferedStream " -"Byte CannotUnloadAppDomainException CaseInsensitiveComparer CaseInsensitiveHashCodeProvider " -"Char CharEnumerator CLSCompliant CLSCompliantAttribute CollectionBase CollectionDataContract " -"CollectionDataContractAttribute Color Comparer Comparison ConcurrentBag ConcurrentDictionary " -"ConcurrentQueue ConcurrentStack ConformanceLevel Console ConsoleCancelEventArgs " -"ConsoleCancelEventHandler ConsoleColor ConsoleKey ConsoleKeyInfo ConsoleModifiers " -"ConsoleSpecialKey ContextBoundObject ContextMarshalException ContextStatic " -"ContextStaticAttribute ContractNamespace ContractNamespaceAttribute Convert Converter " -"CrossAppDomainDelegate DataContract DataContractAttribute DataContractResolver " -"DataContractSerializer DataMember DataMemberAttribute DataMisalignedException DateTime " -"DateTimeKind DateTimeOffset DayOfWeek DBNull Decimal Delegate Dictionary DictionaryBase " -"DictionaryEntry Directory DirectoryInfo DirectoryNotFoundException DivideByZeroException " -"DllNotFoundException Double DriveInfo DriveNotFoundException DriveType DtdProcessing " -"DuplicateWaitObjectException EndOfStreamException EntityHandling EntryPointNotFoundException " -"Enum EnumMember EnumMemberAttribute Environment EnvironmentVariableTarget EqualityComparer " -"ErrorEventArgs ErrorEventHandler EventArgs EventHandler Exception ExecutionEngineException " -"ExportOptions ExtensionDataObject FieldAccessException File FileAccess FileAttributes " -"FileFormatException FileInfo FileLoadException FileMode FileNotFoundException FileOptions " -"FileShare FileStream FileStyleUriParser FileSystemEventArgs FileSystemEventHandler " -"FileSystemInfo FileSystemWatcher Flags FlagsAttribute FormatException Formatter " -"FormatterConverter FormatterServices Formatting FtpStyleUriParser Func GC GCCollectionMode " -"GCNotificationStatus GenericUriParser GenericUriParserOptions GopherStyleUriParser Guid " -"HandleInheritability HashSet Hashtable HttpStyleUriParser IAppDomainSetup IAsyncResult " -"ICloneable ICollection IComparable IComparer IConvertible ICustomFormatter " -"IDataContractSurrogate IDeserializationCallback IDictionary IDictionaryEnumerator IDisposable " -"IEnumerable IEnumerator IEqualityComparer IEquatable IExtensibleDataObject IFormatProvider " -"IFormattable IFormatter IFormatterConverter IFragmentCapableXmlDictionaryWriter " -"IgnoreDataMember IgnoreDataMemberAttribute IHashCodeProvider IHasXmlNode IList ImportOptions " -"IndexOutOfRangeException InsufficientExecutionStackException InsufficientMemoryException Int16 " -"Int32 Int64 InternalBufferOverflowException IntPtr InvalidCastException " -"InvalidDataContractException InvalidDataException InvalidOperationException " -"InvalidProgramException InvalidTimeZoneException IObjectReference IObservable IObserver " -"IODescription IODescriptionAttribute IOException IProducerConsumerCollection " -"ISafeSerializationData ISerializable ISerializationSurrogate IServiceProvider ISet " -"IStreamProvider IStructuralComparable IStructuralEquatable ISurrogateSelector " -"IXmlBinaryReaderInitializer IXmlBinaryWriterInitializer IXmlDictionary IXmlLineInfo " -"IXmlMtomReaderInitializer IXmlMtomWriterInitializer IXmlNamespaceResolver IXmlSchemaInfo " -"IXmlTextReaderInitializer IXmlTextWriterInitializer IXPathNavigable IXsltContextFunction " -"IXsltContextVariable KeyedByTypeCollection KeyNotFoundException KeyValuePair KnownType " -"KnownTypeAttribute Lazy LdapStyleUriParser LinkedList LinkedListNode List LoaderOptimization " -"LoaderOptimizationAttribute LoadOptions LocalDataStoreSlot MarshalByRefObject Math " -"MemberAccessException MemoryStream MethodAccessException MidpointRounding " -"MissingFieldException MissingMemberException MissingMethodException ModuleHandle MTAThread " -"MTAThreadAttribute MulticastDelegate MulticastNotSupportedException NamespaceHandling " -"NameTable NetDataContractSerializer NetPipeStyleUriParser NetTcpStyleUriParser " -"NewLineHandling NewsStyleUriParser NonSerialized NonSerializedAttribute " -"NotFiniteNumberException NotifyFilters NotImplementedException NotSupportedException Nullable " -"NullReferenceException Object ObjectDisposedException ObjectIDGenerator ObjectManager Obsolete " -"ObsoleteAttribute OnDeserialized OnDeserializedAttribute OnDeserializing " -"OnDeserializingAttribute OnSerialized OnSerializedAttribute OnSerializing " -"OnSerializingAttribute OnXmlDictionaryReaderClose OperatingSystem OperationCanceledException " -"OptionalField OptionalFieldAttribute OrderablePartitioner OutOfMemoryException " -"OverflowException ParamArray ParamArrayAttribute Partitioner Path PathTooLongException " -"PipeException PlatformID PlatformNotSupportedException Predicate Queue Random RankException " -"ReaderOptions ReadOnlyCollectionBase ReadState RenamedEventArgs RenamedEventHandler " -"ResolveEventArgs ResolveEventHandler RuntimeArgumentHandle RuntimeFieldHandle " -"RuntimeMethodHandle RuntimeTypeHandle SafeSerializationEventArgs SaveOptions SByte " -"SearchOption SeekOrigin Serializable SerializableAttribute SerializationBinder " -"SerializationEntry SerializationException SerializationInfo SerializationInfoEnumerator " -"SerializationObjectManager Single SortedDictionary SortedList SortedSet Stack " -"StackOverflowException STAThread STAThreadAttribute Stream StreamingContext " -"StreamingContextStates StreamReader StreamWriter String StringBuilder StringComparer StringComparison " -"StringReader StringSplitOptions StringWriter StructuralComparisons SurrogateSelector " -"SynchronizedCollection SynchronizedKeyedCollection SynchronizedReadOnlyCollection " -"SystemException TextReader TextWriter ThreadStatic ThreadStaticAttribute TimeoutException " -"TimeSpan TimeZone TimeZoneInfo TimeZoneNotFoundException Tuple Type TypeAccessException " -"TypeCode TypedReference TypeInitializationException TypeLoadException TypeUnloadedException " -"UInt16 UInt32 UInt64 UIntPtr UnauthorizedAccessException UnhandledExceptionEventArgs " -"UnhandledExceptionEventHandler UniqueId UnmanagedMemoryAccessor UnmanagedMemoryStream Uri " -"UriBuilder UriComponents UriFormat UriFormatException UriHostNameType UriIdnScope UriKind " -"UriParser UriPartial UriTemplate UriTemplateEquivalenceComparer UriTemplateMatch " -"UriTemplateMatchException UriTemplateTable UriTypeConverter ValidationEventArgs " -"ValidationEventHandler ValidationType ValueType Version Void WaitForChangedResult " -"WatcherChangeTypes WeakReference WhitespaceHandling WriteState XAttribute XCData XComment " -"XContainer XDeclaration XDocument XDocumentType XElement XmlAtomicValue XmlAttribute " -"XmlAttributeCollection XmlBinaryReaderSession XmlBinaryWriterSession XmlCaseOrder " -"XmlCDataSection XmlCharacterData XmlComment XmlConvert XmlDataDocument XmlDataType " -"XmlDateTimeSerializationMode XmlDeclaration XmlDictionary XmlDictionaryReader " -"XmlDictionaryReaderQuotas XmlDictionaryString XmlDictionaryWriter XmlDocument " -"XmlDocumentFragment XmlDocumentType XmlElement XmlEntity XmlEntityReference XmlException " -"XmlImplementation XmlLinkedNode XmlNamedNodeMap XmlNamespaceManager XmlNamespaceScope " -"XmlNameTable XmlNode XmlNodeChangedAction XmlNodeChangedEventArgs XmlNodeChangedEventHandler " -"XmlNodeList XmlNodeOrder XmlNodeReader XmlNodeType XmlNotation XmlObjectSerializer " -"XmlOutputMethod XmlParserContext XmlProcessingInstruction XmlQualifiedName XmlReader " -"XmlReaderSettings XmlResolver XmlSchema XmlSchemaAll XmlSchemaAnnotated XmlSchemaAnnotation " -"XmlSchemaAny XmlSchemaAnyAttribute XmlSchemaAppInfo XmlSchemaAttribute XmlSchemaAttributeGroup " -"XmlSchemaAttributeGroupRef XmlSchemaChoice XmlSchemaCollection XmlSchemaCollectionEnumerator " -"XmlSchemaCompilationSettings XmlSchemaComplexContent XmlSchemaComplexContentExtension " -"XmlSchemaComplexContentRestriction XmlSchemaComplexType XmlSchemaContent XmlSchemaContentModel " -"XmlSchemaContentProcessing XmlSchemaContentType XmlSchemaDatatype XmlSchemaDatatypeVariety " -"XmlSchemaDerivationMethod XmlSchemaDocumentation XmlSchemaElement XmlSchemaEnumerationFacet " -"XmlSchemaException XmlSchemaExternal XmlSchemaFacet XmlSchemaForm XmlSchemaFractionDigitsFacet " -"XmlSchemaGroup XmlSchemaGroupBase XmlSchemaGroupRef XmlSchemaIdentityConstraint " -"XmlSchemaImport XmlSchemaInclude XmlSchemaInference XmlSchemaInference.InferenceOption " -"XmlSchemaInferenceException XmlSchemaInfo XmlSchemaKey XmlSchemaKeyref XmlSchemaLengthFacet " -"XmlSchemaMaxExclusiveFacet XmlSchemaMaxInclusiveFacet XmlSchemaMaxLengthFacet " -"XmlSchemaMinExclusiveFacet XmlSchemaMinInclusiveFacet XmlSchemaMinLengthFacet " -"XmlSchemaNotation XmlSchemaNumericFacet XmlSchemaObject XmlSchemaObjectCollection " -"XmlSchemaObjectEnumerator XmlSchemaObjectTable XmlSchemaParticle XmlSchemaPatternFacet " -"XmlSchemaRedefine XmlSchemaSequence XmlSchemaSet XmlSchemaSimpleContent " -"XmlSchemaSimpleContentExtension XmlSchemaSimpleContentRestriction XmlSchemaSimpleType " -"XmlSchemaSimpleTypeContent XmlSchemaSimpleTypeList XmlSchemaSimpleTypeRestriction " -"XmlSchemaSimpleTypeUnion XmlSchemaTotalDigitsFacet XmlSchemaType XmlSchemaUnique " -"XmlSchemaUse XmlSchemaValidationException XmlSchemaValidationFlags XmlSchemaValidator " -"XmlSchemaValidity XmlSchemaWhiteSpaceFacet XmlSchemaXPath XmlSecureResolver " -"XmlSerializableServices XmlSeverityType XmlSignificantWhitespace XmlSortOrder XmlSpace " -"XmlText XmlTextReader XmlTextWriter XmlTokenizedType XmlTypeCode XmlUrlResolver " -"XmlValidatingReader XmlValueGetter XmlWhitespace XmlWriter XmlWriterSettings XName " -"XNamespace XNode XNodeDocumentOrderComparer XNodeEqualityComparer XObject XObjectChange " -"XObjectChangeEventArgs XPathDocument XPathException XPathExpression XPathItem " -"XPathNamespaceScope XPathNavigator XPathNodeIterator XPathNodeType XPathQueryGenerator " -"XPathResultType XProcessingInstruction XsdDataContractExporter XsdDataContractImporter " -"XslCompiledTransform XsltArgumentList XsltCompileException XsltContext XsltException " -"XsltMessageEncounteredEventArgs XsltMessageEncounteredEventHandler XslTransform XsltSettings " -"XStreamingElement XText", -"", "", "", "", "" }; - - -EDITLEXER lexCS = { SCLEX_CPP, 63005, L"C# Source Code", L"cs", L"", &KeyWords_CS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"C Default", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_VERBATIM, 63134, L"Verbatim String", L"fore:#008000", L"" }, - { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_C_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - //{ SCE_C_UUID, L"UUID", L"", L"" }, - //{ SCE_C_REGEX, L"Regex", L"", L"" }, - //{ SCE_C_WORD2, L"Word 2", L"", L"" }, - { SCE_C_GLOBALCLASS, 63337, L"Global Class", L"fore:#2B91AF", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_RC = { -"ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON " -"BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX " -"CLASS COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG " -"DIALOGEX DISCARDABLE EDITTEXT END EXSTYLE FONT GROUPBOX " -"ICON LANGUAGE LISTBOX LTEXT MENU MENUEX MENUITEM " -"MESSAGETABLE POPUP PUSHBUTTON RADIOBUTTON RCDATA RTEXT " -"SCROLLBAR SEPARATOR SHIFT STATE3 STRINGTABLE STYLE " -"TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexRC = { SCLEX_CPP, 63006, L"Resource Script", L"rc; rc2; rct; rh; r; dlg", L"", &KeyWords_RC, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#0A246A", L"" }, - { SCE_C_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - //{ SCE_C_UUID, L"UUID", L"", L"" }, - //{ SCE_C_REGEX, L"Regex", L"", L"" }, - //{ SCE_C_WORD2, L"Word 2", L"", L"" }, - //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_MAK = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexMAK = { SCLEX_MAKEFILE, 63007, L"Makefiles", L"mak; make; mk; dsp; msc; msvc", L"", &KeyWords_MAK, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_MAKE_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_MAKE_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_MAKE_IDENTIFIER,SCE_MAKE_IDEOL,0,0), 63129, L"Identifier", L"fore:#003CE6", L"" }, - { SCE_MAKE_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_MAKE_TARGET, 63204, L"Target", L"fore:#003CE6; back:#FFC000", L"" }, - { SCE_MAKE_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_VBS = { -"alias and as attribute begin boolean byref byte byval call case class compare const continue " -"currency date declare dim do double each else elseif empty end enum eqv erase error event exit " -"explicit false for friend function get global gosub goto if imp implement in integer is let lib " -"load long loop lset me mid mod module new next not nothing null object on option optional or " -"preserve private property public raiseevent redim rem resume return rset select set single " -"static stop string sub then to true type unload until variant wend while with withevents xor", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexVBS = { SCLEX_VBSCRIPT, 63008, L"VBScript", L"vbs; dsm", L"", &KeyWords_VBS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_B_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_B_COMMENT, 63127, L"Comment", L"fore:#808080", L"" }, - { SCE_B_KEYWORD, 63128, L"Keyword", L"bold; fore:#B000B0", L"" }, - { SCE_B_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_B_STRING,SCE_B_STRINGEOL,0,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_B_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_B_OPERATOR, 63132, L"Operator", L"", L"" }, - //{ SCE_B_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF9C00", L"" }, - //{ SCE_B_CONSTANT, L"Constant", L"", L"" }, - //{ SCE_B_DATE, L"Date", L"", L"" }, - //{ SCE_B_KEYWORD2, L"Keyword 2", L"", L"" }, - //{ SCE_B_KEYWORD3, L"Keyword 3", L"", L"" }, - //{ SCE_B_KEYWORD4, L"Keyword 4", L"", L"" }, - //{ SCE_B_ASM, L"Inline Asm", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_VB = { -"addhandler addressof alias and andalso ansi any as assembly auto boolean byref byte byval call " -"case catch cbool cbyte cchar cdate cdbl cdec char cint class clng cobj compare const cshort csng " -"cstr ctype date decimal declare default delegate dim directcast do double each else elseif end " -"enum erase error event exit explicit externalsource false finally for friend function get " -"gettype gosub goto handles if implements imports in inherits integer interface is let lib like " -"long loop me mid mod module mustinherit mustoverride mybase myclass namespace new next not " -"nothing notinheritable notoverridable object on option optional or orelse overloads overridable " -"overrides paramarray preserve private property protected public raiseevent randomize readonly " -"redim rem removehandler resume return select set shadows shared short single static step stop " -"strict string structure sub synclock then throw to true try typeof unicode until variant when " -"while with withevents writeonly xor", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexVB = { SCLEX_VB, 63009, L"Visual Basic", L"vb; bas; frm; cls; ctl; pag; dsr; dob", L"", &KeyWords_VB, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_B_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_B_COMMENT, 63127, L"Comment", L"fore:#808080", L"" }, - { SCE_B_KEYWORD, 63128, L"Keyword", L"bold; fore:#B000B0", L"" }, - { SCE_B_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_B_STRING,SCE_B_STRINGEOL,0,0), 63131, L"String", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_B_NUMBER,SCE_B_DATE,0,0), 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_B_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_B_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF9C00", L"" }, - //{ SCE_B_CONSTANT, L"Constant", L"", L"" }, - //{ SCE_B_KEYWORD2, L"Keyword 2", L"", L"" }, - //{ SCE_B_KEYWORD3, L"Keyword 3", L"", L"" }, - //{ SCE_B_KEYWORD4, L"Keyword 4", L"", L"" }, - //{ SCE_B_ASM, L"Inline Asm", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_JS = { -"abstract boolean break byte case catch char class const continue debugger default delete do " -"double else enum export extends false final finally float for function goto if implements " -"import in instanceof int interface let long native new null package private protected public " -"return short static super switch synchronized this throw throws transient true try typeof var " -"void volatile while with", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexJS = { SCLEX_CPP, 63010, L"JavaScript", L"js; jse; jsm; as", L"", &KeyWords_JS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - //{ SCE_C_UUID, L"UUID", L"", L"" }, - //{ SCE_C_PREPROCESSOR, L"Preprocessor", L"fore:#FF8000", L"" }, - //{ SCE_C_WORD2, L"Word 2", L"", L"" }, - //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_JSON = { -"false true null", -"@id @context @type @value @language @container @list @set @reverse @index @base @vocab @graph", -"", "", "", "", "", "", "" }; - - -EDITLEXER lexJSON = { SCLEX_JSON, 63029, L"JSON", L"json; eslintrc; jshintrc; jsonld", L"", &KeyWords_JSON, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_JSON_STRING, 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_JSON_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { -1, 00000, L"", L"", L"" } } }; - -/* -# String -style.json.2=fore:#7F0000 -# Unclosed string SCE_JSON_STRINGEOL -style.json.3=fore:#FFFFFF,back:#FF0000,eolfilled -# Property name SCE_JSON_PROPERTYNAME -style.json.4=fore:#880AE8 -# Escape sequence SCE_JSON_ESCAPESEQUENCE -style.json.5=fore:#0B982E -# Line comment SCE_JSON_LINECOMMENT -style.json.6=fore:#05BBAE,italic -# Block comment SCE_JSON_BLOCKCOMMENT -style.json.7=$(style.json.6) -# Operator SCE_JSON_OPERATOR -style.json.8=fore:#18644A -# URL/IRI SCE_JSON_URI -style.json.9=fore:#0000FF -# JSON-LD compact IRI SCE_JSON_COMPACTIRI -style.json.10=fore:#D137C1 -# JSON keyword SCE_JSON_KEYWORD -style.json.11=fore:#0BCEA7,bold -# JSON-LD keyword SCE_JSON_LDKEYWORD -style.json.12=fore:#EC2806 -# Parsing error SCE_JSON_ERROR -style.json.13=fore:#FFFFFF,back:#FF0000 -*/ - -KEYWORDLIST KeyWords_JAVA = { -"@interface abstract assert boolean break byte case catch char class const " -"continue default do double else enum extends final finally float for future " -"generic goto if implements import inner instanceof int interface long " -"native new null outer package private protected public rest return " -"short static super switch synchronized this throw throws transient try " -"var void volatile while " -"@Deprecated @Documented @FlaskyTest @Inherited @JavascriptInterface " -"@LargeTest @MediumTest @Override @Retention " -"@SmallTest @Smoke @Supress @SupressLint @SupressWarnings @Target @TargetApi " -"@TestTarget @TestTargetClass @UiThreadTest", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexJAVA = { SCLEX_CPP, 63011, L"Java Source Code", L"java", L"", &KeyWords_JAVA, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, - { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, - { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - //{ SCE_C_UUID, L"UUID", L"", L"" }, - //{ SCE_C_PREPROCESSOR, L"Preprocessor", L"fore:#FF8000", L"" }, - //{ SCE_C_WORD2, L"Word 2", L"", L"" }, - //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_PAS = { -"absolute abstract alias and array as asm assembler begin break case cdecl class const constructor continue cppdecl default " -"destructor dispose div do downto else end end. except exit export exports external false far far16 file finalization finally for " -"forward function goto if implementation in index inherited initialization inline interface is label library local message mod " -"name near new nil nostackframe not object of oldfpccall on operator or out overload override packed pascal private procedure " -"program property protected public published raise read record register reintroduce repeat resourcestring safecall self set shl " -"shr softfloat stdcall stored string then threadvar to true try type unit until uses var virtual while with write xor", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexPAS = { SCLEX_PASCAL, 63012, L"Pascal Source Code", L"pas; dpr; dpk; dfm; inc; pp", L"", &KeyWords_PAS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_PAS_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_PAS_COMMENT,SCE_PAS_COMMENT2,SCE_PAS_COMMENTLINE,0), 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_PAS_WORD, 63128, L"Keyword", L"bold; fore:#800080", L"" }, - { SCE_PAS_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_PAS_STRING,SCE_PAS_CHARACTER,SCE_PAS_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_PAS_NUMBER,SCE_PAS_HEXNUMBER,0,0), 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_PAS_OPERATOR, 63132, L"Operator", L"bold", L"" }, - { SCE_PAS_ASM, 63205, L"Inline Asm", L"fore:#0000FF", L"" }, - { MULTI_STYLE(SCE_PAS_PREPROCESSOR,SCE_PAS_PREPROCESSOR2,0,0), 63133, L"Preprocessor", L"fore:#FF00FF", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_ASM = { -"aaa aad aam aas adc add and arpl bound bsf bsr bswap bt btc btr bts call cbw cdq cflush clc cld " -"cli clts cmc cmova cmovae cmovb cmovbe cmovc cmove cmovg cmovge cmovl cmovle cmovna cmovnae " -"cmovnb cmovnbe cmovnc cmovne cmovng cmovnge cmovnl cmovnle cmovno cmovnp cmovns cmovnz cmovo " -"cmovp cmovpe cmovpo cmovs cmovz cmp cmps cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b " -"cpuid cwd cwde daa das dec div emms enter esc femms hlt ibts icebp idiv imul in inc ins insb " -"insd insw int int01 int03 int1 int3 into invd invlpg iret iretd iretdf iretf iretw ja jae jb jbe " -"jc jcxz je jecxz jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz " -"jo jp jpe jpo js jz lahf lar lds lea leave les lfs lgdt lgs lidt lldt lmsw loadall loadall286 " -"lock lods lodsb lodsd lodsq lodsw loop loopd loope looped loopew loopne loopned loopnew loopnz " -"loopnzd loopnzw loopw loopz loopzd loopzw lsl lss ltr mov movs movsb movsd movsq movsw movsx " -"movsxd movzx mul neg nop not or out outs outsb outsd outsw pop popa popad popaw popf popfd popfw " -"push pusha pushad pushaw pushd pushf pushfd pushfw pushw rcl rcr rdmsr rdpmc rdshr rdtsc rep " -"repe repne repnz repz ret retf retn rol ror rsdc rsldt rsm rsts sahf sal salc sar sbb scas scasb " -"scasd scasq scasw seta setae setb setbe setc sete setg setge setl setle setna setnae setnb " -"setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets " -"setz sgdt shl shld shr shrd sidt sldt smi smint smintold smsw stc std sti stos stosb stosd stosq " -"stosw str sub svdc svldt svts syscall sysenter sysexit sysret test ud0 ud1 ud2 umov verr verw " -"wait wbinvd wrmsr wrshr xadd xbts xchg xlat xlatb xor", -"f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne " -"fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp feni " -"ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr " -"fld fld1 fldcw fldenv fldenvd fldenvw fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex " -"fndisi fneni fninit fnop fnsave fnsaved fnsavew fnstcw fnstenv fnstenvd fnstenvw fnstsw fpatan " -"fprem fprem1 fptan frndint frstor frstord frstorw fsave fsaved fsavew fscale fsetpm fsin fsincos " -"fsqrt fst fstcw fstenv fstenvd fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomp " -"fucompp fwait fxam fxch fxtract fyl2x fyl2xp1", -"ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 cs cx dh di dl dr0 dr1 dr2 dr3 dr6 dr7 ds dx eax ebp " -"ebx ecx edi edx eip es esi esp fs gs mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 r10 r10b r10d r10w r11 r11b " -"r11d r11w r12 r12b r12d r12w r13 r13b r13d r13w r14 r14b r14d r14w r15 r15b r15d r15w r8 r8b r8d " -"r8w r9 r9b r9d r9w rax rbp rbx rcx rdi rdx rip rsi rsp si sp ss st st0 st1 st2 st3 st4 st5 st6 " -"st7 tr3 tr4 tr5 tr6 tr7 xmm0 xmm1 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm2 xmm3 xmm4 xmm5 xmm6 " -"xmm7 xmm8 xmm9 ymm0 ymm1 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 " -"ymm9", -"%arg %assign %define %elif %elifctk %elifdef %elifid %elifidn %elifidni %elifmacro %elifnctk " -"%elifndef %elifnid %elifnidn %elifnidni %elifnmacro %elifnnum %elifnstr %elifnum %elifstr %else " -"%endif %endmacro %endrep %error %exitrep %iassign %idefine %if %ifctk %ifdef %ifid %ifidn " -"%ifidni %ifmacro %ifnctk %ifndef %ifnid %ifnidn %ifnidni %ifnmacro %ifnnum %ifnstr %ifnum %ifstr " -"%imacro %include %line %local %macro %out %pop %push %rep %repl %rotate %stacksize %strlen " -"%substr %undef %xdefine %xidefine .186 .286 .286c .286p .287 .386 .386c .386p .387 .486 .486p " -".8086 .8087 .alpha .break .code .const .continue .cref .data .data? .dosseg .else .elseif .endif " -".endw .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn .erridni .errnb .errndef " -".errnz .exit .fardata .fardata? .if .lall .lfcond .list .listall .listif .listmacro " -".listmacroall .model .msfloat .no87 .nocref .nolist .nolistif .nolistmacro .radix .repeat .sall " -".seq .sfcond .stack .startup .tfcond .type .until .untilcxz .while .xall .xcref .xlist absolute " -"alias align alignb assume at bits catstr comm comment common cpu db dd df dosseg dq dt dup dw " -"echo else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn " -"elseifidni elseifnb elseifndef end endif endm endp ends endstruc eq equ even exitm export extern " -"externdef extrn for forc ge global goto group gt high highword iend if if1 if2 ifb ifdef ifdif " -"ifdifi ife ifidn ifidni ifnb ifndef import incbin include includelib instr invoke irp irpc " -"istruc label le length lengthof local low lowword lroffset lt macro mask mod name ne offset " -"opattr option org page popcontext proc proto ptr public purge pushcontext record repeat rept " -"resb resd resq rest resw section seg segment short size sizeof sizestr struc struct substr " -"subtitle subttl textequ this times title type typedef union use16 use32 while width", -"$ $$ %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 .bss .data .text ? @b @f a16 a32 abs addr all assumes at " -"basic byte c carry? casemap common compact cpu dotname dword emulator epilogue error export " -"expr16 expr32 far far16 far32 farstack flat forceframe fortran fword huge language large listing " -"ljmp loadds m510 medium memory near near16 near32 nearstack nodotname noemulator nokeyword " -"noljmp nom510 none nonunique nooldmacros nooldstructs noreadonly noscoped nosignextend nosplit " -"nothing notpublic o16 o32 oldmacros oldstructs os_dos overflow? para parity? pascal private " -"prologue qword radix readonly real10 real4 real8 req sbyte scoped sdword seq setif2 sign? small " -"smallstack stdcall sword syscall tbyte tiny use16 use32 uses vararg word wrt zero?", -"addpd addps addsd addss andnpd andnps andpd andps blendpd blendps blendvpd blendvps cmpeqpd " -"cmpeqps cmpeqsd cmpeqss cmplepd cmpleps cmplesd cmpless cmpltpd cmpltps cmpltsd cmpltss cmpnepd " -"cmpneps cmpnesd cmpness cmpnlepd cmpnleps cmpnlesd cmpnless cmpnltpd cmpnltps cmpnltsd cmpnltss " -"cmpordpd cmpordps cmpordsd cmpordss cmpunordpd cmpunordps cmpunordsd cmpunordss comisd comiss " -"crc32 cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi " -"cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvtss2sd cvtss2si cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi " -"cvttsd2si cvttss2si divpd divps divsd divss dppd dpps extractps fxrstor fxsave insertps ldmxscr " -"lfence maskmovdq maskmovdqu maxpd maxps maxss mfence minpd minps minsd minss movapd movaps movd " -"movdq2q movdqa movdqu movhlps movhpd movhps movlhps movlpd movlps movmskpd movmskps movntdq " -"movntdqa movnti movntpd movntps movntq movq movq2dq movsd movss movupd movups mpsadbw mulpd " -"mulps mulsd mulss orpd orps packssdw packsswb packusdw packuswb paddb paddd paddq paddsb paddsiw " -"paddsw paddusb paddusw paddw pand pandn pause paveb pavgb pavgusb pavgw paxsd pblendvb pblendw " -"pcmpeqb pcmpeqd pcmpeqq pcmpeqw pcmpestri pcmpestrm pcmpgtb pcmpgtd pcmpgtq pcmpgtw pcmpistri " -"pcmpistrm pdistib pextrb pextrd pextrq pextrw pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt " -"pfmax pfmin pfmul pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr " -"phminposuw pi2fd pinsrb pinsrd pinsrq pinsrw pmachriw pmaddwd pmagw pmaxsb pmaxsd pmaxsw pmaxub " -"pmaxud pmaxuw pminsb pminsd pminsw pminub pminud pminuw pmovmskb pmovsxbd pmovsxbq pmovsxbw " -"pmovsxdq pmovsxwd pmovsxwq pmovzxbd pmovzxbq pmovzxbw pmovzxdq pmovzxwd pmovzxwq pmuldq pmulhriw " -"pmulhrwa pmulhrwc pmulhuw pmulhw pmulld pmullw pmuludq pmvgezb pmvlzb pmvnzb pmvzb popcnt por " -"prefetch prefetchnta prefetcht0 prefetcht1 prefetcht2 prefetchw psadbw pshufd pshufhw pshuflw " -"pshufw pslld pslldq psllq psllw psrad psraw psrld psrldq psrlq psrlw psubb psubd psubq psubsb " -"psubsiw psubsw psubusb psubusw psubw pswapd ptest punpckhbw punpckhdq punpckhqdq punpckhwd " -"punpcklbw punpckldq punpcklqdq punpcklwd pxor rcpps rcpss roundpd roundps roundsd roundss " -"rsqrtps rsqrtss sfence shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd subss " -"ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps", -"", "", "" }; - - -EDITLEXER lexASM = { SCLEX_ASM, 63013, L"Assembly Script", L"asm", L"", &KeyWords_ASM, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_ASM_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_ASM_COMMENT,SCE_ASM_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_ASM_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_ASM_STRING,SCE_ASM_CHARACTER,SCE_ASM_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_ASM_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_ASM_OPERATOR, 63132, L"Operator", L"fore:#0A246A", L"" }, - { SCE_ASM_CPUINSTRUCTION, 63206, L"CPU Instruction", L"fore:#0A246A", L"" }, - { SCE_ASM_MATHINSTRUCTION, 63207, L"FPU Instruction", L"fore:#0A246A", L"" }, - { SCE_ASM_EXTINSTRUCTION, 63210, L"Extended Instruction", L"fore:#0A246A", L"" }, - { SCE_ASM_DIRECTIVE, 63203, L"Directive", L"fore:#0A246A", L"" }, - { SCE_ASM_DIRECTIVEOPERAND, 63209, L"Directive Operand", L"fore:#0A246A", L"" }, - { SCE_ASM_REGISTER, 63208, L"Register", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_PL = { -"__DATA__ __END__ __FILE__ __LINE__ __PACKAGE__ abs accept alarm and atan2 AUTOLOAD BEGIN " -"bind binmode bless break caller chdir CHECK chmod chomp chop chown chr chroot close closedir " -"cmp connect continue CORE cos crypt dbmclose dbmopen default defined delete DESTROY die do " -"dump each else elsif END endgrent endhostent endnetent endprotoent endpwent endservent eof " -"eq EQ eval exec exists exit exp fcntl fileno flock for foreach fork format formline ge GE " -"getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin " -"getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname " -"getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport " -"getservent getsockname getsockopt given glob gmtime goto grep gt GT hex if index INIT int " -"ioctl join keys kill last lc lcfirst le LE length link listen local localtime lock log " -"lstat lt LT map mkdir msgctl msgget msgrcv msgsnd my ne NE next no not NULL oct open " -"opendir or ord our pack package pipe pop pos print printf prototype push qu quotemeta rand " -"read readdir readline readlink readpipe recv redo ref rename require reset return reverse " -"rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent " -"sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift " -"shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split " -"sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek " -"system syswrite tell telldir tie tied time times truncate uc ucfirst umask undef UNITCHECK " -"unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn " -"when while write xor", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexPL = { SCLEX_PERL, 63014, L"Perl Script", L"pl; pm; cgi; pod", L"", &KeyWords_PL, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_PL_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_PL_COMMENTLINE, 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_PL_WORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, - { SCE_PL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_PL_STRING, 63211, L"String Double Quoted", L"fore:#008000", L"" }, - { SCE_PL_CHARACTER, 63212, L"String Single Quoted", L"fore:#008000", L"" }, - { SCE_PL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_PL_OPERATOR, 63132, L"Operator", L"bold", L"" }, - { SCE_PL_SCALAR, 63215, L"Scalar $var", L"fore:#0A246A", L"" }, - { SCE_PL_ARRAY, 63216, L"Array @var", L"fore:#003CE6", L"" }, - { SCE_PL_HASH, 63217, L"Hash %var", L"fore:#B000B0", L"" }, - { SCE_PL_SYMBOLTABLE, 63218, L"Symbol Table *var", L"fore:#3A6EA5", L"" }, - { SCE_PL_REGEX, 63219, L"Regex /re/ or m{re}", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_PL_REGSUBST, 63220, L"Substitution s/re/ore/", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_PL_BACKTICKS, 63221, L"Back Ticks", L"fore:#E24000; back:#FFF1A8", L"" }, - { SCE_PL_HERE_DELIM, 63223, L"Here-Doc (Delimiter)", L"fore:#648000", L"" }, - { SCE_PL_HERE_Q, 63224, L"Here-Doc (Single Quoted, q)", L"fore:#648000", L"" }, - { SCE_PL_HERE_QQ, 63225, L"Here-Doc (Double Quoted, qq)", L"fore:#648000", L"" }, - { SCE_PL_HERE_QX, 63226, L"Here-Doc (Back Ticks, qx)", L"fore:#E24000; back:#FFF1A8", L"" }, - { SCE_PL_STRING_Q, 63227, L"Single Quoted String (Generic, q)", L"fore:#008000", L"" }, - { SCE_PL_STRING_QQ, 63228, L"Double Quoted String (qq)", L"fore:#008000", L"" }, - { SCE_PL_STRING_QX, 63229, L"Back Ticks (qx)", L"fore:#E24000; back:#FFF1A8", L"" }, - { SCE_PL_STRING_QR, 63230, L"Regex (qr)", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_PL_STRING_QW, 63231, L"Array (qw)", L"fore:#003CE6", L"" }, - { SCE_PL_SUB_PROTOTYPE, 63253, L"Prototype", L"fore:#800080; back:#FFE2FF", L"" }, - { SCE_PL_FORMAT_IDENT, 63254, L"Format Identifier", L"bold; fore:#648000; back:#FFF1A8", L"" }, - { SCE_PL_FORMAT, 63255, L"Format Body", L"fore:#648000; back:#FFF1A8", L"" }, - { SCE_PL_POD, 63213, L"POD (Common)", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, - { SCE_PL_POD_VERB, 63214, L"POD (Verbatim)", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, - { SCE_PL_DATASECTION, 63222, L"Data Section", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, - { SCE_PL_ERROR, 63252, L"Parsing Error", L"fore:#C80000; back:#FFFF80", L"" }, - //{ SCE_PL_PUNCTUATION, L"Symbols / Punctuation (not used)", L"", L"" }, - //{ SCE_PL_PREPROCESSOR, L"Preprocessor (not used)", L"", L"" }, - //{ SCE_PL_LONGQUOTE, L"Long Quote (qq, qr, qw, qx) (not used)", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_PROPS = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexPROPS = { SCLEX_PROPERTIES, 63015, L"Configuration Files", L"ini; inf; cfg; properties; oem; sif; url; sed; theme", L"", &KeyWords_PROPS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_PROPS_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_PROPS_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_PROPS_SECTION, 63232, L"Section", L"fore:#000000; back:#FF8040; bold; eolfilled", L"" }, - { SCE_PROPS_ASSIGNMENT, 63233, L"Assignment", L"fore:#FF0000", L"" }, - { SCE_PROPS_DEFVAL, 63234, L"Default Value", L"fore:#FF0000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_BAT = { -"arp assoc attrib bcdedit bootcfg break cacls call cd change chcp chdir chkdsk chkntfs choice cipher " -"cleanmgr cls cmd cmdkey color com comp compact con convert copy country ctty date defined defrag del " -"dir disableextensions diskcomp diskcopy diskpart do doskey driverquery echo echo. else enableextensions " -"enabledelayedexpansion endlocal equ erase errorlevel exist exit expand fc find findstr for forfiles format " -"fsutil ftp ftype geq goto gpresult gpupdate graftabl gtr help icacls if in ipconfig kill label leq loadfix " -"loadhigh logman logoff lpt lss md mem mkdir mklink mode more move msg msiexe nbtstat neq net netstat netsh " -"not nslookup nul openfiles path pathping pause perfmon popd powercfg print prompt pushd rd recover reg regedit " -"regsvr32 rem ren rename replace rmdir robocopy route runas rundll32 sc schtasks sclist set setlocal sfc shift " -"shutdown sort start subst systeminfo taskkill tasklist time timeout title tracert tree type typeperf ver verify " -"vol wmic xcopy", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexBAT = { SCLEX_BATCH, 63016, L"Batch Files", L"bat; cmd", L"", &KeyWords_BAT, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_BAT_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_BAT_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_BAT_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_BAT_IDENTIFIER, 63129, L"Identifier", L"fore:#003CE6; back:#FFF1A8", L"" }, - { SCE_BAT_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { MULTI_STYLE(SCE_BAT_COMMAND,SCE_BAT_HIDE,0,0), 63236, L"Command", L"bold", L"" }, - { SCE_BAT_LABEL, 63235, L"Label", L"fore:#C80000; back:#F4F4F4; eolfilled", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_DIFF = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexDIFF = { SCLEX_DIFF, 63017, L"Diff Files", L"diff; patch", L"", &KeyWords_DIFF, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_DIFF_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_DIFF_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_DIFF_COMMAND, 63236, L"Command", L"bold; fore:#0A246A", L"" }, - { SCE_DIFF_HEADER, 63238, L"Source and Destination", L"fore:#C80000; back:#FFF1A8; eolfilled", L"" }, - { SCE_DIFF_POSITION, 63239, L"Position Setting", L"fore:#0000FF", L"" }, - { SCE_DIFF_ADDED, 63240, L"Line Addition", L"fore:#002000; back:#80FF80; eolfilled", L"" }, - { SCE_DIFF_DELETED, 63241, L"Line Removal", L"fore:#200000; back:#FF8080; eolfilled", L"" }, - { SCE_DIFF_CHANGED, 63242, L"Line Change", L"fore:#000020; back:#8080FF; eolfilled", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_SQL = { -"abort accessible action add after all alter analyze and as asc asensitive attach autoincrement " -"before begin between bigint binary bit blob both by call cascade case cast change char character " -"check collate column commit condition conflict constraint continue convert create cross current_date " -"current_time current_timestamp current_user cursor database databases date day_hour day_microsecond " -"day_minute day_second dec decimal declare default deferrable deferred delayed delete desc describe " -"detach deterministic distinct distinctrow div double drop dual each else elseif enclosed end enum " -"escape escaped except exclusive exists exit explain fail false fetch float float4 float8 for force " -"foreign from full fulltext glob grant group having high_priority hour_microsecond hour_minute " -"hour_second if ignore immediate in index infile initially inner inout insensitive insert instead int " -"int1 int2 int3 int4 int8 integer intersect interval into is isnull iterate join key keys kill " -"leading leave left like limit linear lines load localtime localtimestamp lock long longblob longtext " -"loop low_priority master_ssl_verify_server_cert match merge mediumblob mediumint mediumtext middleint " -"minute_microsecond minute_second mod modifies natural no no_write_to_binlog not notnull null numeric " -"of offset on optimize option optionally or order out outer outfile plan pragma precision primary " -"procedure purge query raise range read read_only read_write reads real references regexp reindex " -"release rename repeat replace require restrict return revoke right rlike rollback row rowid schema " -"schemas second_microsecond select sensitive separator set show smallint spatial specific sql " -"sql_big_result sql_calc_found_rows sql_small_result sqlexception sqlstate sqlwarning ssl starting " -"straight_join table temp temporary terminated text then time timestamp tinyblob tinyint tinytext to " -"trailing transaction trigger true undo union unique unlock unsigned update usage use using utc_date " -"utc_time utc_timestamp vacuum values varbinary varchar varcharacter varying view virtual when where " -"while with write xor year_month zerofill", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexSQL = { SCLEX_SQL, 63018, L"SQL Query", L"sql", L"", &KeyWords_SQL, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_SQL_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_SQL_COMMENT, 63127, L"Comment", L"fore:#505050", L"" }, - { SCE_SQL_WORD, 63128, L"Keyword", L"bold; fore:#800080", L"" }, - { MULTI_STYLE(SCE_SQL_STRING,SCE_SQL_CHARACTER,0,0), 63131, L"String", L"fore:#008000; back:#FFF1A8", L"" }, - { SCE_SQL_IDENTIFIER, 63129, L"Identifier", L"fore:#800080", L"" }, - { SCE_SQL_QUOTEDIDENTIFIER, 63243, L"Quoted Identifier", L"fore:#800080; back:#FFCCFF", L"" }, - { SCE_SQL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_SQL_OPERATOR, 63132, L"Operator", L"bold; fore:#800080", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_PY = { -"and as assert break class continue def del elif else except " -"exec False finally for from global if import in is lambda None " -"nonlocal not or pass print raise return True try while with yield", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexPY = { SCLEX_PYTHON, 63019, L"Python Script", L"py; pyw", L"", &KeyWords_PY, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#880000", L"" }, - { SCE_P_WORD, 63128, L"Keyword", L"fore:#000088", L"" }, - { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,0,0), 63211, L"String Double Quoted", L"fore:#008800", L"" }, - { SCE_P_CHARACTER, 63212, L"String Single Quoted", L"fore:#008800", L"" }, - { SCE_P_TRIPLEDOUBLE, 63244, L"String Triple Double Quotes", L"fore:#008800", L"" }, - { SCE_P_TRIPLE, 63245, L"String Triple Single Quotes", L"fore:#008800", L"" }, - { SCE_P_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, - { SCE_P_OPERATOR, 63132, L"Operator", L"bold; fore:#666600", L"" }, - { SCE_P_DEFNAME, 63247, L"Function Name", L"fore:#660066", L"" }, - { SCE_P_CLASSNAME, 63246, L"Class Name", L"fore:#660066", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_CONF = { -"acceptfilter acceptmutex acceptpathinfo accessconfig accessfilename action addalt addaltbyencoding " -"addaltbytype addcharset adddefaultcharset adddescription addencoding addhandler addicon addiconbyencoding " -"addiconbytype addinputfilter addlanguage addmodule addmoduleinfo addoutputfilter addoutputfilterbytype " -"addtype agentlog alias aliasmatch all allow allowconnect allowencodedslashes allowmethods allowoverride " -"allowoverridelist anonymous anonymous_authoritative anonymous_logemail anonymous_mustgiveemail " -"anonymous_nouserid anonymous_verifyemail assignuserid asyncrequestworkerfactor authauthoritative " -"authbasicauthoritative authbasicfake authbasicprovider authbasicusedigestalgorithm authdbauthoritative " -"authdbduserpwquery authdbduserrealmquery authdbgroupfile authdbmauthoritative authdbmgroupfile " -"authdbmtype authdbmuserfile authdbuserfile authdigestalgorithm authdigestdomain authdigestfile " -"authdigestgroupfile authdigestnccheck authdigestnonceformat authdigestnoncelifetime authdigestprovider " -"authdigestqop authdigestshmemsize authformauthoritative authformbody authformdisablenostore authformfakebasicauth " -"authformlocation authformloginrequiredlocation authformloginsuccesslocation authformlogoutlocation authformmethod " -"authformmimetype authformpassword authformprovider authformsitepassphrase authformsize authformusername " -"authgroupfile authldapauthoritative authldapauthorizeprefix authldapbindauthoritative authldapbinddn " -"authldapbindpassword authldapcharsetconfig authldapcompareasuser authldapcomparednonserver " -"authldapdereferencealiases authldapenabled authldapfrontpagehack authldapgroupattribute " -"authldapgroupattributeisdn authldapinitialbindasuser authldapinitialbindpattern authldapmaxsubgroupdepth " -"authldapremoteuserattribute authldapremoteuserisdn authldapsearchasuser authldapsubgroupattribute " -"authldapsubgroupclass authldapurl authmerging authname authncachecontext authncacheenable authncacheprovidefor " -"authncachesocache authncachetimeout authnprovideralias authnzfcgicheckauthnprovider authnzfcgidefineprovider " -"authtype authuserfile authzdbdlogintoreferer authzdbdquery authzdbdredirectquery authzdbmtype " -"authzsendforbiddenonfailure balancergrowth balancerinherit balancermember balancerpersist bindaddress " -"browsermatch browsermatchnocase bs2000account bufferedlogs buffersize cachedefaultexpire cachedetailheader " -"cachedirlength cachedirlevels cachedisable cacheenable cacheexpirycheck cachefile cacheforcecompletion " -"cachegcclean cachegcdaily cachegcinterval cachegcmemusage cachegcunused cacheheader cacheignorecachecontrol " -"cacheignoreheaders cacheignorenolastmod cacheignorequerystring cacheignoreurlsessionidentifiers " -"cachekeybaseurl cachelastmodifiedfactor cachelock cachelockmaxage cachelockpath cachemaxexpire " -"cachemaxfilesize cacheminexpire cacheminfilesize cachenegotiateddocs cachequickhandler cachereadsize " -"cachereadtime cacheroot cachesize cachesocache cachesocachemaxsize cachesocachemaxtime cachesocachemintime " -"cachesocachereadsize cachesocachereadtime cachestaleonerror cachestoreexpired cachestorenostore cachestoreprivate " -"cachetimemargin cgidscripttimeout cgimapextension cgipassauth cgivar charsetdefault charsetoptions charsetsourceenc " -"checkcaseonly checkspelling childperuserid chrootdir clearmodulelist contentdigest cookiedomain cookieexpires " -"cookielog cookiename cookiestyle cookietracking coredumpdirectory customlog dav davdepthinfinity davgenericlockdb " -"davlockdb davmintimeout dbdexptime dbdinitsql dbdkeep dbdmax dbdmin dbdparams dbdpersist dbdpreparesql dbdriver " -"defaulticon defaultlanguage defaultruntimedir defaulttype define deflatebuffersize deflatecompressionlevel " -"deflatefilternote deflateinflatelimitrequestbody deflateinflateratioburst deflateinflateratiolimit deflatememlevel " -"deflatewindowsize deny directory directorycheckhandler directoryindex directoryindexredirect directorymatch " -"directoryslash documentroot dtraceprivileges dumpioinput dumpiooutput else elseif enableexceptionhook enablemmap " -"enablesendfile error errordocument errorlog errorlogformat example expiresactive expiresbytype expiresdefault " -"extendedstatus extfilterdefine extfilteroptions fallbackresource fancyindexing fileetag files filesmatch " -"filterchain filterdeclare filterprotocol filterprovider filtertrace forcelanguagepriority forcetype forensiclog " -"from globallog gracefulshutdowntimeout group h2direct h2maxsessionstreams h2maxworkeridleseconds h2maxworkers " -"h2minworkers h2moderntlsonly h2push h2pushdiarysize h2pushpriority h2serializeheaders h2sessionextrafiles " -"h2streammaxmemsize h2tlscooldownsecs h2tlswarmupsize h2upgrade h2windowsize header headername heartbeataddress " -"heartbeatlisten heartbeatmaxservers heartbeatstorage hostnamelookups identitycheck identitychecktimeout " -"if ifdefine ifmodule ifversion imapbase imapdefault imapmenu include includeoptional indexheadinsert " -"indexignore indexignorereset indexoptions indexorderdefault indexstylesheet inputsed isapiappendlogtoerrors " -"isapiappendlogtoquery isapicachefile isapifakeasync isapilognotsupported isapireadaheadbuffer keepalive " -"keepalivetimeout keptbodysize languagepriority ldapcacheentries ldapcachettl ldapconnectionpoolttl " -"ldapconnectiontimeout ldaplibrarydebug ldapopcacheentries ldapopcachettl ldapreferralhoplimit ldapreferrals " -"ldapretries ldapretrydelay ldapsharedcachefile ldapsharedcachesize ldaptimeout ldaptrustedca ldaptrustedcatype " -"ldaptrustedclientcert ldaptrustedglobalcert ldaptrustedmode ldapverifyservercert limit limitexcept " -"limitinternalrecursion limitrequestbody limitrequestfields limitrequestfieldsize limitrequestline " -"limitxmlrequestbody listen listenbacklog listencoresbucketsratio loadfile loadmodule location " -"locationmatch lockfile logformat logiotrackttfb loglevel logmessage luaauthzprovider luacodecache " -"luahookaccesschecker luahookauthchecker luahookcheckuserid luahookfixups luahookinsertfilter luahooklog " -"luahookmaptostorage luahooktranslatename luahooktypechecker luainherit luainputfilter luamaphandler " -"luaoutputfilter luapackagecpath luapackagepath luaquickhandler luaroot luascope macro maxclients " -"maxconnectionsperchild maxkeepaliverequests maxmemfree maxrangeoverlaps maxrangereversals maxranges " -"maxrequestsperchild maxrequestsperthread maxrequestworkers maxspareservers maxsparethreads maxthreads " -"maxthreadsperchild mcachemaxobjectcount mcachemaxobjectsize mcachemaxstreamingbuffer mcacheminobjectsize " -"mcacheremovalalgorithm mcachesize memcacheconnttl mergetrailers metadir metafiles metasuffix mimemagicfile " -"minspareservers minsparethreads mmapfile modemstandard modmimeusepathinfo multiviewsmatch mutex namevirtualhost " -"nocache noproxy numservers nwssltrustedcerts nwsslupgradeable options order outputsed passenv pidfile port " -"privilegesmode protocol protocolecho protocols protocolshonororder proxy proxyaddheaders proxybadheader " -"proxyblock proxydomain proxyerroroverride proxyexpressdbmfile proxyexpressdbmtype proxyexpressenable " -"proxyftpdircharset proxyftpescapewildcards proxyftplistonwildcard proxyhcexpr proxyhctemplate proxyhctpsize " -"proxyhtmlbufsize proxyhtmlcharsetout proxyhtmldoctype proxyhtmlenable proxyhtmlevents proxyhtmlextended " -"proxyhtmlfixups proxyhtmlinterp proxyhtmllinks proxyhtmlmeta proxyhtmlstripcomments proxyhtmlurlmap " -"proxyiobuffersize proxymatch proxymaxforwards proxypass proxypassinherit proxypassinterpolateenv " -"proxypassmatch proxypassreverse proxypassreversecookiedomain proxypassreversecookiepath proxypreservehost " -"proxyreceivebuffersize proxyremote proxyremotematch proxyrequests proxyscgiinternalredirect proxyscgisendfile " -"proxyset proxysourceaddress proxystatus proxytimeout proxyvia qsc qualifyredirecturl readmename " -"receivebuffersize redirect redirectmatch redirectpermanent redirecttemp refererignore refererlog " -"reflectorheader remoteipheader remoteipinternalproxy remoteipinternalproxylist remoteipproxiesheader " -"remoteiptrustedproxy remoteiptrustedproxylist removecharset removeencoding removehandler removeinputfilter " -"removelanguage removeoutputfilter removetype requestheader requestreadtimeout require requireall " -"requireany requirenone resourceconfig rewritebase rewritecond rewriteengine rewritelock rewritelog " -"rewriteloglevel rewritemap rewriteoptions rewriterule rlimitcpu rlimitmem rlimitnproc satisfy " -"scoreboardfile script scriptalias scriptaliasmatch scriptinterpretersource scriptlog scriptlogbuffer " -"scriptloglength scriptsock securelisten seerequesttail sendbuffersize serveradmin serveralias serverlimit " -"servername serverpath serverroot serversignature servertokens servertype session sessioncookiename " -"sessioncookiename2 sessioncookieremove sessioncryptocipher sessioncryptodriver sessioncryptopassphrase " -"sessioncryptopassphrasefile sessiondbdcookiename sessiondbdcookiename2 sessiondbdcookieremove " -"sessiondbddeletelabel sessiondbdinsertlabel sessiondbdperuser sessiondbdselectlabel sessiondbdupdatelabel " -"sessionenv sessionexclude sessionheader sessioninclude sessionmaxage setenv setenvif setenvifexpr " -"setenvifnocase sethandler setinputfilter setoutputfilter singlelisten ssiendtag ssierrormsg ssietag " -"ssilastmodified ssilegacyexprparser ssistarttag ssitimeformat ssiundefinedecho sslcacertificatefile " -"sslcacertificatepath sslcadnrequestfile sslcadnrequestpath sslcarevocationcheck sslcarevocationfile " -"sslcarevocationpath sslcertificatechainfile sslcertificatefile sslcertificatekeyfile sslciphersuite " -"sslcompression sslcryptodevice sslengine sslfips sslhonorcipherorder sslinsecurerenegotiation sslmutex " -"sslocspdefaultresponder sslocspenable sslocspoverrideresponder sslocspproxyurl sslocsprespondertimeout " -"sslocspresponsemaxage sslocspresponsetimeskew sslocspuserequestnonce sslopensslconfcmd ssloptions " -"sslpassphrasedialog sslprotocol sslproxycacertificatefile sslproxycacertificatepath sslproxycarevocationcheck " -"sslproxycarevocationfile sslproxycarevocationpath sslproxycheckpeercn sslproxycheckpeerexpire " -"sslproxycheckpeername sslproxyciphersuite sslproxyengine sslproxymachinecertificatechainfile " -"sslproxymachinecertificatefile sslproxymachinecertificatepath sslproxyprotocol sslproxyverify " -"sslproxyverifydepth sslrandomseed sslrenegbuffersize sslrequire sslrequiressl sslsessioncache " -"sslsessioncachetimeout sslsessionticketkeyfile sslsessiontickets sslsrpunknownuserseed " -"sslsrpverifierfile sslstaplingcache sslstaplingerrorcachetimeout sslstaplingfaketrylater " -"sslstaplingforceurl sslstaplingrespondertimeout sslstaplingresponsemaxage sslstaplingresponsetimeskew " -"sslstaplingreturnrespondererrors sslstaplingstandardcachetimeout sslstrictsnivhostcheck sslusername " -"sslusestapling sslverifyclient sslverifydepth startservers startthreads substitute substituteinheritbefore " -"substitutemaxlinelength suexec suexecusergroup threadlimit threadsperchild threadstacksize timeout " -"traceenable transferlog typesconfig undefine undefmacro unsetenv use usecanonicalname usecanonicalphysicalport " -"user userdir vhostcgimode vhostcgiprivs vhostgroup vhostprivs vhostsecure vhostuser virtualdocumentroot " -"virtualdocumentrootip virtualhost virtualscriptalias virtualscriptaliasip watchdoginterval win32disableacceptex " -"xbithack xml2encalias xml2encdefault xml2startparse", -"", //"on off standalone inetd force-response-1.0 downgrade-1.0 nokeepalive indexes includes followsymlinks none x-compress x-gzip", -"", "", "", "", "", "", "" }; - - -EDITLEXER lexCONF = { SCLEX_CONF, 63020, L"Apache Config Files", L"conf; htaccess", L"", &KeyWords_CONF, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_CONF_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_CONF_COMMENT, 63127, L"Comment", L"fore:#648000", L"" }, - { SCE_CONF_STRING, 63131, L"String", L"fore:#B000B0", L"" }, - { SCE_CONF_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, - { SCE_CONF_DIRECTIVE, 63203, L"Directive", L"fore:#003CE6", L"" }, - { SCE_CONF_IP, 63248, L"IP Address", L"bold; fore:#FF4000", L"" }, -// Not used by lexer { SCE_CONF_IDENTIFIER, L"Identifier", L"", L"" }, -// Lexer is buggy { SCE_CONF_OPERATOR, L"Operator", L"", L"" }, -// Lexer is buggy { SCE_CONF_PARAMETER, L"Runtime Directive Parameter", L"", L"" }, -// Lexer is buggy { SCE_CONF_EXTENSION, L"Extension", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_PS = { -"begin break catch continue data do dynamicparam else elseif end exit filter finally for foreach " -"from function if in local param private process return switch throw trap try until where while", -"add-computer add-content add-history add-member add-pssnapin add-type checkpoint-computer " -"clear-content clear-eventlog clear-history clear-host clear-item clear-itemproperty " -"clear-variable compare-object complete-transaction connect-wsman convertfrom-csv " -"convertfrom-securestring convertfrom-stringdata convert-path convertto-csv convertto-html " -"convertto-securestring convertto-xml copy-item copy-itemproperty debug-process " -"disable-computerrestore disable-psbreakpoint disable-psremoting disable-pssessionconfiguration " -"disable-wsmancredssp disconnect-wsman enable-computerrestore enable-psbreakpoint " -"enable-psremoting enable-pssessionconfiguration enable-wsmancredssp enter-pssession " -"exit-pssession export-alias export-clixml export-console export-counter export-csv " -"export-formatdata export-modulemember export-pssession foreach-object format-custom format-list " -"format-table format-wide get-acl get-alias get-authenticodesignature get-childitem get-command " -"get-computerrestorepoint get-content get-counter get-credential get-culture get-date get-event " -"get-eventlog get-eventsubscriber get-executionpolicy get-formatdata get-help get-history " -"get-host get-hotfix get-item get-itemproperty get-job get-location get-member get-module " -"get-pfxcertificate get-process get-psbreakpoint get-pscallstack get-psdrive get-psprovider " -"get-pssession get-pssessionconfiguration get-pssnapin get-random get-service get-tracesource " -"get-transaction get-uiculture get-unique get-variable get-verb get-winevent get-wmiobject " -"get-wsmancredssp get-wsmaninstance group-object import-alias import-clixml import-counter " -"import-csv import-localizeddata import-module import-pssession invoke-command invoke-expression " -"invoke-history invoke-item invoke-restmethod invoke-webrequest invoke-wmimethod " -"invoke-wsmanaction join-path limit-eventlog measure-command measure-object move-item " -"move-itemproperty new-alias new-event new-eventlog new-item new-itemproperty new-module " -"new-modulemanifest new-object new-psdrive new-pssession new-pssessionoption new-service " -"new-timespan new-variable new-webserviceproxy new-wsmaninstance new-wsmansessionoption " -"out-default out-file out-gridview out-host out-null out-printer out-string pop-location " -"push-location read-host receive-job register-engineevent register-objectevent " -"register-pssessionconfiguration register-wmievent remove-computer remove-event remove-eventlog " -"remove-item remove-itemproperty remove-job remove-module remove-psbreakpoint remove-psdrive " -"remove-pssession remove-pssnapin remove-variable remove-wmiobject remove-wsmaninstance " -"rename-item rename-itemproperty reset-computermachinepassword resolve-path restart-computer " -"restart-service restore-computer resume-service select-object select-string select-xml " -"send-mailmessage set-acl set-alias set-authenticodesignature set-content set-date " -"set-executionpolicy set-item set-itemproperty set-location set-psbreakpoint set-psdebug " -"set-pssessionconfiguration set-service set-strictmode set-tracesource set-variable " -"set-wmiinstance set-wsmaninstance set-wsmanquickconfig show-eventlog sort-object split-path " -"start-job start-process start-service start-sleep start-transaction start-transcript " -"stop-computer stop-job stop-process stop-service stop-transcript suspend-service tee-object " -"test-computersecurechannel test-connection test-modulemanifest test-path test-wsman " -"trace-command undo-transaction unregister-event unregister-pssessionconfiguration " -"update-formatdata update-list update-typedata use-transaction wait-event wait-job wait-process " -"where-object write-debug write-error write-eventlog write-host write-output write-progress " -"write-verbose write-warning", -"ac asnp cat cd chdir clc clear clhy cli clp cls clv compare copy cp cpi cpp cvpa dbp del diff " -"dir ebp echo epal epcsv epsn erase etsn exsn fc fl foreach ft fw gal gbp gc gci gcm gcs gdr ghy " -"gi gjb gl gm gmo gp gps group gsn gsnp gsv gu gv gwmi h help history icm iex ihy ii ipal ipcsv " -"ipmo ipsn ise iwmi kill lp ls man md measure mi mkdir more mount move mp mv nal ndr ni nmo nsn " -"nv ogv oh popd ps pushd pwd r rbp rcjb rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rv " -"rvpa rwmi sajb sal saps sasv sbp sc select set si sl sleep sort sp spjb spps spsv start sv swmi " -"tee type where wjb write", -"importsystemmodules prompt psedit tabexpansion", -"", "", "", "", "" }; - - -EDITLEXER lexPS = { SCLEX_POWERSHELL, 63021, L"PowerShell Script", L"ps1; psd1; psm1", L"", &KeyWords_PS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_POWERSHELL_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_POWERSHELL_COMMENT,SCE_POWERSHELL_COMMENTSTREAM,0,0), 63127, L"Comment", L"fore:#646464", L"" }, - { SCE_POWERSHELL_KEYWORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, - { SCE_POWERSHELL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_POWERSHELL_STRING,SCE_POWERSHELL_CHARACTER,0,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_POWERSHELL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_POWERSHELL_OPERATOR, 63132, L"Operator", L"bold", L"" }, - { SCE_POWERSHELL_VARIABLE, 63249, L"Variable", L"fore:#0A246A", L"" }, - { MULTI_STYLE(SCE_POWERSHELL_CMDLET,SCE_POWERSHELL_FUNCTION,0,0), 63250, L"Cmdlet", L"fore:#804000; back:#FFF1A8", L"" }, - { SCE_POWERSHELL_ALIAS, 63251, L"Alias", L"bold; fore:#0A246A", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_NSIS = { -"!addincludedir !addplugindir !appendfile !cd !define !delfile !echo !else !endif !error " -"!execute !finalize !getdllversion !if !ifdef !ifmacrodef !ifmacrondef !ifndef !include !insertmacro !macro " -"!macroend !macroundef !makensis !packhdr !searchparse !searchreplace !system !tempfile !undef !verbose !warning " -".onguiend .onguiinit .oninit .oninstfailed .oninstsuccess .onmouseoversection .onrebootfailed .onselchange " -".onuserabort .onverifyinstdir un.onguiend un.onguiinit un.oninit un.onrebootfailed un.onuninstfailed un.onuninstsuccess " -"un.onuserabort abort addbrandingimage addsize allowrootdirinstall allowskipfiles autoclosewindow " -"bannertrimpath bgfont bggradient brandingtext bringtofront call callinstdll caption changeui checkbitmap " -"clearerrors completedtext componenttext copyfiles crccheck createdirectory createfont createshortcut " -"delete deleteinisec deleteinistr deleteregkey deleteregvalue detailprint detailsbuttontext dirstate dirtext " -"dirvar dirverify enablewindow enumregkey enumregvalue exch exec execshell execwait expandenvstrings " -"file filebufsize fileclose fileerrortext fileexists fileopen fileread filereadbyte filereadutf16le filereadword " -"fileseek filewrite filewritebyte filewriteutf16le filewriteword findclose findfirst findnext findproc " -"findwindow flushini getcurinsttype getcurrentaddress getdlgitem getdllversion getdllversionlocal " -"geterrorlevel getfiletime getfiletimelocal getfontname getfontnamelocal getfontversion getfontversionlocal " -"getfullpathname getfunctionaddress getinstdirerror getlabeladdress gettempfilename goto hidewindow icon " -"ifabort iferrors iffileexists ifrebootflag ifsilent initpluginsdir installbuttontext installcolors installdir " -"installdirregkey instprogressflags insttype insttypegettext insttypesettext intcmp intcmpu intfmt intop " -"iswindow langstring licensebkcolor licensedata licenseforceselection licenselangstring licensetext " -"loadlanguagefile lockwindow logset logtext manifestsupportedos messagebox miscbuttontext name nop outfile page " -"pagecallbacks pop push quit readenvstr readinistr readregdword readregstr reboot regdll rename requestexecutionlevel " -"reservefile return rmdir searchpath sectiongetflags sectiongetinsttypes sectiongetsize sectiongettext sectionin " -"sectionsetflags sectionsetinsttypes sectionsetsize sectionsettext sendmessage setautoclose setbrandingimage " -"setcompress setcompressionlevel setcompressor setcompressordictsize setctlcolors setcurinsttype " -"setdatablockoptimize setdatesave setdetailsprint setdetailsview seterrorlevel seterrors setfileattributes " -"setfont setoutpath setoverwrite setpluginunload setrebootflag setregview setshellvarcontext setsilent " -"showinstdetails showuninstdetails showwindow silentinstall silentuninstall sleep spacetexts strcmp strcmps " -"strcpy strlen subcaption unicode uninstallbuttontext uninstallcaption uninstallicon uninstallsubcaption uninstalltext " -"uninstpage unregdll var viaddversionkey vifileversion viproductversion windowicon writeinistr writeregbin " -"writeregdword writeregexpandstr writeregstr writeuninstaller xpstyle", -"${nsisdir} $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $r0 $r1 $r2 $r3 $r4 $r5 $r6 $r7 $r8 $r9 $instdir $outdir $cmdline " -"$language $programfiles $programfiles32 $programfiles64 $commonfiles $commonfiles32 $commonfiles64 " -"$desktop $exedir $exefile $exepath $windir $sysdir $temp $startmenu $smprograms $smstartup $quicklaunch " -"$documents $sendto $recent $favorites $music $pictures $videos $nethood $fonts $templates $appdata " -"$localappdata $printhood $internet_cache $cookies $history $profile $admintools $resources $resources_localized " -"$cdburn_area $hwndparent $pluginsdir ${__date__} ${__file__} ${__function__} ${__global__} ${__line__} " -"${__pageex__} ${__section__} ${__time__} ${__timestamp__} ${__uninstall__}", -"alt charset colored control cur date end global ignorecase leave shift smooth utcdate sw_hide sw_showmaximized " -"sw_showminimized sw_shownormal archive auto oname rebootok nonfatal ifempty nounload filesonly short mb_ok " -"mb_okcancel mb_abortretryignore mb_retrycancel mb_yesno mb_yesnocancel mb_iconexclamation mb_iconinformation " -"mb_iconquestion mb_iconstop mb_usericon mb_topmost mb_setforeground mb_right mb_rtlreading mb_defbutton1 " -"mb_defbutton2 mb_defbutton3 mb_defbutton4 idabort idcancel idignore idno idok idretry idyes sd current all " -"timeout imgid resizetofit listonly textonly both branding hkcr hkey_classes_root hklm hkey_local_machine hkcu " -"hkey_current_user hku hkey_users hkcc hkey_current_config hkdd hkey_dyn_data hkpd hkey_performance_data shctx " -"shell_context left right top bottom true false on off italic underline strike trimleft trimright trimcenter " -"idd_license idd_dir idd_selcom idd_inst idd_instfiles idd_uninst idd_verify force windows nocustom customstring " -"componentsonlyoncustom gray none user highest admin lang hide show nevershow normal silent silentlog solid final " -"zlib bzip2 lzma try ifnewer ifdiff lastused manual alwaysoff normal file_attribute_normal file_attribute_archive " -"hidden file_attribute_hidden offline file_attribute_offline readonly file_attribute_readonly system " -"file_attribute_system temporary file_attribute_temporary custom license components directory instfiles " -"uninstconfirm 32 64 enablecancel noworkingdir plugin rawnl winvista win7 win8 win8.1 win10", -"", "", "", "", "", "" }; - - -EDITLEXER lexNSIS = { SCLEX_NSIS, 63030, L"NSIS Script", L"nsi; nsh", L"", &KeyWords_NSIS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //,{ SCE_NSIS_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_NSIS_COMMENT,SCE_NSIS_COMMENTBOX,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_NSIS_STRINGDQ,SCE_NSIS_STRINGLQ,SCE_NSIS_STRINGRQ,0), 63131, L"String", L"fore:#666666; back:#EEEEEE", L"" }, - { SCE_NSIS_FUNCTION, 63277, L"Function", L"fore:#0033CC", L"" }, - { SCE_NSIS_VARIABLE, 63249, L"Variable", L"fore:#CC3300", L"" }, - { SCE_NSIS_STRINGVAR, 63285, L"Variable within String", L"fore:#CC3300; back:#EEEEEE", L"" }, - { SCE_NSIS_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_NSIS_LABEL, 63286, L"Constant", L"fore:#FF9900", L"" }, - { SCE_NSIS_SECTIONDEF, 63232, L"Section", L"fore:#0033CC", L"" }, - { SCE_NSIS_SUBSECTIONDEF, 63287, L"Sub Section", L"fore:#0033CC", L"" }, - { SCE_NSIS_SECTIONGROUP, 63288, L"Section Group", L"fore:#0033CC", L"" }, - { SCE_NSIS_FUNCTIONDEF, 63289, L"Function Definition", L"fore:#0033CC", L"" }, - { SCE_NSIS_PAGEEX, 63290, L"PageEx", L"fore:#0033CC", L"" }, - { SCE_NSIS_IFDEFINEDEF, 63291, L"If Definition", L"fore:#0033CC", L"" }, - { SCE_NSIS_MACRODEF, 63292, L"Macro Definition", L"fore:#0033CC", L"" }, - //{ SCE_NSIS_USERDEFINED, L"User Defined", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_INNO = { -"code components custommessages dirs files icons ini installdelete langoptions languages messages " -"registry run setup types tasks uninstalldelete uninstallrun _istool", -"allowcancelduringinstall allownetworkdrive allownoicons allowrootdirectory allowuncpath alwaysrestart " -"alwaysshowcomponentslist alwaysshowdironreadypage alwaysshowgrouponreadypage alwaysusepersonalgroup appcomments " -"appcontact appcopyright appenddefaultdirname appenddefaultgroupname appid appmodifypath appmutex appname apppublisher " -"apppublisherurl appreadmefile appsupportphone appsupporturl appupdatesurl appvername appversion architecturesallowed " -"architecturesinstallin64bitmode backcolor backcolor2 backcolordirection backsolid beveledlabel changesassociations " -"changesenvironment closeapplications closeapplicationsfilter compression compressionthreads copyrightfontname " -"copyrightfontsize createappdir createuninstallregkey defaultdirname defaultgroupname defaultuserinfoname " -"defaultuserinfoorg defaultuserinfoserial dialogfontname dialogfontsize direxistswarning disabledirpage " -"disablefinishedpage disableprogramgrouppage disablereadymemo disablereadypage disablestartupprompt " -"disablewelcomepage diskclustersize diskslicesize diskspanning enabledirdoesntexistwarning encryption " -"extradiskspacerequired flatcomponentslist infoafterfile infobeforefile internalcompresslevel languagedetectionmethod " -"languagecodepage languageid languagename licensefile lzmaalgorithm lzmablocksize lzmadictionarysize lzmamatchfinder " -"lzmanumblockthreads lzmanumfastbytes lzmauseseparateprocess mergeduplicatefiles minversion onlybelowversion " -"outputbasefilename outputdir outputmanifestfile password privilegesrequired reservebytes restartapplications " -"restartifneededbyrun righttoleft setupiconfile setuplogging setupmutex showcomponentsizes showlanguagedialog showtaskstreelines " -"showundisplayablelanguages signeduninstaller signeduninstallerdir signtool signtoolretrycount slicesperdisk solidcompression " -"sourcedir strongassemblyname timestamprounding timestampsinutc titlefontname titlefontsize touchdate touchtime uninstallable " -"uninstalldisplayicon uninstalldisplayname uninstallfilesdir uninstalldisplaysize uninstalllogmode uninstallrestartcomputer " -"updateuninstalllogappname usepreviousappdir usepreviousgroup usepreviouslanguage useprevioussetuptype useprevioustasks " -"verb versioninfoproductname useprevioususerinfo userinfopage usesetupldr versioninfocompany versioninfocopyright " -"versioninfodescription versioninfoproductversion versioninfotextversion versioninfoversion versioninfoproducttextversion " -"welcomefontname welcomefontsize windowshowcaption windowstartmaximized windowresizable windowvisible wizardimagealphaformat " -"wizardimagebackcolor wizardimagefile wizardimagestretch wizardsmallimagefile", -"appusermodelid afterinstall attribs beforeinstall check comment components copymode description destdir destname excludes " -"extradiskspacerequired filename flags fontinstall groupdescription hotkey infoafterfile infobeforefile iconfilename " -"iconindex key languages licensefile messagesfile minversion name onlybelowversion parameters permissions root runonceid " -"section source statusmsg string subkey tasks terminalservicesaware type types valuedata valuename valuetype workingdir", -"append define dim else emit elif endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma " -"sub undef", -"and begin break case const continue do downto else end except finally for function " -"if not of or procedure repeat then to try type until uses var while with", -"", "", "", "" }; - - -EDITLEXER lexINNO = { SCLEX_INNOSETUP, 63031, L"Inno Setup Script", L"iss; isl; islu", L"", &KeyWords_INNO, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_INNO_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_INNO_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_INNO_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, - { SCE_INNO_PARAMETER, 63294, L"Parameter", L"fore:#0000FF", L"" }, - { SCE_INNO_SECTION, 63232, L"Section", L"fore:#000080; bold", L"" }, - { SCE_INNO_PREPROC, 63133, L"Preprocessor", L"fore:#CC0000", L"" }, - { SCE_INNO_INLINE_EXPANSION, 63295, L"Inline Expansion", L"fore:#800080", L"" }, - { SCE_INNO_COMMENT_PASCAL, 63296, L"Pascal Comment", L"fore:#008000", L"" }, - { SCE_INNO_KEYWORD_PASCAL, 63297, L"Pascal Keyword", L"fore:#0000FF", L"" }, - { MULTI_STYLE(SCE_INNO_STRING_DOUBLE,SCE_INNO_STRING_SINGLE,0,0), 63131, L"String", L"", L"" }, - //{ SCE_INNO_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - //{ SCE_INNO_KEYWORD_USER, L"User Defined", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_RUBY = { -"__FILE__ __LINE__ alias and begin break case class def defined? do else elsif end ensure " -"false for in if module next nil not or redo rescue retry return self super then true " -"undef unless until when while yield", -"", "", "", "", "", "", "", "" }; - -EDITLEXER lexRUBY = { SCLEX_RUBY, 63032, L"Ruby Script", L"rb; ruby; rbw; rake; rjs; Rakefile; gemspec", L"", &KeyWords_RUBY, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_RB_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_RB_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_RB_WORD, 63128, L"Keyword", L"fore:#00007F", L"" }, - { SCE_RB_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_RB_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - { SCE_RB_OPERATOR, 63132, L"Operator", L"", L"" }, - { MULTI_STYLE(SCE_RB_STRING,SCE_RB_CHARACTER,SCE_P_STRINGEOL,0), 63131, L"String", L"fore:#FF8000", L"" }, - { SCE_RB_CLASSNAME, 63246, L"Class Name", L"fore:#0000FF", L"" }, - { SCE_RB_DEFNAME, 63247, L"Function Name", L"fore:#007F7F", L"" }, - { SCE_RB_POD, 63314, L"POD", L"fore:#004000; back:#C0FFC0; eolfilled", L"" }, - { SCE_RB_REGEX, 63315, L"Regex", L"fore:#000000; back:#A0FFA0", L"" }, - { SCE_RB_SYMBOL, 63316, L"Symbol", L"fore:#C0A030", L"" }, - { SCE_RB_MODULE_NAME, 63317, L"Module Name", L"fore:#A000A0", L"" }, - { SCE_RB_INSTANCE_VAR, 63318, L"Instance Var", L"fore:#B00080", L"" }, - { SCE_RB_CLASS_VAR, 63319, L"Class Var", L"fore:#8000B0", L"" }, - { SCE_RB_DATASECTION, 63320, L"Data Section", L"fore:#600000; back:#FFF0D8; eolfilled", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_LUA = { -"and break do else elseif end false for function goto if " -"in local nil not or repeat return then true until while", -// Basic Functions -"_VERSION assert collectgarbage dofile error gcinfo loadfile loadstring print rawget rawset " -"require tonumber tostring type unpack _ALERT _ERRORMESSAGE _INPUT _PROMPT _OUTPUT _STDERR " -"_STDIN _STDOUT call dostring foreach foreachi getn globals newtype sort tinsert tremove " -"_G getfenv getmetatable ipairs loadlib next pairs pcall rawequal setfenv setmetatable xpcall " -"string table math coroutine io os debug load module select", -// String Manipulation, Table Manipulation, Mathematical Functions -"abs acos asin atan atan2 ceil cos deg exp floor format frexp gsub ldexp log log10 max min " -"mod rad random randomseed sin sqrt strbyte strchar strfind strlen strlower strrep strsub strupper tan " -"string.byte string.char string.dump string.find string.len string.lower string.rep string.sub string.upper " -"string.format string.gfind string.gsub table.concat table.foreach table.foreachi table.getn table.sort " -"table.insert table.remove table.setn math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos " -"math.deg math.exp math.floor math.frexp math.ldexp math.log math.log10 math.max math.min math.mod " -"math.pi math.pow math.rad math.random math.randomseed math.sin math.sqrt math.tan string.gmatch " -"string.match string.reverse table.maxn math.cosh math.fmod math.modf math.sinh math.tanh math.huge", -// Input and Output Facilities & System Facilities Coroutine Manipulation, -//Input and Output Facilities, System Facilities (coroutine & io & os) -"openfile closefile readfrom writeto appendto remove rename flush seek tmpfile tmpname read " -"write clock date difftime execute exit getenv setlocale time coroutine.create coroutine.resume " -"coroutine.status coroutine.wrap coroutine.yield io.close io.flush io.input io.lines io.open io.output " -"io.read io.tmpfile io.type io.write io.stdin io.stdout io.stderr os.clock os.date os.difftime " -"os.execute os.exit os.getenv os.remove os.rename os.setlocale os.time os.tmpname coroutine.running " -"package.cpath package.loaded package.loadlib package.path package.preload package.seeall io.popen", -"", "", "", "", "" }; - - -EDITLEXER lexLUA = { SCLEX_LUA, 63033, L"Lua Script", L"lua", L"", &KeyWords_LUA, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_LUA_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_LUA_COMMENT,SCE_LUA_COMMENTLINE,SCE_LUA_COMMENTDOC,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_LUA_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - { SCE_LUA_WORD, 63128, L"Keyword", L"fore:#00007F", L"" }, - { SCE_LUA_WORD2, 63321, L"Basic Functions", L"fore:#00007F", L"" }, - { SCE_LUA_WORD3, 63322, L"String, Table & Math Functions", L"fore:#00007F", L"" }, - { SCE_LUA_WORD4, 63323, L"Input, Output & System Facilities", L"fore:#00007F", L"" }, - { MULTI_STYLE(SCE_LUA_STRING,SCE_LUA_STRINGEOL,SCE_LUA_CHARACTER,0), 63131, L"String", L"fore:#B000B0", L"" }, - { SCE_LUA_LITERALSTRING, 63302, L"Literal String", L"fore:#B000B0", L"" }, - { SCE_LUA_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - { SCE_LUA_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_LUA_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_LUA_LABEL, 63235, L"Label", L"fore:#808000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_BASH = { -"alias ar asa awk banner basename bash bc bdiff break bunzip2 bzip2 cal calendar case cat " -"cc cd chmod cksum clear cmp col comm compress continue cp cpio crypt csplit ctags cut date " -"dc dd declare deroff dev df diff diff3 dircmp dirname do done du echo ed egrep elif else " -"env esac eval ex exec exit expand export expr false fc fgrep fi file find fmt fold for function " -"functions getconf getopt getopts grep gres hash head help history iconv id if in integer " -"jobs join kill local lc let line ln logname look ls m4 mail mailx make man mkdir more mt mv " -"newgrp nl nm nohup ntps od pack paste patch pathchk pax pcat perl pg pr print printf ps pwd " -"read readonly red return rev rm rmdir sed select set sh shift size sleep sort spell split " -"start stop strings strip stty sum suspend sync tail tar tee test then time times touch tr " -"trap true tsort tty type typeset ulimit umask unalias uname uncompress unexpand uniq unpack " -"unset until uudecode uuencode vi vim vpax wait wc whence which while who wpaste wstart xargs " -"zcat chgrp chown chroot dir dircolors factor groups hostid install link md5sum mkfifo mknod " -"nice pinky printenv ptx readlink seq sha1sum shred stat su tac unlink users vdir whoami yes", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexBASH = { SCLEX_BASH, 63026, L"Shell Script", L"sh", L"", &KeyWords_BASH, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_SH_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_SH_ERROR, 63261, L"Error", L"", L"" }, - { SCE_SH_COMMENTLINE, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_SH_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - { SCE_SH_WORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, - { SCE_SH_STRING, 63211, L"String Double Quoted", L"fore:#008080", L"" }, - { SCE_SH_CHARACTER, 63212, L"String Single Quoted", L"fore:#800080", L"" }, - { SCE_SH_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_SH_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_SH_SCALAR, 63268, L"Scalar", L"fore:#808000", L"" }, - { SCE_SH_PARAM, 63269, L"Parameter Expansion", L"fore:#808000; back:#FFFF99", L"" }, - { SCE_SH_BACKTICKS, 63270, L"Back Ticks", L"fore:#FF0080", L"" }, - { SCE_SH_HERE_DELIM, 63271, L"Here-Doc (Delimiter)", L"", L"" }, - { SCE_SH_HERE_Q, 63272, L"Here-Doc (Single Quoted, q)", L"fore:#008080", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_TCL = { -// TCL Keywords -"after append array auto_execok auto_import auto_load auto_load_index auto_qualify beep " -"bgerror binary break case catch cd clock close concat continue dde default echo else " -"elseif encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent " -"flush for foreach format gets glob global history http if incr info interp join lappend " -"lindex linsert list llength load loadTk lrange lreplace lsearch lset lsort memory msgcat " -"namespace open package pid pkg::create pkg_mkIndex Platform-specific proc puts pwd " -"re_syntax read regexp registry regsub rename resource return scan seek set socket source " -"split string subst switch tclLog tclMacPkgSearch tclPkgSetup tclPkgUnknown tell time trace " -"unknown unset update uplevel upvar variable vwait while", -// TK Keywords -"bell bind bindtags bitmap button canvas checkbutton clipboard colors console cursors " -"destroy entry event focus font frame grab grid image Inter-client keysyms label labelframe " -"listbox lower menu menubutton message option options pack panedwindow photo place " -"radiobutton raise scale scrollbar selection send spinbox text tk tk_chooseColor " -"tk_chooseDirectory tk_dialog tk_focusNext tk_getOpenFile tk_messageBox tk_optionMenu " -"tk_popup tk_setPalette tkerror tkvars tkwait toplevel winfo wish wm", -// iTCL Keywords -"@scope body class code common component configbody constructor define destructor hull " -"import inherit itcl itk itk_component itk_initialize itk_interior itk_option iwidgets keep " -"method private protected public", -"", "", "", "", "", "" }; - - -#define SCE_TCL__MULTI_COMMENT MULTI_STYLE(SCE_TCL_COMMENT,SCE_TCL_COMMENTLINE,SCE_TCL_COMMENT_BOX,SCE_TCL_BLOCK_COMMENT) -#define SCE_TCL__MULTI_KEYWORD MULTI_STYLE(SCE_TCL_WORD,SCE_TCL_WORD2,SCE_TCL_WORD3,SCE_TCL_WORD_IN_QUOTE) -#define SCE_TCL__MULTI_SUBSTITUTION MULTI_STYLE(SCE_TCL_SUBSTITUTION,SCE_TCL_SUB_BRACE,0,0) - - -EDITLEXER lexTCL = { SCLEX_TCL, 63034, L"Tcl Script", L"tcl; itcl", L"", &KeyWords_TCL, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_TCL_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_TCL__MULTI_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_TCL__MULTI_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, - { SCE_TCL_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - { SCE_TCL_IN_QUOTE, 63131, L"String", L"fore:#008080", L"" }, - { SCE_TCL_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_TCL_IDENTIFIER, 63129, L"Identifier", L"fore:#800080", L"" }, - { SCE_TCL__MULTI_SUBSTITUTION, 63274, L"Substitution", L"fore:#CC0000", L"" }, - { SCE_TCL_MODIFIER, 63275, L"Modifier", L"fore:#FF00FF", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_AU3 = { -"and byref case const continuecase continueloop default dim do else elseif endfunc endif " -"endselect endswitch endwith enum exit exitloop false for func global if in local next not " -"or redim return select static step switch then to true until wend while with", -"abs acos adlibregister adlibunregister asc ascw asin assign atan autoitsetoption autoitwingettitle " -"autoitwinsettitle beep binary binarylen binarymid binarytostring bitand bitnot bitor bitrotate " -"bitshift bitxor blockinput break call cdtray ceiling chr chrw clipget clipput consoleread " -"consolewrite consolewriteerror controlclick controlcommand controldisable controlenable " -"controlfocus controlgetfocus controlgethandle controlgetpos controlgettext controlhide " -"controllistview controlmove controlsend controlsettext controlshow controltreeview cos dec " -"dircopy dircreate dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree dllcallbackgetptr " -"dllcallbackregister dllclose dllopen dllstructcreate dllstructgetdata dllstructgetptr " -"dllstructgetsize dllstructsetdata drivegetdrive drivegetfilesystem drivegetlabel drivegetserial " -"drivegettype drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree drivespacetotal " -"drivestatus envget envset envupdate eval execute exp filechangedir fileclose filecopy " -"filecreatentfslink filecreateshortcut filedelete fileexists filefindfirstfile filefindnextfile " -"fileflush filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut filegetshortname " -"filegetsize filegettime filegetversion fileinstall filemove fileopen fileopendialog fileread " -"filereadline filerecycle filerecycleempty filesavedialog fileselectfolder filesetattrib filesetpos " -"filesettime filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi guictrlcreatebutton " -"guictrlcreatecheckbox guictrlcreatecombo guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy " -"guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon guictrlcreateinput " -"guictrlcreatelabel guictrlcreatelist guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu " -"guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj guictrlcreatepic guictrlcreateprogress " -"guictrlcreateradio guictrlcreateslider guictrlcreatetab guictrlcreatetabitem guictrlcreatetreeview " -"guictrlcreatetreeviewitem guictrlcreateupdown guictrldelete guictrlgethandle guictrlgetstate " -"guictrlread guictrlrecvmsg guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy " -"guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata guictrlsetdefbkcolor " -"guictrlsetdefcolor guictrlsetfont guictrlsetgraphic guictrlsetimage guictrlsetlimit guictrlsetonevent " -"guictrlsetpos guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete " -"guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators guisetbkcolor guisetcoord " -"guisetcursor guisetfont guisethelp guiseticon guisetonevent guisetstate guisetstyle guistartgroup " -"guiswitch hex hotkeyset httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize " -"inetread inidelete iniread inireadsection inireadsectionnames inirenamesection iniwrite iniwritesection " -"inputbox int isadmin isarray isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword " -"isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag mousedown mousegetcursor " -"mousegetpos mousemove mouseup mousewheel msgbox number objcreate objcreateinterface objevent objevent " -"objget objname onautoitexitregister onautoitexitunregister opt ping pixelchecksum pixelgetcolor " -"pixelsearch pluginclose pluginopen processclose processexists processgetstats processlist " -"processsetpriority processwait processwaitclose progressoff progresson progressset ptr random regdelete " -"regenumkey regenumval regread regwrite round run runas runaswait runwait send sendkeepactive " -"seterror setextended shellexecute shellexecutewait shutdown sin sleep soundplay soundsetwavevolume " -"splashimageon splashoff splashtexton sqrt srandom statusbargettext stderrread stdinwrite " -"stdioclose stdoutread string stringaddcr stringcompare stringformat stringfromasciiarray stringinstr " -"stringisalnum stringisalpha stringisascii stringisdigit stringisfloat stringisint stringislower " -"stringisspace stringisupper stringisxdigit stringleft stringlen stringlower stringmid " -"stringregexp stringregexpreplace stringreplace stringright stringsplit stringstripcr stringstripws " -"stringtoasciiarray stringtobinary stringtrimleft stringtrimright stringupper tan tcpaccept " -"tcpclosesocket tcpconnect tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup " -"timerdiff timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete " -"trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent trayitemsetstate " -"trayitemsettext traysetclick trayseticon traysetonevent traysetpauseicon traysetstate " -"traysettooltip traytip ubound udpbind udpclosesocket udpopen udprecv udpsend udpshutdown " -"udpstartup vargettype winactivate winactive winclose winexists winflash wingetcaretpos " -"wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess wingetstate " -"wingettext wingettitle winkill winlist winmenuselectitem winminimizeall winminimizeallundo " -"winmove winsetontop winsetstate winsettitle winsettrans winwait winwaitactive winwaitclose " -"winwaitnotactive", -"@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitunicode @autoitversion @autoitx64 " -"@com_eventobj @commonfilesdir @compiled @computername @comspec @cpuarch @cr @crlf @desktopcommondir " -"@desktopdepth @desktopdir @desktopheight @desktoprefresh @desktopwidth @documentscommondir " -"@error @exitcode @exitmethod @extended @favoritescommondir @favoritesdir @gui_ctrlhandle " -"@gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid @gui_winhandle @homedrive @homepath @homeshare " -"@hotkeypressed @hour @inetgetactive @inetgetbytesread @ipaddress1 @ipaddress2 @ipaddress3 " -"@ipaddress4 @kblayout @lf @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang " -"@mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype @osversion @programfilesdir " -"@programscommondir @programsdir @scriptdir @scriptfullpath @scriptlinenumber @scriptname @sec " -"@startmenucommondir @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide @sw_lock " -"@sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault @sw_showmaximized @sw_showminimized " -"@sw_showminnoactive @sw_showna @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir " -"@tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday @windowsdir " -"@workingdir @yday @year", -"{!} {#} {^} {{} {}} {+} {alt} {altdown} {altup} {appskey} " -"{asc} {backspace} {break} {browser_back} {browser_favorites} {browser_forward} {browser_home} " -"{browser_refresh} {browser_search} {browser_stop} {bs} {capslock} {ctrldown} {ctrlup} " -"{del} {delete} {down} {end} {enter} {esc} {escape} {f1} {f10} {f11} {f12} {f2} {f3} " -"{f4} {f5} {f6} {f7} {f8} {f9} {home} {ins} {insert} {lalt} {launch_app1} {launch_app2} " -"{launch_mail} {launch_media} {lctrl} {left} {lshift} {lwin} {lwindown} {lwinup} {media_next} " -"{media_play_pause} {media_prev} {media_stop} {numlock} {numpad0} {numpad1} {numpad2} " -"{numpad3} {numpad4} {numpad5} {numpad6} {numpad7} {numpad8} {numpad9} {numpadadd} " -"{numpaddiv} {numpaddot} {numpadenter} {numpadmult} {numpadsub} {pause} {pgdn} {pgup} " -"{printscreen} {ralt} {rctrl} {right} {rshift} {rwin} {rwindown} {rwinup} {scrolllock} " -"{shiftdown} {shiftup} {sleep} {space} {tab} {up} {volume_down} {volume_mute} {volume_up}", -"#ce #comments-end #comments-start #cs #include #include-once #noautoit3execute #notrayicon " -"#onautoitstartregister #requireadmin", -"#autoit3wrapper_au3check_parameters #autoit3wrapper_au3check_stop_onwarning " -"#autoit3wrapper_change2cui #autoit3wrapper_compression #autoit3wrapper_cvswrapper_parameters " -"#autoit3wrapper_icon #autoit3wrapper_outfile #autoit3wrapper_outfile_type #autoit3wrapper_plugin_funcs " -"#autoit3wrapper_res_comment #autoit3wrapper_res_description #autoit3wrapper_res_field " -"#autoit3wrapper_res_file_add #autoit3wrapper_res_fileversion #autoit3wrapper_res_fileversion_autoincrement " -"#autoit3wrapper_res_icon_add #autoit3wrapper_res_language #autoit3wrapper_res_legalcopyright " -"#autoit3wrapper_res_requestedexecutionlevel #autoit3wrapper_res_savesource #autoit3wrapper_run_after " -"#autoit3wrapper_run_au3check #autoit3wrapper_run_before #autoit3wrapper_run_cvswrapper " -"#autoit3wrapper_run_debug_mode #autoit3wrapper_run_obfuscator #autoit3wrapper_run_tidy " -"#autoit3wrapper_tidy_stop_onerror #autoit3wrapper_useansi #autoit3wrapper_useupx " -"#autoit3wrapper_usex64 #autoit3wrapper_version #endregion #forceref #obfuscator_ignore_funcs " -"#obfuscator_ignore_variables #obfuscator_parameters #region #tidy_parameters", -"", // Reserved for expand -"_arrayadd _arraybinarysearch _arraycombinations _arrayconcatenate _arraydelete _arraydisplay _arrayfindall " -"_arrayinsert _arraymax _arraymaxindex _arraymin _arrayminindex _arraypermute _arraypop _arraypush " -"_arrayreverse _arraysearch _arraysort _arrayswap _arraytoclip _arraytostring _arraytrim _arrayunique _assert " -"_choosecolor _choosefont _clipboard_changechain _clipboard_close _clipboard _countformats _clipboard_empty " -"_clipboard_enumformats _clipboard_formatstr _clipboard_getdata _clipboard_getdataex _clipboard_getformatname " -"_clipboard_getopenwindow _clipboard_getowner _clipboard_getpriorityformat _clipboard_getsequencenumber " -"_clipboard_getviewer _clipboard_isformatavailable _clipboard_open _clipboard_registerformat " -"_clipboard_setdata _clipboard_setdataex _clipboard_setviewer _clipputfile _colorconverthsltorgb " -"_colorconvertrgbtohsl _colorgetblue _colorgetcolorref _colorgetgreen _colorgetred _colorgetrgb " -"_colorsetcolorref _colorsetrgb _crypt_decryptdata _crypt_decryptfile _crypt_derivekey _crypt_destroykey " -"_crypt_encryptdata _crypt_encryptfile _crypt_hashdata _crypt_hashfile _crypt_shutdown _crypt_startup " -"_date_time_comparefiletime _date_time_dosdatetimetoarray _date_time_dosdatetimetofiletime " -"_date_time_dosdatetimetostr _date_time_dosdatetoarray _date_time_dosdatetostr _date_time_dostimetoarray " -"_date_time_dostimetostr _date_time_encodefiletime _date_time_encodesystemtime _date_time_filetimetoarray " -"_date_time_filetimetodosdatetime _date_time_filetimetolocalfiletime _date_time_filetimetostr " -"_date_time_filetimetosystemtime _date_time_getfiletime _date_time_getlocaltime _date_time_getsystemtime " -"_date_time_getsystemtimeadjustment _date_time_getsystemtimeasfiletime _date_time_getsystemtimes " -"_date_time_gettickcount _date_time_gettimezoneinformation _date_time_localfiletimetofiletime " -"_date_time_setfiletime _date_time_setlocaltime _date_time_setsystemtime _date_time_setsystemtimeadjustment " -"_date_time_settimezoneinformation _date_time_systemtimetoarray _date_time_systemtimetodatestr " -"_date_time_systemtimetodatetimestr _date_time_systemtimetofiletime _date_time_systemtimetotimestr " -"_date_time_systemtimetotzspecificlocaltime _date_time_tzspecificlocaltimetosystemtime _dateadd " -"_datedayofweek _datedaysinmonth _datediff _dateisleapyear _dateisvalid _datetimeformat _datetimesplit " -"_datetodayofweek _datetodayofweekiso _datetodayvalue _datetomonth _dayvaluetodate _debugbugreportenv " -"_debugout _debugreport _debugreportex _debugreportvar _debugsetup _degree _eventlog__backup _eventlog__clear " -"_eventlog__close _eventlog__count _eventlog__deregistersource _eventlog__full _eventlog__notify " -"_eventlog__oldest _eventlog__open _eventlog__openbackup _eventlog__read _eventlog__registersource " -"_eventlog__report _excelbookattach _excelbookclose _excelbooknew _excelbookopen _excelbooksave " -"_excelbooksaveas _excelcolumndelete _excelcolumninsert _excelfontsetproperties _excelhorizontalalignset " -"_excelhyperlinkinsert _excelnumberformat _excelreadarray _excelreadcell _excelreadsheettoarray " -"_excelrowdelete _excelrowinsert _excelsheetactivate _excelsheetaddnew _excelsheetdelete _excelsheetlist " -"_excelsheetmove _excelsheetnameget _excelsheetnameset _excelwritearray _excelwritecell _excelwriteformula " -"_excelwritesheetfromarray _filecountlines _filecreate _filelisttoarray _fileprint _filereadtoarray " -"_filewritefromarray _filewritelog _filewritetoline _ftp_close _ftp_command _ftp_connect " -"_ftp_decodeinternetstatus _ftp_dircreate _ftp_dirdelete _ftp_dirgetcurrent _ftp_dirputcontents " -"_ftp_dirsetcurrent _ftp_fileclose _ftp_filedelete _ftp_fileget _ftp_filegetsize _ftp_fileopen _ftp_fileput " -"_ftp_fileread _ftp_filerename _ftp_filetimelohitostr _ftp_findfileclose _ftp_findfilefirst _ftp_findfilenext " -"_ftp_getlastresponseinfo _ftp_listtoarray _ftp_listtoarray2d _ftp_listtoarrayex _ftp_open " -"_ftp_progressdownload _ftp_progressupload _ftp_setstatuscallback _gdiplus_arrowcapcreate " -"_gdiplus_arrowcapdispose _gdiplus_arrowcapgetfillstate _gdiplus_arrowcapgetheight " -"_gdiplus_arrowcapgetmiddleinset _gdiplus_arrowcapgetwidth _gdiplus_arrowcapsetfillstate " -"_gdiplus_arrowcapsetheight _gdiplus_arrowcapsetmiddleinset _gdiplus_arrowcapsetwidth " -"_gdiplus_bitmapclonearea _gdiplus_bitmapcreatefromfile _gdiplus_bitmapcreatefromgraphics " -"_gdiplus_bitmapcreatefromhbitmap _gdiplus_bitmapcreatehbitmapfrombitmap _gdiplus_bitmapdispose " -"_gdiplus_bitmaplockbits _gdiplus_bitmapunlockbits _gdiplus_brushclone _gdiplus_brushcreatesolid " -"_gdiplus_brushdispose _gdiplus_brushgetsolidcolor _gdiplus_brushgettype _gdiplus_brushsetsolidcolor " -"_gdiplus_customlinecapdispose _gdiplus_decoders _gdiplus_decodersgetcount _gdiplus_decodersgetsize " -"_gdiplus_drawimagepoints _gdiplus_encoders _gdiplus_encodersgetclsid _gdiplus_encodersgetcount " -"_gdiplus_encodersgetparamlist _gdiplus_encodersgetparamlistsize _gdiplus_encodersgetsize _gdiplus_fontcreate " -"_gdiplus_fontdispose _gdiplus_fontfamilycreate _gdiplus_fontfamilydispose _gdiplus_graphicsclear " -"_gdiplus_graphicscreatefromhdc _gdiplus_graphicscreatefromhwnd _gdiplus_graphicsdispose " -"_gdiplus_graphicsdrawarc _gdiplus_graphicsdrawbezier _gdiplus_graphicsdrawclosedcurve " -"_gdiplus_graphicsdrawcurve _gdiplus_graphicsdrawellipse _gdiplus_graphicsdrawimage " -"_gdiplus_graphicsdrawimagerect _gdiplus_graphicsdrawimagerectrect _gdiplus_graphicsdrawline " -"_gdiplus_graphicsdrawpie _gdiplus_graphicsdrawpolygon _gdiplus_graphicsdrawrect _gdiplus_graphicsdrawstring " -"_gdiplus_graphicsdrawstringex _gdiplus_graphicsfillclosedcurve _gdiplus_graphicsfillellipse " -"_gdiplus_graphicsfillpie _gdiplus_graphicsfillpolygon _gdiplus_graphicsfillrect _gdiplus_graphicsgetdc " -"_gdiplus_graphicsgetsmoothingmode _gdiplus_graphicsmeasurestring _gdiplus_graphicsreleasedc " -"_gdiplus_graphicssetsmoothingmode _gdiplus_graphicssettransform _gdiplus_imagedispose _gdiplus_imagegetflags " -"_gdiplus_imagegetgraphicscontext _gdiplus_imagegetheight _gdiplus_imagegethorizontalresolution " -"_gdiplus_imagegetpixelformat _gdiplus_imagegetrawformat _gdiplus_imagegettype " -"_gdiplus_imagegetverticalresolution _gdiplus_imagegetwidth _gdiplus_imageloadfromfile " -"_gdiplus_imagesavetofile _gdiplus_imagesavetofileex _gdiplus_matrixcreate _gdiplus_matrixdispose " -"_gdiplus_matrixrotate _gdiplus_matrixscale _gdiplus_matrixtranslate _gdiplus_paramadd _gdiplus_paraminit " -"_gdiplus_pencreate _gdiplus_pendispose _gdiplus_pengetalignment _gdiplus_pengetcolor " -"_gdiplus_pengetcustomendcap _gdiplus_pengetdashcap _gdiplus_pengetdashstyle _gdiplus_pengetendcap " -"_gdiplus_pengetwidth _gdiplus_pensetalignment _gdiplus_pensetcolor _gdiplus_pensetcustomendcap " -"_gdiplus_pensetdashcap _gdiplus_pensetdashstyle _gdiplus_pensetendcap _gdiplus_pensetwidth " -"_gdiplus_rectfcreate _gdiplus_shutdown _gdiplus_startup _gdiplus_stringformatcreate " -"_gdiplus_stringformatdispose _gdiplus_stringformatsetalign _getip _guictrlavi_close _guictrlavi_create " -"_guictrlavi_destroy _guictrlavi_isplaying _guictrlavi_open _guictrlavi_openex _guictrlavi_play " -"_guictrlavi_seek _guictrlavi_show _guictrlavi_stop _guictrlbutton_click _guictrlbutton_create " -"_guictrlbutton_destroy _guictrlbutton_enable _guictrlbutton_getcheck _guictrlbutton_getfocus " -"_guictrlbutton_getidealsize _guictrlbutton_getimage _guictrlbutton_getimagelist _guictrlbutton_getnote " -"_guictrlbutton_getnotelength _guictrlbutton_getsplitinfo _guictrlbutton_getstate _guictrlbutton_gettext " -"_guictrlbutton_gettextmargin _guictrlbutton_setcheck _guictrlbutton_setdontclick _guictrlbutton_setfocus " -"_guictrlbutton_setimage _guictrlbutton_setimagelist _guictrlbutton_setnote _guictrlbutton_setshield " -"_guictrlbutton_setsize _guictrlbutton_setsplitinfo _guictrlbutton_setstate _guictrlbutton_setstyle " -"_guictrlbutton_settext _guictrlbutton_settextmargin _guictrlbutton_show _guictrlcombobox_adddir " -"_guictrlcombobox_addstring _guictrlcombobox_autocomplete _guictrlcombobox_beginupdate " -"_guictrlcombobox_create _guictrlcombobox_deletestring _guictrlcombobox_destroy _guictrlcombobox_endupdate " -"_guictrlcombobox_findstring _guictrlcombobox_findstringexact _guictrlcombobox_getcomboboxinfo " -"_guictrlcombobox_getcount _guictrlcombobox_getcuebanner _guictrlcombobox_getcursel " -"_guictrlcombobox_getdroppedcontrolrect _guictrlcombobox_getdroppedcontrolrectex " -"_guictrlcombobox_getdroppedstate _guictrlcombobox_getdroppedwidth _guictrlcombobox_geteditsel " -"_guictrlcombobox_getedittext _guictrlcombobox_getextendedui _guictrlcombobox_gethorizontalextent " -"_guictrlcombobox_getitemheight _guictrlcombobox_getlbtext _guictrlcombobox_getlbtextlen " -"_guictrlcombobox_getlist _guictrlcombobox_getlistarray _guictrlcombobox_getlocale " -"_guictrlcombobox_getlocalecountry _guictrlcombobox_getlocalelang _guictrlcombobox_getlocaleprimlang " -"_guictrlcombobox_getlocalesublang _guictrlcombobox_getminvisible _guictrlcombobox_gettopindex " -"_guictrlcombobox_initstorage _guictrlcombobox_insertstring _guictrlcombobox_limittext " -"_guictrlcombobox_replaceeditsel _guictrlcombobox_resetcontent _guictrlcombobox_selectstring " -"_guictrlcombobox_setcuebanner _guictrlcombobox_setcursel _guictrlcombobox_setdroppedwidth " -"_guictrlcombobox_seteditsel _guictrlcombobox_setedittext _guictrlcombobox_setextendedui " -"_guictrlcombobox_sethorizontalextent _guictrlcombobox_setitemheight _guictrlcombobox_setminvisible " -"_guictrlcombobox_settopindex _guictrlcombobox_showdropdown _guictrlcomboboxex_adddir " -"_guictrlcomboboxex_addstring _guictrlcomboboxex_beginupdate _guictrlcomboboxex_create " -"_guictrlcomboboxex_createsolidbitmap _guictrlcomboboxex_deletestring _guictrlcomboboxex_destroy " -"_guictrlcomboboxex_endupdate _guictrlcomboboxex_findstringexact _guictrlcomboboxex_getcomboboxinfo " -"_guictrlcomboboxex_getcombocontrol _guictrlcomboboxex_getcount _guictrlcomboboxex_getcursel " -"_guictrlcomboboxex_getdroppedcontrolrect _guictrlcomboboxex_getdroppedcontrolrectex " -"_guictrlcomboboxex_getdroppedstate _guictrlcomboboxex_getdroppedwidth _guictrlcomboboxex_geteditcontrol " -"_guictrlcomboboxex_geteditsel _guictrlcomboboxex_getedittext _guictrlcomboboxex_getextendedstyle " -"_guictrlcomboboxex_getextendedui _guictrlcomboboxex_getimagelist _guictrlcomboboxex_getitem " -"_guictrlcomboboxex_getitemex _guictrlcomboboxex_getitemheight _guictrlcomboboxex_getitemimage " -"_guictrlcomboboxex_getitemindent _guictrlcomboboxex_getitemoverlayimage _guictrlcomboboxex_getitemparam " -"_guictrlcomboboxex_getitemselectedimage _guictrlcomboboxex_getitemtext _guictrlcomboboxex_getitemtextlen " -"_guictrlcomboboxex_getlist _guictrlcomboboxex_getlistarray _guictrlcomboboxex_getlocale " -"_guictrlcomboboxex_getlocalecountry _guictrlcomboboxex_getlocalelang _guictrlcomboboxex_getlocaleprimlang " -"_guictrlcomboboxex_getlocalesublang _guictrlcomboboxex_getminvisible _guictrlcomboboxex_gettopindex " -"_guictrlcomboboxex_getunicode _guictrlcomboboxex_initstorage _guictrlcomboboxex_insertstring " -"_guictrlcomboboxex_limittext _guictrlcomboboxex_replaceeditsel _guictrlcomboboxex_resetcontent " -"_guictrlcomboboxex_setcursel _guictrlcomboboxex_setdroppedwidth _guictrlcomboboxex_seteditsel " -"_guictrlcomboboxex_setedittext _guictrlcomboboxex_setextendedstyle _guictrlcomboboxex_setextendedui " -"_guictrlcomboboxex_setimagelist _guictrlcomboboxex_setitem _guictrlcomboboxex_setitemex " -"_guictrlcomboboxex_setitemheight _guictrlcomboboxex_setitemimage _guictrlcomboboxex_setitemindent " -"_guictrlcomboboxex_setitemoverlayimage _guictrlcomboboxex_setitemparam " -"_guictrlcomboboxex_setitemselectedimage _guictrlcomboboxex_setminvisible _guictrlcomboboxex_settopindex " -"_guictrlcomboboxex_setunicode _guictrlcomboboxex_showdropdown _guictrldtp_create _guictrldtp_destroy " -"_guictrldtp_getmccolor _guictrldtp_getmcfont _guictrldtp_getmonthcal _guictrldtp_getrange " -"_guictrldtp_getrangeex _guictrldtp_getsystemtime _guictrldtp_getsystemtimeex _guictrldtp_setformat " -"_guictrldtp_setmccolor _guictrldtp_setmcfont _guictrldtp_setrange _guictrldtp_setrangeex " -"_guictrldtp_setsystemtime _guictrldtp_setsystemtimeex _guictrledit_appendtext _guictrledit_beginupdate " -"_guictrledit_canundo _guictrledit_charfrompos _guictrledit_create _guictrledit_destroy " -"_guictrledit_emptyundobuffer _guictrledit_endupdate _guictrledit_find _guictrledit_fmtlines " -"_guictrledit_getfirstvisibleline _guictrledit_getlimittext _guictrledit_getline _guictrledit_getlinecount " -"_guictrledit_getmargins _guictrledit_getmodify _guictrledit_getpasswordchar _guictrledit_getrect " -"_guictrledit_getrectex _guictrledit_getsel _guictrledit_gettext _guictrledit_gettextlen " -"_guictrledit_hideballoontip _guictrledit_inserttext _guictrledit_linefromchar _guictrledit_lineindex " -"_guictrledit_linelength _guictrledit_linescroll _guictrledit_posfromchar _guictrledit_replacesel " -"_guictrledit_scroll _guictrledit_setlimittext _guictrledit_setmargins _guictrledit_setmodify " -"_guictrledit_setpasswordchar _guictrledit_setreadonly _guictrledit_setrect _guictrledit_setrectex " -"_guictrledit_setrectnp _guictrledit_setrectnpex _guictrledit_setsel _guictrledit_settabstops " -"_guictrledit_settext _guictrledit_showballoontip _guictrledit_undo _guictrlheader_additem " -"_guictrlheader_clearfilter _guictrlheader_clearfilterall _guictrlheader_create " -"_guictrlheader_createdragimage _guictrlheader_deleteitem _guictrlheader_destroy _guictrlheader_editfilter " -"_guictrlheader_getbitmapmargin _guictrlheader_getimagelist _guictrlheader_getitem " -"_guictrlheader_getitemalign _guictrlheader_getitembitmap _guictrlheader_getitemcount " -"_guictrlheader_getitemdisplay _guictrlheader_getitemflags _guictrlheader_getitemformat " -"_guictrlheader_getitemimage _guictrlheader_getitemorder _guictrlheader_getitemparam " -"_guictrlheader_getitemrect _guictrlheader_getitemrectex _guictrlheader_getitemtext " -"_guictrlheader_getitemwidth _guictrlheader_getorderarray _guictrlheader_getunicodeformat " -"_guictrlheader_hittest _guictrlheader_insertitem _guictrlheader_layout _guictrlheader_ordertoindex " -"_guictrlheader_setbitmapmargin _guictrlheader_setfilterchangetimeout _guictrlheader_sethotdivider " -"_guictrlheader_setimagelist _guictrlheader_setitem _guictrlheader_setitemalign " -"_guictrlheader_setitembitmap _guictrlheader_setitemdisplay _guictrlheader_setitemflags " -"_guictrlheader_setitemformat _guictrlheader_setitemimage _guictrlheader_setitemorder " -"_guictrlheader_setitemparam _guictrlheader_setitemtext _guictrlheader_setitemwidth " -"_guictrlheader_setorderarray _guictrlheader_setunicodeformat _guictrlipaddress_clearaddress " -"_guictrlipaddress_create _guictrlipaddress_destroy _guictrlipaddress_get _guictrlipaddress_getarray " -"_guictrlipaddress_getex _guictrlipaddress_isblank _guictrlipaddress_set _guictrlipaddress_setarray " -"_guictrlipaddress_setex _guictrlipaddress_setfocus _guictrlipaddress_setfont _guictrlipaddress_setrange " -"_guictrlipaddress_showhide _guictrllistbox_addfile _guictrllistbox_addstring _guictrllistbox_beginupdate " -"_guictrllistbox_clickitem _guictrllistbox_create _guictrllistbox_deletestring _guictrllistbox_destroy " -"_guictrllistbox_dir _guictrllistbox_endupdate _guictrllistbox_findintext _guictrllistbox_findstring " -"_guictrllistbox_getanchorindex _guictrllistbox_getcaretindex _guictrllistbox_getcount " -"_guictrllistbox_getcursel _guictrllistbox_gethorizontalextent _guictrllistbox_getitemdata " -"_guictrllistbox_getitemheight _guictrllistbox_getitemrect _guictrllistbox_getitemrectex " -"_guictrllistbox_getlistboxinfo _guictrllistbox_getlocale _guictrllistbox_getlocalecountry " -"_guictrllistbox_getlocalelang _guictrllistbox_getlocaleprimlang _guictrllistbox_getlocalesublang " -"_guictrllistbox_getsel _guictrllistbox_getselcount _guictrllistbox_getselitems " -"_guictrllistbox_getselitemstext _guictrllistbox_gettext _guictrllistbox_gettextlen " -"_guictrllistbox_gettopindex _guictrllistbox_initstorage _guictrllistbox_insertstring " -"_guictrllistbox_itemfrompoint _guictrllistbox_replacestring _guictrllistbox_resetcontent " -"_guictrllistbox_selectstring _guictrllistbox_selitemrange _guictrllistbox_selitemrangeex " -"_guictrllistbox_setanchorindex _guictrllistbox_setcaretindex _guictrllistbox_setcolumnwidth " -"_guictrllistbox_setcursel _guictrllistbox_sethorizontalextent _guictrllistbox_setitemdata " -"_guictrllistbox_setitemheight _guictrllistbox_setlocale _guictrllistbox_setsel _guictrllistbox_settabstops " -"_guictrllistbox_settopindex _guictrllistbox_sort _guictrllistbox_swapstring _guictrllistbox_updatehscroll " -"_guictrllistview_addarray _guictrllistview_addcolumn _guictrllistview_additem _guictrllistview_addsubitem " -"_guictrllistview_approximateviewheight _guictrllistview_approximateviewrect " -"_guictrllistview_approximateviewwidth _guictrllistview_arrange _guictrllistview_beginupdate " -"_guictrllistview_canceleditlabel _guictrllistview_clickitem _guictrllistview_copyitems " -"_guictrllistview_create _guictrllistview_createdragimage _guictrllistview_createsolidbitmap " -"_guictrllistview_deleteallitems _guictrllistview_deletecolumn _guictrllistview_deleteitem " -"_guictrllistview_deleteitemsselected _guictrllistview_destroy _guictrllistview_drawdragimage " -"_guictrllistview_editlabel _guictrllistview_enablegroupview _guictrllistview_endupdate " -"_guictrllistview_ensurevisible _guictrllistview_findintext _guictrllistview_finditem " -"_guictrllistview_findnearest _guictrllistview_findparam _guictrllistview_findtext " -"_guictrllistview_getbkcolor _guictrllistview_getbkimage _guictrllistview_getcallbackmask " -"_guictrllistview_getcolumn _guictrllistview_getcolumncount _guictrllistview_getcolumnorder " -"_guictrllistview_getcolumnorderarray _guictrllistview_getcolumnwidth _guictrllistview_getcounterpage " -"_guictrllistview_geteditcontrol _guictrllistview_getextendedlistviewstyle _guictrllistview_getfocusedgroup " -"_guictrllistview_getgroupcount _guictrllistview_getgroupinfo _guictrllistview_getgroupinfobyindex " -"_guictrllistview_getgrouprect _guictrllistview_getgroupviewenabled _guictrllistview_getheader " -"_guictrllistview_gethotcursor _guictrllistview_gethotitem _guictrllistview_gethovertime " -"_guictrllistview_getimagelist _guictrllistview_getisearchstring _guictrllistview_getitem " -"_guictrllistview_getitemchecked _guictrllistview_getitemcount _guictrllistview_getitemcut " -"_guictrllistview_getitemdrophilited _guictrllistview_getitemex _guictrllistview_getitemfocused " -"_guictrllistview_getitemgroupid _guictrllistview_getitemimage _guictrllistview_getitemindent " -"_guictrllistview_getitemparam _guictrllistview_getitemposition _guictrllistview_getitempositionx " -"_guictrllistview_getitempositiony _guictrllistview_getitemrect _guictrllistview_getitemrectex " -"_guictrllistview_getitemselected _guictrllistview_getitemspacing _guictrllistview_getitemspacingx " -"_guictrllistview_getitemspacingy _guictrllistview_getitemstate _guictrllistview_getitemstateimage " -"_guictrllistview_getitemtext _guictrllistview_getitemtextarray _guictrllistview_getitemtextstring " -"_guictrllistview_getnextitem _guictrllistview_getnumberofworkareas _guictrllistview_getorigin " -"_guictrllistview_getoriginx _guictrllistview_getoriginy _guictrllistview_getoutlinecolor " -"_guictrllistview_getselectedcolumn _guictrllistview_getselectedcount _guictrllistview_getselectedindices " -"_guictrllistview_getselectionmark _guictrllistview_getstringwidth _guictrllistview_getsubitemrect " -"_guictrllistview_gettextbkcolor _guictrllistview_gettextcolor _guictrllistview_gettooltips " -"_guictrllistview_gettopindex _guictrllistview_getunicodeformat _guictrllistview_getview " -"_guictrllistview_getviewdetails _guictrllistview_getviewlarge _guictrllistview_getviewlist " -"_guictrllistview_getviewrect _guictrllistview_getviewsmall _guictrllistview_getviewtile " -"_guictrllistview_hidecolumn _guictrllistview_hittest _guictrllistview_insertcolumn " -"_guictrllistview_insertgroup _guictrllistview_insertitem _guictrllistview_justifycolumn " -"_guictrllistview_mapidtoindex _guictrllistview_mapindextoid _guictrllistview_redrawitems " -"_guictrllistview_registersortcallback _guictrllistview_removeallgroups _guictrllistview_removegroup " -"_guictrllistview_scroll _guictrllistview_setbkcolor _guictrllistview_setbkimage " -"_guictrllistview_setcallbackmask _guictrllistview_setcolumn _guictrllistview_setcolumnorder " -"_guictrllistview_setcolumnorderarray _guictrllistview_setcolumnwidth " -"_guictrllistview_setextendedlistviewstyle _guictrllistview_setgroupinfo _guictrllistview_sethotitem " -"_guictrllistview_sethovertime _guictrllistview_seticonspacing _guictrllistview_setimagelist " -"_guictrllistview_setitem _guictrllistview_setitemchecked _guictrllistview_setitemcount " -"_guictrllistview_setitemcut _guictrllistview_setitemdrophilited _guictrllistview_setitemex " -"_guictrllistview_setitemfocused _guictrllistview_setitemgroupid _guictrllistview_setitemimage " -"_guictrllistview_setitemindent _guictrllistview_setitemparam _guictrllistview_setitemposition " -"_guictrllistview_setitemposition32 _guictrllistview_setitemselected _guictrllistview_setitemstate " -"_guictrllistview_setitemstateimage _guictrllistview_setitemtext _guictrllistview_setoutlinecolor " -"_guictrllistview_setselectedcolumn _guictrllistview_setselectionmark _guictrllistview_settextbkcolor " -"_guictrllistview_settextcolor _guictrllistview_settooltips _guictrllistview_setunicodeformat " -"_guictrllistview_setview _guictrllistview_setworkareas _guictrllistview_simplesort " -"_guictrllistview_sortitems _guictrllistview_subitemhittest _guictrllistview_unregistersortcallback " -"_guictrlmenu_addmenuitem _guictrlmenu_appendmenu _guictrlmenu_checkmenuitem _guictrlmenu_checkradioitem " -"_guictrlmenu_createmenu _guictrlmenu_createpopup _guictrlmenu_deletemenu _guictrlmenu_destroymenu " -"_guictrlmenu_drawmenubar _guictrlmenu_enablemenuitem _guictrlmenu_finditem _guictrlmenu_findparent " -"_guictrlmenu_getitembmp _guictrlmenu_getitembmpchecked _guictrlmenu_getitembmpunchecked " -"_guictrlmenu_getitemchecked _guictrlmenu_getitemcount _guictrlmenu_getitemdata _guictrlmenu_getitemdefault " -"_guictrlmenu_getitemdisabled _guictrlmenu_getitemenabled _guictrlmenu_getitemgrayed " -"_guictrlmenu_getitemhighlighted _guictrlmenu_getitemid _guictrlmenu_getiteminfo _guictrlmenu_getitemrect " -"_guictrlmenu_getitemrectex _guictrlmenu_getitemstate _guictrlmenu_getitemstateex " -"_guictrlmenu_getitemsubmenu _guictrlmenu_getitemtext _guictrlmenu_getitemtype _guictrlmenu_getmenu " -"_guictrlmenu_getmenubackground _guictrlmenu_getmenubarinfo _guictrlmenu_getmenucontexthelpid " -"_guictrlmenu_getmenudata _guictrlmenu_getmenudefaultitem _guictrlmenu_getmenuheight " -"_guictrlmenu_getmenuinfo _guictrlmenu_getmenustyle _guictrlmenu_getsystemmenu _guictrlmenu_insertmenuitem " -"_guictrlmenu_insertmenuitemex _guictrlmenu_ismenu _guictrlmenu_loadmenu _guictrlmenu_mapaccelerator " -"_guictrlmenu_menuitemfrompoint _guictrlmenu_removemenu _guictrlmenu_setitembitmaps _guictrlmenu_setitembmp " -"_guictrlmenu_setitembmpchecked _guictrlmenu_setitembmpunchecked _guictrlmenu_setitemchecked " -"_guictrlmenu_setitemdata _guictrlmenu_setitemdefault _guictrlmenu_setitemdisabled " -"_guictrlmenu_setitemenabled _guictrlmenu_setitemgrayed _guictrlmenu_setitemhighlighted " -"_guictrlmenu_setitemid _guictrlmenu_setiteminfo _guictrlmenu_setitemstate _guictrlmenu_setitemsubmenu " -"_guictrlmenu_setitemtext _guictrlmenu_setitemtype _guictrlmenu_setmenu _guictrlmenu_setmenubackground " -"_guictrlmenu_setmenucontexthelpid _guictrlmenu_setmenudata _guictrlmenu_setmenudefaultitem " -"_guictrlmenu_setmenuheight _guictrlmenu_setmenuinfo _guictrlmenu_setmenustyle _guictrlmenu_trackpopupmenu " -"_guictrlmonthcal_create _guictrlmonthcal_destroy _guictrlmonthcal_getcalendarborder " -"_guictrlmonthcal_getcalendarcount _guictrlmonthcal_getcolor _guictrlmonthcal_getcolorarray " -"_guictrlmonthcal_getcursel _guictrlmonthcal_getcurselstr _guictrlmonthcal_getfirstdow " -"_guictrlmonthcal_getfirstdowstr _guictrlmonthcal_getmaxselcount _guictrlmonthcal_getmaxtodaywidth " -"_guictrlmonthcal_getminreqheight _guictrlmonthcal_getminreqrect _guictrlmonthcal_getminreqrectarray " -"_guictrlmonthcal_getminreqwidth _guictrlmonthcal_getmonthdelta _guictrlmonthcal_getmonthrange " -"_guictrlmonthcal_getmonthrangemax _guictrlmonthcal_getmonthrangemaxstr _guictrlmonthcal_getmonthrangemin " -"_guictrlmonthcal_getmonthrangeminstr _guictrlmonthcal_getmonthrangespan _guictrlmonthcal_getrange " -"_guictrlmonthcal_getrangemax _guictrlmonthcal_getrangemaxstr _guictrlmonthcal_getrangemin " -"_guictrlmonthcal_getrangeminstr _guictrlmonthcal_getselrange _guictrlmonthcal_getselrangemax " -"_guictrlmonthcal_getselrangemaxstr _guictrlmonthcal_getselrangemin _guictrlmonthcal_getselrangeminstr " -"_guictrlmonthcal_gettoday _guictrlmonthcal_gettodaystr _guictrlmonthcal_getunicodeformat " -"_guictrlmonthcal_hittest _guictrlmonthcal_setcalendarborder _guictrlmonthcal_setcolor " -"_guictrlmonthcal_setcursel _guictrlmonthcal_setdaystate _guictrlmonthcal_setfirstdow " -"_guictrlmonthcal_setmaxselcount _guictrlmonthcal_setmonthdelta _guictrlmonthcal_setrange " -"_guictrlmonthcal_setselrange _guictrlmonthcal_settoday _guictrlmonthcal_setunicodeformat " -"_guictrlrebar_addband _guictrlrebar_addtoolbarband _guictrlrebar_begindrag _guictrlrebar_create " -"_guictrlrebar_deleteband _guictrlrebar_destroy _guictrlrebar_dragmove _guictrlrebar_enddrag " -"_guictrlrebar_getbandbackcolor _guictrlrebar_getbandborders _guictrlrebar_getbandbordersex " -"_guictrlrebar_getbandchildhandle _guictrlrebar_getbandchildsize _guictrlrebar_getbandcount " -"_guictrlrebar_getbandforecolor _guictrlrebar_getbandheadersize _guictrlrebar_getbandid " -"_guictrlrebar_getbandidealsize _guictrlrebar_getbandlength _guictrlrebar_getbandlparam " -"_guictrlrebar_getbandmargins _guictrlrebar_getbandmarginsex _guictrlrebar_getbandrect " -"_guictrlrebar_getbandrectex _guictrlrebar_getbandstyle _guictrlrebar_getbandstylebreak " -"_guictrlrebar_getbandstylechildedge _guictrlrebar_getbandstylefixedbmp _guictrlrebar_getbandstylefixedsize " -"_guictrlrebar_getbandstylegripperalways _guictrlrebar_getbandstylehidden " -"_guictrlrebar_getbandstylehidetitle _guictrlrebar_getbandstylenogripper _guictrlrebar_getbandstyletopalign " -"_guictrlrebar_getbandstyleusechevron _guictrlrebar_getbandstylevariableheight _guictrlrebar_getbandtext " -"_guictrlrebar_getbarheight _guictrlrebar_getbarinfo _guictrlrebar_getbkcolor _guictrlrebar_getcolorscheme " -"_guictrlrebar_getrowcount _guictrlrebar_getrowheight _guictrlrebar_gettextcolor _guictrlrebar_gettooltips " -"_guictrlrebar_getunicodeformat _guictrlrebar_hittest _guictrlrebar_idtoindex _guictrlrebar_maximizeband " -"_guictrlrebar_minimizeband _guictrlrebar_moveband _guictrlrebar_setbandbackcolor " -"_guictrlrebar_setbandforecolor _guictrlrebar_setbandheadersize _guictrlrebar_setbandid " -"_guictrlrebar_setbandidealsize _guictrlrebar_setbandlength _guictrlrebar_setbandlparam " -"_guictrlrebar_setbandstyle _guictrlrebar_setbandstylebreak _guictrlrebar_setbandstylechildedge " -"_guictrlrebar_setbandstylefixedbmp _guictrlrebar_setbandstylefixedsize " -"_guictrlrebar_setbandstylegripperalways _guictrlrebar_setbandstylehidden " -"_guictrlrebar_setbandstylehidetitle _guictrlrebar_setbandstylenogripper _guictrlrebar_setbandstyletopalign " -"_guictrlrebar_setbandstyleusechevron _guictrlrebar_setbandstylevariableheight _guictrlrebar_setbandtext " -"_guictrlrebar_setbarinfo _guictrlrebar_setbkcolor _guictrlrebar_setcolorscheme _guictrlrebar_settextcolor " -"_guictrlrebar_settooltips _guictrlrebar_setunicodeformat _guictrlrebar_showband " -"_guictrlrichedit_appendtext _guictrlrichedit_autodetecturl _guictrlrichedit_canpaste " -"_guictrlrichedit_canpastespecial _guictrlrichedit_canredo _guictrlrichedit_canundo " -"_guictrlrichedit_changefontsize _guictrlrichedit_copy _guictrlrichedit_create _guictrlrichedit_cut " -"_guictrlrichedit_deselect _guictrlrichedit_destroy _guictrlrichedit_emptyundobuffer " -"_guictrlrichedit_findtext _guictrlrichedit_findtextinrange _guictrlrichedit_getbkcolor " -"_guictrlrichedit_getcharattributes _guictrlrichedit_getcharbkcolor _guictrlrichedit_getcharcolor " -"_guictrlrichedit_getcharposfromxy _guictrlrichedit_getcharposofnextword " -"_guictrlrichedit_getcharposofpreviousword _guictrlrichedit_getcharwordbreakinfo " -"_guictrlrichedit_getfirstcharposonline _guictrlrichedit_getfont _guictrlrichedit_getlinecount " -"_guictrlrichedit_getlinelength _guictrlrichedit_getlinenumberfromcharpos _guictrlrichedit_getnextredo " -"_guictrlrichedit_getnextundo _guictrlrichedit_getnumberoffirstvisibleline " -"_guictrlrichedit_getparaalignment _guictrlrichedit_getparaattributes _guictrlrichedit_getparaborder " -"_guictrlrichedit_getparaindents _guictrlrichedit_getparanumbering _guictrlrichedit_getparashading " -"_guictrlrichedit_getparaspacing _guictrlrichedit_getparatabstops _guictrlrichedit_getpasswordchar " -"_guictrlrichedit_getrect _guictrlrichedit_getscrollpos _guictrlrichedit_getsel _guictrlrichedit_getselaa " -"_guictrlrichedit_getseltext _guictrlrichedit_getspaceunit _guictrlrichedit_gettext " -"_guictrlrichedit_gettextinline _guictrlrichedit_gettextinrange _guictrlrichedit_gettextlength " -"_guictrlrichedit_getversion _guictrlrichedit_getxyfromcharpos _guictrlrichedit_getzoom " -"_guictrlrichedit_gotocharpos _guictrlrichedit_hideselection _guictrlrichedit_inserttext " -"_guictrlrichedit_ismodified _guictrlrichedit_istextselected _guictrlrichedit_paste " -"_guictrlrichedit_pastespecial _guictrlrichedit_pauseredraw _guictrlrichedit_redo " -"_guictrlrichedit_replacetext _guictrlrichedit_resumeredraw _guictrlrichedit_scrolllineorpage " -"_guictrlrichedit_scrolllines _guictrlrichedit_scrolltocaret _guictrlrichedit_setbkcolor " -"_guictrlrichedit_setcharattributes _guictrlrichedit_setcharbkcolor _guictrlrichedit_setcharcolor " -"_guictrlrichedit_seteventmask _guictrlrichedit_setfont _guictrlrichedit_setlimitontext " -"_guictrlrichedit_setmodified _guictrlrichedit_setparaalignment _guictrlrichedit_setparaattributes " -"_guictrlrichedit_setparaborder _guictrlrichedit_setparaindents _guictrlrichedit_setparanumbering " -"_guictrlrichedit_setparashading _guictrlrichedit_setparaspacing _guictrlrichedit_setparatabstops " -"_guictrlrichedit_setpasswordchar _guictrlrichedit_setreadonly _guictrlrichedit_setrect " -"_guictrlrichedit_setscrollpos _guictrlrichedit_setsel _guictrlrichedit_setspaceunit " -"_guictrlrichedit_settabstops _guictrlrichedit_settext _guictrlrichedit_setundolimit " -"_guictrlrichedit_setzoom _guictrlrichedit_streamfromfile _guictrlrichedit_streamfromvar " -"_guictrlrichedit_streamtofile _guictrlrichedit_streamtovar _guictrlrichedit_undo _guictrlslider_clearsel " -"_guictrlslider_cleartics _guictrlslider_create _guictrlslider_destroy _guictrlslider_getbuddy " -"_guictrlslider_getchannelrect _guictrlslider_getchannelrectex _guictrlslider_getlinesize " -"_guictrlslider_getlogicaltics _guictrlslider_getnumtics _guictrlslider_getpagesize _guictrlslider_getpos " -"_guictrlslider_getrange _guictrlslider_getrangemax _guictrlslider_getrangemin _guictrlslider_getsel " -"_guictrlslider_getselend _guictrlslider_getselstart _guictrlslider_getthumblength " -"_guictrlslider_getthumbrect _guictrlslider_getthumbrectex _guictrlslider_gettic _guictrlslider_getticpos " -"_guictrlslider_gettooltips _guictrlslider_getunicodeformat _guictrlslider_setbuddy " -"_guictrlslider_setlinesize _guictrlslider_setpagesize _guictrlslider_setpos _guictrlslider_setrange " -"_guictrlslider_setrangemax _guictrlslider_setrangemin _guictrlslider_setsel _guictrlslider_setselend " -"_guictrlslider_setselstart _guictrlslider_setthumblength _guictrlslider_settic _guictrlslider_setticfreq " -"_guictrlslider_settipside _guictrlslider_settooltips _guictrlslider_setunicodeformat " -"_guictrlstatusbar_create _guictrlstatusbar_destroy _guictrlstatusbar_embedcontrol " -"_guictrlstatusbar_getborders _guictrlstatusbar_getbordershorz _guictrlstatusbar_getbordersrect " -"_guictrlstatusbar_getbordersvert _guictrlstatusbar_getcount _guictrlstatusbar_getheight " -"_guictrlstatusbar_geticon _guictrlstatusbar_getparts _guictrlstatusbar_getrect _guictrlstatusbar_getrectex " -"_guictrlstatusbar_gettext _guictrlstatusbar_gettextflags _guictrlstatusbar_gettextlength " -"_guictrlstatusbar_gettextlengthex _guictrlstatusbar_gettiptext _guictrlstatusbar_getunicodeformat " -"_guictrlstatusbar_getwidth _guictrlstatusbar_issimple _guictrlstatusbar_resize " -"_guictrlstatusbar_setbkcolor _guictrlstatusbar_seticon _guictrlstatusbar_setminheight " -"_guictrlstatusbar_setparts _guictrlstatusbar_setsimple _guictrlstatusbar_settext " -"_guictrlstatusbar_settiptext _guictrlstatusbar_setunicodeformat _guictrlstatusbar_showhide " -"_guictrltab_activatetab _guictrltab_clicktab _guictrltab_create _guictrltab_deleteallitems " -"_guictrltab_deleteitem _guictrltab_deselectall _guictrltab_destroy _guictrltab_findtab " -"_guictrltab_getcurfocus _guictrltab_getcursel _guictrltab_getdisplayrect _guictrltab_getdisplayrectex " -"_guictrltab_getextendedstyle _guictrltab_getimagelist _guictrltab_getitem _guictrltab_getitemcount " -"_guictrltab_getitemimage _guictrltab_getitemparam _guictrltab_getitemrect _guictrltab_getitemrectex " -"_guictrltab_getitemstate _guictrltab_getitemtext _guictrltab_getrowcount _guictrltab_gettooltips " -"_guictrltab_getunicodeformat _guictrltab_highlightitem _guictrltab_hittest _guictrltab_insertitem " -"_guictrltab_removeimage _guictrltab_setcurfocus _guictrltab_setcursel _guictrltab_setextendedstyle " -"_guictrltab_setimagelist _guictrltab_setitem _guictrltab_setitemimage _guictrltab_setitemparam " -"_guictrltab_setitemsize _guictrltab_setitemstate _guictrltab_setitemtext _guictrltab_setmintabwidth " -"_guictrltab_setpadding _guictrltab_settooltips _guictrltab_setunicodeformat _guictrltoolbar_addbitmap " -"_guictrltoolbar_addbutton _guictrltoolbar_addbuttonsep _guictrltoolbar_addstring " -"_guictrltoolbar_buttoncount _guictrltoolbar_checkbutton _guictrltoolbar_clickaccel " -"_guictrltoolbar_clickbutton _guictrltoolbar_clickindex _guictrltoolbar_commandtoindex " -"_guictrltoolbar_create _guictrltoolbar_customize _guictrltoolbar_deletebutton _guictrltoolbar_destroy " -"_guictrltoolbar_enablebutton _guictrltoolbar_findtoolbar _guictrltoolbar_getanchorhighlight " -"_guictrltoolbar_getbitmapflags _guictrltoolbar_getbuttonbitmap _guictrltoolbar_getbuttoninfo " -"_guictrltoolbar_getbuttoninfoex _guictrltoolbar_getbuttonparam _guictrltoolbar_getbuttonrect " -"_guictrltoolbar_getbuttonrectex _guictrltoolbar_getbuttonsize _guictrltoolbar_getbuttonstate " -"_guictrltoolbar_getbuttonstyle _guictrltoolbar_getbuttontext _guictrltoolbar_getcolorscheme " -"_guictrltoolbar_getdisabledimagelist _guictrltoolbar_getextendedstyle _guictrltoolbar_gethotimagelist " -"_guictrltoolbar_gethotitem _guictrltoolbar_getimagelist _guictrltoolbar_getinsertmark " -"_guictrltoolbar_getinsertmarkcolor _guictrltoolbar_getmaxsize _guictrltoolbar_getmetrics " -"_guictrltoolbar_getpadding _guictrltoolbar_getrows _guictrltoolbar_getstring _guictrltoolbar_getstyle " -"_guictrltoolbar_getstylealtdrag _guictrltoolbar_getstylecustomerase _guictrltoolbar_getstyleflat " -"_guictrltoolbar_getstylelist _guictrltoolbar_getstyleregisterdrop _guictrltoolbar_getstyletooltips " -"_guictrltoolbar_getstyletransparent _guictrltoolbar_getstylewrapable _guictrltoolbar_gettextrows " -"_guictrltoolbar_gettooltips _guictrltoolbar_getunicodeformat _guictrltoolbar_hidebutton " -"_guictrltoolbar_highlightbutton _guictrltoolbar_hittest _guictrltoolbar_indextocommand " -"_guictrltoolbar_insertbutton _guictrltoolbar_insertmarkhittest _guictrltoolbar_isbuttonchecked " -"_guictrltoolbar_isbuttonenabled _guictrltoolbar_isbuttonhidden _guictrltoolbar_isbuttonhighlighted " -"_guictrltoolbar_isbuttonindeterminate _guictrltoolbar_isbuttonpressed _guictrltoolbar_loadbitmap " -"_guictrltoolbar_loadimages _guictrltoolbar_mapaccelerator _guictrltoolbar_movebutton " -"_guictrltoolbar_pressbutton _guictrltoolbar_setanchorhighlight _guictrltoolbar_setbitmapsize " -"_guictrltoolbar_setbuttonbitmap _guictrltoolbar_setbuttoninfo _guictrltoolbar_setbuttoninfoex " -"_guictrltoolbar_setbuttonparam _guictrltoolbar_setbuttonsize _guictrltoolbar_setbuttonstate " -"_guictrltoolbar_setbuttonstyle _guictrltoolbar_setbuttontext _guictrltoolbar_setbuttonwidth " -"_guictrltoolbar_setcmdid _guictrltoolbar_setcolorscheme _guictrltoolbar_setdisabledimagelist " -"_guictrltoolbar_setdrawtextflags _guictrltoolbar_setextendedstyle _guictrltoolbar_sethotimagelist " -"_guictrltoolbar_sethotitem _guictrltoolbar_setimagelist _guictrltoolbar_setindent " -"_guictrltoolbar_setindeterminate _guictrltoolbar_setinsertmark _guictrltoolbar_setinsertmarkcolor " -"_guictrltoolbar_setmaxtextrows _guictrltoolbar_setmetrics _guictrltoolbar_setpadding " -"_guictrltoolbar_setparent _guictrltoolbar_setrows _guictrltoolbar_setstyle _guictrltoolbar_setstylealtdrag " -"_guictrltoolbar_setstylecustomerase _guictrltoolbar_setstyleflat _guictrltoolbar_setstylelist " -"_guictrltoolbar_setstyleregisterdrop _guictrltoolbar_setstyletooltips _guictrltoolbar_setstyletransparent " -"_guictrltoolbar_setstylewrapable _guictrltoolbar_settooltips _guictrltoolbar_setunicodeformat " -"_guictrltoolbar_setwindowtheme _guictrltreeview_add _guictrltreeview_addchild " -"_guictrltreeview_addchildfirst _guictrltreeview_addfirst _guictrltreeview_beginupdate " -"_guictrltreeview_clickitem _guictrltreeview_create _guictrltreeview_createdragimage " -"_guictrltreeview_createsolidbitmap _guictrltreeview_delete _guictrltreeview_deleteall " -"_guictrltreeview_deletechildren _guictrltreeview_destroy _guictrltreeview_displayrect " -"_guictrltreeview_displayrectex _guictrltreeview_edittext _guictrltreeview_endedit " -"_guictrltreeview_endupdate _guictrltreeview_ensurevisible _guictrltreeview_expand " -"_guictrltreeview_expandedonce _guictrltreeview_finditem _guictrltreeview_finditemex " -"_guictrltreeview_getbkcolor _guictrltreeview_getbold _guictrltreeview_getchecked " -"_guictrltreeview_getchildcount _guictrltreeview_getchildren _guictrltreeview_getcount " -"_guictrltreeview_getcut _guictrltreeview_getdroptarget _guictrltreeview_geteditcontrol " -"_guictrltreeview_getexpanded _guictrltreeview_getfirstchild _guictrltreeview_getfirstitem " -"_guictrltreeview_getfirstvisible _guictrltreeview_getfocused _guictrltreeview_getheight " -"_guictrltreeview_getimageindex _guictrltreeview_getimagelisticonhandle _guictrltreeview_getindent " -"_guictrltreeview_getinsertmarkcolor _guictrltreeview_getisearchstring _guictrltreeview_getitembyindex " -"_guictrltreeview_getitemhandle _guictrltreeview_getitemparam _guictrltreeview_getlastchild " -"_guictrltreeview_getlinecolor _guictrltreeview_getnext _guictrltreeview_getnextchild " -"_guictrltreeview_getnextsibling _guictrltreeview_getnextvisible _guictrltreeview_getnormalimagelist " -"_guictrltreeview_getparenthandle _guictrltreeview_getparentparam _guictrltreeview_getprev " -"_guictrltreeview_getprevchild _guictrltreeview_getprevsibling _guictrltreeview_getprevvisible " -"_guictrltreeview_getscrolltime _guictrltreeview_getselected _guictrltreeview_getselectedimageindex " -"_guictrltreeview_getselection _guictrltreeview_getsiblingcount _guictrltreeview_getstate " -"_guictrltreeview_getstateimageindex _guictrltreeview_getstateimagelist _guictrltreeview_gettext " -"_guictrltreeview_gettextcolor _guictrltreeview_gettooltips _guictrltreeview_gettree " -"_guictrltreeview_getunicodeformat _guictrltreeview_getvisible _guictrltreeview_getvisiblecount " -"_guictrltreeview_hittest _guictrltreeview_hittestex _guictrltreeview_hittestitem _guictrltreeview_index " -"_guictrltreeview_insertitem _guictrltreeview_isfirstitem _guictrltreeview_isparent _guictrltreeview_level " -"_guictrltreeview_selectitem _guictrltreeview_selectitembyindex _guictrltreeview_setbkcolor " -"_guictrltreeview_setbold _guictrltreeview_setchecked _guictrltreeview_setcheckedbyindex " -"_guictrltreeview_setchildren _guictrltreeview_setcut _guictrltreeview_setdroptarget " -"_guictrltreeview_setfocused _guictrltreeview_setheight _guictrltreeview_seticon " -"_guictrltreeview_setimageindex _guictrltreeview_setindent _guictrltreeview_setinsertmark " -"_guictrltreeview_setinsertmarkcolor _guictrltreeview_setitemheight _guictrltreeview_setitemparam " -"_guictrltreeview_setlinecolor _guictrltreeview_setnormalimagelist _guictrltreeview_setscrolltime " -"_guictrltreeview_setselected _guictrltreeview_setselectedimageindex _guictrltreeview_setstate " -"_guictrltreeview_setstateimageindex _guictrltreeview_setstateimagelist _guictrltreeview_settext " -"_guictrltreeview_settextcolor _guictrltreeview_settooltips _guictrltreeview_setunicodeformat " -"_guictrltreeview_sort _guiimagelist_add _guiimagelist_addbitmap _guiimagelist_addicon " -"_guiimagelist_addmasked _guiimagelist_begindrag _guiimagelist_copy _guiimagelist_create " -"_guiimagelist_destroy _guiimagelist_destroyicon _guiimagelist_dragenter _guiimagelist_dragleave " -"_guiimagelist_dragmove _guiimagelist_draw _guiimagelist_drawex _guiimagelist_duplicate " -"_guiimagelist_enddrag _guiimagelist_getbkcolor _guiimagelist_geticon _guiimagelist_geticonheight " -"_guiimagelist_geticonsize _guiimagelist_geticonsizeex _guiimagelist_geticonwidth " -"_guiimagelist_getimagecount _guiimagelist_getimageinfoex _guiimagelist_remove _guiimagelist_replaceicon " -"_guiimagelist_setbkcolor _guiimagelist_seticonsize _guiimagelist_setimagecount _guiimagelist_swap " -"_guiscrollbars_enablescrollbar _guiscrollbars_getscrollbarinfoex _guiscrollbars_getscrollbarrect " -"_guiscrollbars_getscrollbarrgstate _guiscrollbars_getscrollbarxylinebutton " -"_guiscrollbars_getscrollbarxythumbbottom _guiscrollbars_getscrollbarxythumbtop " -"_guiscrollbars_getscrollinfo _guiscrollbars_getscrollinfoex _guiscrollbars_getscrollinfomax " -"_guiscrollbars_getscrollinfomin _guiscrollbars_getscrollinfopage _guiscrollbars_getscrollinfopos " -"_guiscrollbars_getscrollinfotrackpos _guiscrollbars_getscrollpos _guiscrollbars_getscrollrange " -"_guiscrollbars_init _guiscrollbars_scrollwindow _guiscrollbars_setscrollinfo " -"_guiscrollbars_setscrollinfomax _guiscrollbars_setscrollinfomin _guiscrollbars_setscrollinfopage " -"_guiscrollbars_setscrollinfopos _guiscrollbars_setscrollrange _guiscrollbars_showscrollbar " -"_guitooltip_activate _guitooltip_addtool _guitooltip_adjustrect _guitooltip_bitstottf _guitooltip_create " -"_guitooltip_deltool _guitooltip_destroy _guitooltip_enumtools _guitooltip_getbubbleheight " -"_guitooltip_getbubblesize _guitooltip_getbubblewidth _guitooltip_getcurrenttool _guitooltip_getdelaytime " -"_guitooltip_getmargin _guitooltip_getmarginex _guitooltip_getmaxtipwidth _guitooltip_gettext " -"_guitooltip_gettipbkcolor _guitooltip_gettiptextcolor _guitooltip_gettitlebitmap _guitooltip_gettitletext " -"_guitooltip_gettoolcount _guitooltip_gettoolinfo _guitooltip_hittest _guitooltip_newtoolrect " -"_guitooltip_pop _guitooltip_popup _guitooltip_setdelaytime _guitooltip_setmargin " -"_guitooltip_setmaxtipwidth _guitooltip_settipbkcolor _guitooltip_settiptextcolor _guitooltip_settitle " -"_guitooltip_settoolinfo _guitooltip_setwindowtheme _guitooltip_toolexists _guitooltip_tooltoarray " -"_guitooltip_trackactivate _guitooltip_trackposition _guitooltip_ttftobits _guitooltip_update " -"_guitooltip_updatetiptext _hextostring _ie_example _ie_introduction _ie_versioninfo _ieaction _ieattach " -"_iebodyreadhtml _iebodyreadtext _iebodywritehtml _iecreate _iecreateembedded _iedocgetobj _iedocinserthtml " -"_iedocinserttext _iedocreadhtml _iedocwritehtml _ieerrorhandlerderegister _ieerrorhandlerregister " -"_ieerrornotify _ieformelementcheckboxselect _ieformelementgetcollection _ieformelementgetobjbyname " -"_ieformelementgetvalue _ieformelementoptionselect _ieformelementradioselect _ieformelementsetvalue " -"_ieformgetcollection _ieformgetobjbyname _ieformimageclick _ieformreset _ieformsubmit " -"_ieframegetcollection _ieframegetobjbyname _iegetobjbyid _iegetobjbyname _ieheadinserteventscript " -"_ieimgclick _ieimggetcollection _ieisframeset _ielinkclickbyindex _ielinkclickbytext _ielinkgetcollection " -"_ieloadwait _ieloadwaittimeout _ienavigate _iepropertyget _iepropertyset _iequit _ietablegetcollection " -"_ietablewritetoarray _ietagnameallgetcollection _ietagnamegetcollection _iif _inetexplorercapable " -"_inetgetsource _inetmail _inetsmtpmail _ispressed _mathcheckdiv _max _memglobalalloc _memglobalfree " -"_memgloballock _memglobalsize _memglobalunlock _memmovememory _memvirtualalloc _memvirtualallocex " -"_memvirtualfree _memvirtualfreeex _min _mousetrap _namedpipes_callnamedpipe _namedpipes_connectnamedpipe " -"_namedpipes_createnamedpipe _namedpipes_createpipe _namedpipes_disconnectnamedpipe " -"_namedpipes_getnamedpipehandlestate _namedpipes_getnamedpipeinfo _namedpipes_peeknamedpipe " -"_namedpipes_setnamedpipehandlestate _namedpipes_transactnamedpipe _namedpipes_waitnamedpipe " -"_net_share_connectionenum _net_share_fileclose _net_share_fileenum _net_share_filegetinfo " -"_net_share_permstr _net_share_resourcestr _net_share_sessiondel _net_share_sessionenum " -"_net_share_sessiongetinfo _net_share_shareadd _net_share_sharecheck _net_share_sharedel " -"_net_share_shareenum _net_share_sharegetinfo _net_share_sharesetinfo _net_share_statisticsgetsvr " -"_net_share_statisticsgetwrk _now _nowcalc _nowcalcdate _nowdate _nowtime _pathfull _pathgetrelative " -"_pathmake _pathsplit _processgetname _processgetpriority _radian _replacestringinfile _rundos " -"_screencapture_capture _screencapture_capturewnd _screencapture_saveimage _screencapture_setbmpformat " -"_screencapture_setjpgquality _screencapture_settifcolordepth _screencapture_settifcompression " -"_security__adjusttokenprivileges _security__createprocesswithtoken _security__duplicatetokenex " -"_security__getaccountsid _security__getlengthsid _security__gettokeninformation _security__impersonateself " -"_security__isvalidsid _security__lookupaccountname _security__lookupaccountsid " -"_security__lookupprivilegevalue _security__openprocesstoken _security__openthreadtoken " -"_security__openthreadtokenex _security__setprivilege _security__settokeninformation " -"_security__sidtostringsid _security__sidtypestr _security__stringsidtosid _sendmessage _sendmessagea " -"_setdate _settime _singleton _soundclose _soundlength _soundopen _soundpause _soundplay _soundpos " -"_soundresume _soundseek _soundstatus _soundstop _sqlite_changes _sqlite_close _sqlite_display2dresult " -"_sqlite_encode _sqlite_errcode _sqlite_errmsg _sqlite_escape _sqlite_exec _sqlite_fastencode " -"_sqlite_fastescape _sqlite_fetchdata _sqlite_fetchnames _sqlite_gettable _sqlite_gettable2d " -"_sqlite_lastinsertrowid _sqlite_libversion _sqlite_open _sqlite_query _sqlite_queryfinalize " -"_sqlite_queryreset _sqlite_querysinglerow _sqlite_safemode _sqlite_settimeout _sqlite_shutdown " -"_sqlite_sqliteexe _sqlite_startup _sqlite_totalchanges _stringbetween _stringencrypt _stringexplode " -"_stringinsert _stringproper _stringrepeat _stringreverse _stringtohex _tcpiptoname _tempfile _tickstotime " -"_timer_diff _timer_getidletime _timer_gettimerid _timer_init _timer_killalltimers _timer_killtimer " -"_timer_settimer _timetoticks _versioncompare _viclose _viexeccommand _vifindgpib _vigpibbusreset _vigtl " -"_viinteractivecontrol _viopen _visetattribute _visettimeout _weeknumberiso _winapi_attachconsole " -"_winapi_attachthreadinput _winapi_beep _winapi_bitblt _winapi_callnexthookex _winapi_callwindowproc " -"_winapi_clienttoscreen _winapi_closehandle _winapi_combinergn _winapi_commdlgextendederror " -"_winapi_copyicon _winapi_createbitmap _winapi_createcompatiblebitmap _winapi_createcompatibledc " -"_winapi_createevent _winapi_createfile _winapi_createfont _winapi_createfontindirect _winapi_createpen " -"_winapi_createprocess _winapi_createrectrgn _winapi_createroundrectrgn _winapi_createsolidbitmap " -"_winapi_createsolidbrush _winapi_createwindowex _winapi_defwindowproc _winapi_deletedc " -"_winapi_deleteobject _winapi_destroyicon _winapi_destroywindow _winapi_drawedge _winapi_drawframecontrol " -"_winapi_drawicon _winapi_drawiconex _winapi_drawline _winapi_drawtext _winapi_duplicatehandle " -"_winapi_enablewindow _winapi_enumdisplaydevices _winapi_enumwindows _winapi_enumwindowspopup " -"_winapi_enumwindowstop _winapi_expandenvironmentstrings _winapi_extracticonex _winapi_fatalappexit " -"_winapi_fillrect _winapi_findexecutable _winapi_findwindow _winapi_flashwindow _winapi_flashwindowex " -"_winapi_floattoint _winapi_flushfilebuffers _winapi_formatmessage _winapi_framerect _winapi_freelibrary " -"_winapi_getancestor _winapi_getasynckeystate _winapi_getbkmode _winapi_getclassname " -"_winapi_getclientheight _winapi_getclientrect _winapi_getclientwidth _winapi_getcurrentprocess " -"_winapi_getcurrentprocessid _winapi_getcurrentthread _winapi_getcurrentthreadid _winapi_getcursorinfo " -"_winapi_getdc _winapi_getdesktopwindow _winapi_getdevicecaps _winapi_getdibits _winapi_getdlgctrlid " -"_winapi_getdlgitem _winapi_getfilesizeex _winapi_getfocus _winapi_getforegroundwindow " -"_winapi_getguiresources _winapi_geticoninfo _winapi_getlasterror _winapi_getlasterrormessage " -"_winapi_getlayeredwindowattributes _winapi_getmodulehandle _winapi_getmousepos _winapi_getmouseposx " -"_winapi_getmouseposy _winapi_getobject _winapi_getopenfilename _winapi_getoverlappedresult " -"_winapi_getparent _winapi_getprocessaffinitymask _winapi_getsavefilename _winapi_getstdhandle " -"_winapi_getstockobject _winapi_getsyscolor _winapi_getsyscolorbrush _winapi_getsystemmetrics " -"_winapi_gettextextentpoint32 _winapi_gettextmetrics _winapi_getwindow _winapi_getwindowdc " -"_winapi_getwindowheight _winapi_getwindowlong _winapi_getwindowplacement _winapi_getwindowrect " -"_winapi_getwindowrgn _winapi_getwindowtext _winapi_getwindowthreadprocessid _winapi_getwindowwidth " -"_winapi_getxyfrompoint _winapi_globalmemorystatus _winapi_guidfromstring _winapi_guidfromstringex " -"_winapi_hiword _winapi_inprocess _winapi_inttofloat _winapi_invalidaterect _winapi_isclassname " -"_winapi_iswindow _winapi_iswindowvisible _winapi_lineto _winapi_loadbitmap _winapi_loadimage " -"_winapi_loadlibrary _winapi_loadlibraryex _winapi_loadshell32icon _winapi_loadstring _winapi_localfree " -"_winapi_loword _winapi_makelangid _winapi_makelcid _winapi_makelong _winapi_makeqword _winapi_messagebeep " -"_winapi_mouse_event _winapi_moveto _winapi_movewindow _winapi_msgbox _winapi_muldiv " -"_winapi_multibytetowidechar _winapi_multibytetowidecharex _winapi_openprocess _winapi_pathfindonpath " -"_winapi_pointfromrect _winapi_postmessage _winapi_primarylangid _winapi_ptinrect _winapi_readfile " -"_winapi_readprocessmemory _winapi_rectisempty _winapi_redrawwindow _winapi_registerwindowmessage " -"_winapi_releasecapture _winapi_releasedc _winapi_screentoclient _winapi_selectobject _winapi_setbkcolor " -"_winapi_setbkmode _winapi_setcapture _winapi_setcursor _winapi_setdefaultprinter _winapi_setdibits " -"_winapi_setendoffile _winapi_setevent _winapi_setfilepointer _winapi_setfocus _winapi_setfont " -"_winapi_sethandleinformation _winapi_setlasterror _winapi_setlayeredwindowattributes _winapi_setparent " -"_winapi_setprocessaffinitymask _winapi_setsyscolors _winapi_settextcolor _winapi_setwindowlong " -"_winapi_setwindowplacement _winapi_setwindowpos _winapi_setwindowrgn _winapi_setwindowshookex " -"_winapi_setwindowtext _winapi_showcursor _winapi_showerror _winapi_showmsg _winapi_showwindow " -"_winapi_stringfromguid _winapi_stringlena _winapi_stringlenw _winapi_sublangid " -"_winapi_systemparametersinfo _winapi_twipsperpixelx _winapi_twipsperpixely _winapi_unhookwindowshookex " -"_winapi_updatelayeredwindow _winapi_updatewindow _winapi_waitforinputidle _winapi_waitformultipleobjects " -"_winapi_waitforsingleobject _winapi_widechartomultibyte _winapi_windowfrompoint _winapi_writeconsole " -"_winapi_writefile _winapi_writeprocessmemory _winnet_addconnection _winnet_addconnection2 " -"_winnet_addconnection3 _winnet_cancelconnection _winnet_cancelconnection2 _winnet_closeenum " -"_winnet_connectiondialog _winnet_connectiondialog1 _winnet_disconnectdialog _winnet_disconnectdialog1 " -"_winnet_enumresource _winnet_getconnection _winnet_getconnectionperformance _winnet_getlasterror " -"_winnet_getnetworkinformation _winnet_getprovidername _winnet_getresourceinformation " -"_winnet_getresourceparent _winnet_getuniversalname _winnet_getuser _winnet_openenum " -"_winnet_restoreconnection _winnet_useconnection _word_versioninfo _wordattach _wordcreate _worddocadd " -"_worddocaddlink _worddocaddpicture _worddocclose _worddocfindreplace _worddocgetcollection " -"_worddoclinkgetcollection _worddocopen _worddocprint _worddocpropertyget _worddocpropertyset _worddocsave " -"_worddocsaveas _worderrorhandlerderegister _worderrorhandlerregister _worderrornotify _wordmacrorun " -"_wordpropertyget _wordpropertyset _wordquit", -"" }; - - -EDITLEXER lexAU3 = { SCLEX_AU3, 63035, L"AutoIt3 Script", L"au3", L"", &KeyWords_AU3, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_AU3_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_AU3_COMMENT,SCE_AU3_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_AU3_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - { SCE_AU3_FUNCTION, 63277, L"Function", L"fore:#0000FF", L"" }, - { SCE_AU3_UDF, 63360, L"User-Defined Function", L"fore:#0000FF", L"" }, - { SCE_AU3_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, - { SCE_AU3_MACRO, 63278, L"Macro", L"fore:#0080FF", L"" }, - { SCE_AU3_STRING, 63131, L"String", L"fore:#008080", L"" }, - { SCE_AU3_OPERATOR, 63132, L"Operator", L"fore:#C000C0", L"" }, - { SCE_AU3_VARIABLE, 63249, L"Variable", L"fore:#808000", L"" }, - { SCE_AU3_SENT, 63279, L"Send Key", L"fore:#FF0000", L"" }, - { SCE_AU3_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - { SCE_AU3_SPECIAL, 63280, L"Special", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -EDITLEXER lexLATEX = { SCLEX_LATEX, 63036, L"LaTeX Files", L"tex; latex; sty", L"", &KeyWords_NULL, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_L_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_L_COMMAND,SCE_L_SHORTCMD,SCE_L_CMDOPT,0), 63236, L"Command", L"fore:#0000FF", L"" }, - { MULTI_STYLE(SCE_L_COMMENT,SCE_L_COMMENT2,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_L_MATH,SCE_L_MATH2,0,0), 63283, L"Math", L"fore:#FF0000", L"" }, - { SCE_L_SPECIAL, 63330, L"Special Char", L"fore:#AAAA00", L"" }, - { MULTI_STYLE(SCE_L_TAG,SCE_L_TAG2,0,0), 63282, L"Tag", L"fore:#0000FF", L"" }, - { SCE_L_VERBATIM, 63331, L"Verbatim Segment", L"fore:#666666", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -EDITLEXER lexANSI = { SCLEX_NULL, 63025, L"ANSI Art", L"nfo; diz", L"", &KeyWords_NULL, { - { STYLE_DEFAULT, 63126, L"Default", L"font:Lucida Console", L"" }, - { STYLE_LINENUMBER, 63101, L"Margins and Line Numbers", L"font:Lucida Console; size:-2", L"" }, - { STYLE_BRACELIGHT, 63102, L"Matching Braces", L"size:+0", L"" }, - { STYLE_BRACEBAD, 63103, L"Matching Braces Error", L"size:+0", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_AHK = { -"break continue else exit exitapp gosub goto if ifequal ifexist ifgreater ifgreaterorequal " -"ifinstring ifless iflessorequal ifmsgbox ifnotequal ifnotexist ifnotinstring ifwinactive " -"ifwinexist ifwinnotactive ifwinnotexist loop onexit pause repeat return settimer sleep " -"suspend static global local var byref while until for class try catch throw", -"autotrim blockinput clipwait control controlclick controlfocus controlget controlgetfocus " -"controlgetpos controlgettext controlmove controlsend controlsendraw controlsettext coordmode " -"critical detecthiddentext detecthiddenwindows drive driveget drivespacefree edit endrepeat " -"envadd envdiv envget envmult envset envsub envupdate fileappend filecopy filecopydir filecreatedir " -"filecreateshortcut filedelete filegetattrib filegetshortcut filegetsize filegettime filegetversion " -"fileinstall filemove filemovedir fileread filereadline filerecycle filerecycleempty fileremovedir " -"fileselectfile fileselectfolder filesetattrib filesettime formattime getkeystate groupactivate " -"groupadd groupclose groupdeactivategui guicontrol guicontrolget hideautoitwin hotkey imagesearch " -"inidelete iniread iniwrite input inputbox keyhistory keywait listhotkeys listlines listvars menu " -"mouseclick mouseclickdrag mousegetpos mousemove msgbox outputdebug pixelgetcolor pixelsearch " -"postmessage process progress random regdelete regread regwrite reload run runas runwait send " -"sendevent sendinput sendmessage sendmode sendplay sendraw setbatchlines setcapslockstate " -"setcontroldelay setdefaultmousespeed setenv setformat setkeydelay setmousedelay setnumlockstate " -"setscrolllockstate setstorecapslockmode settitlematchmode setwindelay setworkingdir shutdown sort " -"soundbeep soundget soundgetwavevolume soundplay soundset soundsetwavevolume splashimage splashtextoff " -"splashtexton splitpath statusbargettext statusbarwait stringcasesense stringgetpos stringleft stringlen " -"stringlower stringmid stringreplace stringright stringsplit stringtrimleft stringtrimright stringupper " -"sysget thread tooltip transform traytip urldownloadtofile winactivate winactivatebottom winclose winget " -"wingetactivestats wingetactivetitle wingetclass wingetpos wingettext wingettitle winhide winkill " -"winmaximize winmenuselectitem winminimize winminimizeall winminimizeallundo winmove winrestore winset " -"winsettitle winshow winwait winwaitactive winwaitclose winwaitnotactive fileencoding", -"abs acos asc asin atan ceil chr cos dllcall exp fileexist floor getkeystate numget numput " -"registercallback il_add il_create il_destroy instr islabel isfunc ln log lv_add lv_delete " -"lv_deletecol lv_getcount lv_getnext lv_gettext lv_insert lv_insertcol lv_modify lv_modifycol " -"lv_setimagelist mod onmessage round regexmatch regexreplace sb_seticon sb_setparts sb_settext " -"sin sqrt strlen substr tan tv_add tv_delete tv_getchild tv_getcount tv_getnext tv_get tv_getparent " -"tv_getprev tv_getselection tv_gettext tv_modify tv_setimagelist varsetcapacity winactive winexist " -"trim ltrim rtrim fileopen strget strput object array isobject objinsert objremove objminindex " -"objmaxindex objsetcapacity objgetcapacity objgetaddress objnewenum objaddref objrelease objhaskey " -"objclone _insert _remove _minindex _maxindex _setcapacity _getcapacity _getaddress _newenum _addref " -"_release _haskey _clone comobjcreate comobjget comobjconnect comobjerror comobjactive comobjenwrap " -"comobjunwrap comobjparameter comobjmissing comobjtype comobjvalue comobjarray comobjquery comobjflags " -"func getkeyname getkeyvk getkeysc isbyref exception", -"allowsamelinecomments clipboardtimeout commentflag errorstdout escapechar hotkeyinterval " -"hotkeymodifiertimeout hotstring if iftimeout ifwinactive ifwinexist include includeagain " -"installkeybdhook installmousehook keyhistory ltrim maxhotkeysperinterval maxmem maxthreads " -"maxthreadsbuffer maxthreadsperhotkey menumaskkey noenv notrayicon persistent singleinstance " -"usehook warn winactivateforce", -"shift lshift rshift alt lalt ralt control lcontrol rcontrol ctrl lctrl rctrl lwin rwin appskey " -"altdown altup shiftdown shiftup ctrldown ctrlup lwindown lwinup rwindown rwinup lbutton rbutton " -"mbutton wheelup wheeldown xbutton1 xbutton2 joy1 joy2 joy3 joy4 joy5 joy6 joy7 joy8 joy9 joy10 " -"joy11 joy12 joy13 joy14 joy15 joy16 joy17 joy18 joy19 joy20 joy21 joy22 joy23 joy24 joy25 joy26 " -"joy27 joy28 joy29 joy30 joy31 joy32 joyx joyy joyz joyr joyu joyv joypov joyname joybuttons " -"joyaxes joyinfo space tab enter escape esc backspace bs delete del insert ins pgup pgdn home end " -"up down left right printscreen ctrlbreak pause scrolllock capslock numlock numpad0 numpad1 numpad2 " -"numpad3 numpad4 numpad5 numpad6 numpad7 numpad8 numpad9 numpadmult numpadadd numpadsub numpaddiv " -"numpaddot numpaddel numpadins numpadclear numpadup numpaddown numpadleft numpadright numpadhome " -"numpadend numpadpgup numpadpgdn numpadenter f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 " -"f16 f17 f18 f19 f20 f21 f22 f23 f24 browser_back browser_forward browser_refresh browser_stop " -"browser_search browser_favorites browser_home volume_mute volume_down volume_up media_next " -"media_prev media_stop media_play_pause launch_mail launch_media launch_app1 launch_app2 blind " -"click raw wheelleft wheelright", -"a_ahkpath a_ahkversion a_appdata a_appdatacommon a_autotrim a_batchlines a_caretx a_carety " -"a_computername a_controldelay a_cursor a_dd a_ddd a_dddd a_defaultmousespeed a_desktop " -"a_desktopcommon a_detecthiddentext a_detecthiddenwindows a_endchar a_eventinfo a_exitreason " -"a_formatfloat a_formatinteger a_gui a_guievent a_guicontrol a_guicontrolevent a_guiheight " -"a_guiwidth a_guix a_guiy a_hour a_iconfile a_iconhidden a_iconnumber a_icontip a_index " -"a_ipaddress1 a_ipaddress2 a_ipaddress3 a_ipaddress4 a_isadmin a_iscompiled a_issuspended " -"a_keydelay a_language a_lasterror a_linefile a_linenumber a_loopfield a_loopfileattrib " -"a_loopfiledir a_loopfileext a_loopfilefullpath a_loopfilelongpath a_loopfilename " -"a_loopfileshortname a_loopfileshortpath a_loopfilesize a_loopfilesizekb a_loopfilesizemb " -"a_loopfiletimeaccessed a_loopfiletimecreated a_loopfiletimemodified a_loopreadline a_loopregkey " -"a_loopregname a_loopregsubkey a_loopregtimemodified a_loopregtype a_mday a_min a_mm a_mmm " -"a_mmmm a_mon a_mousedelay a_msec a_mydocuments a_now a_nowutc a_numbatchlines a_ostype " -"a_osversion a_priorhotkey a_programfiles a_programs a_programscommon a_screenheight " -"a_screenwidth a_scriptdir a_scriptfullpath a_scriptname a_sec a_space a_startmenu " -"a_startmenucommon a_startup a_startupcommon a_stringcasesense a_tab a_temp a_thishotkey " -"a_thismenu a_thismenuitem a_thismenuitempos a_tickcount a_timeidle a_timeidlephysical " -"a_timesincepriorhotkey a_timesincethishotkey a_titlematchmode a_titlematchmodespeed " -"a_username a_wday a_windelay a_windir a_workingdir a_yday a_year a_yweek a_yyyy " -"clipboard clipboardall comspec errorlevel programfiles true false a_thisfunc a_thislabel " -"a_ispaused a_iscritical a_isunicode a_ptrsize a_scripthwnd a_priorkey", -"ltrim rtrim join ahk_id ahk_pid ahk_class ahk_group ahk_exe processname processpath minmax " -"controllist statuscd filesystem setlabel alwaysontop mainwindow nomainwindow useerrorlevel " -"altsubmit hscroll vscroll imagelist wantctrla wantf2 vis visfirst wantreturn backgroundtrans " -"minimizebox maximizebox sysmenu toolwindow exstyle check3 checkedgray readonly notab lastfound " -"lastfoundexist alttab shiftalttab alttabmenu alttabandmenu alttabmenudismiss controllisthwnd " -"hwnd deref pow bitnot bitand bitor bitxor bitshiftleft bitshiftright sendandmouse mousemove " -"mousemoveoff hkey_local_machine hkey_users hkey_current_user hkey_classes_root hkey_current_config " -"hklm hku hkcu hkcr hkcc reg_sz reg_expand_sz reg_multi_sz reg_dword reg_qword reg_binary reg_link " -"reg_resource_list reg_full_resource_descriptor reg_resource_requirements_list reg_dword_big_endian " -"regex pixel mouse screen relative rgb low belownormal normal abovenormal high realtime between " -"contains in is integer float number digit xdigit integerfast floatfast alpha upper lower alnum " -"time date not or and topmost top bottom transparent transcolor redraw region id idlast count " -"list capacity eject lock unlock label serial type status seconds minutes hours days read parse " -"logoff close error single shutdown menu exit reload tray add rename check uncheck togglecheck " -"enable disable toggleenable default nodefault standard nostandard color delete deleteall icon " -"noicon tip click show edit progress hotkey text picture pic groupbox button checkbox radio " -"dropdownlist ddl combobox statusbar treeview listbox listview datetime monthcal updown slider " -"tab tab2 activex iconsmall tile report sortdesc nosort nosorthdr grid hdr autosize range xm ym " -"ys xs xp yp font resize owner submit nohide minimize maximize restore noactivate na cancel " -"destroy center margin owndialogs guiescape guiclose guisize guicontextmenu guidropfiles tabstop " -"section wrap border top bottom buttons expand first lines number uppercase lowercase limit " -"password multi group background bold italic strike underline norm theme caption delimiter flash " -"style checked password hidden left right center section move focus hide choose choosestring text " -"pos enabled disabled visible notimers interrupt priority waitclose unicode tocodepage fromcodepage " -"yes no ok cancel abort retry ignore force on off all send wanttab monitorcount monitorprimary " -"monitorname monitorworkarea pid this base extends __get __set __call __delete __new new " -"useunsetlocal useunsetglobal useenv localsameasglobal", -"", "" }; - - -EDITLEXER lexAHK = { SCLEX_AHK, 63037, L"AutoHotkey Script", L"ahk; ia; scriptlet", L"", &KeyWords_AHK, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_AHK_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_AHK_COMMENTLINE,SCE_AHK_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_AHK_ESCAPE, 63306, L"Escape", L"fore:#FF8000", L"" }, - { SCE_AHK_SYNOPERATOR, 63307, L"Syntax Operator", L"fore:#7F200F", L"" }, - { SCE_AHK_EXPOPERATOR, 63308, L"Expression Operator", L"fore:#FF4F00", L"" }, - { SCE_AHK_STRING, 63131, L"String", L"fore:#404040", L"" }, - { SCE_AHK_NUMBER, 63130, L"Number", L"fore:#2F4F7F", L"" }, - { SCE_AHK_IDENTIFIER, 63129, L"Identifier", L"fore:#CF2F0F", L"" }, - { SCE_AHK_VARREF, 63309, L"Variable Dereferencing", L"fore:#CF2F0F; back:#E4FFE4", L"" }, - { SCE_AHK_LABEL, 63235, L"Label", L"fore:#000000; back:#FFFFA1", L"" }, - { SCE_AHK_WORD_CF, 63310, L"Flow of Control", L"fore:#480048; bold", L"" }, - { SCE_AHK_WORD_CMD, 63236, L"Command", L"fore:#004080", L"" }, - { SCE_AHK_WORD_FN, 63277, L"Function", L"fore:#0F707F; italic", L"" }, - { SCE_AHK_WORD_DIR, 63203, L"Directive", L"fore:#F04020; italic", L"" }, - { SCE_AHK_WORD_KB, 63311, L"Keys & Buttons", L"fore:#FF00FF; bold", L"" }, - { SCE_AHK_WORD_VAR, 63312, L"Built-In Variables", L"fore:#CF00CF; italic", L"" }, - { SCE_AHK_WORD_SP, 63280, L"Special", L"fore:#0000FF; italic", L"" }, - //{ SCE_AHK_WORD_UD, 63106, L"User Defined", L"fore:#800020", L"" }, - { SCE_AHK_VARREFKW, 63313, L"Variable Keyword", L"fore:#CF00CF; italic; back:#F9F9FF", L"" }, - { SCE_AHK_ERROR, 63261, L"Error", L"back:#FFC0C0", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_CMAKE = { -"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library " -"add_subdirectory add_test aux_source_directory build_command build_name cmake_minimum_required " -"configure_file create_test_sourcelist else elseif enable_language enable_testing endforeach endif " -"endmacro endwhile exec_program execute_process export_library_dependencies file find_file find_library " -"find_package find_path find_program fltk_wrap_ui foreach get_cmake_property get_directory_property " -"get_filename_component get_source_file_property get_target_property get_test_property if include " -"include_directories include_external_msproject include_regular_expression install install_files " -"install_programs install_targets link_directories link_libraries list load_cache load_command " -"macro make_directory mark_as_advanced math message option output_required_files project qt_wrap_cpp " -"qt_wrap_ui remove remove_definitions separate_arguments set set_directory_properties set_source_files_properties " -"set_target_properties set_tests_properties site_name source_group string subdir_depends subdirs " -"target_link_libraries try_compile try_run use_mangled_mesa utility_source variable_requires vtk_make_instantiator " -"vtk_wrap_java vtk_wrap_python vtk_wrap_tcl while write_file", -"ABSOLUTE ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ALL AND APPEND ARGS ASCII BEFORE CACHE CACHE_VARIABLES " -"CLEAR COMMAND COMMANDS COMMAND_NAME COMMENT COMPARE COMPILE_FLAGS COPYONLY DEFINED DEFINE_SYMBOL " -"DEPENDS DOC EQUAL ESCAPE_QUOTES EXCLUDE EXCLUDE_FROM_ALL EXISTS EXPORT_MACRO EXT EXTRA_INCLUDE " -"FATAL_ERROR FILE FILES FORCE FUNCTION GENERATED GLOB GLOB_RECURSE GREATER GROUP_SIZE HEADER_FILE_ONLY " -"HEADER_LOCATION IMMEDIATE INCLUDES INCLUDE_DIRECTORIES INCLUDE_INTERNALS INCLUDE_REGULAR_EXPRESSION " -"LESS LINK_DIRECTORIES LINK_FLAGS LOCATION MACOSX_BUNDLE MACROS MAIN_DEPENDENCY MAKE_DIRECTORY MATCH " -"MATCHALL MATCHES MODULE NAME NAME_WE NOT NOTEQUAL NO_SYSTEM_PATH OBJECT_DEPENDS OPTIONAL OR OUTPUT " -"OUTPUT_VARIABLE PATH PATHS POST_BUILD POST_INSTALL_SCRIPT PREFIX PREORDER PRE_BUILD PRE_INSTALL_SCRIPT " -"PRE_LINK PROGRAM PROGRAM_ARGS PROPERTIES QUIET RANGE READ REGEX REGULAR_EXPRESSION REPLACE REQUIRED " -"RETURN_VALUE RUNTIME_DIRECTORY SEND_ERROR SHARED SOURCES STATIC STATUS STREQUAL STRGREATER STRLESS " -"SUFFIX TARGET TOLOWER TOUPPER VAR VARIABLES VERSION WIN32 WRAP_EXCLUDE WRITE APPLE MINGW MSYS CYGWIN " -"BORLAND WATCOM MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 CMAKE_COMPILER_2005 OFF ON", -"", "", "", "", "", "", "" }; - - -EDITLEXER lexCmake = { SCLEX_CMAKE, 63038, L"Cmake Script", L"cmake; ctest", L"", &KeyWords_CMAKE, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_CMAKE_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_CMAKE_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { MULTI_STYLE(SCE_CMAKE_STRINGDQ,SCE_CMAKE_STRINGLQ,SCE_CMAKE_STRINGRQ,0), 63131, L"String", L"back:#EEEEEE; fore:#7F007F", L"" }, - { SCE_CMAKE_COMMANDS, 63277, L"Function", L"fore:#00007F", L"" }, - { SCE_CMAKE_PARAMETERS, 63294, L"Parameter", L"fore:#7F200F", L"" }, - { SCE_CMAKE_VARIABLE, 63249, L"Variable", L"fore:#CC3300", L"" }, - { SCE_CMAKE_WHILEDEF, 63325, L"While Def", L"fore:#00007F", L"" }, - { SCE_CMAKE_FOREACHDEF, 63326, L"For Each Def", L"fore:#00007F", L"" }, - { SCE_CMAKE_IFDEFINEDEF, 63327, L"If Def", L"fore:#00007F", L"" }, - { SCE_CMAKE_MACRODEF, 63328, L"Macro Def", L"fore:#00007F", L"" }, - { SCE_CMAKE_STRINGVAR, 63267, L"Variable within String", L"back:#EEEEEE; fore:#CC3300", L"" }, - { SCE_CMAKE_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, - //{ SCE_CMAKE_USERDEFINED, 63106, L"User Defined", L"fore:#800020", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_AVS = { -"true false return global", -"addborders alignedsplice amplify amplifydb animate applyrange assumebff assumefieldbased assumefps " -"assumeframebased assumesamplerate assumescaledfps assumetff audiodub audiodubex avifilesource " -"avisource bicubicresize bilinearresize blackmanresize blackness blankclip blur bob cache changefps " -"colorbars colorkeymask coloryuv compare complementparity conditionalfilter conditionalreader " -"convertaudio convertaudioto16bit convertaudioto24bit convertaudioto32bit convertaudioto8bit " -"convertaudiotofloat convertbacktoyuy2 convertfps converttobackyuy2 converttomono converttorgb " -"converttorgb24 converttorgb32 converttoy8 converttoyv16 converttoyv24 converttoyv411 converttoyuy2 " -"converttoyv12 crop cropbottom delayaudio deleteframe dissolve distributor doubleweave duplicateframe " -"ensurevbrmp3sync fadein fadein0 fadein2 fadeio fadeio0 fadeio2 fadeout fadeout0 fadeout2 fixbrokenchromaupsampling " -"fixluminance fliphorizontal flipvertical frameevaluate freezeframe gaussresize generalconvolution " -"getchannel getchannels getmtmode getparity grayscale greyscale histogram horizontalreduceby2 " -"imagereader imagesource imagewriter info interleave internalcache internalcachemt invert killaudio " -"killvideo lanczos4resize lanczosresize layer letterbox levels limiter loop mask maskhs max merge " -"mergeargb mergechannels mergechroma mergeluma mergergb messageclip min mixaudio monotostereo normalize " -"null opendmlsource overlay peculiarblend pointresize pulldown reduceby2 resampleaudio resetmask reverse " -"rgbadjust scriptclip segmentedavisource segmenteddirectshowsource selecteven selectevery selectodd " -"selectrangeevery separatefields setmtmode sharpen showalpha showblue showfiveversions showframenumber " -"showgreen showred showsmpte showtime sincresize skewrows spatialsoften spline16resize spline36resize " -"spline64resize ssrc stackhorizontal stackvertical subtitle subtract supereq swapfields swapuv " -"temporalsoften timestretch tone trim turn180 turnleft turnright tweak unalignedsplice utoy utoy8 " -"version verticalreduceby2 vtoy vtoy8 wavsource weave writefile writefileend writefileif writefilestart " -"ytouv", -"addgrain addgrainc agc_hdragc analyzelogo animeivtc asharp audiograph autocrop autoyuy2 avsrecursion " -"awarpsharp bassaudiosource bicublinresize bifrost binarize blendfields blindpp blockbuster bordercontrol " -"cfielddiff cframediff chromashift cnr2 colormatrix combmask contra convolution3d convolution3dyv12 " -"dctfilter ddcc deblendlogo deblock deblock_qed decimate decomb dedup deen deflate degrainmedian depan " -"depanestimate depaninterleave depanscenes depanstabilize descratch despot dfttest dgbob dgdecode_mpeg2source " -"dgsource directshowsource distancefunction dss2 dup dupmc edeen edgemask ediupsizer eedi2 eedi3 eedi3_rpow2 " -"expand faerydust fastbicubicresize fastbilinearresize fastediupsizer dedgemask fdecimate ffaudiosource " -"ffdshow ffindex ffmpegsource ffmpegsource2 fft3dfilter fft3dgpu ffvideosource fielddeinterlace fielddiff " -"fillmargins fity2uv fity2u fity2v fitu2y fitv2y fluxsmooth fluxsmoothst fluxsmootht framediff framenumber " -"frfun3b frfun7 gicocu golddust gradfun2db grapesmoother greedyhma grid guavacomb hqdn3d hybridfupp " -"hysteresymask ibob improvesceneswitch inflate inpand inpaintlogo interframe interlacedresize " -"interlacedwarpedresize interleaved2planar iscombed iscombedt iscombedtivtc kerneldeint leakkernelbob " -"leakkerneldeint limitedsharpen limitedsharpenfaster logic lsfmod lumafilter lumayv12 manalyse " -"maskeddeinterlace maskedmerge maskedmix mblockfps mcompensate mctemporaldenoise mctemporaldenoisepp " -"mdegrain1 mdegrain2 mdegrain3 mdepan medianblur mergehints mflow mflowblur mflowfps mflowinter minblur " -"mipsmooth mmask moderatesharpen monitorfilter motionmask mpasource mpeg2source mrecalculate mscdetection " -"msharpen mshow msmooth msu_fieldshiftfixer msu_frc msuper mt mt_adddiff mt_average mt_binarize mt_circle " -"mt_clamp mt_convolution mt_deflate mt_diamond mt_edge mt_ellipse mt_expand mt_freeellipse mt_freelosange " -"mt_freerectangle mt_hysteresis mt_infix mt_inflate mt_inpand mt_invert mt_logic mt_losange mt_lut mt_lutf " -"mt_luts mt_lutspa mt_lutsx mt_lutxy mt_lutxyz mt_makediff mt_mappedblur mt_merge mt_motion mt_polish " -"mt_rectangle mt_square mti mtsource multidecimate mvanalyse mvblockfps mvchangecompensate mvcompensate " -"mvdegrain1 mvdegrain2 mvdegrain3 mvdenoise mvdepan mvflow mvflowblur mvflowfps mvflowfps2 mvflowinter " -"mvincrease mvmask mvrecalculate mvscdetection mvshow nicac3source nicdtssource niclpcmsource nicmpasource " -"nicmpg123source nnedi nnedi2 nnedi2_rpow2 nnedi3 nnedi3_rpow2 nomosmooth overlaymask peachsmoother pixiedust " -"planar2interleaved qtgmc qtinput rawavsource rawsource reduceflicker reinterpolate411 removedirt removedust " -"removegrain removegrainhd removetemporalgrain repair requestlinear reversefielddominance rgb3dlut rgdeinterlace " -"rgsdeinterlace rgblut rotate sangnom seesaw sharpen2 showchannels showcombedtivtc smartdecimate smartdeinterlace " -"smdegrain smoothdeinterlace smoothuv soothess soxfilter spacedust sshiq ssim ssiq stmedianfilter t3dlut tanisotropic " -"tbilateral tcanny tcomb tcombmask tcpserver tcpsource tdecimate tdeint tedgemask telecide temporalcleaner " -"temporalrepair temporalsmoother tfieldblank tfm tisophote tivtc tmaskblank tmaskedmerge tmaskedmerge3 tmm " -"tmonitor tnlmeans tomsmocomp toon textsub ttempsmooth ttempsmoothf tunsharp unblock uncomb undot unfilter " -"unsharpmask vaguedenoiser variableblur verticalcleaner videoscope vinverse vobsub vqmcalc warpedresize warpsharp " -"xsharpen yadif yadifmod yuy2lut yv12convolution yv12interlacedreduceby2 yv12interlacedselecttopfields " -"yv12layer yv12lut yv12lutxy yv12substract yv12torgb24 yv12toyuy2", -"abs apply assert bool ceil chr clip continueddenominator continuednumerator cos default defined eval " -"averagechromau averagechromav averageluma chromaudifference chromavdifference lumadifference " -"exist exp findstr float floor frac hexvalue import int isbool isclip isfloat isint isstring lcase leftstr " -"load_stdcall_plugin loadcplugin loadplugin loadvfapiplugin loadvirtualdubplugin log midstr muldiv nop " -"opt_allowfloataudio opt_avipadscanlines opt_dwchannelmask opt_usewaveextensible opt_vdubplanarhack " -"pi pow rand revstr rightstr round scriptdir scriptfile scriptname select setmemorymax setplanarlegacyalignment " -"rgbdifference rgbdifferencefromprevious rgbdifferencetonext udifferencefromprevious udifferencetonext " -"setworkingdir sign sin spline sqrt string strlen time ucase undefined value versionnumber versionstring " -"uplanemax uplanemedian uplanemin uplaneminmaxdifference vdifferencefromprevious vdifferencetonext " -"vplanemax vplanemedian vplanemin vplaneminmaxdifference ydifferencefromprevious ydifferencetonext " -"yplanemax yplanemedian yplanemin yplaneminmaxdifference", -"audiobits audiochannels audiolength audiolengthf audiorate framecount framerate frameratedenominator " -"frameratenumerator getleftchannel getrightchannel hasaudio hasvideo height isaudiofloat isaudioint " -"isfieldbased isframebased isinterleaved isplanar isrgb isrgb24 isrgb32 isyuv isyuy2 isyv12 width", -"", "", "", "" }; - - -EDITLEXER lexAVS = { SCLEX_AVS, 63039, L"AviSynth Script", L"avs; avsi", L"", &KeyWords_AVS, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_AVS_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_AVS_COMMENTLINE,SCE_AVS_COMMENTBLOCK,SCE_AVS_COMMENTBLOCKN,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_AVS_OPERATOR, 63132, L"Operator", L"", L"" }, - { MULTI_STYLE(SCE_AVS_STRING,SCE_AVS_TRIPLESTRING,0,0), 63131, L"String", L"fore:#7F007F", L"" }, - { SCE_AVS_NUMBER, 63130, L"Number", L"fore:#007F7F", L"" }, - { SCE_AVS_KEYWORD, 63128, L"Keyword", L"fore:#00007F; bold", L"" }, - { SCE_AVS_FILTER, 63333, L"Filter", L"fore:#00007F; bold", L"" }, - { SCE_AVS_PLUGIN, 63334, L"Plugin", L"fore:#0080C0; bold", L"" }, - { SCE_AVS_FUNCTION, 63277, L"Function", L"fore:#007F7F", L"" }, - { SCE_AVS_CLIPPROP, 63335, L"Clip Property", L"fore:#00007F", L"" }, - //{ SCE_AVS_USERDFN, 63106, L"User Defined", L"fore:#8000FF", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_MARKDOWN = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexMARKDOWN = { SCLEX_MARKDOWN, 63040, L"Markdown", L"md; markdown; mdown; mkdn; mkd", L"", &KeyWords_MARKDOWN, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_MARKDOWN_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_MARKDOWN_LINE_BEGIN, 63338, L"Line Begin", L"", L"" }, - { MULTI_STYLE(SCE_MARKDOWN_STRONG1,SCE_MARKDOWN_STRONG2,0,0), 63339, L"Strong", L"bold", L"" }, - { MULTI_STYLE(SCE_MARKDOWN_EM1,SCE_MARKDOWN_EM2,0,0), 63340, L"Emphasis", L"italic", L"" }, - { SCE_MARKDOWN_HEADER1, 63341, L"Header 1", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_HEADER2, 63342, L"Header 2", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_HEADER3, 63343, L"Header 3", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_HEADER4, 63344, L"Header 4", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_HEADER5, 63345, L"Header 5", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_HEADER6, 63346, L"Header 6", L"fore:#FF0088; bold", L"" }, - { SCE_MARKDOWN_PRECHAR, 63347, L"Pre Char", L"fore:#00007F", L"" }, - { SCE_MARKDOWN_ULIST_ITEM, 63348, L"Unordered List", L"fore:#0080FF; bold", L"" }, - { SCE_MARKDOWN_OLIST_ITEM, 63268, L"Ordered List", L"fore:#0080FF; bold", L"" }, - { SCE_MARKDOWN_BLOCKQUOTE, 63350, L"Block Quote", L"fore:#00007F", L"" }, - { SCE_MARKDOWN_STRIKEOUT, 63351, L"Strikeout", L"", L"" }, - { SCE_MARKDOWN_HRULE, 63352, L"Horizontal Rule", L"bold", L"" }, - { SCE_MARKDOWN_LINK, 63353, L"Link", L"fore:#0000FF", L"" }, - { MULTI_STYLE(SCE_MARKDOWN_CODE,SCE_MARKDOWN_CODE2,SCE_MARKDOWN_CODEBK,0), 63354, L"Code", L"fore:#00007F; back:#EBEBEB", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_YAML = { -"y n yes no on off true false", "", "", "", "", "", "", "", "" }; - -EDITLEXER lexYAML = { SCLEX_YAML, 63041, L"YAML", L"yaml; yml", L"", &KeyWords_YAML, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_YAML_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_YAML_COMMENT, 63127, L"Comment", L"fore:#008800", L"" }, - { SCE_YAML_IDENTIFIER, 63129, L"Identifier", L"bold; fore:#0A246A", L"" }, - { SCE_YAML_KEYWORD, 63128, L"Keyword", L"fore:#880088", L"" }, - { SCE_YAML_NUMBER, 63130, L"Number", L"fore:#FF8000", L"" }, - { SCE_YAML_REFERENCE, 63356, L"Reference", L"fore:#008888", L"" }, - { SCE_YAML_DOCUMENT, 63357, L"Document", L"fore:#FFFFFF; bold; back:#000088; eolfilled", L"" }, - { SCE_YAML_TEXT, 63358, L"Text", L"fore:#404040", L"" }, - { SCE_YAML_ERROR, 63359, L"Error", L"fore:#FFFFFF; bold; italic; back:#FF0000; eolfilled", L"" }, - { SCE_YAML_OPERATOR, 63132, L"Operator", L"fore:#333366", L"" }, - { -1, 00000, L"", L"", L"" } } }; - -KEYWORDLIST KeyWords_VHDL = { -"access after alias all architecture array assert attribute begin block body buffer bus case component configuration " -"constant disconnect downto else elsif end entity exit file for function generate generic group guarded if impure in " -"inertial inout is label library linkage literal loop map new next null of on open others out package port postponed " -"procedure process pure range record register reject report return select severity shared signal subtype then " -"to transport type unaffected units until use variable wait when while with", -"abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor", -"left right low high ascending image value pos val succ pred leftof rightof base range reverse_range length delayed stable " -"quiet transaction event active last_event last_active last_value driving driving_value simple_name path_name instance_name", -"now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector to_stdulogicvector " -"to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left rotate_right resize to_integer " -"to_unsigned to_signed std_match to_01", -"std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed std_logic_textio std_logic_unsigned " -"numeric_bit numeric_std math_complex math_real vital_primitives vital_timing", -"boolean bit character severity_level integer real time delay_length natural positive string bit_vector file_open_kind " -"file_open_status line text side width std_ulogic std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z unsigned signed", -"", "", "" }; - -EDITLEXER lexVHDL = { SCLEX_VHDL, 63028, L"VHDL", L"vhdl; vhd", L"", &KeyWords_VHDL, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_VHDL_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_VHDL_COMMENTLINEBANG, SCE_VHDL_COMMENT, SCE_VHDL_BLOCK_COMMENT, 0), 63127, L"Comment", L"fore:#008800", L"" }, - { SCE_VHDL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { MULTI_STYLE(SCE_VHDL_STRING, SCE_VHDL_STRINGEOL, 0, 0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_VHDL_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_VHDL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_VHDL_KEYWORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_VHDL_STDOPERATOR, 63371, L"Standard Operator", L"bold; fore:#0A246A", L"" }, - { SCE_VHDL_ATTRIBUTE, 63372, L"Attribute", L"", L"" }, - { SCE_VHDL_STDFUNCTION, 63373, L"Standard Function", L"", L"" }, - { SCE_VHDL_STDPACKAGE, 63374, L"Standard Package", L"", L"" }, - { SCE_VHDL_STDTYPE, 63375, L"Standard Type", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_Registry = { -"", "", "", "", "", "", "", "", "" }; - -EDITLEXER lexRegistry = { SCLEX_REGISTRY, 63027, L"Registry Files", L"reg", L"", &KeyWords_Registry, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_REG_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_REG_COMMENT, 63127, L"Comment", L"fore:#008800", L"" }, - { SCE_REG_VALUENAME, 63376, L"Value Name", L"", L"" }, - { MULTI_STYLE(SCE_REG_STRING,SCE_REG_STRING_GUID,0,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_REG_VALUETYPE, 63377, L"Value Type", L"bold; fore:#00007F", L"" }, - { SCE_REG_HEXDIGIT, 63378, L"Hex", L"fore:#7F0B0C", L"" }, - { SCE_REG_ADDEDKEY, 63379, L"Added Key", L"fore:#000000; back:#FF8040; bold; eolfilled", L"" }, //fore:#530155 - { SCE_REG_DELETEDKEY, 63380, L"Deleted Key", L"fore:#FF0000", L"" }, - { SCE_REG_ESCAPED, 63381, L"Escaped", L"bold; fore:#7D8187", L"" }, - { SCE_REG_KEYPATH_GUID, 63382, L"GUID in Key Path", L"fore:#7B5F15", L"" }, - { SCE_REG_PARAMETER, 63294, L"Parameter", L"fore:#0B6561", L"" }, - { SCE_REG_OPERATOR, 63132, L"Operator", L"bold", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_COFFEESCRIPT = { -"", "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexCOFFEESCRIPT = { SCLEX_COFFEESCRIPT, 63042, L"Coffeescript", L"coffee; Cakefile", L"", &KeyWords_COFFEESCRIPT, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_COFFEESCRIPT_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_COFFEESCRIPT_COMMENT,SCE_COFFEESCRIPT_COMMENTLINE,SCE_COFFEESCRIPT_COMMENTDOC,SCE_COFFEESCRIPT_COMMENTBLOCK), 63127, L"Comment", L"fore:#646464", L"" }, - { MULTI_STYLE(SCE_COFFEESCRIPT_STRING,SCE_COFFEESCRIPT_STRINGEOL,SCE_COFFEESCRIPT_STRINGRAW,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_COFFEESCRIPT_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - { SCE_COFFEESCRIPT_IDENTIFIER, 63129, L"Identifier", L"bold; fore:#0A246A", L"" }, - { SCE_COFFEESCRIPT_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_COFFEESCRIPT_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - //{ SCE_COFFEESCRIPT_CHARACTER, 63376, L"Character", L"", L"" }, - { MULTI_STYLE(SCE_COFFEESCRIPT_REGEX,SCE_COFFEESCRIPT_VERBOSE_REGEX,SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT,0), 63315, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, - { SCE_COFFEESCRIPT_GLOBALCLASS, 63378, L"Global Class", L"", L"" }, - //{ MULTI_STYLE(SCE_COFFEESCRIPT_COMMENTLINEDOC,SCE_COFFEESCRIPT_COMMENTDOCKEYWORD,SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR,0), 63379, L"Comment line", L"fore:#646464", L"" }, - { MULTI_STYLE(SCE_COFFEESCRIPT_WORD,SCE_COFFEESCRIPT_WORD2,0,0), 63380, L"Word", L"", L"" }, - { MULTI_STYLE(SCE_COFFEESCRIPT_VERBATIM,SCE_COFFEESCRIPT_TRIPLEVERBATIM,0,0), 63381, L"Verbatim", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_MATLAB = { -"break case catch continue else elseif end for function global if otherwise " -"persistent return switch try while", -"", "", "", "", "", "", "", "" }; - - -EDITLEXER lexMATLAB = { SCLEX_MATLAB, 63043, L"MATLAB", L"matlab", L"", &KeyWords_MATLAB, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_MATLAB_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_MATLAB_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_MATLAB_COMMAND, 63236, L"Command", L"bold", L"" }, - { SCE_MATLAB_NUMBER, 63130, L"Number", L"fore:#FF8000", L"" }, - { SCE_MATLAB_KEYWORD, 63128, L"Keyword", L"fore:#00007F; bold", L"" }, - { MULTI_STYLE(SCE_MATLAB_STRING,SCE_MATLAB_DOUBLEQUOTESTRING,0,0), 63131, L"String", L"fore:#7F007F", L"" }, - { SCE_MATLAB_OPERATOR, 63132, L"Operator", L"", L"" }, - { SCE_MATLAB_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - - -KEYWORDLIST KeyWords_D = { - // Primary keywords and identifiers - "abstract alias align asm assert auto body break case cast catch class const continue " - "debug default delegate delete deprecated do else enum export extern final finally for foreach foreach_reverse function " - "goto if import in inout interface invariant is lazy mixin module new out override " - "package pragma private protected public return scope static struct super switch synchronized " - "template this throw try typedef typeid typeof union unittest version volatile while with", - // Secondary keywords and identifiers - "false null true", - // Documentation comment keywords (doxygen) - "a addindex addtogroup anchor arg attention author b brief bug c class code date def defgroup deprecated dontinclude " - "e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception f$ f[f] file fn hideinitializer htmlinclude htmlonly " - "if image include ingroup internal invariant interface latexonly li line link mainpage name namespace nosubgrouping note overload " - "p page par param post pre ref relates remarks return retval sa section see showinitializer since skip skipline struct subsection " - "test throw todo typedef union until var verbatim verbinclude version warning weakgroup", - // Type definitions and aliases - "bool byte cdouble cent cfloat char creal dchar double float idouble ifloat int ireal long real short ubyte ucent uint ulong ushort void wchar", - // Keywords 5 - "", - // Keywords 6 - "", - // Keywords 7 - "", - // --- - "" -}; - - -EDITLEXER lexD = { SCLEX_D, 63022, L"D Source Code", L"d; dd; di", L"", &KeyWords_D, { - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_D_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_D_COMMENT,SCE_D_COMMENTLINE,SCE_D_COMMENTNESTED,0), 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_D_COMMENTDOC, 63259, L"Comment Doc", L"fore:#040A0", L"" }, - { SCE_D_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_D_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_D_WORD2, 63260, L"Keyword 2nd", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD3, 63128, L"Keyword 3", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD5, 63128, L"Keyword 5", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD6, 63128, L"Keyword 6", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD7, 63128, L"Keyword 7", L"bold; fore:#0A246A", L"" }, - { SCE_D_TYPEDEF, 63258, L"Typedef", L"italic; fore:#0A246A", L"" }, - { MULTI_STYLE(SCE_D_STRING,SCE_D_CHARACTER,SCE_D_STRINGEOL,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, - { SCE_D_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_D_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - //{ SCE_D_COMMENTLINEDOC, L"Default", L"", L"" }, - //{ SCE_D_COMMENTDOCKEYWORD, L"Default", L"", L"" }, - //{ SCE_D_STRINGB, L"Default", L"", L"" }, - //{ SCE_D_STRINGR, L"Default", L"", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - -KEYWORDLIST KeyWords_Go = { - // Primary keywords and identifiers - "break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type " - "continue for import return var", - // Secondary keywords and identifiers - "nil true false", - // Documentation comment keywords (doxygen) - "", - // Type definitions and aliases - "bool int int8 int16 int32 int64 byte uint uint8 uint16 uint32 uint64 uintptr float float32 float64 string", - // Keywords 5 - "", - // Keywords 6 - "", - // Keywords 7 - "", - // --- - "" -}; - - -EDITLEXER lexGo = { SCLEX_D, 63023, L"Go Source Code", L"go", L"", &KeyWords_Go,{ - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_D_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_D_COMMENT,SCE_D_COMMENTLINE,SCE_D_COMMENTNESTED,0), 63127, L"Comment", L"fore:#008000", L"" }, - //{ SCE_D_COMMENTDOC, 63259, L"Comment Doc", L"fore:#040A0", L"" }, - { SCE_D_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, - { SCE_D_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_D_WORD2, 63260, L"Keyword 2nd", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD3, 63128, L"Keyword 3", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD5, 63128, L"Keyword 5", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD6, 63128, L"Keyword 6", L"bold; fore:#0A246A", L"" }, - //{ SCE_D_WORD7, 63128, L"Keyword 7", L"bold; fore:#0A246A", L"" }, - { SCE_D_TYPEDEF, 63258, L"Typedef", L"italic; fore:#0A246A", L"" }, - { MULTI_STYLE(SCE_D_STRING,SCE_D_CHARACTER,SCE_D_STRINGEOL,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, - { SCE_D_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { SCE_D_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - //{ SCE_D_COMMENTLINEDOC, L"Default", L"", L"" }, - //{ SCE_D_COMMENTDOCKEYWORD, L"Default", L"", L"" }, - //{ SCE_D_STRINGB, L"Default", L"", L"" }, - //{ SCE_D_STRINGR, L"Default", L"", L"" }, - //C++: { MULTI_STYLE(SCE_C_PREPROCESSOR,SCE_C_PREPROCESSORCOMMENT,SCE_C_PREPROCESSORCOMMENTDOC,0), 63133, L"Preprocessor", L"fore:#FF8000", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - - -KEYWORDLIST KeyWords_Awk = { - // Keywords - "break case continue default do else exit function for if in next return switch while " - "@include delete nextfile print printf BEGIN BEGINFILE END " - "atan2 cos exp int log rand sin sqrt srand asort asorti gensub gsub index " - "length match patsplit split sprintf strtonum sub substr tolower toupper close " - "fflush system mktime strftime systime and compl lshift rshift xor " - "isarray bindtextdomain dcgettext dcngettext", - - // Highlighted identifiers (Keywords 2nd) - "ARGC ARGIND ARGV FILENAME FNR FS NF NR OFMT OFS ORS RLENGTH RS RSTART SUBSEP TEXTDOMAIN " - "BINMODE CONVFMT FIELDWIDTHS FPAT IGNORECASE LINT TEXTDOMAiN ENVIRON ERRNO PROCINFO RT", - - "" -}; - - -EDITLEXER lexAwk = { SCLEX_PYTHON, 63024, L"Awk Script", L"awk", L"", &KeyWords_Awk,{ - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_P_WORD, 63128, L"Keyword", L"bold; fore:#0000A0", L"" }, - { SCE_P_WORD2, 63260, L"Keyword 2nd", L"bold; italic; fore:#6666FF", L"" }, - { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#808080", L"" }, - { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,SCE_P_CHARACTER,0), 63131, L"String", L"fore:#008000", L"" }, - { SCE_P_NUMBER, 63130, L"Number", L"fore:#C04000", L"" }, - { SCE_P_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - - -KEYWORDLIST KeyWords_Nimrod = { - "addr and as asm atomic bind block break case cast concept const continue converter " - "defer discard distinct div do elif else end enum except export finally for from func " - "generic if import in include interface is isnot iterator let macro method mixin mod " - "nil not notin object of or out proc ptr raise ref return shl shr static " - "template try tuple type using var when while with without xor yield", - "", "", "", "", "", "", "", "" }; - - -EDITLEXER lexNimrod = { SCLEX_NIMROD, 63044, L"Nim Source Code", L"nim; nimrod", L"", &KeyWords_Nimrod,{ - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, - { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,SCE_C_COMMENTLINEDOC,0), 63127, L"Comment", L"fore:#880000", L"" }, - { SCE_P_WORD, 63128, L"Keyword", L"bold; fore:#000088", L"" }, - { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,0,0), 63211, L"String Double Quoted", L"fore:#008800", L"" }, - { SCE_P_CHARACTER, 63212, L"String Single Quoted", L"fore:#008800", L"" }, - { SCE_P_TRIPLEDOUBLE, 63244, L"String Triple Double Quotes", L"fore:#008800", L"" }, - { SCE_P_TRIPLE, 63245, L"String Triple Single Quotes", L"fore:#008800", L"" }, - { SCE_P_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, - { SCE_P_OPERATOR, 63132, L"Operator", L"bold; fore:#666600", L"" }, - //{ SCE_P_DEFNAME, 63247, L"Function name", L"fore:#660066", L"" }, - //{ SCE_P_CLASSNAME, 63246, L"Class name", L"fore:#660066", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - - -KEYWORDLIST KeyWords_R = { - // Language Keywords - "if else repeat while function for in next break " - "true false NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_", - // Base / Default package function - "abbreviate abline abs acf acos acosh addmargins aggregate agrep alarm alias alist " - "all anova any aov aperm append apply approx approxfun apropos ar args arima array " - "arrows asin asinh assign assocplot atan atanh attach attr attributes autoload autoloader ave axis " - "backsolve barplot basename beta bindtextdomain binomial biplot bitmap bmp body " - "box boxplot bquote break browser builtins bxp by bzfile c call cancor capabilities " - "casefold cat category cbind ccf ceiling character charmatch chartr chol choose " - "chull citation class close cm cmdscale codes coef coefficients col colnames colors " - "colorspaces colours comment complex confint conflicts contour contrasts contributors " - "convolve cophenetic coplot cor cos cosh cov covratio cpgram crossprod cummax cummin " - "cumprod cumsum curve cut cutree cycle data dataentry date dbeta dbinom dcauchy dchisq de " - "debug debugger decompose delay deltat demo dendrapply density deparse deriv det detach " - "determinant deviance dexp df dfbeta dfbetas dffits dgamma dgeom dget dhyper diag diff " - "diffinv difftime digamma dim dimnames dir dirname dist dlnorm dlogis dmultinom dnbinom " - "dnorm dotchart double dpois dput drop dsignrank dt dump dunif duplicated dweibull " - "dwilcox eapply ecdf edit effects eigen emacs embed end environment eval evalq " - "example exists exp expression factanal factor factorial family fft fifo file filter " - "find fitted fivenum fix floor flush for force formals format formula forwardsolve " - "fourfoldplot frame frequency ftable function gamma gaussian gc gcinfo gctorture get " - "getenv geterrmessage gettext gettextf getwd gl glm globalenv gray grep grey grid gsub " - "gzcon gzfile hat hatvalues hcl hclust head heatmap help hist history hsv httpclient " - "iconv iconvlist identical identify if ifelse image influence inherits integer integrate " - "interaction interactive intersect invisible isoreg jitter jpeg julian kappa kernapply " - "kernel kmeans knots kronecker ksmooth labels lag lapply layout lbeta lchoose lcm legend " - "length letters levels lfactorial lgamma library licence license line lines list lm load " - "loadhistory loadings local locator loess log logb logical loglin lowess ls lsfit machine mad " - "mahalanobis makepredictcall manova mapply match matlines matplot matpoints matrix max mean " - "median medpolish menu merge message methods mget min missing mode monthplot months " - "mosaicplot mtext mvfft names napredict naprint naresid nargs nchar ncol next nextn ngettext " - "nlevels nlm nls noquote nrow numeric objects offset open optim optimise optimize options " - "order ordered outer pacf page pairlist pairs palette par parse paste pbeta pbinom pbirthday " - "pcauchy pchisq pdf pentagamma person persp pexp pf pgamma pgeom phyper pi pico pictex pie " - "piechart pipe plclust plnorm plogis plot pmatch pmax pmin pnbinom png pnorm points poisson " - "poly polygon polym polyroot postscript power ppoints ppois ppr prcomp predict preplot " - "pretty princomp print prmatrix prod profile profiler proj promax prompt provide psigamma " - "psignrank pt ptukey punif pweibull pwilcox q qbeta qbinom qbirthday qcauchy qchisq qexp qf " - "qgamma qgeom qhyper qlnorm qlogis qnbinom qnorm qpois qqline qqnorm qqplot qr qsignrank qt " - "qtukey quantile quarters quasi quasibinomial quasipoisson quit qunif quote qweibull qwilcox " - "rainbow range rank raw rbeta rbind rbinom rcauchy rchisq readline real recover rect " - "reformulate regexpr relevel remove reorder rep repeat replace replicate replications require " - "reshape resid residuals restart return rev rexp rf rgamma rgb rgeom rhyper rle rlnorm rlogis rm " - "rmultinom rnbinom rnorm round row rownames rowsum rpois rsignrank rstandard rstudent rt " - "rug runif runmed rweibull rwilcox sample sapply save savehistory scale scan screen screeplot sd " - "search searchpaths seek segments seq sequence serialize setdiff setequal setwd shell sign " - "signif sin single sinh sink smooth solve sort source spectrum spline splinefun split sprintf " - "sqrt stack stars start stderr stdin stdout stem step stepfun stl stop stopifnot str strftime " - "strheight stripchart strptime strsplit strtrim structure strwidth strwrap sub subset " - "substitute substr substring sum summary sunflowerplot supsmu svd sweep switch symbols symnum " - "system t table tabulate tail tan tanh tapply tempdir tempfile termplot terms tetragamma " - "text time title toeplitz tolower topenv toupper trace traceback transform trigamma trunc " - "truncate try ts tsdiag tsp typeof unclass undebug union unique uniroot unix unlink unlist " - "unname unserialize unsplit unstack untrace unz update upgrade url var varimax vcov vector " - "version vi vignette warning warnings weekdays weights which while window windows " - "with write wsbrowser xedit xemacs xfig xinch xor xtabs xyinch yinch zapsmall", - // "Other Package Functions - "acme aids aircondit amis aml banking barchart barley beaver bigcity boot brambles " - "breslow bs bwplot calcium cane capability cav censboot channing city claridge cloth " - "cloud coal condense contourplot control corr darwin densityplot dogs dotplot ducks " - "empinf envelope environmental ethanol fir frets gpar grav gravity grob hirose histogram " - "islay knn larrows levelplot llines logit lpoints lsegments lset ltext lvqinit lvqtest manaus " - "melanoma melanoma motor multiedit neuro nitrofen nodal ns nuclear oneway parallel " - "paulsen poisons polar qq qqmath remission rfs saddle salinity shingle simplex singer " - "somgrid splom stripplot survival tau tmd tsboot tuna unit urine viewport wireframe wool xyplot", - // Unused - "", - // Unused - "", - // --- - "", "", "", "" -}; - - -EDITLEXER lexR = { SCLEX_R, 63045, L"R-S-SPlus Statistics Code", L"R", L"", &KeyWords_R,{ - { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, - //{ SCE_R_DEFAULT, 63126, L"Default", L"", L"" }, - { SCE_R_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, - { SCE_R_KWORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, - { SCE_R_BASEKWORD, 63271, L"Base Package Functions", L"bold; fore:#7f0000", L"" }, - { SCE_R_OTHERKWORD, 63272, L"Other Package Functions", L"bold; fore:#7f007F", L"" }, - { SCE_R_NUMBER, 63130, L"Number", L"fore:#0000FF", L"" }, - { MULTI_STYLE(SCE_R_STRING,SCE_R_STRING2,0,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, - { SCE_R_OPERATOR, 63132, L"Operator", L"bold; fore:#B000B0", L"" }, - { SCE_R_IDENTIFIER, 63129, L"Identifier", L"", L"" }, - { SCE_R_INFIX, 63269, L"Infix", L"fore:#660066", L"" }, - { SCE_R_INFIXEOL, 63270, L"Infix EOL", L"fore:#FF4000; ,back:#E0C0E0; eolfilled", L"" }, - { -1, 00000, L"", L"", L"" } } }; - - - -// This array holds all the lexers... -// Don't forget to change the number of the lexer for HTML and XML -// in Notepad2.c ParseCommandLine() if you change this array! -static PEDITLEXER g_pLexArray[NUMLEXERS] = -{ - &lexStandard, // Default Text - &lexStandard2nd, // 2nd Default Text - &lexANSI, // ANSI Files - &lexCONF, // Apache Config Files - &lexASM, // Assembly Script - &lexAHK, // AutoHotkey Script - &lexAU3, // AutoIt3 Script - &lexAVS, // AviSynth Script - &lexAwk, // Awk Script - &lexBAT, // Batch Files - &lexCPP, // C/C++ Source Code - &lexCS, // C# Source Code - &lexCmake, // Cmake Script - &lexCOFFEESCRIPT, // Coffeescript - &lexPROPS, // Configuration Files - &lexCSS, // CSS Style Sheets - &lexD, // D Source Code - &lexDIFF, // Diff Files - &lexGo, // Go Source Code - &lexINNO, // Inno Setup Script - &lexJAVA, // Java Source Code - &lexJS, // JavaScript - &lexJSON, // JSON - &lexLATEX, // LaTeX Files - &lexLUA, // Lua Script - &lexMAK, // Makefiles - &lexMARKDOWN, // Markdown - &lexMATLAB, // MATLAB - &lexNimrod, // Nim(rod) - &lexNSIS, // NSIS Script - &lexPAS, // Pascal Source Code - &lexPL, // Perl Script - &lexPS, // PowerShell Script - &lexPY, // Python Script - &lexR, // R Statistics Code - &lexRegistry, // Registry Files - &lexRC, // Resource Script - &lexRUBY, // Ruby Script - &lexBASH, // Shell Script - &lexSQL, // SQL Query - &lexTCL, // Tcl Script - &lexVB, // Visual Basic - &lexVBS, // VBScript - &lexVHDL, // VHDL - &lexHTML, // Web Source Code - &lexXML, // XML Document - &lexYAML // YAML -}; - - -// Currently used lexer -static int g_iDefaultLexer = 0; -static PEDITLEXER g_pLexCurrent = &lexStandard; - -static bool g_fStylesModified = false; -static bool g_fWarnedNoIniFile = false; - -static COLORREF g_colorCustom[16]; -static bool g_bAutoSelect; -static int g_cxStyleSelectDlg; -static int g_cyStyleSelectDlg; - - -extern int g_iDefaultCharSet; -extern bool bHiliteCurrentLine; -extern bool bHyperlinkHotspot; - - -//============================================================================= -// -// IsLexerStandard() -// - -bool __fastcall IsLexerStandard(PEDITLEXER pLexer) -{ - return ( pLexer && ((pLexer == &lexStandard) || (pLexer == &lexStandard2nd)) ); -} - -PEDITLEXER __fastcall GetCurrentStdLexer() -{ - return (Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard); -} - -bool __fastcall IsStyleStandardDefault(PEDITSTYLE pStyle) -{ - return (pStyle && ((pStyle->rid == 63100) || (pStyle->rid == 63112))); -} - -bool __fastcall IsStyleSchemeDefault(PEDITSTYLE pStyle) -{ - return (pStyle && (pStyle->rid == 63126)); -} - -PEDITLEXER __fastcall GetDefaultLexer() -{ - return g_pLexArray[g_iDefaultLexer]; -} - - -//============================================================================= -// -// Style_RgbAlpha() -// -int __fastcall Style_RgbAlpha(int rgbFore, int rgbBack, int alpha) -{ - return (int)RGB(\ - (0xFF - alpha) * (int)GetRValue(rgbBack) / 0xFF + alpha * (int)GetRValue(rgbFore) / 0xFF, \ - (0xFF - alpha) * (int)GetGValue(rgbBack) / 0xFF + alpha * (int)GetGValue(rgbFore) / 0xFF, \ - (0xFF - alpha) * (int)GetBValue(rgbBack) / 0xFF + alpha * (int)GetBValue(rgbFore) / 0xFF); -} - - -//============================================================================= -// -// Style_Load() -// -void Style_Load() -{ - int i,iLexer; - WCHAR tch[32] = { L'\0' };; - WCHAR *pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100) ; - int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - // Custom colors - g_colorCustom [0] = RGB(0x00,0x00,0x00); - g_colorCustom [1] = RGB(0x0A,0x24,0x6A); - g_colorCustom [2] = RGB(0x3A,0x6E,0xA5); - g_colorCustom [3] = RGB(0x00,0x3C,0xE6); - g_colorCustom [4] = RGB(0x00,0x66,0x33); - g_colorCustom [5] = RGB(0x60,0x80,0x20); - g_colorCustom [6] = RGB(0x64,0x80,0x00); - g_colorCustom [7] = RGB(0xA4,0x60,0x00); - g_colorCustom [8] = RGB(0xFF,0xFF,0xFF); - g_colorCustom [9] = RGB(0xFF,0xFF,0xE2); - g_colorCustom[10] = RGB(0xFF,0xF1,0xA8); - g_colorCustom[11] = RGB(0xFF,0xC0,0x00); - g_colorCustom[12] = RGB(0xFF,0x40,0x00); - g_colorCustom[13] = RGB(0xC8,0x00,0x00); - g_colorCustom[14] = RGB(0xB0,0x00,0xB0); - g_colorCustom[15] = RGB(0xB2,0x8B,0x40); - - LoadIniSection(L"Custom Colors",pIniSection,cchIniSection); - for (i = 0; i < 16; i++) { - WCHAR wch[32] = { L'\0' }; - StringCchPrintf(tch,COUNTOF(tch),L"%02i",i+1); - if (IniSectionGetString(pIniSection,tch,L"",wch,COUNTOF(wch))) { - if (wch[0] == L'#') { - int irgb; - int itok = swscanf_s(CharNext(wch),L"%x",&irgb); - if (itok == 1) - g_colorCustom[i] = RGB((irgb&0xFF0000) >> 16,(irgb&0xFF00) >> 8,irgb&0xFF); - } - } - } - - LoadIniSection(L"Styles",pIniSection,cchIniSection); - - // 2nd default - Style_SetUse2ndDefault(IniSectionGetBool(pIniSection, L"Use2ndDefaultStyle", 0)); - - // default scheme - g_iDefaultLexer = IniSectionGetInt(pIniSection,L"DefaultScheme",0); - g_iDefaultLexer = min(max(g_iDefaultLexer,0),COUNTOF(g_pLexArray)-1); - - // auto select - g_bAutoSelect = (IniSectionGetInt(pIniSection,L"AutoSelect",1)) ? 1 : 0; - - // scheme select dlg dimensions - g_cxStyleSelectDlg = IniSectionGetInt(pIniSection,L"SelectDlgSizeX",304); - g_cxStyleSelectDlg = max(g_cxStyleSelectDlg,0); - - g_cyStyleSelectDlg = IniSectionGetInt(pIniSection,L"SelectDlgSizeY",0); - g_cyStyleSelectDlg = max(g_cyStyleSelectDlg,324); - - for (iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { - LoadIniSection(g_pLexArray[iLexer]->pszName,pIniSection,cchIniSection); - IniSectionGetString(pIniSection, L"FileNameExtensions", g_pLexArray[iLexer]->pszDefExt, - g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions)); - i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - IniSectionGetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName, - g_pLexArray[iLexer]->Styles[i].pszDefault, - g_pLexArray[iLexer]->Styles[i].szValue, - COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue)); - i++; - } - } - LocalFree(pIniSection); - - // 2nd Default Style has same filename extension list as (1st) Default Style - StringCchCopyW(lexStandard2nd.szExtensions, COUNTOF(lexStandard2nd.szExtensions), lexStandard.szExtensions); -} - - -//============================================================================= -// -// Style_Save() -// -void Style_Save() -{ - WCHAR tch[32] = { L'\0' };; - WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); - //int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - // Custom colors - for (int i = 0; i < 16; i++) { - WCHAR wch[32] = { L'\0' }; - StringCchPrintf(tch,COUNTOF(tch),L"%02i",i+1); - StringCchPrintf(wch,COUNTOF(wch),L"#%02X%02X%02X", - (int)GetRValue(g_colorCustom[i]),(int)GetGValue(g_colorCustom[i]),(int)GetBValue(g_colorCustom[i])); - IniSectionSetString(pIniSection,tch,wch); - } - SaveIniSection(L"Custom Colors",pIniSection); - ZeroMemory(pIniSection,LocalSize(pIniSection)); - - // auto select - IniSectionSetBool(pIniSection,L"Use2ndDefaultStyle",Style_GetUse2ndDefault()); - - // default scheme - IniSectionSetInt(pIniSection,L"DefaultScheme",g_iDefaultLexer); - - // auto select - IniSectionSetInt(pIniSection,L"AutoSelect",g_bAutoSelect); - - // scheme select dlg dimensions - IniSectionSetInt(pIniSection,L"SelectDlgSizeX",g_cxStyleSelectDlg); - IniSectionSetInt(pIniSection,L"SelectDlgSizeY",g_cyStyleSelectDlg); - - SaveIniSection(L"Styles",pIniSection); - ZeroMemory(pIniSection,LocalSize(pIniSection)); - - if (!g_fStylesModified) { - LocalFree(pIniSection); - return; - } - - for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { - IniSectionSetString(pIniSection,L"FileNameExtensions", g_pLexArray[iLexer]->szExtensions); - int i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - IniSectionSetString(pIniSection, g_pLexArray[iLexer]->Styles[i].pszName, g_pLexArray[iLexer]->Styles[i].szValue); - i++; - } - - SaveIniSection(g_pLexArray[iLexer]->pszName,pIniSection); - ZeroMemory(pIniSection,LocalSize(pIniSection)); - } - LocalFree(pIniSection); -} - - -//============================================================================= -// -// Style_Import() -// -bool Style_Import(HWND hwnd) -{ - WCHAR szFile[MAX_PATH * 2] = { L'\0' }; - WCHAR szFilter[256] = { L'\0' }; - OPENFILENAME ofn; - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - GetString(IDS_FILTER_INI,szFilter,COUNTOF(szFilter)); - PrepareFilterStr(szFilter); - - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = szFilter; - ofn.lpstrFile = szFile; - ofn.lpstrDefExt = L"ini"; - ofn.nMaxFile = COUNTOF(szFile); - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT - | OFN_PATHMUSTEXIST | OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/; - - if (GetOpenFileName(&ofn)) { - - int i,iLexer; - WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); - int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - for (iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { - if (GetPrivateProfileSection(g_pLexArray[iLexer]->pszName,pIniSection,cchIniSection,szFile)) { - IniSectionGetString(pIniSection, L"FileNameExtensions", g_pLexArray[iLexer]->pszDefExt, - g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions)); - i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - IniSectionGetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName, - g_pLexArray[iLexer]->Styles[i].pszDefault, - g_pLexArray[iLexer]->Styles[i].szValue, - COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue)); - i++; - } - } - } - LocalFree(pIniSection); - return(true); - } - return(false); -} - -//============================================================================= -// -// Style_Export() -// -bool Style_Export(HWND hwnd) -{ - WCHAR szFile[MAX_PATH * 2] = { L'\0' }; - WCHAR szFilter[256] = { L'\0' }; - OPENFILENAME ofn; - DWORD dwError = ERROR_SUCCESS; - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - GetString(IDS_FILTER_INI,szFilter,COUNTOF(szFilter)); - PrepareFilterStr(szFilter); - - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = szFilter; - ofn.lpstrFile = szFile; - ofn.lpstrDefExt = L"ini"; - ofn.nMaxFile = COUNTOF(szFile); - ofn.Flags = /*OFN_FILEMUSTEXIST |*/ OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT - | OFN_PATHMUSTEXIST | OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/ | OFN_OVERWRITEPROMPT; - - if (GetSaveFileName(&ofn)) { - - WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); - //int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); - - for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { - IniSectionSetString(pIniSection,L"FileNameExtensions",g_pLexArray[iLexer]->szExtensions); - int i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - IniSectionSetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName,g_pLexArray[iLexer]->Styles[i].szValue); - i++; - } - if (!WritePrivateProfileSection(g_pLexArray[iLexer]->pszName,pIniSection,szFile)) - dwError = GetLastError(); - ZeroMemory(pIniSection,LocalSize(pIniSection)); - } - LocalFree(pIniSection); - - if (dwError != ERROR_SUCCESS) { - MsgBox(MBINFO,IDS_EXPORT_FAIL,szFile); - } - return(true); - } - return(false); -} - - -//============================================================================= -// -// Style_SetLexer() -// -void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) -{ - int iValue; - COLORREF rgb; - COLORREF dColor; - - WCHAR wchFontName[64] = { '\0' }; - WCHAR wchSpecificStyle[80] = { L'\0' }; - - // Select standard if NULL is specified - if (!pLexNew) { - pLexNew = GetDefaultLexer(); //GetCurrentStdLexer(); - } - else if (IsLexerStandard(pLexNew)) { - pLexNew = Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard; - } - - // first set standard lexer's default values - g_pLexCurrent = GetCurrentStdLexer(); - const WCHAR* const wchStandardStyleStrg = g_pLexCurrent->Styles[STY_DEFAULT].szValue; - - // Lexer - SendMessage(hwnd, SCI_SETLEXER, pLexNew->iLexer, 0); - - // Lexer very specific styles - if (pLexNew->iLexer == SCLEX_XML) - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.xml.allow.scripts", (LPARAM)"1"); - if (pLexNew->iLexer == SCLEX_CPP) { - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"styling.within.preprocessor", (LPARAM)"1"); - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.cpp.track.preprocessor", (LPARAM)"0"); - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.cpp.update.preprocessor", (LPARAM)"0"); - } - else if (pLexNew->iLexer == SCLEX_PASCAL) - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.pascal.smart.highlighting", (LPARAM)"1"); - else if (pLexNew->iLexer == SCLEX_SQL) { - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1"); - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.sql.backticks.identifier", (LPARAM)"1"); - SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.sql.numbersign.comment", (LPARAM)"1"); - } - else if (pLexNew->iLexer == SCLEX_NSIS) - SciCall_SetProperty("nsis.ignorecase", "1"); - else if (pLexNew->iLexer == SCLEX_CSS) { - SciCall_SetProperty("lexer.css.scss.language", "1"); - SciCall_SetProperty("lexer.css.less.language", "1"); - } - else if (pLexNew->iLexer == SCLEX_JSON) { - SciCall_SetProperty("json.allow.comments", "1"); - SciCall_SetProperty("json.escape.sequence", "1"); - } - - // Code folding - switch (pLexNew->iLexer) - { - case SCLEX_NULL: - case SCLEX_CONTAINER: - case SCLEX_BATCH: - case SCLEX_CONF: - case SCLEX_MAKEFILE: - case SCLEX_MARKDOWN: - g_bCodeFoldingAvailable = false; - SciCall_SetProperty("fold", "0"); - break; - default: - g_bCodeFoldingAvailable = true; - SciCall_SetProperty("fold", "1"); - SciCall_SetProperty("fold.compact", "0"); - SciCall_SetProperty("fold.comment", "1"); - SciCall_SetProperty("fold.html", "1"); - SciCall_SetProperty("fold.preprocessor", "1"); - SciCall_SetProperty("fold.cpp.comment.explicit", "0"); - break; - } - - // Add KeyWord Lists - for (int i = 0; i < (KEYWORDSET_MAX + 1); i++) { - SendMessage(hwnd, SCI_SETKEYWORDS, i, (LPARAM)pLexNew->pKeyWords->pszKeyWords[i]); - } - - // Clear - SendMessage(hwnd, SCI_CLEARDOCUMENTSTYLE, 0, 0); - - // Idle Styling (very large text) - SendMessage(hwnd, SCI_SETIDLESTYLING, SC_IDLESTYLING_AFTERVISIBLE, 0); - //SendMessage(hwnd, SCI_SETIDLESTYLING, SC_IDLESTYLING_ALL, 0); - - // Default Values are always set - SendMessage(hwnd, SCI_STYLERESETDEFAULT, 0, 0); - - if (!Style_StrGetColor(true, wchStandardStyleStrg, &dColor)) - SendMessage(hwnd, SCI_STYLESETFORE, STYLE_DEFAULT, (LPARAM)GetSysColor(COLOR_WINDOWTEXT)); // default text color - if (!Style_StrGetColor(false, wchStandardStyleStrg, &dColor)) - SendMessage(hwnd, SCI_STYLESETBACK, STYLE_DEFAULT, (LPARAM)GetSysColor(COLOR_WINDOW)); // default window color - - // Auto-select codepage according to charset - //~Style_SetACPfromCharSet(hwnd); - - // ---- Font & More --- - - // constants - - Style_SetFontQuality(hwnd, wchStandardStyleStrg); - SendMessage(hwnd, SCI_STYLESETVISIBLE, STYLE_DEFAULT, (LPARAM)true); - SendMessage(hwnd, SCI_STYLESETHOTSPOT, STYLE_DEFAULT, (LPARAM)false); // default hotspot off - - - // customizable - - if (!Style_StrGetFont(wchStandardStyleStrg, wchFontName, COUNTOF(wchFontName))) - { - char chFontName[64] = { '\0' }; - Style_StrGetFont(L"font:Default", wchFontName, COUNTOF(wchFontName)); - WideCharToMultiByteStrg(Encoding_SciCP, wchFontName, chFontName); - SendMessage(hwnd, SCI_STYLESETFONT, STYLE_DEFAULT, (LPARAM)chFontName); - } - - float fBaseFontSize = INITIAL_BASE_FONT_SIZE * 1.0; // init - Style_StrGetSize(wchStandardStyleStrg, &fBaseFontSize); - fBaseFontSize = (float)max(0.0, fBaseFontSize); - Style_SetBaseFontSize(hwnd, fBaseFontSize); - Style_SetCurrentFontSize(hwnd, fBaseFontSize); - - if (!Style_StrGetCharSet(wchStandardStyleStrg, &iValue)) { - SendMessage(hwnd, SCI_STYLESETCHARACTERSET, STYLE_DEFAULT, (LPARAM)DEFAULT_CHARSET); - } - - if (!Style_StrGetWeightValue(wchStandardStyleStrg, &iValue)) { - SendMessage(hwnd, SCI_STYLESETWEIGHT, STYLE_DEFAULT, (LPARAM)FW_NORMAL); - } - - if (!Style_StrGetCase(wchStandardStyleStrg, &iValue)) { - SendMessage(hwnd, SCI_STYLESETCASE, STYLE_DEFAULT, (LPARAM)SC_CASE_MIXED); - } - - if (!StrStrI(wchStandardStyleStrg, L"italic")) - SendMessage(hwnd, SCI_STYLESETITALIC, STYLE_DEFAULT, (LPARAM)false); - - if (!StrStrI(wchStandardStyleStrg, L"underline")) - SendMessage(hwnd, SCI_STYLESETUNDERLINE, STYLE_DEFAULT, (LPARAM)false); - - if (!StrStrI(wchStandardStyleStrg, L"eolfilled")) - SendMessage(hwnd, SCI_STYLESETEOLFILLED, STYLE_DEFAULT, (LPARAM)false); - - - // --- apply default style --- - Style_SetStyles(hwnd, STYLE_DEFAULT, wchStandardStyleStrg); - - // --- apply current scheme specific settings to default style --- - if (!IsLexerStandard(pLexNew)) - { - const WCHAR* const wchCurrentLexerStyleStrg = pLexNew->Styles[STY_DEFAULT].szValue; - // merge lexer styles - Style_SetStyles(hwnd, STYLE_DEFAULT, wchCurrentLexerStyleStrg); - // use this font size as current lexer's base - fBaseFontSize = Style_GetBaseFontSize(hwnd); - Style_StrGetSize(wchCurrentLexerStyleStrg, &fBaseFontSize); - fBaseFontSize = (float)max(0.0, fBaseFontSize); - Style_SetCurrentFontSize(hwnd, fBaseFontSize); - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, true && !IsWindow(g_hwndDlgCustomizeSchemes)); - } - else { - EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, false); - } - - // Broadcast STYLE_DEFAULT as base style to all other style - SendMessage(hwnd, SCI_STYLECLEARALL, 0, 0); - - // -------------------------------------------------------------------------- - - const PEDITLEXER pCurrentStandard = g_pLexCurrent; - - // -------------------------------------------------------------------------- - - Style_SetMargin(hwnd, pCurrentStandard->Styles[STY_MARGIN].iStyle, - pCurrentStandard->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style - - if (bUseOldStyleBraceMatching) { - Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_OK].iStyle, - pCurrentStandard->Styles[STY_BRACE_OK].szValue); // brace light - } - else { - if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_BRACE_OK].szValue, &dColor)) - SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_MATCH_BRACE, dColor); - if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_OK].szValue, &iValue, true)) - SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_MATCH_BRACE, iValue); - if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_OK].szValue, &iValue, false)) - SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MATCH_BRACE, iValue); - - iValue = -1; // need for retrieval - if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_BRACE_OK].szValue, 0, &iValue)) { - // got default, get string - StringCchCatW(pCurrentStandard->Styles[STY_BRACE_OK].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); - Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); - StringCchCatW(pCurrentStandard->Styles[STY_BRACE_OK].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); - } - SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MATCH_BRACE, iValue); - } - if (bUseOldStyleBraceMatching) { - Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_BAD].iStyle, - pCurrentStandard->Styles[STY_BRACE_BAD].szValue); // brace bad - } - else { - if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &dColor)) - SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_BAD_BRACE, dColor); - if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &iValue, true)) - SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_BAD_BRACE, iValue); - if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &iValue, false)) - SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_BAD_BRACE, iValue); - - iValue = -1; // need for retrieval - if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, 0, &iValue)) { - // got default, get string - StringCchCatW(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); - Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); - StringCchCatW(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); - } - SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_BAD_BRACE, iValue); - } - - // Occurrences Marker - if (!Style_StrGetColor(true, pCurrentStandard->Styles[STY_MARK_OCC].szValue, &dColor)) - { - WCHAR* sty = L""; - switch (iMarkOccurrences) { - case 1: - sty = L"fore:0xFF0000"; - dColor = RGB(0xFF, 0x00, 0x00); - break; - case 2: - sty = L"fore:0x00FF00"; - dColor = RGB(0x00, 0xFF, 0x00); - break; - case 3: - default: - sty = L"fore:0x0000FF"; - dColor = RGB(0x00, 0xFF, 0x00); - break; - } - StringCchCopyW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), sty); - } - SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_MARK_OCCURANCE, dColor); - - if (!Style_StrGetAlpha(pCurrentStandard->Styles[STY_MARK_OCC].szValue, &iValue, true)) { - iValue = 100; - StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; alpha:100"); - } - SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_MARK_OCCURANCE, iValue); - - if (!Style_StrGetAlpha(pCurrentStandard->Styles[STY_MARK_OCC].szValue, &iValue, false)) { - iValue = 100; - StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; alpha2:100"); - } - SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MARK_OCCURANCE, iValue); - - iValue = -1; // need for retrieval - if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_MARK_OCC].szValue, 0, &iValue)) { - // got default, get string - StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); - Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); - StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); - } - SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MARK_OCCURANCE, iValue); - - // More default values... - - if (pLexNew != &lexANSI) - Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_CTRL_CHR].iStyle, pCurrentStandard->Styles[STY_CTRL_CHR].szValue); // control char - - Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_INDENT_GUIDE].iStyle, pCurrentStandard->Styles[STY_INDENT_GUIDE].szValue); // indent guide - - if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_SEL_TXT].szValue, &rgb)) { // selection fore - SendMessage(hwnd, SCI_SETSELFORE, true, rgb); - SendMessage(hwnd, SCI_SETADDITIONALSELFORE, rgb, 0); - } - else { - SendMessage(hwnd, SCI_SETSELFORE, 0, 0); - SendMessage(hwnd, SCI_SETADDITIONALSELFORE, 0, 0); - } - - if (Style_StrGetColor(false, pCurrentStandard->Styles[STY_SEL_TXT].szValue, &dColor)) { // selection back - SendMessage(hwnd, SCI_SETSELBACK, true, dColor); - SendMessage(hwnd, SCI_SETADDITIONALSELBACK, dColor, 0); - } - else { - SendMessage(hwnd, SCI_SETSELBACK, true, RGB(0xC0, 0xC0, 0xC0)); // use a default value... - SendMessage(hwnd, SCI_SETADDITIONALSELBACK, RGB(0xC0, 0xC0, 0xC0), 0); - } - - if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_SEL_TXT].szValue, &iValue, true)) { // selection alpha - SendMessage(hwnd, SCI_SETSELALPHA, iValue, 0); - SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, iValue, 0); - } - else { - SendMessage(hwnd, SCI_SETSELALPHA, SC_ALPHA_NOALPHA, 0); - SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, SC_ALPHA_NOALPHA, 0); - } - - if (StrStrI(pCurrentStandard->Styles[STY_SEL_TXT].szValue, L"eolfilled")) // selection eolfilled - SendMessage(hwnd, SCI_SETSELEOLFILLED, 1, 0); - else - SendMessage(hwnd, SCI_SETSELEOLFILLED, 0, 0); - - if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_WHITESPACE].szValue, &rgb)) // whitespace fore - SendMessage(hwnd, SCI_SETWHITESPACEFORE, true, rgb); - else - SendMessage(hwnd, SCI_SETWHITESPACEFORE, 0, 0); - - if (Style_StrGetColor(false, pCurrentStandard->Styles[STY_WHITESPACE].szValue, &rgb)) // whitespace back - SendMessage(hwnd, SCI_SETWHITESPACEBACK, true, rgb); - else - SendMessage(hwnd, SCI_SETWHITESPACEBACK, 0, 0); // use a default value... - - // whitespace dot size - iValue = 1; - float fValue = 1.0; - if (Style_StrGetSize(pCurrentStandard->Styles[STY_WHITESPACE].szValue, &fValue)) - { - iValue = (int)max(min(fValue, 5.0), 0.0); - - WCHAR tch[32] = { L'\0' }; - WCHAR wchStyle[BUFSIZE_STYLE_VALUE]; - StringCchCopyN(wchStyle, COUNTOF(wchStyle), pCurrentStandard->Styles[STY_WHITESPACE].szValue, - COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue)); - - StringCchPrintf(pCurrentStandard->Styles[STY_WHITESPACE].szValue, - COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), L"size:%i", iValue); - - if (Style_StrGetColor(true, wchStyle, &rgb)) { - StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X", - (int)GetRValue(rgb), - (int)GetGValue(rgb), - (int)GetBValue(rgb)); - StringCchCat(pCurrentStandard->Styles[STY_WHITESPACE].szValue, - COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), tch); - } - - if (Style_StrGetColor(false, wchStyle, &rgb)) { - StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X", - (int)GetRValue(rgb), - (int)GetGValue(rgb), - (int)GetBValue(rgb)); - StringCchCat(pCurrentStandard->Styles[STY_WHITESPACE].szValue, - COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), tch); - } - } - SendMessage(hwnd, SCI_SETWHITESPACESIZE, iValue, 0); - - // current line background - Style_SetCurrentLineBackground(hwnd, bHiliteCurrentLine); - - // bookmark line or marker - Style_SetBookmark(hwnd, g_bShowSelectionMargin); - - // caret style and width - if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"block")) { - SendMessage(hwnd,SCI_SETCARETSTYLE,CARETSTYLE_BLOCK,0); - StringCchCopy(wchSpecificStyle,COUNTOF(wchSpecificStyle),L"block"); - } - else { - SendMessage(hwnd, SCI_SETCARETSTYLE, CARETSTYLE_LINE, 0); - - WCHAR wch[32] = { L'\0' }; - iValue = 1; - fValue = 1.0; // default caret width - if (Style_StrGetSize(pCurrentStandard->Styles[STY_CARET].szValue,&fValue)) { - iValue = (int)max(min(fValue,3.0),1.0); - StringCchPrintf(wch,COUNTOF(wch),L"size:%i",iValue); - StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),wch); - } - SendMessage(hwnd,SCI_SETCARETWIDTH,iValue,0); - } - if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"noblink")) { - SendMessage(hwnd,SCI_SETCARETPERIOD,(WPARAM)0,0); - SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, false, 0); - StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),L"; noblink"); - } - else { - const UINT uCaretBlinkTime = GetCaretBlinkTime(); - SendMessage(hwnd, SCI_SETCARETPERIOD, (WPARAM)uCaretBlinkTime, 0); - SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, ((uCaretBlinkTime != 0) ? true : false), 0); - } - // caret fore - if (!Style_StrGetColor(true,pCurrentStandard->Styles[STY_CARET].szValue,&rgb)) - rgb = GetSysColor(COLOR_WINDOWTEXT); - else { - WCHAR wch[32] = { L'\0' }; - StringCchPrintf(wch,COUNTOF(wch),L"; fore:#%02X%02X%02X", - (int)GetRValue(rgb), - (int)GetGValue(rgb), - (int)GetBValue(rgb)); - - StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),wch); - } - if (!VerifyContrast(rgb,(COLORREF)SendMessage(hwnd,SCI_STYLEGETBACK,0,0))) - rgb = (int)SendMessage(hwnd,SCI_STYLEGETFORE,0,0); - SendMessage(hwnd,SCI_SETCARETFORE,rgb,0); - SendMessage(hwnd,SCI_SETADDITIONALCARETFORE,rgb,0); - - - StrTrimW(wchSpecificStyle, L" ;"); - StringCchCopy(pCurrentStandard->Styles[STY_CARET].szValue, - COUNTOF(pCurrentStandard->Styles[STY_CARET].szValue),wchSpecificStyle); - - if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) { - if (Style_StrGetColor(true,pCurrentStandard->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge fore - SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); - else - SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } - else { - if (Style_StrGetColor(false,pCurrentStandard->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge back - SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); - else - SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } - - // Extra Line Spacing - iValue = 0; - fValue = 0.0; - if (Style_StrGetSize(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue,&fValue) && (pLexNew != &lexANSI)) { - iValue = (int)fValue; - const int iCurFontSizeDbl = (int)(2.0 * Style_GetCurrentFontSize(hwnd)); - int iValAdj = min(max(iValue,(0 - iCurFontSizeDbl)), 256 * iCurFontSizeDbl); - if (iValAdj != iValue) - StringCchPrintf(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue, - COUNTOF(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue), L"size:%i", iValAdj); - - int iAscent = 0; - int iDescent = 0; - if ((iValAdj % 2) != 0) { - iAscent++; - iValAdj--; - } - iAscent += (iValAdj / 2); - iDescent += (iValAdj / 2); - SendMessage(hwnd,SCI_SETEXTRAASCENT,(WPARAM)iAscent,0); - SendMessage(hwnd,SCI_SETEXTRADESCENT,(WPARAM)iDescent,0); - } - else { - SendMessage(hwnd,SCI_SETEXTRAASCENT,0,0); - SendMessage(hwnd,SCI_SETEXTRADESCENT,0,0); - } - - if (SendMessage(hwnd,SCI_GETINDENTATIONGUIDES,0,0) != SC_IV_NONE) - Style_SetIndentGuides(hwnd,true); - - // here: global define current lexer (used in subsequent calls) - g_pLexCurrent = pLexNew; - - if (g_pLexCurrent->iLexer != SCLEX_NULL || g_pLexCurrent == &lexANSI) - { - int j; - int i = 1; // don't re-apply lexer's default style - while (g_pLexCurrent->Styles[i].iStyle != -1) - { - for (j = 0; j < 4 && (g_pLexCurrent->Styles[i].iStyle8[j] != 0 || j == 0); ++j) { - Style_SetStyles(hwnd, g_pLexCurrent->Styles[i].iStyle8[j], g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HPHP_DEFAULT) { - int iRelated[] = { SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HPHP_WORD, SCE_HPHP_HSTRING, SCE_HPHP_SIMPLESTRING, SCE_HPHP_NUMBER, - SCE_HPHP_OPERATOR, SCE_HPHP_VARIABLE, SCE_HPHP_HSTRING_VARIABLE, SCE_HPHP_COMPLEX_VARIABLE }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HJ_DEFAULT) { - int iRelated[] = { SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC, SCE_HJ_KEYWORD, SCE_HJ_WORD, SCE_HJ_DOUBLESTRING, - SCE_HJ_SINGLESTRING, SCE_HJ_STRINGEOL, SCE_HJ_REGEX, SCE_HJ_NUMBER, SCE_HJ_SYMBOLS }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HJA_DEFAULT) { - int iRelated[] = { SCE_HJA_COMMENT, SCE_HJA_COMMENTLINE, SCE_HJA_COMMENTDOC, SCE_HJA_KEYWORD, SCE_HJA_WORD, SCE_HJA_DOUBLESTRING, - SCE_HJA_SINGLESTRING, SCE_HJA_STRINGEOL, SCE_HJA_REGEX, SCE_HJA_NUMBER, SCE_HJA_SYMBOLS }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HB_DEFAULT) { - int iRelated[] = { SCE_HB_COMMENTLINE, SCE_HB_WORD, SCE_HB_IDENTIFIER, SCE_HB_STRING, SCE_HB_STRINGEOL, SCE_HB_NUMBER }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HBA_DEFAULT) { - int iRelated[] = { SCE_HBA_COMMENTLINE, SCE_HBA_WORD, SCE_HBA_IDENTIFIER, SCE_HBA_STRING, SCE_HBA_STRINGEOL, SCE_HBA_NUMBER }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if ((g_pLexCurrent->iLexer == SCLEX_HTML || g_pLexCurrent->iLexer == SCLEX_XML) && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_SGML_DEFAULT) { - int iRelated[] = { SCE_H_SGML_COMMAND, SCE_H_SGML_1ST_PARAM, SCE_H_SGML_DOUBLESTRING, SCE_H_SGML_SIMPLESTRING, SCE_H_SGML_ERROR, - SCE_H_SGML_SPECIAL, SCE_H_SGML_ENTITY, SCE_H_SGML_COMMENT, SCE_H_SGML_1ST_PARAM_COMMENT, SCE_H_SGML_BLOCK_DEFAULT }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if ((g_pLexCurrent->iLexer == SCLEX_HTML || g_pLexCurrent->iLexer == SCLEX_XML) && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_CDATA) { - int iRelated[] = { SCE_HP_START, SCE_HP_DEFAULT, SCE_HP_COMMENTLINE, SCE_HP_NUMBER, SCE_HP_STRING, - SCE_HP_CHARACTER, SCE_HP_WORD, SCE_HP_TRIPLE, SCE_HP_TRIPLEDOUBLE, SCE_HP_CLASSNAME, - SCE_HP_DEFNAME, SCE_HP_OPERATOR, SCE_HP_IDENTIFIER, SCE_HPA_START, SCE_HPA_DEFAULT, - SCE_HPA_COMMENTLINE, SCE_HPA_NUMBER, SCE_HPA_STRING, SCE_HPA_CHARACTER, SCE_HPA_WORD, - SCE_HPA_TRIPLE, SCE_HPA_TRIPLEDOUBLE, SCE_HPA_CLASSNAME, SCE_HPA_DEFNAME, SCE_HPA_OPERATOR, - SCE_HPA_IDENTIFIER }; - for (j = 0; j < COUNTOF(iRelated); j++) - Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); - } - - if (g_pLexCurrent->iLexer == SCLEX_XML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_CDATA) { - int iRelated[] = { SCE_H_SCRIPT, SCE_H_ASP, SCE_H_ASPAT, SCE_H_QUESTION, - SCE_HPHP_DEFAULT, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HPHP_WORD, SCE_HPHP_HSTRING, - SCE_HPHP_SIMPLESTRING, SCE_HPHP_NUMBER, SCE_HPHP_OPERATOR, SCE_HPHP_VARIABLE, - SCE_HPHP_HSTRING_VARIABLE, SCE_HPHP_COMPLEX_VARIABLE, SCE_HJ_START, SCE_HJ_DEFAULT, - SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC, SCE_HJ_KEYWORD, SCE_HJ_WORD, - SCE_HJ_DOUBLESTRING, SCE_HJ_SINGLESTRING, SCE_HJ_STRINGEOL, SCE_HJ_REGEX, SCE_HJ_NUMBER, - SCE_HJ_SYMBOLS, SCE_HJA_START, SCE_HJA_DEFAULT, SCE_HJA_COMMENT, SCE_HJA_COMMENTLINE, - SCE_HJA_COMMENTDOC, SCE_HJA_KEYWORD, SCE_HJA_WORD, SCE_HJA_DOUBLESTRING, SCE_HJA_SINGLESTRING, - SCE_HJA_STRINGEOL, SCE_HJA_REGEX, SCE_HJA_NUMBER, SCE_HJA_SYMBOLS, SCE_HB_START, SCE_HB_DEFAULT, - SCE_HB_COMMENTLINE, SCE_HB_WORD, SCE_HB_IDENTIFIER, SCE_HB_STRING, SCE_HB_STRINGEOL, - SCE_HB_NUMBER, SCE_HBA_START, SCE_HBA_DEFAULT, SCE_HBA_COMMENTLINE, SCE_HBA_WORD, - SCE_HBA_IDENTIFIER, SCE_HBA_STRING, SCE_HBA_STRINGEOL, SCE_HBA_NUMBER, SCE_HP_START, - SCE_HP_DEFAULT, SCE_HP_COMMENTLINE, SCE_HP_NUMBER, SCE_HP_STRING, SCE_HP_CHARACTER, SCE_HP_WORD, - SCE_HP_TRIPLE, SCE_HP_TRIPLEDOUBLE, SCE_HP_CLASSNAME, SCE_HP_DEFNAME, SCE_HP_OPERATOR, - SCE_HP_IDENTIFIER, SCE_HPA_START, SCE_HPA_DEFAULT, SCE_HPA_COMMENTLINE, SCE_HPA_NUMBER, - SCE_HPA_STRING, SCE_HPA_CHARACTER, SCE_HPA_WORD, SCE_HPA_TRIPLE, SCE_HPA_TRIPLEDOUBLE, - SCE_HPA_CLASSNAME, SCE_HPA_DEFNAME, SCE_HPA_OPERATOR, SCE_HPA_IDENTIFIER }; - - for (j = 0; j < COUNTOF(iRelated); j++) { - Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); - } - } - - if (g_pLexCurrent->iLexer == SCLEX_CPP && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_C_COMMENT) { - int iRelated[] = { SCE_C_COMMENTLINE, SCE_C_COMMENTDOC, SCE_C_COMMENTLINEDOC, SCE_C_COMMENTDOCKEYWORD, SCE_C_COMMENTDOCKEYWORDERROR }; - for (j = 0; j < COUNTOF(iRelated); j++) { - Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); - } - } - - if (g_pLexCurrent->iLexer == SCLEX_SQL && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_SQL_COMMENT) { - int iRelated[] = { SCE_SQL_COMMENTLINE, SCE_SQL_COMMENTDOC, SCE_SQL_COMMENTLINEDOC, SCE_SQL_COMMENTDOCKEYWORD, SCE_SQL_COMMENTDOCKEYWORDERROR }; - for (j = 0; j < COUNTOF(iRelated); j++) { - Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); - } - } - i++; - } - } - - // apply lexer styles - Style_SetUrlHotSpot(hwnd, false); - EditApplyLexerStyle(hwnd, 0, -1); - - // update UI for hotspots - if (bHyperlinkHotspot) { - Style_SetUrlHotSpot(hwnd, bHyperlinkHotspot); - EditUpdateUrlHotspots(hwnd, 0, SciCall_GetTextLength(), bHyperlinkHotspot); - } - - UpdateLineNumberWidth(); -} - - -//============================================================================= -// -// Style_GetHotspotStyleID() -// -int Style_GetHotspotStyleID() -{ - return (STYLE_LASTPREDEFINED + STY_URL_HOTSPOT); -} - - -//============================================================================= -// -// Style_SetUrlHotSpot() -// -void Style_SetUrlHotSpot(HWND hwnd, bool bHotSpot) -{ - // Hot Spot settings - const int iStyleHotSpot = Style_GetHotspotStyleID(); - - if (bHotSpot) - { - const WCHAR* const lpszStyleHotSpot = GetCurrentStdLexer()->Styles[STY_URL_HOTSPOT].szValue; - - SendMessage(hwnd, SCI_STYLESETHOTSPOT, iStyleHotSpot, (LPARAM)true); - SendMessage(hwnd, SCI_SETHOTSPOTSINGLELINE, false, 0); - - // Font - Style_SetStyles(hwnd, iStyleHotSpot, lpszStyleHotSpot); - - //if (StrStrI(lpszStyleHotSpot, L"underline") != NULL) - // SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, true, 0); - //else - // SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, false, 0); - SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, true, 0); - - COLORREF rgb = 0; - // Fore - if (Style_StrGetColor(true, lpszStyleHotSpot, &rgb)) { - COLORREF inactiveFG = (COLORREF)((rgb * 75 + 50) / 100); - SendMessage(hwnd, SCI_STYLESETFORE, iStyleHotSpot, (LPARAM)inactiveFG); - SendMessage(hwnd, SCI_SETHOTSPOTACTIVEFORE, true, (LPARAM)rgb); - } - // Back - if (Style_StrGetColor(false, lpszStyleHotSpot, &rgb)) { - SendMessage(hwnd, SCI_STYLESETBACK, iStyleHotSpot, (LPARAM)rgb); - SendMessage(hwnd, SCI_SETHOTSPOTACTIVEBACK, true, (LPARAM)rgb); - } - } - else { - const WCHAR* const lpszStyleHotSpot = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue; - Style_SetStyles(hwnd, iStyleHotSpot, lpszStyleHotSpot); - SendMessage(hwnd, SCI_STYLESETHOTSPOT, iStyleHotSpot, (LPARAM)false); - } - -} - - -//============================================================================= -// -// Style_SetLongLineColors() -// -void Style_SetLongLineColors(HWND hwnd) -{ - COLORREF rgb; - - if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) - { - if (Style_StrGetColor(true, GetCurrentStdLexer()->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge fore - SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); - else - SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } - else { - if (Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge back - SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); - else - SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } -} - - -//============================================================================= -// -// Style_SetCurrentLineBackground() -// -void Style_SetCurrentLineBackground(HWND hwnd, bool bHiLitCurrLn) -{ - if (bHiLitCurrLn) - { - COLORREF rgb = 0; - if (Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_CUR_LN_BCK].szValue, &rgb)) // caret line back - { - SendMessage(hwnd, SCI_SETCARETLINEVISIBLEALWAYS, true, 0); - SendMessage(hwnd, SCI_SETCARETLINEVISIBLE, true, 0); - SendMessage(hwnd, SCI_SETCARETLINEBACK, rgb, 0); - - int alpha = 0; - if (Style_StrGetAlpha(GetCurrentStdLexer()->Styles[STY_CUR_LN_BCK].szValue, &alpha, true)) - SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,alpha,0); - else - SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,SC_ALPHA_NOALPHA,0); - - return; - } - } - SendMessage(hwnd, SCI_SETCARETLINEVISIBLE, false, 0); - SendMessage(hwnd, SCI_SETCARETLINEVISIBLEALWAYS, false, 0); -} - - -//============================================================================= -// -// Style_SetFolding() -// -void Style_SetFolding(HWND hwnd, bool bShowCodeFolding) -{ - float fSize = INITIAL_BASE_FONT_SIZE + 1.0; - Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); - SciCall_SetMarginWidth(MARGIN_SCI_FOLDING, (bShowCodeFolding) ? (int)fSize : 0); - UNUSED(hwnd); -} - - -//============================================================================= -// -// Style_SetBookmark() -// -void Style_SetBookmark(HWND hwnd, bool bShowSelMargin) -{ - UNUSED(hwnd); - float fSize = INITIAL_BASE_FONT_SIZE + 1.0; - Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); - SciCall_SetMarginWidth(MARGIN_SCI_BOOKMRK, (bShowSelMargin) ? (int)fSize + 4 : 0); - - // Depending on if the margin is visible or not, choose different bookmark indication - if (bShowSelMargin) { - SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BOOKMARK); - } - else { - SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BACKGROUND); - } -} - - -//============================================================================= -// -// Style_SetMargin() -// -void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle) -{ - static const int iMarkerIDs[] = - { - SC_MARKNUM_FOLDEROPEN, - SC_MARKNUM_FOLDER, - SC_MARKNUM_FOLDERSUB, - SC_MARKNUM_FOLDERTAIL, - SC_MARKNUM_FOLDEREND, - SC_MARKNUM_FOLDEROPENMID, - SC_MARKNUM_FOLDERMIDTAIL - }; - - if (iStyle == STYLE_LINENUMBER) { - Style_SetStyles(hwnd, iStyle, lpszStyle); // line numbers - } - - COLORREF clrFore = SciCall_StyleGetFore(STYLE_LINENUMBER); - Style_StrGetColor(true, lpszStyle, &clrFore); - - COLORREF clrBack = SciCall_StyleGetBack(STYLE_LINENUMBER); - Style_StrGetColor(false, lpszStyle, &clrBack); - - //SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrBack); - - - // --- Bookmarks --- - COLORREF bmkFore = clrFore; - COLORREF bmkBack = clrBack; - const WCHAR* wchBookMarkStyleStrg = GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue; - - Style_StrGetColor(true, wchBookMarkStyleStrg, &bmkFore); - Style_StrGetColor(false, wchBookMarkStyleStrg, &bmkBack); - - // adjust background color by alpha in case of show margin - int alpha = 20; - Style_StrGetAlpha(wchBookMarkStyleStrg, &alpha, true); - - COLORREF bckgrnd = clrBack; - Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &bckgrnd); - bmkBack = Style_RgbAlpha(bmkBack, bckgrnd, min(0xFF, alpha)); - - SciCall_MarkerSetFore(MARKER_NP3_BOOKMARK, bmkFore); - SciCall_MarkerSetBack(MARKER_NP3_BOOKMARK, bmkBack); - SendMessage(hwnd, SCI_MARKERSETALPHA, MARKER_NP3_BOOKMARK, alpha); - - SciCall_SetMarginBackN(MARGIN_SCI_BOOKMRK, clrBack); - - - // --- Code folding --- - SciCall_SetMarginType(MARGIN_SCI_FOLDING, SC_MARGIN_COLOUR); - SciCall_SetMarginMask(MARGIN_SCI_FOLDING, SC_MASK_FOLDERS); - SciCall_SetMarginSensitive(MARGIN_SCI_FOLDING, true); - SciCall_SetMarginBackN(MARGIN_SCI_FOLDING, clrBack); - - int fldStyleMrk = SC_CASE_LOWER; - Style_StrGetCase(wchBookMarkStyleStrg, &fldStyleMrk); - if (fldStyleMrk == SC_CASE_UPPER) // circle style - { - SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); - SciCall_MarkerDefine(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE); - SciCall_MarkerDefine(SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED); - SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE); - } - else // box style - { - SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); - SciCall_MarkerDefine(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER); - SciCall_MarkerDefine(SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED); - SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED); - SciCall_MarkerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER); - } - - int fldStyleLn = 0; - Style_StrGetCharSet(wchBookMarkStyleStrg, &fldStyleLn); - switch (fldStyleLn) - { - case 1: - SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED); - break; - case 2: - SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED | SC_FOLDFLAG_LINEAFTER_CONTRACTED); - break; - default: - SciCall_SetFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED); - break; - } - - SciCall_SetFoldMarginColour(true, clrBack); // background - SciCall_SetFoldMarginHiColour(true, clrBack); // (!) - - //SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_HIDDEN); - - for (int i = 0; i < COUNTOF(iMarkerIDs); ++i) { - SciCall_MarkerSetBack(iMarkerIDs[i], bmkFore); - SciCall_MarkerSetFore(iMarkerIDs[i], bmkBack); - } - - // set width - Style_SetBookmark(hwnd, g_bShowSelectionMargin); - Style_SetFolding(hwnd, (g_bCodeFoldingAvailable && g_bShowCodeFolding)); -} - - -//============================================================================= -// -// Style_SniffShebang() -// -PEDITLEXER __fastcall Style_SniffShebang(char *pchText) -{ - if (StrCmpNA(pchText,"#!",2) == 0) { - char *pch = pchText + 2; - while (*pch == ' ' || *pch == '\t') - pch++; - while (*pch && *pch != ' ' && *pch != '\t' && *pch != '\r' && *pch != '\n') - pch++; - if ((pch - pchText) >= 3 && StrCmpNA(pch-3,"env",3) == 0) { - while (*pch == ' ') - pch++; - while (*pch && *pch != ' ' && *pch != '\t' && *pch != '\r' && *pch != '\n') - pch++; - } - if ((pch - pchText) >= 3 && StrCmpNIA(pch-3,"php",3) == 0) - return(&lexHTML); - else if ((pch - pchText) >= 4 && StrCmpNIA(pch-4,"perl",4) == 0) - return(&lexPL); - else if ((pch - pchText) >= 6 && StrCmpNIA(pch-6,"python",6) == 0) - return(&lexPY); - else if ((pch - pchText) >= 3 && StrCmpNA(pch-3,"tcl",3) == 0) - return(&lexTCL); - else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"wish",4) == 0) - return(&lexTCL); - else if ((pch - pchText) >= 5 && StrCmpNA(pch-5,"tclsh",5) == 0) - return(&lexTCL); - else if ((pch - pchText) >= 2 && StrCmpNA(pch-2,"sh",2) == 0) - return(&lexBASH); - else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"ruby",4) == 0) - return(&lexRUBY); - else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"node",4) == 0) - return(&lexJS); - } - - return(NULL); -} - - -//============================================================================= -// -// Style_MatchLexer() -// -PEDITLEXER __fastcall Style_MatchLexer(LPCWSTR lpszMatch,bool bCheckNames) { - int i; - WCHAR tch[COUNTOF(g_pLexArray[0]->szExtensions)] = { L'\0' }; - WCHAR *p1,*p2; - - if (!bCheckNames) { - - for (i = 0; i < COUNTOF(g_pLexArray); i++) { - ZeroMemory(tch,sizeof(WCHAR)*COUNTOF(tch)); - StringCchCopy(tch,COUNTOF(tch),g_pLexArray[i]->szExtensions); - p1 = tch; - while (*p1) { - p2 = StrChr(p1,L';'); - if (p2) - *p2 = L'\0'; - else - p2 = StrEnd(p1); - StrTrim(p1,L" ."); - if (StringCchCompareIX(p1,lpszMatch) == 0) - return(g_pLexArray[i]); - p1 = p2 + 1; - } - } - } - - else { - - int cch = lstrlen(lpszMatch); - if (cch >= 3) { - - for (i = 0; i < COUNTOF(g_pLexArray); i++) { - if (StrCmpNI(g_pLexArray[i]->pszName,lpszMatch,cch) == 0) - return(g_pLexArray[i]); - } - } - } - return(NULL); -} - - -//============================================================================= -// -// Style_HasLexerForExt() -// -bool Style_HasLexerForExt(LPCWSTR lpszExt) -{ - if (lpszExt && (*lpszExt == L'.')) ++lpszExt; - return (lpszExt && Style_MatchLexer(lpszExt,false)) ? true : false; -} - - -//============================================================================= -// -// Style_SetLexerFromFile() -// -extern int flagNoHTMLGuess; -extern int flagNoCGIGuess; -extern FILEVARS fvCurFile; - -void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) -{ - LPWSTR lpszExt = PathFindExtension(lpszFile); - bool bFound = false; - PEDITLEXER pLexNew = g_pLexArray[g_iDefaultLexer]; - PEDITLEXER pLexSniffed; - - if ((fvCurFile.mask & FV_MODE) && fvCurFile.tchMode[0]) { - - WCHAR wchMode[32] = { L'\0' }; - PEDITLEXER pLexMode; - - MultiByteToWideCharStrg(Encoding_SciCP, fvCurFile.tchMode, wchMode); - - if (!flagNoCGIGuess && (StringCchCompareIN(wchMode,COUNTOF(wchMode),L"cgi",-1) == 0 || - StringCchCompareIN(wchMode,COUNTOF(wchMode),L"fcgi",-1) == 0)) { - char tchText[256] = { L'\0' }; - SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); - StrTrimA(tchText," \t\n\r"); - pLexSniffed = Style_SniffShebang(tchText); - if (pLexSniffed) { - if ((Encoding_Current(CPI_GET) != g_DOSEncoding) || !IsLexerStandard(pLexSniffed) || ( - StringCchCompareIX(lpszExt,L"nfo") && StringCchCompareIX(lpszExt,L"diz"))) { - // Although .nfo and .diz were removed from the default lexer's - // default extensions list, they may still presist in the user's INI - pLexNew = pLexSniffed; - bFound = true; - } - } - } - - if (!bFound) { - pLexMode = Style_MatchLexer(wchMode, false); - if (pLexMode) { - pLexNew = pLexMode; - bFound = true; - } - else { - pLexMode = Style_MatchLexer(wchMode, true); - if (pLexMode) { - pLexNew = pLexMode; - bFound = true; - } - } - } - } - - if (!bFound && g_bAutoSelect && /* g_bAutoSelect == false skips lexer search */ - (lpszFile && StringCchLen(lpszFile,MAX_PATH) > 0 && *lpszExt)) { - - if (*lpszExt == L'.') ++lpszExt; - - if (!flagNoCGIGuess && (StringCchCompareIX(lpszExt,L"cgi") == 0 || StringCchCompareIX(lpszExt,L"fcgi") == 0)) { - char tchText[256] = { L'\0' }; - SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); - StrTrimA(tchText," \t\n\r"); - pLexSniffed = Style_SniffShebang(tchText); - if (pLexSniffed) { - pLexNew = pLexSniffed; - bFound = true; - } - } - - if (!bFound && StringCchCompareIX(PathFindFileName(lpszFile),L"cmakelists.txt") == 0) { - pLexNew = &lexCmake; - bFound = true; - } - - // check associated extensions - if (!bFound) { - pLexSniffed = Style_MatchLexer(lpszExt, false); - if (pLexSniffed) { - pLexNew = pLexSniffed; - bFound = true; - } - } - } - - if (!bFound && g_bAutoSelect && - StringCchCompareIX(PathFindFileName(lpszFile),L"makefile") == 0) { - pLexNew = &lexMAK; - bFound = true; - } - - if (!bFound && g_bAutoSelect && - StringCchCompareIX(PathFindFileName(lpszFile),L"rakefile") == 0) { - pLexNew = &lexRUBY; - bFound = true; - } - - if (!bFound && g_bAutoSelect && - StringCchCompareIX(PathFindFileName(lpszFile),L"mozconfig") == 0) { - pLexNew = &lexBASH; - bFound = true; - } - - if (!bFound && g_bAutoSelect && (!flagNoHTMLGuess || !flagNoCGIGuess)) { - char tchText[512]; - SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); - StrTrimA(tchText," \t\n\r"); - if (!flagNoCGIGuess) { - if (tchText[0] == '<') { - if (StrStrIA(tchText, "= 0 && id < COUNTOF(g_pLexArray)) { - Style_SetLexer(hwnd,g_pLexArray[id]); - } -} - - -//============================================================================= -// -// Style_ToggleUse2ndDefault() -// -void Style_ToggleUse2ndDefault(HWND hwnd) -{ - bool use2ndDefStyle = Style_GetUse2ndDefault(); - Style_SetUse2ndDefault(use2ndDefStyle ? false : true); // swap - Style_SetLexer(hwnd,g_pLexCurrent); -} - - - -//============================================================================= -// -// Style_SetDefaultFont() -// -void Style_SetDefaultFont(HWND hwnd, bool bGlobalDefault) -{ - WCHAR newStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - const PEDITLEXER pLexer = bGlobalDefault ? GetCurrentStdLexer() : g_pLexCurrent; - const PEDITSTYLE pLexerDefStyle = &(pLexer->Styles[STY_DEFAULT]); - - StringCchCopyW(newStyle, COUNTOF(newStyle), pLexer->Styles[STY_DEFAULT].szValue); - - if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), pLexer->pszName, pLexer->Styles[STY_DEFAULT].pszName, - IsStyleStandardDefault(pLexerDefStyle), IsStyleSchemeDefault(pLexerDefStyle), false, true)) - { - // set new styles to current lexer's default text - StringCchCopyW(pLexerDefStyle->szValue, COUNTOF(pLexerDefStyle->szValue), newStyle); - g_fStylesModified = true; - // redraw current(!) lexer - Style_SetLexer(hwnd, g_pLexCurrent); - } -} - - - -//============================================================================= -// -// Style_SetUse2ndDefault(), Style_GetUse2ndDefault() -// -bool Style_SetUse2ndDefault(int value) -{ - static bool bUse2ndDefaultStyle = false; - - if ((value == true) || (value == false)) { - bUse2ndDefaultStyle = (bool)value; - } - return bUse2ndDefaultStyle; -} - -bool Style_GetUse2ndDefault() -{ - return Style_SetUse2ndDefault(false - true); -} - - - -//============================================================================= -// -// Style_SetBaseFontSize(), Style_GetBaseFontSize() -// -float Style_SetBaseFontSize(HWND hwnd, float fSize) -{ - static float fBaseFontSize = INITIAL_BASE_FONT_SIZE * 1.0; - - if (fSize >= 0.0) { - fBaseFontSize = (float)(((int)(fSize * 100 + 0.5)) / 100.0); - //SendMessage(hwnd, SCI_STYLESETSIZE, STYLE_DEFAULT, (LPARAM)iBaseFontSize); - SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, STYLE_DEFAULT, (LPARAM)((int)(fBaseFontSize * SC_FONT_SIZE_MULTIPLIER + 0.5))); - - } - return fBaseFontSize; -} - -float Style_GetBaseFontSize(HWND hwnd) -{ - return Style_SetBaseFontSize(hwnd, -1.0); -} - - - -//============================================================================= -// -// Style_SetCurrentFontSize(), Style_GetCurrentFontSize() -// -float Style_SetCurrentFontSize(HWND hwnd, float fSize) -{ - static float fCurrentFontSize = INITIAL_BASE_FONT_SIZE * 1.0; - - if (fSize >= 0.0) { - fCurrentFontSize = (float)(((int)(fSize * 100 + 0.5)) / 100.0); - //SendMessage(hwnd, SCI_STYLESETSIZE, STYLE_DEFAULT, (LPARAM)iCurrentFontSize); - SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, STYLE_DEFAULT, (LPARAM)((int)(fCurrentFontSize * SC_FONT_SIZE_MULTIPLIER + 0.5))); - - } - return fCurrentFontSize; -} - -float Style_GetCurrentFontSize(HWND hwnd) -{ - return Style_SetCurrentFontSize(hwnd, -1.0); -} - - - - -//============================================================================= -// -// Style_SetIndentGuides() -// -extern int flagSimpleIndentGuides; - -void Style_SetIndentGuides(HWND hwnd,bool bShow) -{ - int iIndentView = SC_IV_NONE; - if (bShow) { - if (!flagSimpleIndentGuides) { - switch (SendMessage(hwnd, SCI_GETLEXER, 0, 0)) { - case SCLEX_PYTHON: - case SCLEX_NIMROD: - iIndentView = SC_IV_LOOKFORWARD; - break; - default: - iIndentView = SC_IV_LOOKBOTH; - break; - } - } - else - iIndentView = SC_IV_REAL; - } - SendMessage(hwnd,SCI_SETINDENTATIONGUIDES,iIndentView,0); -} - - -//============================================================================= -// -// Style_GetFileOpenDlgFilter() -// -extern WCHAR tchFileDlgFilters[5*1024]; - -bool Style_GetOpenDlgFilterStr(LPWSTR lpszFilter,int cchFilter) -{ - if (StringCchLenW(tchFileDlgFilters,COUNTOF(tchFileDlgFilters)) == 0) - GetString(IDS_FILTER_ALL,lpszFilter,cchFilter); - else { - StringCchCopyN(lpszFilter,cchFilter,tchFileDlgFilters,cchFilter - 2); - StringCchCat(lpszFilter,cchFilter,L"||"); - } - PrepareFilterStr(lpszFilter); - return true; -} - - -//============================================================================= -// -// Style_StrGetFont() -// -bool Style_StrGetFont(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont) -{ - WCHAR tch[64] = { L'\0' }; - WCHAR *p = StrStrI(lpszStyle, L"font:"); - if (p) - { - StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"font:")); - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - - if (StringCchCompareIN(tch,COUNTOF(tch),L"Default",-1) == 0) - { - if (IsFontAvailable(L"Consolas")) - StringCchCopyN(lpszFont,cchFont,L"Consolas",cchFont); - else - StringCchCopyN(lpszFont,cchFont,L"Lucida Console",cchFont); - } - else - { - StringCchCopyN(lpszFont,cchFont,tch, COUNTOF(tch)); - } - return true; - } - return false; -} - - -//============================================================================= -// -// Style_StrGetFontQuality() -// -bool Style_StrGetFontQuality(LPCWSTR lpszStyle,LPWSTR lpszQuality,int cchQuality) -{ - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - WCHAR *p = StrStrI(lpszStyle, L"smoothing:"); - if (p) - { - StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"smoothing:")); - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - if (StringCchCompareIN(tch,COUNTOF(tch),L"none",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"standard",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"cleartype",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"default",-1) == 0) - { - StringCchCopyN(lpszQuality,cchQuality,tch,COUNTOF(tch)); - return true; - } - } - return false; -} - - -//============================================================================= -// -// Style_StrGetCharSet() -// -bool Style_StrGetCharSet(LPCWSTR lpszStyle, int* i) -{ - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - WCHAR *p = StrStrI(lpszStyle, L"charset:"); - if (p) - { - StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"charset:")); - p = StrChr(tch, L';'); - if (p) { *p = L'\0'; } - TrimString(tch); - int iValue = 0; - if (1 == swscanf_s(tch, L"%i", &iValue)) - { - *i = max(SC_CHARSET_ANSI, iValue); - return true; - } - } - return false; -} - - -//============================================================================= -// -// Style_StrGetSize() -// -bool Style_StrGetSize(LPCWSTR lpszStyle, float* f) -{ - WCHAR *p = StrStrI(lpszStyle, L"size:"); - if (p) - { - float fSign = 0.0; - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"size:")); - if (tch[0] == L'+') - { - fSign = 1.0; - tch[0] = L' '; - } - else if (tch[0] == L'-') - { - fSign = -1.0; - tch[0] = L' '; - } - p = StrChr(tch, L';'); - if (p) { *p = L'\0'; } - TrimString(tch); - float fValue = 0; - const int itok = swscanf_s(tch,L"%f",&fValue); - if (itok == 1) - { - if (fSign == 0.0) - *f = fValue; - else { - // relative size calculation - const float base = *f; // base is input - *f = (base + (fSign * fValue)); // can be negative - } - return true; - } - } - return false; -} - - -//============================================================================= -// -// Style_StrGetSizeStr() -// -bool Style_StrGetSizeStr(LPCWSTR lpszStyle,LPWSTR lpszSize,int cchSize) -{ - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - WCHAR *p = StrStrI(lpszStyle, L"size:"); - if (p) - { - StringCchCopy(tch,COUNTOF(tch),(p + CSTRLEN(L"size:"))); - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - StringCchCopyN(lpszSize,cchSize,tch,COUNTOF(tch)); - return true; - } - return false; -} - - -//============================================================================= -// -// Style_StrGetWeightValue() -// -bool Style_StrGetWeightValue(LPCWSTR lpszWeight, int* i) -{ - int iFontWeight = -1; - - if (StrStrI(lpszWeight, L"thin")) - iFontWeight = FW_THIN; - else if (StrStrI(lpszWeight, L"extralight")) - iFontWeight = FW_EXTRALIGHT; - else if (StrStrI(lpszWeight, L"light")) - iFontWeight = FW_LIGHT; - else if (StrStrI(lpszWeight, L"normal")) - iFontWeight = FW_NORMAL; - else if (StrStrI(lpszWeight, L"medium")) - iFontWeight = FW_MEDIUM; - else if (StrStrI(lpszWeight, L"semibold")) - iFontWeight = FW_SEMIBOLD; - else if (StrStrI(lpszWeight, L"extrabold")) - iFontWeight = FW_EXTRABOLD; - else if (StrStrI(lpszWeight, L"bold")) // here, cause bold is in semibold and extrabold too - iFontWeight = FW_BOLD; - else if (StrStrI(lpszWeight, L"heavy")) - iFontWeight = FW_HEAVY; - - if (iFontWeight >= 0) { - *i = iFontWeight; - } - return ((iFontWeight < 0) ? false : true); -} - -//============================================================================= -// -// Style_AppendWeightStr() -// -void Style_AppendWeightStr(LPWSTR lpszWeight, int cchSize, int fontWeight) -{ - if (fontWeight <= FW_THIN) { - StringCchCat(lpszWeight, cchSize, L"; thin"); - } - else if (fontWeight <= FW_EXTRALIGHT) { - StringCchCat(lpszWeight, cchSize, L"; extralight"); - } - else if (fontWeight <= FW_LIGHT) { - StringCchCat(lpszWeight, cchSize, L"; light"); - } - else if (fontWeight <= FW_NORMAL) { - StringCchCat(lpszWeight, cchSize, L"; normal"); - } - else if (fontWeight <= FW_MEDIUM) { - StringCchCat(lpszWeight, cchSize, L"; medium"); - } - else if (fontWeight <= FW_SEMIBOLD) { - StringCchCat(lpszWeight, cchSize, L"; semibold"); - } - else if (fontWeight <= FW_BOLD) { - StringCchCat(lpszWeight, cchSize, L"; bold"); - } - else if (fontWeight <= FW_EXTRABOLD) { - StringCchCat(lpszWeight, cchSize, L"; extrabold"); - } - else { // (fontWeight >= FW_HEAVY) - StringCchCat(lpszWeight, cchSize, L"; heavy"); - } -} - - -//============================================================================= -// -// Style_StrGetColor() -// -bool Style_StrGetColor(bool bFore, LPCWSTR lpszStyle, COLORREF* rgb) -{ - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - WCHAR *pItem = (bFore) ? L"fore:" : L"back:"; - - WCHAR *p = StrStrI(lpszStyle, pItem); - if (p) - { - StringCchCopy(tch, COUNTOF(tch), p + lstrlen(pItem)); - if (tch[0] == L'#') - tch[0] = L' '; - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - int iValue = 0; - int itok = swscanf_s(tch, L"%x", &iValue); - if (itok == 1) - { - *rgb = RGB((iValue & 0xFF0000) >> 16, (iValue & 0xFF00) >> 8, iValue & 0xFF); - return true; - } - } - return false; -} - - -//============================================================================= -// -// Style_StrGetAlpha() -// -bool Style_StrGetAlpha(LPCWSTR lpszStyle, int* i, bool bAlpha1st) -{ - const WCHAR* strAlpha = bAlpha1st ? L"alpha:" : L"alpha2:"; - - WCHAR* p = StrStrI(lpszStyle, strAlpha); - if (p) { - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - StringCchCopy(tch, COUNTOF(tch), p + lstrlen(strAlpha)); - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - int iValue = 0; - int itok = swscanf_s(tch, L"%i", &iValue); - if (itok == 1) { - *i = min(max(SC_ALPHA_TRANSPARENT, iValue), SC_ALPHA_OPAQUE); - return true; - } - } - return false; -} - - -////============================================================================= -//// -//// Style_StrGetPropertyValue() -//// -//bool Style_StrGetPropertyValue(LPCWSTR lpszStyle, LPCWSTR lpszProperty, int* val) -//{ -// WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; -// WCHAR *p = StrStrI(lpszStyle, lpszProperty); -// if (p) { -// StringCchCopy(tch, COUNTOF(tch), (p + lstrlen(lpszProperty))); -// p = StrChr(tch, L';'); -// if (p) -// *p = L'\0'; -// TrimString(tch); -// if (1 == swscanf_s(tch, L"%i", val)) { return true; } -// } -// return false; -//} - - -//============================================================================= -// -// Style_StrGetCase() -// -bool Style_StrGetCase(LPCWSTR lpszStyle, int* i) -{ - WCHAR *p = StrStrI(lpszStyle, L"case:"); - if (p) { - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"case:")); - p = StrChr(tch, L';'); - if (p) - *p = L'\0'; - TrimString(tch); - if (tch[0] == L'u' || tch[0] == L'U') { - *i = SC_CASE_UPPER; - return true; - } - else if (tch[0] == L'l' || tch[0] == L'L') { - *i = SC_CASE_LOWER; - return true; - } - } - return false; -} - - -//============================================================================= -// -// Style_GetIndicatorType() -// - -static WCHAR* IndicatorTypes[20] = { - L"indic_plain", - L"indic_squiggle", - L"indic_tt", - L"indic_diagonal", - L"indic_strike", - L"indic_hidden", - L"indic_box", - L"indic_roundbox", - L"indic_straightbox", - L"indic_dash", - L"indic_dots", - L"indic_squigglelow", - L"indic_dotbox", - L"indic_squigglepixmap", - L"indic_compositionthick", - L"indic_compositionthin", - L"indic_fullbox", - L"indic_textfore", - L"indic_point", - L"indic_pointcharacter" -}; - -bool Style_GetIndicatorType(LPWSTR lpszStyle, int cchSize, int* idx) -{ - if (*idx < 0) { // retrieve indicator style from string - for (int i = 0; i < COUNTOF(IndicatorTypes); i++) { - if (StrStrI(lpszStyle, IndicatorTypes[i])) { - *idx = i; - return true; - } - } - *idx = INDIC_ROUNDBOX; // default - } - else { // get indicator string from index - - if (*idx < COUNTOF(IndicatorTypes)) - { - StringCchCopy(lpszStyle, cchSize, IndicatorTypes[*idx]); - return true; - } - StringCchCopy(lpszStyle, cchSize, IndicatorTypes[INDIC_ROUNDBOX]); // default - } - return false; -} - - -//============================================================================= -// -// Style_CopyStyles_IfNotDefined() -// -void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, int cchSizeDest, bool bCopyFont, bool bWithEffects) -{ - WCHAR szTmpStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - int iValue; - COLORREF dColor; - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - // --------- Font settings --------- - if (bCopyFont) - { - if (!StrStrI(lpszStyleDest, L"font:")) { - if (Style_StrGetFont(lpszStyleSrc, tch, COUNTOF(tch))) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; font:"); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - // --------- Size --------- - if (!StrStrI(lpszStyleDest, L"size:")) { - if (Style_StrGetSizeStr(lpszStyleSrc, tch, COUNTOF(tch))) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; size:"); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - if (StrStrI(lpszStyleSrc, L"thin") && !StrStrI(lpszStyleDest, L"thin")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; thin"); - else if (StrStrI(lpszStyleSrc, L"extralight") && !StrStrI(lpszStyleDest, L"extralight")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extralight"); - else if (StrStrI(lpszStyleSrc, L"light") && !StrStrI(lpszStyleDest, L"light")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; light"); - else if (StrStrI(lpszStyleSrc, L"normal") && !StrStrI(lpszStyleDest, L"normal")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal"); - else if (StrStrI(lpszStyleSrc, L"medium") && !StrStrI(lpszStyleDest, L"medium")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; medium"); - else if (StrStrI(lpszStyleSrc, L"semibold") && !StrStrI(lpszStyleDest, L"semibold")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; semibold"); - else if (StrStrI(lpszStyleSrc, L"extrabold") && !StrStrI(lpszStyleDest, L"extrabold")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extrabold"); - else if (StrStrI(lpszStyleSrc, L"bold") && !StrStrI(lpszStyleDest, L"bold")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; bold"); - else if (StrStrI(lpszStyleSrc, L"heavy") && !StrStrI(lpszStyleDest, L"heavy")) - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; heavy"); - //else - // StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal"); - - if (StrStrI(lpszStyleSrc, L"italic") && !StrStrI(lpszStyleDest, L"italic")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; italic"); - } - - if (!StrStrI(lpszStyleDest, L"charset:")) { - if (Style_StrGetCharSet(lpszStyleSrc, &iValue)) { - StringCchPrintf(tch, COUNTOF(tch), L"; charset:%i", iValue); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - } - - // --------- Effects --------- - if (bWithEffects) - { - if (StrStrI(lpszStyleSrc, L"strikeout") && !StrStrI(lpszStyleDest, L"strikeout")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; strikeout"); - } - - if (StrStrI(lpszStyleSrc, L"underline") && !StrStrI(lpszStyleDest, L"underline")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; underline"); - } - - if (!StrStrI(lpszStyleDest, L"fore:")) { // foreground - if (Style_StrGetColor(true, lpszStyleSrc, &dColor)) { - StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X", - (int)GetRValue(dColor), (int)GetGValue(dColor), (int)GetBValue(dColor)); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - if (!StrStrI(lpszStyleDest, L"back:")) { // background - if (Style_StrGetColor(false, lpszStyleSrc, &dColor)) { - StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X", - (int)GetRValue(dColor), (int)GetGValue(dColor), (int)GetBValue(dColor)); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - } - - // --------- Special Styles --------- - - if (StrStrI(lpszStyleSrc, L"eolfilled") && !StrStrI(lpszStyleDest, L"eolfilled")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; eolfilled"); - } - - if (!StrStrI(lpszStyleDest, L"smoothing:")) { - if (Style_StrGetFontQuality(lpszStyleSrc, tch, COUNTOF(tch))) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; smoothing:"); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - if (Style_StrGetCase(lpszStyleSrc, &iValue) && !StrStrI(lpszStyleDest, L"case:")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; case:"); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), (iValue == SC_CASE_UPPER) ? L"u" : L""); - } - - if (!StrStrI(lpszStyleDest, L"alpha:")) { - if (Style_StrGetAlpha(lpszStyleSrc, &iValue, true)) { - StringCchPrintf(tch, COUNTOF(tch), L"; alpha:%i", iValue); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - if (!StrStrI(lpszStyleDest, L"alpha2:")) { - if (Style_StrGetAlpha(lpszStyleSrc, &iValue, false)) { - StringCchPrintf(tch, COUNTOF(tch), L"; alpha2:%i", iValue); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - //const WCHAR* wchProperty = L"property:"; - //if (!StrStrI(lpszStyleDest, wchProperty)) { - // if (Style_StrGetPropertyValue(lpszStyleSrc, wchProperty, &iValue)) { - // StringCchPrintf(tch, COUNTOF(tch), L"; %s%i", wchProperty, iValue); - // StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - // } - //} - - // -------- indicator type -------- - if (!StrStrI(lpszStyleDest, L"indic_")) { - iValue = -1; - if (Style_GetIndicatorType(lpszStyleSrc, 0, &iValue)) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; "); - Style_GetIndicatorType(tch, COUNTOF(tch), &iValue); - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); - } - } - - // -------- other style settings -------- - if (StrStrI(lpszStyleSrc, L"block") && !StrStrI(lpszStyleDest, L"block")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; block"); - } - - if (StrStrI(lpszStyleSrc, L"noblink") && !StrStrI(lpszStyleDest, L"noblink")) { - StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; noblink"); - } - - StrTrim(szTmpStyle, L" ;"); - StringCchCat(lpszStyleDest, cchSizeDest, szTmpStyle); -} - - -/// Callback to set the font dialog's title -static WCHAR FontSelTitle[128]; - -static UINT CALLBACK Style_FontDialogHook( - HWND hdlg, // handle to the dialog box window - UINT uiMsg, // message identifier - WPARAM wParam, // message parameter - LPARAM lParam // message parameter -) -{ - if (uiMsg == WM_INITDIALOG) { - SetWindowText(hdlg, (WCHAR*)((CHOOSEFONT*)lParam)->lCustData); - } - UNUSED(wParam); - return 0; // Allow the default handler a chance to process -} - -//============================================================================= -// -// Style_SelectFont() -// -bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerName, LPCWSTR sStyleName, - bool bGlobalDefaultStyle, bool bCurrentDefaultStyle, - bool bWithEffects, bool bPreserveStyles) -{ - // Map lpszStyle to LOGFONT - WCHAR wchFontName[64] = { L'\0' }; - if (!Style_StrGetFont(lpszStyle, wchFontName, COUNTOF(wchFontName))) - { - if (!Style_StrGetFont(GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue, wchFontName, COUNTOF(wchFontName))) - { - Style_StrGetFont(L"font:Default", wchFontName, COUNTOF(wchFontName)); - } - } - - int iCharSet = g_iDefaultCharSet; - if (!Style_StrGetCharSet(lpszStyle, &iCharSet)) { - iCharSet = g_iDefaultCharSet; - } - - // is "size:" definition relative ? - bool bRelFontSize = (!StrStrI(lpszStyle, L"size:") || StrStrI(lpszStyle, L"size:+") || StrStrI(lpszStyle, L"size:-")); - - const float fBaseFontSize = (float)(bGlobalDefaultStyle ? (INITIAL_BASE_FONT_SIZE * 1.0) : - (bCurrentDefaultStyle ? Style_GetBaseFontSize(hwnd) : Style_GetCurrentFontSize(hwnd))); - - // Font Height - int iFontHeight = 0; - float fFontSize = fBaseFontSize; - if (Style_StrGetSize(lpszStyle,&fFontSize) > 0.0) { - HDC hdc = GetDC(hwnd); - iFontHeight = -MulDiv((int)(fFontSize * 100.0 + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 7200); - ReleaseDC(hwnd,hdc); - } - else { - HDC hdc = GetDC(hwnd); - iFontHeight = -MulDiv((int)(fBaseFontSize * 100.0 + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 7200); - ReleaseDC(hwnd, hdc); - } - - // Font Weight - int iFontWeight = FW_NORMAL; - if (!Style_StrGetWeightValue(lpszStyle, &iFontWeight)) { - iFontWeight = FW_NORMAL; - } - bool bIsItalic = (StrStrI(lpszStyle, L"italic")) ? true : false; - bool bIsUnderline = (StrStrI(lpszStyle, L"underline")) ? true : false; - bool bIsStrikeout = (StrStrI(lpszStyle, L"strikeout")) ? true : false; - - // -------------------------------------------------------------------------- - - LOGFONT lf; - ZeroMemory(&lf, sizeof(LOGFONT)); - StringCchCopyN(lf.lfFaceName, COUNTOF(lf.lfFaceName), wchFontName, COUNTOF(wchFontName)); - lf.lfCharSet = (BYTE)iCharSet; - lf.lfHeight = iFontHeight; - lf.lfWeight = iFontWeight; - lf.lfItalic = (BYTE)bIsItalic; - lf.lfUnderline = (BYTE)bIsUnderline; - lf.lfStrikeOut = (BYTE)bIsStrikeout; - - - COLORREF color = 0L; - Style_StrGetColor(true, lpszStyle, &color); - - // Init cf - CHOOSEFONT cf; - ZeroMemory(&cf, sizeof(CHOOSEFONT)); - cf.lStructSize = sizeof(CHOOSEFONT); - cf.hwndOwner = hwnd; - cf.rgbColors = color; - cf.lpLogFont = &lf; - cf.lpfnHook = (LPCFHOOKPROC)Style_FontDialogHook; // Register the callback - cf.lCustData = (LPARAM)FontSelTitle; - //cf.Flags = CF_INITTOLOGFONTSTRUCT /*| CF_EFFECTS | CF_NOSCRIPTSEL*/ | CF_SCREENFONTS | CF_FORCEFONTEXIST | CF_ENABLEHOOK; - cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_BOTH | CF_WYSIWYG | CF_FORCEFONTEXIST | CF_ENABLEHOOK; - - if (bGlobalDefaultStyle) { - if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ BASE (%s) +++", sStyleName); - else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" BASE (%s)", sStyleName); - } - else if (bCurrentDefaultStyle) { - if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ %s: %s Style +++", sLexerName, sStyleName); - else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" %s: %s Style", sLexerName, sStyleName); - } - else { - if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ Style '%s' (%s) +++", sStyleName, sLexerName); - else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" Style '%s' (%s)", sStyleName, sLexerName); - } - - if (bWithEffects) - cf.Flags |= CF_EFFECTS; - - if (HIBYTE(GetKeyState(VK_SHIFT))) - cf.Flags |= CF_FIXEDPITCHONLY; - - - // --- open systems Font Selection dialog --- - - if (!ChooseFont(&cf) || (lf.lfFaceName[0] == L'\0')) { return false; } - - // --- map back to lpszStyle --- - - WCHAR szNewStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - if (StrStrI(lpszStyle, L"font:")) { - StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L"font:"); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), lf.lfFaceName); - } - else { // no font in source specified, - if (lstrcmpW(lf.lfFaceName, wchFontName) != 0) { - StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L"font:"); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), lf.lfFaceName); - } - } - - if (lf.lfWeight == iFontWeight) { - WCHAR check[64] = { L'\0' }; - Style_AppendWeightStr(check, COUNTOF(check), lf.lfWeight); - StrTrimW(check, L" ;"); - if (StrStrI(lpszStyle, check)) { - Style_AppendWeightStr(szNewStyle, COUNTOF(szNewStyle), lf.lfWeight); - } - } - else { - Style_AppendWeightStr(szNewStyle, COUNTOF(szNewStyle), lf.lfWeight); - } - - - float fNewFontSize = (float)(cf.iPointSize / 10.0); - WCHAR newSize[64] = { L'\0' }; - - if (bRelFontSize) - { - float fNewRelSize = fNewFontSize - fBaseFontSize; - - if (fNewRelSize >= 0.0) { - if (HasFractionCent(fNewRelSize)) - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:+%.2f", fNewRelSize); - else - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:+%i", (int)fNewRelSize); - } - else { - if (HasFractionCent(fNewRelSize)) - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:-%.2f", (0.0 - fNewRelSize)); - else - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:-%i", (int)(0.0 - fNewRelSize)); - } - } - else { - fFontSize = (float)(((int)(fFontSize * 100.0 + 0.5)) / 100.0); - fNewFontSize = (float)(((int)(fNewFontSize * 100.0 + 0.5)) / 100.0); - if (fNewFontSize == fFontSize) { - if (StrStrI(lpszStyle, L"size:")) { - if (HasFractionCent(fNewFontSize)) - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%.2f", fNewFontSize); - else - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%i", (int)fNewFontSize); - } - } - else { - if (HasFractionCent(fNewFontSize)) - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%.2f", fNewFontSize); - else - StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%i", (int)fNewFontSize); - } - } - StringCchCat(szNewStyle, COUNTOF(szNewStyle), newSize); - - - WCHAR chset[32] = { L'\0' }; - if (bGlobalDefaultStyle && - (lf.lfCharSet != DEFAULT_CHARSET) && - (lf.lfCharSet != ANSI_CHARSET) && - (lf.lfCharSet != g_iDefaultCharSet)) { - if (lf.lfCharSet == iCharSet) { - if (StrStrI(lpszStyle, L"charset:")) - { - StringCchPrintf(chset, COUNTOF(chset), L"; charset:%i", lf.lfCharSet); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), chset); - } - } - else { - StringCchPrintf(chset, COUNTOF(chset), L"; charset:%i", lf.lfCharSet); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), chset); - } - } - - if (lf.lfItalic) { - if (bIsItalic) { - if (StrStrI(lpszStyle, L"italic")) { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; italic"); - } - } - else { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; italic"); - } - } - - - if (bWithEffects) { - - if (lf.lfUnderline) { - if (bIsUnderline) { - if (StrStrI(lpszStyle, L"underline")) { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; underline"); - } - } - else { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; underline"); - } - } - - if (lf.lfStrikeOut) { - if (bIsStrikeout) { - if (StrStrI(lpszStyle, L"strikeout")) { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; strikeout"); - } - } - else { - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; strikeout"); - } - } - - // --- save colors --- - WCHAR newColor[64] = { L'\0' }; - if (cf.rgbColors == color) { - if (StrStrI(lpszStyle, L"fore:")) { - StringCchPrintf(newColor, COUNTOF(newColor), L"; fore:#%02X%02X%02X", - (int)GetRValue(cf.rgbColors), - (int)GetGValue(cf.rgbColors), - (int)GetBValue(cf.rgbColors)); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); - } - } - else { // color changed - StringCchPrintf(newColor, COUNTOF(newColor), L"; fore:#%02X%02X%02X", - (int)GetRValue(cf.rgbColors), - (int)GetGValue(cf.rgbColors), - (int)GetBValue(cf.rgbColors)); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); - } - // copy background - if (Style_StrGetColor(false, lpszStyle, &color)) { - StringCchPrintf(newColor, COUNTOF(newColor), L"; back:#%02X%02X%02X", - (int)GetRValue(color), - (int)GetGValue(color), - (int)GetBValue(color)); - StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); - } - } - - if (bPreserveStyles) { - // copy all other styles - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; "); - Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), false, !bWithEffects); - } - - StrTrim(szNewStyle, L" ;"); - StringCchCopyN(lpszStyle, cchStyle, szNewStyle, COUNTOF(szNewStyle)); - return true; -} - - -//============================================================================= -// -// Style_SelectColor() -// -bool Style_SelectColor(HWND hwnd,bool bForeGround,LPWSTR lpszStyle,int cchStyle, bool bPreserveStyles) -{ - CHOOSECOLOR cc; - WCHAR szNewStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; - COLORREF dRGBResult; - COLORREF dColor; - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - ZeroMemory(&cc,sizeof(CHOOSECOLOR)); - - dRGBResult = (bForeGround) ? GetSysColor(COLOR_WINDOWTEXT) : GetSysColor(COLOR_WINDOW); - Style_StrGetColor(bForeGround,lpszStyle,&dRGBResult); - - cc.lStructSize = sizeof(CHOOSECOLOR); - cc.hwndOwner = hwnd; - cc.rgbResult = dRGBResult; - cc.lpCustColors = g_colorCustom; - cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR; - - if (!ChooseColor(&cc)) - return false; - - dRGBResult = cc.rgbResult; - - - // Rebuild style string - StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L""); // clear - - if (bForeGround) - { - StringCchPrintf(tch,COUNTOF(tch),L"; fore:#%02X%02X%02X", - (int)GetRValue(dRGBResult), - (int)GetGValue(dRGBResult), - (int)GetBValue(dRGBResult)); - StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); - - if (Style_StrGetColor(false,lpszStyle,&dColor)) - { - StringCchPrintf(tch,COUNTOF(tch),L"; back:#%02X%02X%02X", - (int)GetRValue(dColor), - (int)GetGValue(dColor), - (int)GetBValue(dColor)); - StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); - } - } - else // set background - { - if (Style_StrGetColor(true,lpszStyle,&dColor)) - { - StringCchPrintf(tch,COUNTOF(tch),L"; fore:#%02X%02X%02X; ", - (int)GetRValue(dColor), - (int)GetGValue(dColor), - (int)GetBValue(dColor)); - StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); - } - StringCchPrintf(tch,COUNTOF(tch),L"; back:#%02X%02X%02X", - (int)GetRValue(dRGBResult), - (int)GetGValue(dRGBResult), - (int)GetBValue(dRGBResult)); - StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); - } - - if (bPreserveStyles) { - // copy all other styles - StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; "); - Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), true, false); - } - - StrTrim(szNewStyle, L" ;"); - StringCchCopyN(lpszStyle,cchStyle,szNewStyle,cchStyle); - return true; -} - - -//============================================================================= -// -// Style_SetStyles() -// -void Style_SetStyles(HWND hwnd, int iStyle, LPCWSTR lpszStyle) -{ - WCHAR tch[64] = { L'\0' }; - - if (lstrlen(lpszStyle) == 0) { return; } - - // reset horizontal scrollbar width - SendMessage(hwnd, SCI_SETSCROLLWIDTH, 1, 0); - - // Font - if (Style_StrGetFont(lpszStyle, tch, COUNTOF(tch))) { - if (lstrlen(tch) > 0) { - char chFont[64] = { '\0' }; - WideCharToMultiByteStrg(Encoding_SciCP, tch, chFont); - SendMessage(hwnd, SCI_STYLESETFONT, iStyle, (LPARAM)chFont); - } - } - - // Size values are relative to fBaseFontSize - float fValue = IsLexerStandard(g_pLexCurrent) ? Style_GetBaseFontSize(hwnd) : Style_GetCurrentFontSize(hwnd); - - if (Style_StrGetSize(lpszStyle, &fValue) > 0.0) { - //SendMessage(hwnd, SCI_STYLESETSIZE, iStyle, (LPARAM)iValue); - SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, iStyle, (LPARAM)((int)(fValue * SC_FONT_SIZE_MULTIPLIER + 0.5))); - } - - int iValue = 0; - COLORREF dColor = 0L; - // Fore - if (Style_StrGetColor(true,lpszStyle,&dColor)) - SendMessage(hwnd,SCI_STYLESETFORE,iStyle,(LPARAM)dColor); - - // Back - if (Style_StrGetColor(false,lpszStyle,&dColor)) - SendMessage(hwnd,SCI_STYLESETBACK,iStyle,(LPARAM)dColor); - - // Weight - if (Style_StrGetWeightValue(lpszStyle,&iValue)) - SendMessage(hwnd, SCI_STYLESETWEIGHT, iStyle, (LPARAM)iValue); - - // Italic - if (StrStrI(lpszStyle, L"italic")) - SendMessage(hwnd,SCI_STYLESETITALIC,iStyle,(LPARAM)true); - - // Underline - if (StrStrI(lpszStyle, L"underline")) - SendMessage(hwnd,SCI_STYLESETUNDERLINE,iStyle,(LPARAM)true); - - // StrikeOut does not exist in scintilla ??? / Hide instead (no good idea) - //if (StrStrI(lpszStyle, L"strikeout")) - // SendMessage(hwnd, SCI_STYLESETVISIBLE,iStyle,(LPARAM)false); - - // EOL Filled - if (StrStrI(lpszStyle, L"eolfilled")) - SendMessage(hwnd,SCI_STYLESETEOLFILLED,iStyle,(LPARAM)true); - - // Case - if (Style_StrGetCase(lpszStyle, &iValue)) - SendMessage(hwnd,SCI_STYLESETCASE,iStyle,(LPARAM)iValue); - - // Character Set - if (Style_StrGetCharSet(lpszStyle, &iValue)) - SendMessage(hwnd,SCI_STYLESETCHARACTERSET,iStyle,(LPARAM)iValue); - -} - - -//============================================================================= -// -// Style_SetFontQuality() -// -void Style_SetFontQuality(HWND hwnd,LPCWSTR lpszStyle) { - - WPARAM wQuality = (WPARAM)FontQuality[iSciFontQuality]; - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - - if (Style_StrGetFontQuality(lpszStyle,tch,COUNTOF(tch))) { - if (StringCchCompareIN(tch,COUNTOF(tch),L"default",-1) == 0) - wQuality = SC_EFF_QUALITY_DEFAULT; - else if (StringCchCompareIN(tch,COUNTOF(tch),L"none",-1) == 0) - wQuality = SC_EFF_QUALITY_NON_ANTIALIASED; - else if (StringCchCompareIN(tch,COUNTOF(tch),L"standard",-1) == 0) - wQuality = SC_EFF_QUALITY_ANTIALIASED; - else if (StringCchCompareIN(tch,COUNTOF(tch),L"cleartype",-1) == 0) - wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; - } - else if (wQuality == SC_EFF_QUALITY_DEFAULT) { - // undefined, use general settings, except for special fonts - if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch))) { - if (StringCchCompareIN(tch,COUNTOF(tch),L"Calibri",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Cambria",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Candara",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Consolas",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Constantia",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Corbel",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Segoe UI",-1) == 0 || - StringCchCompareIN(tch,COUNTOF(tch),L"Source Code Pro",-1) == 0) - wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; - } - } - SendMessage(hwnd,SCI_SETFONTQUALITY,wQuality,0); -} - - -//============================================================================= -// -// Style_GetCurrentLexerName() -// -void Style_GetCurrentLexerName(LPWSTR lpszName, int cchName) -{ - if (IsLexerStandard(g_pLexCurrent)) { - StringCchPrintfW(lpszName, cchName, L" %s", GetCurrentStdLexer()->pszName); - } - else { - if (!GetString(g_pLexCurrent->rid, lpszName, cchName)) { - StringCchCopyW(lpszName, cchName, g_pLexCurrent->pszName); - } - } -} - - -//============================================================================= -// -// Style_GetLexerIconId() -// -int Style_GetLexerIconId(PEDITLEXER plex) -{ - WCHAR pszFile[MAX_PATH + BUFZIZE_STYLE_EXTENTIONS]; - - WCHAR *pszExtensions; - if (StringCchLenW(plex->szExtensions,COUNTOF(plex->szExtensions))) - pszExtensions = plex->szExtensions; - else - pszExtensions = plex->pszDefExt; - - StringCchCopy(pszFile,COUNTOF(pszFile),L"*."); - StringCchCat(pszFile,COUNTOF(pszFile),pszExtensions); - - WCHAR *p = StrChr(pszFile, L';'); - if (p) { *p = L'\0'; } - - // check for ; at beginning - if (StringCchLen(pszFile, COUNTOF(pszFile)) < 3) - StringCchCat(pszFile, COUNTOF(pszFile),L"txt"); - - SHFILEINFO shfi; - ZeroMemory(&shfi,sizeof(SHFILEINFO)); - - SHGetFileInfo(pszFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO), - SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES); - - return (shfi.iIcon); -} - - -//============================================================================= -// -// Style_AddLexerToTreeView() -// -HTREEITEM Style_AddLexerToTreeView(HWND hwnd,PEDITLEXER plex) -{ - WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; - - HTREEITEM hTreeNode; - - TVINSERTSTRUCT tvis; - ZeroMemory(&tvis,sizeof(TVINSERTSTRUCT)); - - tvis.hInsertAfter = TVI_LAST; - - tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - if (GetString(plex->rid,tch,COUNTOF(tch))) - tvis.item.pszText = tch; - else - tvis.item.pszText = plex->pszName; - - tvis.item.iImage = Style_GetLexerIconId(plex); - tvis.item.iSelectedImage = tvis.item.iImage; - tvis.item.lParam = (LPARAM)plex; - - hTreeNode = TreeView_InsertItem(hwnd,&tvis); - - tvis.hParent = hTreeNode; - - tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - //tvis.item.iImage = -1; - //tvis.item.iSelectedImage = -1; - - int i = 1; // default style is handled separately - while (plex->Styles[i].iStyle != -1) { - - if (GetString(plex->Styles[i].rid,tch,COUNTOF(tch))) - tvis.item.pszText = tch; - else - tvis.item.pszText = plex->Styles[i].pszName; - tvis.item.lParam = (LPARAM)(&plex->Styles[i]); - TreeView_InsertItem(hwnd,&tvis); - i++; - } - - return hTreeNode; -} - - -//============================================================================= -// -// Style_AddLexerToListView() -// -void Style_AddLexerToListView(HWND hwnd,PEDITLEXER plex) -{ - WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; - LVITEM lvi; - ZeroMemory(&lvi,sizeof(LVITEM)); - - lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; - lvi.iItem = ListView_GetItemCount(hwnd); - if (GetString(plex->rid,tch,COUNTOF(tch))) - lvi.pszText = tch; - else - lvi.pszText = plex->pszName; - lvi.iImage = Style_GetLexerIconId(plex); - lvi.lParam = (LPARAM)plex; - - ListView_InsertItem(hwnd,&lvi); -} - - -//============================================================================= -// -// Style_CustomizeSchemesDlgProc() -// -INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - - static HWND hwndTV; - static bool fDragging; - static PEDITLEXER pCurrentLexer; - static PEDITSTYLE pCurrentStyle; - static HFONT hFontTitle; - static HBRUSH hbrFore; - static HBRUSH hbrBack; - static bool bIsStyleSelected = false; - - static WCHAR* Style_StylesBackup[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER]; - - WCHAR tchBuf[128] = { L'\0' }; - - switch(umsg) - { - case WM_INITDIALOG: - { - // Backup Styles - ZeroMemory(&Style_StylesBackup, NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * sizeof(WCHAR*)); - int cnt = 0; - for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { - Style_StylesBackup[cnt++] = StrDup(g_pLexArray[iLexer]->szExtensions); - int i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - Style_StylesBackup[cnt++] = StrDup(g_pLexArray[iLexer]->Styles[i].szValue); - ++i; - } - } - - hwndTV = GetDlgItem(hwnd,IDC_STYLELIST); - fDragging = false; - - SHFILEINFO shfi; - ZeroMemory(&shfi, sizeof(SHFILEINFO)); - TreeView_SetImageList(hwndTV, - (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY,&shfi,sizeof(SHFILEINFO), - SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),TVSIL_NORMAL); - - // findlexer - int found = -1; - for (int i = 0; i < COUNTOF(g_pLexArray); ++i) { - //if (StringCchCompareX(g_pLexArray[i]->pszName, g_pLexCurrent->pszName) == 0) { - if (g_pLexArray[i] == g_pLexCurrent) { - found = i; - break; - } - } - - // Build lexer tree view - HTREEITEM hCurrentTVLex = NULL; - for (int i = 0; i < COUNTOF(g_pLexArray); i++) - { - if (i == found) - hCurrentTVLex = Style_AddLexerToTreeView(hwndTV,g_pLexArray[i]); - else - Style_AddLexerToTreeView(hwndTV,g_pLexArray[i]); - } - if (!hCurrentTVLex) - { - hCurrentTVLex = TreeView_GetRoot(hwndTV); - if (Style_GetUse2ndDefault()) - hCurrentTVLex = TreeView_GetNextSibling(hwndTV, hCurrentTVLex); - } - TreeView_Select(hwndTV, hCurrentTVLex, TVGN_CARET); - - pCurrentLexer = (found >= 0) ? g_pLexCurrent : GetDefaultLexer(); - pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); - - SendDlgItemMessage(hwnd,IDC_STYLEEDIT,EM_LIMITTEXT, max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)-1,0); - - MakeBitmapButton(hwnd,IDC_PREVSTYLE,g_hInstance,IDB_PREV); - MakeBitmapButton(hwnd,IDC_NEXTSTYLE,g_hInstance,IDB_NEXT); - - // Setup title font - if (hFontTitle) - DeleteObject(hFontTitle); - - if (NULL == (hFontTitle = (HFONT)SendDlgItemMessage(hwnd,IDC_TITLE,WM_GETFONT,0,0))) - hFontTitle = GetStockObject(DEFAULT_GUI_FONT); - - LOGFONT lf; - GetObject(hFontTitle,sizeof(LOGFONT),&lf); - lf.lfHeight += lf.lfHeight / 5; - lf.lfWeight = FW_BOLD; - hFontTitle = CreateFontIndirect(&lf); - SendDlgItemMessage(hwnd,IDC_TITLE,WM_SETFONT,(WPARAM)hFontTitle,true); - - if (xCustomSchemesDlg == 0 || yCustomSchemesDlg == 0) - CenterDlgInParent(hwnd); - else - SetDlgPos(hwnd, xCustomSchemesDlg, yCustomSchemesDlg); - - HMENU hmenu = GetSystemMenu(hwnd, false); - GetString(IDS_PREVIEW, tchBuf, COUNTOF(tchBuf)); - InsertMenu(hmenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_PREVIEW, tchBuf); - InsertMenu(hmenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - GetString(IDS_SAVEPOS, tchBuf, COUNTOF(tchBuf)); - InsertMenu(hmenu, 2, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_SAVEPOS, tchBuf); - GetString(IDS_RESETPOS, tchBuf, COUNTOF(tchBuf)); - InsertMenu(hmenu, 3, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_RESETPOS, tchBuf); - InsertMenu(hmenu, 4, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - } - return true; - - case WM_ACTIVATE: - DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == g_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); - break; - - case WM_DESTROY: - { - DeleteBitmapButton(hwnd, IDC_STYLEFORE); - DeleteBitmapButton(hwnd, IDC_STYLEBACK); - DeleteBitmapButton(hwnd, IDC_PREVSTYLE); - DeleteBitmapButton(hwnd, IDC_NEXTSTYLE); - // free old backup - int cnt = 0; - for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { - if (Style_StylesBackup[cnt]) { - LocalFree(Style_StylesBackup[cnt]); - Style_StylesBackup[cnt] = NULL; - } - ++cnt; - int i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - if (Style_StylesBackup[cnt]) { - LocalFree(Style_StylesBackup[cnt]); - Style_StylesBackup[cnt] = NULL; - } - ++cnt; - ++i; - } - } - pCurrentLexer = NULL; - pCurrentStyle = NULL; - } - return false; - - #define APPLY_DIALOG_ITEM_TEXT { \ - bool bChgNfy = false; \ - WCHAR szBuf[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)]; \ - GetDlgItemText(hwnd, IDC_STYLEEDIT, szBuf, COUNTOF(szBuf)); \ - if (StringCchCompareIXW(szBuf, pCurrentStyle->szValue) != 0) { \ - StringCchCopyW(pCurrentStyle->szValue, COUNTOF(pCurrentStyle->szValue), szBuf); \ - bChgNfy = true; \ - } \ - if (!bIsStyleSelected) { \ - if (!GetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, szBuf, COUNTOF(szBuf))) { \ - StringCchCopy(szBuf, COUNTOF(szBuf), pCurrentLexer->pszDefExt); \ - } \ - if (StringCchCompareIXW(szBuf, pCurrentLexer->szExtensions) != 0) { \ - StringCchCopyW(pCurrentLexer->szExtensions, COUNTOF(pCurrentLexer->szExtensions), szBuf); \ - bChgNfy = true; \ - } \ - } \ - if (bChgNfy && ( IsLexerStandard(pCurrentLexer) || (pCurrentLexer == g_pLexCurrent))) { \ - Style_SetLexer(g_hwndEdit, g_pLexCurrent); \ - } \ - } - - - case WM_SYSCOMMAND: - if (wParam == IDS_SAVEPOS) { - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_SAVEPOS, 0), 0); - return true; - } - else if (wParam == IDS_RESETPOS) { - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_RESETPOS, 0), 0); - return true; - } - else - return false; - - - case WM_NOTIFY: - - if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) - { - LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam; - - switch (lpnmtv->hdr.code) - { - - case TVN_SELCHANGED: - { - if (pCurrentLexer && pCurrentStyle) { - APPLY_DIALOG_ITEM_TEXT; - } - - WCHAR label[128] = { L'\0' }; - - //DialogEnableWindow(hwnd, IDC_STYLEEDIT, true); - //DialogEnableWindow(hwnd, IDC_STYLEFONT, true); - //DialogEnableWindow(hwnd, IDC_STYLEFORE, true); - //DialogEnableWindow(hwnd, IDC_STYLEBACK, true); - //DialogEnableWindow(hwnd, IDC_STYLEDEFAULT, true); - - // a lexer has been selected - if (!TreeView_GetParent(hwndTV,lpnmtv->itemNew.hItem)) - { - pCurrentLexer = (PEDITLEXER)lpnmtv->itemNew.lParam; - - if (pCurrentLexer) - { - bIsStyleSelected = false; - SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT, L"Associated filename extensions:"); - DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,true); - SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->szExtensions); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, true); - - if (IsLexerStandard(pCurrentLexer)) - { - pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); - - if (pCurrentStyle->rid == 63100) { - StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); - } - else { - StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); - } - } - else { - pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); - StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); - } - SetDlgItemText(hwnd, IDC_STYLELABEL, label); - SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); - } - else - { - SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT,L""); - DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,false); - SetDlgItemText(hwnd, IDC_STYLELABEL, L""); - DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); - } - DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == g_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); - } - // a style has been selected - else - { - if (IsLexerStandard(pCurrentLexer)) - { - if (pCurrentLexer->Styles[STY_DEFAULT].rid == 63100) - StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); - else - StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); - } - else { - StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); - } - SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label); - - SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->Styles[STY_DEFAULT].szValue); - DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); - - pCurrentStyle = (PEDITSTYLE)lpnmtv->itemNew.lParam; - - if (pCurrentStyle) - { - bIsStyleSelected = true; - StringCchPrintfW(label, COUNTOF(label), L"%s's style:", pCurrentStyle->pszName); - SetDlgItemText(hwnd, IDC_STYLELABEL, label); - SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); - } - else - { - SetDlgItemText(hwnd, IDC_STYLELABEL, L""); - DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); - } - } - } - break; - - case TVN_BEGINDRAG: - { - TreeView_Select(hwndTV,lpnmtv->itemNew.hItem,TVGN_CARET); - - if (bIsStyleSelected) - DestroyCursor(SetCursor(LoadCursor(g_hInstance,MAKEINTRESOURCE(IDC_COPY)))); - else - DestroyCursor(SetCursor(LoadCursor(NULL,IDC_NO))); - - SetCapture(hwnd); - fDragging = true; - } - - } - } - break; - - - case WM_MOUSEMOVE: - { - HTREEITEM htiTarget; - TVHITTESTINFO tvht; - - if (fDragging && bIsStyleSelected) - { - LONG xCur = LOWORD(lParam); - LONG yCur = HIWORD(lParam); - - //ImageList_DragMove(xCur,yCur); - //ImageList_DragShowNolock(false); - - tvht.pt.x = xCur; - tvht.pt.y = yCur; - - //ClientToScreen(hwnd,&tvht.pt); - //ScreenToClient(hwndTV,&tvht.pt); - MapWindowPoints(hwnd,hwndTV,&tvht.pt,1); - - if ((htiTarget = TreeView_HitTest(hwndTV,&tvht)) != NULL && - TreeView_GetParent(hwndTV,htiTarget) != NULL) - { - TreeView_SelectDropTarget(hwndTV,htiTarget); - //TreeView_Expand(hwndTV,htiTarget,TVE_EXPAND); - TreeView_EnsureVisible(hwndTV,htiTarget); - } - else - TreeView_SelectDropTarget(hwndTV,NULL); - - //ImageList_DragShowNolock(true); - } - } - break; - - - case WM_LBUTTONUP: - { - if (fDragging && bIsStyleSelected) - { - //ImageList_EndDrag(); - HTREEITEM htiTarget = TreeView_GetDropHilight(hwndTV); - if (htiTarget) - { - WCHAR tchCopy[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = { L'\0' }; - TreeView_SelectDropTarget(hwndTV,NULL); - GetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy,COUNTOF(tchCopy)); - TreeView_Select(hwndTV,htiTarget,TVGN_CARET); - - // after select, this is new current item - SetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy); - APPLY_DIALOG_ITEM_TEXT; - } - ReleaseCapture(); - DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW))); - fDragging = false; - } - } - break; - - - case WM_CANCELMODE: - { - if (fDragging) - { - //ImageList_EndDrag(); - TreeView_SelectDropTarget(hwndTV,NULL); - ReleaseCapture(); - DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW))); - fDragging = false; - } - } - break; - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_SETCURLEXERTV: - { - // find current lexer's tree entry - HTREEITEM hCurrentTVLex = TreeView_GetRoot(hwndTV); - for (int i = 0; i < COUNTOF(g_pLexArray); ++i) { - if (g_pLexArray[i] == g_pLexCurrent) { - break; - } - hCurrentTVLex = TreeView_GetNextSibling(hwndTV, hCurrentTVLex); // next - } - if (g_pLexCurrent == pCurrentLexer) - break; // no change - - // collaps current node - HTREEITEM hSel = TreeView_GetSelection(hwndTV); - if (hSel) { - HTREEITEM hPar = TreeView_GetParent(hwndTV, hSel); - TreeView_Expand(hwndTV, hSel, TVE_COLLAPSE); - if (hPar) - TreeView_Expand(hwndTV, hPar, TVE_COLLAPSE); - } - - // set new lexer - TreeView_Select(hwndTV, hCurrentTVLex, TVGN_CARET); - TreeView_Expand(hwndTV, hCurrentTVLex, TVE_EXPAND); - - pCurrentLexer = g_pLexCurrent; - pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); - - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - } - break; - - - case IDC_STYLEFORE: - if (pCurrentStyle) { - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); - if (Style_SelectColor(hwnd, true, tch, COUNTOF(tch), true)) { - SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); - } - } - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - break; - - - case IDC_STYLEBACK: - if (pCurrentStyle) { - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); - if (Style_SelectColor(hwnd, false, tch, COUNTOF(tch), true)) { - SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); - } - } - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - break; - - - case IDC_STYLEFONT: - if (pCurrentStyle) { - WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; - GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); - - if (Style_SelectFont(hwnd, tch, COUNTOF(tch), pCurrentLexer->pszName, pCurrentStyle->pszName, - IsStyleStandardDefault(pCurrentStyle), IsStyleSchemeDefault(pCurrentStyle), false, true)) { - SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); - } - } - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - break; - - - case IDC_STYLEDEFAULT: - SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->pszDefault); - if (!bIsStyleSelected) { - SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->pszDefExt); - } - APPLY_DIALOG_ITEM_TEXT; - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - break; - - - case IDC_STYLEEDIT: - { - if (HIWORD(wParam) == EN_CHANGE) { - WCHAR tch[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = { L'\0' }; - - GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); - - COLORREF cr = (COLORREF)-1; // SciCall_StyleGetFore(STYLE_DEFAULT); - Style_StrGetColor(true, tch, &cr); - MakeColorPickButton(hwnd, IDC_STYLEFORE, g_hInstance, cr); - - cr = (COLORREF)-1; // SciCall_StyleGetBack(STYLE_DEFAULT); - Style_StrGetColor(false, tch, &cr); - MakeColorPickButton(hwnd, IDC_STYLEBACK, g_hInstance, cr); - } - } - break; - - - case IDC_IMPORT: - { - hwndTV = GetDlgItem(hwnd, IDC_STYLELIST); - - if (Style_Import(hwnd)) { - SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); - if (!bIsStyleSelected) { - SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->szExtensions); - } - TreeView_Select(hwndTV, TreeView_GetRoot(hwndTV), TVGN_CARET); - Style_SetLexer(g_hwndEdit, g_pLexCurrent); - } - } - break; - - - case IDC_EXPORT: - { - APPLY_DIALOG_ITEM_TEXT; - Style_Export(hwnd); - } - break; - - - case IDC_PREVIEW: - { - APPLY_DIALOG_ITEM_TEXT; - } - break; - - - case IDC_PREVSTYLE: - { - APPLY_DIALOG_ITEM_TEXT; - HTREEITEM hSel = TreeView_GetSelection(hwndTV); - if (hSel) { - HTREEITEM hPrev = TreeView_GetPrevVisible(hwndTV, hSel); - if (hPrev) - TreeView_Select(hwndTV, hPrev, TVGN_CARET); - } - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - } - break; - - - case IDC_NEXTSTYLE: - { - APPLY_DIALOG_ITEM_TEXT; - HTREEITEM hSel = TreeView_GetSelection(hwndTV); - if (hSel) { - HTREEITEM hNext = TreeView_GetNextVisible(hwndTV, hSel); - if (hNext) - TreeView_Select(hwndTV, hNext, TVGN_CARET); - } - PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); - } - break; - - - case IDOK: - APPLY_DIALOG_ITEM_TEXT; - g_fStylesModified = true; - if (!g_fWarnedNoIniFile && (StringCchLenW(g_wchIniFile, COUNTOF(g_wchIniFile)) == 0)) { - MsgBox(MBWARN, IDS_SETTINGSNOTSAVED); - g_fWarnedNoIniFile = true; - } - //EndDialog(hwnd,IDOK); - DestroyWindow(hwnd); - break; - - - case IDCANCEL: - if (fDragging) { - SendMessage(hwnd, WM_CANCELMODE, 0, 0); - } - else { - APPLY_DIALOG_ITEM_TEXT; - // Restore Styles - int cnt = 0; - for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { - StringCchCopy(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), Style_StylesBackup[cnt]); - ++cnt; - int i = 0; - while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { - StringCchCopy(g_pLexArray[iLexer]->Styles[i].szValue, COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue), Style_StylesBackup[cnt]); - ++cnt; - ++i; - } - } - Style_SetLexer(g_hwndEdit, g_pLexCurrent); - //EndDialog(hwnd,IDCANCEL); - DestroyWindow(hwnd); - } - break; - - - case IDACC_VIEWSCHEMECONFIG: - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_SETCURLEXERTV, 1), 0); - break; - - case IDACC_PREVIEW: - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_PREVIEW, 1), 0); - break; - - case IDACC_SAVEPOS: - GetDlgPos(hwnd, &xCustomSchemesDlg, &yCustomSchemesDlg); - break; - - case IDACC_RESETPOS: - CenterDlgInParent(hwnd); - xCustomSchemesDlg = yCustomSchemesDlg = 0; - break; - - - default: - // return false??? - break; - - } // switch() - } // WM_COMMAND - return true; - } - return false; -} - - -//============================================================================= -// -// Style_CustomizeSchemesDlg() -// -HWND Style_CustomizeSchemesDlg(HWND hwnd) -{ - HWND hDlg = CreateThemedDialogParam(g_hInstance, - MAKEINTRESOURCE(IDD_STYLECONFIG), - GetParent(hwnd), - Style_CustomizeSchemesDlgProc, - (LPARAM)NULL); - ShowWindow(hDlg, SW_SHOW); - return hDlg; -} - - -//============================================================================= -// -// Style_SelectLexerDlgProc() -// -INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) -{ - - static int cxClient; - static int cyClient; - static int mmiPtMaxY; - static int mmiPtMinX; - - static HWND hwndLV; - static int iInternalDefault; - - switch(umsg) - { - case WM_INITDIALOG: - { - int lvItems; - LVITEM lvi; - SHFILEINFO shfi; - LVCOLUMN lvc = { LVCF_FMT|LVCF_TEXT, LVCFMT_LEFT, 0, L"", -1, 0, 0, 0 }; - - RECT rc; - WCHAR tch[MAX_PATH] = { L'\0' }; - int cGrip; - - GetClientRect(hwnd,&rc); - cxClient = rc.right - rc.left; - cyClient = rc.bottom - rc.top; - - AdjustWindowRectEx(&rc,GetWindowLong(hwnd,GWL_STYLE)|WS_THICKFRAME,false,0); - mmiPtMinX = rc.right-rc.left; - mmiPtMaxY = rc.bottom-rc.top; - - if (g_cxStyleSelectDlg < (rc.right-rc.left)) - g_cxStyleSelectDlg = rc.right-rc.left; - if (g_cyStyleSelectDlg < (rc.bottom-rc.top)) - g_cyStyleSelectDlg = rc.bottom-rc.top; - SetWindowPos(hwnd,NULL,rc.left,rc.top,g_cxStyleSelectDlg,g_cyStyleSelectDlg,SWP_NOZORDER); - - SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|WS_THICKFRAME); - SetWindowPos(hwnd,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); - - GetMenuString(GetSystemMenu(GetParent(hwnd),false),SC_SIZE,tch,COUNTOF(tch),MF_BYCOMMAND); - InsertMenu(GetSystemMenu(hwnd,false),SC_CLOSE,MF_BYCOMMAND|MF_STRING|MF_ENABLED,SC_SIZE,tch); - InsertMenu(GetSystemMenu(hwnd,false),SC_CLOSE,MF_BYCOMMAND|MF_SEPARATOR,0,NULL); - - SetWindowLongPtr(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE, - GetWindowLongPtr(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE)|SBS_SIZEGRIP|WS_CLIPSIBLINGS); - - cGrip = GetSystemMetrics(SM_CXHTHUMB); - SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,cxClient-cGrip, - cyClient-cGrip,cGrip,cGrip,SWP_NOZORDER); - - hwndLV = GetDlgItem(hwnd,IDC_STYLELIST); - - ListView_SetImageList(hwndLV, - (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY, - &shfi,sizeof(SHFILEINFO),SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES), - LVSIL_SMALL); - - ListView_SetImageList(hwndLV, - (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY, - &shfi,sizeof(SHFILEINFO),SHGFI_LARGEICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES), - LVSIL_NORMAL); - - //SetExplorerTheme(hwndLV); - ListView_SetExtendedListViewStyle(hwndLV,/*LVS_EX_FULLROWSELECT|*/LVS_EX_DOUBLEBUFFER|LVS_EX_LABELTIP); - ListView_InsertColumn(hwndLV,0,&lvc); - - // Add lexers - for (int i = 0; i < COUNTOF(g_pLexArray); i++) { - Style_AddLexerToListView(hwndLV, g_pLexArray[i]); - } - ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE_USEHEADER); - - // Select current lexer - lvItems = ListView_GetItemCount(hwndLV); - lvi.mask = LVIF_PARAM; - for (int i = 0; i < lvItems; i++) { - lvi.iItem = i; - ListView_GetItem(hwndLV,&lvi); - if (StringCchCompareX(((PEDITLEXER)lvi.lParam)->pszName, g_pLexCurrent->pszName) == 0) - { - ListView_SetItemState(hwndLV,i,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED); - ListView_EnsureVisible(hwndLV,i,false); - if (g_iDefaultLexer == i) { - CheckDlgButton(hwnd,IDC_DEFAULTSCHEME,BST_CHECKED); - } - break; - } - } - - iInternalDefault = g_iDefaultLexer; - - if (g_bAutoSelect) - CheckDlgButton(hwnd,IDC_AUTOSELECT,BST_CHECKED); - - CenterDlgInParent(hwnd); - } - return true; - - - case WM_DESTROY: - { - RECT rc; - GetWindowRect(hwnd,&rc); - g_cxStyleSelectDlg = rc.right-rc.left; - g_cyStyleSelectDlg = rc.bottom-rc.top; - } - return false; - - - case WM_SIZE: - { - RECT rc; - - int dxClient = LOWORD(lParam) - cxClient; - int dyClient = HIWORD(lParam) - cyClient; - cxClient = LOWORD(lParam); - cyClient = HIWORD(lParam); - - GetWindowRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); - InvalidateRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,true); - - GetWindowRect(GetDlgItem(hwnd,IDOK),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDOK),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); - InvalidateRect(GetDlgItem(hwnd,IDOK),NULL,true); - - GetWindowRect(GetDlgItem(hwnd,IDCANCEL),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDCANCEL),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); - InvalidateRect(GetDlgItem(hwnd,IDCANCEL),NULL,true); - - GetWindowRect(GetDlgItem(hwnd,IDC_STYLELIST),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDC_STYLELIST),NULL,0,0,rc.right-rc.left+dxClient,rc.bottom-rc.top+dyClient,SWP_NOZORDER|SWP_NOMOVE); - ListView_SetColumnWidth(GetDlgItem(hwnd,IDC_STYLELIST),0,LVSCW_AUTOSIZE_USEHEADER); - InvalidateRect(GetDlgItem(hwnd,IDC_STYLELIST),NULL,true); - - GetWindowRect(GetDlgItem(hwnd,IDC_AUTOSELECT),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); - InvalidateRect(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,true); - - GetWindowRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),&rc); - MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); - SetWindowPos(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); - InvalidateRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,true); - } - return true; - - - case WM_GETMINMAXINFO: - { - LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; - lpmmi->ptMinTrackSize.x = mmiPtMinX; - lpmmi->ptMinTrackSize.y = mmiPtMaxY; - //lpmmi->ptMaxTrackSize.y = mmiPtMaxY; - } - return true; - - - case WM_NOTIFY: - { - if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) { - - switch (((LPNMHDR)(lParam))->code) { - - case NM_DBLCLK: - SendMessage(hwnd, WM_COMMAND, MAKELONG(IDOK, 1), 0); - break; - - case LVN_ITEMCHANGED: - case LVN_DELETEITEM: - { - int i = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); - if (iInternalDefault == i) - CheckDlgButton(hwnd, IDC_DEFAULTSCHEME, BST_CHECKED); - else - CheckDlgButton(hwnd, IDC_DEFAULTSCHEME, BST_UNCHECKED); - DialogEnableWindow(hwnd, IDC_DEFAULTSCHEME, i != -1); - DialogEnableWindow(hwnd, IDOK, i != -1); - } - break; - } - } - } - return true; - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) { - case IDC_DEFAULTSCHEME: - if (IsDlgButtonChecked(hwnd, IDC_DEFAULTSCHEME) == BST_CHECKED) - iInternalDefault = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); - else - iInternalDefault = 0; - break; - - - case IDOK: - { - LVITEM lvi; - lvi.mask = LVIF_PARAM; - lvi.iItem = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); - if (ListView_GetItem(hwndLV, &lvi)) { - g_pLexCurrent = (PEDITLEXER)lvi.lParam; - g_iDefaultLexer = iInternalDefault; - g_bAutoSelect = (IsDlgButtonChecked(hwnd, IDC_AUTOSELECT) == BST_CHECKED) ? 1 : 0; - EndDialog(hwnd,IDOK); - } - } - break; - - - case IDCANCEL: - EndDialog(hwnd, IDCANCEL); - break; - - } // switch() - } // WM_COMMAND - return true; - } - return false; -} - - -//============================================================================= -// -// Style_SelectLexerDlg() -// -void Style_SelectLexerDlg(HWND hwnd) -{ - if (IDOK == ThemedDialogBoxParam(g_hInstance, - MAKEINTRESOURCE(IDD_STYLESELECT), - GetParent(hwnd), Style_SelectLexerDlgProc, 0)) - - Style_SetLexer(hwnd, g_pLexCurrent); -} - -// End of Styles.c +/****************************************************************************** +* * +* * +* Notepad3 * +* * +* Styles.c * +* Scintilla Style Management * +* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * +* Mostly taken from SciTE, (c) Neil Hodgson * +* * +* (c) Rizonesoft 2008-2016 * +* http://www.rizonesoft.com * +* * +* * +*******************************************************************************/ +#if !defined(WINVER) +#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(NTDDI_VERSION) +#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ +#endif +#define VC_EXTRALEAN 1 + +#include +#include +#include +#include +#include +#include + +#include "scintilla.h" +#include "scilexer.h" +#include "notepad3.h" +#include "edit.h" +#include "dialogs.h" +#include "resource.h" +#include "encoding.h" +#include "helpers.h" +#include "SciCall.h" + +#include "styles.h" + +extern HINSTANCE g_hInstance; + +extern HWND g_hwndMain; +extern HWND g_hwndDlgCustomizeSchemes; +extern EDITFINDREPLACE g_efrData; + +extern int iSciFontQuality; +extern const int FontQuality[4]; + +extern bool g_bCodeFoldingAvailable; +extern bool g_bShowCodeFolding; +extern bool g_bShowSelectionMargin; + +extern int g_iMarkOccurrences; +extern bool bUseOldStyleBraceMatching; + +extern int xCustomSchemesDlg; +extern int yCustomSchemesDlg; + + +#define MULTI_STYLE(a,b,c,d) ((a)|(b<<8)|(c<<16)|(d<<24)) + +#define INITIAL_BASE_FONT_SIZE (10) + +KEYWORDLIST KeyWords_NULL = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexStandard = { SCLEX_NULL, 63000, L"Default Text", L"txt; text; wtx; log; asc; doc", L"", &KeyWords_NULL, { + /* 0 */ { STYLE_DEFAULT, 63100, L"Default Style", L"font:Default; size:10", L"" }, + /* 1 */ { STYLE_LINENUMBER, 63101, L"Margins and Line Numbers", L"size:-2; fore:#FF0000", L"" }, + /* 2 */ { STYLE_BRACELIGHT, 63102, L"Matching Braces (Indicator)", L"fore:#00FF40; alpha:40; alpha2:40; indic_roundbox", L"" }, + /* 3 */ { STYLE_BRACEBAD, 63103, L"Matching Braces Error (Indicator)", L"fore:#FF0080; alpha:140; alpha2:140; indic_roundbox", L"" }, + /* 4 */ { STYLE_CONTROLCHAR, 63104, L"Control Characters (Font)", L"size:-1", L"" }, + /* 5 */ { STYLE_INDENTGUIDE, 63105, L"Indentation Guide (Color)", L"fore:#A0A0A0", L"" }, + /* 6 */ { SCI_SETSELFORE+SCI_SETSELBACK, 63106, L"Selected Text (Colors)", L"back:#0A246A; eolfilled; alpha:95", L"" }, + /* 7 */ { SCI_SETWHITESPACEFORE+SCI_SETWHITESPACEBACK+SCI_SETWHITESPACESIZE, 63107, L"Whitespace (Colors, Size 0-5)", L"fore:#FF4000", L"" }, + /* 8 */ { SCI_SETCARETLINEBACK, 63108, L"Current Line Background (Color)", L"back:#FFFF00; alpha:50", L"" }, + /* 9 */ { SCI_SETCARETFORE+SCI_SETCARETWIDTH, 63109, L"Caret (Color, Size 1-3)", L"", L"" }, + /* 10 */ { SCI_SETEDGECOLOUR, 63110, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" }, + /* 11 */ { SCI_SETEXTRAASCENT+SCI_SETEXTRADESCENT, 63111, L"Extra Line Spacing (Size)", L"size:2", L"" }, + /* 12 */ { SCI_FOLDALL+SCI_MARKERSETALPHA, 63124, L"Bookmarks and Folding (Colors)", L"fore:#000000; back:#808080; alpha:80", L"" }, + /* 13 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, 63262, L"Mark Occurrences (Indicator)", L"indic_roundbox", L"" }, + /* 14 */ { SCI_SETHOTSPOTACTIVEFORE, 63264, L"Hyperlink Hotspots", L"italic; fore:#0000FF", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +EDITLEXER lexStandard2nd = { SCLEX_NULL, 63266, L"2nd Default Text", L"txt; text; wtx; log; asc; doc", L"", &KeyWords_NULL,{ + /* 0 */ { STYLE_DEFAULT, 63112, L"2nd Default Style", L"font:Courier New; size:10", L"" }, + /* 1 */ { STYLE_LINENUMBER, 63113, L"2nd Margins and Line Numbers", L"font:Tahoma; size:-2; fore:#FF0000", L"" }, + /* 2 */ { STYLE_BRACELIGHT, 63114, L"2nd Matching Braces (Indicator)", L"fore:#00FF40; alpha:80; alpha2:220; indic_roundbox", L"" }, + /* 3 */ { STYLE_BRACEBAD, 63115, L"2nd Matching Braces Error (Indicator)", L"fore:#FF0080; alpha:140; alpha2:220; indic_roundbox", L"" }, + /* 4 */ { STYLE_CONTROLCHAR, 63116, L"2nd Control Characters (Font)", L"size:-1", L"" }, + /* 5 */ { STYLE_INDENTGUIDE, 63117, L"2nd Indentation Guide (Color)", L"fore:#A0A0A0", L"" }, + /* 6 */ { SCI_SETSELFORE + SCI_SETSELBACK, 63118, L"2nd Selected Text (Colors)", L"eolfilled", L"" }, + /* 7 */ { SCI_SETWHITESPACEFORE + SCI_SETWHITESPACEBACK + SCI_SETWHITESPACESIZE, 63119, L"2nd Whitespace (Colors, Size 0-5)", L"fore:#FF4000", L"" }, + /* 8 */ { SCI_SETCARETLINEBACK, 63120, L"2nd Current Line Background (Color)", L"back:#FFFF00; alpha:50", L"" }, + /* 9 */ { SCI_SETCARETFORE + SCI_SETCARETWIDTH, 63121, L"2nd Caret (Color, Size 1-3)", L"", L"" }, + /* 10 */ { SCI_SETEDGECOLOUR, 63122, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" }, + /* 11 */ { SCI_SETEXTRAASCENT + SCI_SETEXTRADESCENT, 63123, L"2nd Extra Line Spacing (Size)", L"", L"" }, + /* 12 */ { SCI_FOLDALL + SCI_MARKERSETALPHA, 63125, L"2nd Bookmarks and Folding (Colors)", L"fore:#000000; back:#808080; alpha:80; charset:2; case:U", L"" }, + /* 13 */ { SCI_MARKERSETBACK + SCI_MARKERSETALPHA, 63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0x000000; alpha:100; alpha2:220; indic_box", L"" }, + /* 14 */ { SCI_SETHOTSPOTACTIVEFORE, 63265, L"2nd Hyperlink Hotspots", L"bold; fore:#FF0000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +enum LexDefaultStyles { + STY_DEFAULT = 0, + STY_MARGIN = 1, + STY_BRACE_OK = 2, + STY_BRACE_BAD = 3, + STY_CTRL_CHR = 4, + STY_INDENT_GUIDE = 5, + STY_SEL_TXT = 6, + STY_WHITESPACE = 7, + STY_CUR_LN_BCK = 8, + STY_CARET = 9, + STY_LONG_LN_MRK = 10, + STY_X_LN_SPACE = 11, + STY_BOOK_MARK = 12, + STY_MARK_OCC = 13, + STY_URL_HOTSPOT = 14, + STY_INVISIBLE = 15, + STY_READONLY = 16 +}; + + +// ---------------------------------------------------------------------------- + +KEYWORDLIST KeyWords_HTML = { +"!doctype ^aria- ^data- a abbr accept accept-charset accesskey acronym action address align alink " +"alt and applet archive area article aside async audio autocomplete autofocus autoplay axis b " +"background base basefont bb bdi bdo bgcolor big blockquote body border bordercolor br buffered button " +"canvas caption cellpadding cellspacing center challenge char charoff charset checkbox checked " +"cite class classid clear code codebase codetype col colgroup color cols colspan command compact " +"content contenteditable contextmenu controls coords crossorigin data datafld dataformatas datagrid " +"datalist datapagesize datasrc datetime dd declare default defer del details dfn dialog dir dirname " +"disabled div dl download draggable dropzone dt em embed enctype event eventsource face fieldset " +"figcaption figure file font footer for form formaction formenctype formmethod formnovalidate " +"formtarget frame frameborder frameset h1 h2 h3 h4 h5 h6 head header headers height hgroup hidden " +"high hr href hreflang hspace html http-equiv i icon id iframe image img input ins integrity isindex " +"ismap itemprop itemscope itemtype kbd keygen keytype kind label lang language leftmargin legend li link " +"list longdesc loop low main manifest map marginheight marginwidth mark max maxlength media mediagroup " +"menu menuitem meta meter method min multiple muted name nav noframes nohref noresize noscript noshade " +"novalidate nowrap object ol onabort onafterprint onbeforeprint onbeforeunload onblur oncancel oncanplay " +"oncanplaythrough onchange onclick onclose oncontextmenu oncuechange ondblclick ondrag ondragend ondragenter " +"ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange " +"onforminput onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata " +"onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel " +"onoffline ononline onpagehide onpageshow onpause onplay onplaying onpopstate onprogress " +"onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking onselect " +"onshow onstalled onstorage onsubmit onsuspend ontimeupdate onundo onunload onvolumechange " +"onwaiting open optgroup optimum option output p param password pattern ping placeholder poster " +"pre prefix preload profile progress prompt property pubdate public q radio radiogroup readonly rel " +"required reset rev reversed role rows rowspan rp rt ruby rules s samp sandbox scheme scope scoped script " +"scrolling seamless section select selected shape size sizes small source span spellcheck src " +"srcdoc srclang standby start step strike strong style sub submit summary sup tabindex table " +"target tbody td text textarea tfoot th thead time title topmargin tr track translate tt type " +"typemustmatch u ul usemap valign value valuetype var version video vlink vspace wbr width wrap xml " +"xmlns", +"abstract boolean break byte case catch char class const continue debugger default delete do " +"double else enum export extends false final finally float for function goto if implements " +"import in instanceof int interface long native new null package private protected public " +"return short static super switch synchronized this throw throws transient true try typeof var " +"void volatile while with", +"alias and as attribute begin boolean byref byte byval call case class compare const continue " +"currency date declare dim do double each else elseif empty end enum eqv erase error event exit " +"explicit false for friend function get global gosub goto if imp implement in integer is let lib " +"load long loop lset me mid mod module new next not nothing null object on option optional or " +"preserve private property public raiseevent redim rem resume return rset select set single " +"static stop string sub then to true type unload until variant wend while with withevents xor", +"", +"__callstatic __class__ __compiler_halt_offset__ __dir__ __file__ __function__ __get __halt_compiler " +"__isset __line__ __method__ __namespace__ __set __sleep __trait__ __unset __wakeup " +"abstract and argc argv array as break callable case catch cfunction class clone closure const continue " +"declare default define die directory do e_all e_compile_error e_compile_warning e_core_error e_core_warning " +"e_deprecated e_error e_fatal e_notice e_parse e_strict e_user_deprecated e_user_error e_user_notice " +"e_user_warning e_warning echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile " +"eval exception exit extends false final for foreach function global goto http_cookie_vars http_env_vars " +"http_get_vars http_post_files http_post_vars http_server_vars if implements include include_once " +"instanceof insteadof interface isset list namespace new not null old_function or parent php_self " +"print private protected public require require_once return static stdclass switch this throw trait " +"true try unset use var virtual while xor", +"", "", "", "" }; + + +EDITLEXER lexHTML = { SCLEX_HTML, 63001, L"Web Source Code", L"html; htm; asp; aspx; shtml; htd; xhtml; php; php3; phtml; htt; cfm; tpl; dtd; hta; htc", L"", &KeyWords_HTML, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_H_TAG,SCE_H_TAGEND,0,0), 63136, L"HTML Tag", L"fore:#648000", L"" }, + { SCE_H_TAGUNKNOWN, 63137, L"HTML Unknown Tag", L"fore:#C80000; back:#FFFF80", L"" }, + { SCE_H_ATTRIBUTE, 63138, L"HTML Attribute", L"fore:#FF4000", L"" }, + { SCE_H_ATTRIBUTEUNKNOWN, 63139, L"HTML Unknown Attribute", L"fore:#C80000; back:#FFFF80", L"" }, + { SCE_H_VALUE, 63140, L"HTML Value", L"fore:#3A6EA5", L"" }, + { MULTI_STYLE(SCE_H_DOUBLESTRING,SCE_H_SINGLESTRING,0,0), 63141, L"HTML String", L"fore:#3A6EA5", L"" }, + { SCE_H_OTHER, 63142, L"HTML Other Inside Tag", L"fore:#3A6EA5", L"" }, + { MULTI_STYLE(SCE_H_COMMENT,SCE_H_XCCOMMENT,0,0), 63143, L"HTML Comment", L"fore:#646464", L"" }, + { SCE_H_ENTITY, 63144, L"HTML Entity", L"fore:#B000B0", L"" }, + { SCE_H_DEFAULT, 63256, L"HTML Element Text", L"", L"" }, + { MULTI_STYLE(SCE_H_XMLSTART,SCE_H_XMLEND,0,0), 63145, L"XML Identifier", L"bold; fore:#881280", L"" }, + { SCE_H_SGML_DEFAULT, 63237, L"SGML", L"fore:#881280", L"" }, + { SCE_H_CDATA, 63147, L"CDATA", L"fore:#646464", L"" }, + { MULTI_STYLE(SCE_H_ASP,SCE_H_ASPAT,0,0), 63146, L"ASP Start Tag", L"bold; fore:#000080", L"" }, + //{ SCE_H_SCRIPT, L"Script", L"", L"" }, + { SCE_H_QUESTION, 63148, L"PHP Start Tag", L"bold; fore:#000080", L"" }, + { SCE_HPHP_DEFAULT, 63149, L"PHP Default", L"", L"" }, + { MULTI_STYLE(SCE_HPHP_COMMENT,SCE_HPHP_COMMENTLINE,0,0), 63157, L"PHP Comment", L"fore:#FF8000", L"" }, + { SCE_HPHP_WORD, 63152, L"PHP Keyword", L"bold; fore:#A46000", L"" }, + { SCE_HPHP_HSTRING, 63150, L"PHP String", L"fore:#008000", L"" }, + { SCE_HPHP_SIMPLESTRING, 63151, L"PHP Simple String", L"fore:#008000", L"" }, + { SCE_HPHP_NUMBER, 63153, L"PHP Number", L"fore:#FF0000", L"" }, + { SCE_HPHP_OPERATOR, 63158, L"PHP Operator", L"fore:#B000B0", L"" }, + { SCE_HPHP_VARIABLE, 63154, L"PHP Variable", L"italic; fore:#000080", L"" }, + { SCE_HPHP_HSTRING_VARIABLE, 63155, L"PHP String Variable", L"italic; fore:#000080", L"" }, + { SCE_HPHP_COMPLEX_VARIABLE, 63156, L"PHP Complex Variable", L"italic; fore:#000080", L"" }, + { MULTI_STYLE(SCE_HJ_DEFAULT,SCE_HJ_START,0,0), 63159, L"JS Default", L"", L"" }, + { MULTI_STYLE(SCE_HJ_COMMENT,SCE_HJ_COMMENTLINE,SCE_HJ_COMMENTDOC,0), 63160, L"JS Comment", L"fore:#646464", L"" }, + { SCE_HJ_KEYWORD, 63163, L"JS Keyword", L"bold; fore:#A46000", L"" }, + { SCE_HJ_WORD, 63162, L"JS Identifier", L"", L"" }, + { MULTI_STYLE(SCE_HJ_DOUBLESTRING,SCE_HJ_SINGLESTRING,SCE_HJ_STRINGEOL,0), 63164, L"JS String", L"fore:#008000", L"" }, + { SCE_HJ_REGEX, 63166, L"JS Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_HJ_NUMBER, 63161, L"JS Number", L"fore:#FF0000", L"" }, + { SCE_HJ_SYMBOLS, 63165, L"JS Symbols", L"fore:#B000B0", L"" }, + { MULTI_STYLE(SCE_HJA_DEFAULT,SCE_HJA_START,0,0), 63167, L"ASP JS Default", L"", L"" }, + { MULTI_STYLE(SCE_HJA_COMMENT,SCE_HJA_COMMENTLINE,SCE_HJA_COMMENTDOC,0), 63168, L"ASP JS Comment", L"fore:#646464", L"" }, + { SCE_HJA_KEYWORD, 63171, L"ASP JS Keyword", L"bold; fore:#A46000", L"" }, + { SCE_HJA_WORD, 63170, L"ASP JS Identifier", L"", L"" }, + { MULTI_STYLE(SCE_HJA_DOUBLESTRING,SCE_HJA_SINGLESTRING,SCE_HJA_STRINGEOL,0), 63172, L"ASP JS String", L"fore:#008000", L"" }, + { SCE_HJA_REGEX, 63174, L"ASP JS Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_HJA_NUMBER, 63169, L"ASP JS Number", L"fore:#FF0000", L"" }, + { SCE_HJA_SYMBOLS, 63173, L"ASP JS Symbols", L"fore:#B000B0", L"" }, + { MULTI_STYLE(SCE_HB_DEFAULT,SCE_HB_START,0,0), 63175, L"VBS Default", L"", L"" }, + { SCE_HB_COMMENTLINE, 63176, L"VBS Comment", L"fore:#646464", L"" }, + { SCE_HB_WORD, 63178, L"VBS Keyword", L"bold; fore:#B000B0", L"" }, + { SCE_HB_IDENTIFIER, 63180, L"VBS Identifier", L"", L"" }, + { MULTI_STYLE(SCE_HB_STRING,SCE_HB_STRINGEOL,0,0), 63179, L"VBS String", L"fore:#008000", L"" }, + { SCE_HB_NUMBER, 63177, L"VBS Number", L"fore:#FF0000", L"" }, + { MULTI_STYLE(SCE_HBA_DEFAULT,SCE_HBA_START,0,0), 63181, L"ASP VBS Default", L"", L"" }, + { SCE_HBA_COMMENTLINE, 63182, L"ASP VBS Comment", L"fore:#646464", L"" }, + { SCE_HBA_WORD, 63184, L"ASP VBS Keyword", L"bold; fore:#B000B0", L"" }, + { SCE_HBA_IDENTIFIER, 63186, L"ASP VBS Identifier", L"", L"" }, + { MULTI_STYLE(SCE_HBA_STRING,SCE_HBA_STRINGEOL,0,0), 63185, L"ASP VBS String", L"fore:#008000", L"" }, + { SCE_HBA_NUMBER, 63183, L"ASP VBS Number", L"fore:#FF0000", L"" }, + //{ SCE_HP_START, L"Phyton Start", L"", L"" }, + //{ SCE_HP_DEFAULT, L"Phyton Default", L"", L"" }, + //{ SCE_HP_COMMENTLINE, L"Phyton Comment Line", L"", L"" }, + //{ SCE_HP_NUMBER, L"Phyton Number", L"", L"" }, + //{ SCE_HP_STRING, L"Phyton String", L"", L"" }, + //{ SCE_HP_CHARACTER, L"Phyton Character", L"", L"" }, + //{ SCE_HP_WORD, L"Phyton Keyword", L"", L"" }, + //{ SCE_HP_TRIPLE, L"Phyton Triple", L"", L"" }, + //{ SCE_HP_TRIPLEDOUBLE, L"Phyton Triple Double", L"", L"" }, + //{ SCE_HP_CLASSNAME, L"Phyton Class Name", L"", L"" }, + //{ SCE_HP_DEFNAME, L"Phyton Def Name", L"", L"" }, + //{ SCE_HP_OPERATOR, L"Phyton Operator", L"", L"" }, + //{ SCE_HP_IDENTIFIER, L"Phyton Identifier", L"", L"" }, + //{ SCE_HPA_START, L"ASP Phyton Start", L"", L"" }, + //{ SCE_HPA_DEFAULT, L"ASP Phyton Default", L"", L"" }, + //{ SCE_HPA_COMMENTLINE, L"ASP Phyton Comment Line", L"", L"" }, + //{ SCE_HPA_NUMBER, L"ASP Phyton Number", L"", L"" }, + //{ SCE_HPA_STRING, L"ASP Phyton String", L"", L"" }, + //{ SCE_HPA_CHARACTER, L"ASP Phyton Character", L"", L"" }, + //{ SCE_HPA_WORD, L"ASP Phyton Keyword", L"", L"" }, + //{ SCE_HPA_TRIPLE, L"ASP Phyton Triple", L"", L"" }, + //{ SCE_HPA_TRIPLEDOUBLE, L"ASP Phyton Triple Double", L"", L"" }, + //{ SCE_HPA_CLASSNAME, L"ASP Phyton Class Name", L"", L"" }, + //{ SCE_HPA_DEFNAME, L"ASP Phyton Def Name", L"", L"" }, + //{ SCE_HPA_OPERATOR, L"ASP Phyton Operator", L"", L"" }, + //{ SCE_HPA_IDENTIFIER, L"ASP Phyton Identifier", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_XML = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexXML = { SCLEX_XML, 63002, L"XML Document", L"xml; xsl; rss; svg; xul; xsd; xslt; axl; rdf; xaml; vcproj", L"", &KeyWords_XML, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_H_TAG,SCE_H_TAGUNKNOWN,SCE_H_TAGEND,0), 63187, L"XML Tag", L"fore:#881280", L"" }, + { MULTI_STYLE(SCE_H_ATTRIBUTE,SCE_H_ATTRIBUTEUNKNOWN,0,0), 63188, L"XML Attribute", L"fore:#994500", L"" }, + { SCE_H_VALUE, 63189, L"XML Value", L"fore:#1A1AA6", L"" }, + { MULTI_STYLE(SCE_H_DOUBLESTRING,SCE_H_SINGLESTRING,0,0), 63190, L"XML String", L"fore:#1A1AA6", L"" }, + { SCE_H_OTHER, 63191, L"XML Other Inside Tag", L"fore:#1A1AA6", L"" }, + { MULTI_STYLE(SCE_H_COMMENT,SCE_H_XCCOMMENT,0,0), 63192, L"XML Comment", L"fore:#646464", L"" }, + { SCE_H_ENTITY, 63193, L"XML Entity", L"fore:#B000B0", L"" }, + { SCE_H_DEFAULT, 63257, L"XML Element Text", L"", L"" }, + { MULTI_STYLE(SCE_H_XMLSTART,SCE_H_XMLEND,0,0), 63145, L"XML Identifier", L"bold; fore:#881280", L"" }, + { SCE_H_SGML_DEFAULT, 63237, L"SGML", L"fore:#881280", L"" }, + { SCE_H_CDATA, 63147, L"CDATA", L"fore:#646464", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_CSS = { +"align-content align-items align-self alignment-adjust alignment-baseline animation animation-delay " +"animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name " +"animation-play-state animation-timing-function appearance ascent azimuth backface-visibility " +"background background-attachment background-blend-mode background-break background-clip background-color " +"background-image background-origin background-position background-repeat background-size " +"baseline baseline-shift bbox binding bleed bookmark-label bookmark-level bookmark-state " +"bookmark-target border border-bottom border-bottom-color border-bottom-left-radius " +"border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color " +"border-image border-image-outset border-image-repeat border-image-slice border-image-source " +"border-image-width border-left border-left-color border-left-style border-left-width " +"border-length border-radius border-right border-right-color border-right-style " +"border-right-width border-spacing border-style border-top border-top-color " +"border-top-left-radius border-top-right-radius border-top-style border-top-width border-width " +"bottom box-align box-decoration-break box-direction box-flex box-flex-group box-lines " +"box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before " +"break-inside cap-height caption-side centerline change-bar change-bar-class change-bar-offset " +"change-bar-side clear clip clip-path clip-rule color color-profile column-count column-fill column-gap " +"column-rule column-rule-color column-rule-style column-rule-width columns column-span column-width " +"content counter-increment counter-reset crop cue cue-after cue-before cursor definition-src descent " +"direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align " +"drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value " +"elevation empty-cells fill fit fit-position flex flex-basis flex-direction flex-flow flex-grow flex-shrink " +"flex-wrap float float-offset flow-from flow-into font font-family font-feature-settings font-kerning font-size " +"font-size-adjust font-stretch font-style font-synthesis font-variant font-weight grid-columns grid-rows " +"hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-limit-chars " +"hyphenate-limit-last hyphenate-limit-zone hyphenate-lines hyphenate-resource hyphens icon image-orientation " +"image-resolution ime-mode inline-box-align insert-position interpret-as justify-content left letter-spacing " +"line-height line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy list-style " +"list-style-image list-style-position list-style-type make-element margin margin-bottom margin-left " +"margin-right margin-top mark mark-after mark-before marker-offset marks marquee-direction marquee-play-count " +"marquee-speed marquee-style mask mask-type mathline max-height max-width media min-height min-width " +"move-to nav-down nav-index nav-left nav-right nav-up object-fit object-position opacity order orphans " +"outline outline-color outline-offset outline-style outline-width overflow overflow-style overflow-wrap " +"overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after " +"page-break-before page-break-inside page-policy panose-1 pause pause-after pause-before perspective " +"perspective-origin phonemes pitch pitch-range play-during pointer-events position presentation-level prototype " +"prototype-insert-policy prototype-insert-position punctuation-trim quotes region-overflow " +"rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align " +"ruby-overhang ruby-position ruby-span shape-image-threshold shape-inside shape-outside size slope speak " +"speak-header speak-numeral speak-punctuation speech-rate src stemh stemv stress string-set tab-size table-layout " +"target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color " +"text-decoration-line text-decoration-style text-emphasis text-height text-indent text-justify text-outline " +"text-overflow text-rendering text-replace text-shadow text-transform text-underline-position text-wrap top topline " +"transform transform-origin transform-style transition transition-delay transition-duration transition-property " +"transition-timing-function unicode-bidi unicode-range units-per-em vertical-align visibility " +"voice-balance voice-duration voice-family voice-pitch voice-pitch-range voice-rate voice-stress " +"voice-volume volume white-space white-space-collapse widows width widths will-change word-break word-spacing " +"word-wrap wrap wrap-flow wrap-margin wrap-padding wrap-through writing-mode x-height z-index", +"active after before checked choices default disabled empty enabled first first-child first-letter " +"first-line first-of-type focus hover indeterminate in-range invalid lang last-child last-of-type left " +"link not nth-child nth-last-child nth-last-of-type nth-of-type only-child only-of-type optional " +"out-of-range read-only read-write repeat-index repeat-item required right root target valid visited", +"", "", +"after before first-letter first-line selection", +"^-moz- ^-ms- ^-o- ^-webkit-", +"^-moz- ^-ms- ^-o- ^-webkit-", +"^-moz- ^-ms- ^-o- ^-webkit-", +"" }; + + +EDITLEXER lexCSS = { SCLEX_CSS, 63003, L"CSS Style Sheets", L"css; less; sass; scss", L"", &KeyWords_CSS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_CSS_DEFAULT, 63126, L"CSS Default", L"", L"" }, + { SCE_CSS_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_CSS_TAG, 63136, L"HTML Tag", L"bold; fore:#0A246A", L"" }, + { SCE_CSS_CLASS, 63194, L"Tag-Class", L"fore:#648000", L"" }, + { SCE_CSS_ID, 63195, L"Tag-ID", L"fore:#648000", L"" }, + { SCE_CSS_ATTRIBUTE, 63196, L"Tag-Attribute", L"italic; fore:#648000", L"" }, + { MULTI_STYLE(SCE_CSS_PSEUDOCLASS,SCE_CSS_EXTENDED_PSEUDOCLASS,0,0), 63197, L"Pseudo-Class", L"fore:#B000B0", L"" }, + { MULTI_STYLE(SCE_CSS_PSEUDOELEMENT,SCE_CSS_EXTENDED_PSEUDOELEMENT,0,0), 63361, L"Pseudo-Element", L"fore:#B00050", L"" }, + { MULTI_STYLE(SCE_CSS_IDENTIFIER,SCE_CSS_IDENTIFIER2,SCE_CSS_IDENTIFIER3,SCE_CSS_EXTENDED_IDENTIFIER), 63199, L"CSS Property", L"fore:#FF4000", L"" }, + { MULTI_STYLE(SCE_CSS_DOUBLESTRING,SCE_CSS_SINGLESTRING,0,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_CSS_VALUE, 63201, L"Value", L"fore:#3A6EA5", L"" }, + { SCE_CSS_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_CSS_IMPORTANT, 63202, L"Important", L"bold; fore:#C80000", L"" }, + { SCE_CSS_DIRECTIVE, 63203, L"Directive", L"bold; fore:#000000; back:#FFF1A8", L"" }, + { SCE_CSS_MEDIA, 63382, L"Media", L"bold; fore:#0A246A", L"" }, + { SCE_CSS_VARIABLE, 63249, L"Variable", L"bold; fore:#FF4000", L"" }, + { SCE_CSS_UNKNOWN_PSEUDOCLASS, 63198, L"Unknown Pseudo-Class", L"fore:#C80000; back:#FFFF80", L"" }, + { SCE_CSS_UNKNOWN_IDENTIFIER, 63200, L"Unknown Property", L"fore:#C80000; back:#FFFF80", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_CPP = { + // Primary keywords + "alignas auto bool break case catch char char16_t char32_t class const constexpr const_cast " + "continue decltype default delete do double dynamic_cast else enum explicit export extern false float " + "for friend goto if inline int long mutable namespace new noexcept nullptr operator " + "private protected public register reinterpret_cast restrict return short signed sizeof static " + "static_assert static_cast struct switch template this thread_local throw true try typedef typeid typename " + "union unsigned using virtual void volatile wchar_t while " + "alignof defined naked noreturn", + // Secondary keywords + "asm __abstract __alignof __asm __assume __based __box __cdecl __declspec __delegate __event " + "__except __except__try __fastcall __finally __forceinline __gc __hook __identifier " + "__if_exists __if_not_exists __inline __interface __leave " + "__multiple_inheritance __nogc __noop __pin __property __raise " + "__sealed __single_inheritance __stdcall __super __try __try_cast __unhook __uuidof __value " + "__virtual_inheritance", + // Documentation comment keywords + "", + // Global classes and typedefs + "complex imaginary int8_t int16_t int32_t int64_t intptr_t intmax_t ptrdiff_t size_t " + "uint8_t uint16_t uint32_t uint64_t uintptr_t uintmax_t" + "__int16 __int32 __int64 __int8 __m128 __m128d __m128i __m64 __wchar_t " + "_Alignas _Alignof _Atomic _Bool _Complex _Generic _Imaginary _Noreturn _Pragma _Static_assert _Thread_local", + // Preprocessor definitions + "DEBUG NDEBUG UNICODE _DEBUG _UNICODE _MSC_VER", + // Task marker and error marker keywords + "", + "", + "", + "" +}; + +EDITLEXER lexCPP = { SCLEX_CPP, 63004, L"C/C++ Source Code", L"c; cpp; cxx; cc; h; hpp; hxx; hh; m; mm; idl; inl; odl", L"", &KeyWords_CPP, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_C_WORD2, 63260, L"Keyword 2nd", L"bold; italic; fore:#3C6CDD", L"" }, + { SCE_C_GLOBALCLASS, 63258, L"Typedefs/Classes", L"bold; italic; fore:#800000", L"" }, + { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { MULTI_STYLE(SCE_C_PREPROCESSOR,SCE_C_PREPROCESSORCOMMENT,SCE_C_PREPROCESSORCOMMENTDOC,0), 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + //{ SCE_C_UUID, L"UUID", L"", L"" }, + //{ SCE_C_REGEX, L"Regex", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_CS = { +"abstract add alias as ascending async await base bool break by byte case catch char checked " +"class const continue decimal default delegate descending do double dynamic else " +"enum equals event explicit extern false finally fixed float for foreach from get " +"global goto group if implicit in int interface internal into is join lock let long " +"namespace new null object on operator orderby out override params partial private " +"protected public readonly ref remove return sbyte sealed select set short sizeof " +"stackalloc static string struct switch this throw true try typeof uint ulong " +"unchecked unsafe ushort using value var virtual void volatile where while yield", +"", "", +"AccessViolationException Action ActivationContext Activator AggregateException AppDomain " +"AppDomainInitializer AppDomainManager AppDomainManagerInitializationOptions AppDomainSetup " +"AppDomainUnloadedException ApplicationException ApplicationId ApplicationIdentity ArgIterator " +"ArgumentException ArgumentNullException ArgumentOutOfRangeException ArithmeticException Array " +"ArrayList ArraySegment ArrayTypeMismatchException AssemblyLoadEventArgs " +"AssemblyLoadEventHandler AsyncCallback Attribute AttributeTargets AttributeUsage " +"AttributeUsageAttribute BadImageFormatException Base64FormattingOptions BinaryReader " +"BinaryWriter BitArray BitConverter BlockingCollection Boolean Buffer BufferedStream " +"Byte CannotUnloadAppDomainException CaseInsensitiveComparer CaseInsensitiveHashCodeProvider " +"Char CharEnumerator CLSCompliant CLSCompliantAttribute CollectionBase CollectionDataContract " +"CollectionDataContractAttribute Color Comparer Comparison ConcurrentBag ConcurrentDictionary " +"ConcurrentQueue ConcurrentStack ConformanceLevel Console ConsoleCancelEventArgs " +"ConsoleCancelEventHandler ConsoleColor ConsoleKey ConsoleKeyInfo ConsoleModifiers " +"ConsoleSpecialKey ContextBoundObject ContextMarshalException ContextStatic " +"ContextStaticAttribute ContractNamespace ContractNamespaceAttribute Convert Converter " +"CrossAppDomainDelegate DataContract DataContractAttribute DataContractResolver " +"DataContractSerializer DataMember DataMemberAttribute DataMisalignedException DateTime " +"DateTimeKind DateTimeOffset DayOfWeek DBNull Decimal Delegate Dictionary DictionaryBase " +"DictionaryEntry Directory DirectoryInfo DirectoryNotFoundException DivideByZeroException " +"DllNotFoundException Double DriveInfo DriveNotFoundException DriveType DtdProcessing " +"DuplicateWaitObjectException EndOfStreamException EntityHandling EntryPointNotFoundException " +"Enum EnumMember EnumMemberAttribute Environment EnvironmentVariableTarget EqualityComparer " +"ErrorEventArgs ErrorEventHandler EventArgs EventHandler Exception ExecutionEngineException " +"ExportOptions ExtensionDataObject FieldAccessException File FileAccess FileAttributes " +"FileFormatException FileInfo FileLoadException FileMode FileNotFoundException FileOptions " +"FileShare FileStream FileStyleUriParser FileSystemEventArgs FileSystemEventHandler " +"FileSystemInfo FileSystemWatcher Flags FlagsAttribute FormatException Formatter " +"FormatterConverter FormatterServices Formatting FtpStyleUriParser Func GC GCCollectionMode " +"GCNotificationStatus GenericUriParser GenericUriParserOptions GopherStyleUriParser Guid " +"HandleInheritability HashSet Hashtable HttpStyleUriParser IAppDomainSetup IAsyncResult " +"ICloneable ICollection IComparable IComparer IConvertible ICustomFormatter " +"IDataContractSurrogate IDeserializationCallback IDictionary IDictionaryEnumerator IDisposable " +"IEnumerable IEnumerator IEqualityComparer IEquatable IExtensibleDataObject IFormatProvider " +"IFormattable IFormatter IFormatterConverter IFragmentCapableXmlDictionaryWriter " +"IgnoreDataMember IgnoreDataMemberAttribute IHashCodeProvider IHasXmlNode IList ImportOptions " +"IndexOutOfRangeException InsufficientExecutionStackException InsufficientMemoryException Int16 " +"Int32 Int64 InternalBufferOverflowException IntPtr InvalidCastException " +"InvalidDataContractException InvalidDataException InvalidOperationException " +"InvalidProgramException InvalidTimeZoneException IObjectReference IObservable IObserver " +"IODescription IODescriptionAttribute IOException IProducerConsumerCollection " +"ISafeSerializationData ISerializable ISerializationSurrogate IServiceProvider ISet " +"IStreamProvider IStructuralComparable IStructuralEquatable ISurrogateSelector " +"IXmlBinaryReaderInitializer IXmlBinaryWriterInitializer IXmlDictionary IXmlLineInfo " +"IXmlMtomReaderInitializer IXmlMtomWriterInitializer IXmlNamespaceResolver IXmlSchemaInfo " +"IXmlTextReaderInitializer IXmlTextWriterInitializer IXPathNavigable IXsltContextFunction " +"IXsltContextVariable KeyedByTypeCollection KeyNotFoundException KeyValuePair KnownType " +"KnownTypeAttribute Lazy LdapStyleUriParser LinkedList LinkedListNode List LoaderOptimization " +"LoaderOptimizationAttribute LoadOptions LocalDataStoreSlot MarshalByRefObject Math " +"MemberAccessException MemoryStream MethodAccessException MidpointRounding " +"MissingFieldException MissingMemberException MissingMethodException ModuleHandle MTAThread " +"MTAThreadAttribute MulticastDelegate MulticastNotSupportedException NamespaceHandling " +"NameTable NetDataContractSerializer NetPipeStyleUriParser NetTcpStyleUriParser " +"NewLineHandling NewsStyleUriParser NonSerialized NonSerializedAttribute " +"NotFiniteNumberException NotifyFilters NotImplementedException NotSupportedException Nullable " +"NullReferenceException Object ObjectDisposedException ObjectIDGenerator ObjectManager Obsolete " +"ObsoleteAttribute OnDeserialized OnDeserializedAttribute OnDeserializing " +"OnDeserializingAttribute OnSerialized OnSerializedAttribute OnSerializing " +"OnSerializingAttribute OnXmlDictionaryReaderClose OperatingSystem OperationCanceledException " +"OptionalField OptionalFieldAttribute OrderablePartitioner OutOfMemoryException " +"OverflowException ParamArray ParamArrayAttribute Partitioner Path PathTooLongException " +"PipeException PlatformID PlatformNotSupportedException Predicate Queue Random RankException " +"ReaderOptions ReadOnlyCollectionBase ReadState RenamedEventArgs RenamedEventHandler " +"ResolveEventArgs ResolveEventHandler RuntimeArgumentHandle RuntimeFieldHandle " +"RuntimeMethodHandle RuntimeTypeHandle SafeSerializationEventArgs SaveOptions SByte " +"SearchOption SeekOrigin Serializable SerializableAttribute SerializationBinder " +"SerializationEntry SerializationException SerializationInfo SerializationInfoEnumerator " +"SerializationObjectManager Single SortedDictionary SortedList SortedSet Stack " +"StackOverflowException STAThread STAThreadAttribute Stream StreamingContext " +"StreamingContextStates StreamReader StreamWriter String StringBuilder StringComparer StringComparison " +"StringReader StringSplitOptions StringWriter StructuralComparisons SurrogateSelector " +"SynchronizedCollection SynchronizedKeyedCollection SynchronizedReadOnlyCollection " +"SystemException TextReader TextWriter ThreadStatic ThreadStaticAttribute TimeoutException " +"TimeSpan TimeZone TimeZoneInfo TimeZoneNotFoundException Tuple Type TypeAccessException " +"TypeCode TypedReference TypeInitializationException TypeLoadException TypeUnloadedException " +"UInt16 UInt32 UInt64 UIntPtr UnauthorizedAccessException UnhandledExceptionEventArgs " +"UnhandledExceptionEventHandler UniqueId UnmanagedMemoryAccessor UnmanagedMemoryStream Uri " +"UriBuilder UriComponents UriFormat UriFormatException UriHostNameType UriIdnScope UriKind " +"UriParser UriPartial UriTemplate UriTemplateEquivalenceComparer UriTemplateMatch " +"UriTemplateMatchException UriTemplateTable UriTypeConverter ValidationEventArgs " +"ValidationEventHandler ValidationType ValueType Version Void WaitForChangedResult " +"WatcherChangeTypes WeakReference WhitespaceHandling WriteState XAttribute XCData XComment " +"XContainer XDeclaration XDocument XDocumentType XElement XmlAtomicValue XmlAttribute " +"XmlAttributeCollection XmlBinaryReaderSession XmlBinaryWriterSession XmlCaseOrder " +"XmlCDataSection XmlCharacterData XmlComment XmlConvert XmlDataDocument XmlDataType " +"XmlDateTimeSerializationMode XmlDeclaration XmlDictionary XmlDictionaryReader " +"XmlDictionaryReaderQuotas XmlDictionaryString XmlDictionaryWriter XmlDocument " +"XmlDocumentFragment XmlDocumentType XmlElement XmlEntity XmlEntityReference XmlException " +"XmlImplementation XmlLinkedNode XmlNamedNodeMap XmlNamespaceManager XmlNamespaceScope " +"XmlNameTable XmlNode XmlNodeChangedAction XmlNodeChangedEventArgs XmlNodeChangedEventHandler " +"XmlNodeList XmlNodeOrder XmlNodeReader XmlNodeType XmlNotation XmlObjectSerializer " +"XmlOutputMethod XmlParserContext XmlProcessingInstruction XmlQualifiedName XmlReader " +"XmlReaderSettings XmlResolver XmlSchema XmlSchemaAll XmlSchemaAnnotated XmlSchemaAnnotation " +"XmlSchemaAny XmlSchemaAnyAttribute XmlSchemaAppInfo XmlSchemaAttribute XmlSchemaAttributeGroup " +"XmlSchemaAttributeGroupRef XmlSchemaChoice XmlSchemaCollection XmlSchemaCollectionEnumerator " +"XmlSchemaCompilationSettings XmlSchemaComplexContent XmlSchemaComplexContentExtension " +"XmlSchemaComplexContentRestriction XmlSchemaComplexType XmlSchemaContent XmlSchemaContentModel " +"XmlSchemaContentProcessing XmlSchemaContentType XmlSchemaDatatype XmlSchemaDatatypeVariety " +"XmlSchemaDerivationMethod XmlSchemaDocumentation XmlSchemaElement XmlSchemaEnumerationFacet " +"XmlSchemaException XmlSchemaExternal XmlSchemaFacet XmlSchemaForm XmlSchemaFractionDigitsFacet " +"XmlSchemaGroup XmlSchemaGroupBase XmlSchemaGroupRef XmlSchemaIdentityConstraint " +"XmlSchemaImport XmlSchemaInclude XmlSchemaInference XmlSchemaInference.InferenceOption " +"XmlSchemaInferenceException XmlSchemaInfo XmlSchemaKey XmlSchemaKeyref XmlSchemaLengthFacet " +"XmlSchemaMaxExclusiveFacet XmlSchemaMaxInclusiveFacet XmlSchemaMaxLengthFacet " +"XmlSchemaMinExclusiveFacet XmlSchemaMinInclusiveFacet XmlSchemaMinLengthFacet " +"XmlSchemaNotation XmlSchemaNumericFacet XmlSchemaObject XmlSchemaObjectCollection " +"XmlSchemaObjectEnumerator XmlSchemaObjectTable XmlSchemaParticle XmlSchemaPatternFacet " +"XmlSchemaRedefine XmlSchemaSequence XmlSchemaSet XmlSchemaSimpleContent " +"XmlSchemaSimpleContentExtension XmlSchemaSimpleContentRestriction XmlSchemaSimpleType " +"XmlSchemaSimpleTypeContent XmlSchemaSimpleTypeList XmlSchemaSimpleTypeRestriction " +"XmlSchemaSimpleTypeUnion XmlSchemaTotalDigitsFacet XmlSchemaType XmlSchemaUnique " +"XmlSchemaUse XmlSchemaValidationException XmlSchemaValidationFlags XmlSchemaValidator " +"XmlSchemaValidity XmlSchemaWhiteSpaceFacet XmlSchemaXPath XmlSecureResolver " +"XmlSerializableServices XmlSeverityType XmlSignificantWhitespace XmlSortOrder XmlSpace " +"XmlText XmlTextReader XmlTextWriter XmlTokenizedType XmlTypeCode XmlUrlResolver " +"XmlValidatingReader XmlValueGetter XmlWhitespace XmlWriter XmlWriterSettings XName " +"XNamespace XNode XNodeDocumentOrderComparer XNodeEqualityComparer XObject XObjectChange " +"XObjectChangeEventArgs XPathDocument XPathException XPathExpression XPathItem " +"XPathNamespaceScope XPathNavigator XPathNodeIterator XPathNodeType XPathQueryGenerator " +"XPathResultType XProcessingInstruction XsdDataContractExporter XsdDataContractImporter " +"XslCompiledTransform XsltArgumentList XsltCompileException XsltContext XsltException " +"XsltMessageEncounteredEventArgs XsltMessageEncounteredEventHandler XslTransform XsltSettings " +"XStreamingElement XText", +"", "", "", "", "" }; + + +EDITLEXER lexCS = { SCLEX_CPP, 63005, L"C# Source Code", L"cs", L"", &KeyWords_CS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"C Default", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_VERBATIM, 63134, L"Verbatim String", L"fore:#008000", L"" }, + { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_C_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + //{ SCE_C_UUID, L"UUID", L"", L"" }, + //{ SCE_C_REGEX, L"Regex", L"", L"" }, + //{ SCE_C_WORD2, L"Word 2", L"", L"" }, + { SCE_C_GLOBALCLASS, 63337, L"Global Class", L"fore:#2B91AF", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_RC = { +"ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON " +"BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX " +"CLASS COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG " +"DIALOGEX DISCARDABLE EDITTEXT END EXSTYLE FONT GROUPBOX " +"ICON LANGUAGE LISTBOX LTEXT MENU MENUEX MENUITEM " +"MESSAGETABLE POPUP PUSHBUTTON RADIOBUTTON RCDATA RTEXT " +"SCROLLBAR SEPARATOR SHIFT STATE3 STRINGTABLE STYLE " +"TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexRC = { SCLEX_CPP, 63006, L"Resource Script", L"rc; rc2; rct; rh; r; dlg", L"", &KeyWords_RC, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#0A246A", L"" }, + { SCE_C_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + //{ SCE_C_UUID, L"UUID", L"", L"" }, + //{ SCE_C_REGEX, L"Regex", L"", L"" }, + //{ SCE_C_WORD2, L"Word 2", L"", L"" }, + //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_MAK = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexMAK = { SCLEX_MAKEFILE, 63007, L"Makefiles", L"mak; make; mk; dsp; msc; msvc", L"", &KeyWords_MAK, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_MAKE_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_MAKE_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_MAKE_IDENTIFIER,SCE_MAKE_IDEOL,0,0), 63129, L"Identifier", L"fore:#003CE6", L"" }, + { SCE_MAKE_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_MAKE_TARGET, 63204, L"Target", L"fore:#003CE6; back:#FFC000", L"" }, + { SCE_MAKE_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_VBS = { +"alias and as attribute begin boolean byref byte byval call case class compare const continue " +"currency date declare dim do double each else elseif empty end enum eqv erase error event exit " +"explicit false for friend function get global gosub goto if imp implement in integer is let lib " +"load long loop lset me mid mod module new next not nothing null object on option optional or " +"preserve private property public raiseevent redim rem resume return rset select set single " +"static stop string sub then to true type unload until variant wend while with withevents xor", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexVBS = { SCLEX_VBSCRIPT, 63008, L"VBScript", L"vbs; dsm", L"", &KeyWords_VBS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_B_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_B_COMMENT, 63127, L"Comment", L"fore:#808080", L"" }, + { SCE_B_KEYWORD, 63128, L"Keyword", L"bold; fore:#B000B0", L"" }, + { SCE_B_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_B_STRING,SCE_B_STRINGEOL,0,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_B_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_B_OPERATOR, 63132, L"Operator", L"", L"" }, + //{ SCE_B_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF9C00", L"" }, + //{ SCE_B_CONSTANT, L"Constant", L"", L"" }, + //{ SCE_B_DATE, L"Date", L"", L"" }, + //{ SCE_B_KEYWORD2, L"Keyword 2", L"", L"" }, + //{ SCE_B_KEYWORD3, L"Keyword 3", L"", L"" }, + //{ SCE_B_KEYWORD4, L"Keyword 4", L"", L"" }, + //{ SCE_B_ASM, L"Inline Asm", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_VB = { +"addhandler addressof alias and andalso ansi any as assembly auto boolean byref byte byval call " +"case catch cbool cbyte cchar cdate cdbl cdec char cint class clng cobj compare const cshort csng " +"cstr ctype date decimal declare default delegate dim directcast do double each else elseif end " +"enum erase error event exit explicit externalsource false finally for friend function get " +"gettype gosub goto handles if implements imports in inherits integer interface is let lib like " +"long loop me mid mod module mustinherit mustoverride mybase myclass namespace new next not " +"nothing notinheritable notoverridable object on option optional or orelse overloads overridable " +"overrides paramarray preserve private property protected public raiseevent randomize readonly " +"redim rem removehandler resume return select set shadows shared short single static step stop " +"strict string structure sub synclock then throw to true try typeof unicode until variant when " +"while with withevents writeonly xor", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexVB = { SCLEX_VB, 63009, L"Visual Basic", L"vb; bas; frm; cls; ctl; pag; dsr; dob", L"", &KeyWords_VB, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_B_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_B_COMMENT, 63127, L"Comment", L"fore:#808080", L"" }, + { SCE_B_KEYWORD, 63128, L"Keyword", L"bold; fore:#B000B0", L"" }, + { SCE_B_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_B_STRING,SCE_B_STRINGEOL,0,0), 63131, L"String", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_B_NUMBER,SCE_B_DATE,0,0), 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_B_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_B_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF9C00", L"" }, + //{ SCE_B_CONSTANT, L"Constant", L"", L"" }, + //{ SCE_B_KEYWORD2, L"Keyword 2", L"", L"" }, + //{ SCE_B_KEYWORD3, L"Keyword 3", L"", L"" }, + //{ SCE_B_KEYWORD4, L"Keyword 4", L"", L"" }, + //{ SCE_B_ASM, L"Inline Asm", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_JS = { +"abstract boolean break byte case catch char class const continue debugger default delete do " +"double else enum export extends false final finally float for function goto if implements " +"import in instanceof int interface let long native new null package private protected public " +"return short static super switch synchronized this throw throws transient true try typeof var " +"void volatile while with", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexJS = { SCLEX_CPP, 63010, L"JavaScript", L"js; jse; jsm; as", L"", &KeyWords_JS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + //{ SCE_C_UUID, L"UUID", L"", L"" }, + //{ SCE_C_PREPROCESSOR, L"Preprocessor", L"fore:#FF8000", L"" }, + //{ SCE_C_WORD2, L"Word 2", L"", L"" }, + //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_JSON = { +"false true null", +"@id @context @type @value @language @container @list @set @reverse @index @base @vocab @graph", +"", "", "", "", "", "", "" }; + + +EDITLEXER lexJSON = { SCLEX_JSON, 63029, L"JSON", L"json; eslintrc; jshintrc; jsonld", L"", &KeyWords_JSON, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_JSON_STRING, 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_JSON_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { -1, 00000, L"", L"", L"" } } }; + +/* +# String +style.json.2=fore:#7F0000 +# Unclosed string SCE_JSON_STRINGEOL +style.json.3=fore:#FFFFFF,back:#FF0000,eolfilled +# Property name SCE_JSON_PROPERTYNAME +style.json.4=fore:#880AE8 +# Escape sequence SCE_JSON_ESCAPESEQUENCE +style.json.5=fore:#0B982E +# Line comment SCE_JSON_LINECOMMENT +style.json.6=fore:#05BBAE,italic +# Block comment SCE_JSON_BLOCKCOMMENT +style.json.7=$(style.json.6) +# Operator SCE_JSON_OPERATOR +style.json.8=fore:#18644A +# URL/IRI SCE_JSON_URI +style.json.9=fore:#0000FF +# JSON-LD compact IRI SCE_JSON_COMPACTIRI +style.json.10=fore:#D137C1 +# JSON keyword SCE_JSON_KEYWORD +style.json.11=fore:#0BCEA7,bold +# JSON-LD keyword SCE_JSON_LDKEYWORD +style.json.12=fore:#EC2806 +# Parsing error SCE_JSON_ERROR +style.json.13=fore:#FFFFFF,back:#FF0000 +*/ + +KEYWORDLIST KeyWords_JAVA = { +"@interface abstract assert boolean break byte case catch char class const " +"continue default do double else enum extends final finally float for future " +"generic goto if implements import inner instanceof int interface long " +"native new null outer package private protected public rest return " +"short static super switch synchronized this throw throws transient try " +"var void volatile while " +"@Deprecated @Documented @FlaskyTest @Inherited @JavascriptInterface " +"@LargeTest @MediumTest @Override @Retention " +"@SmallTest @Smoke @Supress @SupressLint @SupressWarnings @Target @TargetApi " +"@TestTarget @TestTargetClass @UiThreadTest", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexJAVA = { SCLEX_CPP, 63011, L"Java Source Code", L"java", L"", &KeyWords_JAVA, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_C_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_C_COMMENT, 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_C_WORD, 63128, L"Keyword", L"bold; fore:#A46000", L"" }, + { SCE_C_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_C_STRING,SCE_C_CHARACTER,SCE_C_STRINGEOL,SCE_C_VERBATIM), 63131, L"String", L"fore:#008000", L"" }, + { SCE_C_REGEX, 63135, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_C_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_C_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + //{ SCE_C_UUID, L"UUID", L"", L"" }, + //{ SCE_C_PREPROCESSOR, L"Preprocessor", L"fore:#FF8000", L"" }, + //{ SCE_C_WORD2, L"Word 2", L"", L"" }, + //{ SCE_C_GLOBALCLASS, L"Global Class", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_PAS = { +"absolute abstract alias and array as asm assembler begin break case cdecl class const constructor continue cppdecl default " +"destructor dispose div do downto else end end. except exit export exports external false far far16 file finalization finally for " +"forward function goto if implementation in index inherited initialization inline interface is label library local message mod " +"name near new nil nostackframe not object of oldfpccall on operator or out overload override packed pascal private procedure " +"program property protected public published raise read record register reintroduce repeat resourcestring safecall self set shl " +"shr softfloat stdcall stored string then threadvar to true try type unit until uses var virtual while with write xor", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexPAS = { SCLEX_PASCAL, 63012, L"Pascal Source Code", L"pas; dpr; dpk; dfm; inc; pp", L"", &KeyWords_PAS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_PAS_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_PAS_COMMENT,SCE_PAS_COMMENT2,SCE_PAS_COMMENTLINE,0), 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_PAS_WORD, 63128, L"Keyword", L"bold; fore:#800080", L"" }, + { SCE_PAS_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_PAS_STRING,SCE_PAS_CHARACTER,SCE_PAS_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_PAS_NUMBER,SCE_PAS_HEXNUMBER,0,0), 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_PAS_OPERATOR, 63132, L"Operator", L"bold", L"" }, + { SCE_PAS_ASM, 63205, L"Inline Asm", L"fore:#0000FF", L"" }, + { MULTI_STYLE(SCE_PAS_PREPROCESSOR,SCE_PAS_PREPROCESSOR2,0,0), 63133, L"Preprocessor", L"fore:#FF00FF", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_ASM = { +"aaa aad aam aas adc add and arpl bound bsf bsr bswap bt btc btr bts call cbw cdq cflush clc cld " +"cli clts cmc cmova cmovae cmovb cmovbe cmovc cmove cmovg cmovge cmovl cmovle cmovna cmovnae " +"cmovnb cmovnbe cmovnc cmovne cmovng cmovnge cmovnl cmovnle cmovno cmovnp cmovns cmovnz cmovo " +"cmovp cmovpe cmovpo cmovs cmovz cmp cmps cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b " +"cpuid cwd cwde daa das dec div emms enter esc femms hlt ibts icebp idiv imul in inc ins insb " +"insd insw int int01 int03 int1 int3 into invd invlpg iret iretd iretdf iretf iretw ja jae jb jbe " +"jc jcxz je jecxz jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz " +"jo jp jpe jpo js jz lahf lar lds lea leave les lfs lgdt lgs lidt lldt lmsw loadall loadall286 " +"lock lods lodsb lodsd lodsq lodsw loop loopd loope looped loopew loopne loopned loopnew loopnz " +"loopnzd loopnzw loopw loopz loopzd loopzw lsl lss ltr mov movs movsb movsd movsq movsw movsx " +"movsxd movzx mul neg nop not or out outs outsb outsd outsw pop popa popad popaw popf popfd popfw " +"push pusha pushad pushaw pushd pushf pushfd pushfw pushw rcl rcr rdmsr rdpmc rdshr rdtsc rep " +"repe repne repnz repz ret retf retn rol ror rsdc rsldt rsm rsts sahf sal salc sar sbb scas scasb " +"scasd scasq scasw seta setae setb setbe setc sete setg setge setl setle setna setnae setnb " +"setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets " +"setz sgdt shl shld shr shrd sidt sldt smi smint smintold smsw stc std sti stos stosb stosd stosq " +"stosw str sub svdc svldt svts syscall sysenter sysexit sysret test ud0 ud1 ud2 umov verr verw " +"wait wbinvd wrmsr wrshr xadd xbts xchg xlat xlatb xor", +"f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne " +"fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp feni " +"ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr " +"fld fld1 fldcw fldenv fldenvd fldenvw fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex " +"fndisi fneni fninit fnop fnsave fnsaved fnsavew fnstcw fnstenv fnstenvd fnstenvw fnstsw fpatan " +"fprem fprem1 fptan frndint frstor frstord frstorw fsave fsaved fsavew fscale fsetpm fsin fsincos " +"fsqrt fst fstcw fstenv fstenvd fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomp " +"fucompp fwait fxam fxch fxtract fyl2x fyl2xp1", +"ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 cs cx dh di dl dr0 dr1 dr2 dr3 dr6 dr7 ds dx eax ebp " +"ebx ecx edi edx eip es esi esp fs gs mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 r10 r10b r10d r10w r11 r11b " +"r11d r11w r12 r12b r12d r12w r13 r13b r13d r13w r14 r14b r14d r14w r15 r15b r15d r15w r8 r8b r8d " +"r8w r9 r9b r9d r9w rax rbp rbx rcx rdi rdx rip rsi rsp si sp ss st st0 st1 st2 st3 st4 st5 st6 " +"st7 tr3 tr4 tr5 tr6 tr7 xmm0 xmm1 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm2 xmm3 xmm4 xmm5 xmm6 " +"xmm7 xmm8 xmm9 ymm0 ymm1 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 " +"ymm9", +"%arg %assign %define %elif %elifctk %elifdef %elifid %elifidn %elifidni %elifmacro %elifnctk " +"%elifndef %elifnid %elifnidn %elifnidni %elifnmacro %elifnnum %elifnstr %elifnum %elifstr %else " +"%endif %endmacro %endrep %error %exitrep %iassign %idefine %if %ifctk %ifdef %ifid %ifidn " +"%ifidni %ifmacro %ifnctk %ifndef %ifnid %ifnidn %ifnidni %ifnmacro %ifnnum %ifnstr %ifnum %ifstr " +"%imacro %include %line %local %macro %out %pop %push %rep %repl %rotate %stacksize %strlen " +"%substr %undef %xdefine %xidefine .186 .286 .286c .286p .287 .386 .386c .386p .387 .486 .486p " +".8086 .8087 .alpha .break .code .const .continue .cref .data .data? .dosseg .else .elseif .endif " +".endw .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn .erridni .errnb .errndef " +".errnz .exit .fardata .fardata? .if .lall .lfcond .list .listall .listif .listmacro " +".listmacroall .model .msfloat .no87 .nocref .nolist .nolistif .nolistmacro .radix .repeat .sall " +".seq .sfcond .stack .startup .tfcond .type .until .untilcxz .while .xall .xcref .xlist absolute " +"alias align alignb assume at bits catstr comm comment common cpu db dd df dosseg dq dt dup dw " +"echo else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn " +"elseifidni elseifnb elseifndef end endif endm endp ends endstruc eq equ even exitm export extern " +"externdef extrn for forc ge global goto group gt high highword iend if if1 if2 ifb ifdef ifdif " +"ifdifi ife ifidn ifidni ifnb ifndef import incbin include includelib instr invoke irp irpc " +"istruc label le length lengthof local low lowword lroffset lt macro mask mod name ne offset " +"opattr option org page popcontext proc proto ptr public purge pushcontext record repeat rept " +"resb resd resq rest resw section seg segment short size sizeof sizestr struc struct substr " +"subtitle subttl textequ this times title type typedef union use16 use32 while width", +"$ $$ %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 .bss .data .text ? @b @f a16 a32 abs addr all assumes at " +"basic byte c carry? casemap common compact cpu dotname dword emulator epilogue error export " +"expr16 expr32 far far16 far32 farstack flat forceframe fortran fword huge language large listing " +"ljmp loadds m510 medium memory near near16 near32 nearstack nodotname noemulator nokeyword " +"noljmp nom510 none nonunique nooldmacros nooldstructs noreadonly noscoped nosignextend nosplit " +"nothing notpublic o16 o32 oldmacros oldstructs os_dos overflow? para parity? pascal private " +"prologue qword radix readonly real10 real4 real8 req sbyte scoped sdword seq setif2 sign? small " +"smallstack stdcall sword syscall tbyte tiny use16 use32 uses vararg word wrt zero?", +"addpd addps addsd addss andnpd andnps andpd andps blendpd blendps blendvpd blendvps cmpeqpd " +"cmpeqps cmpeqsd cmpeqss cmplepd cmpleps cmplesd cmpless cmpltpd cmpltps cmpltsd cmpltss cmpnepd " +"cmpneps cmpnesd cmpness cmpnlepd cmpnleps cmpnlesd cmpnless cmpnltpd cmpnltps cmpnltsd cmpnltss " +"cmpordpd cmpordps cmpordsd cmpordss cmpunordpd cmpunordps cmpunordsd cmpunordss comisd comiss " +"crc32 cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi " +"cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvtss2sd cvtss2si cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi " +"cvttsd2si cvttss2si divpd divps divsd divss dppd dpps extractps fxrstor fxsave insertps ldmxscr " +"lfence maskmovdq maskmovdqu maxpd maxps maxss mfence minpd minps minsd minss movapd movaps movd " +"movdq2q movdqa movdqu movhlps movhpd movhps movlhps movlpd movlps movmskpd movmskps movntdq " +"movntdqa movnti movntpd movntps movntq movq movq2dq movsd movss movupd movups mpsadbw mulpd " +"mulps mulsd mulss orpd orps packssdw packsswb packusdw packuswb paddb paddd paddq paddsb paddsiw " +"paddsw paddusb paddusw paddw pand pandn pause paveb pavgb pavgusb pavgw paxsd pblendvb pblendw " +"pcmpeqb pcmpeqd pcmpeqq pcmpeqw pcmpestri pcmpestrm pcmpgtb pcmpgtd pcmpgtq pcmpgtw pcmpistri " +"pcmpistrm pdistib pextrb pextrd pextrq pextrw pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt " +"pfmax pfmin pfmul pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr " +"phminposuw pi2fd pinsrb pinsrd pinsrq pinsrw pmachriw pmaddwd pmagw pmaxsb pmaxsd pmaxsw pmaxub " +"pmaxud pmaxuw pminsb pminsd pminsw pminub pminud pminuw pmovmskb pmovsxbd pmovsxbq pmovsxbw " +"pmovsxdq pmovsxwd pmovsxwq pmovzxbd pmovzxbq pmovzxbw pmovzxdq pmovzxwd pmovzxwq pmuldq pmulhriw " +"pmulhrwa pmulhrwc pmulhuw pmulhw pmulld pmullw pmuludq pmvgezb pmvlzb pmvnzb pmvzb popcnt por " +"prefetch prefetchnta prefetcht0 prefetcht1 prefetcht2 prefetchw psadbw pshufd pshufhw pshuflw " +"pshufw pslld pslldq psllq psllw psrad psraw psrld psrldq psrlq psrlw psubb psubd psubq psubsb " +"psubsiw psubsw psubusb psubusw psubw pswapd ptest punpckhbw punpckhdq punpckhqdq punpckhwd " +"punpcklbw punpckldq punpcklqdq punpcklwd pxor rcpps rcpss roundpd roundps roundsd roundss " +"rsqrtps rsqrtss sfence shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd subss " +"ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps", +"", "", "" }; + + +EDITLEXER lexASM = { SCLEX_ASM, 63013, L"Assembly Script", L"asm", L"", &KeyWords_ASM, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_ASM_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_ASM_COMMENT,SCE_ASM_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_ASM_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_ASM_STRING,SCE_ASM_CHARACTER,SCE_ASM_STRINGEOL,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_ASM_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_ASM_OPERATOR, 63132, L"Operator", L"fore:#0A246A", L"" }, + { SCE_ASM_CPUINSTRUCTION, 63206, L"CPU Instruction", L"fore:#0A246A", L"" }, + { SCE_ASM_MATHINSTRUCTION, 63207, L"FPU Instruction", L"fore:#0A246A", L"" }, + { SCE_ASM_EXTINSTRUCTION, 63210, L"Extended Instruction", L"fore:#0A246A", L"" }, + { SCE_ASM_DIRECTIVE, 63203, L"Directive", L"fore:#0A246A", L"" }, + { SCE_ASM_DIRECTIVEOPERAND, 63209, L"Directive Operand", L"fore:#0A246A", L"" }, + { SCE_ASM_REGISTER, 63208, L"Register", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_PL = { +"__DATA__ __END__ __FILE__ __LINE__ __PACKAGE__ abs accept alarm and atan2 AUTOLOAD BEGIN " +"bind binmode bless break caller chdir CHECK chmod chomp chop chown chr chroot close closedir " +"cmp connect continue CORE cos crypt dbmclose dbmopen default defined delete DESTROY die do " +"dump each else elsif END endgrent endhostent endnetent endprotoent endpwent endservent eof " +"eq EQ eval exec exists exit exp fcntl fileno flock for foreach fork format formline ge GE " +"getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin " +"getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname " +"getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport " +"getservent getsockname getsockopt given glob gmtime goto grep gt GT hex if index INIT int " +"ioctl join keys kill last lc lcfirst le LE length link listen local localtime lock log " +"lstat lt LT map mkdir msgctl msgget msgrcv msgsnd my ne NE next no not NULL oct open " +"opendir or ord our pack package pipe pop pos print printf prototype push qu quotemeta rand " +"read readdir readline readlink readpipe recv redo ref rename require reset return reverse " +"rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent " +"sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift " +"shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split " +"sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek " +"system syswrite tell telldir tie tied time times truncate uc ucfirst umask undef UNITCHECK " +"unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn " +"when while write xor", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexPL = { SCLEX_PERL, 63014, L"Perl Script", L"pl; pm; cgi; pod", L"", &KeyWords_PL, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_PL_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_PL_COMMENTLINE, 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_PL_WORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, + { SCE_PL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_PL_STRING, 63211, L"String Double Quoted", L"fore:#008000", L"" }, + { SCE_PL_CHARACTER, 63212, L"String Single Quoted", L"fore:#008000", L"" }, + { SCE_PL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_PL_OPERATOR, 63132, L"Operator", L"bold", L"" }, + { SCE_PL_SCALAR, 63215, L"Scalar $var", L"fore:#0A246A", L"" }, + { SCE_PL_ARRAY, 63216, L"Array @var", L"fore:#003CE6", L"" }, + { SCE_PL_HASH, 63217, L"Hash %var", L"fore:#B000B0", L"" }, + { SCE_PL_SYMBOLTABLE, 63218, L"Symbol Table *var", L"fore:#3A6EA5", L"" }, + { SCE_PL_REGEX, 63219, L"Regex /re/ or m{re}", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_PL_REGSUBST, 63220, L"Substitution s/re/ore/", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_PL_BACKTICKS, 63221, L"Back Ticks", L"fore:#E24000; back:#FFF1A8", L"" }, + { SCE_PL_HERE_DELIM, 63223, L"Here-Doc (Delimiter)", L"fore:#648000", L"" }, + { SCE_PL_HERE_Q, 63224, L"Here-Doc (Single Quoted, q)", L"fore:#648000", L"" }, + { SCE_PL_HERE_QQ, 63225, L"Here-Doc (Double Quoted, qq)", L"fore:#648000", L"" }, + { SCE_PL_HERE_QX, 63226, L"Here-Doc (Back Ticks, qx)", L"fore:#E24000; back:#FFF1A8", L"" }, + { SCE_PL_STRING_Q, 63227, L"Single Quoted String (Generic, q)", L"fore:#008000", L"" }, + { SCE_PL_STRING_QQ, 63228, L"Double Quoted String (qq)", L"fore:#008000", L"" }, + { SCE_PL_STRING_QX, 63229, L"Back Ticks (qx)", L"fore:#E24000; back:#FFF1A8", L"" }, + { SCE_PL_STRING_QR, 63230, L"Regex (qr)", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_PL_STRING_QW, 63231, L"Array (qw)", L"fore:#003CE6", L"" }, + { SCE_PL_SUB_PROTOTYPE, 63253, L"Prototype", L"fore:#800080; back:#FFE2FF", L"" }, + { SCE_PL_FORMAT_IDENT, 63254, L"Format Identifier", L"bold; fore:#648000; back:#FFF1A8", L"" }, + { SCE_PL_FORMAT, 63255, L"Format Body", L"fore:#648000; back:#FFF1A8", L"" }, + { SCE_PL_POD, 63213, L"POD (Common)", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, + { SCE_PL_POD_VERB, 63214, L"POD (Verbatim)", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, + { SCE_PL_DATASECTION, 63222, L"Data Section", L"fore:#A46000; back:#FFFFC0; eolfilled", L"" }, + { SCE_PL_ERROR, 63252, L"Parsing Error", L"fore:#C80000; back:#FFFF80", L"" }, + //{ SCE_PL_PUNCTUATION, L"Symbols / Punctuation (not used)", L"", L"" }, + //{ SCE_PL_PREPROCESSOR, L"Preprocessor (not used)", L"", L"" }, + //{ SCE_PL_LONGQUOTE, L"Long Quote (qq, qr, qw, qx) (not used)", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_PROPS = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexPROPS = { SCLEX_PROPERTIES, 63015, L"Configuration Files", L"ini; inf; cfg; properties; oem; sif; url; sed; theme", L"", &KeyWords_PROPS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_PROPS_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_PROPS_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_PROPS_SECTION, 63232, L"Section", L"fore:#000000; back:#FF8040; bold; eolfilled", L"" }, + { SCE_PROPS_ASSIGNMENT, 63233, L"Assignment", L"fore:#FF0000", L"" }, + { SCE_PROPS_DEFVAL, 63234, L"Default Value", L"fore:#FF0000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_BAT = { +"arp assoc attrib bcdedit bootcfg break cacls call cd change chcp chdir chkdsk chkntfs choice cipher " +"cleanmgr cls cmd cmdkey color com comp compact con convert copy country ctty date defined defrag del " +"dir disableextensions diskcomp diskcopy diskpart do doskey driverquery echo echo. else enableextensions " +"enabledelayedexpansion endlocal equ erase errorlevel exist exit expand fc find findstr for forfiles format " +"fsutil ftp ftype geq goto gpresult gpupdate graftabl gtr help icacls if in ipconfig kill label leq loadfix " +"loadhigh logman logoff lpt lss md mem mkdir mklink mode more move msg msiexe nbtstat neq net netstat netsh " +"not nslookup nul openfiles path pathping pause perfmon popd powercfg print prompt pushd rd recover reg regedit " +"regsvr32 rem ren rename replace rmdir robocopy route runas rundll32 sc schtasks sclist set setlocal sfc shift " +"shutdown sort start subst systeminfo taskkill tasklist time timeout title tracert tree type typeperf ver verify " +"vol wmic xcopy", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexBAT = { SCLEX_BATCH, 63016, L"Batch Files", L"bat; cmd", L"", &KeyWords_BAT, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_BAT_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_BAT_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_BAT_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_BAT_IDENTIFIER, 63129, L"Identifier", L"fore:#003CE6; back:#FFF1A8", L"" }, + { SCE_BAT_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { MULTI_STYLE(SCE_BAT_COMMAND,SCE_BAT_HIDE,0,0), 63236, L"Command", L"bold", L"" }, + { SCE_BAT_LABEL, 63235, L"Label", L"fore:#C80000; back:#F4F4F4; eolfilled", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_DIFF = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexDIFF = { SCLEX_DIFF, 63017, L"Diff Files", L"diff; patch", L"", &KeyWords_DIFF, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_DIFF_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_DIFF_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_DIFF_COMMAND, 63236, L"Command", L"bold; fore:#0A246A", L"" }, + { SCE_DIFF_HEADER, 63238, L"Source and Destination", L"fore:#C80000; back:#FFF1A8; eolfilled", L"" }, + { SCE_DIFF_POSITION, 63239, L"Position Setting", L"fore:#0000FF", L"" }, + { SCE_DIFF_ADDED, 63240, L"Line Addition", L"fore:#002000; back:#80FF80; eolfilled", L"" }, + { SCE_DIFF_DELETED, 63241, L"Line Removal", L"fore:#200000; back:#FF8080; eolfilled", L"" }, + { SCE_DIFF_CHANGED, 63242, L"Line Change", L"fore:#000020; back:#8080FF; eolfilled", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_SQL = { +"abort accessible action add after all alter analyze and as asc asensitive attach autoincrement " +"before begin between bigint binary bit blob both by call cascade case cast change char character " +"check collate column commit condition conflict constraint continue convert create cross current_date " +"current_time current_timestamp current_user cursor database databases date day_hour day_microsecond " +"day_minute day_second dec decimal declare default deferrable deferred delayed delete desc describe " +"detach deterministic distinct distinctrow div double drop dual each else elseif enclosed end enum " +"escape escaped except exclusive exists exit explain fail false fetch float float4 float8 for force " +"foreign from full fulltext glob grant group having high_priority hour_microsecond hour_minute " +"hour_second if ignore immediate in index infile initially inner inout insensitive insert instead int " +"int1 int2 int3 int4 int8 integer intersect interval into is isnull iterate join key keys kill " +"leading leave left like limit linear lines load localtime localtimestamp lock long longblob longtext " +"loop low_priority master_ssl_verify_server_cert match merge mediumblob mediumint mediumtext middleint " +"minute_microsecond minute_second mod modifies natural no no_write_to_binlog not notnull null numeric " +"of offset on optimize option optionally or order out outer outfile plan pragma precision primary " +"procedure purge query raise range read read_only read_write reads real references regexp reindex " +"release rename repeat replace require restrict return revoke right rlike rollback row rowid schema " +"schemas second_microsecond select sensitive separator set show smallint spatial specific sql " +"sql_big_result sql_calc_found_rows sql_small_result sqlexception sqlstate sqlwarning ssl starting " +"straight_join table temp temporary terminated text then time timestamp tinyblob tinyint tinytext to " +"trailing transaction trigger true undo union unique unlock unsigned update usage use using utc_date " +"utc_time utc_timestamp vacuum values varbinary varchar varcharacter varying view virtual when where " +"while with write xor year_month zerofill", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexSQL = { SCLEX_SQL, 63018, L"SQL Query", L"sql", L"", &KeyWords_SQL, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_SQL_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_SQL_COMMENT, 63127, L"Comment", L"fore:#505050", L"" }, + { SCE_SQL_WORD, 63128, L"Keyword", L"bold; fore:#800080", L"" }, + { MULTI_STYLE(SCE_SQL_STRING,SCE_SQL_CHARACTER,0,0), 63131, L"String", L"fore:#008000; back:#FFF1A8", L"" }, + { SCE_SQL_IDENTIFIER, 63129, L"Identifier", L"fore:#800080", L"" }, + { SCE_SQL_QUOTEDIDENTIFIER, 63243, L"Quoted Identifier", L"fore:#800080; back:#FFCCFF", L"" }, + { SCE_SQL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_SQL_OPERATOR, 63132, L"Operator", L"bold; fore:#800080", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_PY = { +"and as assert break class continue def del elif else except " +"exec False finally for from global if import in is lambda None " +"nonlocal not or pass print raise return True try while with yield", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexPY = { SCLEX_PYTHON, 63019, L"Python Script", L"py; pyw", L"", &KeyWords_PY, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#880000", L"" }, + { SCE_P_WORD, 63128, L"Keyword", L"fore:#000088", L"" }, + { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,0,0), 63211, L"String Double Quoted", L"fore:#008800", L"" }, + { SCE_P_CHARACTER, 63212, L"String Single Quoted", L"fore:#008800", L"" }, + { SCE_P_TRIPLEDOUBLE, 63244, L"String Triple Double Quotes", L"fore:#008800", L"" }, + { SCE_P_TRIPLE, 63245, L"String Triple Single Quotes", L"fore:#008800", L"" }, + { SCE_P_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, + { SCE_P_OPERATOR, 63132, L"Operator", L"bold; fore:#666600", L"" }, + { SCE_P_DEFNAME, 63247, L"Function Name", L"fore:#660066", L"" }, + { SCE_P_CLASSNAME, 63246, L"Class Name", L"fore:#660066", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_CONF = { +"acceptfilter acceptmutex acceptpathinfo accessconfig accessfilename action addalt addaltbyencoding " +"addaltbytype addcharset adddefaultcharset adddescription addencoding addhandler addicon addiconbyencoding " +"addiconbytype addinputfilter addlanguage addmodule addmoduleinfo addoutputfilter addoutputfilterbytype " +"addtype agentlog alias aliasmatch all allow allowconnect allowencodedslashes allowmethods allowoverride " +"allowoverridelist anonymous anonymous_authoritative anonymous_logemail anonymous_mustgiveemail " +"anonymous_nouserid anonymous_verifyemail assignuserid asyncrequestworkerfactor authauthoritative " +"authbasicauthoritative authbasicfake authbasicprovider authbasicusedigestalgorithm authdbauthoritative " +"authdbduserpwquery authdbduserrealmquery authdbgroupfile authdbmauthoritative authdbmgroupfile " +"authdbmtype authdbmuserfile authdbuserfile authdigestalgorithm authdigestdomain authdigestfile " +"authdigestgroupfile authdigestnccheck authdigestnonceformat authdigestnoncelifetime authdigestprovider " +"authdigestqop authdigestshmemsize authformauthoritative authformbody authformdisablenostore authformfakebasicauth " +"authformlocation authformloginrequiredlocation authformloginsuccesslocation authformlogoutlocation authformmethod " +"authformmimetype authformpassword authformprovider authformsitepassphrase authformsize authformusername " +"authgroupfile authldapauthoritative authldapauthorizeprefix authldapbindauthoritative authldapbinddn " +"authldapbindpassword authldapcharsetconfig authldapcompareasuser authldapcomparednonserver " +"authldapdereferencealiases authldapenabled authldapfrontpagehack authldapgroupattribute " +"authldapgroupattributeisdn authldapinitialbindasuser authldapinitialbindpattern authldapmaxsubgroupdepth " +"authldapremoteuserattribute authldapremoteuserisdn authldapsearchasuser authldapsubgroupattribute " +"authldapsubgroupclass authldapurl authmerging authname authncachecontext authncacheenable authncacheprovidefor " +"authncachesocache authncachetimeout authnprovideralias authnzfcgicheckauthnprovider authnzfcgidefineprovider " +"authtype authuserfile authzdbdlogintoreferer authzdbdquery authzdbdredirectquery authzdbmtype " +"authzsendforbiddenonfailure balancergrowth balancerinherit balancermember balancerpersist bindaddress " +"browsermatch browsermatchnocase bs2000account bufferedlogs buffersize cachedefaultexpire cachedetailheader " +"cachedirlength cachedirlevels cachedisable cacheenable cacheexpirycheck cachefile cacheforcecompletion " +"cachegcclean cachegcdaily cachegcinterval cachegcmemusage cachegcunused cacheheader cacheignorecachecontrol " +"cacheignoreheaders cacheignorenolastmod cacheignorequerystring cacheignoreurlsessionidentifiers " +"cachekeybaseurl cachelastmodifiedfactor cachelock cachelockmaxage cachelockpath cachemaxexpire " +"cachemaxfilesize cacheminexpire cacheminfilesize cachenegotiateddocs cachequickhandler cachereadsize " +"cachereadtime cacheroot cachesize cachesocache cachesocachemaxsize cachesocachemaxtime cachesocachemintime " +"cachesocachereadsize cachesocachereadtime cachestaleonerror cachestoreexpired cachestorenostore cachestoreprivate " +"cachetimemargin cgidscripttimeout cgimapextension cgipassauth cgivar charsetdefault charsetoptions charsetsourceenc " +"checkcaseonly checkspelling childperuserid chrootdir clearmodulelist contentdigest cookiedomain cookieexpires " +"cookielog cookiename cookiestyle cookietracking coredumpdirectory customlog dav davdepthinfinity davgenericlockdb " +"davlockdb davmintimeout dbdexptime dbdinitsql dbdkeep dbdmax dbdmin dbdparams dbdpersist dbdpreparesql dbdriver " +"defaulticon defaultlanguage defaultruntimedir defaulttype define deflatebuffersize deflatecompressionlevel " +"deflatefilternote deflateinflatelimitrequestbody deflateinflateratioburst deflateinflateratiolimit deflatememlevel " +"deflatewindowsize deny directory directorycheckhandler directoryindex directoryindexredirect directorymatch " +"directoryslash documentroot dtraceprivileges dumpioinput dumpiooutput else elseif enableexceptionhook enablemmap " +"enablesendfile error errordocument errorlog errorlogformat example expiresactive expiresbytype expiresdefault " +"extendedstatus extfilterdefine extfilteroptions fallbackresource fancyindexing fileetag files filesmatch " +"filterchain filterdeclare filterprotocol filterprovider filtertrace forcelanguagepriority forcetype forensiclog " +"from globallog gracefulshutdowntimeout group h2direct h2maxsessionstreams h2maxworkeridleseconds h2maxworkers " +"h2minworkers h2moderntlsonly h2push h2pushdiarysize h2pushpriority h2serializeheaders h2sessionextrafiles " +"h2streammaxmemsize h2tlscooldownsecs h2tlswarmupsize h2upgrade h2windowsize header headername heartbeataddress " +"heartbeatlisten heartbeatmaxservers heartbeatstorage hostnamelookups identitycheck identitychecktimeout " +"if ifdefine ifmodule ifversion imapbase imapdefault imapmenu include includeoptional indexheadinsert " +"indexignore indexignorereset indexoptions indexorderdefault indexstylesheet inputsed isapiappendlogtoerrors " +"isapiappendlogtoquery isapicachefile isapifakeasync isapilognotsupported isapireadaheadbuffer keepalive " +"keepalivetimeout keptbodysize languagepriority ldapcacheentries ldapcachettl ldapconnectionpoolttl " +"ldapconnectiontimeout ldaplibrarydebug ldapopcacheentries ldapopcachettl ldapreferralhoplimit ldapreferrals " +"ldapretries ldapretrydelay ldapsharedcachefile ldapsharedcachesize ldaptimeout ldaptrustedca ldaptrustedcatype " +"ldaptrustedclientcert ldaptrustedglobalcert ldaptrustedmode ldapverifyservercert limit limitexcept " +"limitinternalrecursion limitrequestbody limitrequestfields limitrequestfieldsize limitrequestline " +"limitxmlrequestbody listen listenbacklog listencoresbucketsratio loadfile loadmodule location " +"locationmatch lockfile logformat logiotrackttfb loglevel logmessage luaauthzprovider luacodecache " +"luahookaccesschecker luahookauthchecker luahookcheckuserid luahookfixups luahookinsertfilter luahooklog " +"luahookmaptostorage luahooktranslatename luahooktypechecker luainherit luainputfilter luamaphandler " +"luaoutputfilter luapackagecpath luapackagepath luaquickhandler luaroot luascope macro maxclients " +"maxconnectionsperchild maxkeepaliverequests maxmemfree maxrangeoverlaps maxrangereversals maxranges " +"maxrequestsperchild maxrequestsperthread maxrequestworkers maxspareservers maxsparethreads maxthreads " +"maxthreadsperchild mcachemaxobjectcount mcachemaxobjectsize mcachemaxstreamingbuffer mcacheminobjectsize " +"mcacheremovalalgorithm mcachesize memcacheconnttl mergetrailers metadir metafiles metasuffix mimemagicfile " +"minspareservers minsparethreads mmapfile modemstandard modmimeusepathinfo multiviewsmatch mutex namevirtualhost " +"nocache noproxy numservers nwssltrustedcerts nwsslupgradeable options order outputsed passenv pidfile port " +"privilegesmode protocol protocolecho protocols protocolshonororder proxy proxyaddheaders proxybadheader " +"proxyblock proxydomain proxyerroroverride proxyexpressdbmfile proxyexpressdbmtype proxyexpressenable " +"proxyftpdircharset proxyftpescapewildcards proxyftplistonwildcard proxyhcexpr proxyhctemplate proxyhctpsize " +"proxyhtmlbufsize proxyhtmlcharsetout proxyhtmldoctype proxyhtmlenable proxyhtmlevents proxyhtmlextended " +"proxyhtmlfixups proxyhtmlinterp proxyhtmllinks proxyhtmlmeta proxyhtmlstripcomments proxyhtmlurlmap " +"proxyiobuffersize proxymatch proxymaxforwards proxypass proxypassinherit proxypassinterpolateenv " +"proxypassmatch proxypassreverse proxypassreversecookiedomain proxypassreversecookiepath proxypreservehost " +"proxyreceivebuffersize proxyremote proxyremotematch proxyrequests proxyscgiinternalredirect proxyscgisendfile " +"proxyset proxysourceaddress proxystatus proxytimeout proxyvia qsc qualifyredirecturl readmename " +"receivebuffersize redirect redirectmatch redirectpermanent redirecttemp refererignore refererlog " +"reflectorheader remoteipheader remoteipinternalproxy remoteipinternalproxylist remoteipproxiesheader " +"remoteiptrustedproxy remoteiptrustedproxylist removecharset removeencoding removehandler removeinputfilter " +"removelanguage removeoutputfilter removetype requestheader requestreadtimeout require requireall " +"requireany requirenone resourceconfig rewritebase rewritecond rewriteengine rewritelock rewritelog " +"rewriteloglevel rewritemap rewriteoptions rewriterule rlimitcpu rlimitmem rlimitnproc satisfy " +"scoreboardfile script scriptalias scriptaliasmatch scriptinterpretersource scriptlog scriptlogbuffer " +"scriptloglength scriptsock securelisten seerequesttail sendbuffersize serveradmin serveralias serverlimit " +"servername serverpath serverroot serversignature servertokens servertype session sessioncookiename " +"sessioncookiename2 sessioncookieremove sessioncryptocipher sessioncryptodriver sessioncryptopassphrase " +"sessioncryptopassphrasefile sessiondbdcookiename sessiondbdcookiename2 sessiondbdcookieremove " +"sessiondbddeletelabel sessiondbdinsertlabel sessiondbdperuser sessiondbdselectlabel sessiondbdupdatelabel " +"sessionenv sessionexclude sessionheader sessioninclude sessionmaxage setenv setenvif setenvifexpr " +"setenvifnocase sethandler setinputfilter setoutputfilter singlelisten ssiendtag ssierrormsg ssietag " +"ssilastmodified ssilegacyexprparser ssistarttag ssitimeformat ssiundefinedecho sslcacertificatefile " +"sslcacertificatepath sslcadnrequestfile sslcadnrequestpath sslcarevocationcheck sslcarevocationfile " +"sslcarevocationpath sslcertificatechainfile sslcertificatefile sslcertificatekeyfile sslciphersuite " +"sslcompression sslcryptodevice sslengine sslfips sslhonorcipherorder sslinsecurerenegotiation sslmutex " +"sslocspdefaultresponder sslocspenable sslocspoverrideresponder sslocspproxyurl sslocsprespondertimeout " +"sslocspresponsemaxage sslocspresponsetimeskew sslocspuserequestnonce sslopensslconfcmd ssloptions " +"sslpassphrasedialog sslprotocol sslproxycacertificatefile sslproxycacertificatepath sslproxycarevocationcheck " +"sslproxycarevocationfile sslproxycarevocationpath sslproxycheckpeercn sslproxycheckpeerexpire " +"sslproxycheckpeername sslproxyciphersuite sslproxyengine sslproxymachinecertificatechainfile " +"sslproxymachinecertificatefile sslproxymachinecertificatepath sslproxyprotocol sslproxyverify " +"sslproxyverifydepth sslrandomseed sslrenegbuffersize sslrequire sslrequiressl sslsessioncache " +"sslsessioncachetimeout sslsessionticketkeyfile sslsessiontickets sslsrpunknownuserseed " +"sslsrpverifierfile sslstaplingcache sslstaplingerrorcachetimeout sslstaplingfaketrylater " +"sslstaplingforceurl sslstaplingrespondertimeout sslstaplingresponsemaxage sslstaplingresponsetimeskew " +"sslstaplingreturnrespondererrors sslstaplingstandardcachetimeout sslstrictsnivhostcheck sslusername " +"sslusestapling sslverifyclient sslverifydepth startservers startthreads substitute substituteinheritbefore " +"substitutemaxlinelength suexec suexecusergroup threadlimit threadsperchild threadstacksize timeout " +"traceenable transferlog typesconfig undefine undefmacro unsetenv use usecanonicalname usecanonicalphysicalport " +"user userdir vhostcgimode vhostcgiprivs vhostgroup vhostprivs vhostsecure vhostuser virtualdocumentroot " +"virtualdocumentrootip virtualhost virtualscriptalias virtualscriptaliasip watchdoginterval win32disableacceptex " +"xbithack xml2encalias xml2encdefault xml2startparse", +"", //"on off standalone inetd force-response-1.0 downgrade-1.0 nokeepalive indexes includes followsymlinks none x-compress x-gzip", +"", "", "", "", "", "", "" }; + + +EDITLEXER lexCONF = { SCLEX_CONF, 63020, L"Apache Config Files", L"conf; htaccess", L"", &KeyWords_CONF, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_CONF_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_CONF_COMMENT, 63127, L"Comment", L"fore:#648000", L"" }, + { SCE_CONF_STRING, 63131, L"String", L"fore:#B000B0", L"" }, + { SCE_CONF_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, + { SCE_CONF_DIRECTIVE, 63203, L"Directive", L"fore:#003CE6", L"" }, + { SCE_CONF_IP, 63248, L"IP Address", L"bold; fore:#FF4000", L"" }, +// Not used by lexer { SCE_CONF_IDENTIFIER, L"Identifier", L"", L"" }, +// Lexer is buggy { SCE_CONF_OPERATOR, L"Operator", L"", L"" }, +// Lexer is buggy { SCE_CONF_PARAMETER, L"Runtime Directive Parameter", L"", L"" }, +// Lexer is buggy { SCE_CONF_EXTENSION, L"Extension", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_PS = { +"begin break catch continue data do dynamicparam else elseif end exit filter finally for foreach " +"from function if in local param private process return switch throw trap try until where while", +"add-computer add-content add-history add-member add-pssnapin add-type checkpoint-computer " +"clear-content clear-eventlog clear-history clear-host clear-item clear-itemproperty " +"clear-variable compare-object complete-transaction connect-wsman convertfrom-csv " +"convertfrom-securestring convertfrom-stringdata convert-path convertto-csv convertto-html " +"convertto-securestring convertto-xml copy-item copy-itemproperty debug-process " +"disable-computerrestore disable-psbreakpoint disable-psremoting disable-pssessionconfiguration " +"disable-wsmancredssp disconnect-wsman enable-computerrestore enable-psbreakpoint " +"enable-psremoting enable-pssessionconfiguration enable-wsmancredssp enter-pssession " +"exit-pssession export-alias export-clixml export-console export-counter export-csv " +"export-formatdata export-modulemember export-pssession foreach-object format-custom format-list " +"format-table format-wide get-acl get-alias get-authenticodesignature get-childitem get-command " +"get-computerrestorepoint get-content get-counter get-credential get-culture get-date get-event " +"get-eventlog get-eventsubscriber get-executionpolicy get-formatdata get-help get-history " +"get-host get-hotfix get-item get-itemproperty get-job get-location get-member get-module " +"get-pfxcertificate get-process get-psbreakpoint get-pscallstack get-psdrive get-psprovider " +"get-pssession get-pssessionconfiguration get-pssnapin get-random get-service get-tracesource " +"get-transaction get-uiculture get-unique get-variable get-verb get-winevent get-wmiobject " +"get-wsmancredssp get-wsmaninstance group-object import-alias import-clixml import-counter " +"import-csv import-localizeddata import-module import-pssession invoke-command invoke-expression " +"invoke-history invoke-item invoke-restmethod invoke-webrequest invoke-wmimethod " +"invoke-wsmanaction join-path limit-eventlog measure-command measure-object move-item " +"move-itemproperty new-alias new-event new-eventlog new-item new-itemproperty new-module " +"new-modulemanifest new-object new-psdrive new-pssession new-pssessionoption new-service " +"new-timespan new-variable new-webserviceproxy new-wsmaninstance new-wsmansessionoption " +"out-default out-file out-gridview out-host out-null out-printer out-string pop-location " +"push-location read-host receive-job register-engineevent register-objectevent " +"register-pssessionconfiguration register-wmievent remove-computer remove-event remove-eventlog " +"remove-item remove-itemproperty remove-job remove-module remove-psbreakpoint remove-psdrive " +"remove-pssession remove-pssnapin remove-variable remove-wmiobject remove-wsmaninstance " +"rename-item rename-itemproperty reset-computermachinepassword resolve-path restart-computer " +"restart-service restore-computer resume-service select-object select-string select-xml " +"send-mailmessage set-acl set-alias set-authenticodesignature set-content set-date " +"set-executionpolicy set-item set-itemproperty set-location set-psbreakpoint set-psdebug " +"set-pssessionconfiguration set-service set-strictmode set-tracesource set-variable " +"set-wmiinstance set-wsmaninstance set-wsmanquickconfig show-eventlog sort-object split-path " +"start-job start-process start-service start-sleep start-transaction start-transcript " +"stop-computer stop-job stop-process stop-service stop-transcript suspend-service tee-object " +"test-computersecurechannel test-connection test-modulemanifest test-path test-wsman " +"trace-command undo-transaction unregister-event unregister-pssessionconfiguration " +"update-formatdata update-list update-typedata use-transaction wait-event wait-job wait-process " +"where-object write-debug write-error write-eventlog write-host write-output write-progress " +"write-verbose write-warning", +"ac asnp cat cd chdir clc clear clhy cli clp cls clv compare copy cp cpi cpp cvpa dbp del diff " +"dir ebp echo epal epcsv epsn erase etsn exsn fc fl foreach ft fw gal gbp gc gci gcm gcs gdr ghy " +"gi gjb gl gm gmo gp gps group gsn gsnp gsv gu gv gwmi h help history icm iex ihy ii ipal ipcsv " +"ipmo ipsn ise iwmi kill lp ls man md measure mi mkdir more mount move mp mv nal ndr ni nmo nsn " +"nv ogv oh popd ps pushd pwd r rbp rcjb rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rv " +"rvpa rwmi sajb sal saps sasv sbp sc select set si sl sleep sort sp spjb spps spsv start sv swmi " +"tee type where wjb write", +"importsystemmodules prompt psedit tabexpansion", +"", "", "", "", "" }; + + +EDITLEXER lexPS = { SCLEX_POWERSHELL, 63021, L"PowerShell Script", L"ps1; psd1; psm1", L"", &KeyWords_PS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_POWERSHELL_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_POWERSHELL_COMMENT,SCE_POWERSHELL_COMMENTSTREAM,0,0), 63127, L"Comment", L"fore:#646464", L"" }, + { SCE_POWERSHELL_KEYWORD, 63128, L"Keyword", L"bold; fore:#804000", L"" }, + { SCE_POWERSHELL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_POWERSHELL_STRING,SCE_POWERSHELL_CHARACTER,0,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_POWERSHELL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_POWERSHELL_OPERATOR, 63132, L"Operator", L"bold", L"" }, + { SCE_POWERSHELL_VARIABLE, 63249, L"Variable", L"fore:#0A246A", L"" }, + { MULTI_STYLE(SCE_POWERSHELL_CMDLET,SCE_POWERSHELL_FUNCTION,0,0), 63250, L"Cmdlet", L"fore:#804000; back:#FFF1A8", L"" }, + { SCE_POWERSHELL_ALIAS, 63251, L"Alias", L"bold; fore:#0A246A", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_NSIS = { +"!addincludedir !addplugindir !appendfile !cd !define !delfile !echo !else !endif !error " +"!execute !finalize !getdllversion !if !ifdef !ifmacrodef !ifmacrondef !ifndef !include !insertmacro !macro " +"!macroend !macroundef !makensis !packhdr !searchparse !searchreplace !system !tempfile !undef !verbose !warning " +".onguiend .onguiinit .oninit .oninstfailed .oninstsuccess .onmouseoversection .onrebootfailed .onselchange " +".onuserabort .onverifyinstdir un.onguiend un.onguiinit un.oninit un.onrebootfailed un.onuninstfailed un.onuninstsuccess " +"un.onuserabort abort addbrandingimage addsize allowrootdirinstall allowskipfiles autoclosewindow " +"bannertrimpath bgfont bggradient brandingtext bringtofront call callinstdll caption changeui checkbitmap " +"clearerrors completedtext componenttext copyfiles crccheck createdirectory createfont createshortcut " +"delete deleteinisec deleteinistr deleteregkey deleteregvalue detailprint detailsbuttontext dirstate dirtext " +"dirvar dirverify enablewindow enumregkey enumregvalue exch exec execshell execwait expandenvstrings " +"file filebufsize fileclose fileerrortext fileexists fileopen fileread filereadbyte filereadutf16le filereadword " +"fileseek filewrite filewritebyte filewriteutf16le filewriteword findclose findfirst findnext findproc " +"findwindow flushini getcurinsttype getcurrentaddress getdlgitem getdllversion getdllversionlocal " +"geterrorlevel getfiletime getfiletimelocal getfontname getfontnamelocal getfontversion getfontversionlocal " +"getfullpathname getfunctionaddress getinstdirerror getlabeladdress gettempfilename goto hidewindow icon " +"ifabort iferrors iffileexists ifrebootflag ifsilent initpluginsdir installbuttontext installcolors installdir " +"installdirregkey instprogressflags insttype insttypegettext insttypesettext intcmp intcmpu intfmt intop " +"iswindow langstring licensebkcolor licensedata licenseforceselection licenselangstring licensetext " +"loadlanguagefile lockwindow logset logtext manifestsupportedos messagebox miscbuttontext name nop outfile page " +"pagecallbacks pop push quit readenvstr readinistr readregdword readregstr reboot regdll rename requestexecutionlevel " +"reservefile return rmdir searchpath sectiongetflags sectiongetinsttypes sectiongetsize sectiongettext sectionin " +"sectionsetflags sectionsetinsttypes sectionsetsize sectionsettext sendmessage setautoclose setbrandingimage " +"setcompress setcompressionlevel setcompressor setcompressordictsize setctlcolors setcurinsttype " +"setdatablockoptimize setdatesave setdetailsprint setdetailsview seterrorlevel seterrors setfileattributes " +"setfont setoutpath setoverwrite setpluginunload setrebootflag setregview setshellvarcontext setsilent " +"showinstdetails showuninstdetails showwindow silentinstall silentuninstall sleep spacetexts strcmp strcmps " +"strcpy strlen subcaption unicode uninstallbuttontext uninstallcaption uninstallicon uninstallsubcaption uninstalltext " +"uninstpage unregdll var viaddversionkey vifileversion viproductversion windowicon writeinistr writeregbin " +"writeregdword writeregexpandstr writeregstr writeuninstaller xpstyle", +"${nsisdir} $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $r0 $r1 $r2 $r3 $r4 $r5 $r6 $r7 $r8 $r9 $instdir $outdir $cmdline " +"$language $programfiles $programfiles32 $programfiles64 $commonfiles $commonfiles32 $commonfiles64 " +"$desktop $exedir $exefile $exepath $windir $sysdir $temp $startmenu $smprograms $smstartup $quicklaunch " +"$documents $sendto $recent $favorites $music $pictures $videos $nethood $fonts $templates $appdata " +"$localappdata $printhood $internet_cache $cookies $history $profile $admintools $resources $resources_localized " +"$cdburn_area $hwndparent $pluginsdir ${__date__} ${__file__} ${__function__} ${__global__} ${__line__} " +"${__pageex__} ${__section__} ${__time__} ${__timestamp__} ${__uninstall__}", +"alt charset colored control cur date end global ignorecase leave shift smooth utcdate sw_hide sw_showmaximized " +"sw_showminimized sw_shownormal archive auto oname rebootok nonfatal ifempty nounload filesonly short mb_ok " +"mb_okcancel mb_abortretryignore mb_retrycancel mb_yesno mb_yesnocancel mb_iconexclamation mb_iconinformation " +"mb_iconquestion mb_iconstop mb_usericon mb_topmost mb_setforeground mb_right mb_rtlreading mb_defbutton1 " +"mb_defbutton2 mb_defbutton3 mb_defbutton4 idabort idcancel idignore idno idok idretry idyes sd current all " +"timeout imgid resizetofit listonly textonly both branding hkcr hkey_classes_root hklm hkey_local_machine hkcu " +"hkey_current_user hku hkey_users hkcc hkey_current_config hkdd hkey_dyn_data hkpd hkey_performance_data shctx " +"shell_context left right top bottom true false on off italic underline strike trimleft trimright trimcenter " +"idd_license idd_dir idd_selcom idd_inst idd_instfiles idd_uninst idd_verify force windows nocustom customstring " +"componentsonlyoncustom gray none user highest admin lang hide show nevershow normal silent silentlog solid final " +"zlib bzip2 lzma try ifnewer ifdiff lastused manual alwaysoff normal file_attribute_normal file_attribute_archive " +"hidden file_attribute_hidden offline file_attribute_offline readonly file_attribute_readonly system " +"file_attribute_system temporary file_attribute_temporary custom license components directory instfiles " +"uninstconfirm 32 64 enablecancel noworkingdir plugin rawnl winvista win7 win8 win8.1 win10", +"", "", "", "", "", "" }; + + +EDITLEXER lexNSIS = { SCLEX_NSIS, 63030, L"NSIS Script", L"nsi; nsh", L"", &KeyWords_NSIS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //,{ SCE_NSIS_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_NSIS_COMMENT,SCE_NSIS_COMMENTBOX,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_NSIS_STRINGDQ,SCE_NSIS_STRINGLQ,SCE_NSIS_STRINGRQ,0), 63131, L"String", L"fore:#666666; back:#EEEEEE", L"" }, + { SCE_NSIS_FUNCTION, 63277, L"Function", L"fore:#0033CC", L"" }, + { SCE_NSIS_VARIABLE, 63249, L"Variable", L"fore:#CC3300", L"" }, + { SCE_NSIS_STRINGVAR, 63285, L"Variable within String", L"fore:#CC3300; back:#EEEEEE", L"" }, + { SCE_NSIS_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_NSIS_LABEL, 63286, L"Constant", L"fore:#FF9900", L"" }, + { SCE_NSIS_SECTIONDEF, 63232, L"Section", L"fore:#0033CC", L"" }, + { SCE_NSIS_SUBSECTIONDEF, 63287, L"Sub Section", L"fore:#0033CC", L"" }, + { SCE_NSIS_SECTIONGROUP, 63288, L"Section Group", L"fore:#0033CC", L"" }, + { SCE_NSIS_FUNCTIONDEF, 63289, L"Function Definition", L"fore:#0033CC", L"" }, + { SCE_NSIS_PAGEEX, 63290, L"PageEx", L"fore:#0033CC", L"" }, + { SCE_NSIS_IFDEFINEDEF, 63291, L"If Definition", L"fore:#0033CC", L"" }, + { SCE_NSIS_MACRODEF, 63292, L"Macro Definition", L"fore:#0033CC", L"" }, + //{ SCE_NSIS_USERDEFINED, L"User Defined", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_INNO = { +"code components custommessages dirs files icons ini installdelete langoptions languages messages " +"registry run setup types tasks uninstalldelete uninstallrun _istool", +"allowcancelduringinstall allownetworkdrive allownoicons allowrootdirectory allowuncpath alwaysrestart " +"alwaysshowcomponentslist alwaysshowdironreadypage alwaysshowgrouponreadypage alwaysusepersonalgroup appcomments " +"appcontact appcopyright appenddefaultdirname appenddefaultgroupname appid appmodifypath appmutex appname apppublisher " +"apppublisherurl appreadmefile appsupportphone appsupporturl appupdatesurl appvername appversion architecturesallowed " +"architecturesinstallin64bitmode backcolor backcolor2 backcolordirection backsolid beveledlabel changesassociations " +"changesenvironment closeapplications closeapplicationsfilter compression compressionthreads copyrightfontname " +"copyrightfontsize createappdir createuninstallregkey defaultdirname defaultgroupname defaultuserinfoname " +"defaultuserinfoorg defaultuserinfoserial dialogfontname dialogfontsize direxistswarning disabledirpage " +"disablefinishedpage disableprogramgrouppage disablereadymemo disablereadypage disablestartupprompt " +"disablewelcomepage diskclustersize diskslicesize diskspanning enabledirdoesntexistwarning encryption " +"extradiskspacerequired flatcomponentslist infoafterfile infobeforefile internalcompresslevel languagedetectionmethod " +"languagecodepage languageid languagename licensefile lzmaalgorithm lzmablocksize lzmadictionarysize lzmamatchfinder " +"lzmanumblockthreads lzmanumfastbytes lzmauseseparateprocess mergeduplicatefiles minversion onlybelowversion " +"outputbasefilename outputdir outputmanifestfile password privilegesrequired reservebytes restartapplications " +"restartifneededbyrun righttoleft setupiconfile setuplogging setupmutex showcomponentsizes showlanguagedialog showtaskstreelines " +"showundisplayablelanguages signeduninstaller signeduninstallerdir signtool signtoolretrycount slicesperdisk solidcompression " +"sourcedir strongassemblyname timestamprounding timestampsinutc titlefontname titlefontsize touchdate touchtime uninstallable " +"uninstalldisplayicon uninstalldisplayname uninstallfilesdir uninstalldisplaysize uninstalllogmode uninstallrestartcomputer " +"updateuninstalllogappname usepreviousappdir usepreviousgroup usepreviouslanguage useprevioussetuptype useprevioustasks " +"verb versioninfoproductname useprevioususerinfo userinfopage usesetupldr versioninfocompany versioninfocopyright " +"versioninfodescription versioninfoproductversion versioninfotextversion versioninfoversion versioninfoproducttextversion " +"welcomefontname welcomefontsize windowshowcaption windowstartmaximized windowresizable windowvisible wizardimagealphaformat " +"wizardimagebackcolor wizardimagefile wizardimagestretch wizardsmallimagefile", +"appusermodelid afterinstall attribs beforeinstall check comment components copymode description destdir destname excludes " +"extradiskspacerequired filename flags fontinstall groupdescription hotkey infoafterfile infobeforefile iconfilename " +"iconindex key languages licensefile messagesfile minversion name onlybelowversion parameters permissions root runonceid " +"section source statusmsg string subkey tasks terminalservicesaware type types valuedata valuename valuetype workingdir", +"append define dim else emit elif endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma " +"sub undef", +"and begin break case const continue do downto else end except finally for function " +"if not of or procedure repeat then to try type until uses var while with", +"", "", "", "" }; + + +EDITLEXER lexINNO = { SCLEX_INNOSETUP, 63031, L"Inno Setup Script", L"iss; isl; islu", L"", &KeyWords_INNO, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_INNO_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_INNO_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_INNO_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, + { SCE_INNO_PARAMETER, 63294, L"Parameter", L"fore:#0000FF", L"" }, + { SCE_INNO_SECTION, 63232, L"Section", L"fore:#000080; bold", L"" }, + { SCE_INNO_PREPROC, 63133, L"Preprocessor", L"fore:#CC0000", L"" }, + { SCE_INNO_INLINE_EXPANSION, 63295, L"Inline Expansion", L"fore:#800080", L"" }, + { SCE_INNO_COMMENT_PASCAL, 63296, L"Pascal Comment", L"fore:#008000", L"" }, + { SCE_INNO_KEYWORD_PASCAL, 63297, L"Pascal Keyword", L"fore:#0000FF", L"" }, + { MULTI_STYLE(SCE_INNO_STRING_DOUBLE,SCE_INNO_STRING_SINGLE,0,0), 63131, L"String", L"", L"" }, + //{ SCE_INNO_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + //{ SCE_INNO_KEYWORD_USER, L"User Defined", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_RUBY = { +"__FILE__ __LINE__ alias and begin break case class def defined? do else elsif end ensure " +"false for in if module next nil not or redo rescue retry return self super then true " +"undef unless until when while yield", +"", "", "", "", "", "", "", "" }; + +EDITLEXER lexRUBY = { SCLEX_RUBY, 63032, L"Ruby Script", L"rb; ruby; rbw; rake; rjs; Rakefile; gemspec", L"", &KeyWords_RUBY, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_RB_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_RB_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_RB_WORD, 63128, L"Keyword", L"fore:#00007F", L"" }, + { SCE_RB_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_RB_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + { SCE_RB_OPERATOR, 63132, L"Operator", L"", L"" }, + { MULTI_STYLE(SCE_RB_STRING,SCE_RB_CHARACTER,SCE_P_STRINGEOL,0), 63131, L"String", L"fore:#FF8000", L"" }, + { SCE_RB_CLASSNAME, 63246, L"Class Name", L"fore:#0000FF", L"" }, + { SCE_RB_DEFNAME, 63247, L"Function Name", L"fore:#007F7F", L"" }, + { SCE_RB_POD, 63314, L"POD", L"fore:#004000; back:#C0FFC0; eolfilled", L"" }, + { SCE_RB_REGEX, 63315, L"Regex", L"fore:#000000; back:#A0FFA0", L"" }, + { SCE_RB_SYMBOL, 63316, L"Symbol", L"fore:#C0A030", L"" }, + { SCE_RB_MODULE_NAME, 63317, L"Module Name", L"fore:#A000A0", L"" }, + { SCE_RB_INSTANCE_VAR, 63318, L"Instance Var", L"fore:#B00080", L"" }, + { SCE_RB_CLASS_VAR, 63319, L"Class Var", L"fore:#8000B0", L"" }, + { SCE_RB_DATASECTION, 63320, L"Data Section", L"fore:#600000; back:#FFF0D8; eolfilled", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_LUA = { +"and break do else elseif end false for function goto if " +"in local nil not or repeat return then true until while", +// Basic Functions +"_VERSION assert collectgarbage dofile error gcinfo loadfile loadstring print rawget rawset " +"require tonumber tostring type unpack _ALERT _ERRORMESSAGE _INPUT _PROMPT _OUTPUT _STDERR " +"_STDIN _STDOUT call dostring foreach foreachi getn globals newtype sort tinsert tremove " +"_G getfenv getmetatable ipairs loadlib next pairs pcall rawequal setfenv setmetatable xpcall " +"string table math coroutine io os debug load module select", +// String Manipulation, Table Manipulation, Mathematical Functions +"abs acos asin atan atan2 ceil cos deg exp floor format frexp gsub ldexp log log10 max min " +"mod rad random randomseed sin sqrt strbyte strchar strfind strlen strlower strrep strsub strupper tan " +"string.byte string.char string.dump string.find string.len string.lower string.rep string.sub string.upper " +"string.format string.gfind string.gsub table.concat table.foreach table.foreachi table.getn table.sort " +"table.insert table.remove table.setn math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos " +"math.deg math.exp math.floor math.frexp math.ldexp math.log math.log10 math.max math.min math.mod " +"math.pi math.pow math.rad math.random math.randomseed math.sin math.sqrt math.tan string.gmatch " +"string.match string.reverse table.maxn math.cosh math.fmod math.modf math.sinh math.tanh math.huge", +// Input and Output Facilities & System Facilities Coroutine Manipulation, +//Input and Output Facilities, System Facilities (coroutine & io & os) +"openfile closefile readfrom writeto appendto remove rename flush seek tmpfile tmpname read " +"write clock date difftime execute exit getenv setlocale time coroutine.create coroutine.resume " +"coroutine.status coroutine.wrap coroutine.yield io.close io.flush io.input io.lines io.open io.output " +"io.read io.tmpfile io.type io.write io.stdin io.stdout io.stderr os.clock os.date os.difftime " +"os.execute os.exit os.getenv os.remove os.rename os.setlocale os.time os.tmpname coroutine.running " +"package.cpath package.loaded package.loadlib package.path package.preload package.seeall io.popen", +"", "", "", "", "" }; + + +EDITLEXER lexLUA = { SCLEX_LUA, 63033, L"Lua Script", L"lua", L"", &KeyWords_LUA, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_LUA_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_LUA_COMMENT,SCE_LUA_COMMENTLINE,SCE_LUA_COMMENTDOC,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_LUA_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + { SCE_LUA_WORD, 63128, L"Keyword", L"fore:#00007F", L"" }, + { SCE_LUA_WORD2, 63321, L"Basic Functions", L"fore:#00007F", L"" }, + { SCE_LUA_WORD3, 63322, L"String, Table & Math Functions", L"fore:#00007F", L"" }, + { SCE_LUA_WORD4, 63323, L"Input, Output & System Facilities", L"fore:#00007F", L"" }, + { MULTI_STYLE(SCE_LUA_STRING,SCE_LUA_STRINGEOL,SCE_LUA_CHARACTER,0), 63131, L"String", L"fore:#B000B0", L"" }, + { SCE_LUA_LITERALSTRING, 63302, L"Literal String", L"fore:#B000B0", L"" }, + { SCE_LUA_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + { SCE_LUA_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_LUA_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_LUA_LABEL, 63235, L"Label", L"fore:#808000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_BASH = { +"alias ar asa awk banner basename bash bc bdiff break bunzip2 bzip2 cal calendar case cat " +"cc cd chmod cksum clear cmp col comm compress continue cp cpio crypt csplit ctags cut date " +"dc dd declare deroff dev df diff diff3 dircmp dirname do done du echo ed egrep elif else " +"env esac eval ex exec exit expand export expr false fc fgrep fi file find fmt fold for function " +"functions getconf getopt getopts grep gres hash head help history iconv id if in integer " +"jobs join kill local lc let line ln logname look ls m4 mail mailx make man mkdir more mt mv " +"newgrp nl nm nohup ntps od pack paste patch pathchk pax pcat perl pg pr print printf ps pwd " +"read readonly red return rev rm rmdir sed select set sh shift size sleep sort spell split " +"start stop strings strip stty sum suspend sync tail tar tee test then time times touch tr " +"trap true tsort tty type typeset ulimit umask unalias uname uncompress unexpand uniq unpack " +"unset until uudecode uuencode vi vim vpax wait wc whence which while who wpaste wstart xargs " +"zcat chgrp chown chroot dir dircolors factor groups hostid install link md5sum mkfifo mknod " +"nice pinky printenv ptx readlink seq sha1sum shred stat su tac unlink users vdir whoami yes", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexBASH = { SCLEX_BASH, 63026, L"Shell Script", L"sh", L"", &KeyWords_BASH, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_SH_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_SH_ERROR, 63261, L"Error", L"", L"" }, + { SCE_SH_COMMENTLINE, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_SH_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + { SCE_SH_WORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, + { SCE_SH_STRING, 63211, L"String Double Quoted", L"fore:#008080", L"" }, + { SCE_SH_CHARACTER, 63212, L"String Single Quoted", L"fore:#800080", L"" }, + { SCE_SH_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_SH_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_SH_SCALAR, 63268, L"Scalar", L"fore:#808000", L"" }, + { SCE_SH_PARAM, 63269, L"Parameter Expansion", L"fore:#808000; back:#FFFF99", L"" }, + { SCE_SH_BACKTICKS, 63270, L"Back Ticks", L"fore:#FF0080", L"" }, + { SCE_SH_HERE_DELIM, 63271, L"Here-Doc (Delimiter)", L"", L"" }, + { SCE_SH_HERE_Q, 63272, L"Here-Doc (Single Quoted, q)", L"fore:#008080", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_TCL = { +// TCL Keywords +"after append array auto_execok auto_import auto_load auto_load_index auto_qualify beep " +"bgerror binary break case catch cd clock close concat continue dde default echo else " +"elseif encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent " +"flush for foreach format gets glob global history http if incr info interp join lappend " +"lindex linsert list llength load loadTk lrange lreplace lsearch lset lsort memory msgcat " +"namespace open package pid pkg::create pkg_mkIndex Platform-specific proc puts pwd " +"re_syntax read regexp registry regsub rename resource return scan seek set socket source " +"split string subst switch tclLog tclMacPkgSearch tclPkgSetup tclPkgUnknown tell time trace " +"unknown unset update uplevel upvar variable vwait while", +// TK Keywords +"bell bind bindtags bitmap button canvas checkbutton clipboard colors console cursors " +"destroy entry event focus font frame grab grid image Inter-client keysyms label labelframe " +"listbox lower menu menubutton message option options pack panedwindow photo place " +"radiobutton raise scale scrollbar selection send spinbox text tk tk_chooseColor " +"tk_chooseDirectory tk_dialog tk_focusNext tk_getOpenFile tk_messageBox tk_optionMenu " +"tk_popup tk_setPalette tkerror tkvars tkwait toplevel winfo wish wm", +// iTCL Keywords +"@scope body class code common component configbody constructor define destructor hull " +"import inherit itcl itk itk_component itk_initialize itk_interior itk_option iwidgets keep " +"method private protected public", +"", "", "", "", "", "" }; + + +#define SCE_TCL__MULTI_COMMENT MULTI_STYLE(SCE_TCL_COMMENT,SCE_TCL_COMMENTLINE,SCE_TCL_COMMENT_BOX,SCE_TCL_BLOCK_COMMENT) +#define SCE_TCL__MULTI_KEYWORD MULTI_STYLE(SCE_TCL_WORD,SCE_TCL_WORD2,SCE_TCL_WORD3,SCE_TCL_WORD_IN_QUOTE) +#define SCE_TCL__MULTI_SUBSTITUTION MULTI_STYLE(SCE_TCL_SUBSTITUTION,SCE_TCL_SUB_BRACE,0,0) + + +EDITLEXER lexTCL = { SCLEX_TCL, 63034, L"Tcl Script", L"tcl; itcl", L"", &KeyWords_TCL, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_TCL_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_TCL__MULTI_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_TCL__MULTI_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, + { SCE_TCL_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + { SCE_TCL_IN_QUOTE, 63131, L"String", L"fore:#008080", L"" }, + { SCE_TCL_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_TCL_IDENTIFIER, 63129, L"Identifier", L"fore:#800080", L"" }, + { SCE_TCL__MULTI_SUBSTITUTION, 63274, L"Substitution", L"fore:#CC0000", L"" }, + { SCE_TCL_MODIFIER, 63275, L"Modifier", L"fore:#FF00FF", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_AU3 = { +"and byref case const continuecase continueloop default dim do else elseif endfunc endif " +"endselect endswitch endwith enum exit exitloop false for func global if in local next not " +"or redim return select static step switch then to true until wend while with", +"abs acos adlibregister adlibunregister asc ascw asin assign atan autoitsetoption autoitwingettitle " +"autoitwinsettitle beep binary binarylen binarymid binarytostring bitand bitnot bitor bitrotate " +"bitshift bitxor blockinput break call cdtray ceiling chr chrw clipget clipput consoleread " +"consolewrite consolewriteerror controlclick controlcommand controldisable controlenable " +"controlfocus controlgetfocus controlgethandle controlgetpos controlgettext controlhide " +"controllistview controlmove controlsend controlsettext controlshow controltreeview cos dec " +"dircopy dircreate dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree dllcallbackgetptr " +"dllcallbackregister dllclose dllopen dllstructcreate dllstructgetdata dllstructgetptr " +"dllstructgetsize dllstructsetdata drivegetdrive drivegetfilesystem drivegetlabel drivegetserial " +"drivegettype drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree drivespacetotal " +"drivestatus envget envset envupdate eval execute exp filechangedir fileclose filecopy " +"filecreatentfslink filecreateshortcut filedelete fileexists filefindfirstfile filefindnextfile " +"fileflush filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut filegetshortname " +"filegetsize filegettime filegetversion fileinstall filemove fileopen fileopendialog fileread " +"filereadline filerecycle filerecycleempty filesavedialog fileselectfolder filesetattrib filesetpos " +"filesettime filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi guictrlcreatebutton " +"guictrlcreatecheckbox guictrlcreatecombo guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy " +"guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon guictrlcreateinput " +"guictrlcreatelabel guictrlcreatelist guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu " +"guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj guictrlcreatepic guictrlcreateprogress " +"guictrlcreateradio guictrlcreateslider guictrlcreatetab guictrlcreatetabitem guictrlcreatetreeview " +"guictrlcreatetreeviewitem guictrlcreateupdown guictrldelete guictrlgethandle guictrlgetstate " +"guictrlread guictrlrecvmsg guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy " +"guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata guictrlsetdefbkcolor " +"guictrlsetdefcolor guictrlsetfont guictrlsetgraphic guictrlsetimage guictrlsetlimit guictrlsetonevent " +"guictrlsetpos guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete " +"guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators guisetbkcolor guisetcoord " +"guisetcursor guisetfont guisethelp guiseticon guisetonevent guisetstate guisetstyle guistartgroup " +"guiswitch hex hotkeyset httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize " +"inetread inidelete iniread inireadsection inireadsectionnames inirenamesection iniwrite iniwritesection " +"inputbox int isadmin isarray isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword " +"isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag mousedown mousegetcursor " +"mousegetpos mousemove mouseup mousewheel msgbox number objcreate objcreateinterface objevent objevent " +"objget objname onautoitexitregister onautoitexitunregister opt ping pixelchecksum pixelgetcolor " +"pixelsearch pluginclose pluginopen processclose processexists processgetstats processlist " +"processsetpriority processwait processwaitclose progressoff progresson progressset ptr random regdelete " +"regenumkey regenumval regread regwrite round run runas runaswait runwait send sendkeepactive " +"seterror setextended shellexecute shellexecutewait shutdown sin sleep soundplay soundsetwavevolume " +"splashimageon splashoff splashtexton sqrt srandom statusbargettext stderrread stdinwrite " +"stdioclose stdoutread string stringaddcr stringcompare stringformat stringfromasciiarray stringinstr " +"stringisalnum stringisalpha stringisascii stringisdigit stringisfloat stringisint stringislower " +"stringisspace stringisupper stringisxdigit stringleft stringlen stringlower stringmid " +"stringregexp stringregexpreplace stringreplace stringright stringsplit stringstripcr stringstripws " +"stringtoasciiarray stringtobinary stringtrimleft stringtrimright stringupper tan tcpaccept " +"tcpclosesocket tcpconnect tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup " +"timerdiff timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete " +"trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent trayitemsetstate " +"trayitemsettext traysetclick trayseticon traysetonevent traysetpauseicon traysetstate " +"traysettooltip traytip ubound udpbind udpclosesocket udpopen udprecv udpsend udpshutdown " +"udpstartup vargettype winactivate winactive winclose winexists winflash wingetcaretpos " +"wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess wingetstate " +"wingettext wingettitle winkill winlist winmenuselectitem winminimizeall winminimizeallundo " +"winmove winsetontop winsetstate winsettitle winsettrans winwait winwaitactive winwaitclose " +"winwaitnotactive", +"@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitunicode @autoitversion @autoitx64 " +"@com_eventobj @commonfilesdir @compiled @computername @comspec @cpuarch @cr @crlf @desktopcommondir " +"@desktopdepth @desktopdir @desktopheight @desktoprefresh @desktopwidth @documentscommondir " +"@error @exitcode @exitmethod @extended @favoritescommondir @favoritesdir @gui_ctrlhandle " +"@gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid @gui_winhandle @homedrive @homepath @homeshare " +"@hotkeypressed @hour @inetgetactive @inetgetbytesread @ipaddress1 @ipaddress2 @ipaddress3 " +"@ipaddress4 @kblayout @lf @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang " +"@mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype @osversion @programfilesdir " +"@programscommondir @programsdir @scriptdir @scriptfullpath @scriptlinenumber @scriptname @sec " +"@startmenucommondir @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide @sw_lock " +"@sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault @sw_showmaximized @sw_showminimized " +"@sw_showminnoactive @sw_showna @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir " +"@tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday @windowsdir " +"@workingdir @yday @year", +"{!} {#} {^} {{} {}} {+} {alt} {altdown} {altup} {appskey} " +"{asc} {backspace} {break} {browser_back} {browser_favorites} {browser_forward} {browser_home} " +"{browser_refresh} {browser_search} {browser_stop} {bs} {capslock} {ctrldown} {ctrlup} " +"{del} {delete} {down} {end} {enter} {esc} {escape} {f1} {f10} {f11} {f12} {f2} {f3} " +"{f4} {f5} {f6} {f7} {f8} {f9} {home} {ins} {insert} {lalt} {launch_app1} {launch_app2} " +"{launch_mail} {launch_media} {lctrl} {left} {lshift} {lwin} {lwindown} {lwinup} {media_next} " +"{media_play_pause} {media_prev} {media_stop} {numlock} {numpad0} {numpad1} {numpad2} " +"{numpad3} {numpad4} {numpad5} {numpad6} {numpad7} {numpad8} {numpad9} {numpadadd} " +"{numpaddiv} {numpaddot} {numpadenter} {numpadmult} {numpadsub} {pause} {pgdn} {pgup} " +"{printscreen} {ralt} {rctrl} {right} {rshift} {rwin} {rwindown} {rwinup} {scrolllock} " +"{shiftdown} {shiftup} {sleep} {space} {tab} {up} {volume_down} {volume_mute} {volume_up}", +"#ce #comments-end #comments-start #cs #include #include-once #noautoit3execute #notrayicon " +"#onautoitstartregister #requireadmin", +"#autoit3wrapper_au3check_parameters #autoit3wrapper_au3check_stop_onwarning " +"#autoit3wrapper_change2cui #autoit3wrapper_compression #autoit3wrapper_cvswrapper_parameters " +"#autoit3wrapper_icon #autoit3wrapper_outfile #autoit3wrapper_outfile_type #autoit3wrapper_plugin_funcs " +"#autoit3wrapper_res_comment #autoit3wrapper_res_description #autoit3wrapper_res_field " +"#autoit3wrapper_res_file_add #autoit3wrapper_res_fileversion #autoit3wrapper_res_fileversion_autoincrement " +"#autoit3wrapper_res_icon_add #autoit3wrapper_res_language #autoit3wrapper_res_legalcopyright " +"#autoit3wrapper_res_requestedexecutionlevel #autoit3wrapper_res_savesource #autoit3wrapper_run_after " +"#autoit3wrapper_run_au3check #autoit3wrapper_run_before #autoit3wrapper_run_cvswrapper " +"#autoit3wrapper_run_debug_mode #autoit3wrapper_run_obfuscator #autoit3wrapper_run_tidy " +"#autoit3wrapper_tidy_stop_onerror #autoit3wrapper_useansi #autoit3wrapper_useupx " +"#autoit3wrapper_usex64 #autoit3wrapper_version #endregion #forceref #obfuscator_ignore_funcs " +"#obfuscator_ignore_variables #obfuscator_parameters #region #tidy_parameters", +"", // Reserved for expand +"_arrayadd _arraybinarysearch _arraycombinations _arrayconcatenate _arraydelete _arraydisplay _arrayfindall " +"_arrayinsert _arraymax _arraymaxindex _arraymin _arrayminindex _arraypermute _arraypop _arraypush " +"_arrayreverse _arraysearch _arraysort _arrayswap _arraytoclip _arraytostring _arraytrim _arrayunique _assert " +"_choosecolor _choosefont _clipboard_changechain _clipboard_close _clipboard _countformats _clipboard_empty " +"_clipboard_enumformats _clipboard_formatstr _clipboard_getdata _clipboard_getdataex _clipboard_getformatname " +"_clipboard_getopenwindow _clipboard_getowner _clipboard_getpriorityformat _clipboard_getsequencenumber " +"_clipboard_getviewer _clipboard_isformatavailable _clipboard_open _clipboard_registerformat " +"_clipboard_setdata _clipboard_setdataex _clipboard_setviewer _clipputfile _colorconverthsltorgb " +"_colorconvertrgbtohsl _colorgetblue _colorgetcolorref _colorgetgreen _colorgetred _colorgetrgb " +"_colorsetcolorref _colorsetrgb _crypt_decryptdata _crypt_decryptfile _crypt_derivekey _crypt_destroykey " +"_crypt_encryptdata _crypt_encryptfile _crypt_hashdata _crypt_hashfile _crypt_shutdown _crypt_startup " +"_date_time_comparefiletime _date_time_dosdatetimetoarray _date_time_dosdatetimetofiletime " +"_date_time_dosdatetimetostr _date_time_dosdatetoarray _date_time_dosdatetostr _date_time_dostimetoarray " +"_date_time_dostimetostr _date_time_encodefiletime _date_time_encodesystemtime _date_time_filetimetoarray " +"_date_time_filetimetodosdatetime _date_time_filetimetolocalfiletime _date_time_filetimetostr " +"_date_time_filetimetosystemtime _date_time_getfiletime _date_time_getlocaltime _date_time_getsystemtime " +"_date_time_getsystemtimeadjustment _date_time_getsystemtimeasfiletime _date_time_getsystemtimes " +"_date_time_gettickcount _date_time_gettimezoneinformation _date_time_localfiletimetofiletime " +"_date_time_setfiletime _date_time_setlocaltime _date_time_setsystemtime _date_time_setsystemtimeadjustment " +"_date_time_settimezoneinformation _date_time_systemtimetoarray _date_time_systemtimetodatestr " +"_date_time_systemtimetodatetimestr _date_time_systemtimetofiletime _date_time_systemtimetotimestr " +"_date_time_systemtimetotzspecificlocaltime _date_time_tzspecificlocaltimetosystemtime _dateadd " +"_datedayofweek _datedaysinmonth _datediff _dateisleapyear _dateisvalid _datetimeformat _datetimesplit " +"_datetodayofweek _datetodayofweekiso _datetodayvalue _datetomonth _dayvaluetodate _debugbugreportenv " +"_debugout _debugreport _debugreportex _debugreportvar _debugsetup _degree _eventlog__backup _eventlog__clear " +"_eventlog__close _eventlog__count _eventlog__deregistersource _eventlog__full _eventlog__notify " +"_eventlog__oldest _eventlog__open _eventlog__openbackup _eventlog__read _eventlog__registersource " +"_eventlog__report _excelbookattach _excelbookclose _excelbooknew _excelbookopen _excelbooksave " +"_excelbooksaveas _excelcolumndelete _excelcolumninsert _excelfontsetproperties _excelhorizontalalignset " +"_excelhyperlinkinsert _excelnumberformat _excelreadarray _excelreadcell _excelreadsheettoarray " +"_excelrowdelete _excelrowinsert _excelsheetactivate _excelsheetaddnew _excelsheetdelete _excelsheetlist " +"_excelsheetmove _excelsheetnameget _excelsheetnameset _excelwritearray _excelwritecell _excelwriteformula " +"_excelwritesheetfromarray _filecountlines _filecreate _filelisttoarray _fileprint _filereadtoarray " +"_filewritefromarray _filewritelog _filewritetoline _ftp_close _ftp_command _ftp_connect " +"_ftp_decodeinternetstatus _ftp_dircreate _ftp_dirdelete _ftp_dirgetcurrent _ftp_dirputcontents " +"_ftp_dirsetcurrent _ftp_fileclose _ftp_filedelete _ftp_fileget _ftp_filegetsize _ftp_fileopen _ftp_fileput " +"_ftp_fileread _ftp_filerename _ftp_filetimelohitostr _ftp_findfileclose _ftp_findfilefirst _ftp_findfilenext " +"_ftp_getlastresponseinfo _ftp_listtoarray _ftp_listtoarray2d _ftp_listtoarrayex _ftp_open " +"_ftp_progressdownload _ftp_progressupload _ftp_setstatuscallback _gdiplus_arrowcapcreate " +"_gdiplus_arrowcapdispose _gdiplus_arrowcapgetfillstate _gdiplus_arrowcapgetheight " +"_gdiplus_arrowcapgetmiddleinset _gdiplus_arrowcapgetwidth _gdiplus_arrowcapsetfillstate " +"_gdiplus_arrowcapsetheight _gdiplus_arrowcapsetmiddleinset _gdiplus_arrowcapsetwidth " +"_gdiplus_bitmapclonearea _gdiplus_bitmapcreatefromfile _gdiplus_bitmapcreatefromgraphics " +"_gdiplus_bitmapcreatefromhbitmap _gdiplus_bitmapcreatehbitmapfrombitmap _gdiplus_bitmapdispose " +"_gdiplus_bitmaplockbits _gdiplus_bitmapunlockbits _gdiplus_brushclone _gdiplus_brushcreatesolid " +"_gdiplus_brushdispose _gdiplus_brushgetsolidcolor _gdiplus_brushgettype _gdiplus_brushsetsolidcolor " +"_gdiplus_customlinecapdispose _gdiplus_decoders _gdiplus_decodersgetcount _gdiplus_decodersgetsize " +"_gdiplus_drawimagepoints _gdiplus_encoders _gdiplus_encodersgetclsid _gdiplus_encodersgetcount " +"_gdiplus_encodersgetparamlist _gdiplus_encodersgetparamlistsize _gdiplus_encodersgetsize _gdiplus_fontcreate " +"_gdiplus_fontdispose _gdiplus_fontfamilycreate _gdiplus_fontfamilydispose _gdiplus_graphicsclear " +"_gdiplus_graphicscreatefromhdc _gdiplus_graphicscreatefromhwnd _gdiplus_graphicsdispose " +"_gdiplus_graphicsdrawarc _gdiplus_graphicsdrawbezier _gdiplus_graphicsdrawclosedcurve " +"_gdiplus_graphicsdrawcurve _gdiplus_graphicsdrawellipse _gdiplus_graphicsdrawimage " +"_gdiplus_graphicsdrawimagerect _gdiplus_graphicsdrawimagerectrect _gdiplus_graphicsdrawline " +"_gdiplus_graphicsdrawpie _gdiplus_graphicsdrawpolygon _gdiplus_graphicsdrawrect _gdiplus_graphicsdrawstring " +"_gdiplus_graphicsdrawstringex _gdiplus_graphicsfillclosedcurve _gdiplus_graphicsfillellipse " +"_gdiplus_graphicsfillpie _gdiplus_graphicsfillpolygon _gdiplus_graphicsfillrect _gdiplus_graphicsgetdc " +"_gdiplus_graphicsgetsmoothingmode _gdiplus_graphicsmeasurestring _gdiplus_graphicsreleasedc " +"_gdiplus_graphicssetsmoothingmode _gdiplus_graphicssettransform _gdiplus_imagedispose _gdiplus_imagegetflags " +"_gdiplus_imagegetgraphicscontext _gdiplus_imagegetheight _gdiplus_imagegethorizontalresolution " +"_gdiplus_imagegetpixelformat _gdiplus_imagegetrawformat _gdiplus_imagegettype " +"_gdiplus_imagegetverticalresolution _gdiplus_imagegetwidth _gdiplus_imageloadfromfile " +"_gdiplus_imagesavetofile _gdiplus_imagesavetofileex _gdiplus_matrixcreate _gdiplus_matrixdispose " +"_gdiplus_matrixrotate _gdiplus_matrixscale _gdiplus_matrixtranslate _gdiplus_paramadd _gdiplus_paraminit " +"_gdiplus_pencreate _gdiplus_pendispose _gdiplus_pengetalignment _gdiplus_pengetcolor " +"_gdiplus_pengetcustomendcap _gdiplus_pengetdashcap _gdiplus_pengetdashstyle _gdiplus_pengetendcap " +"_gdiplus_pengetwidth _gdiplus_pensetalignment _gdiplus_pensetcolor _gdiplus_pensetcustomendcap " +"_gdiplus_pensetdashcap _gdiplus_pensetdashstyle _gdiplus_pensetendcap _gdiplus_pensetwidth " +"_gdiplus_rectfcreate _gdiplus_shutdown _gdiplus_startup _gdiplus_stringformatcreate " +"_gdiplus_stringformatdispose _gdiplus_stringformatsetalign _getip _guictrlavi_close _guictrlavi_create " +"_guictrlavi_destroy _guictrlavi_isplaying _guictrlavi_open _guictrlavi_openex _guictrlavi_play " +"_guictrlavi_seek _guictrlavi_show _guictrlavi_stop _guictrlbutton_click _guictrlbutton_create " +"_guictrlbutton_destroy _guictrlbutton_enable _guictrlbutton_getcheck _guictrlbutton_getfocus " +"_guictrlbutton_getidealsize _guictrlbutton_getimage _guictrlbutton_getimagelist _guictrlbutton_getnote " +"_guictrlbutton_getnotelength _guictrlbutton_getsplitinfo _guictrlbutton_getstate _guictrlbutton_gettext " +"_guictrlbutton_gettextmargin _guictrlbutton_setcheck _guictrlbutton_setdontclick _guictrlbutton_setfocus " +"_guictrlbutton_setimage _guictrlbutton_setimagelist _guictrlbutton_setnote _guictrlbutton_setshield " +"_guictrlbutton_setsize _guictrlbutton_setsplitinfo _guictrlbutton_setstate _guictrlbutton_setstyle " +"_guictrlbutton_settext _guictrlbutton_settextmargin _guictrlbutton_show _guictrlcombobox_adddir " +"_guictrlcombobox_addstring _guictrlcombobox_autocomplete _guictrlcombobox_beginupdate " +"_guictrlcombobox_create _guictrlcombobox_deletestring _guictrlcombobox_destroy _guictrlcombobox_endupdate " +"_guictrlcombobox_findstring _guictrlcombobox_findstringexact _guictrlcombobox_getcomboboxinfo " +"_guictrlcombobox_getcount _guictrlcombobox_getcuebanner _guictrlcombobox_getcursel " +"_guictrlcombobox_getdroppedcontrolrect _guictrlcombobox_getdroppedcontrolrectex " +"_guictrlcombobox_getdroppedstate _guictrlcombobox_getdroppedwidth _guictrlcombobox_geteditsel " +"_guictrlcombobox_getedittext _guictrlcombobox_getextendedui _guictrlcombobox_gethorizontalextent " +"_guictrlcombobox_getitemheight _guictrlcombobox_getlbtext _guictrlcombobox_getlbtextlen " +"_guictrlcombobox_getlist _guictrlcombobox_getlistarray _guictrlcombobox_getlocale " +"_guictrlcombobox_getlocalecountry _guictrlcombobox_getlocalelang _guictrlcombobox_getlocaleprimlang " +"_guictrlcombobox_getlocalesublang _guictrlcombobox_getminvisible _guictrlcombobox_gettopindex " +"_guictrlcombobox_initstorage _guictrlcombobox_insertstring _guictrlcombobox_limittext " +"_guictrlcombobox_replaceeditsel _guictrlcombobox_resetcontent _guictrlcombobox_selectstring " +"_guictrlcombobox_setcuebanner _guictrlcombobox_setcursel _guictrlcombobox_setdroppedwidth " +"_guictrlcombobox_seteditsel _guictrlcombobox_setedittext _guictrlcombobox_setextendedui " +"_guictrlcombobox_sethorizontalextent _guictrlcombobox_setitemheight _guictrlcombobox_setminvisible " +"_guictrlcombobox_settopindex _guictrlcombobox_showdropdown _guictrlcomboboxex_adddir " +"_guictrlcomboboxex_addstring _guictrlcomboboxex_beginupdate _guictrlcomboboxex_create " +"_guictrlcomboboxex_createsolidbitmap _guictrlcomboboxex_deletestring _guictrlcomboboxex_destroy " +"_guictrlcomboboxex_endupdate _guictrlcomboboxex_findstringexact _guictrlcomboboxex_getcomboboxinfo " +"_guictrlcomboboxex_getcombocontrol _guictrlcomboboxex_getcount _guictrlcomboboxex_getcursel " +"_guictrlcomboboxex_getdroppedcontrolrect _guictrlcomboboxex_getdroppedcontrolrectex " +"_guictrlcomboboxex_getdroppedstate _guictrlcomboboxex_getdroppedwidth _guictrlcomboboxex_geteditcontrol " +"_guictrlcomboboxex_geteditsel _guictrlcomboboxex_getedittext _guictrlcomboboxex_getextendedstyle " +"_guictrlcomboboxex_getextendedui _guictrlcomboboxex_getimagelist _guictrlcomboboxex_getitem " +"_guictrlcomboboxex_getitemex _guictrlcomboboxex_getitemheight _guictrlcomboboxex_getitemimage " +"_guictrlcomboboxex_getitemindent _guictrlcomboboxex_getitemoverlayimage _guictrlcomboboxex_getitemparam " +"_guictrlcomboboxex_getitemselectedimage _guictrlcomboboxex_getitemtext _guictrlcomboboxex_getitemtextlen " +"_guictrlcomboboxex_getlist _guictrlcomboboxex_getlistarray _guictrlcomboboxex_getlocale " +"_guictrlcomboboxex_getlocalecountry _guictrlcomboboxex_getlocalelang _guictrlcomboboxex_getlocaleprimlang " +"_guictrlcomboboxex_getlocalesublang _guictrlcomboboxex_getminvisible _guictrlcomboboxex_gettopindex " +"_guictrlcomboboxex_getunicode _guictrlcomboboxex_initstorage _guictrlcomboboxex_insertstring " +"_guictrlcomboboxex_limittext _guictrlcomboboxex_replaceeditsel _guictrlcomboboxex_resetcontent " +"_guictrlcomboboxex_setcursel _guictrlcomboboxex_setdroppedwidth _guictrlcomboboxex_seteditsel " +"_guictrlcomboboxex_setedittext _guictrlcomboboxex_setextendedstyle _guictrlcomboboxex_setextendedui " +"_guictrlcomboboxex_setimagelist _guictrlcomboboxex_setitem _guictrlcomboboxex_setitemex " +"_guictrlcomboboxex_setitemheight _guictrlcomboboxex_setitemimage _guictrlcomboboxex_setitemindent " +"_guictrlcomboboxex_setitemoverlayimage _guictrlcomboboxex_setitemparam " +"_guictrlcomboboxex_setitemselectedimage _guictrlcomboboxex_setminvisible _guictrlcomboboxex_settopindex " +"_guictrlcomboboxex_setunicode _guictrlcomboboxex_showdropdown _guictrldtp_create _guictrldtp_destroy " +"_guictrldtp_getmccolor _guictrldtp_getmcfont _guictrldtp_getmonthcal _guictrldtp_getrange " +"_guictrldtp_getrangeex _guictrldtp_getsystemtime _guictrldtp_getsystemtimeex _guictrldtp_setformat " +"_guictrldtp_setmccolor _guictrldtp_setmcfont _guictrldtp_setrange _guictrldtp_setrangeex " +"_guictrldtp_setsystemtime _guictrldtp_setsystemtimeex _guictrledit_appendtext _guictrledit_beginupdate " +"_guictrledit_canundo _guictrledit_charfrompos _guictrledit_create _guictrledit_destroy " +"_guictrledit_emptyundobuffer _guictrledit_endupdate _guictrledit_find _guictrledit_fmtlines " +"_guictrledit_getfirstvisibleline _guictrledit_getlimittext _guictrledit_getline _guictrledit_getlinecount " +"_guictrledit_getmargins _guictrledit_getmodify _guictrledit_getpasswordchar _guictrledit_getrect " +"_guictrledit_getrectex _guictrledit_getsel _guictrledit_gettext _guictrledit_gettextlen " +"_guictrledit_hideballoontip _guictrledit_inserttext _guictrledit_linefromchar _guictrledit_lineindex " +"_guictrledit_linelength _guictrledit_linescroll _guictrledit_posfromchar _guictrledit_replacesel " +"_guictrledit_scroll _guictrledit_setlimittext _guictrledit_setmargins _guictrledit_setmodify " +"_guictrledit_setpasswordchar _guictrledit_setreadonly _guictrledit_setrect _guictrledit_setrectex " +"_guictrledit_setrectnp _guictrledit_setrectnpex _guictrledit_setsel _guictrledit_settabstops " +"_guictrledit_settext _guictrledit_showballoontip _guictrledit_undo _guictrlheader_additem " +"_guictrlheader_clearfilter _guictrlheader_clearfilterall _guictrlheader_create " +"_guictrlheader_createdragimage _guictrlheader_deleteitem _guictrlheader_destroy _guictrlheader_editfilter " +"_guictrlheader_getbitmapmargin _guictrlheader_getimagelist _guictrlheader_getitem " +"_guictrlheader_getitemalign _guictrlheader_getitembitmap _guictrlheader_getitemcount " +"_guictrlheader_getitemdisplay _guictrlheader_getitemflags _guictrlheader_getitemformat " +"_guictrlheader_getitemimage _guictrlheader_getitemorder _guictrlheader_getitemparam " +"_guictrlheader_getitemrect _guictrlheader_getitemrectex _guictrlheader_getitemtext " +"_guictrlheader_getitemwidth _guictrlheader_getorderarray _guictrlheader_getunicodeformat " +"_guictrlheader_hittest _guictrlheader_insertitem _guictrlheader_layout _guictrlheader_ordertoindex " +"_guictrlheader_setbitmapmargin _guictrlheader_setfilterchangetimeout _guictrlheader_sethotdivider " +"_guictrlheader_setimagelist _guictrlheader_setitem _guictrlheader_setitemalign " +"_guictrlheader_setitembitmap _guictrlheader_setitemdisplay _guictrlheader_setitemflags " +"_guictrlheader_setitemformat _guictrlheader_setitemimage _guictrlheader_setitemorder " +"_guictrlheader_setitemparam _guictrlheader_setitemtext _guictrlheader_setitemwidth " +"_guictrlheader_setorderarray _guictrlheader_setunicodeformat _guictrlipaddress_clearaddress " +"_guictrlipaddress_create _guictrlipaddress_destroy _guictrlipaddress_get _guictrlipaddress_getarray " +"_guictrlipaddress_getex _guictrlipaddress_isblank _guictrlipaddress_set _guictrlipaddress_setarray " +"_guictrlipaddress_setex _guictrlipaddress_setfocus _guictrlipaddress_setfont _guictrlipaddress_setrange " +"_guictrlipaddress_showhide _guictrllistbox_addfile _guictrllistbox_addstring _guictrllistbox_beginupdate " +"_guictrllistbox_clickitem _guictrllistbox_create _guictrllistbox_deletestring _guictrllistbox_destroy " +"_guictrllistbox_dir _guictrllistbox_endupdate _guictrllistbox_findintext _guictrllistbox_findstring " +"_guictrllistbox_getanchorindex _guictrllistbox_getcaretindex _guictrllistbox_getcount " +"_guictrllistbox_getcursel _guictrllistbox_gethorizontalextent _guictrllistbox_getitemdata " +"_guictrllistbox_getitemheight _guictrllistbox_getitemrect _guictrllistbox_getitemrectex " +"_guictrllistbox_getlistboxinfo _guictrllistbox_getlocale _guictrllistbox_getlocalecountry " +"_guictrllistbox_getlocalelang _guictrllistbox_getlocaleprimlang _guictrllistbox_getlocalesublang " +"_guictrllistbox_getsel _guictrllistbox_getselcount _guictrllistbox_getselitems " +"_guictrllistbox_getselitemstext _guictrllistbox_gettext _guictrllistbox_gettextlen " +"_guictrllistbox_gettopindex _guictrllistbox_initstorage _guictrllistbox_insertstring " +"_guictrllistbox_itemfrompoint _guictrllistbox_replacestring _guictrllistbox_resetcontent " +"_guictrllistbox_selectstring _guictrllistbox_selitemrange _guictrllistbox_selitemrangeex " +"_guictrllistbox_setanchorindex _guictrllistbox_setcaretindex _guictrllistbox_setcolumnwidth " +"_guictrllistbox_setcursel _guictrllistbox_sethorizontalextent _guictrllistbox_setitemdata " +"_guictrllistbox_setitemheight _guictrllistbox_setlocale _guictrllistbox_setsel _guictrllistbox_settabstops " +"_guictrllistbox_settopindex _guictrllistbox_sort _guictrllistbox_swapstring _guictrllistbox_updatehscroll " +"_guictrllistview_addarray _guictrllistview_addcolumn _guictrllistview_additem _guictrllistview_addsubitem " +"_guictrllistview_approximateviewheight _guictrllistview_approximateviewrect " +"_guictrllistview_approximateviewwidth _guictrllistview_arrange _guictrllistview_beginupdate " +"_guictrllistview_canceleditlabel _guictrllistview_clickitem _guictrllistview_copyitems " +"_guictrllistview_create _guictrllistview_createdragimage _guictrllistview_createsolidbitmap " +"_guictrllistview_deleteallitems _guictrllistview_deletecolumn _guictrllistview_deleteitem " +"_guictrllistview_deleteitemsselected _guictrllistview_destroy _guictrllistview_drawdragimage " +"_guictrllistview_editlabel _guictrllistview_enablegroupview _guictrllistview_endupdate " +"_guictrllistview_ensurevisible _guictrllistview_findintext _guictrllistview_finditem " +"_guictrllistview_findnearest _guictrllistview_findparam _guictrllistview_findtext " +"_guictrllistview_getbkcolor _guictrllistview_getbkimage _guictrllistview_getcallbackmask " +"_guictrllistview_getcolumn _guictrllistview_getcolumncount _guictrllistview_getcolumnorder " +"_guictrllistview_getcolumnorderarray _guictrllistview_getcolumnwidth _guictrllistview_getcounterpage " +"_guictrllistview_geteditcontrol _guictrllistview_getextendedlistviewstyle _guictrllistview_getfocusedgroup " +"_guictrllistview_getgroupcount _guictrllistview_getgroupinfo _guictrllistview_getgroupinfobyindex " +"_guictrllistview_getgrouprect _guictrllistview_getgroupviewenabled _guictrllistview_getheader " +"_guictrllistview_gethotcursor _guictrllistview_gethotitem _guictrllistview_gethovertime " +"_guictrllistview_getimagelist _guictrllistview_getisearchstring _guictrllistview_getitem " +"_guictrllistview_getitemchecked _guictrllistview_getitemcount _guictrllistview_getitemcut " +"_guictrllistview_getitemdrophilited _guictrllistview_getitemex _guictrllistview_getitemfocused " +"_guictrllistview_getitemgroupid _guictrllistview_getitemimage _guictrllistview_getitemindent " +"_guictrllistview_getitemparam _guictrllistview_getitemposition _guictrllistview_getitempositionx " +"_guictrllistview_getitempositiony _guictrllistview_getitemrect _guictrllistview_getitemrectex " +"_guictrllistview_getitemselected _guictrllistview_getitemspacing _guictrllistview_getitemspacingx " +"_guictrllistview_getitemspacingy _guictrllistview_getitemstate _guictrllistview_getitemstateimage " +"_guictrllistview_getitemtext _guictrllistview_getitemtextarray _guictrllistview_getitemtextstring " +"_guictrllistview_getnextitem _guictrllistview_getnumberofworkareas _guictrllistview_getorigin " +"_guictrllistview_getoriginx _guictrllistview_getoriginy _guictrllistview_getoutlinecolor " +"_guictrllistview_getselectedcolumn _guictrllistview_getselectedcount _guictrllistview_getselectedindices " +"_guictrllistview_getselectionmark _guictrllistview_getstringwidth _guictrllistview_getsubitemrect " +"_guictrllistview_gettextbkcolor _guictrllistview_gettextcolor _guictrllistview_gettooltips " +"_guictrllistview_gettopindex _guictrllistview_getunicodeformat _guictrllistview_getview " +"_guictrllistview_getviewdetails _guictrllistview_getviewlarge _guictrllistview_getviewlist " +"_guictrllistview_getviewrect _guictrllistview_getviewsmall _guictrllistview_getviewtile " +"_guictrllistview_hidecolumn _guictrllistview_hittest _guictrllistview_insertcolumn " +"_guictrllistview_insertgroup _guictrllistview_insertitem _guictrllistview_justifycolumn " +"_guictrllistview_mapidtoindex _guictrllistview_mapindextoid _guictrllistview_redrawitems " +"_guictrllistview_registersortcallback _guictrllistview_removeallgroups _guictrllistview_removegroup " +"_guictrllistview_scroll _guictrllistview_setbkcolor _guictrllistview_setbkimage " +"_guictrllistview_setcallbackmask _guictrllistview_setcolumn _guictrllistview_setcolumnorder " +"_guictrllistview_setcolumnorderarray _guictrllistview_setcolumnwidth " +"_guictrllistview_setextendedlistviewstyle _guictrllistview_setgroupinfo _guictrllistview_sethotitem " +"_guictrllistview_sethovertime _guictrllistview_seticonspacing _guictrllistview_setimagelist " +"_guictrllistview_setitem _guictrllistview_setitemchecked _guictrllistview_setitemcount " +"_guictrllistview_setitemcut _guictrllistview_setitemdrophilited _guictrllistview_setitemex " +"_guictrllistview_setitemfocused _guictrllistview_setitemgroupid _guictrllistview_setitemimage " +"_guictrllistview_setitemindent _guictrllistview_setitemparam _guictrllistview_setitemposition " +"_guictrllistview_setitemposition32 _guictrllistview_setitemselected _guictrllistview_setitemstate " +"_guictrllistview_setitemstateimage _guictrllistview_setitemtext _guictrllistview_setoutlinecolor " +"_guictrllistview_setselectedcolumn _guictrllistview_setselectionmark _guictrllistview_settextbkcolor " +"_guictrllistview_settextcolor _guictrllistview_settooltips _guictrllistview_setunicodeformat " +"_guictrllistview_setview _guictrllistview_setworkareas _guictrllistview_simplesort " +"_guictrllistview_sortitems _guictrllistview_subitemhittest _guictrllistview_unregistersortcallback " +"_guictrlmenu_addmenuitem _guictrlmenu_appendmenu _guictrlmenu_checkmenuitem _guictrlmenu_checkradioitem " +"_guictrlmenu_createmenu _guictrlmenu_createpopup _guictrlmenu_deletemenu _guictrlmenu_destroymenu " +"_guictrlmenu_drawmenubar _guictrlmenu_enablemenuitem _guictrlmenu_finditem _guictrlmenu_findparent " +"_guictrlmenu_getitembmp _guictrlmenu_getitembmpchecked _guictrlmenu_getitembmpunchecked " +"_guictrlmenu_getitemchecked _guictrlmenu_getitemcount _guictrlmenu_getitemdata _guictrlmenu_getitemdefault " +"_guictrlmenu_getitemdisabled _guictrlmenu_getitemenabled _guictrlmenu_getitemgrayed " +"_guictrlmenu_getitemhighlighted _guictrlmenu_getitemid _guictrlmenu_getiteminfo _guictrlmenu_getitemrect " +"_guictrlmenu_getitemrectex _guictrlmenu_getitemstate _guictrlmenu_getitemstateex " +"_guictrlmenu_getitemsubmenu _guictrlmenu_getitemtext _guictrlmenu_getitemtype _guictrlmenu_getmenu " +"_guictrlmenu_getmenubackground _guictrlmenu_getmenubarinfo _guictrlmenu_getmenucontexthelpid " +"_guictrlmenu_getmenudata _guictrlmenu_getmenudefaultitem _guictrlmenu_getmenuheight " +"_guictrlmenu_getmenuinfo _guictrlmenu_getmenustyle _guictrlmenu_getsystemmenu _guictrlmenu_insertmenuitem " +"_guictrlmenu_insertmenuitemex _guictrlmenu_ismenu _guictrlmenu_loadmenu _guictrlmenu_mapaccelerator " +"_guictrlmenu_menuitemfrompoint _guictrlmenu_removemenu _guictrlmenu_setitembitmaps _guictrlmenu_setitembmp " +"_guictrlmenu_setitembmpchecked _guictrlmenu_setitembmpunchecked _guictrlmenu_setitemchecked " +"_guictrlmenu_setitemdata _guictrlmenu_setitemdefault _guictrlmenu_setitemdisabled " +"_guictrlmenu_setitemenabled _guictrlmenu_setitemgrayed _guictrlmenu_setitemhighlighted " +"_guictrlmenu_setitemid _guictrlmenu_setiteminfo _guictrlmenu_setitemstate _guictrlmenu_setitemsubmenu " +"_guictrlmenu_setitemtext _guictrlmenu_setitemtype _guictrlmenu_setmenu _guictrlmenu_setmenubackground " +"_guictrlmenu_setmenucontexthelpid _guictrlmenu_setmenudata _guictrlmenu_setmenudefaultitem " +"_guictrlmenu_setmenuheight _guictrlmenu_setmenuinfo _guictrlmenu_setmenustyle _guictrlmenu_trackpopupmenu " +"_guictrlmonthcal_create _guictrlmonthcal_destroy _guictrlmonthcal_getcalendarborder " +"_guictrlmonthcal_getcalendarcount _guictrlmonthcal_getcolor _guictrlmonthcal_getcolorarray " +"_guictrlmonthcal_getcursel _guictrlmonthcal_getcurselstr _guictrlmonthcal_getfirstdow " +"_guictrlmonthcal_getfirstdowstr _guictrlmonthcal_getmaxselcount _guictrlmonthcal_getmaxtodaywidth " +"_guictrlmonthcal_getminreqheight _guictrlmonthcal_getminreqrect _guictrlmonthcal_getminreqrectarray " +"_guictrlmonthcal_getminreqwidth _guictrlmonthcal_getmonthdelta _guictrlmonthcal_getmonthrange " +"_guictrlmonthcal_getmonthrangemax _guictrlmonthcal_getmonthrangemaxstr _guictrlmonthcal_getmonthrangemin " +"_guictrlmonthcal_getmonthrangeminstr _guictrlmonthcal_getmonthrangespan _guictrlmonthcal_getrange " +"_guictrlmonthcal_getrangemax _guictrlmonthcal_getrangemaxstr _guictrlmonthcal_getrangemin " +"_guictrlmonthcal_getrangeminstr _guictrlmonthcal_getselrange _guictrlmonthcal_getselrangemax " +"_guictrlmonthcal_getselrangemaxstr _guictrlmonthcal_getselrangemin _guictrlmonthcal_getselrangeminstr " +"_guictrlmonthcal_gettoday _guictrlmonthcal_gettodaystr _guictrlmonthcal_getunicodeformat " +"_guictrlmonthcal_hittest _guictrlmonthcal_setcalendarborder _guictrlmonthcal_setcolor " +"_guictrlmonthcal_setcursel _guictrlmonthcal_setdaystate _guictrlmonthcal_setfirstdow " +"_guictrlmonthcal_setmaxselcount _guictrlmonthcal_setmonthdelta _guictrlmonthcal_setrange " +"_guictrlmonthcal_setselrange _guictrlmonthcal_settoday _guictrlmonthcal_setunicodeformat " +"_guictrlrebar_addband _guictrlrebar_addtoolbarband _guictrlrebar_begindrag _guictrlrebar_create " +"_guictrlrebar_deleteband _guictrlrebar_destroy _guictrlrebar_dragmove _guictrlrebar_enddrag " +"_guictrlrebar_getbandbackcolor _guictrlrebar_getbandborders _guictrlrebar_getbandbordersex " +"_guictrlrebar_getbandchildhandle _guictrlrebar_getbandchildsize _guictrlrebar_getbandcount " +"_guictrlrebar_getbandforecolor _guictrlrebar_getbandheadersize _guictrlrebar_getbandid " +"_guictrlrebar_getbandidealsize _guictrlrebar_getbandlength _guictrlrebar_getbandlparam " +"_guictrlrebar_getbandmargins _guictrlrebar_getbandmarginsex _guictrlrebar_getbandrect " +"_guictrlrebar_getbandrectex _guictrlrebar_getbandstyle _guictrlrebar_getbandstylebreak " +"_guictrlrebar_getbandstylechildedge _guictrlrebar_getbandstylefixedbmp _guictrlrebar_getbandstylefixedsize " +"_guictrlrebar_getbandstylegripperalways _guictrlrebar_getbandstylehidden " +"_guictrlrebar_getbandstylehidetitle _guictrlrebar_getbandstylenogripper _guictrlrebar_getbandstyletopalign " +"_guictrlrebar_getbandstyleusechevron _guictrlrebar_getbandstylevariableheight _guictrlrebar_getbandtext " +"_guictrlrebar_getbarheight _guictrlrebar_getbarinfo _guictrlrebar_getbkcolor _guictrlrebar_getcolorscheme " +"_guictrlrebar_getrowcount _guictrlrebar_getrowheight _guictrlrebar_gettextcolor _guictrlrebar_gettooltips " +"_guictrlrebar_getunicodeformat _guictrlrebar_hittest _guictrlrebar_idtoindex _guictrlrebar_maximizeband " +"_guictrlrebar_minimizeband _guictrlrebar_moveband _guictrlrebar_setbandbackcolor " +"_guictrlrebar_setbandforecolor _guictrlrebar_setbandheadersize _guictrlrebar_setbandid " +"_guictrlrebar_setbandidealsize _guictrlrebar_setbandlength _guictrlrebar_setbandlparam " +"_guictrlrebar_setbandstyle _guictrlrebar_setbandstylebreak _guictrlrebar_setbandstylechildedge " +"_guictrlrebar_setbandstylefixedbmp _guictrlrebar_setbandstylefixedsize " +"_guictrlrebar_setbandstylegripperalways _guictrlrebar_setbandstylehidden " +"_guictrlrebar_setbandstylehidetitle _guictrlrebar_setbandstylenogripper _guictrlrebar_setbandstyletopalign " +"_guictrlrebar_setbandstyleusechevron _guictrlrebar_setbandstylevariableheight _guictrlrebar_setbandtext " +"_guictrlrebar_setbarinfo _guictrlrebar_setbkcolor _guictrlrebar_setcolorscheme _guictrlrebar_settextcolor " +"_guictrlrebar_settooltips _guictrlrebar_setunicodeformat _guictrlrebar_showband " +"_guictrlrichedit_appendtext _guictrlrichedit_autodetecturl _guictrlrichedit_canpaste " +"_guictrlrichedit_canpastespecial _guictrlrichedit_canredo _guictrlrichedit_canundo " +"_guictrlrichedit_changefontsize _guictrlrichedit_copy _guictrlrichedit_create _guictrlrichedit_cut " +"_guictrlrichedit_deselect _guictrlrichedit_destroy _guictrlrichedit_emptyundobuffer " +"_guictrlrichedit_findtext _guictrlrichedit_findtextinrange _guictrlrichedit_getbkcolor " +"_guictrlrichedit_getcharattributes _guictrlrichedit_getcharbkcolor _guictrlrichedit_getcharcolor " +"_guictrlrichedit_getcharposfromxy _guictrlrichedit_getcharposofnextword " +"_guictrlrichedit_getcharposofpreviousword _guictrlrichedit_getcharwordbreakinfo " +"_guictrlrichedit_getfirstcharposonline _guictrlrichedit_getfont _guictrlrichedit_getlinecount " +"_guictrlrichedit_getlinelength _guictrlrichedit_getlinenumberfromcharpos _guictrlrichedit_getnextredo " +"_guictrlrichedit_getnextundo _guictrlrichedit_getnumberoffirstvisibleline " +"_guictrlrichedit_getparaalignment _guictrlrichedit_getparaattributes _guictrlrichedit_getparaborder " +"_guictrlrichedit_getparaindents _guictrlrichedit_getparanumbering _guictrlrichedit_getparashading " +"_guictrlrichedit_getparaspacing _guictrlrichedit_getparatabstops _guictrlrichedit_getpasswordchar " +"_guictrlrichedit_getrect _guictrlrichedit_getscrollpos _guictrlrichedit_getsel _guictrlrichedit_getselaa " +"_guictrlrichedit_getseltext _guictrlrichedit_getspaceunit _guictrlrichedit_gettext " +"_guictrlrichedit_gettextinline _guictrlrichedit_gettextinrange _guictrlrichedit_gettextlength " +"_guictrlrichedit_getversion _guictrlrichedit_getxyfromcharpos _guictrlrichedit_getzoom " +"_guictrlrichedit_gotocharpos _guictrlrichedit_hideselection _guictrlrichedit_inserttext " +"_guictrlrichedit_ismodified _guictrlrichedit_istextselected _guictrlrichedit_paste " +"_guictrlrichedit_pastespecial _guictrlrichedit_pauseredraw _guictrlrichedit_redo " +"_guictrlrichedit_replacetext _guictrlrichedit_resumeredraw _guictrlrichedit_scrolllineorpage " +"_guictrlrichedit_scrolllines _guictrlrichedit_scrolltocaret _guictrlrichedit_setbkcolor " +"_guictrlrichedit_setcharattributes _guictrlrichedit_setcharbkcolor _guictrlrichedit_setcharcolor " +"_guictrlrichedit_seteventmask _guictrlrichedit_setfont _guictrlrichedit_setlimitontext " +"_guictrlrichedit_setmodified _guictrlrichedit_setparaalignment _guictrlrichedit_setparaattributes " +"_guictrlrichedit_setparaborder _guictrlrichedit_setparaindents _guictrlrichedit_setparanumbering " +"_guictrlrichedit_setparashading _guictrlrichedit_setparaspacing _guictrlrichedit_setparatabstops " +"_guictrlrichedit_setpasswordchar _guictrlrichedit_setreadonly _guictrlrichedit_setrect " +"_guictrlrichedit_setscrollpos _guictrlrichedit_setsel _guictrlrichedit_setspaceunit " +"_guictrlrichedit_settabstops _guictrlrichedit_settext _guictrlrichedit_setundolimit " +"_guictrlrichedit_setzoom _guictrlrichedit_streamfromfile _guictrlrichedit_streamfromvar " +"_guictrlrichedit_streamtofile _guictrlrichedit_streamtovar _guictrlrichedit_undo _guictrlslider_clearsel " +"_guictrlslider_cleartics _guictrlslider_create _guictrlslider_destroy _guictrlslider_getbuddy " +"_guictrlslider_getchannelrect _guictrlslider_getchannelrectex _guictrlslider_getlinesize " +"_guictrlslider_getlogicaltics _guictrlslider_getnumtics _guictrlslider_getpagesize _guictrlslider_getpos " +"_guictrlslider_getrange _guictrlslider_getrangemax _guictrlslider_getrangemin _guictrlslider_getsel " +"_guictrlslider_getselend _guictrlslider_getselstart _guictrlslider_getthumblength " +"_guictrlslider_getthumbrect _guictrlslider_getthumbrectex _guictrlslider_gettic _guictrlslider_getticpos " +"_guictrlslider_gettooltips _guictrlslider_getunicodeformat _guictrlslider_setbuddy " +"_guictrlslider_setlinesize _guictrlslider_setpagesize _guictrlslider_setpos _guictrlslider_setrange " +"_guictrlslider_setrangemax _guictrlslider_setrangemin _guictrlslider_setsel _guictrlslider_setselend " +"_guictrlslider_setselstart _guictrlslider_setthumblength _guictrlslider_settic _guictrlslider_setticfreq " +"_guictrlslider_settipside _guictrlslider_settooltips _guictrlslider_setunicodeformat " +"_guictrlstatusbar_create _guictrlstatusbar_destroy _guictrlstatusbar_embedcontrol " +"_guictrlstatusbar_getborders _guictrlstatusbar_getbordershorz _guictrlstatusbar_getbordersrect " +"_guictrlstatusbar_getbordersvert _guictrlstatusbar_getcount _guictrlstatusbar_getheight " +"_guictrlstatusbar_geticon _guictrlstatusbar_getparts _guictrlstatusbar_getrect _guictrlstatusbar_getrectex " +"_guictrlstatusbar_gettext _guictrlstatusbar_gettextflags _guictrlstatusbar_gettextlength " +"_guictrlstatusbar_gettextlengthex _guictrlstatusbar_gettiptext _guictrlstatusbar_getunicodeformat " +"_guictrlstatusbar_getwidth _guictrlstatusbar_issimple _guictrlstatusbar_resize " +"_guictrlstatusbar_setbkcolor _guictrlstatusbar_seticon _guictrlstatusbar_setminheight " +"_guictrlstatusbar_setparts _guictrlstatusbar_setsimple _guictrlstatusbar_settext " +"_guictrlstatusbar_settiptext _guictrlstatusbar_setunicodeformat _guictrlstatusbar_showhide " +"_guictrltab_activatetab _guictrltab_clicktab _guictrltab_create _guictrltab_deleteallitems " +"_guictrltab_deleteitem _guictrltab_deselectall _guictrltab_destroy _guictrltab_findtab " +"_guictrltab_getcurfocus _guictrltab_getcursel _guictrltab_getdisplayrect _guictrltab_getdisplayrectex " +"_guictrltab_getextendedstyle _guictrltab_getimagelist _guictrltab_getitem _guictrltab_getitemcount " +"_guictrltab_getitemimage _guictrltab_getitemparam _guictrltab_getitemrect _guictrltab_getitemrectex " +"_guictrltab_getitemstate _guictrltab_getitemtext _guictrltab_getrowcount _guictrltab_gettooltips " +"_guictrltab_getunicodeformat _guictrltab_highlightitem _guictrltab_hittest _guictrltab_insertitem " +"_guictrltab_removeimage _guictrltab_setcurfocus _guictrltab_setcursel _guictrltab_setextendedstyle " +"_guictrltab_setimagelist _guictrltab_setitem _guictrltab_setitemimage _guictrltab_setitemparam " +"_guictrltab_setitemsize _guictrltab_setitemstate _guictrltab_setitemtext _guictrltab_setmintabwidth " +"_guictrltab_setpadding _guictrltab_settooltips _guictrltab_setunicodeformat _guictrltoolbar_addbitmap " +"_guictrltoolbar_addbutton _guictrltoolbar_addbuttonsep _guictrltoolbar_addstring " +"_guictrltoolbar_buttoncount _guictrltoolbar_checkbutton _guictrltoolbar_clickaccel " +"_guictrltoolbar_clickbutton _guictrltoolbar_clickindex _guictrltoolbar_commandtoindex " +"_guictrltoolbar_create _guictrltoolbar_customize _guictrltoolbar_deletebutton _guictrltoolbar_destroy " +"_guictrltoolbar_enablebutton _guictrltoolbar_findtoolbar _guictrltoolbar_getanchorhighlight " +"_guictrltoolbar_getbitmapflags _guictrltoolbar_getbuttonbitmap _guictrltoolbar_getbuttoninfo " +"_guictrltoolbar_getbuttoninfoex _guictrltoolbar_getbuttonparam _guictrltoolbar_getbuttonrect " +"_guictrltoolbar_getbuttonrectex _guictrltoolbar_getbuttonsize _guictrltoolbar_getbuttonstate " +"_guictrltoolbar_getbuttonstyle _guictrltoolbar_getbuttontext _guictrltoolbar_getcolorscheme " +"_guictrltoolbar_getdisabledimagelist _guictrltoolbar_getextendedstyle _guictrltoolbar_gethotimagelist " +"_guictrltoolbar_gethotitem _guictrltoolbar_getimagelist _guictrltoolbar_getinsertmark " +"_guictrltoolbar_getinsertmarkcolor _guictrltoolbar_getmaxsize _guictrltoolbar_getmetrics " +"_guictrltoolbar_getpadding _guictrltoolbar_getrows _guictrltoolbar_getstring _guictrltoolbar_getstyle " +"_guictrltoolbar_getstylealtdrag _guictrltoolbar_getstylecustomerase _guictrltoolbar_getstyleflat " +"_guictrltoolbar_getstylelist _guictrltoolbar_getstyleregisterdrop _guictrltoolbar_getstyletooltips " +"_guictrltoolbar_getstyletransparent _guictrltoolbar_getstylewrapable _guictrltoolbar_gettextrows " +"_guictrltoolbar_gettooltips _guictrltoolbar_getunicodeformat _guictrltoolbar_hidebutton " +"_guictrltoolbar_highlightbutton _guictrltoolbar_hittest _guictrltoolbar_indextocommand " +"_guictrltoolbar_insertbutton _guictrltoolbar_insertmarkhittest _guictrltoolbar_isbuttonchecked " +"_guictrltoolbar_isbuttonenabled _guictrltoolbar_isbuttonhidden _guictrltoolbar_isbuttonhighlighted " +"_guictrltoolbar_isbuttonindeterminate _guictrltoolbar_isbuttonpressed _guictrltoolbar_loadbitmap " +"_guictrltoolbar_loadimages _guictrltoolbar_mapaccelerator _guictrltoolbar_movebutton " +"_guictrltoolbar_pressbutton _guictrltoolbar_setanchorhighlight _guictrltoolbar_setbitmapsize " +"_guictrltoolbar_setbuttonbitmap _guictrltoolbar_setbuttoninfo _guictrltoolbar_setbuttoninfoex " +"_guictrltoolbar_setbuttonparam _guictrltoolbar_setbuttonsize _guictrltoolbar_setbuttonstate " +"_guictrltoolbar_setbuttonstyle _guictrltoolbar_setbuttontext _guictrltoolbar_setbuttonwidth " +"_guictrltoolbar_setcmdid _guictrltoolbar_setcolorscheme _guictrltoolbar_setdisabledimagelist " +"_guictrltoolbar_setdrawtextflags _guictrltoolbar_setextendedstyle _guictrltoolbar_sethotimagelist " +"_guictrltoolbar_sethotitem _guictrltoolbar_setimagelist _guictrltoolbar_setindent " +"_guictrltoolbar_setindeterminate _guictrltoolbar_setinsertmark _guictrltoolbar_setinsertmarkcolor " +"_guictrltoolbar_setmaxtextrows _guictrltoolbar_setmetrics _guictrltoolbar_setpadding " +"_guictrltoolbar_setparent _guictrltoolbar_setrows _guictrltoolbar_setstyle _guictrltoolbar_setstylealtdrag " +"_guictrltoolbar_setstylecustomerase _guictrltoolbar_setstyleflat _guictrltoolbar_setstylelist " +"_guictrltoolbar_setstyleregisterdrop _guictrltoolbar_setstyletooltips _guictrltoolbar_setstyletransparent " +"_guictrltoolbar_setstylewrapable _guictrltoolbar_settooltips _guictrltoolbar_setunicodeformat " +"_guictrltoolbar_setwindowtheme _guictrltreeview_add _guictrltreeview_addchild " +"_guictrltreeview_addchildfirst _guictrltreeview_addfirst _guictrltreeview_beginupdate " +"_guictrltreeview_clickitem _guictrltreeview_create _guictrltreeview_createdragimage " +"_guictrltreeview_createsolidbitmap _guictrltreeview_delete _guictrltreeview_deleteall " +"_guictrltreeview_deletechildren _guictrltreeview_destroy _guictrltreeview_displayrect " +"_guictrltreeview_displayrectex _guictrltreeview_edittext _guictrltreeview_endedit " +"_guictrltreeview_endupdate _guictrltreeview_ensurevisible _guictrltreeview_expand " +"_guictrltreeview_expandedonce _guictrltreeview_finditem _guictrltreeview_finditemex " +"_guictrltreeview_getbkcolor _guictrltreeview_getbold _guictrltreeview_getchecked " +"_guictrltreeview_getchildcount _guictrltreeview_getchildren _guictrltreeview_getcount " +"_guictrltreeview_getcut _guictrltreeview_getdroptarget _guictrltreeview_geteditcontrol " +"_guictrltreeview_getexpanded _guictrltreeview_getfirstchild _guictrltreeview_getfirstitem " +"_guictrltreeview_getfirstvisible _guictrltreeview_getfocused _guictrltreeview_getheight " +"_guictrltreeview_getimageindex _guictrltreeview_getimagelisticonhandle _guictrltreeview_getindent " +"_guictrltreeview_getinsertmarkcolor _guictrltreeview_getisearchstring _guictrltreeview_getitembyindex " +"_guictrltreeview_getitemhandle _guictrltreeview_getitemparam _guictrltreeview_getlastchild " +"_guictrltreeview_getlinecolor _guictrltreeview_getnext _guictrltreeview_getnextchild " +"_guictrltreeview_getnextsibling _guictrltreeview_getnextvisible _guictrltreeview_getnormalimagelist " +"_guictrltreeview_getparenthandle _guictrltreeview_getparentparam _guictrltreeview_getprev " +"_guictrltreeview_getprevchild _guictrltreeview_getprevsibling _guictrltreeview_getprevvisible " +"_guictrltreeview_getscrolltime _guictrltreeview_getselected _guictrltreeview_getselectedimageindex " +"_guictrltreeview_getselection _guictrltreeview_getsiblingcount _guictrltreeview_getstate " +"_guictrltreeview_getstateimageindex _guictrltreeview_getstateimagelist _guictrltreeview_gettext " +"_guictrltreeview_gettextcolor _guictrltreeview_gettooltips _guictrltreeview_gettree " +"_guictrltreeview_getunicodeformat _guictrltreeview_getvisible _guictrltreeview_getvisiblecount " +"_guictrltreeview_hittest _guictrltreeview_hittestex _guictrltreeview_hittestitem _guictrltreeview_index " +"_guictrltreeview_insertitem _guictrltreeview_isfirstitem _guictrltreeview_isparent _guictrltreeview_level " +"_guictrltreeview_selectitem _guictrltreeview_selectitembyindex _guictrltreeview_setbkcolor " +"_guictrltreeview_setbold _guictrltreeview_setchecked _guictrltreeview_setcheckedbyindex " +"_guictrltreeview_setchildren _guictrltreeview_setcut _guictrltreeview_setdroptarget " +"_guictrltreeview_setfocused _guictrltreeview_setheight _guictrltreeview_seticon " +"_guictrltreeview_setimageindex _guictrltreeview_setindent _guictrltreeview_setinsertmark " +"_guictrltreeview_setinsertmarkcolor _guictrltreeview_setitemheight _guictrltreeview_setitemparam " +"_guictrltreeview_setlinecolor _guictrltreeview_setnormalimagelist _guictrltreeview_setscrolltime " +"_guictrltreeview_setselected _guictrltreeview_setselectedimageindex _guictrltreeview_setstate " +"_guictrltreeview_setstateimageindex _guictrltreeview_setstateimagelist _guictrltreeview_settext " +"_guictrltreeview_settextcolor _guictrltreeview_settooltips _guictrltreeview_setunicodeformat " +"_guictrltreeview_sort _guiimagelist_add _guiimagelist_addbitmap _guiimagelist_addicon " +"_guiimagelist_addmasked _guiimagelist_begindrag _guiimagelist_copy _guiimagelist_create " +"_guiimagelist_destroy _guiimagelist_destroyicon _guiimagelist_dragenter _guiimagelist_dragleave " +"_guiimagelist_dragmove _guiimagelist_draw _guiimagelist_drawex _guiimagelist_duplicate " +"_guiimagelist_enddrag _guiimagelist_getbkcolor _guiimagelist_geticon _guiimagelist_geticonheight " +"_guiimagelist_geticonsize _guiimagelist_geticonsizeex _guiimagelist_geticonwidth " +"_guiimagelist_getimagecount _guiimagelist_getimageinfoex _guiimagelist_remove _guiimagelist_replaceicon " +"_guiimagelist_setbkcolor _guiimagelist_seticonsize _guiimagelist_setimagecount _guiimagelist_swap " +"_guiscrollbars_enablescrollbar _guiscrollbars_getscrollbarinfoex _guiscrollbars_getscrollbarrect " +"_guiscrollbars_getscrollbarrgstate _guiscrollbars_getscrollbarxylinebutton " +"_guiscrollbars_getscrollbarxythumbbottom _guiscrollbars_getscrollbarxythumbtop " +"_guiscrollbars_getscrollinfo _guiscrollbars_getscrollinfoex _guiscrollbars_getscrollinfomax " +"_guiscrollbars_getscrollinfomin _guiscrollbars_getscrollinfopage _guiscrollbars_getscrollinfopos " +"_guiscrollbars_getscrollinfotrackpos _guiscrollbars_getscrollpos _guiscrollbars_getscrollrange " +"_guiscrollbars_init _guiscrollbars_scrollwindow _guiscrollbars_setscrollinfo " +"_guiscrollbars_setscrollinfomax _guiscrollbars_setscrollinfomin _guiscrollbars_setscrollinfopage " +"_guiscrollbars_setscrollinfopos _guiscrollbars_setscrollrange _guiscrollbars_showscrollbar " +"_guitooltip_activate _guitooltip_addtool _guitooltip_adjustrect _guitooltip_bitstottf _guitooltip_create " +"_guitooltip_deltool _guitooltip_destroy _guitooltip_enumtools _guitooltip_getbubbleheight " +"_guitooltip_getbubblesize _guitooltip_getbubblewidth _guitooltip_getcurrenttool _guitooltip_getdelaytime " +"_guitooltip_getmargin _guitooltip_getmarginex _guitooltip_getmaxtipwidth _guitooltip_gettext " +"_guitooltip_gettipbkcolor _guitooltip_gettiptextcolor _guitooltip_gettitlebitmap _guitooltip_gettitletext " +"_guitooltip_gettoolcount _guitooltip_gettoolinfo _guitooltip_hittest _guitooltip_newtoolrect " +"_guitooltip_pop _guitooltip_popup _guitooltip_setdelaytime _guitooltip_setmargin " +"_guitooltip_setmaxtipwidth _guitooltip_settipbkcolor _guitooltip_settiptextcolor _guitooltip_settitle " +"_guitooltip_settoolinfo _guitooltip_setwindowtheme _guitooltip_toolexists _guitooltip_tooltoarray " +"_guitooltip_trackactivate _guitooltip_trackposition _guitooltip_ttftobits _guitooltip_update " +"_guitooltip_updatetiptext _hextostring _ie_example _ie_introduction _ie_versioninfo _ieaction _ieattach " +"_iebodyreadhtml _iebodyreadtext _iebodywritehtml _iecreate _iecreateembedded _iedocgetobj _iedocinserthtml " +"_iedocinserttext _iedocreadhtml _iedocwritehtml _ieerrorhandlerderegister _ieerrorhandlerregister " +"_ieerrornotify _ieformelementcheckboxselect _ieformelementgetcollection _ieformelementgetobjbyname " +"_ieformelementgetvalue _ieformelementoptionselect _ieformelementradioselect _ieformelementsetvalue " +"_ieformgetcollection _ieformgetobjbyname _ieformimageclick _ieformreset _ieformsubmit " +"_ieframegetcollection _ieframegetobjbyname _iegetobjbyid _iegetobjbyname _ieheadinserteventscript " +"_ieimgclick _ieimggetcollection _ieisframeset _ielinkclickbyindex _ielinkclickbytext _ielinkgetcollection " +"_ieloadwait _ieloadwaittimeout _ienavigate _iepropertyget _iepropertyset _iequit _ietablegetcollection " +"_ietablewritetoarray _ietagnameallgetcollection _ietagnamegetcollection _iif _inetexplorercapable " +"_inetgetsource _inetmail _inetsmtpmail _ispressed _mathcheckdiv _max _memglobalalloc _memglobalfree " +"_memgloballock _memglobalsize _memglobalunlock _memmovememory _memvirtualalloc _memvirtualallocex " +"_memvirtualfree _memvirtualfreeex _min _mousetrap _namedpipes_callnamedpipe _namedpipes_connectnamedpipe " +"_namedpipes_createnamedpipe _namedpipes_createpipe _namedpipes_disconnectnamedpipe " +"_namedpipes_getnamedpipehandlestate _namedpipes_getnamedpipeinfo _namedpipes_peeknamedpipe " +"_namedpipes_setnamedpipehandlestate _namedpipes_transactnamedpipe _namedpipes_waitnamedpipe " +"_net_share_connectionenum _net_share_fileclose _net_share_fileenum _net_share_filegetinfo " +"_net_share_permstr _net_share_resourcestr _net_share_sessiondel _net_share_sessionenum " +"_net_share_sessiongetinfo _net_share_shareadd _net_share_sharecheck _net_share_sharedel " +"_net_share_shareenum _net_share_sharegetinfo _net_share_sharesetinfo _net_share_statisticsgetsvr " +"_net_share_statisticsgetwrk _now _nowcalc _nowcalcdate _nowdate _nowtime _pathfull _pathgetrelative " +"_pathmake _pathsplit _processgetname _processgetpriority _radian _replacestringinfile _rundos " +"_screencapture_capture _screencapture_capturewnd _screencapture_saveimage _screencapture_setbmpformat " +"_screencapture_setjpgquality _screencapture_settifcolordepth _screencapture_settifcompression " +"_security__adjusttokenprivileges _security__createprocesswithtoken _security__duplicatetokenex " +"_security__getaccountsid _security__getlengthsid _security__gettokeninformation _security__impersonateself " +"_security__isvalidsid _security__lookupaccountname _security__lookupaccountsid " +"_security__lookupprivilegevalue _security__openprocesstoken _security__openthreadtoken " +"_security__openthreadtokenex _security__setprivilege _security__settokeninformation " +"_security__sidtostringsid _security__sidtypestr _security__stringsidtosid _sendmessage _sendmessagea " +"_setdate _settime _singleton _soundclose _soundlength _soundopen _soundpause _soundplay _soundpos " +"_soundresume _soundseek _soundstatus _soundstop _sqlite_changes _sqlite_close _sqlite_display2dresult " +"_sqlite_encode _sqlite_errcode _sqlite_errmsg _sqlite_escape _sqlite_exec _sqlite_fastencode " +"_sqlite_fastescape _sqlite_fetchdata _sqlite_fetchnames _sqlite_gettable _sqlite_gettable2d " +"_sqlite_lastinsertrowid _sqlite_libversion _sqlite_open _sqlite_query _sqlite_queryfinalize " +"_sqlite_queryreset _sqlite_querysinglerow _sqlite_safemode _sqlite_settimeout _sqlite_shutdown " +"_sqlite_sqliteexe _sqlite_startup _sqlite_totalchanges _stringbetween _stringencrypt _stringexplode " +"_stringinsert _stringproper _stringrepeat _stringreverse _stringtohex _tcpiptoname _tempfile _tickstotime " +"_timer_diff _timer_getidletime _timer_gettimerid _timer_init _timer_killalltimers _timer_killtimer " +"_timer_settimer _timetoticks _versioncompare _viclose _viexeccommand _vifindgpib _vigpibbusreset _vigtl " +"_viinteractivecontrol _viopen _visetattribute _visettimeout _weeknumberiso _winapi_attachconsole " +"_winapi_attachthreadinput _winapi_beep _winapi_bitblt _winapi_callnexthookex _winapi_callwindowproc " +"_winapi_clienttoscreen _winapi_closehandle _winapi_combinergn _winapi_commdlgextendederror " +"_winapi_copyicon _winapi_createbitmap _winapi_createcompatiblebitmap _winapi_createcompatibledc " +"_winapi_createevent _winapi_createfile _winapi_createfont _winapi_createfontindirect _winapi_createpen " +"_winapi_createprocess _winapi_createrectrgn _winapi_createroundrectrgn _winapi_createsolidbitmap " +"_winapi_createsolidbrush _winapi_createwindowex _winapi_defwindowproc _winapi_deletedc " +"_winapi_deleteobject _winapi_destroyicon _winapi_destroywindow _winapi_drawedge _winapi_drawframecontrol " +"_winapi_drawicon _winapi_drawiconex _winapi_drawline _winapi_drawtext _winapi_duplicatehandle " +"_winapi_enablewindow _winapi_enumdisplaydevices _winapi_enumwindows _winapi_enumwindowspopup " +"_winapi_enumwindowstop _winapi_expandenvironmentstrings _winapi_extracticonex _winapi_fatalappexit " +"_winapi_fillrect _winapi_findexecutable _winapi_findwindow _winapi_flashwindow _winapi_flashwindowex " +"_winapi_floattoint _winapi_flushfilebuffers _winapi_formatmessage _winapi_framerect _winapi_freelibrary " +"_winapi_getancestor _winapi_getasynckeystate _winapi_getbkmode _winapi_getclassname " +"_winapi_getclientheight _winapi_getclientrect _winapi_getclientwidth _winapi_getcurrentprocess " +"_winapi_getcurrentprocessid _winapi_getcurrentthread _winapi_getcurrentthreadid _winapi_getcursorinfo " +"_winapi_getdc _winapi_getdesktopwindow _winapi_getdevicecaps _winapi_getdibits _winapi_getdlgctrlid " +"_winapi_getdlgitem _winapi_getfilesizeex _winapi_getfocus _winapi_getforegroundwindow " +"_winapi_getguiresources _winapi_geticoninfo _winapi_getlasterror _winapi_getlasterrormessage " +"_winapi_getlayeredwindowattributes _winapi_getmodulehandle _winapi_getmousepos _winapi_getmouseposx " +"_winapi_getmouseposy _winapi_getobject _winapi_getopenfilename _winapi_getoverlappedresult " +"_winapi_getparent _winapi_getprocessaffinitymask _winapi_getsavefilename _winapi_getstdhandle " +"_winapi_getstockobject _winapi_getsyscolor _winapi_getsyscolorbrush _winapi_getsystemmetrics " +"_winapi_gettextextentpoint32 _winapi_gettextmetrics _winapi_getwindow _winapi_getwindowdc " +"_winapi_getwindowheight _winapi_getwindowlong _winapi_getwindowplacement _winapi_getwindowrect " +"_winapi_getwindowrgn _winapi_getwindowtext _winapi_getwindowthreadprocessid _winapi_getwindowwidth " +"_winapi_getxyfrompoint _winapi_globalmemorystatus _winapi_guidfromstring _winapi_guidfromstringex " +"_winapi_hiword _winapi_inprocess _winapi_inttofloat _winapi_invalidaterect _winapi_isclassname " +"_winapi_iswindow _winapi_iswindowvisible _winapi_lineto _winapi_loadbitmap _winapi_loadimage " +"_winapi_loadlibrary _winapi_loadlibraryex _winapi_loadshell32icon _winapi_loadstring _winapi_localfree " +"_winapi_loword _winapi_makelangid _winapi_makelcid _winapi_makelong _winapi_makeqword _winapi_messagebeep " +"_winapi_mouse_event _winapi_moveto _winapi_movewindow _winapi_msgbox _winapi_muldiv " +"_winapi_multibytetowidechar _winapi_multibytetowidecharex _winapi_openprocess _winapi_pathfindonpath " +"_winapi_pointfromrect _winapi_postmessage _winapi_primarylangid _winapi_ptinrect _winapi_readfile " +"_winapi_readprocessmemory _winapi_rectisempty _winapi_redrawwindow _winapi_registerwindowmessage " +"_winapi_releasecapture _winapi_releasedc _winapi_screentoclient _winapi_selectobject _winapi_setbkcolor " +"_winapi_setbkmode _winapi_setcapture _winapi_setcursor _winapi_setdefaultprinter _winapi_setdibits " +"_winapi_setendoffile _winapi_setevent _winapi_setfilepointer _winapi_setfocus _winapi_setfont " +"_winapi_sethandleinformation _winapi_setlasterror _winapi_setlayeredwindowattributes _winapi_setparent " +"_winapi_setprocessaffinitymask _winapi_setsyscolors _winapi_settextcolor _winapi_setwindowlong " +"_winapi_setwindowplacement _winapi_setwindowpos _winapi_setwindowrgn _winapi_setwindowshookex " +"_winapi_setwindowtext _winapi_showcursor _winapi_showerror _winapi_showmsg _winapi_showwindow " +"_winapi_stringfromguid _winapi_stringlena _winapi_stringlenw _winapi_sublangid " +"_winapi_systemparametersinfo _winapi_twipsperpixelx _winapi_twipsperpixely _winapi_unhookwindowshookex " +"_winapi_updatelayeredwindow _winapi_updatewindow _winapi_waitforinputidle _winapi_waitformultipleobjects " +"_winapi_waitforsingleobject _winapi_widechartomultibyte _winapi_windowfrompoint _winapi_writeconsole " +"_winapi_writefile _winapi_writeprocessmemory _winnet_addconnection _winnet_addconnection2 " +"_winnet_addconnection3 _winnet_cancelconnection _winnet_cancelconnection2 _winnet_closeenum " +"_winnet_connectiondialog _winnet_connectiondialog1 _winnet_disconnectdialog _winnet_disconnectdialog1 " +"_winnet_enumresource _winnet_getconnection _winnet_getconnectionperformance _winnet_getlasterror " +"_winnet_getnetworkinformation _winnet_getprovidername _winnet_getresourceinformation " +"_winnet_getresourceparent _winnet_getuniversalname _winnet_getuser _winnet_openenum " +"_winnet_restoreconnection _winnet_useconnection _word_versioninfo _wordattach _wordcreate _worddocadd " +"_worddocaddlink _worddocaddpicture _worddocclose _worddocfindreplace _worddocgetcollection " +"_worddoclinkgetcollection _worddocopen _worddocprint _worddocpropertyget _worddocpropertyset _worddocsave " +"_worddocsaveas _worderrorhandlerderegister _worderrorhandlerregister _worderrornotify _wordmacrorun " +"_wordpropertyget _wordpropertyset _wordquit", +"" }; + + +EDITLEXER lexAU3 = { SCLEX_AU3, 63035, L"AutoIt3 Script", L"au3", L"", &KeyWords_AU3, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_AU3_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_AU3_COMMENT,SCE_AU3_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_AU3_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + { SCE_AU3_FUNCTION, 63277, L"Function", L"fore:#0000FF", L"" }, + { SCE_AU3_UDF, 63360, L"User-Defined Function", L"fore:#0000FF", L"" }, + { SCE_AU3_KEYWORD, 63128, L"Keyword", L"fore:#0000FF", L"" }, + { SCE_AU3_MACRO, 63278, L"Macro", L"fore:#0080FF", L"" }, + { SCE_AU3_STRING, 63131, L"String", L"fore:#008080", L"" }, + { SCE_AU3_OPERATOR, 63132, L"Operator", L"fore:#C000C0", L"" }, + { SCE_AU3_VARIABLE, 63249, L"Variable", L"fore:#808000", L"" }, + { SCE_AU3_SENT, 63279, L"Send Key", L"fore:#FF0000", L"" }, + { SCE_AU3_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + { SCE_AU3_SPECIAL, 63280, L"Special", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +EDITLEXER lexLATEX = { SCLEX_LATEX, 63036, L"LaTeX Files", L"tex; latex; sty", L"", &KeyWords_NULL, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_L_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_L_COMMAND,SCE_L_SHORTCMD,SCE_L_CMDOPT,0), 63236, L"Command", L"fore:#0000FF", L"" }, + { MULTI_STYLE(SCE_L_COMMENT,SCE_L_COMMENT2,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_L_MATH,SCE_L_MATH2,0,0), 63283, L"Math", L"fore:#FF0000", L"" }, + { SCE_L_SPECIAL, 63330, L"Special Char", L"fore:#AAAA00", L"" }, + { MULTI_STYLE(SCE_L_TAG,SCE_L_TAG2,0,0), 63282, L"Tag", L"fore:#0000FF", L"" }, + { SCE_L_VERBATIM, 63331, L"Verbatim Segment", L"fore:#666666", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +EDITLEXER lexANSI = { SCLEX_NULL, 63025, L"ANSI Art", L"nfo; diz", L"", &KeyWords_NULL, { + { STYLE_DEFAULT, 63126, L"Default", L"font:Lucida Console", L"" }, + { STYLE_LINENUMBER, 63101, L"Margins and Line Numbers", L"font:Lucida Console; size:-2", L"" }, + { STYLE_BRACELIGHT, 63102, L"Matching Braces", L"size:+0", L"" }, + { STYLE_BRACEBAD, 63103, L"Matching Braces Error", L"size:+0", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_AHK = { +"break continue else exit exitapp gosub goto if ifequal ifexist ifgreater ifgreaterorequal " +"ifinstring ifless iflessorequal ifmsgbox ifnotequal ifnotexist ifnotinstring ifwinactive " +"ifwinexist ifwinnotactive ifwinnotexist loop onexit pause repeat return settimer sleep " +"suspend static global local var byref while until for class try catch throw", +"autotrim blockinput clipwait control controlclick controlfocus controlget controlgetfocus " +"controlgetpos controlgettext controlmove controlsend controlsendraw controlsettext coordmode " +"critical detecthiddentext detecthiddenwindows drive driveget drivespacefree edit endrepeat " +"envadd envdiv envget envmult envset envsub envupdate fileappend filecopy filecopydir filecreatedir " +"filecreateshortcut filedelete filegetattrib filegetshortcut filegetsize filegettime filegetversion " +"fileinstall filemove filemovedir fileread filereadline filerecycle filerecycleempty fileremovedir " +"fileselectfile fileselectfolder filesetattrib filesettime formattime getkeystate groupactivate " +"groupadd groupclose groupdeactivategui guicontrol guicontrolget hideautoitwin hotkey imagesearch " +"inidelete iniread iniwrite input inputbox keyhistory keywait listhotkeys listlines listvars menu " +"mouseclick mouseclickdrag mousegetpos mousemove msgbox outputdebug pixelgetcolor pixelsearch " +"postmessage process progress random regdelete regread regwrite reload run runas runwait send " +"sendevent sendinput sendmessage sendmode sendplay sendraw setbatchlines setcapslockstate " +"setcontroldelay setdefaultmousespeed setenv setformat setkeydelay setmousedelay setnumlockstate " +"setscrolllockstate setstorecapslockmode settitlematchmode setwindelay setworkingdir shutdown sort " +"soundbeep soundget soundgetwavevolume soundplay soundset soundsetwavevolume splashimage splashtextoff " +"splashtexton splitpath statusbargettext statusbarwait stringcasesense stringgetpos stringleft stringlen " +"stringlower stringmid stringreplace stringright stringsplit stringtrimleft stringtrimright stringupper " +"sysget thread tooltip transform traytip urldownloadtofile winactivate winactivatebottom winclose winget " +"wingetactivestats wingetactivetitle wingetclass wingetpos wingettext wingettitle winhide winkill " +"winmaximize winmenuselectitem winminimize winminimizeall winminimizeallundo winmove winrestore winset " +"winsettitle winshow winwait winwaitactive winwaitclose winwaitnotactive fileencoding", +"abs acos asc asin atan ceil chr cos dllcall exp fileexist floor getkeystate numget numput " +"registercallback il_add il_create il_destroy instr islabel isfunc ln log lv_add lv_delete " +"lv_deletecol lv_getcount lv_getnext lv_gettext lv_insert lv_insertcol lv_modify lv_modifycol " +"lv_setimagelist mod onmessage round regexmatch regexreplace sb_seticon sb_setparts sb_settext " +"sin sqrt strlen substr tan tv_add tv_delete tv_getchild tv_getcount tv_getnext tv_get tv_getparent " +"tv_getprev tv_getselection tv_gettext tv_modify tv_setimagelist varsetcapacity winactive winexist " +"trim ltrim rtrim fileopen strget strput object array isobject objinsert objremove objminindex " +"objmaxindex objsetcapacity objgetcapacity objgetaddress objnewenum objaddref objrelease objhaskey " +"objclone _insert _remove _minindex _maxindex _setcapacity _getcapacity _getaddress _newenum _addref " +"_release _haskey _clone comobjcreate comobjget comobjconnect comobjerror comobjactive comobjenwrap " +"comobjunwrap comobjparameter comobjmissing comobjtype comobjvalue comobjarray comobjquery comobjflags " +"func getkeyname getkeyvk getkeysc isbyref exception", +"allowsamelinecomments clipboardtimeout commentflag errorstdout escapechar hotkeyinterval " +"hotkeymodifiertimeout hotstring if iftimeout ifwinactive ifwinexist include includeagain " +"installkeybdhook installmousehook keyhistory ltrim maxhotkeysperinterval maxmem maxthreads " +"maxthreadsbuffer maxthreadsperhotkey menumaskkey noenv notrayicon persistent singleinstance " +"usehook warn winactivateforce", +"shift lshift rshift alt lalt ralt control lcontrol rcontrol ctrl lctrl rctrl lwin rwin appskey " +"altdown altup shiftdown shiftup ctrldown ctrlup lwindown lwinup rwindown rwinup lbutton rbutton " +"mbutton wheelup wheeldown xbutton1 xbutton2 joy1 joy2 joy3 joy4 joy5 joy6 joy7 joy8 joy9 joy10 " +"joy11 joy12 joy13 joy14 joy15 joy16 joy17 joy18 joy19 joy20 joy21 joy22 joy23 joy24 joy25 joy26 " +"joy27 joy28 joy29 joy30 joy31 joy32 joyx joyy joyz joyr joyu joyv joypov joyname joybuttons " +"joyaxes joyinfo space tab enter escape esc backspace bs delete del insert ins pgup pgdn home end " +"up down left right printscreen ctrlbreak pause scrolllock capslock numlock numpad0 numpad1 numpad2 " +"numpad3 numpad4 numpad5 numpad6 numpad7 numpad8 numpad9 numpadmult numpadadd numpadsub numpaddiv " +"numpaddot numpaddel numpadins numpadclear numpadup numpaddown numpadleft numpadright numpadhome " +"numpadend numpadpgup numpadpgdn numpadenter f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 " +"f16 f17 f18 f19 f20 f21 f22 f23 f24 browser_back browser_forward browser_refresh browser_stop " +"browser_search browser_favorites browser_home volume_mute volume_down volume_up media_next " +"media_prev media_stop media_play_pause launch_mail launch_media launch_app1 launch_app2 blind " +"click raw wheelleft wheelright", +"a_ahkpath a_ahkversion a_appdata a_appdatacommon a_autotrim a_batchlines a_caretx a_carety " +"a_computername a_controldelay a_cursor a_dd a_ddd a_dddd a_defaultmousespeed a_desktop " +"a_desktopcommon a_detecthiddentext a_detecthiddenwindows a_endchar a_eventinfo a_exitreason " +"a_formatfloat a_formatinteger a_gui a_guievent a_guicontrol a_guicontrolevent a_guiheight " +"a_guiwidth a_guix a_guiy a_hour a_iconfile a_iconhidden a_iconnumber a_icontip a_index " +"a_ipaddress1 a_ipaddress2 a_ipaddress3 a_ipaddress4 a_isadmin a_iscompiled a_issuspended " +"a_keydelay a_language a_lasterror a_linefile a_linenumber a_loopfield a_loopfileattrib " +"a_loopfiledir a_loopfileext a_loopfilefullpath a_loopfilelongpath a_loopfilename " +"a_loopfileshortname a_loopfileshortpath a_loopfilesize a_loopfilesizekb a_loopfilesizemb " +"a_loopfiletimeaccessed a_loopfiletimecreated a_loopfiletimemodified a_loopreadline a_loopregkey " +"a_loopregname a_loopregsubkey a_loopregtimemodified a_loopregtype a_mday a_min a_mm a_mmm " +"a_mmmm a_mon a_mousedelay a_msec a_mydocuments a_now a_nowutc a_numbatchlines a_ostype " +"a_osversion a_priorhotkey a_programfiles a_programs a_programscommon a_screenheight " +"a_screenwidth a_scriptdir a_scriptfullpath a_scriptname a_sec a_space a_startmenu " +"a_startmenucommon a_startup a_startupcommon a_stringcasesense a_tab a_temp a_thishotkey " +"a_thismenu a_thismenuitem a_thismenuitempos a_tickcount a_timeidle a_timeidlephysical " +"a_timesincepriorhotkey a_timesincethishotkey a_titlematchmode a_titlematchmodespeed " +"a_username a_wday a_windelay a_windir a_workingdir a_yday a_year a_yweek a_yyyy " +"clipboard clipboardall comspec errorlevel programfiles true false a_thisfunc a_thislabel " +"a_ispaused a_iscritical a_isunicode a_ptrsize a_scripthwnd a_priorkey", +"ltrim rtrim join ahk_id ahk_pid ahk_class ahk_group ahk_exe processname processpath minmax " +"controllist statuscd filesystem setlabel alwaysontop mainwindow nomainwindow useerrorlevel " +"altsubmit hscroll vscroll imagelist wantctrla wantf2 vis visfirst wantreturn backgroundtrans " +"minimizebox maximizebox sysmenu toolwindow exstyle check3 checkedgray readonly notab lastfound " +"lastfoundexist alttab shiftalttab alttabmenu alttabandmenu alttabmenudismiss controllisthwnd " +"hwnd deref pow bitnot bitand bitor bitxor bitshiftleft bitshiftright sendandmouse mousemove " +"mousemoveoff hkey_local_machine hkey_users hkey_current_user hkey_classes_root hkey_current_config " +"hklm hku hkcu hkcr hkcc reg_sz reg_expand_sz reg_multi_sz reg_dword reg_qword reg_binary reg_link " +"reg_resource_list reg_full_resource_descriptor reg_resource_requirements_list reg_dword_big_endian " +"regex pixel mouse screen relative rgb low belownormal normal abovenormal high realtime between " +"contains in is integer float number digit xdigit integerfast floatfast alpha upper lower alnum " +"time date not or and topmost top bottom transparent transcolor redraw region id idlast count " +"list capacity eject lock unlock label serial type status seconds minutes hours days read parse " +"logoff close error single shutdown menu exit reload tray add rename check uncheck togglecheck " +"enable disable toggleenable default nodefault standard nostandard color delete deleteall icon " +"noicon tip click show edit progress hotkey text picture pic groupbox button checkbox radio " +"dropdownlist ddl combobox statusbar treeview listbox listview datetime monthcal updown slider " +"tab tab2 activex iconsmall tile report sortdesc nosort nosorthdr grid hdr autosize range xm ym " +"ys xs xp yp font resize owner submit nohide minimize maximize restore noactivate na cancel " +"destroy center margin owndialogs guiescape guiclose guisize guicontextmenu guidropfiles tabstop " +"section wrap border top bottom buttons expand first lines number uppercase lowercase limit " +"password multi group background bold italic strike underline norm theme caption delimiter flash " +"style checked password hidden left right center section move focus hide choose choosestring text " +"pos enabled disabled visible notimers interrupt priority waitclose unicode tocodepage fromcodepage " +"yes no ok cancel abort retry ignore force on off all send wanttab monitorcount monitorprimary " +"monitorname monitorworkarea pid this base extends __get __set __call __delete __new new " +"useunsetlocal useunsetglobal useenv localsameasglobal", +"", "" }; + + +EDITLEXER lexAHK = { SCLEX_AHK, 63037, L"AutoHotkey Script", L"ahk; ia; scriptlet", L"", &KeyWords_AHK, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_AHK_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_AHK_COMMENTLINE,SCE_AHK_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_AHK_ESCAPE, 63306, L"Escape", L"fore:#FF8000", L"" }, + { SCE_AHK_SYNOPERATOR, 63307, L"Syntax Operator", L"fore:#7F200F", L"" }, + { SCE_AHK_EXPOPERATOR, 63308, L"Expression Operator", L"fore:#FF4F00", L"" }, + { SCE_AHK_STRING, 63131, L"String", L"fore:#404040", L"" }, + { SCE_AHK_NUMBER, 63130, L"Number", L"fore:#2F4F7F", L"" }, + { SCE_AHK_IDENTIFIER, 63129, L"Identifier", L"fore:#CF2F0F", L"" }, + { SCE_AHK_VARREF, 63309, L"Variable Dereferencing", L"fore:#CF2F0F; back:#E4FFE4", L"" }, + { SCE_AHK_LABEL, 63235, L"Label", L"fore:#000000; back:#FFFFA1", L"" }, + { SCE_AHK_WORD_CF, 63310, L"Flow of Control", L"fore:#480048; bold", L"" }, + { SCE_AHK_WORD_CMD, 63236, L"Command", L"fore:#004080", L"" }, + { SCE_AHK_WORD_FN, 63277, L"Function", L"fore:#0F707F; italic", L"" }, + { SCE_AHK_WORD_DIR, 63203, L"Directive", L"fore:#F04020; italic", L"" }, + { SCE_AHK_WORD_KB, 63311, L"Keys & Buttons", L"fore:#FF00FF; bold", L"" }, + { SCE_AHK_WORD_VAR, 63312, L"Built-In Variables", L"fore:#CF00CF; italic", L"" }, + { SCE_AHK_WORD_SP, 63280, L"Special", L"fore:#0000FF; italic", L"" }, + //{ SCE_AHK_WORD_UD, 63106, L"User Defined", L"fore:#800020", L"" }, + { SCE_AHK_VARREFKW, 63313, L"Variable Keyword", L"fore:#CF00CF; italic; back:#F9F9FF", L"" }, + { SCE_AHK_ERROR, 63261, L"Error", L"back:#FFC0C0", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_CMAKE = { +"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library " +"add_subdirectory add_test aux_source_directory build_command build_name cmake_minimum_required " +"configure_file create_test_sourcelist else elseif enable_language enable_testing endforeach endif " +"endmacro endwhile exec_program execute_process export_library_dependencies file find_file find_library " +"find_package find_path find_program fltk_wrap_ui foreach get_cmake_property get_directory_property " +"get_filename_component get_source_file_property get_target_property get_test_property if include " +"include_directories include_external_msproject include_regular_expression install install_files " +"install_programs install_targets link_directories link_libraries list load_cache load_command " +"macro make_directory mark_as_advanced math message option output_required_files project qt_wrap_cpp " +"qt_wrap_ui remove remove_definitions separate_arguments set set_directory_properties set_source_files_properties " +"set_target_properties set_tests_properties site_name source_group string subdir_depends subdirs " +"target_link_libraries try_compile try_run use_mangled_mesa utility_source variable_requires vtk_make_instantiator " +"vtk_wrap_java vtk_wrap_python vtk_wrap_tcl while write_file", +"ABSOLUTE ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ALL AND APPEND ARGS ASCII BEFORE CACHE CACHE_VARIABLES " +"CLEAR COMMAND COMMANDS COMMAND_NAME COMMENT COMPARE COMPILE_FLAGS COPYONLY DEFINED DEFINE_SYMBOL " +"DEPENDS DOC EQUAL ESCAPE_QUOTES EXCLUDE EXCLUDE_FROM_ALL EXISTS EXPORT_MACRO EXT EXTRA_INCLUDE " +"FATAL_ERROR FILE FILES FORCE FUNCTION GENERATED GLOB GLOB_RECURSE GREATER GROUP_SIZE HEADER_FILE_ONLY " +"HEADER_LOCATION IMMEDIATE INCLUDES INCLUDE_DIRECTORIES INCLUDE_INTERNALS INCLUDE_REGULAR_EXPRESSION " +"LESS LINK_DIRECTORIES LINK_FLAGS LOCATION MACOSX_BUNDLE MACROS MAIN_DEPENDENCY MAKE_DIRECTORY MATCH " +"MATCHALL MATCHES MODULE NAME NAME_WE NOT NOTEQUAL NO_SYSTEM_PATH OBJECT_DEPENDS OPTIONAL OR OUTPUT " +"OUTPUT_VARIABLE PATH PATHS POST_BUILD POST_INSTALL_SCRIPT PREFIX PREORDER PRE_BUILD PRE_INSTALL_SCRIPT " +"PRE_LINK PROGRAM PROGRAM_ARGS PROPERTIES QUIET RANGE READ REGEX REGULAR_EXPRESSION REPLACE REQUIRED " +"RETURN_VALUE RUNTIME_DIRECTORY SEND_ERROR SHARED SOURCES STATIC STATUS STREQUAL STRGREATER STRLESS " +"SUFFIX TARGET TOLOWER TOUPPER VAR VARIABLES VERSION WIN32 WRAP_EXCLUDE WRITE APPLE MINGW MSYS CYGWIN " +"BORLAND WATCOM MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 CMAKE_COMPILER_2005 OFF ON", +"", "", "", "", "", "", "" }; + + +EDITLEXER lexCmake = { SCLEX_CMAKE, 63038, L"Cmake Script", L"cmake; ctest", L"", &KeyWords_CMAKE, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_CMAKE_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_CMAKE_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { MULTI_STYLE(SCE_CMAKE_STRINGDQ,SCE_CMAKE_STRINGLQ,SCE_CMAKE_STRINGRQ,0), 63131, L"String", L"back:#EEEEEE; fore:#7F007F", L"" }, + { SCE_CMAKE_COMMANDS, 63277, L"Function", L"fore:#00007F", L"" }, + { SCE_CMAKE_PARAMETERS, 63294, L"Parameter", L"fore:#7F200F", L"" }, + { SCE_CMAKE_VARIABLE, 63249, L"Variable", L"fore:#CC3300", L"" }, + { SCE_CMAKE_WHILEDEF, 63325, L"While Def", L"fore:#00007F", L"" }, + { SCE_CMAKE_FOREACHDEF, 63326, L"For Each Def", L"fore:#00007F", L"" }, + { SCE_CMAKE_IFDEFINEDEF, 63327, L"If Def", L"fore:#00007F", L"" }, + { SCE_CMAKE_MACRODEF, 63328, L"Macro Def", L"fore:#00007F", L"" }, + { SCE_CMAKE_STRINGVAR, 63267, L"Variable within String", L"back:#EEEEEE; fore:#CC3300", L"" }, + { SCE_CMAKE_NUMBER, 63130, L"Number", L"fore:#008080", L"" }, + //{ SCE_CMAKE_USERDEFINED, 63106, L"User Defined", L"fore:#800020", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_AVS = { +"true false return global", +"addborders alignedsplice amplify amplifydb animate applyrange assumebff assumefieldbased assumefps " +"assumeframebased assumesamplerate assumescaledfps assumetff audiodub audiodubex avifilesource " +"avisource bicubicresize bilinearresize blackmanresize blackness blankclip blur bob cache changefps " +"colorbars colorkeymask coloryuv compare complementparity conditionalfilter conditionalreader " +"convertaudio convertaudioto16bit convertaudioto24bit convertaudioto32bit convertaudioto8bit " +"convertaudiotofloat convertbacktoyuy2 convertfps converttobackyuy2 converttomono converttorgb " +"converttorgb24 converttorgb32 converttoy8 converttoyv16 converttoyv24 converttoyv411 converttoyuy2 " +"converttoyv12 crop cropbottom delayaudio deleteframe dissolve distributor doubleweave duplicateframe " +"ensurevbrmp3sync fadein fadein0 fadein2 fadeio fadeio0 fadeio2 fadeout fadeout0 fadeout2 fixbrokenchromaupsampling " +"fixluminance fliphorizontal flipvertical frameevaluate freezeframe gaussresize generalconvolution " +"getchannel getchannels getmtmode getparity grayscale greyscale histogram horizontalreduceby2 " +"imagereader imagesource imagewriter info interleave internalcache internalcachemt invert killaudio " +"killvideo lanczos4resize lanczosresize layer letterbox levels limiter loop mask maskhs max merge " +"mergeargb mergechannels mergechroma mergeluma mergergb messageclip min mixaudio monotostereo normalize " +"null opendmlsource overlay peculiarblend pointresize pulldown reduceby2 resampleaudio resetmask reverse " +"rgbadjust scriptclip segmentedavisource segmenteddirectshowsource selecteven selectevery selectodd " +"selectrangeevery separatefields setmtmode sharpen showalpha showblue showfiveversions showframenumber " +"showgreen showred showsmpte showtime sincresize skewrows spatialsoften spline16resize spline36resize " +"spline64resize ssrc stackhorizontal stackvertical subtitle subtract supereq swapfields swapuv " +"temporalsoften timestretch tone trim turn180 turnleft turnright tweak unalignedsplice utoy utoy8 " +"version verticalreduceby2 vtoy vtoy8 wavsource weave writefile writefileend writefileif writefilestart " +"ytouv", +"addgrain addgrainc agc_hdragc analyzelogo animeivtc asharp audiograph autocrop autoyuy2 avsrecursion " +"awarpsharp bassaudiosource bicublinresize bifrost binarize blendfields blindpp blockbuster bordercontrol " +"cfielddiff cframediff chromashift cnr2 colormatrix combmask contra convolution3d convolution3dyv12 " +"dctfilter ddcc deblendlogo deblock deblock_qed decimate decomb dedup deen deflate degrainmedian depan " +"depanestimate depaninterleave depanscenes depanstabilize descratch despot dfttest dgbob dgdecode_mpeg2source " +"dgsource directshowsource distancefunction dss2 dup dupmc edeen edgemask ediupsizer eedi2 eedi3 eedi3_rpow2 " +"expand faerydust fastbicubicresize fastbilinearresize fastediupsizer dedgemask fdecimate ffaudiosource " +"ffdshow ffindex ffmpegsource ffmpegsource2 fft3dfilter fft3dgpu ffvideosource fielddeinterlace fielddiff " +"fillmargins fity2uv fity2u fity2v fitu2y fitv2y fluxsmooth fluxsmoothst fluxsmootht framediff framenumber " +"frfun3b frfun7 gicocu golddust gradfun2db grapesmoother greedyhma grid guavacomb hqdn3d hybridfupp " +"hysteresymask ibob improvesceneswitch inflate inpand inpaintlogo interframe interlacedresize " +"interlacedwarpedresize interleaved2planar iscombed iscombedt iscombedtivtc kerneldeint leakkernelbob " +"leakkerneldeint limitedsharpen limitedsharpenfaster logic lsfmod lumafilter lumayv12 manalyse " +"maskeddeinterlace maskedmerge maskedmix mblockfps mcompensate mctemporaldenoise mctemporaldenoisepp " +"mdegrain1 mdegrain2 mdegrain3 mdepan medianblur mergehints mflow mflowblur mflowfps mflowinter minblur " +"mipsmooth mmask moderatesharpen monitorfilter motionmask mpasource mpeg2source mrecalculate mscdetection " +"msharpen mshow msmooth msu_fieldshiftfixer msu_frc msuper mt mt_adddiff mt_average mt_binarize mt_circle " +"mt_clamp mt_convolution mt_deflate mt_diamond mt_edge mt_ellipse mt_expand mt_freeellipse mt_freelosange " +"mt_freerectangle mt_hysteresis mt_infix mt_inflate mt_inpand mt_invert mt_logic mt_losange mt_lut mt_lutf " +"mt_luts mt_lutspa mt_lutsx mt_lutxy mt_lutxyz mt_makediff mt_mappedblur mt_merge mt_motion mt_polish " +"mt_rectangle mt_square mti mtsource multidecimate mvanalyse mvblockfps mvchangecompensate mvcompensate " +"mvdegrain1 mvdegrain2 mvdegrain3 mvdenoise mvdepan mvflow mvflowblur mvflowfps mvflowfps2 mvflowinter " +"mvincrease mvmask mvrecalculate mvscdetection mvshow nicac3source nicdtssource niclpcmsource nicmpasource " +"nicmpg123source nnedi nnedi2 nnedi2_rpow2 nnedi3 nnedi3_rpow2 nomosmooth overlaymask peachsmoother pixiedust " +"planar2interleaved qtgmc qtinput rawavsource rawsource reduceflicker reinterpolate411 removedirt removedust " +"removegrain removegrainhd removetemporalgrain repair requestlinear reversefielddominance rgb3dlut rgdeinterlace " +"rgsdeinterlace rgblut rotate sangnom seesaw sharpen2 showchannels showcombedtivtc smartdecimate smartdeinterlace " +"smdegrain smoothdeinterlace smoothuv soothess soxfilter spacedust sshiq ssim ssiq stmedianfilter t3dlut tanisotropic " +"tbilateral tcanny tcomb tcombmask tcpserver tcpsource tdecimate tdeint tedgemask telecide temporalcleaner " +"temporalrepair temporalsmoother tfieldblank tfm tisophote tivtc tmaskblank tmaskedmerge tmaskedmerge3 tmm " +"tmonitor tnlmeans tomsmocomp toon textsub ttempsmooth ttempsmoothf tunsharp unblock uncomb undot unfilter " +"unsharpmask vaguedenoiser variableblur verticalcleaner videoscope vinverse vobsub vqmcalc warpedresize warpsharp " +"xsharpen yadif yadifmod yuy2lut yv12convolution yv12interlacedreduceby2 yv12interlacedselecttopfields " +"yv12layer yv12lut yv12lutxy yv12substract yv12torgb24 yv12toyuy2", +"abs apply assert bool ceil chr clip continueddenominator continuednumerator cos default defined eval " +"averagechromau averagechromav averageluma chromaudifference chromavdifference lumadifference " +"exist exp findstr float floor frac hexvalue import int isbool isclip isfloat isint isstring lcase leftstr " +"load_stdcall_plugin loadcplugin loadplugin loadvfapiplugin loadvirtualdubplugin log midstr muldiv nop " +"opt_allowfloataudio opt_avipadscanlines opt_dwchannelmask opt_usewaveextensible opt_vdubplanarhack " +"pi pow rand revstr rightstr round scriptdir scriptfile scriptname select setmemorymax setplanarlegacyalignment " +"rgbdifference rgbdifferencefromprevious rgbdifferencetonext udifferencefromprevious udifferencetonext " +"setworkingdir sign sin spline sqrt string strlen time ucase undefined value versionnumber versionstring " +"uplanemax uplanemedian uplanemin uplaneminmaxdifference vdifferencefromprevious vdifferencetonext " +"vplanemax vplanemedian vplanemin vplaneminmaxdifference ydifferencefromprevious ydifferencetonext " +"yplanemax yplanemedian yplanemin yplaneminmaxdifference", +"audiobits audiochannels audiolength audiolengthf audiorate framecount framerate frameratedenominator " +"frameratenumerator getleftchannel getrightchannel hasaudio hasvideo height isaudiofloat isaudioint " +"isfieldbased isframebased isinterleaved isplanar isrgb isrgb24 isrgb32 isyuv isyuy2 isyv12 width", +"", "", "", "" }; + + +EDITLEXER lexAVS = { SCLEX_AVS, 63039, L"AviSynth Script", L"avs; avsi", L"", &KeyWords_AVS, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_AVS_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_AVS_COMMENTLINE,SCE_AVS_COMMENTBLOCK,SCE_AVS_COMMENTBLOCKN,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_AVS_OPERATOR, 63132, L"Operator", L"", L"" }, + { MULTI_STYLE(SCE_AVS_STRING,SCE_AVS_TRIPLESTRING,0,0), 63131, L"String", L"fore:#7F007F", L"" }, + { SCE_AVS_NUMBER, 63130, L"Number", L"fore:#007F7F", L"" }, + { SCE_AVS_KEYWORD, 63128, L"Keyword", L"fore:#00007F; bold", L"" }, + { SCE_AVS_FILTER, 63333, L"Filter", L"fore:#00007F; bold", L"" }, + { SCE_AVS_PLUGIN, 63334, L"Plugin", L"fore:#0080C0; bold", L"" }, + { SCE_AVS_FUNCTION, 63277, L"Function", L"fore:#007F7F", L"" }, + { SCE_AVS_CLIPPROP, 63335, L"Clip Property", L"fore:#00007F", L"" }, + //{ SCE_AVS_USERDFN, 63106, L"User Defined", L"fore:#8000FF", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_MARKDOWN = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexMARKDOWN = { SCLEX_MARKDOWN, 63040, L"Markdown", L"md; markdown; mdown; mkdn; mkd", L"", &KeyWords_MARKDOWN, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_MARKDOWN_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_MARKDOWN_LINE_BEGIN, 63338, L"Line Begin", L"", L"" }, + { MULTI_STYLE(SCE_MARKDOWN_STRONG1,SCE_MARKDOWN_STRONG2,0,0), 63339, L"Strong", L"bold", L"" }, + { MULTI_STYLE(SCE_MARKDOWN_EM1,SCE_MARKDOWN_EM2,0,0), 63340, L"Emphasis", L"italic", L"" }, + { SCE_MARKDOWN_HEADER1, 63341, L"Header 1", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_HEADER2, 63342, L"Header 2", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_HEADER3, 63343, L"Header 3", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_HEADER4, 63344, L"Header 4", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_HEADER5, 63345, L"Header 5", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_HEADER6, 63346, L"Header 6", L"fore:#FF0088; bold", L"" }, + { SCE_MARKDOWN_PRECHAR, 63347, L"Pre Char", L"fore:#00007F", L"" }, + { SCE_MARKDOWN_ULIST_ITEM, 63348, L"Unordered List", L"fore:#0080FF; bold", L"" }, + { SCE_MARKDOWN_OLIST_ITEM, 63268, L"Ordered List", L"fore:#0080FF; bold", L"" }, + { SCE_MARKDOWN_BLOCKQUOTE, 63350, L"Block Quote", L"fore:#00007F", L"" }, + { SCE_MARKDOWN_STRIKEOUT, 63351, L"Strikeout", L"", L"" }, + { SCE_MARKDOWN_HRULE, 63352, L"Horizontal Rule", L"bold", L"" }, + { SCE_MARKDOWN_LINK, 63353, L"Link", L"fore:#0000FF", L"" }, + { MULTI_STYLE(SCE_MARKDOWN_CODE,SCE_MARKDOWN_CODE2,SCE_MARKDOWN_CODEBK,0), 63354, L"Code", L"fore:#00007F; back:#EBEBEB", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_YAML = { +"y n yes no on off true false", "", "", "", "", "", "", "", "" }; + +EDITLEXER lexYAML = { SCLEX_YAML, 63041, L"YAML", L"yaml; yml", L"", &KeyWords_YAML, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_YAML_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_YAML_COMMENT, 63127, L"Comment", L"fore:#008800", L"" }, + { SCE_YAML_IDENTIFIER, 63129, L"Identifier", L"bold; fore:#0A246A", L"" }, + { SCE_YAML_KEYWORD, 63128, L"Keyword", L"fore:#880088", L"" }, + { SCE_YAML_NUMBER, 63130, L"Number", L"fore:#FF8000", L"" }, + { SCE_YAML_REFERENCE, 63356, L"Reference", L"fore:#008888", L"" }, + { SCE_YAML_DOCUMENT, 63357, L"Document", L"fore:#FFFFFF; bold; back:#000088; eolfilled", L"" }, + { SCE_YAML_TEXT, 63358, L"Text", L"fore:#404040", L"" }, + { SCE_YAML_ERROR, 63359, L"Error", L"fore:#FFFFFF; bold; italic; back:#FF0000; eolfilled", L"" }, + { SCE_YAML_OPERATOR, 63132, L"Operator", L"fore:#333366", L"" }, + { -1, 00000, L"", L"", L"" } } }; + +KEYWORDLIST KeyWords_VHDL = { +"access after alias all architecture array assert attribute begin block body buffer bus case component configuration " +"constant disconnect downto else elsif end entity exit file for function generate generic group guarded if impure in " +"inertial inout is label library linkage literal loop map new next null of on open others out package port postponed " +"procedure process pure range record register reject report return select severity shared signal subtype then " +"to transport type unaffected units until use variable wait when while with", +"abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor", +"left right low high ascending image value pos val succ pred leftof rightof base range reverse_range length delayed stable " +"quiet transaction event active last_event last_active last_value driving driving_value simple_name path_name instance_name", +"now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector to_stdulogicvector " +"to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left rotate_right resize to_integer " +"to_unsigned to_signed std_match to_01", +"std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed std_logic_textio std_logic_unsigned " +"numeric_bit numeric_std math_complex math_real vital_primitives vital_timing", +"boolean bit character severity_level integer real time delay_length natural positive string bit_vector file_open_kind " +"file_open_status line text side width std_ulogic std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z unsigned signed", +"", "", "" }; + +EDITLEXER lexVHDL = { SCLEX_VHDL, 63028, L"VHDL", L"vhdl; vhd", L"", &KeyWords_VHDL, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_VHDL_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_VHDL_COMMENTLINEBANG, SCE_VHDL_COMMENT, SCE_VHDL_BLOCK_COMMENT, 0), 63127, L"Comment", L"fore:#008800", L"" }, + { SCE_VHDL_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { MULTI_STYLE(SCE_VHDL_STRING, SCE_VHDL_STRINGEOL, 0, 0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_VHDL_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_VHDL_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_VHDL_KEYWORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_VHDL_STDOPERATOR, 63371, L"Standard Operator", L"bold; fore:#0A246A", L"" }, + { SCE_VHDL_ATTRIBUTE, 63372, L"Attribute", L"", L"" }, + { SCE_VHDL_STDFUNCTION, 63373, L"Standard Function", L"", L"" }, + { SCE_VHDL_STDPACKAGE, 63374, L"Standard Package", L"", L"" }, + { SCE_VHDL_STDTYPE, 63375, L"Standard Type", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_Registry = { +"", "", "", "", "", "", "", "", "" }; + +EDITLEXER lexRegistry = { SCLEX_REGISTRY, 63027, L"Registry Files", L"reg", L"", &KeyWords_Registry, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_REG_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_REG_COMMENT, 63127, L"Comment", L"fore:#008800", L"" }, + { SCE_REG_VALUENAME, 63376, L"Value Name", L"", L"" }, + { MULTI_STYLE(SCE_REG_STRING,SCE_REG_STRING_GUID,0,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_REG_VALUETYPE, 63377, L"Value Type", L"bold; fore:#00007F", L"" }, + { SCE_REG_HEXDIGIT, 63378, L"Hex", L"fore:#7F0B0C", L"" }, + { SCE_REG_ADDEDKEY, 63379, L"Added Key", L"fore:#000000; back:#FF8040; bold; eolfilled", L"" }, //fore:#530155 + { SCE_REG_DELETEDKEY, 63380, L"Deleted Key", L"fore:#FF0000", L"" }, + { SCE_REG_ESCAPED, 63381, L"Escaped", L"bold; fore:#7D8187", L"" }, + { SCE_REG_KEYPATH_GUID, 63382, L"GUID in Key Path", L"fore:#7B5F15", L"" }, + { SCE_REG_PARAMETER, 63294, L"Parameter", L"fore:#0B6561", L"" }, + { SCE_REG_OPERATOR, 63132, L"Operator", L"bold", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_COFFEESCRIPT = { +"", "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexCOFFEESCRIPT = { SCLEX_COFFEESCRIPT, 63042, L"Coffeescript", L"coffee; Cakefile", L"", &KeyWords_COFFEESCRIPT, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_COFFEESCRIPT_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_COFFEESCRIPT_COMMENT,SCE_COFFEESCRIPT_COMMENTLINE,SCE_COFFEESCRIPT_COMMENTDOC,SCE_COFFEESCRIPT_COMMENTBLOCK), 63127, L"Comment", L"fore:#646464", L"" }, + { MULTI_STYLE(SCE_COFFEESCRIPT_STRING,SCE_COFFEESCRIPT_STRINGEOL,SCE_COFFEESCRIPT_STRINGRAW,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_COFFEESCRIPT_PREPROCESSOR, 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + { SCE_COFFEESCRIPT_IDENTIFIER, 63129, L"Identifier", L"bold; fore:#0A246A", L"" }, + { SCE_COFFEESCRIPT_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_COFFEESCRIPT_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + //{ SCE_COFFEESCRIPT_CHARACTER, 63376, L"Character", L"", L"" }, + { MULTI_STYLE(SCE_COFFEESCRIPT_REGEX,SCE_COFFEESCRIPT_VERBOSE_REGEX,SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT,0), 63315, L"Regex", L"fore:#006633; back:#FFF1A8", L"" }, + { SCE_COFFEESCRIPT_GLOBALCLASS, 63378, L"Global Class", L"", L"" }, + //{ MULTI_STYLE(SCE_COFFEESCRIPT_COMMENTLINEDOC,SCE_COFFEESCRIPT_COMMENTDOCKEYWORD,SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR,0), 63379, L"Comment line", L"fore:#646464", L"" }, + { MULTI_STYLE(SCE_COFFEESCRIPT_WORD,SCE_COFFEESCRIPT_WORD2,0,0), 63380, L"Word", L"", L"" }, + { MULTI_STYLE(SCE_COFFEESCRIPT_VERBATIM,SCE_COFFEESCRIPT_TRIPLEVERBATIM,0,0), 63381, L"Verbatim", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_MATLAB = { +"break case catch continue else elseif end for function global if otherwise " +"persistent return switch try while", +"", "", "", "", "", "", "", "" }; + + +EDITLEXER lexMATLAB = { SCLEX_MATLAB, 63043, L"MATLAB", L"matlab", L"", &KeyWords_MATLAB, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_MATLAB_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_MATLAB_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_MATLAB_COMMAND, 63236, L"Command", L"bold", L"" }, + { SCE_MATLAB_NUMBER, 63130, L"Number", L"fore:#FF8000", L"" }, + { SCE_MATLAB_KEYWORD, 63128, L"Keyword", L"fore:#00007F; bold", L"" }, + { MULTI_STYLE(SCE_MATLAB_STRING,SCE_MATLAB_DOUBLEQUOTESTRING,0,0), 63131, L"String", L"fore:#7F007F", L"" }, + { SCE_MATLAB_OPERATOR, 63132, L"Operator", L"", L"" }, + { SCE_MATLAB_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + + +KEYWORDLIST KeyWords_D = { + // Primary keywords and identifiers + "abstract alias align asm assert auto body break case cast catch class const continue " + "debug default delegate delete deprecated do else enum export extern final finally for foreach foreach_reverse function " + "goto if import in inout interface invariant is lazy mixin module new out override " + "package pragma private protected public return scope static struct super switch synchronized " + "template this throw try typedef typeid typeof union unittest version volatile while with", + // Secondary keywords and identifiers + "false null true", + // Documentation comment keywords (doxygen) + "a addindex addtogroup anchor arg attention author b brief bug c class code date def defgroup deprecated dontinclude " + "e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception f$ f[f] file fn hideinitializer htmlinclude htmlonly " + "if image include ingroup internal invariant interface latexonly li line link mainpage name namespace nosubgrouping note overload " + "p page par param post pre ref relates remarks return retval sa section see showinitializer since skip skipline struct subsection " + "test throw todo typedef union until var verbatim verbinclude version warning weakgroup", + // Type definitions and aliases + "bool byte cdouble cent cfloat char creal dchar double float idouble ifloat int ireal long real short ubyte ucent uint ulong ushort void wchar", + // Keywords 5 + "", + // Keywords 6 + "", + // Keywords 7 + "", + // --- + "" +}; + + +EDITLEXER lexD = { SCLEX_D, 63022, L"D Source Code", L"d; dd; di", L"", &KeyWords_D, { + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_D_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_D_COMMENT,SCE_D_COMMENTLINE,SCE_D_COMMENTNESTED,0), 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_D_COMMENTDOC, 63259, L"Comment Doc", L"fore:#040A0", L"" }, + { SCE_D_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_D_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_D_WORD2, 63260, L"Keyword 2nd", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD3, 63128, L"Keyword 3", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD5, 63128, L"Keyword 5", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD6, 63128, L"Keyword 6", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD7, 63128, L"Keyword 7", L"bold; fore:#0A246A", L"" }, + { SCE_D_TYPEDEF, 63258, L"Typedef", L"italic; fore:#0A246A", L"" }, + { MULTI_STYLE(SCE_D_STRING,SCE_D_CHARACTER,SCE_D_STRINGEOL,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, + { SCE_D_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_D_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + //{ SCE_D_COMMENTLINEDOC, L"Default", L"", L"" }, + //{ SCE_D_COMMENTDOCKEYWORD, L"Default", L"", L"" }, + //{ SCE_D_STRINGB, L"Default", L"", L"" }, + //{ SCE_D_STRINGR, L"Default", L"", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + +KEYWORDLIST KeyWords_Go = { + // Primary keywords and identifiers + "break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type " + "continue for import return var", + // Secondary keywords and identifiers + "nil true false", + // Documentation comment keywords (doxygen) + "", + // Type definitions and aliases + "bool int int8 int16 int32 int64 byte uint uint8 uint16 uint32 uint64 uintptr float float32 float64 string", + // Keywords 5 + "", + // Keywords 6 + "", + // Keywords 7 + "", + // --- + "" +}; + + +EDITLEXER lexGo = { SCLEX_D, 63023, L"Go Source Code", L"go", L"", &KeyWords_Go,{ + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_D_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_D_COMMENT,SCE_D_COMMENTLINE,SCE_D_COMMENTNESTED,0), 63127, L"Comment", L"fore:#008000", L"" }, + //{ SCE_D_COMMENTDOC, 63259, L"Comment Doc", L"fore:#040A0", L"" }, + { SCE_D_NUMBER, 63130, L"Number", L"fore:#FF0000", L"" }, + { SCE_D_WORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_D_WORD2, 63260, L"Keyword 2nd", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD3, 63128, L"Keyword 3", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD5, 63128, L"Keyword 5", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD6, 63128, L"Keyword 6", L"bold; fore:#0A246A", L"" }, + //{ SCE_D_WORD7, 63128, L"Keyword 7", L"bold; fore:#0A246A", L"" }, + { SCE_D_TYPEDEF, 63258, L"Typedef", L"italic; fore:#0A246A", L"" }, + { MULTI_STYLE(SCE_D_STRING,SCE_D_CHARACTER,SCE_D_STRINGEOL,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, + { SCE_D_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { SCE_D_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + //{ SCE_D_COMMENTLINEDOC, L"Default", L"", L"" }, + //{ SCE_D_COMMENTDOCKEYWORD, L"Default", L"", L"" }, + //{ SCE_D_STRINGB, L"Default", L"", L"" }, + //{ SCE_D_STRINGR, L"Default", L"", L"" }, + //C++: { MULTI_STYLE(SCE_C_PREPROCESSOR,SCE_C_PREPROCESSORCOMMENT,SCE_C_PREPROCESSORCOMMENTDOC,0), 63133, L"Preprocessor", L"fore:#FF8000", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + + +KEYWORDLIST KeyWords_Awk = { + // Keywords + "break case continue default do else exit function for if in next return switch while " + "@include delete nextfile print printf BEGIN BEGINFILE END " + "atan2 cos exp int log rand sin sqrt srand asort asorti gensub gsub index " + "length match patsplit split sprintf strtonum sub substr tolower toupper close " + "fflush system mktime strftime systime and compl lshift rshift xor " + "isarray bindtextdomain dcgettext dcngettext", + + // Highlighted identifiers (Keywords 2nd) + "ARGC ARGIND ARGV FILENAME FNR FS NF NR OFMT OFS ORS RLENGTH RS RSTART SUBSEP TEXTDOMAIN " + "BINMODE CONVFMT FIELDWIDTHS FPAT IGNORECASE LINT TEXTDOMAiN ENVIRON ERRNO PROCINFO RT", + + "" +}; + + +EDITLEXER lexAwk = { SCLEX_PYTHON, 63024, L"Awk Script", L"awk", L"", &KeyWords_Awk,{ + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_P_WORD, 63128, L"Keyword", L"bold; fore:#0000A0", L"" }, + { SCE_P_WORD2, 63260, L"Keyword 2nd", L"bold; italic; fore:#6666FF", L"" }, + { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,0,0), 63127, L"Comment", L"fore:#808080", L"" }, + { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,SCE_P_CHARACTER,0), 63131, L"String", L"fore:#008000", L"" }, + { SCE_P_NUMBER, 63130, L"Number", L"fore:#C04000", L"" }, + { SCE_P_OPERATOR, 63132, L"Operator", L"fore:#B000B0", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + + +KEYWORDLIST KeyWords_Nimrod = { + "addr and as asm atomic bind block break case cast concept const continue converter " + "defer discard distinct div do elif else end enum except export finally for from func " + "generic if import in include interface is isnot iterator let macro method mixin mod " + "nil not notin object of or out proc ptr raise ref return shl shr static " + "template try tuple type using var when while with without xor yield", + "", "", "", "", "", "", "", "" }; + + +EDITLEXER lexNimrod = { SCLEX_NIMROD, 63044, L"Nim Source Code", L"nim; nimrod", L"", &KeyWords_Nimrod,{ + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_P_DEFAULT, 63126, L"Default", L"", L"" }, + { MULTI_STYLE(SCE_P_COMMENTLINE,SCE_P_COMMENTBLOCK,SCE_C_COMMENTLINEDOC,0), 63127, L"Comment", L"fore:#880000", L"" }, + { SCE_P_WORD, 63128, L"Keyword", L"bold; fore:#000088", L"" }, + { SCE_P_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { MULTI_STYLE(SCE_P_STRING,SCE_P_STRINGEOL,0,0), 63211, L"String Double Quoted", L"fore:#008800", L"" }, + { SCE_P_CHARACTER, 63212, L"String Single Quoted", L"fore:#008800", L"" }, + { SCE_P_TRIPLEDOUBLE, 63244, L"String Triple Double Quotes", L"fore:#008800", L"" }, + { SCE_P_TRIPLE, 63245, L"String Triple Single Quotes", L"fore:#008800", L"" }, + { SCE_P_NUMBER, 63130, L"Number", L"fore:#FF4000", L"" }, + { SCE_P_OPERATOR, 63132, L"Operator", L"bold; fore:#666600", L"" }, + //{ SCE_P_DEFNAME, 63247, L"Function name", L"fore:#660066", L"" }, + //{ SCE_P_CLASSNAME, 63246, L"Class name", L"fore:#660066", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + + +KEYWORDLIST KeyWords_R = { + // Language Keywords + "if else repeat while function for in next break " + "true false NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_", + // Base / Default package function + "abbreviate abline abs acf acos acosh addmargins aggregate agrep alarm alias alist " + "all anova any aov aperm append apply approx approxfun apropos ar args arima array " + "arrows asin asinh assign assocplot atan atanh attach attr attributes autoload autoloader ave axis " + "backsolve barplot basename beta bindtextdomain binomial biplot bitmap bmp body " + "box boxplot bquote break browser builtins bxp by bzfile c call cancor capabilities " + "casefold cat category cbind ccf ceiling character charmatch chartr chol choose " + "chull citation class close cm cmdscale codes coef coefficients col colnames colors " + "colorspaces colours comment complex confint conflicts contour contrasts contributors " + "convolve cophenetic coplot cor cos cosh cov covratio cpgram crossprod cummax cummin " + "cumprod cumsum curve cut cutree cycle data dataentry date dbeta dbinom dcauchy dchisq de " + "debug debugger decompose delay deltat demo dendrapply density deparse deriv det detach " + "determinant deviance dexp df dfbeta dfbetas dffits dgamma dgeom dget dhyper diag diff " + "diffinv difftime digamma dim dimnames dir dirname dist dlnorm dlogis dmultinom dnbinom " + "dnorm dotchart double dpois dput drop dsignrank dt dump dunif duplicated dweibull " + "dwilcox eapply ecdf edit effects eigen emacs embed end environment eval evalq " + "example exists exp expression factanal factor factorial family fft fifo file filter " + "find fitted fivenum fix floor flush for force formals format formula forwardsolve " + "fourfoldplot frame frequency ftable function gamma gaussian gc gcinfo gctorture get " + "getenv geterrmessage gettext gettextf getwd gl glm globalenv gray grep grey grid gsub " + "gzcon gzfile hat hatvalues hcl hclust head heatmap help hist history hsv httpclient " + "iconv iconvlist identical identify if ifelse image influence inherits integer integrate " + "interaction interactive intersect invisible isoreg jitter jpeg julian kappa kernapply " + "kernel kmeans knots kronecker ksmooth labels lag lapply layout lbeta lchoose lcm legend " + "length letters levels lfactorial lgamma library licence license line lines list lm load " + "loadhistory loadings local locator loess log logb logical loglin lowess ls lsfit machine mad " + "mahalanobis makepredictcall manova mapply match matlines matplot matpoints matrix max mean " + "median medpolish menu merge message methods mget min missing mode monthplot months " + "mosaicplot mtext mvfft names napredict naprint naresid nargs nchar ncol next nextn ngettext " + "nlevels nlm nls noquote nrow numeric objects offset open optim optimise optimize options " + "order ordered outer pacf page pairlist pairs palette par parse paste pbeta pbinom pbirthday " + "pcauchy pchisq pdf pentagamma person persp pexp pf pgamma pgeom phyper pi pico pictex pie " + "piechart pipe plclust plnorm plogis plot pmatch pmax pmin pnbinom png pnorm points poisson " + "poly polygon polym polyroot postscript power ppoints ppois ppr prcomp predict preplot " + "pretty princomp print prmatrix prod profile profiler proj promax prompt provide psigamma " + "psignrank pt ptukey punif pweibull pwilcox q qbeta qbinom qbirthday qcauchy qchisq qexp qf " + "qgamma qgeom qhyper qlnorm qlogis qnbinom qnorm qpois qqline qqnorm qqplot qr qsignrank qt " + "qtukey quantile quarters quasi quasibinomial quasipoisson quit qunif quote qweibull qwilcox " + "rainbow range rank raw rbeta rbind rbinom rcauchy rchisq readline real recover rect " + "reformulate regexpr relevel remove reorder rep repeat replace replicate replications require " + "reshape resid residuals restart return rev rexp rf rgamma rgb rgeom rhyper rle rlnorm rlogis rm " + "rmultinom rnbinom rnorm round row rownames rowsum rpois rsignrank rstandard rstudent rt " + "rug runif runmed rweibull rwilcox sample sapply save savehistory scale scan screen screeplot sd " + "search searchpaths seek segments seq sequence serialize setdiff setequal setwd shell sign " + "signif sin single sinh sink smooth solve sort source spectrum spline splinefun split sprintf " + "sqrt stack stars start stderr stdin stdout stem step stepfun stl stop stopifnot str strftime " + "strheight stripchart strptime strsplit strtrim structure strwidth strwrap sub subset " + "substitute substr substring sum summary sunflowerplot supsmu svd sweep switch symbols symnum " + "system t table tabulate tail tan tanh tapply tempdir tempfile termplot terms tetragamma " + "text time title toeplitz tolower topenv toupper trace traceback transform trigamma trunc " + "truncate try ts tsdiag tsp typeof unclass undebug union unique uniroot unix unlink unlist " + "unname unserialize unsplit unstack untrace unz update upgrade url var varimax vcov vector " + "version vi vignette warning warnings weekdays weights which while window windows " + "with write wsbrowser xedit xemacs xfig xinch xor xtabs xyinch yinch zapsmall", + // "Other Package Functions + "acme aids aircondit amis aml banking barchart barley beaver bigcity boot brambles " + "breslow bs bwplot calcium cane capability cav censboot channing city claridge cloth " + "cloud coal condense contourplot control corr darwin densityplot dogs dotplot ducks " + "empinf envelope environmental ethanol fir frets gpar grav gravity grob hirose histogram " + "islay knn larrows levelplot llines logit lpoints lsegments lset ltext lvqinit lvqtest manaus " + "melanoma melanoma motor multiedit neuro nitrofen nodal ns nuclear oneway parallel " + "paulsen poisons polar qq qqmath remission rfs saddle salinity shingle simplex singer " + "somgrid splom stripplot survival tau tmd tsboot tuna unit urine viewport wireframe wool xyplot", + // Unused + "", + // Unused + "", + // --- + "", "", "", "" +}; + + +EDITLEXER lexR = { SCLEX_R, 63045, L"R-S-SPlus Statistics Code", L"R", L"", &KeyWords_R,{ + { STYLE_DEFAULT, 63126, L"Default", L"", L"" }, + //{ SCE_R_DEFAULT, 63126, L"Default", L"", L"" }, + { SCE_R_COMMENT, 63127, L"Comment", L"fore:#008000", L"" }, + { SCE_R_KWORD, 63128, L"Keyword", L"bold; fore:#0A246A", L"" }, + { SCE_R_BASEKWORD, 63271, L"Base Package Functions", L"bold; fore:#7f0000", L"" }, + { SCE_R_OTHERKWORD, 63272, L"Other Package Functions", L"bold; fore:#7f007F", L"" }, + { SCE_R_NUMBER, 63130, L"Number", L"fore:#0000FF", L"" }, + { MULTI_STYLE(SCE_R_STRING,SCE_R_STRING2,0,0), 63131, L"String", L"italic; fore:#3C6CDD", L"" }, + { SCE_R_OPERATOR, 63132, L"Operator", L"bold; fore:#B000B0", L"" }, + { SCE_R_IDENTIFIER, 63129, L"Identifier", L"", L"" }, + { SCE_R_INFIX, 63269, L"Infix", L"fore:#660066", L"" }, + { SCE_R_INFIXEOL, 63270, L"Infix EOL", L"fore:#FF4000; ,back:#E0C0E0; eolfilled", L"" }, + { -1, 00000, L"", L"", L"" } } }; + + + +// This array holds all the lexers... +// Don't forget to change the number of the lexer for HTML and XML +// in Notepad2.c ParseCommandLine() if you change this array! +static PEDITLEXER g_pLexArray[NUMLEXERS] = +{ + &lexStandard, // Default Text + &lexStandard2nd, // 2nd Default Text + &lexANSI, // ANSI Files + &lexCONF, // Apache Config Files + &lexASM, // Assembly Script + &lexAHK, // AutoHotkey Script + &lexAU3, // AutoIt3 Script + &lexAVS, // AviSynth Script + &lexAwk, // Awk Script + &lexBAT, // Batch Files + &lexCPP, // C/C++ Source Code + &lexCS, // C# Source Code + &lexCmake, // Cmake Script + &lexCOFFEESCRIPT, // Coffeescript + &lexPROPS, // Configuration Files + &lexCSS, // CSS Style Sheets + &lexD, // D Source Code + &lexDIFF, // Diff Files + &lexGo, // Go Source Code + &lexINNO, // Inno Setup Script + &lexJAVA, // Java Source Code + &lexJS, // JavaScript + &lexJSON, // JSON + &lexLATEX, // LaTeX Files + &lexLUA, // Lua Script + &lexMAK, // Makefiles + &lexMARKDOWN, // Markdown + &lexMATLAB, // MATLAB + &lexNimrod, // Nim(rod) + &lexNSIS, // NSIS Script + &lexPAS, // Pascal Source Code + &lexPL, // Perl Script + &lexPS, // PowerShell Script + &lexPY, // Python Script + &lexR, // R Statistics Code + &lexRegistry, // Registry Files + &lexRC, // Resource Script + &lexRUBY, // Ruby Script + &lexBASH, // Shell Script + &lexSQL, // SQL Query + &lexTCL, // Tcl Script + &lexVB, // Visual Basic + &lexVBS, // VBScript + &lexVHDL, // VHDL + &lexHTML, // Web Source Code + &lexXML, // XML Document + &lexYAML // YAML +}; + + +// Currently used lexer +static int g_iDefaultLexer = 0; +static PEDITLEXER g_pLexCurrent = &lexStandard; + +static bool g_fStylesModified = false; +static bool g_fWarnedNoIniFile = false; + +static COLORREF g_colorCustom[16]; +static bool g_bAutoSelect; +static int g_cxStyleSelectDlg; +static int g_cyStyleSelectDlg; + + +extern int g_iDefaultCharSet; +extern bool bHiliteCurrentLine; +extern bool g_bHyperlinkHotspot; + + +//============================================================================= +// +// IsLexerStandard() +// + +bool __fastcall IsLexerStandard(PEDITLEXER pLexer) +{ + return ( pLexer && ((pLexer == &lexStandard) || (pLexer == &lexStandard2nd)) ); +} + +PEDITLEXER __fastcall GetCurrentStdLexer() +{ + return (Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard); +} + +bool __fastcall IsStyleStandardDefault(PEDITSTYLE pStyle) +{ + return (pStyle && ((pStyle->rid == 63100) || (pStyle->rid == 63112))); +} + +bool __fastcall IsStyleSchemeDefault(PEDITSTYLE pStyle) +{ + return (pStyle && (pStyle->rid == 63126)); +} + +PEDITLEXER __fastcall GetDefaultLexer() +{ + return g_pLexArray[g_iDefaultLexer]; +} + + +//============================================================================= +// +// Style_RgbAlpha() +// +int __fastcall Style_RgbAlpha(int rgbFore, int rgbBack, int alpha) +{ + return (int)RGB(\ + (0xFF - alpha) * (int)GetRValue(rgbBack) / 0xFF + alpha * (int)GetRValue(rgbFore) / 0xFF, \ + (0xFF - alpha) * (int)GetGValue(rgbBack) / 0xFF + alpha * (int)GetGValue(rgbFore) / 0xFF, \ + (0xFF - alpha) * (int)GetBValue(rgbBack) / 0xFF + alpha * (int)GetBValue(rgbFore) / 0xFF); +} + + +//============================================================================= +// +// Style_Load() +// +void Style_Load() +{ + int i,iLexer; + WCHAR tch[32] = { L'\0' };; + WCHAR *pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100) ; + int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + // Custom colors + g_colorCustom [0] = RGB(0x00,0x00,0x00); + g_colorCustom [1] = RGB(0x0A,0x24,0x6A); + g_colorCustom [2] = RGB(0x3A,0x6E,0xA5); + g_colorCustom [3] = RGB(0x00,0x3C,0xE6); + g_colorCustom [4] = RGB(0x00,0x66,0x33); + g_colorCustom [5] = RGB(0x60,0x80,0x20); + g_colorCustom [6] = RGB(0x64,0x80,0x00); + g_colorCustom [7] = RGB(0xA4,0x60,0x00); + g_colorCustom [8] = RGB(0xFF,0xFF,0xFF); + g_colorCustom [9] = RGB(0xFF,0xFF,0xE2); + g_colorCustom[10] = RGB(0xFF,0xF1,0xA8); + g_colorCustom[11] = RGB(0xFF,0xC0,0x00); + g_colorCustom[12] = RGB(0xFF,0x40,0x00); + g_colorCustom[13] = RGB(0xC8,0x00,0x00); + g_colorCustom[14] = RGB(0xB0,0x00,0xB0); + g_colorCustom[15] = RGB(0xB2,0x8B,0x40); + + LoadIniSection(L"Custom Colors",pIniSection,cchIniSection); + for (i = 0; i < 16; i++) { + WCHAR wch[32] = { L'\0' }; + StringCchPrintf(tch,COUNTOF(tch),L"%02i",i+1); + if (IniSectionGetString(pIniSection,tch,L"",wch,COUNTOF(wch))) { + if (wch[0] == L'#') { + int irgb; + int itok = swscanf_s(CharNext(wch),L"%x",&irgb); + if (itok == 1) + g_colorCustom[i] = RGB((irgb&0xFF0000) >> 16,(irgb&0xFF00) >> 8,irgb&0xFF); + } + } + } + + LoadIniSection(L"Styles",pIniSection,cchIniSection); + + // 2nd default + Style_SetUse2ndDefault(IniSectionGetBool(pIniSection, L"Use2ndDefaultStyle", 0)); + + // default scheme + g_iDefaultLexer = IniSectionGetInt(pIniSection,L"DefaultScheme",0); + g_iDefaultLexer = min(max(g_iDefaultLexer,0),COUNTOF(g_pLexArray)-1); + + // auto select + g_bAutoSelect = (IniSectionGetInt(pIniSection,L"AutoSelect",1)) ? 1 : 0; + + // scheme select dlg dimensions + g_cxStyleSelectDlg = IniSectionGetInt(pIniSection,L"SelectDlgSizeX",304); + g_cxStyleSelectDlg = max(g_cxStyleSelectDlg,0); + + g_cyStyleSelectDlg = IniSectionGetInt(pIniSection,L"SelectDlgSizeY",0); + g_cyStyleSelectDlg = max(g_cyStyleSelectDlg,324); + + for (iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { + LoadIniSection(g_pLexArray[iLexer]->pszName,pIniSection,cchIniSection); + IniSectionGetString(pIniSection, L"FileNameExtensions", g_pLexArray[iLexer]->pszDefExt, + g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions)); + i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + IniSectionGetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName, + g_pLexArray[iLexer]->Styles[i].pszDefault, + g_pLexArray[iLexer]->Styles[i].szValue, + COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue)); + i++; + } + } + LocalFree(pIniSection); + + // 2nd Default Style has same filename extension list as (1st) Default Style + StringCchCopyW(lexStandard2nd.szExtensions, COUNTOF(lexStandard2nd.szExtensions), lexStandard.szExtensions); +} + + +//============================================================================= +// +// Style_Save() +// +void Style_Save() +{ + WCHAR tch[32] = { L'\0' };; + WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); + //int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + // Custom colors + for (int i = 0; i < 16; i++) { + WCHAR wch[32] = { L'\0' }; + StringCchPrintf(tch,COUNTOF(tch),L"%02i",i+1); + StringCchPrintf(wch,COUNTOF(wch),L"#%02X%02X%02X", + (int)GetRValue(g_colorCustom[i]),(int)GetGValue(g_colorCustom[i]),(int)GetBValue(g_colorCustom[i])); + IniSectionSetString(pIniSection,tch,wch); + } + SaveIniSection(L"Custom Colors",pIniSection); + ZeroMemory(pIniSection,LocalSize(pIniSection)); + + // auto select + IniSectionSetBool(pIniSection,L"Use2ndDefaultStyle",Style_GetUse2ndDefault()); + + // default scheme + IniSectionSetInt(pIniSection,L"DefaultScheme",g_iDefaultLexer); + + // auto select + IniSectionSetInt(pIniSection,L"AutoSelect",g_bAutoSelect); + + // scheme select dlg dimensions + IniSectionSetInt(pIniSection,L"SelectDlgSizeX",g_cxStyleSelectDlg); + IniSectionSetInt(pIniSection,L"SelectDlgSizeY",g_cyStyleSelectDlg); + + SaveIniSection(L"Styles",pIniSection); + ZeroMemory(pIniSection,LocalSize(pIniSection)); + + if (!g_fStylesModified) { + LocalFree(pIniSection); + return; + } + + for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { + IniSectionSetString(pIniSection,L"FileNameExtensions", g_pLexArray[iLexer]->szExtensions); + int i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + IniSectionSetString(pIniSection, g_pLexArray[iLexer]->Styles[i].pszName, g_pLexArray[iLexer]->Styles[i].szValue); + i++; + } + + SaveIniSection(g_pLexArray[iLexer]->pszName,pIniSection); + ZeroMemory(pIniSection,LocalSize(pIniSection)); + } + LocalFree(pIniSection); +} + + +//============================================================================= +// +// Style_Import() +// +bool Style_Import(HWND hwnd) +{ + WCHAR szFile[MAX_PATH * 2] = { L'\0' }; + WCHAR szFilter[256] = { L'\0' }; + OPENFILENAME ofn; + + ZeroMemory(&ofn,sizeof(OPENFILENAME)); + GetString(IDS_FILTER_INI,szFilter,COUNTOF(szFilter)); + PrepareFilterStr(szFilter); + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrFile = szFile; + ofn.lpstrDefExt = L"ini"; + ofn.nMaxFile = COUNTOF(szFile); + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT + | OFN_PATHMUSTEXIST | OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/; + + if (GetOpenFileName(&ofn)) { + + int i,iLexer; + WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); + int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + for (iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { + if (GetPrivateProfileSection(g_pLexArray[iLexer]->pszName,pIniSection,cchIniSection,szFile)) { + IniSectionGetString(pIniSection, L"FileNameExtensions", g_pLexArray[iLexer]->pszDefExt, + g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions)); + i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + IniSectionGetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName, + g_pLexArray[iLexer]->Styles[i].pszDefault, + g_pLexArray[iLexer]->Styles[i].szValue, + COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue)); + i++; + } + } + } + LocalFree(pIniSection); + return(true); + } + return(false); +} + +//============================================================================= +// +// Style_Export() +// +bool Style_Export(HWND hwnd) +{ + WCHAR szFile[MAX_PATH * 2] = { L'\0' }; + WCHAR szFilter[256] = { L'\0' }; + OPENFILENAME ofn; + DWORD dwError = ERROR_SUCCESS; + + ZeroMemory(&ofn,sizeof(OPENFILENAME)); + GetString(IDS_FILTER_INI,szFilter,COUNTOF(szFilter)); + PrepareFilterStr(szFilter); + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrFile = szFile; + ofn.lpstrDefExt = L"ini"; + ofn.nMaxFile = COUNTOF(szFile); + ofn.Flags = /*OFN_FILEMUSTEXIST |*/ OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT + | OFN_PATHMUSTEXIST | OFN_SHAREAWARE /*| OFN_NODEREFERENCELINKS*/ | OFN_OVERWRITEPROMPT; + + if (GetSaveFileName(&ofn)) { + + WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100); + //int cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR); + + for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) { + IniSectionSetString(pIniSection,L"FileNameExtensions",g_pLexArray[iLexer]->szExtensions); + int i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + IniSectionSetString(pIniSection,g_pLexArray[iLexer]->Styles[i].pszName,g_pLexArray[iLexer]->Styles[i].szValue); + i++; + } + if (!WritePrivateProfileSection(g_pLexArray[iLexer]->pszName,pIniSection,szFile)) + dwError = GetLastError(); + ZeroMemory(pIniSection,LocalSize(pIniSection)); + } + LocalFree(pIniSection); + + if (dwError != ERROR_SUCCESS) { + MsgBox(MBINFO,IDS_EXPORT_FAIL,szFile); + } + return(true); + } + return(false); +} + + +//============================================================================= +// +// Style_SetLexer() +// +void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) +{ + int iValue; + COLORREF rgb; + COLORREF dColor; + + WCHAR wchFontName[64] = { '\0' }; + WCHAR wchSpecificStyle[80] = { L'\0' }; + + // Select standard if NULL is specified + if (!pLexNew) { + pLexNew = GetDefaultLexer(); //GetCurrentStdLexer(); + } + else if (IsLexerStandard(pLexNew)) { + pLexNew = Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard; + } + + // first set standard lexer's default values + g_pLexCurrent = GetCurrentStdLexer(); + const WCHAR* const wchStandardStyleStrg = g_pLexCurrent->Styles[STY_DEFAULT].szValue; + + // Lexer + SendMessage(hwnd, SCI_SETLEXER, pLexNew->iLexer, 0); + + // Lexer very specific styles + if (pLexNew->iLexer == SCLEX_XML) + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.xml.allow.scripts", (LPARAM)"1"); + if (pLexNew->iLexer == SCLEX_CPP) { + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"styling.within.preprocessor", (LPARAM)"1"); + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.cpp.track.preprocessor", (LPARAM)"0"); + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.cpp.update.preprocessor", (LPARAM)"0"); + } + else if (pLexNew->iLexer == SCLEX_PASCAL) + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.pascal.smart.highlighting", (LPARAM)"1"); + else if (pLexNew->iLexer == SCLEX_SQL) { + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1"); + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.sql.backticks.identifier", (LPARAM)"1"); + SendMessage(hwnd, SCI_SETPROPERTY, (WPARAM)"lexer.sql.numbersign.comment", (LPARAM)"1"); + } + else if (pLexNew->iLexer == SCLEX_NSIS) + SciCall_SetProperty("nsis.ignorecase", "1"); + else if (pLexNew->iLexer == SCLEX_CSS) { + SciCall_SetProperty("lexer.css.scss.language", "1"); + SciCall_SetProperty("lexer.css.less.language", "1"); + } + else if (pLexNew->iLexer == SCLEX_JSON) { + SciCall_SetProperty("json.allow.comments", "1"); + SciCall_SetProperty("json.escape.sequence", "1"); + } + + // Code folding + switch (pLexNew->iLexer) + { + case SCLEX_NULL: + case SCLEX_CONTAINER: + case SCLEX_BATCH: + case SCLEX_CONF: + case SCLEX_MAKEFILE: + case SCLEX_MARKDOWN: + g_bCodeFoldingAvailable = false; + SciCall_SetProperty("fold", "0"); + break; + default: + g_bCodeFoldingAvailable = true; + SciCall_SetProperty("fold", "1"); + SciCall_SetProperty("fold.compact", "0"); + SciCall_SetProperty("fold.comment", "1"); + SciCall_SetProperty("fold.html", "1"); + SciCall_SetProperty("fold.preprocessor", "1"); + SciCall_SetProperty("fold.cpp.comment.explicit", "0"); + break; + } + + // Add KeyWord Lists + for (int i = 0; i < (KEYWORDSET_MAX + 1); i++) { + SendMessage(hwnd, SCI_SETKEYWORDS, i, (LPARAM)pLexNew->pKeyWords->pszKeyWords[i]); + } + + // Clear + SendMessage(hwnd, SCI_CLEARDOCUMENTSTYLE, 0, 0); + + // Idle Styling (very large text) + SendMessage(hwnd, SCI_SETIDLESTYLING, SC_IDLESTYLING_AFTERVISIBLE, 0); + //SendMessage(hwnd, SCI_SETIDLESTYLING, SC_IDLESTYLING_ALL, 0); + + // Default Values are always set + SendMessage(hwnd, SCI_STYLERESETDEFAULT, 0, 0); + + if (!Style_StrGetColor(true, wchStandardStyleStrg, &dColor)) + SendMessage(hwnd, SCI_STYLESETFORE, STYLE_DEFAULT, (LPARAM)GetSysColor(COLOR_WINDOWTEXT)); // default text color + if (!Style_StrGetColor(false, wchStandardStyleStrg, &dColor)) + SendMessage(hwnd, SCI_STYLESETBACK, STYLE_DEFAULT, (LPARAM)GetSysColor(COLOR_WINDOW)); // default window color + + // Auto-select codepage according to charset + //~Style_SetACPfromCharSet(hwnd); + + // ---- Font & More --- + + // constants + + Style_SetFontQuality(hwnd, wchStandardStyleStrg); + SendMessage(hwnd, SCI_STYLESETVISIBLE, STYLE_DEFAULT, (LPARAM)true); + SendMessage(hwnd, SCI_STYLESETHOTSPOT, STYLE_DEFAULT, (LPARAM)false); // default hotspot off + + + // customizable + + if (!Style_StrGetFont(wchStandardStyleStrg, wchFontName, COUNTOF(wchFontName))) + { + char chFontName[64] = { '\0' }; + Style_StrGetFont(L"font:Default", wchFontName, COUNTOF(wchFontName)); + WideCharToMultiByteStrg(Encoding_SciCP, wchFontName, chFontName); + SendMessage(hwnd, SCI_STYLESETFONT, STYLE_DEFAULT, (LPARAM)chFontName); + } + + float fBaseFontSize = INITIAL_BASE_FONT_SIZE * 1.0; // init + Style_StrGetSize(wchStandardStyleStrg, &fBaseFontSize); + fBaseFontSize = (float)max(0.0, fBaseFontSize); + Style_SetBaseFontSize(hwnd, fBaseFontSize); + Style_SetCurrentFontSize(hwnd, fBaseFontSize); + + if (!Style_StrGetCharSet(wchStandardStyleStrg, &iValue)) { + SendMessage(hwnd, SCI_STYLESETCHARACTERSET, STYLE_DEFAULT, (LPARAM)DEFAULT_CHARSET); + } + + if (!Style_StrGetWeightValue(wchStandardStyleStrg, &iValue)) { + SendMessage(hwnd, SCI_STYLESETWEIGHT, STYLE_DEFAULT, (LPARAM)FW_NORMAL); + } + + if (!Style_StrGetCase(wchStandardStyleStrg, &iValue)) { + SendMessage(hwnd, SCI_STYLESETCASE, STYLE_DEFAULT, (LPARAM)SC_CASE_MIXED); + } + + if (!StrStrI(wchStandardStyleStrg, L"italic")) + SendMessage(hwnd, SCI_STYLESETITALIC, STYLE_DEFAULT, (LPARAM)false); + + if (!StrStrI(wchStandardStyleStrg, L"underline")) + SendMessage(hwnd, SCI_STYLESETUNDERLINE, STYLE_DEFAULT, (LPARAM)false); + + if (!StrStrI(wchStandardStyleStrg, L"eolfilled")) + SendMessage(hwnd, SCI_STYLESETEOLFILLED, STYLE_DEFAULT, (LPARAM)false); + + + // --- apply default style --- + Style_SetStyles(hwnd, STYLE_DEFAULT, wchStandardStyleStrg); + + // --- apply current scheme specific settings to default style --- + if (!IsLexerStandard(pLexNew)) + { + const WCHAR* const wchCurrentLexerStyleStrg = pLexNew->Styles[STY_DEFAULT].szValue; + // merge lexer styles + Style_SetStyles(hwnd, STYLE_DEFAULT, wchCurrentLexerStyleStrg); + // use this font size as current lexer's base + fBaseFontSize = Style_GetBaseFontSize(hwnd); + Style_StrGetSize(wchCurrentLexerStyleStrg, &fBaseFontSize); + fBaseFontSize = (float)max(0.0, fBaseFontSize); + Style_SetCurrentFontSize(hwnd, fBaseFontSize); + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, true && !IsWindow(g_hwndDlgCustomizeSchemes)); + } + else { + EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, false); + } + + // Broadcast STYLE_DEFAULT as base style to all other style + SendMessage(hwnd, SCI_STYLECLEARALL, 0, 0); + + // -------------------------------------------------------------------------- + + const PEDITLEXER pCurrentStandard = g_pLexCurrent; + + // -------------------------------------------------------------------------- + + Style_SetMargin(hwnd, pCurrentStandard->Styles[STY_MARGIN].iStyle, + pCurrentStandard->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style + + if (bUseOldStyleBraceMatching) { + Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_OK].iStyle, + pCurrentStandard->Styles[STY_BRACE_OK].szValue); // brace light + } + else { + if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_BRACE_OK].szValue, &dColor)) + SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_MATCH_BRACE, dColor); + if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_OK].szValue, &iValue, true)) + SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_MATCH_BRACE, iValue); + if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_OK].szValue, &iValue, false)) + SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MATCH_BRACE, iValue); + + iValue = -1; // need for retrieval + if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_BRACE_OK].szValue, 0, &iValue)) { + // got default, get string + StringCchCatW(pCurrentStandard->Styles[STY_BRACE_OK].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); + Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); + StringCchCatW(pCurrentStandard->Styles[STY_BRACE_OK].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); + } + SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MATCH_BRACE, iValue); + } + if (bUseOldStyleBraceMatching) { + Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_BAD].iStyle, + pCurrentStandard->Styles[STY_BRACE_BAD].szValue); // brace bad + } + else { + if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &dColor)) + SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_BAD_BRACE, dColor); + if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &iValue, true)) + SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_BAD_BRACE, iValue); + if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, &iValue, false)) + SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_BAD_BRACE, iValue); + + iValue = -1; // need for retrieval + if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, 0, &iValue)) { + // got default, get string + StringCchCatW(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); + Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); + StringCchCatW(pCurrentStandard->Styles[STY_BRACE_BAD].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); + } + SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_BAD_BRACE, iValue); + } + + // Occurrences Marker + if (!Style_StrGetColor(true, pCurrentStandard->Styles[STY_MARK_OCC].szValue, &dColor)) + { + WCHAR* sty = L""; + switch (g_iMarkOccurrences) { + case 1: + sty = L"fore:0xFF0000"; + dColor = RGB(0xFF, 0x00, 0x00); + break; + case 2: + sty = L"fore:0x00FF00"; + dColor = RGB(0x00, 0xFF, 0x00); + break; + case 3: + default: + sty = L"fore:0x0000FF"; + dColor = RGB(0x00, 0xFF, 0x00); + break; + } + StringCchCopyW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), sty); + } + SendMessage(hwnd, SCI_INDICSETFORE, INDIC_NP3_MARK_OCCURANCE, dColor); + + if (!Style_StrGetAlpha(pCurrentStandard->Styles[STY_MARK_OCC].szValue, &iValue, true)) { + iValue = 100; + StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; alpha:100"); + } + SendMessage(hwnd, SCI_INDICSETALPHA, INDIC_NP3_MARK_OCCURANCE, iValue); + + if (!Style_StrGetAlpha(pCurrentStandard->Styles[STY_MARK_OCC].szValue, &iValue, false)) { + iValue = 100; + StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; alpha2:100"); + } + SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MARK_OCCURANCE, iValue); + + iValue = -1; // need for retrieval + if (!Style_GetIndicatorType(pCurrentStandard->Styles[STY_MARK_OCC].szValue, 0, &iValue)) { + // got default, get string + StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), L"; "); + Style_GetIndicatorType(wchSpecificStyle, COUNTOF(wchSpecificStyle), &iValue); + StringCchCatW(pCurrentStandard->Styles[STY_MARK_OCC].szValue, COUNTOF(pCurrentStandard->Styles[0].szValue), wchSpecificStyle); + } + SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MARK_OCCURANCE, iValue); + + // More default values... + + if (pLexNew != &lexANSI) + Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_CTRL_CHR].iStyle, pCurrentStandard->Styles[STY_CTRL_CHR].szValue); // control char + + Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_INDENT_GUIDE].iStyle, pCurrentStandard->Styles[STY_INDENT_GUIDE].szValue); // indent guide + + if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_SEL_TXT].szValue, &rgb)) { // selection fore + SendMessage(hwnd, SCI_SETSELFORE, true, rgb); + SendMessage(hwnd, SCI_SETADDITIONALSELFORE, rgb, 0); + } + else { + SendMessage(hwnd, SCI_SETSELFORE, 0, 0); + SendMessage(hwnd, SCI_SETADDITIONALSELFORE, 0, 0); + } + + if (Style_StrGetColor(false, pCurrentStandard->Styles[STY_SEL_TXT].szValue, &dColor)) { // selection back + SendMessage(hwnd, SCI_SETSELBACK, true, dColor); + SendMessage(hwnd, SCI_SETADDITIONALSELBACK, dColor, 0); + } + else { + SendMessage(hwnd, SCI_SETSELBACK, true, RGB(0xC0, 0xC0, 0xC0)); // use a default value... + SendMessage(hwnd, SCI_SETADDITIONALSELBACK, RGB(0xC0, 0xC0, 0xC0), 0); + } + + if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_SEL_TXT].szValue, &iValue, true)) { // selection alpha + SendMessage(hwnd, SCI_SETSELALPHA, iValue, 0); + SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, iValue, 0); + } + else { + SendMessage(hwnd, SCI_SETSELALPHA, SC_ALPHA_NOALPHA, 0); + SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, SC_ALPHA_NOALPHA, 0); + } + + if (StrStrI(pCurrentStandard->Styles[STY_SEL_TXT].szValue, L"eolfilled")) // selection eolfilled + SendMessage(hwnd, SCI_SETSELEOLFILLED, 1, 0); + else + SendMessage(hwnd, SCI_SETSELEOLFILLED, 0, 0); + + if (Style_StrGetColor(true, pCurrentStandard->Styles[STY_WHITESPACE].szValue, &rgb)) // whitespace fore + SendMessage(hwnd, SCI_SETWHITESPACEFORE, true, rgb); + else + SendMessage(hwnd, SCI_SETWHITESPACEFORE, 0, 0); + + if (Style_StrGetColor(false, pCurrentStandard->Styles[STY_WHITESPACE].szValue, &rgb)) // whitespace back + SendMessage(hwnd, SCI_SETWHITESPACEBACK, true, rgb); + else + SendMessage(hwnd, SCI_SETWHITESPACEBACK, 0, 0); // use a default value... + + // whitespace dot size + iValue = 1; + float fValue = 1.0; + if (Style_StrGetSize(pCurrentStandard->Styles[STY_WHITESPACE].szValue, &fValue)) + { + iValue = (int)max(min(fValue, 5.0), 0.0); + + WCHAR tch[32] = { L'\0' }; + WCHAR wchStyle[BUFSIZE_STYLE_VALUE]; + StringCchCopyN(wchStyle, COUNTOF(wchStyle), pCurrentStandard->Styles[STY_WHITESPACE].szValue, + COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue)); + + StringCchPrintf(pCurrentStandard->Styles[STY_WHITESPACE].szValue, + COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), L"size:%i", iValue); + + if (Style_StrGetColor(true, wchStyle, &rgb)) { + StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X", + (int)GetRValue(rgb), + (int)GetGValue(rgb), + (int)GetBValue(rgb)); + StringCchCat(pCurrentStandard->Styles[STY_WHITESPACE].szValue, + COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), tch); + } + + if (Style_StrGetColor(false, wchStyle, &rgb)) { + StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X", + (int)GetRValue(rgb), + (int)GetGValue(rgb), + (int)GetBValue(rgb)); + StringCchCat(pCurrentStandard->Styles[STY_WHITESPACE].szValue, + COUNTOF(pCurrentStandard->Styles[STY_WHITESPACE].szValue), tch); + } + } + SendMessage(hwnd, SCI_SETWHITESPACESIZE, iValue, 0); + + // current line background + Style_SetCurrentLineBackground(hwnd, bHiliteCurrentLine); + + // bookmark line or marker + Style_SetBookmark(hwnd, g_bShowSelectionMargin); + + // caret style and width + if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"block")) { + SendMessage(hwnd,SCI_SETCARETSTYLE,CARETSTYLE_BLOCK,0); + StringCchCopy(wchSpecificStyle,COUNTOF(wchSpecificStyle),L"block"); + } + else { + SendMessage(hwnd, SCI_SETCARETSTYLE, CARETSTYLE_LINE, 0); + + WCHAR wch[32] = { L'\0' }; + iValue = 1; + fValue = 1.0; // default caret width + if (Style_StrGetSize(pCurrentStandard->Styles[STY_CARET].szValue,&fValue)) { + iValue = (int)max(min(fValue,3.0),1.0); + StringCchPrintf(wch,COUNTOF(wch),L"size:%i",iValue); + StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),wch); + } + SendMessage(hwnd,SCI_SETCARETWIDTH,iValue,0); + } + if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"noblink")) { + SendMessage(hwnd,SCI_SETCARETPERIOD,(WPARAM)0,0); + SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, false, 0); + StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),L"; noblink"); + } + else { + const UINT uCaretBlinkTime = GetCaretBlinkTime(); + SendMessage(hwnd, SCI_SETCARETPERIOD, (WPARAM)uCaretBlinkTime, 0); + SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, ((uCaretBlinkTime != 0) ? true : false), 0); + } + // caret fore + if (!Style_StrGetColor(true,pCurrentStandard->Styles[STY_CARET].szValue,&rgb)) + rgb = GetSysColor(COLOR_WINDOWTEXT); + else { + WCHAR wch[32] = { L'\0' }; + StringCchPrintf(wch,COUNTOF(wch),L"; fore:#%02X%02X%02X", + (int)GetRValue(rgb), + (int)GetGValue(rgb), + (int)GetBValue(rgb)); + + StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),wch); + } + if (!VerifyContrast(rgb,(COLORREF)SendMessage(hwnd,SCI_STYLEGETBACK,0,0))) + rgb = (int)SendMessage(hwnd,SCI_STYLEGETFORE,0,0); + SendMessage(hwnd,SCI_SETCARETFORE,rgb,0); + SendMessage(hwnd,SCI_SETADDITIONALCARETFORE,rgb,0); + + + StrTrimW(wchSpecificStyle, L" ;"); + StringCchCopy(pCurrentStandard->Styles[STY_CARET].szValue, + COUNTOF(pCurrentStandard->Styles[STY_CARET].szValue),wchSpecificStyle); + + if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) { + if (Style_StrGetColor(true,pCurrentStandard->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge fore + SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); + else + SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); + } + else { + if (Style_StrGetColor(false,pCurrentStandard->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge back + SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); + else + SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); + } + + // Extra Line Spacing + iValue = 0; + fValue = 0.0; + if (Style_StrGetSize(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue,&fValue) && (pLexNew != &lexANSI)) { + iValue = (int)fValue; + const int iCurFontSizeDbl = (int)(2.0 * Style_GetCurrentFontSize(hwnd)); + int iValAdj = min(max(iValue,(0 - iCurFontSizeDbl)), 256 * iCurFontSizeDbl); + if (iValAdj != iValue) + StringCchPrintf(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue, + COUNTOF(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue), L"size:%i", iValAdj); + + int iAscent = 0; + int iDescent = 0; + if ((iValAdj % 2) != 0) { + iAscent++; + iValAdj--; + } + iAscent += (iValAdj / 2); + iDescent += (iValAdj / 2); + SendMessage(hwnd,SCI_SETEXTRAASCENT,(WPARAM)iAscent,0); + SendMessage(hwnd,SCI_SETEXTRADESCENT,(WPARAM)iDescent,0); + } + else { + SendMessage(hwnd,SCI_SETEXTRAASCENT,0,0); + SendMessage(hwnd,SCI_SETEXTRADESCENT,0,0); + } + + if (SendMessage(hwnd,SCI_GETINDENTATIONGUIDES,0,0) != SC_IV_NONE) + Style_SetIndentGuides(hwnd,true); + + // here: global define current lexer (used in subsequent calls) + g_pLexCurrent = pLexNew; + + if (g_pLexCurrent->iLexer != SCLEX_NULL || g_pLexCurrent == &lexANSI) + { + int j; + int i = 1; // don't re-apply lexer's default style + while (g_pLexCurrent->Styles[i].iStyle != -1) + { + for (j = 0; j < 4 && (g_pLexCurrent->Styles[i].iStyle8[j] != 0 || j == 0); ++j) { + Style_SetStyles(hwnd, g_pLexCurrent->Styles[i].iStyle8[j], g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HPHP_DEFAULT) { + int iRelated[] = { SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HPHP_WORD, SCE_HPHP_HSTRING, SCE_HPHP_SIMPLESTRING, SCE_HPHP_NUMBER, + SCE_HPHP_OPERATOR, SCE_HPHP_VARIABLE, SCE_HPHP_HSTRING_VARIABLE, SCE_HPHP_COMPLEX_VARIABLE }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HJ_DEFAULT) { + int iRelated[] = { SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC, SCE_HJ_KEYWORD, SCE_HJ_WORD, SCE_HJ_DOUBLESTRING, + SCE_HJ_SINGLESTRING, SCE_HJ_STRINGEOL, SCE_HJ_REGEX, SCE_HJ_NUMBER, SCE_HJ_SYMBOLS }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HJA_DEFAULT) { + int iRelated[] = { SCE_HJA_COMMENT, SCE_HJA_COMMENTLINE, SCE_HJA_COMMENTDOC, SCE_HJA_KEYWORD, SCE_HJA_WORD, SCE_HJA_DOUBLESTRING, + SCE_HJA_SINGLESTRING, SCE_HJA_STRINGEOL, SCE_HJA_REGEX, SCE_HJA_NUMBER, SCE_HJA_SYMBOLS }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HB_DEFAULT) { + int iRelated[] = { SCE_HB_COMMENTLINE, SCE_HB_WORD, SCE_HB_IDENTIFIER, SCE_HB_STRING, SCE_HB_STRINGEOL, SCE_HB_NUMBER }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_HTML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_HBA_DEFAULT) { + int iRelated[] = { SCE_HBA_COMMENTLINE, SCE_HBA_WORD, SCE_HBA_IDENTIFIER, SCE_HBA_STRING, SCE_HBA_STRINGEOL, SCE_HBA_NUMBER }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if ((g_pLexCurrent->iLexer == SCLEX_HTML || g_pLexCurrent->iLexer == SCLEX_XML) && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_SGML_DEFAULT) { + int iRelated[] = { SCE_H_SGML_COMMAND, SCE_H_SGML_1ST_PARAM, SCE_H_SGML_DOUBLESTRING, SCE_H_SGML_SIMPLESTRING, SCE_H_SGML_ERROR, + SCE_H_SGML_SPECIAL, SCE_H_SGML_ENTITY, SCE_H_SGML_COMMENT, SCE_H_SGML_1ST_PARAM_COMMENT, SCE_H_SGML_BLOCK_DEFAULT }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if ((g_pLexCurrent->iLexer == SCLEX_HTML || g_pLexCurrent->iLexer == SCLEX_XML) && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_CDATA) { + int iRelated[] = { SCE_HP_START, SCE_HP_DEFAULT, SCE_HP_COMMENTLINE, SCE_HP_NUMBER, SCE_HP_STRING, + SCE_HP_CHARACTER, SCE_HP_WORD, SCE_HP_TRIPLE, SCE_HP_TRIPLEDOUBLE, SCE_HP_CLASSNAME, + SCE_HP_DEFNAME, SCE_HP_OPERATOR, SCE_HP_IDENTIFIER, SCE_HPA_START, SCE_HPA_DEFAULT, + SCE_HPA_COMMENTLINE, SCE_HPA_NUMBER, SCE_HPA_STRING, SCE_HPA_CHARACTER, SCE_HPA_WORD, + SCE_HPA_TRIPLE, SCE_HPA_TRIPLEDOUBLE, SCE_HPA_CLASSNAME, SCE_HPA_DEFNAME, SCE_HPA_OPERATOR, + SCE_HPA_IDENTIFIER }; + for (j = 0; j < COUNTOF(iRelated); j++) + Style_SetStyles(hwnd,iRelated[j],g_pLexCurrent->Styles[i].szValue); + } + + if (g_pLexCurrent->iLexer == SCLEX_XML && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_H_CDATA) { + int iRelated[] = { SCE_H_SCRIPT, SCE_H_ASP, SCE_H_ASPAT, SCE_H_QUESTION, + SCE_HPHP_DEFAULT, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HPHP_WORD, SCE_HPHP_HSTRING, + SCE_HPHP_SIMPLESTRING, SCE_HPHP_NUMBER, SCE_HPHP_OPERATOR, SCE_HPHP_VARIABLE, + SCE_HPHP_HSTRING_VARIABLE, SCE_HPHP_COMPLEX_VARIABLE, SCE_HJ_START, SCE_HJ_DEFAULT, + SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC, SCE_HJ_KEYWORD, SCE_HJ_WORD, + SCE_HJ_DOUBLESTRING, SCE_HJ_SINGLESTRING, SCE_HJ_STRINGEOL, SCE_HJ_REGEX, SCE_HJ_NUMBER, + SCE_HJ_SYMBOLS, SCE_HJA_START, SCE_HJA_DEFAULT, SCE_HJA_COMMENT, SCE_HJA_COMMENTLINE, + SCE_HJA_COMMENTDOC, SCE_HJA_KEYWORD, SCE_HJA_WORD, SCE_HJA_DOUBLESTRING, SCE_HJA_SINGLESTRING, + SCE_HJA_STRINGEOL, SCE_HJA_REGEX, SCE_HJA_NUMBER, SCE_HJA_SYMBOLS, SCE_HB_START, SCE_HB_DEFAULT, + SCE_HB_COMMENTLINE, SCE_HB_WORD, SCE_HB_IDENTIFIER, SCE_HB_STRING, SCE_HB_STRINGEOL, + SCE_HB_NUMBER, SCE_HBA_START, SCE_HBA_DEFAULT, SCE_HBA_COMMENTLINE, SCE_HBA_WORD, + SCE_HBA_IDENTIFIER, SCE_HBA_STRING, SCE_HBA_STRINGEOL, SCE_HBA_NUMBER, SCE_HP_START, + SCE_HP_DEFAULT, SCE_HP_COMMENTLINE, SCE_HP_NUMBER, SCE_HP_STRING, SCE_HP_CHARACTER, SCE_HP_WORD, + SCE_HP_TRIPLE, SCE_HP_TRIPLEDOUBLE, SCE_HP_CLASSNAME, SCE_HP_DEFNAME, SCE_HP_OPERATOR, + SCE_HP_IDENTIFIER, SCE_HPA_START, SCE_HPA_DEFAULT, SCE_HPA_COMMENTLINE, SCE_HPA_NUMBER, + SCE_HPA_STRING, SCE_HPA_CHARACTER, SCE_HPA_WORD, SCE_HPA_TRIPLE, SCE_HPA_TRIPLEDOUBLE, + SCE_HPA_CLASSNAME, SCE_HPA_DEFNAME, SCE_HPA_OPERATOR, SCE_HPA_IDENTIFIER }; + + for (j = 0; j < COUNTOF(iRelated); j++) { + Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); + } + } + + if (g_pLexCurrent->iLexer == SCLEX_CPP && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_C_COMMENT) { + int iRelated[] = { SCE_C_COMMENTLINE, SCE_C_COMMENTDOC, SCE_C_COMMENTLINEDOC, SCE_C_COMMENTDOCKEYWORD, SCE_C_COMMENTDOCKEYWORDERROR }; + for (j = 0; j < COUNTOF(iRelated); j++) { + Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); + } + } + + if (g_pLexCurrent->iLexer == SCLEX_SQL && g_pLexCurrent->Styles[i].iStyle8[0] == SCE_SQL_COMMENT) { + int iRelated[] = { SCE_SQL_COMMENTLINE, SCE_SQL_COMMENTDOC, SCE_SQL_COMMENTLINEDOC, SCE_SQL_COMMENTDOCKEYWORD, SCE_SQL_COMMENTDOCKEYWORDERROR }; + for (j = 0; j < COUNTOF(iRelated); j++) { + Style_SetStyles(hwnd, iRelated[j], g_pLexCurrent->Styles[i].szValue); + } + } + i++; + } + } + + Style_SetInvisible(hwnd, false); // set fixed invisible style + + // apply lexer styles + Style_SetUrlHotSpot(hwnd, false); + EditApplyLexerStyle(hwnd, 0, -1); + + // update UI for hotspots + if (g_bHyperlinkHotspot) { + Style_SetUrlHotSpot(hwnd, g_bHyperlinkHotspot); + EditUpdateUrlHotspots(hwnd, 0, SciCall_GetTextLength(), g_bHyperlinkHotspot); + } + + UpdateLineNumberWidth(); +} + + +//============================================================================= +// +// Style_GetHotspotStyleID() +// +int Style_GetHotspotStyleID() +{ + return (STYLE_LASTPREDEFINED + STY_URL_HOTSPOT); +} + + +//============================================================================= +// +// Style_SetUrlHotSpot() +// +void Style_SetUrlHotSpot(HWND hwnd, bool bHotSpot) +{ + // Hot Spot settings + const int iStyleHotSpot = Style_GetHotspotStyleID(); + + if (bHotSpot) + { + const WCHAR* const lpszStyleHotSpot = GetCurrentStdLexer()->Styles[STY_URL_HOTSPOT].szValue; + + SendMessage(hwnd, SCI_STYLESETHOTSPOT, iStyleHotSpot, (LPARAM)true); + SendMessage(hwnd, SCI_SETHOTSPOTSINGLELINE, false, 0); + + // Font + Style_SetStyles(hwnd, iStyleHotSpot, lpszStyleHotSpot); + + //if (StrStrI(lpszStyleHotSpot, L"underline") != NULL) + // SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, true, 0); + //else + // SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, false, 0); + SendMessage(hwnd, SCI_SETHOTSPOTACTIVEUNDERLINE, true, 0); + + COLORREF rgb = 0; + // Fore + if (Style_StrGetColor(true, lpszStyleHotSpot, &rgb)) { + COLORREF inactiveFG = (COLORREF)((rgb * 75 + 50) / 100); + SendMessage(hwnd, SCI_STYLESETFORE, iStyleHotSpot, (LPARAM)inactiveFG); + SendMessage(hwnd, SCI_SETHOTSPOTACTIVEFORE, true, (LPARAM)rgb); + } + // Back + if (Style_StrGetColor(false, lpszStyleHotSpot, &rgb)) { + SendMessage(hwnd, SCI_STYLESETBACK, iStyleHotSpot, (LPARAM)rgb); + SendMessage(hwnd, SCI_SETHOTSPOTACTIVEBACK, true, (LPARAM)rgb); + } + } + else { + const WCHAR* const lpszStyleHotSpot = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue; + Style_SetStyles(hwnd, iStyleHotSpot, lpszStyleHotSpot); + SendMessage(hwnd, SCI_STYLESETHOTSPOT, iStyleHotSpot, (LPARAM)false); + } + +} + + +//============================================================================= +// +// Style_GetInvisibleStyleID() +// +int Style_GetInvisibleStyleID() +{ + //return STYLE_FOLDDISPLAYTEXT; + return (STYLE_LASTPREDEFINED + STY_INVISIBLE); +} + + +//============================================================================= +// +// Style_SetInvisible() +// +void Style_SetInvisible(HWND hwnd, bool bInvisible) +{ + //SendMessage(hwnd, SCI_FOLDDISPLAYTEXTSETSTYLE, (WPARAM)SC_FOLDDISPLAYTEXT_BOXED, 0); + SciCall_MarkerDefine(MARKER_NP3_OCCUR_LINE, SC_MARK_EMPTY); // occurrences marker + if (bInvisible) { + SendMessage(hwnd, SCI_STYLESETVISIBLE, Style_GetInvisibleStyleID(), (LPARAM)!bInvisible); + } +} + + + +//============================================================================= +// +// Style_GetReadonlyStyleID() +// +int Style_GetReadonlyStyleID() +{ + return (STYLE_LASTPREDEFINED + STY_READONLY); +} + + +//============================================================================= +// +// Style_SetInvisible() +// +void Style_SetReadonly(HWND hwnd, bool bReadonly) +{ + SendMessage(hwnd, SCI_STYLESETCHANGEABLE, Style_GetReadonlyStyleID(), (LPARAM)!bReadonly); +} + + +//============================================================================= +// +// Style_SetLongLineColors() +// +void Style_SetLongLineColors(HWND hwnd) +{ + COLORREF rgb; + + if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) + { + if (Style_StrGetColor(true, GetCurrentStdLexer()->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge fore + SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); + else + SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); + } + else { + if (Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_LONG_LN_MRK].szValue,&rgb)) // edge back + SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); + else + SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); + } +} + + +//============================================================================= +// +// Style_SetCurrentLineBackground() +// +void Style_SetCurrentLineBackground(HWND hwnd, bool bHiLitCurrLn) +{ + if (bHiLitCurrLn) + { + COLORREF rgb = 0; + if (Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_CUR_LN_BCK].szValue, &rgb)) // caret line back + { + SendMessage(hwnd, SCI_SETCARETLINEVISIBLEALWAYS, true, 0); + SendMessage(hwnd, SCI_SETCARETLINEVISIBLE, true, 0); + SendMessage(hwnd, SCI_SETCARETLINEBACK, rgb, 0); + + int alpha = 0; + if (Style_StrGetAlpha(GetCurrentStdLexer()->Styles[STY_CUR_LN_BCK].szValue, &alpha, true)) + SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,alpha,0); + else + SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,SC_ALPHA_NOALPHA,0); + + return; + } + } + SendMessage(hwnd, SCI_SETCARETLINEVISIBLE, false, 0); + SendMessage(hwnd, SCI_SETCARETLINEVISIBLEALWAYS, false, 0); +} + + +//============================================================================= +// +// Style_SetFolding() +// +void Style_SetFolding(HWND hwnd, bool bShowCodeFolding) +{ + float fSize = INITIAL_BASE_FONT_SIZE + 1.0; + Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); + SciCall_SetMarginWidth(MARGIN_SCI_FOLDING, (bShowCodeFolding) ? (int)fSize : 0); + UNUSED(hwnd); +} + + +//============================================================================= +// +// Style_SetBookmark() +// +void Style_SetBookmark(HWND hwnd, bool bShowSelMargin) +{ + UNUSED(hwnd); + float fSize = INITIAL_BASE_FONT_SIZE + 1.0; + Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); + SciCall_SetMarginWidth(MARGIN_SCI_BOOKMRK, (bShowSelMargin) ? (int)fSize + 4 : 0); + + // Depending on if the margin is visible or not, choose different bookmark indication + if (bShowSelMargin) { + SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BOOKMARK); + } + else { + SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BACKGROUND); + } +} + + +//============================================================================= +// +// Style_SetMargin() +// +void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle) +{ + static const int iMarkerIDs[] = + { + SC_MARKNUM_FOLDEROPEN, + SC_MARKNUM_FOLDER, + SC_MARKNUM_FOLDERSUB, + SC_MARKNUM_FOLDERTAIL, + SC_MARKNUM_FOLDEREND, + SC_MARKNUM_FOLDEROPENMID, + SC_MARKNUM_FOLDERMIDTAIL + }; + + if (iStyle == STYLE_LINENUMBER) { + Style_SetStyles(hwnd, iStyle, lpszStyle); // line numbers + } + + COLORREF clrFore = SciCall_StyleGetFore(STYLE_LINENUMBER); + Style_StrGetColor(true, lpszStyle, &clrFore); + + COLORREF clrBack = SciCall_StyleGetBack(STYLE_LINENUMBER); + Style_StrGetColor(false, lpszStyle, &clrBack); + + //SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrBack); + + + // --- Bookmarks --- + COLORREF bmkFore = clrFore; + COLORREF bmkBack = clrBack; + const WCHAR* wchBookMarkStyleStrg = GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue; + + Style_StrGetColor(true, wchBookMarkStyleStrg, &bmkFore); + Style_StrGetColor(false, wchBookMarkStyleStrg, &bmkBack); + + // adjust background color by alpha in case of show margin + int alpha = 20; + Style_StrGetAlpha(wchBookMarkStyleStrg, &alpha, true); + + COLORREF bckgrnd = clrBack; + Style_StrGetColor(false, GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &bckgrnd); + bmkBack = Style_RgbAlpha(bmkBack, bckgrnd, min(0xFF, alpha)); + + SciCall_MarkerSetFore(MARKER_NP3_BOOKMARK, bmkFore); + SciCall_MarkerSetBack(MARKER_NP3_BOOKMARK, bmkBack); + SciCall_MarkerSetAlpha(MARKER_NP3_BOOKMARK, alpha); + SciCall_SetMarginBackN(MARGIN_SCI_BOOKMRK, clrBack); + + + // --- Code folding --- + SciCall_SetMarginType(MARGIN_SCI_FOLDING, SC_MARGIN_COLOUR); + SciCall_SetMarginMask(MARGIN_SCI_FOLDING, SC_MASK_FOLDERS); + SciCall_SetMarginSensitive(MARGIN_SCI_FOLDING, true); + SciCall_SetMarginBackN(MARGIN_SCI_FOLDING, clrBack); + + int fldStyleMrk = SC_CASE_LOWER; + Style_StrGetCase(wchBookMarkStyleStrg, &fldStyleMrk); + if (fldStyleMrk == SC_CASE_UPPER) // circle style + { + SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); + SciCall_MarkerDefine(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE); + SciCall_MarkerDefine(SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED); + SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE); + } + else // box style + { + SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); + SciCall_MarkerDefine(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER); + SciCall_MarkerDefine(SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED); + SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED); + SciCall_MarkerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER); + } + + SciCall_SetFoldMarginColour(true, clrBack); // background + SciCall_SetFoldMarginHiColour(true, clrBack); // (!) + + //SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_HIDDEN); + + int fldStyleLn = 0; + Style_StrGetCharSet(wchBookMarkStyleStrg, &fldStyleLn); + switch (fldStyleLn) + { + case 1: + SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED); + break; + case 2: + SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED | SC_FOLDFLAG_LINEAFTER_CONTRACTED); + break; + default: + SciCall_SetFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED); + break; + } + + for (int i = 0; i < COUNTOF(iMarkerIDs); ++i) { + SciCall_MarkerSetBack(iMarkerIDs[i], bmkFore); + SciCall_MarkerSetFore(iMarkerIDs[i], bmkBack); + } + + // set width + Style_SetBookmark(hwnd, g_bShowSelectionMargin); + Style_SetFolding(hwnd, (g_bCodeFoldingAvailable && g_bShowCodeFolding)); +} + + +//============================================================================= +// +// Style_SniffShebang() +// +PEDITLEXER __fastcall Style_SniffShebang(char *pchText) +{ + if (StrCmpNA(pchText,"#!",2) == 0) { + char *pch = pchText + 2; + while (*pch == ' ' || *pch == '\t') + pch++; + while (*pch && *pch != ' ' && *pch != '\t' && *pch != '\r' && *pch != '\n') + pch++; + if ((pch - pchText) >= 3 && StrCmpNA(pch-3,"env",3) == 0) { + while (*pch == ' ') + pch++; + while (*pch && *pch != ' ' && *pch != '\t' && *pch != '\r' && *pch != '\n') + pch++; + } + if ((pch - pchText) >= 3 && StrCmpNIA(pch-3,"php",3) == 0) + return(&lexHTML); + else if ((pch - pchText) >= 4 && StrCmpNIA(pch-4,"perl",4) == 0) + return(&lexPL); + else if ((pch - pchText) >= 6 && StrCmpNIA(pch-6,"python",6) == 0) + return(&lexPY); + else if ((pch - pchText) >= 3 && StrCmpNA(pch-3,"tcl",3) == 0) + return(&lexTCL); + else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"wish",4) == 0) + return(&lexTCL); + else if ((pch - pchText) >= 5 && StrCmpNA(pch-5,"tclsh",5) == 0) + return(&lexTCL); + else if ((pch - pchText) >= 2 && StrCmpNA(pch-2,"sh",2) == 0) + return(&lexBASH); + else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"ruby",4) == 0) + return(&lexRUBY); + else if ((pch - pchText) >= 4 && StrCmpNA(pch-4,"node",4) == 0) + return(&lexJS); + } + + return(NULL); +} + + +//============================================================================= +// +// Style_MatchLexer() +// +PEDITLEXER __fastcall Style_MatchLexer(LPCWSTR lpszMatch,bool bCheckNames) { + int i; + WCHAR tch[COUNTOF(g_pLexArray[0]->szExtensions)] = { L'\0' }; + WCHAR *p1,*p2; + + if (!bCheckNames) { + + for (i = 0; i < COUNTOF(g_pLexArray); i++) { + ZeroMemory(tch,sizeof(WCHAR)*COUNTOF(tch)); + StringCchCopy(tch,COUNTOF(tch),g_pLexArray[i]->szExtensions); + p1 = tch; + while (*p1) { + p2 = StrChr(p1,L';'); + if (p2) + *p2 = L'\0'; + else + p2 = StrEnd(p1); + StrTrim(p1,L" ."); + if (StringCchCompareIX(p1,lpszMatch) == 0) + return(g_pLexArray[i]); + p1 = p2 + 1; + } + } + } + + else { + + int cch = lstrlen(lpszMatch); + if (cch >= 3) { + + for (i = 0; i < COUNTOF(g_pLexArray); i++) { + if (StrCmpNI(g_pLexArray[i]->pszName,lpszMatch,cch) == 0) + return(g_pLexArray[i]); + } + } + } + return(NULL); +} + + +//============================================================================= +// +// Style_HasLexerForExt() +// +bool Style_HasLexerForExt(LPCWSTR lpszExt) +{ + if (lpszExt && (*lpszExt == L'.')) ++lpszExt; + return (lpszExt && Style_MatchLexer(lpszExt,false)) ? true : false; +} + + +//============================================================================= +// +// Style_SetLexerFromFile() +// +extern int flagNoHTMLGuess; +extern int flagNoCGIGuess; +extern FILEVARS fvCurFile; + +void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) +{ + LPWSTR lpszExt = PathFindExtension(lpszFile); + bool bFound = false; + PEDITLEXER pLexNew = g_pLexArray[g_iDefaultLexer]; + PEDITLEXER pLexSniffed; + + if ((fvCurFile.mask & FV_MODE) && fvCurFile.tchMode[0]) { + + WCHAR wchMode[32] = { L'\0' }; + PEDITLEXER pLexMode; + + MultiByteToWideCharStrg(Encoding_SciCP, fvCurFile.tchMode, wchMode); + + if (!flagNoCGIGuess && (StringCchCompareIN(wchMode,COUNTOF(wchMode),L"cgi",-1) == 0 || + StringCchCompareIN(wchMode,COUNTOF(wchMode),L"fcgi",-1) == 0)) { + char tchText[256] = { L'\0' }; + SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); + StrTrimA(tchText," \t\n\r"); + pLexSniffed = Style_SniffShebang(tchText); + if (pLexSniffed) { + if ((Encoding_Current(CPI_GET) != g_DOSEncoding) || !IsLexerStandard(pLexSniffed) || ( + StringCchCompareIX(lpszExt,L"nfo") && StringCchCompareIX(lpszExt,L"diz"))) { + // Although .nfo and .diz were removed from the default lexer's + // default extensions list, they may still presist in the user's INI + pLexNew = pLexSniffed; + bFound = true; + } + } + } + + if (!bFound) { + pLexMode = Style_MatchLexer(wchMode, false); + if (pLexMode) { + pLexNew = pLexMode; + bFound = true; + } + else { + pLexMode = Style_MatchLexer(wchMode, true); + if (pLexMode) { + pLexNew = pLexMode; + bFound = true; + } + } + } + } + + if (!bFound && g_bAutoSelect && /* g_bAutoSelect == false skips lexer search */ + (lpszFile && StringCchLen(lpszFile,MAX_PATH) > 0 && *lpszExt)) { + + if (*lpszExt == L'.') ++lpszExt; + + if (!flagNoCGIGuess && (StringCchCompareIX(lpszExt,L"cgi") == 0 || StringCchCompareIX(lpszExt,L"fcgi") == 0)) { + char tchText[256] = { L'\0' }; + SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); + StrTrimA(tchText," \t\n\r"); + pLexSniffed = Style_SniffShebang(tchText); + if (pLexSniffed) { + pLexNew = pLexSniffed; + bFound = true; + } + } + + if (!bFound && StringCchCompareIX(PathFindFileName(lpszFile),L"cmakelists.txt") == 0) { + pLexNew = &lexCmake; + bFound = true; + } + + // check associated extensions + if (!bFound) { + pLexSniffed = Style_MatchLexer(lpszExt, false); + if (pLexSniffed) { + pLexNew = pLexSniffed; + bFound = true; + } + } + } + + if (!bFound && g_bAutoSelect && + StringCchCompareIX(PathFindFileName(lpszFile),L"makefile") == 0) { + pLexNew = &lexMAK; + bFound = true; + } + + if (!bFound && g_bAutoSelect && + StringCchCompareIX(PathFindFileName(lpszFile),L"rakefile") == 0) { + pLexNew = &lexRUBY; + bFound = true; + } + + if (!bFound && g_bAutoSelect && + StringCchCompareIX(PathFindFileName(lpszFile),L"mozconfig") == 0) { + pLexNew = &lexBASH; + bFound = true; + } + + if (!bFound && g_bAutoSelect && (!flagNoHTMLGuess || !flagNoCGIGuess)) { + char tchText[512]; + SendMessage(hwnd,SCI_GETTEXT,(WPARAM)COUNTOF(tchText)-1,(LPARAM)tchText); + StrTrimA(tchText," \t\n\r"); + if (!flagNoCGIGuess) { + if (tchText[0] == '<') { + if (StrStrIA(tchText, "= 0 && id < COUNTOF(g_pLexArray)) { + Style_SetLexer(hwnd,g_pLexArray[id]); + } +} + + +//============================================================================= +// +// Style_ToggleUse2ndDefault() +// +void Style_ToggleUse2ndDefault(HWND hwnd) +{ + bool use2ndDefStyle = Style_GetUse2ndDefault(); + Style_SetUse2ndDefault(use2ndDefStyle ? false : true); // swap + Style_SetLexer(hwnd,g_pLexCurrent); +} + + + +//============================================================================= +// +// Style_SetDefaultFont() +// +void Style_SetDefaultFont(HWND hwnd, bool bGlobalDefault) +{ + WCHAR newStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + const PEDITLEXER pLexer = bGlobalDefault ? GetCurrentStdLexer() : g_pLexCurrent; + const PEDITSTYLE pLexerDefStyle = &(pLexer->Styles[STY_DEFAULT]); + + StringCchCopyW(newStyle, COUNTOF(newStyle), pLexer->Styles[STY_DEFAULT].szValue); + + if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), pLexer->pszName, pLexer->Styles[STY_DEFAULT].pszName, + IsStyleStandardDefault(pLexerDefStyle), IsStyleSchemeDefault(pLexerDefStyle), false, true)) + { + // set new styles to current lexer's default text + StringCchCopyW(pLexerDefStyle->szValue, COUNTOF(pLexerDefStyle->szValue), newStyle); + g_fStylesModified = true; + // redraw current(!) lexer + Style_SetLexer(hwnd, g_pLexCurrent); + } +} + + + +//============================================================================= +// +// Style_SetUse2ndDefault(), Style_GetUse2ndDefault() +// +bool Style_SetUse2ndDefault(int value) +{ + static bool bUse2ndDefaultStyle = false; + + if ((value == true) || (value == false)) { + bUse2ndDefaultStyle = (bool)value; + } + return bUse2ndDefaultStyle; +} + +bool Style_GetUse2ndDefault() +{ + return Style_SetUse2ndDefault(false - true); +} + + + +//============================================================================= +// +// Style_SetBaseFontSize(), Style_GetBaseFontSize() +// +float Style_SetBaseFontSize(HWND hwnd, float fSize) +{ + static float fBaseFontSize = INITIAL_BASE_FONT_SIZE * 1.0; + + if (fSize >= 0.0) { + fBaseFontSize = (float)(((int)(fSize * 100 + 0.5)) / 100.0); + //SendMessage(hwnd, SCI_STYLESETSIZE, STYLE_DEFAULT, (LPARAM)iBaseFontSize); + SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, STYLE_DEFAULT, (LPARAM)((int)(fBaseFontSize * SC_FONT_SIZE_MULTIPLIER + 0.5))); + + } + return fBaseFontSize; +} + +float Style_GetBaseFontSize(HWND hwnd) +{ + return Style_SetBaseFontSize(hwnd, -1.0); +} + + + +//============================================================================= +// +// Style_SetCurrentFontSize(), Style_GetCurrentFontSize() +// +float Style_SetCurrentFontSize(HWND hwnd, float fSize) +{ + static float fCurrentFontSize = INITIAL_BASE_FONT_SIZE * 1.0; + + if (fSize >= 0.0) { + fCurrentFontSize = (float)(((int)(fSize * 100 + 0.5)) / 100.0); + //SendMessage(hwnd, SCI_STYLESETSIZE, STYLE_DEFAULT, (LPARAM)iCurrentFontSize); + SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, STYLE_DEFAULT, (LPARAM)((int)(fCurrentFontSize * SC_FONT_SIZE_MULTIPLIER + 0.5))); + + } + return fCurrentFontSize; +} + +float Style_GetCurrentFontSize(HWND hwnd) +{ + return Style_SetCurrentFontSize(hwnd, -1.0); +} + + + + +//============================================================================= +// +// Style_SetIndentGuides() +// +extern int flagSimpleIndentGuides; + +void Style_SetIndentGuides(HWND hwnd,bool bShow) +{ + int iIndentView = SC_IV_NONE; + if (bShow) { + if (!flagSimpleIndentGuides) { + switch (SendMessage(hwnd, SCI_GETLEXER, 0, 0)) { + case SCLEX_PYTHON: + case SCLEX_NIMROD: + iIndentView = SC_IV_LOOKFORWARD; + break; + default: + iIndentView = SC_IV_LOOKBOTH; + break; + } + } + else + iIndentView = SC_IV_REAL; + } + SendMessage(hwnd,SCI_SETINDENTATIONGUIDES,iIndentView,0); +} + + +//============================================================================= +// +// Style_GetFileOpenDlgFilter() +// +extern WCHAR tchFileDlgFilters[5*1024]; + +bool Style_GetOpenDlgFilterStr(LPWSTR lpszFilter,int cchFilter) +{ + if (StringCchLenW(tchFileDlgFilters,COUNTOF(tchFileDlgFilters)) == 0) + GetString(IDS_FILTER_ALL,lpszFilter,cchFilter); + else { + StringCchCopyN(lpszFilter,cchFilter,tchFileDlgFilters,cchFilter - 2); + StringCchCat(lpszFilter,cchFilter,L"||"); + } + PrepareFilterStr(lpszFilter); + return true; +} + + +//============================================================================= +// +// Style_StrGetFont() +// +bool Style_StrGetFont(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont) +{ + WCHAR tch[64] = { L'\0' }; + WCHAR *p = StrStrI(lpszStyle, L"font:"); + if (p) + { + StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"font:")); + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + + if (StringCchCompareIN(tch,COUNTOF(tch),L"Default",-1) == 0) + { + if (IsFontAvailable(L"Consolas")) + StringCchCopyN(lpszFont,cchFont,L"Consolas",cchFont); + else + StringCchCopyN(lpszFont,cchFont,L"Lucida Console",cchFont); + } + else + { + StringCchCopyN(lpszFont,cchFont,tch, COUNTOF(tch)); + } + return true; + } + return false; +} + + +//============================================================================= +// +// Style_StrGetFontQuality() +// +bool Style_StrGetFontQuality(LPCWSTR lpszStyle,LPWSTR lpszQuality,int cchQuality) +{ + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR *p = StrStrI(lpszStyle, L"smoothing:"); + if (p) + { + StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"smoothing:")); + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + if (StringCchCompareIN(tch,COUNTOF(tch),L"none",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"standard",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"cleartype",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"default",-1) == 0) + { + StringCchCopyN(lpszQuality,cchQuality,tch,COUNTOF(tch)); + return true; + } + } + return false; +} + + +//============================================================================= +// +// Style_StrGetCharSet() +// +bool Style_StrGetCharSet(LPCWSTR lpszStyle, int* i) +{ + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR *p = StrStrI(lpszStyle, L"charset:"); + if (p) + { + StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"charset:")); + p = StrChr(tch, L';'); + if (p) { *p = L'\0'; } + TrimString(tch); + int iValue = 0; + if (1 == swscanf_s(tch, L"%i", &iValue)) + { + *i = max(SC_CHARSET_ANSI, iValue); + return true; + } + } + return false; +} + + +//============================================================================= +// +// Style_StrGetSize() +// +bool Style_StrGetSize(LPCWSTR lpszStyle, float* f) +{ + WCHAR *p = StrStrI(lpszStyle, L"size:"); + if (p) + { + float fSign = 0.0; + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"size:")); + if (tch[0] == L'+') + { + fSign = 1.0; + tch[0] = L' '; + } + else if (tch[0] == L'-') + { + fSign = -1.0; + tch[0] = L' '; + } + p = StrChr(tch, L';'); + if (p) { *p = L'\0'; } + TrimString(tch); + float fValue = 0; + const int itok = swscanf_s(tch,L"%f",&fValue); + if (itok == 1) + { + if (fSign == 0.0) + *f = fValue; + else { + // relative size calculation + const float base = *f; // base is input + *f = (base + (fSign * fValue)); // can be negative + } + return true; + } + } + return false; +} + + +//============================================================================= +// +// Style_StrGetSizeStr() +// +bool Style_StrGetSizeStr(LPCWSTR lpszStyle,LPWSTR lpszSize,int cchSize) +{ + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR *p = StrStrI(lpszStyle, L"size:"); + if (p) + { + StringCchCopy(tch,COUNTOF(tch),(p + CSTRLEN(L"size:"))); + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + StringCchCopyN(lpszSize,cchSize,tch,COUNTOF(tch)); + return true; + } + return false; +} + + +//============================================================================= +// +// Style_StrGetWeightValue() +// +bool Style_StrGetWeightValue(LPCWSTR lpszWeight, int* i) +{ + int iFontWeight = -1; + + if (StrStrI(lpszWeight, L"thin")) + iFontWeight = FW_THIN; + else if (StrStrI(lpszWeight, L"extralight")) + iFontWeight = FW_EXTRALIGHT; + else if (StrStrI(lpszWeight, L"light")) + iFontWeight = FW_LIGHT; + else if (StrStrI(lpszWeight, L"normal")) + iFontWeight = FW_NORMAL; + else if (StrStrI(lpszWeight, L"medium")) + iFontWeight = FW_MEDIUM; + else if (StrStrI(lpszWeight, L"semibold")) + iFontWeight = FW_SEMIBOLD; + else if (StrStrI(lpszWeight, L"extrabold")) + iFontWeight = FW_EXTRABOLD; + else if (StrStrI(lpszWeight, L"bold")) // here, cause bold is in semibold and extrabold too + iFontWeight = FW_BOLD; + else if (StrStrI(lpszWeight, L"heavy")) + iFontWeight = FW_HEAVY; + + if (iFontWeight >= 0) { + *i = iFontWeight; + } + return ((iFontWeight < 0) ? false : true); +} + +//============================================================================= +// +// Style_AppendWeightStr() +// +void Style_AppendWeightStr(LPWSTR lpszWeight, int cchSize, int fontWeight) +{ + if (fontWeight <= FW_THIN) { + StringCchCat(lpszWeight, cchSize, L"; thin"); + } + else if (fontWeight <= FW_EXTRALIGHT) { + StringCchCat(lpszWeight, cchSize, L"; extralight"); + } + else if (fontWeight <= FW_LIGHT) { + StringCchCat(lpszWeight, cchSize, L"; light"); + } + else if (fontWeight <= FW_NORMAL) { + StringCchCat(lpszWeight, cchSize, L"; normal"); + } + else if (fontWeight <= FW_MEDIUM) { + StringCchCat(lpszWeight, cchSize, L"; medium"); + } + else if (fontWeight <= FW_SEMIBOLD) { + StringCchCat(lpszWeight, cchSize, L"; semibold"); + } + else if (fontWeight <= FW_BOLD) { + StringCchCat(lpszWeight, cchSize, L"; bold"); + } + else if (fontWeight <= FW_EXTRABOLD) { + StringCchCat(lpszWeight, cchSize, L"; extrabold"); + } + else { // (fontWeight >= FW_HEAVY) + StringCchCat(lpszWeight, cchSize, L"; heavy"); + } +} + + +//============================================================================= +// +// Style_StrGetColor() +// +bool Style_StrGetColor(bool bFore, LPCWSTR lpszStyle, COLORREF* rgb) +{ + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR *pItem = (bFore) ? L"fore:" : L"back:"; + + WCHAR *p = StrStrI(lpszStyle, pItem); + if (p) + { + StringCchCopy(tch, COUNTOF(tch), p + lstrlen(pItem)); + if (tch[0] == L'#') + tch[0] = L' '; + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + int iValue = 0; + int itok = swscanf_s(tch, L"%x", &iValue); + if (itok == 1) + { + *rgb = RGB((iValue & 0xFF0000) >> 16, (iValue & 0xFF00) >> 8, iValue & 0xFF); + return true; + } + } + return false; +} + + +//============================================================================= +// +// Style_StrGetAlpha() +// +bool Style_StrGetAlpha(LPCWSTR lpszStyle, int* i, bool bAlpha1st) +{ + const WCHAR* strAlpha = bAlpha1st ? L"alpha:" : L"alpha2:"; + + WCHAR* p = StrStrI(lpszStyle, strAlpha); + if (p) { + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + StringCchCopy(tch, COUNTOF(tch), p + lstrlen(strAlpha)); + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + int iValue = 0; + int itok = swscanf_s(tch, L"%i", &iValue); + if (itok == 1) { + *i = min(max(SC_ALPHA_TRANSPARENT, iValue), SC_ALPHA_OPAQUE); + return true; + } + } + return false; +} + + +////============================================================================= +//// +//// Style_StrGetPropertyValue() +//// +//bool Style_StrGetPropertyValue(LPCWSTR lpszStyle, LPCWSTR lpszProperty, int* val) +//{ +// WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; +// WCHAR *p = StrStrI(lpszStyle, lpszProperty); +// if (p) { +// StringCchCopy(tch, COUNTOF(tch), (p + lstrlen(lpszProperty))); +// p = StrChr(tch, L';'); +// if (p) +// *p = L'\0'; +// TrimString(tch); +// if (1 == swscanf_s(tch, L"%i", val)) { return true; } +// } +// return false; +//} + + +//============================================================================= +// +// Style_StrGetCase() +// +bool Style_StrGetCase(LPCWSTR lpszStyle, int* i) +{ + WCHAR *p = StrStrI(lpszStyle, L"case:"); + if (p) { + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + StringCchCopy(tch,COUNTOF(tch),p + CSTRLEN(L"case:")); + p = StrChr(tch, L';'); + if (p) + *p = L'\0'; + TrimString(tch); + if (tch[0] == L'u' || tch[0] == L'U') { + *i = SC_CASE_UPPER; + return true; + } + else if (tch[0] == L'l' || tch[0] == L'L') { + *i = SC_CASE_LOWER; + return true; + } + } + return false; +} + + +//============================================================================= +// +// Style_GetIndicatorType() +// + +static WCHAR* IndicatorTypes[20] = { + L"indic_plain", + L"indic_squiggle", + L"indic_tt", + L"indic_diagonal", + L"indic_strike", + L"indic_hidden", + L"indic_box", + L"indic_roundbox", + L"indic_straightbox", + L"indic_dash", + L"indic_dots", + L"indic_squigglelow", + L"indic_dotbox", + L"indic_squigglepixmap", + L"indic_compositionthick", + L"indic_compositionthin", + L"indic_fullbox", + L"indic_textfore", + L"indic_point", + L"indic_pointcharacter" +}; + +bool Style_GetIndicatorType(LPWSTR lpszStyle, int cchSize, int* idx) +{ + if (*idx < 0) { // retrieve indicator style from string + for (int i = 0; i < COUNTOF(IndicatorTypes); i++) { + if (StrStrI(lpszStyle, IndicatorTypes[i])) { + *idx = i; + return true; + } + } + *idx = INDIC_ROUNDBOX; // default + } + else { // get indicator string from index + + if (*idx < COUNTOF(IndicatorTypes)) + { + StringCchCopy(lpszStyle, cchSize, IndicatorTypes[*idx]); + return true; + } + StringCchCopy(lpszStyle, cchSize, IndicatorTypes[INDIC_ROUNDBOX]); // default + } + return false; +} + + +//============================================================================= +// +// Style_CopyStyles_IfNotDefined() +// +void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, int cchSizeDest, bool bCopyFont, bool bWithEffects) +{ + WCHAR szTmpStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + int iValue; + COLORREF dColor; + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + // --------- Font settings --------- + if (bCopyFont) + { + if (!StrStrI(lpszStyleDest, L"font:")) { + if (Style_StrGetFont(lpszStyleSrc, tch, COUNTOF(tch))) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; font:"); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + // --------- Size --------- + if (!StrStrI(lpszStyleDest, L"size:")) { + if (Style_StrGetSizeStr(lpszStyleSrc, tch, COUNTOF(tch))) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; size:"); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + if (StrStrI(lpszStyleSrc, L"thin") && !StrStrI(lpszStyleDest, L"thin")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; thin"); + else if (StrStrI(lpszStyleSrc, L"extralight") && !StrStrI(lpszStyleDest, L"extralight")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extralight"); + else if (StrStrI(lpszStyleSrc, L"light") && !StrStrI(lpszStyleDest, L"light")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; light"); + else if (StrStrI(lpszStyleSrc, L"normal") && !StrStrI(lpszStyleDest, L"normal")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal"); + else if (StrStrI(lpszStyleSrc, L"medium") && !StrStrI(lpszStyleDest, L"medium")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; medium"); + else if (StrStrI(lpszStyleSrc, L"semibold") && !StrStrI(lpszStyleDest, L"semibold")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; semibold"); + else if (StrStrI(lpszStyleSrc, L"extrabold") && !StrStrI(lpszStyleDest, L"extrabold")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extrabold"); + else if (StrStrI(lpszStyleSrc, L"bold") && !StrStrI(lpszStyleDest, L"bold")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; bold"); + else if (StrStrI(lpszStyleSrc, L"heavy") && !StrStrI(lpszStyleDest, L"heavy")) + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; heavy"); + //else + // StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal"); + + if (StrStrI(lpszStyleSrc, L"italic") && !StrStrI(lpszStyleDest, L"italic")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; italic"); + } + + if (!StrStrI(lpszStyleDest, L"charset:")) { + if (Style_StrGetCharSet(lpszStyleSrc, &iValue)) { + StringCchPrintf(tch, COUNTOF(tch), L"; charset:%i", iValue); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + } + + // --------- Effects --------- + if (bWithEffects) + { + if (StrStrI(lpszStyleSrc, L"strikeout") && !StrStrI(lpszStyleDest, L"strikeout")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; strikeout"); + } + + if (StrStrI(lpszStyleSrc, L"underline") && !StrStrI(lpszStyleDest, L"underline")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; underline"); + } + + if (!StrStrI(lpszStyleDest, L"fore:")) { // foreground + if (Style_StrGetColor(true, lpszStyleSrc, &dColor)) { + StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X", + (int)GetRValue(dColor), (int)GetGValue(dColor), (int)GetBValue(dColor)); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + if (!StrStrI(lpszStyleDest, L"back:")) { // background + if (Style_StrGetColor(false, lpszStyleSrc, &dColor)) { + StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X", + (int)GetRValue(dColor), (int)GetGValue(dColor), (int)GetBValue(dColor)); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + } + + // --------- Special Styles --------- + + if (StrStrI(lpszStyleSrc, L"eolfilled") && !StrStrI(lpszStyleDest, L"eolfilled")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; eolfilled"); + } + + if (!StrStrI(lpszStyleDest, L"smoothing:")) { + if (Style_StrGetFontQuality(lpszStyleSrc, tch, COUNTOF(tch))) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; smoothing:"); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + if (Style_StrGetCase(lpszStyleSrc, &iValue) && !StrStrI(lpszStyleDest, L"case:")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; case:"); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), (iValue == SC_CASE_UPPER) ? L"u" : L""); + } + + if (!StrStrI(lpszStyleDest, L"alpha:")) { + if (Style_StrGetAlpha(lpszStyleSrc, &iValue, true)) { + StringCchPrintf(tch, COUNTOF(tch), L"; alpha:%i", iValue); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + if (!StrStrI(lpszStyleDest, L"alpha2:")) { + if (Style_StrGetAlpha(lpszStyleSrc, &iValue, false)) { + StringCchPrintf(tch, COUNTOF(tch), L"; alpha2:%i", iValue); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + //const WCHAR* wchProperty = L"property:"; + //if (!StrStrI(lpszStyleDest, wchProperty)) { + // if (Style_StrGetPropertyValue(lpszStyleSrc, wchProperty, &iValue)) { + // StringCchPrintf(tch, COUNTOF(tch), L"; %s%i", wchProperty, iValue); + // StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + // } + //} + + // -------- indicator type -------- + if (!StrStrI(lpszStyleDest, L"indic_")) { + iValue = -1; + if (Style_GetIndicatorType(lpszStyleSrc, 0, &iValue)) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; "); + Style_GetIndicatorType(tch, COUNTOF(tch), &iValue); + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch); + } + } + + // -------- other style settings -------- + if (StrStrI(lpszStyleSrc, L"block") && !StrStrI(lpszStyleDest, L"block")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; block"); + } + + if (StrStrI(lpszStyleSrc, L"noblink") && !StrStrI(lpszStyleDest, L"noblink")) { + StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; noblink"); + } + + StrTrim(szTmpStyle, L" ;"); + StringCchCat(lpszStyleDest, cchSizeDest, szTmpStyle); +} + + +/// Callback to set the font dialog's title +static WCHAR FontSelTitle[128]; + +static UINT CALLBACK Style_FontDialogHook( + HWND hdlg, // handle to the dialog box window + UINT uiMsg, // message identifier + WPARAM wParam, // message parameter + LPARAM lParam // message parameter +) +{ + if (uiMsg == WM_INITDIALOG) { + SetWindowText(hdlg, (WCHAR*)((CHOOSEFONT*)lParam)->lCustData); + } + UNUSED(wParam); + return 0; // Allow the default handler a chance to process +} + +//============================================================================= +// +// Style_SelectFont() +// +bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerName, LPCWSTR sStyleName, + bool bGlobalDefaultStyle, bool bCurrentDefaultStyle, + bool bWithEffects, bool bPreserveStyles) +{ + // Map lpszStyle to LOGFONT + WCHAR wchFontName[64] = { L'\0' }; + if (!Style_StrGetFont(lpszStyle, wchFontName, COUNTOF(wchFontName))) + { + if (!Style_StrGetFont(GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue, wchFontName, COUNTOF(wchFontName))) + { + Style_StrGetFont(L"font:Default", wchFontName, COUNTOF(wchFontName)); + } + } + + int iCharSet = g_iDefaultCharSet; + if (!Style_StrGetCharSet(lpszStyle, &iCharSet)) { + iCharSet = g_iDefaultCharSet; + } + + // is "size:" definition relative ? + bool bRelFontSize = (!StrStrI(lpszStyle, L"size:") || StrStrI(lpszStyle, L"size:+") || StrStrI(lpszStyle, L"size:-")); + + const float fBaseFontSize = (float)(bGlobalDefaultStyle ? (INITIAL_BASE_FONT_SIZE * 1.0) : + (bCurrentDefaultStyle ? Style_GetBaseFontSize(hwnd) : Style_GetCurrentFontSize(hwnd))); + + // Font Height + int iFontHeight = 0; + float fFontSize = fBaseFontSize; + if (Style_StrGetSize(lpszStyle,&fFontSize) > 0.0) { + HDC hdc = GetDC(hwnd); + iFontHeight = -MulDiv((int)(fFontSize * 100.0 + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 7200); + ReleaseDC(hwnd,hdc); + } + else { + HDC hdc = GetDC(hwnd); + iFontHeight = -MulDiv((int)(fBaseFontSize * 100.0 + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 7200); + ReleaseDC(hwnd, hdc); + } + + // Font Weight + int iFontWeight = FW_NORMAL; + if (!Style_StrGetWeightValue(lpszStyle, &iFontWeight)) { + iFontWeight = FW_NORMAL; + } + bool bIsItalic = (StrStrI(lpszStyle, L"italic")) ? true : false; + bool bIsUnderline = (StrStrI(lpszStyle, L"underline")) ? true : false; + bool bIsStrikeout = (StrStrI(lpszStyle, L"strikeout")) ? true : false; + + // -------------------------------------------------------------------------- + + LOGFONT lf; + ZeroMemory(&lf, sizeof(LOGFONT)); + StringCchCopyN(lf.lfFaceName, COUNTOF(lf.lfFaceName), wchFontName, COUNTOF(wchFontName)); + lf.lfCharSet = (BYTE)iCharSet; + lf.lfHeight = iFontHeight; + lf.lfWeight = iFontWeight; + lf.lfItalic = (BYTE)bIsItalic; + lf.lfUnderline = (BYTE)bIsUnderline; + lf.lfStrikeOut = (BYTE)bIsStrikeout; + + + COLORREF color = 0L; + Style_StrGetColor(true, lpszStyle, &color); + + // Init cf + CHOOSEFONT cf; + ZeroMemory(&cf, sizeof(CHOOSEFONT)); + cf.lStructSize = sizeof(CHOOSEFONT); + cf.hwndOwner = hwnd; + cf.rgbColors = color; + cf.lpLogFont = &lf; + cf.lpfnHook = (LPCFHOOKPROC)Style_FontDialogHook; // Register the callback + cf.lCustData = (LPARAM)FontSelTitle; + //cf.Flags = CF_INITTOLOGFONTSTRUCT /*| CF_EFFECTS | CF_NOSCRIPTSEL*/ | CF_SCREENFONTS | CF_FORCEFONTEXIST | CF_ENABLEHOOK; + cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_BOTH | CF_WYSIWYG | CF_FORCEFONTEXIST | CF_ENABLEHOOK; + + if (bGlobalDefaultStyle) { + if (bRelFontSize) + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ BASE (%s) +++", sStyleName); + else + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" BASE (%s)", sStyleName); + } + else if (bCurrentDefaultStyle) { + if (bRelFontSize) + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ %s: %s Style +++", sLexerName, sStyleName); + else + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" %s: %s Style", sLexerName, sStyleName); + } + else { + if (bRelFontSize) + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ Style '%s' (%s) +++", sStyleName, sLexerName); + else + StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" Style '%s' (%s)", sStyleName, sLexerName); + } + + if (bWithEffects) + cf.Flags |= CF_EFFECTS; + + if (HIBYTE(GetKeyState(VK_SHIFT))) + cf.Flags |= CF_FIXEDPITCHONLY; + + + // --- open systems Font Selection dialog --- + + if (!ChooseFont(&cf) || (lf.lfFaceName[0] == L'\0')) { return false; } + + // --- map back to lpszStyle --- + + WCHAR szNewStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + if (StrStrI(lpszStyle, L"font:")) { + StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L"font:"); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), lf.lfFaceName); + } + else { // no font in source specified, + if (lstrcmpW(lf.lfFaceName, wchFontName) != 0) { + StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L"font:"); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), lf.lfFaceName); + } + } + + if (lf.lfWeight == iFontWeight) { + WCHAR check[64] = { L'\0' }; + Style_AppendWeightStr(check, COUNTOF(check), lf.lfWeight); + StrTrimW(check, L" ;"); + if (StrStrI(lpszStyle, check)) { + Style_AppendWeightStr(szNewStyle, COUNTOF(szNewStyle), lf.lfWeight); + } + } + else { + Style_AppendWeightStr(szNewStyle, COUNTOF(szNewStyle), lf.lfWeight); + } + + + float fNewFontSize = (float)(cf.iPointSize / 10.0); + WCHAR newSize[64] = { L'\0' }; + + if (bRelFontSize) + { + float fNewRelSize = fNewFontSize - fBaseFontSize; + + if (fNewRelSize >= 0.0) { + if (HasFractionCent(fNewRelSize)) + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:+%.2f", fNewRelSize); + else + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:+%i", (int)fNewRelSize); + } + else { + if (HasFractionCent(fNewRelSize)) + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:-%.2f", (0.0 - fNewRelSize)); + else + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:-%i", (int)(0.0 - fNewRelSize)); + } + } + else { + fFontSize = (float)(((int)(fFontSize * 100.0 + 0.5)) / 100.0); + fNewFontSize = (float)(((int)(fNewFontSize * 100.0 + 0.5)) / 100.0); + if (fNewFontSize == fFontSize) { + if (StrStrI(lpszStyle, L"size:")) { + if (HasFractionCent(fNewFontSize)) + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%.2f", fNewFontSize); + else + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%i", (int)fNewFontSize); + } + } + else { + if (HasFractionCent(fNewFontSize)) + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%.2f", fNewFontSize); + else + StringCchPrintfW(newSize, COUNTOF(newSize), L"; size:%i", (int)fNewFontSize); + } + } + StringCchCat(szNewStyle, COUNTOF(szNewStyle), newSize); + + + WCHAR chset[32] = { L'\0' }; + if (bGlobalDefaultStyle && + (lf.lfCharSet != DEFAULT_CHARSET) && + (lf.lfCharSet != ANSI_CHARSET) && + (lf.lfCharSet != g_iDefaultCharSet)) { + if (lf.lfCharSet == iCharSet) { + if (StrStrI(lpszStyle, L"charset:")) + { + StringCchPrintf(chset, COUNTOF(chset), L"; charset:%i", lf.lfCharSet); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), chset); + } + } + else { + StringCchPrintf(chset, COUNTOF(chset), L"; charset:%i", lf.lfCharSet); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), chset); + } + } + + if (lf.lfItalic) { + if (bIsItalic) { + if (StrStrI(lpszStyle, L"italic")) { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; italic"); + } + } + else { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; italic"); + } + } + + + if (bWithEffects) { + + if (lf.lfUnderline) { + if (bIsUnderline) { + if (StrStrI(lpszStyle, L"underline")) { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; underline"); + } + } + else { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; underline"); + } + } + + if (lf.lfStrikeOut) { + if (bIsStrikeout) { + if (StrStrI(lpszStyle, L"strikeout")) { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; strikeout"); + } + } + else { + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; strikeout"); + } + } + + // --- save colors --- + WCHAR newColor[64] = { L'\0' }; + if (cf.rgbColors == color) { + if (StrStrI(lpszStyle, L"fore:")) { + StringCchPrintf(newColor, COUNTOF(newColor), L"; fore:#%02X%02X%02X", + (int)GetRValue(cf.rgbColors), + (int)GetGValue(cf.rgbColors), + (int)GetBValue(cf.rgbColors)); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); + } + } + else { // color changed + StringCchPrintf(newColor, COUNTOF(newColor), L"; fore:#%02X%02X%02X", + (int)GetRValue(cf.rgbColors), + (int)GetGValue(cf.rgbColors), + (int)GetBValue(cf.rgbColors)); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); + } + // copy background + if (Style_StrGetColor(false, lpszStyle, &color)) { + StringCchPrintf(newColor, COUNTOF(newColor), L"; back:#%02X%02X%02X", + (int)GetRValue(color), + (int)GetGValue(color), + (int)GetBValue(color)); + StringCchCat(szNewStyle, COUNTOF(szNewStyle), newColor); + } + } + + if (bPreserveStyles) { + // copy all other styles + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; "); + Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), false, !bWithEffects); + } + + StrTrim(szNewStyle, L" ;"); + StringCchCopyN(lpszStyle, cchStyle, szNewStyle, COUNTOF(szNewStyle)); + return true; +} + + +//============================================================================= +// +// Style_SelectColor() +// +bool Style_SelectColor(HWND hwnd,bool bForeGround,LPWSTR lpszStyle,int cchStyle, bool bPreserveStyles) +{ + CHOOSECOLOR cc; + WCHAR szNewStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; + COLORREF dRGBResult; + COLORREF dColor; + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + ZeroMemory(&cc,sizeof(CHOOSECOLOR)); + + dRGBResult = (bForeGround) ? GetSysColor(COLOR_WINDOWTEXT) : GetSysColor(COLOR_WINDOW); + Style_StrGetColor(bForeGround,lpszStyle,&dRGBResult); + + cc.lStructSize = sizeof(CHOOSECOLOR); + cc.hwndOwner = hwnd; + cc.rgbResult = dRGBResult; + cc.lpCustColors = g_colorCustom; + cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR; + + if (!ChooseColor(&cc)) + return false; + + dRGBResult = cc.rgbResult; + + + // Rebuild style string + StringCchCopy(szNewStyle, COUNTOF(szNewStyle), L""); // clear + + if (bForeGround) + { + StringCchPrintf(tch,COUNTOF(tch),L"; fore:#%02X%02X%02X", + (int)GetRValue(dRGBResult), + (int)GetGValue(dRGBResult), + (int)GetBValue(dRGBResult)); + StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); + + if (Style_StrGetColor(false,lpszStyle,&dColor)) + { + StringCchPrintf(tch,COUNTOF(tch),L"; back:#%02X%02X%02X", + (int)GetRValue(dColor), + (int)GetGValue(dColor), + (int)GetBValue(dColor)); + StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); + } + } + else // set background + { + if (Style_StrGetColor(true,lpszStyle,&dColor)) + { + StringCchPrintf(tch,COUNTOF(tch),L"; fore:#%02X%02X%02X; ", + (int)GetRValue(dColor), + (int)GetGValue(dColor), + (int)GetBValue(dColor)); + StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); + } + StringCchPrintf(tch,COUNTOF(tch),L"; back:#%02X%02X%02X", + (int)GetRValue(dRGBResult), + (int)GetGValue(dRGBResult), + (int)GetBValue(dRGBResult)); + StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch); + } + + if (bPreserveStyles) { + // copy all other styles + StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; "); + Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), true, false); + } + + StrTrim(szNewStyle, L" ;"); + StringCchCopyN(lpszStyle,cchStyle,szNewStyle,cchStyle); + return true; +} + + +//============================================================================= +// +// Style_SetStyles() +// +void Style_SetStyles(HWND hwnd, int iStyle, LPCWSTR lpszStyle) +{ + WCHAR tch[64] = { L'\0' }; + + if (lstrlen(lpszStyle) == 0) { return; } + + // reset horizontal scrollbar width + SendMessage(hwnd, SCI_SETSCROLLWIDTH, 1, 0); + + // Font + if (Style_StrGetFont(lpszStyle, tch, COUNTOF(tch))) { + if (lstrlen(tch) > 0) { + char chFont[64] = { '\0' }; + WideCharToMultiByteStrg(Encoding_SciCP, tch, chFont); + SendMessage(hwnd, SCI_STYLESETFONT, iStyle, (LPARAM)chFont); + } + } + + // Size values are relative to fBaseFontSize + float fValue = IsLexerStandard(g_pLexCurrent) ? Style_GetBaseFontSize(hwnd) : Style_GetCurrentFontSize(hwnd); + + if (Style_StrGetSize(lpszStyle, &fValue) > 0.0) { + //SendMessage(hwnd, SCI_STYLESETSIZE, iStyle, (LPARAM)iValue); + SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, iStyle, (LPARAM)((int)(fValue * SC_FONT_SIZE_MULTIPLIER + 0.5))); + } + + int iValue = 0; + COLORREF dColor = 0L; + // Fore + if (Style_StrGetColor(true,lpszStyle,&dColor)) + SendMessage(hwnd,SCI_STYLESETFORE,iStyle,(LPARAM)dColor); + + // Back + if (Style_StrGetColor(false,lpszStyle,&dColor)) + SendMessage(hwnd,SCI_STYLESETBACK,iStyle,(LPARAM)dColor); + + // Weight + if (Style_StrGetWeightValue(lpszStyle,&iValue)) + SendMessage(hwnd, SCI_STYLESETWEIGHT, iStyle, (LPARAM)iValue); + + // Italic + if (StrStrI(lpszStyle, L"italic")) + SendMessage(hwnd,SCI_STYLESETITALIC,iStyle,(LPARAM)true); + + // Underline + if (StrStrI(lpszStyle, L"underline")) + SendMessage(hwnd,SCI_STYLESETUNDERLINE,iStyle,(LPARAM)true); + + // StrikeOut does not exist in scintilla ??? / Hide instead (no good idea) + //if (StrStrI(lpszStyle, L"strikeout")) + // SendMessage(hwnd, SCI_STYLESETVISIBLE,iStyle,(LPARAM)false); + + // EOL Filled + if (StrStrI(lpszStyle, L"eolfilled")) + SendMessage(hwnd,SCI_STYLESETEOLFILLED,iStyle,(LPARAM)true); + + // Case + if (Style_StrGetCase(lpszStyle, &iValue)) + SendMessage(hwnd,SCI_STYLESETCASE,iStyle,(LPARAM)iValue); + + // Character Set + if (Style_StrGetCharSet(lpszStyle, &iValue)) + SendMessage(hwnd,SCI_STYLESETCHARACTERSET,iStyle,(LPARAM)iValue); + +} + + +//============================================================================= +// +// Style_SetFontQuality() +// +void Style_SetFontQuality(HWND hwnd,LPCWSTR lpszStyle) { + + WPARAM wQuality = (WPARAM)FontQuality[iSciFontQuality]; + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + + if (Style_StrGetFontQuality(lpszStyle,tch,COUNTOF(tch))) { + if (StringCchCompareIN(tch,COUNTOF(tch),L"default",-1) == 0) + wQuality = SC_EFF_QUALITY_DEFAULT; + else if (StringCchCompareIN(tch,COUNTOF(tch),L"none",-1) == 0) + wQuality = SC_EFF_QUALITY_NON_ANTIALIASED; + else if (StringCchCompareIN(tch,COUNTOF(tch),L"standard",-1) == 0) + wQuality = SC_EFF_QUALITY_ANTIALIASED; + else if (StringCchCompareIN(tch,COUNTOF(tch),L"cleartype",-1) == 0) + wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; + } + else if (wQuality == SC_EFF_QUALITY_DEFAULT) { + // undefined, use general settings, except for special fonts + if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch))) { + if (StringCchCompareIN(tch,COUNTOF(tch),L"Calibri",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Cambria",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Candara",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Consolas",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Constantia",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Corbel",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Segoe UI",-1) == 0 || + StringCchCompareIN(tch,COUNTOF(tch),L"Source Code Pro",-1) == 0) + wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; + } + } + SendMessage(hwnd,SCI_SETFONTQUALITY,wQuality,0); +} + + +//============================================================================= +// +// Style_GetCurrentLexerName() +// +void Style_GetCurrentLexerName(LPWSTR lpszName, int cchName) +{ + if (IsLexerStandard(g_pLexCurrent)) { + StringCchPrintfW(lpszName, cchName, L" %s", GetCurrentStdLexer()->pszName); + } + else { + if (!GetString(g_pLexCurrent->rid, lpszName, cchName)) { + StringCchCopyW(lpszName, cchName, g_pLexCurrent->pszName); + } + } +} + + +//============================================================================= +// +// Style_GetLexerIconId() +// +int Style_GetLexerIconId(PEDITLEXER plex) +{ + WCHAR pszFile[MAX_PATH + BUFZIZE_STYLE_EXTENTIONS]; + + WCHAR *pszExtensions; + if (StringCchLenW(plex->szExtensions,COUNTOF(plex->szExtensions))) + pszExtensions = plex->szExtensions; + else + pszExtensions = plex->pszDefExt; + + StringCchCopy(pszFile,COUNTOF(pszFile),L"*."); + StringCchCat(pszFile,COUNTOF(pszFile),pszExtensions); + + WCHAR *p = StrChr(pszFile, L';'); + if (p) { *p = L'\0'; } + + // check for ; at beginning + if (StringCchLen(pszFile, COUNTOF(pszFile)) < 3) + StringCchCat(pszFile, COUNTOF(pszFile),L"txt"); + + SHFILEINFO shfi; + ZeroMemory(&shfi,sizeof(SHFILEINFO)); + + SHGetFileInfo(pszFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO), + SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES); + + return (shfi.iIcon); +} + + +//============================================================================= +// +// Style_AddLexerToTreeView() +// +HTREEITEM Style_AddLexerToTreeView(HWND hwnd,PEDITLEXER plex) +{ + WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; + + HTREEITEM hTreeNode; + + TVINSERTSTRUCT tvis; + ZeroMemory(&tvis,sizeof(TVINSERTSTRUCT)); + + tvis.hInsertAfter = TVI_LAST; + + tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; + + if (GetString(plex->rid,tch,COUNTOF(tch))) + tvis.item.pszText = tch; + else + tvis.item.pszText = plex->pszName; + + tvis.item.iImage = Style_GetLexerIconId(plex); + tvis.item.iSelectedImage = tvis.item.iImage; + tvis.item.lParam = (LPARAM)plex; + + hTreeNode = TreeView_InsertItem(hwnd,&tvis); + + tvis.hParent = hTreeNode; + + tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; + //tvis.item.iImage = -1; + //tvis.item.iSelectedImage = -1; + + int i = 1; // default style is handled separately + while (plex->Styles[i].iStyle != -1) { + + if (GetString(plex->Styles[i].rid,tch,COUNTOF(tch))) + tvis.item.pszText = tch; + else + tvis.item.pszText = plex->Styles[i].pszName; + tvis.item.lParam = (LPARAM)(&plex->Styles[i]); + TreeView_InsertItem(hwnd,&tvis); + i++; + } + + return hTreeNode; +} + + +//============================================================================= +// +// Style_AddLexerToListView() +// +void Style_AddLexerToListView(HWND hwnd,PEDITLEXER plex) +{ + WCHAR tch[MIDSZ_BUFFER] = { L'\0' }; + LVITEM lvi; + ZeroMemory(&lvi,sizeof(LVITEM)); + + lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; + lvi.iItem = ListView_GetItemCount(hwnd); + if (GetString(plex->rid,tch,COUNTOF(tch))) + lvi.pszText = tch; + else + lvi.pszText = plex->pszName; + lvi.iImage = Style_GetLexerIconId(plex); + lvi.lParam = (LPARAM)plex; + + ListView_InsertItem(hwnd,&lvi); +} + + +//============================================================================= +// +// Style_CustomizeSchemesDlgProc() +// +INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + + static HWND hwndTV; + static bool fDragging; + static PEDITLEXER pCurrentLexer; + static PEDITSTYLE pCurrentStyle; + static HFONT hFontTitle; + static HBRUSH hbrFore; + static HBRUSH hbrBack; + static bool bIsStyleSelected = false; + + static WCHAR* Style_StylesBackup[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER]; + + WCHAR tchBuf[128] = { L'\0' }; + + switch(umsg) + { + case WM_INITDIALOG: + { + // Backup Styles + ZeroMemory(&Style_StylesBackup, NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * sizeof(WCHAR*)); + int cnt = 0; + for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { + Style_StylesBackup[cnt++] = StrDup(g_pLexArray[iLexer]->szExtensions); + int i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + Style_StylesBackup[cnt++] = StrDup(g_pLexArray[iLexer]->Styles[i].szValue); + ++i; + } + } + + hwndTV = GetDlgItem(hwnd,IDC_STYLELIST); + fDragging = false; + + SHFILEINFO shfi; + ZeroMemory(&shfi, sizeof(SHFILEINFO)); + TreeView_SetImageList(hwndTV, + (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY,&shfi,sizeof(SHFILEINFO), + SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),TVSIL_NORMAL); + + // findlexer + int found = -1; + for (int i = 0; i < COUNTOF(g_pLexArray); ++i) { + //if (StringCchCompareX(g_pLexArray[i]->pszName, g_pLexCurrent->pszName) == 0) { + if (g_pLexArray[i] == g_pLexCurrent) { + found = i; + break; + } + } + + // Build lexer tree view + HTREEITEM hCurrentTVLex = NULL; + for (int i = 0; i < COUNTOF(g_pLexArray); i++) + { + if (i == found) + hCurrentTVLex = Style_AddLexerToTreeView(hwndTV,g_pLexArray[i]); + else + Style_AddLexerToTreeView(hwndTV,g_pLexArray[i]); + } + if (!hCurrentTVLex) + { + hCurrentTVLex = TreeView_GetRoot(hwndTV); + if (Style_GetUse2ndDefault()) + hCurrentTVLex = TreeView_GetNextSibling(hwndTV, hCurrentTVLex); + } + TreeView_Select(hwndTV, hCurrentTVLex, TVGN_CARET); + + pCurrentLexer = (found >= 0) ? g_pLexCurrent : GetDefaultLexer(); + pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); + + SendDlgItemMessage(hwnd,IDC_STYLEEDIT,EM_LIMITTEXT, max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)-1,0); + + MakeBitmapButton(hwnd,IDC_PREVSTYLE,g_hInstance,IDB_PREV); + MakeBitmapButton(hwnd,IDC_NEXTSTYLE,g_hInstance,IDB_NEXT); + + // Setup title font + if (hFontTitle) + DeleteObject(hFontTitle); + + if (NULL == (hFontTitle = (HFONT)SendDlgItemMessage(hwnd,IDC_TITLE,WM_GETFONT,0,0))) + hFontTitle = GetStockObject(DEFAULT_GUI_FONT); + + LOGFONT lf; + GetObject(hFontTitle,sizeof(LOGFONT),&lf); + lf.lfHeight += lf.lfHeight / 5; + lf.lfWeight = FW_BOLD; + hFontTitle = CreateFontIndirect(&lf); + SendDlgItemMessage(hwnd,IDC_TITLE,WM_SETFONT,(WPARAM)hFontTitle,true); + + if (xCustomSchemesDlg == 0 || yCustomSchemesDlg == 0) + CenterDlgInParent(hwnd); + else + SetDlgPos(hwnd, xCustomSchemesDlg, yCustomSchemesDlg); + + HMENU hmenu = GetSystemMenu(hwnd, false); + GetString(IDS_PREVIEW, tchBuf, COUNTOF(tchBuf)); + InsertMenu(hmenu, 0, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_PREVIEW, tchBuf); + InsertMenu(hmenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + GetString(IDS_SAVEPOS, tchBuf, COUNTOF(tchBuf)); + InsertMenu(hmenu, 2, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_SAVEPOS, tchBuf); + GetString(IDS_RESETPOS, tchBuf, COUNTOF(tchBuf)); + InsertMenu(hmenu, 3, MF_BYPOSITION | MF_STRING | MF_ENABLED, IDS_RESETPOS, tchBuf); + InsertMenu(hmenu, 4, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + } + return true; + + case WM_ACTIVATE: + DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == g_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); + break; + + case WM_DESTROY: + { + DeleteBitmapButton(hwnd, IDC_STYLEFORE); + DeleteBitmapButton(hwnd, IDC_STYLEBACK); + DeleteBitmapButton(hwnd, IDC_PREVSTYLE); + DeleteBitmapButton(hwnd, IDC_NEXTSTYLE); + // free old backup + int cnt = 0; + for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { + if (Style_StylesBackup[cnt]) { + LocalFree(Style_StylesBackup[cnt]); + Style_StylesBackup[cnt] = NULL; + } + ++cnt; + int i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + if (Style_StylesBackup[cnt]) { + LocalFree(Style_StylesBackup[cnt]); + Style_StylesBackup[cnt] = NULL; + } + ++cnt; + ++i; + } + } + pCurrentLexer = NULL; + pCurrentStyle = NULL; + } + return false; + + #define APPLY_DIALOG_ITEM_TEXT { \ + bool bChgNfy = false; \ + WCHAR szBuf[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)]; \ + GetDlgItemText(hwnd, IDC_STYLEEDIT, szBuf, COUNTOF(szBuf)); \ + if (StringCchCompareIXW(szBuf, pCurrentStyle->szValue) != 0) { \ + StringCchCopyW(pCurrentStyle->szValue, COUNTOF(pCurrentStyle->szValue), szBuf); \ + bChgNfy = true; \ + } \ + if (!bIsStyleSelected) { \ + if (!GetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, szBuf, COUNTOF(szBuf))) { \ + StringCchCopy(szBuf, COUNTOF(szBuf), pCurrentLexer->pszDefExt); \ + } \ + if (StringCchCompareIXW(szBuf, pCurrentLexer->szExtensions) != 0) { \ + StringCchCopyW(pCurrentLexer->szExtensions, COUNTOF(pCurrentLexer->szExtensions), szBuf); \ + bChgNfy = true; \ + } \ + } \ + if (bChgNfy && ( IsLexerStandard(pCurrentLexer) || (pCurrentLexer == g_pLexCurrent))) { \ + Style_SetLexer(g_hwndEdit, g_pLexCurrent); \ + } \ + } + + + case WM_SYSCOMMAND: + if (wParam == IDS_SAVEPOS) { + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_SAVEPOS, 0), 0); + return true; + } + else if (wParam == IDS_RESETPOS) { + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDACC_RESETPOS, 0), 0); + return true; + } + else + return false; + + + case WM_NOTIFY: + + if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) + { + LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam; + + switch (lpnmtv->hdr.code) + { + + case TVN_SELCHANGED: + { + if (pCurrentLexer && pCurrentStyle) { + APPLY_DIALOG_ITEM_TEXT; + } + + WCHAR label[128] = { L'\0' }; + + //DialogEnableWindow(hwnd, IDC_STYLEEDIT, true); + //DialogEnableWindow(hwnd, IDC_STYLEFONT, true); + //DialogEnableWindow(hwnd, IDC_STYLEFORE, true); + //DialogEnableWindow(hwnd, IDC_STYLEBACK, true); + //DialogEnableWindow(hwnd, IDC_STYLEDEFAULT, true); + + // a lexer has been selected + if (!TreeView_GetParent(hwndTV,lpnmtv->itemNew.hItem)) + { + pCurrentLexer = (PEDITLEXER)lpnmtv->itemNew.lParam; + + if (pCurrentLexer) + { + bIsStyleSelected = false; + SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT, L"Associated filename extensions:"); + DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,true); + SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->szExtensions); + DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, true); + + if (IsLexerStandard(pCurrentLexer)) + { + pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); + + if (pCurrentStyle->rid == 63100) { + StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); + } + else { + StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); + DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); + } + } + else { + pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); + StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); + } + SetDlgItemText(hwnd, IDC_STYLELABEL, label); + SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); + } + else + { + SetDlgItemText(hwnd,IDC_STYLELABEL_ROOT,L""); + DialogEnableWindow(hwnd,IDC_STYLEEDIT_ROOT,false); + SetDlgItemText(hwnd, IDC_STYLELABEL, L""); + DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); + } + DialogEnableWindow(hwnd, IDC_PREVIEW, ((pCurrentLexer == g_pLexCurrent) || (pCurrentLexer == GetCurrentStdLexer()))); + } + // a style has been selected + else + { + if (IsLexerStandard(pCurrentLexer)) + { + if (pCurrentLexer->Styles[STY_DEFAULT].rid == 63100) + StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); + else + StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); + } + else { + StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); + } + SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label); + + SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->Styles[STY_DEFAULT].szValue); + DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); + + pCurrentStyle = (PEDITSTYLE)lpnmtv->itemNew.lParam; + + if (pCurrentStyle) + { + bIsStyleSelected = true; + StringCchPrintfW(label, COUNTOF(label), L"%s's style:", pCurrentStyle->pszName); + SetDlgItemText(hwnd, IDC_STYLELABEL, label); + SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); + } + else + { + SetDlgItemText(hwnd, IDC_STYLELABEL, L""); + DialogEnableWindow(hwnd, IDC_STYLEEDIT, false); + } + } + } + break; + + case TVN_BEGINDRAG: + { + TreeView_Select(hwndTV,lpnmtv->itemNew.hItem,TVGN_CARET); + + if (bIsStyleSelected) + DestroyCursor(SetCursor(LoadCursor(g_hInstance,MAKEINTRESOURCE(IDC_COPY)))); + else + DestroyCursor(SetCursor(LoadCursor(NULL,IDC_NO))); + + SetCapture(hwnd); + fDragging = true; + } + + } + } + break; + + + case WM_MOUSEMOVE: + { + HTREEITEM htiTarget; + TVHITTESTINFO tvht; + + if (fDragging && bIsStyleSelected) + { + LONG xCur = LOWORD(lParam); + LONG yCur = HIWORD(lParam); + + //ImageList_DragMove(xCur,yCur); + //ImageList_DragShowNolock(false); + + tvht.pt.x = xCur; + tvht.pt.y = yCur; + + //ClientToScreen(hwnd,&tvht.pt); + //ScreenToClient(hwndTV,&tvht.pt); + MapWindowPoints(hwnd,hwndTV,&tvht.pt,1); + + if ((htiTarget = TreeView_HitTest(hwndTV,&tvht)) != NULL && + TreeView_GetParent(hwndTV,htiTarget) != NULL) + { + TreeView_SelectDropTarget(hwndTV,htiTarget); + //TreeView_Expand(hwndTV,htiTarget,TVE_EXPAND); + TreeView_EnsureVisible(hwndTV,htiTarget); + } + else + TreeView_SelectDropTarget(hwndTV,NULL); + + //ImageList_DragShowNolock(true); + } + } + break; + + + case WM_LBUTTONUP: + { + if (fDragging && bIsStyleSelected) + { + //ImageList_EndDrag(); + HTREEITEM htiTarget = TreeView_GetDropHilight(hwndTV); + if (htiTarget) + { + WCHAR tchCopy[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = { L'\0' }; + TreeView_SelectDropTarget(hwndTV,NULL); + GetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy,COUNTOF(tchCopy)); + TreeView_Select(hwndTV,htiTarget,TVGN_CARET); + + // after select, this is new current item + SetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy); + APPLY_DIALOG_ITEM_TEXT; + } + ReleaseCapture(); + DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW))); + fDragging = false; + } + } + break; + + + case WM_CANCELMODE: + { + if (fDragging) + { + //ImageList_EndDrag(); + TreeView_SelectDropTarget(hwndTV,NULL); + ReleaseCapture(); + DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW))); + fDragging = false; + } + } + break; + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_SETCURLEXERTV: + { + // find current lexer's tree entry + HTREEITEM hCurrentTVLex = TreeView_GetRoot(hwndTV); + for (int i = 0; i < COUNTOF(g_pLexArray); ++i) { + if (g_pLexArray[i] == g_pLexCurrent) { + break; + } + hCurrentTVLex = TreeView_GetNextSibling(hwndTV, hCurrentTVLex); // next + } + if (g_pLexCurrent == pCurrentLexer) + break; // no change + + // collaps current node + HTREEITEM hSel = TreeView_GetSelection(hwndTV); + if (hSel) { + HTREEITEM hPar = TreeView_GetParent(hwndTV, hSel); + TreeView_Expand(hwndTV, hSel, TVE_COLLAPSE); + if (hPar) + TreeView_Expand(hwndTV, hPar, TVE_COLLAPSE); + } + + // set new lexer + TreeView_Select(hwndTV, hCurrentTVLex, TVGN_CARET); + TreeView_Expand(hwndTV, hCurrentTVLex, TVE_EXPAND); + + pCurrentLexer = g_pLexCurrent; + pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); + + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + } + break; + + + case IDC_STYLEFORE: + if (pCurrentStyle) { + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); + if (Style_SelectColor(hwnd, true, tch, COUNTOF(tch), true)) { + SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); + } + } + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + break; + + + case IDC_STYLEBACK: + if (pCurrentStyle) { + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); + if (Style_SelectColor(hwnd, false, tch, COUNTOF(tch), true)) { + SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); + } + } + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + break; + + + case IDC_STYLEFONT: + if (pCurrentStyle) { + WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); + + if (Style_SelectFont(hwnd, tch, COUNTOF(tch), pCurrentLexer->pszName, pCurrentStyle->pszName, + IsStyleStandardDefault(pCurrentStyle), IsStyleSchemeDefault(pCurrentStyle), false, true)) { + SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); + } + } + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + break; + + + case IDC_STYLEDEFAULT: + SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->pszDefault); + if (!bIsStyleSelected) { + SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->pszDefExt); + } + APPLY_DIALOG_ITEM_TEXT; + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + break; + + + case IDC_STYLEEDIT: + { + if (HIWORD(wParam) == EN_CHANGE) { + WCHAR tch[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = { L'\0' }; + + GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); + + COLORREF cr = (COLORREF)-1; // SciCall_StyleGetFore(STYLE_DEFAULT); + Style_StrGetColor(true, tch, &cr); + MakeColorPickButton(hwnd, IDC_STYLEFORE, g_hInstance, cr); + + cr = (COLORREF)-1; // SciCall_StyleGetBack(STYLE_DEFAULT); + Style_StrGetColor(false, tch, &cr); + MakeColorPickButton(hwnd, IDC_STYLEBACK, g_hInstance, cr); + } + } + break; + + + case IDC_IMPORT: + { + hwndTV = GetDlgItem(hwnd, IDC_STYLELIST); + + if (Style_Import(hwnd)) { + SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); + if (!bIsStyleSelected) { + SetDlgItemText(hwnd, IDC_STYLEEDIT_ROOT, pCurrentLexer->szExtensions); + } + TreeView_Select(hwndTV, TreeView_GetRoot(hwndTV), TVGN_CARET); + Style_SetLexer(g_hwndEdit, g_pLexCurrent); + } + } + break; + + + case IDC_EXPORT: + { + APPLY_DIALOG_ITEM_TEXT; + Style_Export(hwnd); + } + break; + + + case IDC_PREVIEW: + { + APPLY_DIALOG_ITEM_TEXT; + } + break; + + + case IDC_PREVSTYLE: + { + APPLY_DIALOG_ITEM_TEXT; + HTREEITEM hSel = TreeView_GetSelection(hwndTV); + if (hSel) { + HTREEITEM hPrev = TreeView_GetPrevVisible(hwndTV, hSel); + if (hPrev) + TreeView_Select(hwndTV, hPrev, TVGN_CARET); + } + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + } + break; + + + case IDC_NEXTSTYLE: + { + APPLY_DIALOG_ITEM_TEXT; + HTREEITEM hSel = TreeView_GetSelection(hwndTV); + if (hSel) { + HTREEITEM hNext = TreeView_GetNextVisible(hwndTV, hSel); + if (hNext) + TreeView_Select(hwndTV, hNext, TVGN_CARET); + } + PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetDlgItem(hwnd, IDC_STYLEEDIT)), 1); + } + break; + + + case IDOK: + APPLY_DIALOG_ITEM_TEXT; + g_fStylesModified = true; + if (!g_fWarnedNoIniFile && (StringCchLenW(g_wchIniFile, COUNTOF(g_wchIniFile)) == 0)) { + MsgBox(MBWARN, IDS_SETTINGSNOTSAVED); + g_fWarnedNoIniFile = true; + } + //EndDialog(hwnd,IDOK); + DestroyWindow(hwnd); + break; + + + case IDCANCEL: + if (fDragging) { + SendMessage(hwnd, WM_CANCELMODE, 0, 0); + } + else { + APPLY_DIALOG_ITEM_TEXT; + // Restore Styles + int cnt = 0; + for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) { + StringCchCopy(g_pLexArray[iLexer]->szExtensions, COUNTOF(g_pLexArray[iLexer]->szExtensions), Style_StylesBackup[cnt]); + ++cnt; + int i = 0; + while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) { + StringCchCopy(g_pLexArray[iLexer]->Styles[i].szValue, COUNTOF(g_pLexArray[iLexer]->Styles[i].szValue), Style_StylesBackup[cnt]); + ++cnt; + ++i; + } + } + Style_SetLexer(g_hwndEdit, g_pLexCurrent); + //EndDialog(hwnd,IDCANCEL); + DestroyWindow(hwnd); + } + break; + + + case IDACC_VIEWSCHEMECONFIG: + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_SETCURLEXERTV, 1), 0); + break; + + case IDACC_PREVIEW: + PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_PREVIEW, 1), 0); + break; + + case IDACC_SAVEPOS: + GetDlgPos(hwnd, &xCustomSchemesDlg, &yCustomSchemesDlg); + break; + + case IDACC_RESETPOS: + CenterDlgInParent(hwnd); + xCustomSchemesDlg = yCustomSchemesDlg = 0; + break; + + + default: + // return false??? + break; + + } // switch() + } // WM_COMMAND + return true; + } + return false; +} + + +//============================================================================= +// +// Style_CustomizeSchemesDlg() +// +HWND Style_CustomizeSchemesDlg(HWND hwnd) +{ + HWND hDlg = CreateThemedDialogParam(g_hInstance, + MAKEINTRESOURCE(IDD_STYLECONFIG), + GetParent(hwnd), + Style_CustomizeSchemesDlgProc, + (LPARAM)NULL); + ShowWindow(hDlg, SW_SHOW); + return hDlg; +} + + +//============================================================================= +// +// Style_SelectLexerDlgProc() +// +INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) +{ + + static int cxClient; + static int cyClient; + static int mmiPtMaxY; + static int mmiPtMinX; + + static HWND hwndLV; + static int iInternalDefault; + + switch(umsg) + { + case WM_INITDIALOG: + { + int lvItems; + LVITEM lvi; + SHFILEINFO shfi; + LVCOLUMN lvc = { LVCF_FMT|LVCF_TEXT, LVCFMT_LEFT, 0, L"", -1, 0, 0, 0 }; + + RECT rc; + WCHAR tch[MAX_PATH] = { L'\0' }; + int cGrip; + + GetClientRect(hwnd,&rc); + cxClient = rc.right - rc.left; + cyClient = rc.bottom - rc.top; + + AdjustWindowRectEx(&rc,GetWindowLong(hwnd,GWL_STYLE)|WS_THICKFRAME,false,0); + mmiPtMinX = rc.right-rc.left; + mmiPtMaxY = rc.bottom-rc.top; + + if (g_cxStyleSelectDlg < (rc.right-rc.left)) + g_cxStyleSelectDlg = rc.right-rc.left; + if (g_cyStyleSelectDlg < (rc.bottom-rc.top)) + g_cyStyleSelectDlg = rc.bottom-rc.top; + SetWindowPos(hwnd,NULL,rc.left,rc.top,g_cxStyleSelectDlg,g_cyStyleSelectDlg,SWP_NOZORDER); + + SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|WS_THICKFRAME); + SetWindowPos(hwnd,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); + + GetMenuString(GetSystemMenu(GetParent(hwnd),false),SC_SIZE,tch,COUNTOF(tch),MF_BYCOMMAND); + InsertMenu(GetSystemMenu(hwnd,false),SC_CLOSE,MF_BYCOMMAND|MF_STRING|MF_ENABLED,SC_SIZE,tch); + InsertMenu(GetSystemMenu(hwnd,false),SC_CLOSE,MF_BYCOMMAND|MF_SEPARATOR,0,NULL); + + SetWindowLongPtr(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE, + GetWindowLongPtr(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE)|SBS_SIZEGRIP|WS_CLIPSIBLINGS); + + cGrip = GetSystemMetrics(SM_CXHTHUMB); + SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,cxClient-cGrip, + cyClient-cGrip,cGrip,cGrip,SWP_NOZORDER); + + hwndLV = GetDlgItem(hwnd,IDC_STYLELIST); + + ListView_SetImageList(hwndLV, + (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY, + &shfi,sizeof(SHFILEINFO),SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES), + LVSIL_SMALL); + + ListView_SetImageList(hwndLV, + (HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY, + &shfi,sizeof(SHFILEINFO),SHGFI_LARGEICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES), + LVSIL_NORMAL); + + //SetExplorerTheme(hwndLV); + ListView_SetExtendedListViewStyle(hwndLV,/*LVS_EX_FULLROWSELECT|*/LVS_EX_DOUBLEBUFFER|LVS_EX_LABELTIP); + ListView_InsertColumn(hwndLV,0,&lvc); + + // Add lexers + for (int i = 0; i < COUNTOF(g_pLexArray); i++) { + Style_AddLexerToListView(hwndLV, g_pLexArray[i]); + } + ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE_USEHEADER); + + // Select current lexer + lvItems = ListView_GetItemCount(hwndLV); + lvi.mask = LVIF_PARAM; + for (int i = 0; i < lvItems; i++) { + lvi.iItem = i; + ListView_GetItem(hwndLV,&lvi); + if (StringCchCompareX(((PEDITLEXER)lvi.lParam)->pszName, g_pLexCurrent->pszName) == 0) + { + ListView_SetItemState(hwndLV,i,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED); + ListView_EnsureVisible(hwndLV,i,false); + if (g_iDefaultLexer == i) { + CheckDlgButton(hwnd,IDC_DEFAULTSCHEME,BST_CHECKED); + } + break; + } + } + + iInternalDefault = g_iDefaultLexer; + + if (g_bAutoSelect) + CheckDlgButton(hwnd,IDC_AUTOSELECT,BST_CHECKED); + + CenterDlgInParent(hwnd); + } + return true; + + + case WM_DESTROY: + { + RECT rc; + GetWindowRect(hwnd,&rc); + g_cxStyleSelectDlg = rc.right-rc.left; + g_cyStyleSelectDlg = rc.bottom-rc.top; + } + return false; + + + case WM_SIZE: + { + RECT rc; + + int dxClient = LOWORD(lParam) - cxClient; + int dyClient = HIWORD(lParam) - cyClient; + cxClient = LOWORD(lParam); + cyClient = HIWORD(lParam); + + GetWindowRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); + InvalidateRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,true); + + GetWindowRect(GetDlgItem(hwnd,IDOK),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDOK),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); + InvalidateRect(GetDlgItem(hwnd,IDOK),NULL,true); + + GetWindowRect(GetDlgItem(hwnd,IDCANCEL),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDCANCEL),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); + InvalidateRect(GetDlgItem(hwnd,IDCANCEL),NULL,true); + + GetWindowRect(GetDlgItem(hwnd,IDC_STYLELIST),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDC_STYLELIST),NULL,0,0,rc.right-rc.left+dxClient,rc.bottom-rc.top+dyClient,SWP_NOZORDER|SWP_NOMOVE); + ListView_SetColumnWidth(GetDlgItem(hwnd,IDC_STYLELIST),0,LVSCW_AUTOSIZE_USEHEADER); + InvalidateRect(GetDlgItem(hwnd,IDC_STYLELIST),NULL,true); + + GetWindowRect(GetDlgItem(hwnd,IDC_AUTOSELECT),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); + InvalidateRect(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,true); + + GetWindowRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),&rc); + MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2); + SetWindowPos(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE); + InvalidateRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,true); + } + return true; + + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; + lpmmi->ptMinTrackSize.x = mmiPtMinX; + lpmmi->ptMinTrackSize.y = mmiPtMaxY; + //lpmmi->ptMaxTrackSize.y = mmiPtMaxY; + } + return true; + + + case WM_NOTIFY: + { + if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) { + + switch (((LPNMHDR)(lParam))->code) { + + case NM_DBLCLK: + SendMessage(hwnd, WM_COMMAND, MAKELONG(IDOK, 1), 0); + break; + + case LVN_ITEMCHANGED: + case LVN_DELETEITEM: + { + int i = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); + if (iInternalDefault == i) + CheckDlgButton(hwnd, IDC_DEFAULTSCHEME, BST_CHECKED); + else + CheckDlgButton(hwnd, IDC_DEFAULTSCHEME, BST_UNCHECKED); + DialogEnableWindow(hwnd, IDC_DEFAULTSCHEME, i != -1); + DialogEnableWindow(hwnd, IDOK, i != -1); + } + break; + } + } + } + return true; + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) { + case IDC_DEFAULTSCHEME: + if (IsDlgButtonChecked(hwnd, IDC_DEFAULTSCHEME) == BST_CHECKED) + iInternalDefault = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); + else + iInternalDefault = 0; + break; + + + case IDOK: + { + LVITEM lvi; + lvi.mask = LVIF_PARAM; + lvi.iItem = ListView_GetNextItem(hwndLV, -1, LVNI_ALL | LVNI_SELECTED); + if (ListView_GetItem(hwndLV, &lvi)) { + g_pLexCurrent = (PEDITLEXER)lvi.lParam; + g_iDefaultLexer = iInternalDefault; + g_bAutoSelect = (IsDlgButtonChecked(hwnd, IDC_AUTOSELECT) == BST_CHECKED) ? 1 : 0; + EndDialog(hwnd,IDOK); + } + } + break; + + + case IDCANCEL: + EndDialog(hwnd, IDCANCEL); + break; + + } // switch() + } // WM_COMMAND + return true; + } + return false; +} + + +//============================================================================= +// +// Style_SelectLexerDlg() +// +void Style_SelectLexerDlg(HWND hwnd) +{ + if (IDOK == ThemedDialogBoxParam(g_hInstance, + MAKEINTRESOURCE(IDD_STYLESELECT), + GetParent(hwnd), Style_SelectLexerDlgProc, 0)) + + Style_SetLexer(hwnd, g_pLexCurrent); +} + +// End of Styles.c diff --git a/src/Styles.h b/src/Styles.h index 285666441..774acd93e 100644 --- a/src/Styles.h +++ b/src/Styles.h @@ -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); diff --git a/src/TypeDefs.h b/src/TypeDefs.h index eac68ca50..06466ecc0 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -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 + +// -------------------------------------------------------------------------- //============================================================================= diff --git a/src/Version.h b/src/Version.h index e7309a8e6..886f8e99b 100644 Binary files a/src/Version.h and b/src/Version.h differ diff --git a/src/VersionEx.h b/src/VersionEx.h index 788bfd7e7..4d35455d9 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -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" diff --git a/src/resource.h b/src/resource.h index 7323f69a5..2272c95df 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,519 +1,523 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Notepad3.rc -// -#define IDR_RT_MANIFEST 1 -#define IDR_MAINWND 100 -#define IDC_FINDTEXT 101 -#define IDC_LINENUM 102 -#define IDC_COMMANDLINE 103 -#define IDD_ABOUT 104 -#define IDC_VERSION 105 -#define IDC_OPENWITHDIR 106 -#define IDC_FILEMRU 107 -#define IDC_STYLELIST 108 -#define IDC_FAVORITESDIR 109 -#define IDC_COLUMNWRAP 110 -#define IDC_INFOBOXICON 111 -#define IDC_COPY 112 -#define IDC_ENCODINGLIST 113 -#define IDC_SEARCHEXE 114 -#define IDR_POPUPMENU 115 -#define IDC_GETOPENWITHDIR 116 -#define IDC_RESIZEGRIP 117 -#define IDD_OPENWITH 118 -#define IDC_REPLACETEXT 119 -#define IDI_RUN 120 -#define IDC_COLNUM 121 -#define IDC_DEFAULTSCHEME 122 -#define IDC_GETFAVORITESDIR 123 -#define IDC_INFOBOXTEXT 124 -#define IDB_OPEN 125 -#define IDR_ACCFINDREPLACE 126 -#define IDC_STYLELABEL_ROOT 127 -#define IDC_STYLELABEL 128 -#define IDC_STYLEEDIT_ROOT 129 -#define IDC_STYLEEDIT 130 -#define IDC_STYLEBACK 131 -#define IDC_STYLEFONT 132 -#define IDC_STYLEDEFAULT 133 -#define IDC_PREVIEW 134 -#define IDC_PREVSTYLE 135 -#define IDC_NEXTSTYLE 136 -#define IDC_IMPORT 137 -#define IDC_EXPORT 138 -#define IDC_RESIZEGRIP4 139 -#define IDC_NOUNICODEDETECTION 140 -#define IDC_COPYRIGHT 141 -#define IDC_FINDCASE 142 -#define IDC_OPENWITHDESCR 143 -#define IDC_SAVEMRU 144 -#define IDD_RUN 145 -#define IDC_AUTOSELECT 146 -#define IDC_FAVORITESDESCR 147 -#define IDC_INFOBOXCHECK 148 -#define IDC_CONSISTENTEOLS 149 -#define IDB_PREV 150 -#define IDI_STYLES 151 -#define IDC_ASCIIASUTF8 152 -#define IDC_WEBPAGE 153 -#define IDD_DEFENCODING 154 -#define IDC_FINDWORD 155 -#define IDC_RESIZEGRIP3 156 -#define IDB_NEXT 157 -#define IDC_STYLEFORE 158 -#define IDC_AUTOSTRIPBLANKS 159 -#define IDC_ENCODINGFROMFILEVARS 160 -#define IDC_WEBPAGE2 161 -#define IDC_PRESERVECARET 162 -#define IDC_MODWEBPAGE2 163 -#define IDD_ENCODING 164 -#define IDC_MOD_PAGE2 165 -#define IDC_FINDSTART 166 -#define IDB_PICK 167 -#define IDC_AUTHORNAME 168 -#define IDC_WEBPAGE4 169 -#define IDC_MODWEBPAGE 170 -#define IDD_RECODE 171 -#define IDC_FINDREGEXP 172 -#define IDB_ENCODING 173 -#define IDC_EMAIL 174 -#define IDC_NOTE2WEBPAGE 175 -#define IDD_DEFEOLMODE 176 -#define IDC_FINDTRANSFORMBS 177 -#define IDC_EMAIL2 178 -#define IDC_NOTE2WEBPAGE2 179 -#define IDD_FAVORITES 180 -#define IDC_NOWRAP 181 -#define IDD_ADDTOFAV 182 -#define IDC_FINDCLOSE 183 -#define IDC_EMAIL3 184 -#define IDD_FILEMRU 186 -#define IDC_FINDPREV 187 -#define IDD_CHANGENOTIFY 188 -#define IDD_MODIFYLINES 189 -#define IDC_MOD_PAGE 190 -#define IDC_REPLACE 191 -#define IDC_TITLE 192 -#define IDD_ALIGN 193 -#define IDC_WEBPAGE3 194 -#define IDD_ENCLOSESELECTION 195 -#define IDC_REPLACEALL 196 -#define IDD_INSERTTAG 198 -#define IDC_REPLACEINSEL 199 -#define IDD_SORT 200 -#define IDC_TOGGLEFINDREPLACE 201 -#define IDD_COLUMNWRAP 202 -#define IDD_LINENUM 203 -#define IDD_FIND 204 -#define IDD_REPLACE 205 -#define IDD_STYLESELECT 206 -#define IDD_STYLECONFIG 207 -#define IDD_WORDWRAP 208 -#define IDD_LONGLINES 209 -#define IDD_TABSETTINGS 210 -#define IDD_PAGESETUP 211 -#define IDD_INFOBOX 212 -#define IDD_INFOBOX2 213 -#define IDD_INFOBOX3 214 -#define IDT_TIMER_MRKALL 215 -#define IDC_ALL_OCCURRENCES 216 -#define IDC_DOT_MATCH_ALL 217 -#define IDT_TIMER_MAIN_MRKALL 218 -#define IDT_TIMER_UPDATE_HOTSPOT 219 -#define IDC_BACKSLASHHELP 220 -#define IDC_REGEXPHELP 221 -#define IDC_WILDCARDHELP 222 -#define IDC_WILDCARDSEARCH 223 -#define IDC_SCI_VERSION 224 -#define IDR_MAINWNDTB 225 -#define IDC_REMOVE 226 -#define IDC_SWAPSTRG 227 -#define IDC_CHECK_OCC 228 -#define IDC_PRINTER 229 -#define IDC_USEASREADINGFALLBACK 230 -#define IDR_ACCCUSTOMSCHEMES 231 -#define IDC_NOANSICPDETECTION 232 -#define IDC_REMEMBERSEARCHPATTERN 233 -#define IDC_TOGGLE_VISIBILITY 234 -#define IDACC_FIND 302 -#define IDACC_REPLACE 303 -#define IDACC_SAVEPOS 304 -#define IDACC_RESETPOS 305 -#define IDACC_FINDNEXT 306 -#define IDACC_FINDPREV 307 -#define IDACC_REPLACENEXT 308 -#define IDACC_SAVEFIND 309 -#define IDACC_SELTONEXT 310 -#define IDACC_SELTOPREV 311 -#define IDACC_VIEWSCHEMECONFIG 312 -#define IDACC_PREVIEW 313 -#define IDC_NFOASOEM 400 -#define IDC_COMPILER 401 -#define IDC_SETCURLEXERTV 402 -#define IDD_READPW 501 -#define IDC_CHECK1 502 -#define IDC_EDIT1 503 -#define IDC_EDIT2 504 -#define IDC_CHECK2 505 -#define IDC_STATICPW 506 -#define IDC_CHECK3 507 -#define IDM_SETPASS 508 -#define IDD_PASSWORDS 509 -#define IDC_EDIT3 510 -#define IDS_PASS_FAILURE 511 -#define IDS_NOPASS 512 -#define IDM_HELP_UPDATEINSTALLER 513 -#define IDM_HELP_UPDATEWEBSITE 514 -#define IDS_FR_STATUS_TEXT 515 -#define IDR_MAINWNDTB2 550 -#define IDR_MAINWND128 551 -#define IDC_RICHEDITABOUT 552 -#define IDC_COPYVERSTRG 553 -#define IDR_RIZBITMAP 554 -#define IDC_RIZONEBMP 555 -#define IDS_APPTITLE 10000 -#define IDS_APPTITLE_ELEVATED 10001 -#define IDS_APPTITLE_PASTEBOARD 10002 -#define IDS_UNTITLED 10003 -#define IDS_TITLEEXCERPT 10004 -#define IDS_READONLY 10005 -#define IDS_DOCPOS 10006 -#define IDS_DOCPOS2 10007 -#define IDS_DOCSIZE 10008 -#define IDS_LOADFILE 10009 -#define IDS_SAVEFILE 10010 -#define IDS_PRINTFILE 10011 -#define IDS_SAVINGSETTINGS 10012 -#define IDS_LINKDESCRIPTION 10013 -#define IDS_FILTER_ALL 10014 -#define IDS_FILTER_EXE 10015 -#define IDS_FILTER_INI 10016 -#define IDS_OPENWITH 10017 -#define IDS_FAVORITES 10018 -#define IDS_BACKSLASHHELP 10019 -#define IDS_REGEXPHELP 10020 -#define IDS_WILDCARDHELP 10021 -#define IDS_FR_STATUS_FMT 10022 -#define CMD_ESCAPE 20000 -#define CMD_SHIFTESC 20001 -#define CMD_SHIFTCTRLENTER 20002 -#define CMD_CTRLLEFT 20003 -#define CMD_CTRLRIGHT 20004 -#define CMD_DELETEBACK 20005 -#define CMD_CTRLBACK 20006 -#define CMD_DEL 20007 -#define CMD_CTRLDEL 20008 -#define CMD_CTRLTAB 20009 -#define CMD_RECODEDEFAULT 20010 -#define CMD_RECODEANSI 20011 -#define CMD_RECODEOEM 20012 -#define CMD_RELOADASCIIASUTF8 20013 -#define CMD_RELOADNOFILEVARS 20014 -#define CMD_LEXDEFAULT 20015 -#define CMD_LEXHTML 20016 -#define CMD_LEXXML 20017 -#define CMD_TIMESTAMPS 20018 -#define CMD_WEBACTION1 20019 -#define CMD_WEBACTION2 20020 -#define CMD_FINDNEXTSEL 20021 -#define CMD_FINDPREVSEL 20022 -#define CMD_INCLINELIMIT 20023 -#define CMD_DECLINELIMIT 20024 -#define CMD_STRINGIFY 20025 -#define CMD_STRINGIFY2 20026 -#define CMD_EMBRACE 20027 -#define CMD_EMBRACE2 20028 -#define CMD_EMBRACE3 20029 -#define CMD_EMBRACE4 20030 -#define CMD_INCREASENUM 20031 -#define CMD_DECREASENUM 20032 -#define CMD_TOGGLETITLE 20033 -#define CMD_JUMP2SELSTART 20034 -#define CMD_JUMP2SELEND 20035 -#define CMD_COPYPATHNAME 20036 -#define CMD_COPYWINPOS 20037 -#define CMD_DEFAULTWINPOS 20038 -#define CMD_OPENINIFILE 20039 -#define CMD_CTRLENTER 20040 -#define CMD_OPEN_HYPERLINK 20041 -#define CMD_ALTUP 20042 -#define CMD_ALTDOWN 20043 -#define CMD_ALTLEFT 20044 -#define CMD_ALTRIGHT 20045 -#define CMD_TAB 20046 -#define CMD_BACKTAB 20047 -#define IDM_FILE_NEW 40000 -#define IDM_FILE_OPEN 40001 -#define IDM_FILE_REVERT 40002 -#define IDM_FILE_BROWSE 40003 -#define IDM_FILE_SAVE 40004 -#define IDM_FILE_SAVEAS 40005 -#define IDM_FILE_SAVECOPY 40006 -#define IDM_FILE_READONLY 40007 -#define IDM_FILE_LAUNCH 40008 -#define IDM_FILE_OPENWITH 40009 -#define IDM_FILE_RUN 40010 -#define IDM_FILE_NEWWINDOW 40011 -#define IDM_FILE_NEWWINDOW2 40012 -#define IDM_FILE_PAGESETUP 40013 -#define IDM_FILE_PRINT 40014 -#define IDM_FILE_PROPERTIES 40015 -#define IDM_FILE_CREATELINK 40016 -#define IDM_FILE_OPENFAV 40017 -#define IDM_FILE_ADDTOFAV 40018 -#define IDM_FILE_MANAGEFAV 40019 -#define IDM_FILE_RECENT 40020 -#define IDM_FILE_EXIT 40021 -#define IDM_ENCODING_ANSI 40100 -#define IDM_ENCODING_UNICODE 40101 -#define IDM_ENCODING_UNICODEREV 40102 -#define IDM_ENCODING_UTF8 40103 -#define IDM_ENCODING_UTF8SIGN 40104 -#define IDM_ENCODING_SELECT 40105 -#define IDM_ENCODING_RECODE 40106 -#define IDM_ENCODING_SETDEFAULT 40107 -#define IDM_LINEENDINGS_CRLF 40200 -#define IDM_LINEENDINGS_LF 40201 -#define IDM_LINEENDINGS_CR 40202 -#define IDM_LINEENDINGS_SETDEFAULT 40203 -#define IDM_EDIT_BOOKMARKTOGGLE 40250 -#define IDM_EDIT_BOOKMARKNEXT 40251 -#define IDM_EDIT_BOOKMARKCLEAR 40252 -#define IDM_EDIT_BOOKMARKPREV 40253 -#define BME_EDIT_BOOKMARKTOGGLE 40254 -#define BME_EDIT_BOOKMARKNEXT 40255 -#define BME_EDIT_BOOKMARKCLEAR 40256 -#define BME_EDIT_BOOKMARKPREV 40257 -#define IDM_EDIT_UNDO 40300 -#define IDM_EDIT_REDO 40301 -#define IDM_EDIT_CUT 40302 -#define IDM_EDIT_COPY 40303 -#define IDM_EDIT_COPYALL 40304 -#define IDM_EDIT_COPYADD 40305 -#define IDM_EDIT_PASTE 40306 -#define IDM_EDIT_SWAP 40307 -#define IDM_EDIT_CLEAR 40308 -#define IDM_EDIT_CLEARCLIPBOARD 40309 -#define IDM_EDIT_SELECTALL 40310 -#define IDM_EDIT_SELECTWORD 40311 -#define IDM_EDIT_SELECTLINE 40312 -#define IDM_EDIT_MOVELINEUP 40313 -#define IDM_EDIT_MOVELINEDOWN 40314 -#define IDM_EDIT_DUPLICATELINE 40315 -#define IDM_EDIT_CUTLINE 40316 -#define IDM_EDIT_COPYLINE 40317 -#define IDM_EDIT_DELETELINE 40318 -#define IDM_EDIT_DELETELINELEFT 40319 -#define IDM_EDIT_DELETELINERIGHT 40320 -#define IDM_EDIT_COLUMNWRAP 40321 -#define IDM_EDIT_SPLITLINES 40322 -#define IDM_EDIT_JOINLINES 40323 -#define IDM_EDIT_JOINLINES_PARA 40324 -#define IDM_EDIT_INDENT 40325 -#define IDM_EDIT_UNINDENT 40326 -#define IDM_EDIT_ENCLOSESELECTION 40327 -#define IDM_EDIT_SELECTIONDUPLICATE 40328 -#define IDM_EDIT_PADWITHSPACES 40329 -#define IDM_EDIT_STRIP1STCHAR 40330 -#define IDM_EDIT_STRIPLASTCHAR 40331 -#define IDM_EDIT_TRIMLINES 40332 -#define IDM_EDIT_COMPRESSWS 40333 -#define IDM_EDIT_MERGEBLANKLINES 40334 -#define IDM_EDIT_REMOVEBLANKLINES 40335 -#define IDM_EDIT_MODIFYLINES 40336 -#define IDM_EDIT_SORTLINES 40337 -#define IDM_EDIT_ALIGN 40338 -#define IDM_EDIT_CONVERTUPPERCASE 40339 -#define IDM_EDIT_CONVERTLOWERCASE 40340 -#define IDM_EDIT_INVERTCASE 40341 -#define IDM_EDIT_TITLECASE 40342 -#define IDM_EDIT_SENTENCECASE 40343 -#define IDM_EDIT_CONVERTTABS 40344 -#define IDM_EDIT_CONVERTSPACES 40345 -#define IDM_EDIT_CONVERTTABS2 40346 -#define IDM_EDIT_CONVERTSPACES2 40347 -#define IDM_EDIT_INSERT_TAG 40348 -#define IDM_EDIT_INSERT_ENCODING 40349 -#define IDM_EDIT_INSERT_SHORTDATE 40350 -#define IDM_EDIT_INSERT_LONGDATE 40351 -#define IDM_EDIT_INSERT_FILENAME 40352 -#define IDM_EDIT_INSERT_PATHNAME 40353 -#define IDM_EDIT_LINECOMMENT 40354 -#define IDM_EDIT_STREAMCOMMENT 40355 -#define IDM_EDIT_URLENCODE 40356 -#define IDM_EDIT_URLDECODE 40357 -#define IDM_EDIT_ESCAPECCHARS 40358 -#define IDM_EDIT_UNESCAPECCHARS 40359 -#define IDM_EDIT_CHAR2HEX 40360 -#define IDM_EDIT_HEX2CHAR 40361 -#define IDM_EDIT_FINDMATCHINGBRACE 40362 -#define IDM_EDIT_SELTOMATCHINGBRACE 40363 -#define IDM_EDIT_FIND 40364 -#define IDM_EDIT_SAVEFIND 40365 -#define IDM_EDIT_FINDNEXT 40366 -#define IDM_EDIT_FINDPREV 40367 -#define IDM_EDIT_REPLACE 40368 -#define IDM_EDIT_REPLACENEXT 40369 -#define IDM_EDIT_GOTOLINE 40370 -#define IDM_EDIT_SELTONEXT 40371 -#define IDM_EDIT_SELTOPREV 40372 -#define IDM_EDIT_COMPLETEWORD 40373 -#define IDM_EDIT_JOINLN_NOSP 40374 -#define IDM_EDIT_REMOVEDUPLICATELINES 40375 -#define IDM_EDIT_REMOVEEMPTYLINES 40376 -#define IDM_EDIT_MERGEEMPTYLINES 40377 -#define IDM_VIEW_SCHEME 40400 -#define IDM_VIEW_USE2NDDEFAULT 40401 -#define IDM_VIEW_SCHEMECONFIG 40402 -#define IDM_VIEW_FONT 40403 -#define IDM_VIEW_WORDWRAP 40404 -#define IDM_VIEW_LONGLINEMARKER 40405 -#define IDM_VIEW_SHOWINDENTGUIDES 40406 -#define IDM_VIEW_SHOWWHITESPACE 40407 -#define IDM_VIEW_SHOWEOLS 40408 -#define IDM_VIEW_WORDWRAPSYMBOLS 40409 -#define IDM_VIEW_MATCHBRACES 40410 -#define IDM_VIEW_HILITECURRENTLINE 40411 -#define IDM_VIEW_LINENUMBERS 40412 -#define IDM_VIEW_MARGIN 40413 -#define IDM_VIEW_ZOOMIN 40414 -#define IDM_VIEW_ZOOMOUT 40415 -#define IDM_VIEW_RESETZOOM 40416 -#define IDM_VIEW_TABSASSPACES 40417 -#define IDM_VIEW_TABSETTINGS 40418 -#define IDM_VIEW_WORDWRAPSETTINGS 40419 -#define IDM_VIEW_LONGLINESETTINGS 40420 -#define IDM_VIEW_AUTOINDENTTEXT 40421 -#define IDM_VIEW_AUTOCLOSETAGS 40422 -#define IDM_VIEW_REUSEWINDOW 40423 -#define IDM_VIEW_STICKYWINPOS 40424 -#define IDM_VIEW_ALWAYSONTOP 40425 -#define IDM_VIEW_MINTOTRAY 40426 -#define IDM_VIEW_TRANSPARENT 40427 -#define IDM_VIEW_SINGLEFILEINSTANCE 40428 -#define IDM_VIEW_CHANGENOTIFY 40429 -#define IDM_VIEW_SHOWFILENAMEONLY 40430 -#define IDM_VIEW_SHOWFILENAMEFIRST 40431 -#define IDM_VIEW_SHOWFULLPATH 40432 -#define IDM_VIEW_SHOWEXCERPT 40433 -#define IDM_VIEW_NOESCFUNC 40434 -#define IDM_VIEW_ESCMINIMIZE 40435 -#define IDM_VIEW_ESCEXIT 40436 -#define IDM_VIEW_SAVEBEFORERUNNINGTOOLS 40437 -#define IDM_VIEW_NOSAVERECENT 40438 -#define IDM_VIEW_NOSAVEFINDREPL 40439 -#define IDM_VIEW_TOOLBAR 40440 -#define IDM_VIEW_CUSTOMIZETB 40441 -#define IDM_VIEW_STATUSBAR 40442 -#define IDM_VIEW_SAVESETTINGS 40443 -#define IDM_VIEW_SAVESETTINGSNOW 40444 -#define IDM_VIEW_FOLDING 40445 -#define IDM_VIEW_TOGGLEFOLDS 40446 -#define IDM_VIEW_MARKOCCUR_ONOFF 40447 -#define IDM_VIEW_MARKOCCUR_CASE 40448 -#define IDM_VIEW_MARKOCCUR_WNONE 40449 -#define IDM_VIEW_MARKOCCUR_WORD 40450 -#define IDM_VIEW_MARKOCCUR_CURRENT 40451 -#define IDM_VIEW_MARKOCCUR_VISIBLE 40452 -#define IDM_VIEW_AUTOCOMPLETEWORDS 40453 -#define IDM_VIEW_ACCELWORDNAV 40454 -#define IDM_VIEW_NOPRESERVECARET 40455 -#define IDM_VIEW_HYPERLINKHOTSPOTS 40456 -#define IDM_VIEW_CURRENTSCHEME 40457 -#define IDM_VIEW_SCROLLPASTEOF 40458 -#define IDM_HELP_ABOUT 40500 -#define IDM_HELP_CMD 40501 -#define IDM_HELP_ONLINEDOCUMENTATION 40502 -#define IDM_TRAY_RESTORE 40600 -#define IDM_TRAY_EXIT 40601 -#define IDT_FILE_NEW 40700 -#define IDT_FILE_OPEN 40701 -#define IDT_FILE_BROWSE 40702 -#define IDT_FILE_SAVE 40703 -#define IDT_EDIT_UNDO 40704 -#define IDT_EDIT_REDO 40705 -#define IDT_EDIT_CUT 40706 -#define IDT_EDIT_COPY 40707 -#define IDT_EDIT_PASTE 40708 -#define IDT_EDIT_FIND 40709 -#define IDT_EDIT_REPLACE 40710 -#define IDT_VIEW_WORDWRAP 40711 -#define IDT_VIEW_ZOOMIN 40712 -#define IDT_VIEW_ZOOMOUT 40713 -#define IDT_VIEW_SCHEME 40714 -#define IDT_VIEW_SCHEMECONFIG 40715 -#define IDT_FILE_EXIT 40716 -#define IDT_FILE_SAVEAS 40717 -#define IDT_FILE_SAVECOPY 40718 -#define IDT_EDIT_CLEAR 40719 -#define IDT_FILE_PRINT 40720 -#define IDT_FILE_OPENFAV 40721 -#define IDT_FILE_ADDTOFAV 40722 -#define IDT_VIEW_TOGGLEFOLDS 40723 -#define IDT_FILE_LAUNCH 40724 -#define IDS_SAVEPOS 40800 -#define IDS_RESETPOS 40801 -#define IDS_PREVIEW 40802 -#define IDS_ERR_LOADFILE 50000 -#define IDS_ERR_SAVEFILE 50001 -#define IDS_ERR_BROWSE 50002 -#define IDS_ERR_MRUDLG 50003 -#define IDS_ERR_CREATELINK 50004 -#define IDS_ERR_PREVWINDISABLED 50005 -#define IDS_SELRECT 50006 -#define IDS_BUFFERTOOSMALL 50007 -#define IDS_FIND_WRAPFW 50008 -#define IDS_FIND_WRAPRE 50009 -#define IDS_NOTFOUND 50010 -#define IDS_REPLCOUNT 50011 -#define IDS_ASK_ENCODING 50012 -#define IDS_ASK_ENCODING2 50013 -#define IDS_ERR_ENCODINGNA 50014 -#define IDS_ERR_UNICODE 50015 -#define IDS_ERR_UNICODE2 50016 -#define IDS_WARN_LOAD_BIG_FILE 50017 -#define IDS_ERR_DROP 50018 -#define IDS_ASK_SAVE 50019 -#define IDS_ASK_REVERT 50020 -#define IDS_ASK_RECODE 50021 -#define IDS_ASK_CREATE 50022 -#define IDS_PRINT_HEADER 50023 -#define IDS_PRINT_FOOTER 50024 -#define IDS_PRINT_COLOR 50025 -#define IDS_PRINT_PAGENUM 50026 -#define IDS_PRINT_EMPTY 50027 -#define IDS_PRINT_ERROR 50028 -#define IDS_FAV_SUCCESS 50029 -#define IDS_FAV_FAILURE 50030 -#define IDS_READONLY_MODIFY 50031 -#define IDS_READONLY_SAVE 50032 -#define IDS_FILECHANGENOTIFY 50033 -#define IDS_FILECHANGENOTIFY2 50034 -#define IDS_STICKYWINPOS 50035 -#define IDS_SAVEDSETTINGS 50036 -#define IDS_CREATEINI_FAIL 50037 -#define IDS_WRITEINI_FAIL 50038 -#define IDS_SETTINGSNOTSAVED 50039 -#define IDS_EXPORT_FAIL 50040 -#define IDS_ERR_ACCESSDENIED 50041 -#define IDS_WARN_UNKNOWN_EXT 50042 -#define IDS_REGEX_INVALID 50043 -#define IDS_DROP_NO_FILE 50044 -#define IDS_APPLY_DEFAULT_FONT 50045 -#define IDS_ERR_UPDATECHECKER 50046 -#define IDS_CMDLINEHELP 60000 -#define IDM_EDIT_INSERT_GUID 60001 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 601 -#define _APS_NEXT_COMMAND_VALUE 701 -#define _APS_NEXT_CONTROL_VALUE 801 -#define _APS_NEXT_SYMED_VALUE 901 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Notepad3.rc +// +#define IDR_RT_MANIFEST 1 +#define IDR_MAINWND 100 +#define IDC_FINDTEXT 101 +#define IDC_LINENUM 102 +#define IDC_COMMANDLINE 103 +#define IDD_ABOUT 104 +#define IDC_VERSION 105 +#define IDC_OPENWITHDIR 106 +#define IDC_FILEMRU 107 +#define IDC_STYLELIST 108 +#define IDC_FAVORITESDIR 109 +#define IDC_COLUMNWRAP 110 +#define IDC_INFOBOXICON 111 +#define IDC_COPY 112 +#define IDC_ENCODINGLIST 113 +#define IDC_SEARCHEXE 114 +#define IDR_POPUPMENU 115 +#define IDC_GETOPENWITHDIR 116 +#define IDC_RESIZEGRIP 117 +#define IDD_OPENWITH 118 +#define IDC_REPLACETEXT 119 +#define IDI_RUN 120 +#define IDC_COLNUM 121 +#define IDC_DEFAULTSCHEME 122 +#define IDC_GETFAVORITESDIR 123 +#define IDC_INFOBOXTEXT 124 +#define IDB_OPEN 125 +#define IDR_ACCFINDREPLACE 126 +#define IDC_STYLELABEL_ROOT 127 +#define IDC_STYLELABEL 128 +#define IDC_STYLEEDIT_ROOT 129 +#define IDC_STYLEEDIT 130 +#define IDC_STYLEBACK 131 +#define IDC_STYLEFONT 132 +#define IDC_STYLEDEFAULT 133 +#define IDC_PREVIEW 134 +#define IDC_PREVSTYLE 135 +#define IDC_NEXTSTYLE 136 +#define IDC_IMPORT 137 +#define IDC_EXPORT 138 +#define IDC_RESIZEGRIP4 139 +#define IDC_NOUNICODEDETECTION 140 +#define IDC_COPYRIGHT 141 +#define IDC_FINDCASE 142 +#define IDC_OPENWITHDESCR 143 +#define IDC_SAVEMRU 144 +#define IDD_RUN 145 +#define IDC_AUTOSELECT 146 +#define IDC_FAVORITESDESCR 147 +#define IDC_INFOBOXCHECK 148 +#define IDC_CONSISTENTEOLS 149 +#define IDB_PREV 150 +#define IDI_STYLES 151 +#define IDC_ASCIIASUTF8 152 +#define IDC_WEBPAGE 153 +#define IDD_DEFENCODING 154 +#define IDC_FINDWORD 155 +#define IDC_RESIZEGRIP3 156 +#define IDB_NEXT 157 +#define IDC_STYLEFORE 158 +#define IDC_AUTOSTRIPBLANKS 159 +#define IDC_ENCODINGFROMFILEVARS 160 +#define IDC_WEBPAGE2 161 +#define IDC_PRESERVECARET 162 +#define IDC_MODWEBPAGE2 163 +#define IDD_ENCODING 164 +#define IDC_MOD_PAGE2 165 +#define IDC_FINDSTART 166 +#define IDB_PICK 167 +#define IDC_AUTHORNAME 168 +#define IDC_WEBPAGE4 169 +#define IDC_MODWEBPAGE 170 +#define IDD_RECODE 171 +#define IDC_FINDREGEXP 172 +#define IDB_ENCODING 173 +#define IDC_EMAIL 174 +#define IDC_NOTE2WEBPAGE 175 +#define IDD_DEFEOLMODE 176 +#define IDC_FINDTRANSFORMBS 177 +#define IDC_EMAIL2 178 +#define IDC_NOTE2WEBPAGE2 179 +#define IDD_FAVORITES 180 +#define IDC_NOWRAP 181 +#define IDD_ADDTOFAV 182 +#define IDC_FINDCLOSE 183 +#define IDC_EMAIL3 184 +#define IDD_FILEMRU 186 +#define IDC_FINDPREV 187 +#define IDD_CHANGENOTIFY 188 +#define IDD_MODIFYLINES 189 +#define IDC_MOD_PAGE 190 +#define IDC_REPLACE 191 +#define IDC_TITLE 192 +#define IDD_ALIGN 193 +#define IDC_WEBPAGE3 194 +#define IDD_ENCLOSESELECTION 195 +#define IDC_REPLACEALL 196 +#define IDD_INSERTTAG 198 +#define IDC_REPLACEINSEL 199 +#define IDD_SORT 200 +#define IDC_TOGGLEFINDREPLACE 201 +#define IDD_COLUMNWRAP 202 +#define IDD_LINENUM 203 +#define IDD_FIND 204 +#define IDD_REPLACE 205 +#define IDD_STYLESELECT 206 +#define IDD_STYLECONFIG 207 +#define IDD_WORDWRAP 208 +#define IDD_LONGLINES 209 +#define IDD_TABSETTINGS 210 +#define IDD_PAGESETUP 211 +#define IDD_INFOBOX 212 +#define IDD_INFOBOX2 213 +#define IDD_INFOBOX3 214 +#define IDT_TIMER_MRKALL 215 +#define IDC_ALL_OCCURRENCES 216 +#define IDC_DOT_MATCH_ALL 217 +#define IDT_TIMER_MAIN_MRKALL 218 +#define IDT_TIMER_UPDATE_HOTSPOT 219 +#define IDC_BACKSLASHHELP 220 +#define IDC_REGEXPHELP 221 +#define IDC_WILDCARDHELP 222 +#define IDC_WILDCARDSEARCH 223 +#define IDC_SCI_VERSION 224 +#define IDR_MAINWNDTB 225 +#define IDC_REMOVE 226 +#define IDC_SWAPSTRG 227 +#define IDC_CHECK_OCC 228 +#define IDC_PRINTER 229 +#define IDC_USEASREADINGFALLBACK 230 +#define IDR_ACCCUSTOMSCHEMES 231 +#define IDC_NOANSICPDETECTION 232 +#define IDC_REMEMBERSEARCHPATTERN 233 +#define IDC_TOGGLE_VISIBILITY 234 +#define IDC_DOC_MODIFIED 235 +#define IDACC_FIND 302 +#define IDACC_REPLACE 303 +#define IDACC_SAVEPOS 304 +#define IDACC_RESETPOS 305 +#define IDACC_FINDNEXT 306 +#define IDACC_FINDPREV 307 +#define IDACC_REPLACENEXT 308 +#define IDACC_SAVEFIND 309 +#define IDACC_SELTONEXT 310 +#define IDACC_SELTOPREV 311 +#define IDACC_VIEWSCHEMECONFIG 312 +#define IDACC_PREVIEW 313 +#define IDC_NFOASOEM 400 +#define IDC_COMPILER 401 +#define IDC_SETCURLEXERTV 402 +#define IDD_READPW 501 +#define IDC_CHECK1 502 +#define IDC_EDIT1 503 +#define IDC_EDIT2 504 +#define IDC_CHECK2 505 +#define IDC_STATICPW 506 +#define IDC_CHECK3 507 +#define IDM_SETPASS 508 +#define IDD_PASSWORDS 509 +#define IDC_EDIT3 510 +#define IDS_PASS_FAILURE 511 +#define IDS_NOPASS 512 +#define IDM_HELP_UPDATEINSTALLER 513 +#define IDM_HELP_UPDATEWEBSITE 514 +#define IDS_FR_STATUS_TEXT 515 +#define IDC_CHECK4 516 +#define IDR_MAINWNDTB2 550 +#define IDR_MAINWND128 551 +#define IDC_RICHEDITABOUT 552 +#define IDC_COPYVERSTRG 553 +#define IDR_RIZBITMAP 554 +#define IDC_RIZONEBMP 555 +#define IDS_APPTITLE 10000 +#define IDS_APPTITLE_ELEVATED 10001 +#define IDS_APPTITLE_PASTEBOARD 10002 +#define IDS_UNTITLED 10003 +#define IDS_TITLEEXCERPT 10004 +#define IDS_READONLY 10005 +#define IDS_DOCPOS 10006 +#define IDS_DOCPOS2 10007 +#define IDS_DOCSIZE 10008 +#define IDS_LOADFILE 10009 +#define IDS_SAVEFILE 10010 +#define IDS_PRINTFILE 10011 +#define IDS_SAVINGSETTINGS 10012 +#define IDS_LINKDESCRIPTION 10013 +#define IDS_FILTER_ALL 10014 +#define IDS_FILTER_EXE 10015 +#define IDS_FILTER_INI 10016 +#define IDS_OPENWITH 10017 +#define IDS_FAVORITES 10018 +#define IDS_BACKSLASHHELP 10019 +#define IDS_REGEXPHELP 10020 +#define IDS_WILDCARDHELP 10021 +#define IDS_FR_STATUS_FMT 10022 +#define CMD_ESCAPE 20000 +#define CMD_SHIFTESC 20001 +#define CMD_SHIFTCTRLENTER 20002 +#define CMD_CTRLLEFT 20003 +#define CMD_CTRLRIGHT 20004 +#define CMD_DELETEBACK 20005 +#define CMD_CTRLBACK 20006 +#define CMD_DEL 20007 +#define CMD_CTRLDEL 20008 +#define CMD_CTRLTAB 20009 +#define CMD_RECODEDEFAULT 20010 +#define CMD_RECODEANSI 20011 +#define CMD_RECODEOEM 20012 +#define CMD_RELOADASCIIASUTF8 20013 +#define CMD_RELOADNOFILEVARS 20014 +#define CMD_LEXDEFAULT 20015 +#define CMD_LEXHTML 20016 +#define CMD_LEXXML 20017 +#define CMD_TIMESTAMPS 20018 +#define CMD_WEBACTION1 20019 +#define CMD_WEBACTION2 20020 +#define CMD_FINDNEXTSEL 20021 +#define CMD_FINDPREVSEL 20022 +#define CMD_INCLINELIMIT 20023 +#define CMD_DECLINELIMIT 20024 +#define CMD_STRINGIFY 20025 +#define CMD_STRINGIFY2 20026 +#define CMD_EMBRACE 20027 +#define CMD_EMBRACE2 20028 +#define CMD_EMBRACE3 20029 +#define CMD_EMBRACE4 20030 +#define CMD_INCREASENUM 20031 +#define CMD_DECREASENUM 20032 +#define CMD_TOGGLETITLE 20033 +#define CMD_JUMP2SELSTART 20034 +#define CMD_JUMP2SELEND 20035 +#define CMD_COPYPATHNAME 20036 +#define CMD_COPYWINPOS 20037 +#define CMD_DEFAULTWINPOS 20038 +#define CMD_OPENINIFILE 20039 +#define CMD_CTRLENTER 20040 +#define CMD_OPEN_HYPERLINK 20041 +#define CMD_ALTUP 20042 +#define CMD_ALTDOWN 20043 +#define CMD_ALTLEFT 20044 +#define CMD_ALTRIGHT 20045 +#define CMD_TAB 20046 +#define CMD_BACKTAB 20047 +#define IDM_FILE_NEW 40000 +#define IDM_FILE_OPEN 40001 +#define IDM_FILE_REVERT 40002 +#define IDM_FILE_BROWSE 40003 +#define IDM_FILE_SAVE 40004 +#define IDM_FILE_SAVEAS 40005 +#define IDM_FILE_SAVECOPY 40006 +#define IDM_FILE_READONLY 40007 +#define IDM_FILE_LAUNCH 40008 +#define IDM_FILE_OPENWITH 40009 +#define IDM_FILE_RUN 40010 +#define IDM_FILE_NEWWINDOW 40011 +#define IDM_FILE_NEWWINDOW2 40012 +#define IDM_FILE_PAGESETUP 40013 +#define IDM_FILE_PRINT 40014 +#define IDM_FILE_PROPERTIES 40015 +#define IDM_FILE_CREATELINK 40016 +#define IDM_FILE_OPENFAV 40017 +#define IDM_FILE_ADDTOFAV 40018 +#define IDM_FILE_MANAGEFAV 40019 +#define IDM_FILE_RECENT 40020 +#define IDM_FILE_EXIT 40021 +#define IDM_ENCODING_ANSI 40100 +#define IDM_ENCODING_UNICODE 40101 +#define IDM_ENCODING_UNICODEREV 40102 +#define IDM_ENCODING_UTF8 40103 +#define IDM_ENCODING_UTF8SIGN 40104 +#define IDM_ENCODING_SELECT 40105 +#define IDM_ENCODING_RECODE 40106 +#define IDM_ENCODING_SETDEFAULT 40107 +#define IDM_LINEENDINGS_CRLF 40200 +#define IDM_LINEENDINGS_LF 40201 +#define IDM_LINEENDINGS_CR 40202 +#define IDM_LINEENDINGS_SETDEFAULT 40203 +#define IDM_EDIT_BOOKMARKTOGGLE 40250 +#define IDM_EDIT_BOOKMARKNEXT 40251 +#define IDM_EDIT_BOOKMARKCLEAR 40252 +#define IDM_EDIT_BOOKMARKPREV 40253 +#define BME_EDIT_BOOKMARKTOGGLE 40254 +#define BME_EDIT_BOOKMARKNEXT 40255 +#define BME_EDIT_BOOKMARKCLEAR 40256 +#define BME_EDIT_BOOKMARKPREV 40257 +#define IDM_EDIT_UNDO 40300 +#define IDM_EDIT_REDO 40301 +#define IDM_EDIT_CUT 40302 +#define IDM_EDIT_COPY 40303 +#define IDM_EDIT_COPYALL 40304 +#define IDM_EDIT_COPYADD 40305 +#define IDM_EDIT_PASTE 40306 +#define IDM_EDIT_SWAP 40307 +#define IDM_EDIT_CLEAR 40308 +#define IDM_EDIT_CLEARCLIPBOARD 40309 +#define IDM_EDIT_SELECTALL 40310 +#define IDM_EDIT_SELECTWORD 40311 +#define IDM_EDIT_SELECTLINE 40312 +#define IDM_EDIT_MOVELINEUP 40313 +#define IDM_EDIT_MOVELINEDOWN 40314 +#define IDM_EDIT_DUPLICATELINE 40315 +#define IDM_EDIT_CUTLINE 40316 +#define IDM_EDIT_COPYLINE 40317 +#define IDM_EDIT_DELETELINE 40318 +#define IDM_EDIT_DELETELINELEFT 40319 +#define IDM_EDIT_DELETELINERIGHT 40320 +#define IDM_EDIT_COLUMNWRAP 40321 +#define IDM_EDIT_SPLITLINES 40322 +#define IDM_EDIT_JOINLINES 40323 +#define IDM_EDIT_JOINLINES_PARA 40324 +#define IDM_EDIT_INDENT 40325 +#define IDM_EDIT_UNINDENT 40326 +#define IDM_EDIT_ENCLOSESELECTION 40327 +#define IDM_EDIT_SELECTIONDUPLICATE 40328 +#define IDM_EDIT_PADWITHSPACES 40329 +#define IDM_EDIT_STRIP1STCHAR 40330 +#define IDM_EDIT_STRIPLASTCHAR 40331 +#define IDM_EDIT_TRIMLINES 40332 +#define IDM_EDIT_COMPRESSWS 40333 +#define IDM_EDIT_MERGEBLANKLINES 40334 +#define IDM_EDIT_REMOVEBLANKLINES 40335 +#define IDM_EDIT_MODIFYLINES 40336 +#define IDM_EDIT_SORTLINES 40337 +#define IDM_EDIT_ALIGN 40338 +#define IDM_EDIT_CONVERTUPPERCASE 40339 +#define IDM_EDIT_CONVERTLOWERCASE 40340 +#define IDM_EDIT_INVERTCASE 40341 +#define IDM_EDIT_TITLECASE 40342 +#define IDM_EDIT_SENTENCECASE 40343 +#define IDM_EDIT_CONVERTTABS 40344 +#define IDM_EDIT_CONVERTSPACES 40345 +#define IDM_EDIT_CONVERTTABS2 40346 +#define IDM_EDIT_CONVERTSPACES2 40347 +#define IDM_EDIT_INSERT_TAG 40348 +#define IDM_EDIT_INSERT_ENCODING 40349 +#define IDM_EDIT_INSERT_SHORTDATE 40350 +#define IDM_EDIT_INSERT_LONGDATE 40351 +#define IDM_EDIT_INSERT_FILENAME 40352 +#define IDM_EDIT_INSERT_PATHNAME 40353 +#define IDM_EDIT_LINECOMMENT 40354 +#define IDM_EDIT_STREAMCOMMENT 40355 +#define IDM_EDIT_URLENCODE 40356 +#define IDM_EDIT_URLDECODE 40357 +#define IDM_EDIT_ESCAPECCHARS 40358 +#define IDM_EDIT_UNESCAPECCHARS 40359 +#define IDM_EDIT_CHAR2HEX 40360 +#define IDM_EDIT_HEX2CHAR 40361 +#define IDM_EDIT_FINDMATCHINGBRACE 40362 +#define IDM_EDIT_SELTOMATCHINGBRACE 40363 +#define IDM_EDIT_FIND 40364 +#define IDM_EDIT_SAVEFIND 40365 +#define IDM_EDIT_FINDNEXT 40366 +#define IDM_EDIT_FINDPREV 40367 +#define IDM_EDIT_REPLACE 40368 +#define IDM_EDIT_REPLACENEXT 40369 +#define IDM_EDIT_GOTOLINE 40370 +#define IDM_EDIT_SELTONEXT 40371 +#define IDM_EDIT_SELTOPREV 40372 +#define IDM_EDIT_COMPLETEWORD 40373 +#define IDM_EDIT_JOINLN_NOSP 40374 +#define IDM_EDIT_REMOVEDUPLICATELINES 40375 +#define IDM_EDIT_REMOVEEMPTYLINES 40376 +#define IDM_EDIT_MERGEEMPTYLINES 40377 +#define IDM_VIEW_SCHEME 40400 +#define IDM_VIEW_USE2NDDEFAULT 40401 +#define IDM_VIEW_SCHEMECONFIG 40402 +#define IDM_VIEW_FONT 40403 +#define IDM_VIEW_WORDWRAP 40404 +#define IDM_VIEW_LONGLINEMARKER 40405 +#define IDM_VIEW_SHOWINDENTGUIDES 40406 +#define IDM_VIEW_SHOWWHITESPACE 40407 +#define IDM_VIEW_SHOWEOLS 40408 +#define IDM_VIEW_WORDWRAPSYMBOLS 40409 +#define IDM_VIEW_MATCHBRACES 40410 +#define IDM_VIEW_HILITECURRENTLINE 40411 +#define IDM_VIEW_LINENUMBERS 40412 +#define IDM_VIEW_MARGIN 40413 +#define IDM_VIEW_ZOOMIN 40414 +#define IDM_VIEW_ZOOMOUT 40415 +#define IDM_VIEW_RESETZOOM 40416 +#define IDM_VIEW_TABSASSPACES 40417 +#define IDM_VIEW_TABSETTINGS 40418 +#define IDM_VIEW_WORDWRAPSETTINGS 40419 +#define IDM_VIEW_LONGLINESETTINGS 40420 +#define IDM_VIEW_AUTOINDENTTEXT 40421 +#define IDM_VIEW_AUTOCLOSETAGS 40422 +#define IDM_VIEW_REUSEWINDOW 40423 +#define IDM_VIEW_STICKYWINPOS 40424 +#define IDM_VIEW_ALWAYSONTOP 40425 +#define IDM_VIEW_MINTOTRAY 40426 +#define IDM_VIEW_TRANSPARENT 40427 +#define IDM_VIEW_SINGLEFILEINSTANCE 40428 +#define IDM_VIEW_CHANGENOTIFY 40429 +#define IDM_VIEW_SHOWFILENAMEONLY 40430 +#define IDM_VIEW_SHOWFILENAMEFIRST 40431 +#define IDM_VIEW_SHOWFULLPATH 40432 +#define IDM_VIEW_SHOWEXCERPT 40433 +#define IDM_VIEW_NOESCFUNC 40434 +#define IDM_VIEW_ESCMINIMIZE 40435 +#define IDM_VIEW_ESCEXIT 40436 +#define IDM_VIEW_SAVEBEFORERUNNINGTOOLS 40437 +#define IDM_VIEW_NOSAVERECENT 40438 +#define IDM_VIEW_NOSAVEFINDREPL 40439 +#define IDM_VIEW_TOOLBAR 40440 +#define IDM_VIEW_CUSTOMIZETB 40441 +#define IDM_VIEW_STATUSBAR 40442 +#define IDM_VIEW_SAVESETTINGS 40443 +#define IDM_VIEW_SAVESETTINGSNOW 40444 +#define IDM_VIEW_FOLDING 40445 +#define IDM_VIEW_TOGGLEFOLDS 40446 +#define IDM_VIEW_MARKOCCUR_ONOFF 40447 +#define IDM_VIEW_MARKOCCUR_CASE 40448 +#define IDM_VIEW_MARKOCCUR_WNONE 40449 +#define IDM_VIEW_MARKOCCUR_WORD 40450 +#define IDM_VIEW_MARKOCCUR_CURRENT 40451 +#define IDM_VIEW_MARKOCCUR_VISIBLE 40452 +#define IDM_VIEW_AUTOCOMPLETEWORDS 40453 +#define IDM_VIEW_ACCELWORDNAV 40454 +#define IDM_VIEW_NOPRESERVECARET 40455 +#define IDM_VIEW_HYPERLINKHOTSPOTS 40456 +#define IDM_VIEW_CURRENTSCHEME 40457 +#define IDM_VIEW_SCROLLPASTEOF 40458 +#define IDM_VIEW_TOGGLE_VIEW 40459 +#define IDM_HELP_ABOUT 40500 +#define IDM_HELP_CMD 40501 +#define IDM_HELP_ONLINEDOCUMENTATION 40502 +#define IDM_TRAY_RESTORE 40600 +#define IDM_TRAY_EXIT 40601 +#define IDT_FILE_NEW 40700 +#define IDT_FILE_OPEN 40701 +#define IDT_FILE_BROWSE 40702 +#define IDT_FILE_SAVE 40703 +#define IDT_EDIT_UNDO 40704 +#define IDT_EDIT_REDO 40705 +#define IDT_EDIT_CUT 40706 +#define IDT_EDIT_COPY 40707 +#define IDT_EDIT_PASTE 40708 +#define IDT_EDIT_FIND 40709 +#define IDT_EDIT_REPLACE 40710 +#define IDT_VIEW_WORDWRAP 40711 +#define IDT_VIEW_ZOOMIN 40712 +#define IDT_VIEW_ZOOMOUT 40713 +#define IDT_VIEW_SCHEME 40714 +#define IDT_VIEW_SCHEMECONFIG 40715 +#define IDT_FILE_EXIT 40716 +#define IDT_FILE_SAVEAS 40717 +#define IDT_FILE_SAVECOPY 40718 +#define IDT_EDIT_CLEAR 40719 +#define IDT_FILE_PRINT 40720 +#define IDT_FILE_OPENFAV 40721 +#define IDT_FILE_ADDTOFAV 40722 +#define IDT_VIEW_TOGGLEFOLDS 40723 +#define IDT_FILE_LAUNCH 40724 +#define IDT_VIEW_TOGGLE_VIEW 40725 +#define IDS_SAVEPOS 40800 +#define IDS_RESETPOS 40801 +#define IDS_PREVIEW 40802 +#define IDS_ERR_LOADFILE 50000 +#define IDS_ERR_SAVEFILE 50001 +#define IDS_ERR_BROWSE 50002 +#define IDS_ERR_MRUDLG 50003 +#define IDS_ERR_CREATELINK 50004 +#define IDS_ERR_PREVWINDISABLED 50005 +#define IDS_SELRECT 50006 +#define IDS_BUFFERTOOSMALL 50007 +#define IDS_FIND_WRAPFW 50008 +#define IDS_FIND_WRAPRE 50009 +#define IDS_NOTFOUND 50010 +#define IDS_REPLCOUNT 50011 +#define IDS_ASK_ENCODING 50012 +#define IDS_ASK_ENCODING2 50013 +#define IDS_ERR_ENCODINGNA 50014 +#define IDS_ERR_UNICODE 50015 +#define IDS_ERR_UNICODE2 50016 +#define IDS_WARN_LOAD_BIG_FILE 50017 +#define IDS_ERR_DROP 50018 +#define IDS_ASK_SAVE 50019 +#define IDS_ASK_REVERT 50020 +#define IDS_ASK_RECODE 50021 +#define IDS_ASK_CREATE 50022 +#define IDS_PRINT_HEADER 50023 +#define IDS_PRINT_FOOTER 50024 +#define IDS_PRINT_COLOR 50025 +#define IDS_PRINT_PAGENUM 50026 +#define IDS_PRINT_EMPTY 50027 +#define IDS_PRINT_ERROR 50028 +#define IDS_FAV_SUCCESS 50029 +#define IDS_FAV_FAILURE 50030 +#define IDS_READONLY_MODIFY 50031 +#define IDS_READONLY_SAVE 50032 +#define IDS_FILECHANGENOTIFY 50033 +#define IDS_FILECHANGENOTIFY2 50034 +#define IDS_STICKYWINPOS 50035 +#define IDS_SAVEDSETTINGS 50036 +#define IDS_CREATEINI_FAIL 50037 +#define IDS_WRITEINI_FAIL 50038 +#define IDS_SETTINGSNOTSAVED 50039 +#define IDS_EXPORT_FAIL 50040 +#define IDS_ERR_ACCESSDENIED 50041 +#define IDS_WARN_UNKNOWN_EXT 50042 +#define IDS_REGEX_INVALID 50043 +#define IDS_DROP_NO_FILE 50044 +#define IDS_APPLY_DEFAULT_FONT 50045 +#define IDS_ERR_UPDATECHECKER 50046 +#define IDS_CMDLINEHELP 60000 +#define IDM_EDIT_INSERT_GUID 60001 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 601 +#define _APS_NEXT_COMMAND_VALUE 701 +#define _APS_NEXT_CONTROL_VALUE 801 +#define _APS_NEXT_SYMED_VALUE 901 +#endif +#endif