mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-31 01:34:58 +02:00
Make code more sanitary
Fix some vulnerable codes detected by VS's analyzing. Close #10541
This commit is contained in:
parent
36d0d29cc7
commit
e5a800722b
@ -252,7 +252,13 @@ constexpr bool CheckBuildNumber(DWORD buildNumber)
|
|||||||
|
|
||||||
void InitDarkMode()
|
void InitDarkMode()
|
||||||
{
|
{
|
||||||
auto RtlGetNtVersionNumbers = reinterpret_cast<fnRtlGetNtVersionNumbers>(GetProcAddress(GetModuleHandle(L"ntdll.dll"), "RtlGetNtVersionNumbers"));
|
fnRtlGetNtVersionNumbers RtlGetNtVersionNumbers = nullptr;
|
||||||
|
HMODULE hNtdllModule = GetModuleHandle(L"ntdll.dll");
|
||||||
|
if (hNtdllModule)
|
||||||
|
{
|
||||||
|
RtlGetNtVersionNumbers = reinterpret_cast<fnRtlGetNtVersionNumbers>(GetProcAddress(hNtdllModule, "RtlGetNtVersionNumbers"));
|
||||||
|
}
|
||||||
|
|
||||||
if (RtlGetNtVersionNumbers)
|
if (RtlGetNtVersionNumbers)
|
||||||
{
|
{
|
||||||
DWORD major, minor;
|
DWORD major, minor;
|
||||||
@ -278,7 +284,11 @@ void InitDarkMode()
|
|||||||
_FlushMenuThemes = reinterpret_cast<fnFlushMenuThemes>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(136)));
|
_FlushMenuThemes = reinterpret_cast<fnFlushMenuThemes>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(136)));
|
||||||
_IsDarkModeAllowedForWindow = reinterpret_cast<fnIsDarkModeAllowedForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(137)));
|
_IsDarkModeAllowedForWindow = reinterpret_cast<fnIsDarkModeAllowedForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(137)));
|
||||||
|
|
||||||
_SetWindowCompositionAttribute = reinterpret_cast<fnSetWindowCompositionAttribute>(GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute"));
|
HMODULE hUser32Module = GetModuleHandleW(L"user32.dll");
|
||||||
|
if (hUser32Module)
|
||||||
|
{
|
||||||
|
_SetWindowCompositionAttribute = reinterpret_cast<fnSetWindowCompositionAttribute>(GetProcAddress(hUser32Module, "SetWindowCompositionAttribute"));
|
||||||
|
}
|
||||||
|
|
||||||
if (_OpenNcThemeData &&
|
if (_OpenNcThemeData &&
|
||||||
_RefreshImmersiveColorPolicyState &&
|
_RefreshImmersiveColorPolicyState &&
|
||||||
|
@ -1068,10 +1068,12 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
|
|||||||
HCERTSTORE hStore = NULL;
|
HCERTSTORE hStore = NULL;
|
||||||
HCRYPTMSG hMsg = NULL;
|
HCRYPTMSG hMsg = NULL;
|
||||||
PCCERT_CONTEXT pCertContext = NULL;
|
PCCERT_CONTEXT pCertContext = NULL;
|
||||||
BOOL result;
|
BOOL result = FALSE;
|
||||||
DWORD dwEncoding, dwContentType, dwFormatType;
|
DWORD dwEncoding = 0;
|
||||||
|
DWORD dwContentType = 0;
|
||||||
|
DWORD dwFormatType = 0;
|
||||||
PCMSG_SIGNER_INFO pSignerInfo = NULL;
|
PCMSG_SIGNER_INFO pSignerInfo = NULL;
|
||||||
DWORD dwSignerInfo;
|
DWORD dwSignerInfo = 0;
|
||||||
CERT_INFO CertInfo;
|
CERT_INFO CertInfo;
|
||||||
LPTSTR szName = NULL;
|
LPTSTR szName = NULL;
|
||||||
|
|
||||||
|
@ -37,8 +37,14 @@ unsigned long Process::runSync(bool isElevationRequired) const
|
|||||||
ShExecInfo.lpDirectory = _curDir.c_str();
|
ShExecInfo.lpDirectory = _curDir.c_str();
|
||||||
ShExecInfo.nShow = SW_SHOWNORMAL;
|
ShExecInfo.nShow = SW_SHOWNORMAL;
|
||||||
ShExecInfo.hInstApp = NULL;
|
ShExecInfo.hInstApp = NULL;
|
||||||
|
|
||||||
ShellExecuteEx(&ShExecInfo);
|
ShellExecuteEx(&ShExecInfo);
|
||||||
|
if (!ShExecInfo.hProcess)
|
||||||
|
{
|
||||||
|
// throw exception
|
||||||
|
throw GetLastErrorAsString(GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
||||||
|
|
||||||
unsigned long exitCode;
|
unsigned long exitCode;
|
||||||
|
@ -257,7 +257,7 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
|
|||||||
if (i != LB_ERR)
|
if (i != LB_ERR)
|
||||||
{
|
{
|
||||||
const size_t itemNameLen = 32;
|
const size_t itemNameLen = 32;
|
||||||
TCHAR itemName[itemNameLen + 1];
|
TCHAR itemName[itemNameLen + 1] = { '\0' };
|
||||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXTLEN, i, 0);
|
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXTLEN, i, 0);
|
||||||
if (lbTextLen > itemNameLen)
|
if (lbTextLen > itemNameLen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2458,6 +2458,7 @@ void Notepad_plus::pasteToMarkedLines()
|
|||||||
HANDLE clipboardData = ::GetClipboardData(clipFormat);
|
HANDLE clipboardData = ::GetClipboardData(clipFormat);
|
||||||
::GlobalSize(clipboardData);
|
::GlobalSize(clipboardData);
|
||||||
LPVOID clipboardDataPtr = ::GlobalLock(clipboardData);
|
LPVOID clipboardDataPtr = ::GlobalLock(clipboardData);
|
||||||
|
if (!clipboardDataPtr) return;
|
||||||
|
|
||||||
generic_string clipboardStr = (const TCHAR *)clipboardDataPtr;
|
generic_string clipboardStr = (const TCHAR *)clipboardDataPtr;
|
||||||
|
|
||||||
@ -5768,7 +5769,7 @@ bool Notepad_plus::dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix)
|
|||||||
somedirty = true;
|
somedirty = true;
|
||||||
|
|
||||||
const TCHAR * unitext = (docbuf->getUnicodeMode() != uni8Bit)?TEXT("_utf8"):TEXT("");
|
const TCHAR * unitext = (docbuf->getUnicodeMode() != uni8Bit)?TEXT("_utf8"):TEXT("");
|
||||||
wsprintf(savePath, TEXT("%s\\%s%03d%s.dump"), outdir, fileprefix, i, unitext);
|
wsprintf(savePath, TEXT("%s\\%s%03d%s.dump"), outdir, fileprefix, static_cast<int>(i), unitext);
|
||||||
|
|
||||||
SavingStatus res = MainFileManager.saveBuffer(docbuf->getID(), savePath);
|
SavingStatus res = MainFileManager.saveBuffer(docbuf->getID(), savePath);
|
||||||
|
|
||||||
@ -7579,7 +7580,8 @@ void Notepad_plus::showQuote(const QuoteParams* quote) const
|
|||||||
params._pCurrentView = _pEditView;
|
params._pCurrentView = _pEditView;
|
||||||
|
|
||||||
HANDLE hThread = ::CreateThread(NULL, 0, threadTextPlayer, ¶ms, 0, NULL);
|
HANDLE hThread = ::CreateThread(NULL, 0, threadTextPlayer, ¶ms, 0, NULL);
|
||||||
::CloseHandle(hThread);
|
if (hThread)
|
||||||
|
::CloseHandle(hThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::minimizeDialogs()
|
void Notepad_plus::minimizeDialogs()
|
||||||
|
@ -785,7 +785,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
case NPPM_GETNAMEPART:
|
case NPPM_GETNAMEPART:
|
||||||
case NPPM_GETEXTPART:
|
case NPPM_GETEXTPART:
|
||||||
{
|
{
|
||||||
TCHAR str[MAX_PATH];
|
TCHAR str[MAX_PATH] = { '\0' };
|
||||||
// par defaut : NPPM_GETCURRENTDIRECTORY
|
// par defaut : NPPM_GETCURRENTDIRECTORY
|
||||||
wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName());
|
wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName());
|
||||||
TCHAR* fileStr = str;
|
TCHAR* fileStr = str;
|
||||||
|
@ -772,7 +772,7 @@ namespace NppDarkMode
|
|||||||
hFont = reinterpret_cast<HFONT>(SendMessage(hwnd, WM_GETFONT, 0, 0));
|
hFont = reinterpret_cast<HFONT>(SendMessage(hwnd, WM_GETFONT, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectObject(hdc, hFont);
|
hOldFont = static_cast<HFONT>(SelectObject(hdc, hFont));
|
||||||
|
|
||||||
DWORD dtFlags = DT_LEFT; // DT_LEFT is 0
|
DWORD dtFlags = DT_LEFT; // DT_LEFT is 0
|
||||||
dtFlags |= (nStyle & BS_MULTILINE) ? DT_WORDBREAK : DT_SINGLELINE;
|
dtFlags |= (nStyle & BS_MULTILINE) ? DT_WORDBREAK : DT_SINGLELINE;
|
||||||
|
@ -124,7 +124,7 @@ void resolveLinkFile(generic_string& linkFilePath)
|
|||||||
{
|
{
|
||||||
IShellLink* psl;
|
IShellLink* psl;
|
||||||
WCHAR targetFilePath[MAX_PATH];
|
WCHAR targetFilePath[MAX_PATH];
|
||||||
WIN32_FIND_DATA wfd;
|
WIN32_FIND_DATA wfd = {0};
|
||||||
|
|
||||||
HRESULT hres = CoInitialize(NULL);
|
HRESULT hres = CoInitialize(NULL);
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
|
@ -229,7 +229,7 @@ struct CmdLineParams
|
|||||||
int _column2go = -1;
|
int _column2go = -1;
|
||||||
int _pos2go = -1;
|
int _pos2go = -1;
|
||||||
|
|
||||||
POINT _point;
|
POINT _point = { 0 };
|
||||||
bool _isPointXValid = false;
|
bool _isPointXValid = false;
|
||||||
bool _isPointYValid = false;
|
bool _isPointYValid = false;
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ struct CmdLineParams
|
|||||||
generic_string _udlName;
|
generic_string _udlName;
|
||||||
|
|
||||||
generic_string _easterEggName;
|
generic_string _easterEggName;
|
||||||
unsigned char _quoteType = '\0';
|
unsigned char _quoteType = 0;
|
||||||
int _ghostTypingSpeed = -1; // -1: initial value 1: slow 2: fast 3: speed of light
|
int _ghostTypingSpeed = -1; // -1: initial value 1: slow 2: fast 3: speed of light
|
||||||
|
|
||||||
CmdLineParams()
|
CmdLineParams()
|
||||||
@ -294,8 +294,8 @@ struct CmdLineParamsDTO
|
|||||||
|
|
||||||
struct FloatingWindowInfo
|
struct FloatingWindowInfo
|
||||||
{
|
{
|
||||||
int _cont;
|
int _cont = 0;
|
||||||
RECT _pos;
|
RECT _pos = { 0 };
|
||||||
|
|
||||||
FloatingWindowInfo(int cont, int x, int y, int w, int h)
|
FloatingWindowInfo(int cont, int x, int y, int w, int h)
|
||||||
: _cont(cont)
|
: _cont(cont)
|
||||||
@ -544,8 +544,8 @@ struct NewDocDefaultSettings final
|
|||||||
|
|
||||||
struct LangMenuItem final
|
struct LangMenuItem final
|
||||||
{
|
{
|
||||||
LangType _langType;
|
LangType _langType = L_TEXT;
|
||||||
int _cmdID;
|
int _cmdID = -1;
|
||||||
generic_string _langName;
|
generic_string _langName;
|
||||||
|
|
||||||
LangMenuItem(LangType lt, int cmdID = 0, const generic_string& langName = TEXT("")):
|
LangMenuItem(LangType lt, int cmdID = 0, const generic_string& langName = TEXT("")):
|
||||||
@ -570,7 +570,7 @@ struct PrintSettings final {
|
|||||||
int _footerFontStyle = 0;
|
int _footerFontStyle = 0;
|
||||||
int _footerFontSize = 0;
|
int _footerFontSize = 0;
|
||||||
|
|
||||||
RECT _marge;
|
RECT _marge = {0};
|
||||||
|
|
||||||
PrintSettings() {
|
PrintSettings() {
|
||||||
_marge.left = 0; _marge.top = 0; _marge.right = 0; _marge.bottom = 0;
|
_marge.left = 0; _marge.top = 0; _marge.right = 0; _marge.bottom = 0;
|
||||||
@ -739,9 +739,9 @@ struct NppGUI final
|
|||||||
|
|
||||||
bool _checkHistoryFiles = false;
|
bool _checkHistoryFiles = false;
|
||||||
|
|
||||||
RECT _appPos;
|
RECT _appPos = {0};
|
||||||
|
|
||||||
RECT _findWindowPos;
|
RECT _findWindowPos = { 0 };
|
||||||
|
|
||||||
bool _isMaximized = false;
|
bool _isMaximized = false;
|
||||||
bool _isMinimizedToTray = false;
|
bool _isMinimizedToTray = false;
|
||||||
@ -919,11 +919,11 @@ struct Lang final
|
|||||||
{
|
{
|
||||||
LangType _langID = L_TEXT;
|
LangType _langID = L_TEXT;
|
||||||
generic_string _langName;
|
generic_string _langName;
|
||||||
const TCHAR *_defaultExtList = nullptr;
|
const TCHAR* _defaultExtList = nullptr;
|
||||||
const TCHAR *_langKeyWordList[NB_LIST];
|
const TCHAR* _langKeyWordList[NB_LIST];
|
||||||
const TCHAR *_pCommentLineSymbol = nullptr;
|
const TCHAR* _pCommentLineSymbol = nullptr;
|
||||||
const TCHAR *_pCommentStart = nullptr;
|
const TCHAR* _pCommentStart = nullptr;
|
||||||
const TCHAR *_pCommentEnd = nullptr;
|
const TCHAR* _pCommentEnd = nullptr;
|
||||||
|
|
||||||
bool _isTabReplacedBySpace = false;
|
bool _isTabReplacedBySpace = false;
|
||||||
int _tabSize = -1;
|
int _tabSize = -1;
|
||||||
@ -992,15 +992,13 @@ struct Lang final
|
|||||||
class UserLangContainer final
|
class UserLangContainer final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UserLangContainer() :_name(TEXT("new user define")), _ext(TEXT("")), _udlVersion(TEXT(""))
|
UserLangContainer() :_name(TEXT("new user define")), _ext(TEXT("")), _udlVersion(TEXT("")) {
|
||||||
{
|
for (int i = 0; i < SCE_USER_KWLIST_TOTAL; ++i) *_keywordLists[i] = '\0';
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserLangContainer(const TCHAR *name, const TCHAR *ext, bool isDarkModeTheme, const TCHAR *udlVer):
|
UserLangContainer(const TCHAR *name, const TCHAR *ext, bool isDarkModeTheme, const TCHAR *udlVer):
|
||||||
_name(name), _ext(ext), _isDarkModeTheme(isDarkModeTheme), _udlVersion(udlVer)
|
_name(name), _ext(ext), _isDarkModeTheme(isDarkModeTheme), _udlVersion(udlVer) {
|
||||||
{
|
for (int i = 0; i < SCE_USER_KWLIST_TOTAL; ++i) *_keywordLists[i] = '\0';
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserLangContainer & operator = (const UserLangContainer & ulc)
|
UserLangContainer & operator = (const UserLangContainer & ulc)
|
||||||
@ -1046,13 +1044,13 @@ private:
|
|||||||
bool _isDarkModeTheme = false;
|
bool _isDarkModeTheme = false;
|
||||||
|
|
||||||
TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char];
|
TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char];
|
||||||
bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS];
|
bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS] = {false};
|
||||||
|
|
||||||
bool _isCaseIgnored;
|
bool _isCaseIgnored = false;
|
||||||
bool _allowFoldOfComments;
|
bool _allowFoldOfComments = false;
|
||||||
int _forcePureLC;
|
int _forcePureLC = PURE_LC_NONE;
|
||||||
int _decimalSeparator;
|
int _decimalSeparator = DECSEP_DOT;
|
||||||
bool _foldCompact;
|
bool _foldCompact = false;
|
||||||
|
|
||||||
// nakama zone
|
// nakama zone
|
||||||
friend class Notepad_plus;
|
friend class Notepad_plus;
|
||||||
@ -1066,21 +1064,6 @@ private:
|
|||||||
friend class SymbolsStyleDialog;
|
friend class SymbolsStyleDialog;
|
||||||
friend class UserDefineDialog;
|
friend class UserDefineDialog;
|
||||||
friend class StylerDlg;
|
friend class StylerDlg;
|
||||||
|
|
||||||
void init()
|
|
||||||
{
|
|
||||||
_forcePureLC = PURE_LC_NONE;
|
|
||||||
_decimalSeparator = DECSEP_DOT;
|
|
||||||
_foldCompact = false;
|
|
||||||
_isCaseIgnored = false;
|
|
||||||
_allowFoldOfComments = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < SCE_USER_KWLIST_TOTAL; ++i)
|
|
||||||
*_keywordLists[i] = '\0';
|
|
||||||
|
|
||||||
for (int i = 0; i < SCE_USER_TOTAL_KEYWORD_GROUPS; ++i)
|
|
||||||
_isPrefix[i] = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_EXTERNAL_LEXER_NAME_LEN 16
|
#define MAX_EXTERNAL_LEXER_NAME_LEN 16
|
||||||
@ -1150,8 +1133,8 @@ friend class NppParameters;
|
|||||||
public:
|
public:
|
||||||
struct LocalizationDefinition
|
struct LocalizationDefinition
|
||||||
{
|
{
|
||||||
const wchar_t *_langName;
|
const wchar_t *_langName = nullptr;
|
||||||
const wchar_t *_xmlFileName;
|
const wchar_t *_xmlFileName = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool addLanguageFromXml(const std::wstring& xmlFullPath);
|
bool addLanguageFromXml(const std::wstring& xmlFullPath);
|
||||||
@ -1701,11 +1684,11 @@ private:
|
|||||||
|
|
||||||
NppGUI _nppGUI;
|
NppGUI _nppGUI;
|
||||||
ScintillaViewParams _svp;
|
ScintillaViewParams _svp;
|
||||||
Lang *_langList[NB_LANG] = {};
|
Lang* _langList[NB_LANG] = { nullptr };
|
||||||
int _nbLang = 0;
|
int _nbLang = 0;
|
||||||
|
|
||||||
// Recent File History
|
// Recent File History
|
||||||
generic_string *_LRFileList[NB_MAX_LRF_FILE];
|
generic_string* _LRFileList[NB_MAX_LRF_FILE] = { nullptr };
|
||||||
int _nbRecentFile = 0;
|
int _nbRecentFile = 0;
|
||||||
int _nbMaxRecentFile = 10;
|
int _nbMaxRecentFile = 10;
|
||||||
bool _putRecentFileInSubMenu = false;
|
bool _putRecentFileInSubMenu = false;
|
||||||
@ -1715,11 +1698,11 @@ private:
|
|||||||
|
|
||||||
FindHistory _findHistory;
|
FindHistory _findHistory;
|
||||||
|
|
||||||
UserLangContainer *_userLangArray[NB_MAX_USER_LANG];
|
UserLangContainer* _userLangArray[NB_MAX_USER_LANG] = { nullptr };
|
||||||
unsigned char _nbUserLang = 0; // won't be exceeded to 255;
|
unsigned char _nbUserLang = 0; // won't be exceeded to 255;
|
||||||
generic_string _userDefineLangsFolderPath;
|
generic_string _userDefineLangsFolderPath;
|
||||||
generic_string _userDefineLangPath;
|
generic_string _userDefineLangPath;
|
||||||
ExternalLangContainer *_externalLangArray[NB_MAX_EXTERNAL_LANG];
|
ExternalLangContainer* _externalLangArray[NB_MAX_EXTERNAL_LANG] = { nullptr };
|
||||||
int _nbExternalLang = 0;
|
int _nbExternalLang = 0;
|
||||||
|
|
||||||
CmdLineParamsDTO _cmdLineParams;
|
CmdLineParamsDTO _cmdLineParams;
|
||||||
@ -1739,7 +1722,7 @@ private:
|
|||||||
|
|
||||||
WNDPROC _transparentFuncAddr = nullptr;
|
WNDPROC _transparentFuncAddr = nullptr;
|
||||||
WNDPROC _enableThemeDialogTextureFuncAddr = nullptr;
|
WNDPROC _enableThemeDialogTextureFuncAddr = nullptr;
|
||||||
bool _isLocal;
|
bool _isLocal = false;
|
||||||
bool _isx64 = false; // by default 32-bit
|
bool _isx64 = false; // by default 32-bit
|
||||||
|
|
||||||
generic_string _cmdSettingsDir;
|
generic_string _cmdSettingsDir;
|
||||||
@ -1791,19 +1774,19 @@ private:
|
|||||||
std::vector<generic_string> _fileBrowserRoot;
|
std::vector<generic_string> _fileBrowserRoot;
|
||||||
generic_string _fileBrowserSelectedItemPath;
|
generic_string _fileBrowserSelectedItemPath;
|
||||||
|
|
||||||
Accelerator *_pAccelerator;
|
Accelerator* _pAccelerator = nullptr;
|
||||||
ScintillaAccelerator * _pScintAccelerator;
|
ScintillaAccelerator* _pScintAccelerator = nullptr;
|
||||||
|
|
||||||
FindDlgTabTitiles _findDlgTabTitiles;
|
FindDlgTabTitiles _findDlgTabTitiles;
|
||||||
bool _asNotepadStyle = false;
|
bool _asNotepadStyle = false;
|
||||||
|
|
||||||
winVer _winVersion;
|
winVer _winVersion = WV_UNKNOWN;
|
||||||
Platform _platForm;
|
Platform _platForm = PF_UNKNOWN;
|
||||||
|
|
||||||
NativeLangSpeaker *_pNativeLangSpeaker = nullptr;
|
NativeLangSpeaker *_pNativeLangSpeaker = nullptr;
|
||||||
|
|
||||||
COLORREF _currentDefaultBgColor;
|
COLORREF _currentDefaultBgColor = RGB(0xFF, 0xFF, 0xFF);
|
||||||
COLORREF _currentDefaultFgColor;
|
COLORREF _currentDefaultFgColor = RGB(0x00, 0x00, 0x00);
|
||||||
|
|
||||||
generic_string _initialCloudChoice;
|
generic_string _initialCloudChoice;
|
||||||
|
|
||||||
|
@ -1124,7 +1124,7 @@ BufferID FileManager::newEmptyDocument()
|
|||||||
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
|
|
||||||
TCHAR nb[10];
|
TCHAR nb[10];
|
||||||
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
|
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
||||||
newTitle += nb;
|
newTitle += nb;
|
||||||
|
|
||||||
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
|
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
|
||||||
@ -1141,7 +1141,7 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d
|
|||||||
{
|
{
|
||||||
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
TCHAR nb[10];
|
TCHAR nb[10];
|
||||||
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
|
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
||||||
newTitle += nb;
|
newTitle += nb;
|
||||||
|
|
||||||
if (!dontRef)
|
if (!dontRef)
|
||||||
|
@ -46,7 +46,7 @@ void addText2Combo(const TCHAR * txt2add, HWND hCombo)
|
|||||||
|
|
||||||
generic_string getTextFromCombo(HWND hCombo)
|
generic_string getTextFromCombo(HWND hCombo)
|
||||||
{
|
{
|
||||||
TCHAR str[FINDREPLACE_MAXLENGTH];
|
TCHAR str[FINDREPLACE_MAXLENGTH] = { '\0' };
|
||||||
::SendMessage(hCombo, WM_GETTEXT, FINDREPLACE_MAXLENGTH - 1, reinterpret_cast<LPARAM>(str));
|
::SendMessage(hCombo, WM_GETTEXT, FINDREPLACE_MAXLENGTH - 1, reinterpret_cast<LPARAM>(str));
|
||||||
return generic_string(str);
|
return generic_string(str);
|
||||||
};
|
};
|
||||||
@ -429,7 +429,7 @@ void FindReplaceDlg::saveFindHistory()
|
|||||||
|
|
||||||
int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector<generic_string> & strings, bool saveEmpty)
|
int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector<generic_string> & strings, bool saveEmpty)
|
||||||
{
|
{
|
||||||
TCHAR text[FINDREPLACE_MAXLENGTH];
|
TCHAR text[FINDREPLACE_MAXLENGTH] = { '\0' };
|
||||||
HWND hCombo = ::GetDlgItem(_hSelf, id);
|
HWND hCombo = ::GetDlgItem(_hSelf, id);
|
||||||
int count = static_cast<int32_t>(::SendMessage(hCombo, CB_GETCOUNT, 0, 0));
|
int count = static_cast<int32_t>(::SendMessage(hCombo, CB_GETCOUNT, 0, 0));
|
||||||
count = min(count, maxcount);
|
count = min(count, maxcount);
|
||||||
@ -970,6 +970,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
// Change handler of edit element in the comboboxes to support Ctrl+Backspace
|
// Change handler of edit element in the comboboxes to support Ctrl+Backspace
|
||||||
COMBOBOXINFO cbinfo = { sizeof(COMBOBOXINFO) };
|
COMBOBOXINFO cbinfo = { sizeof(COMBOBOXINFO) };
|
||||||
GetComboBoxInfo(hFindCombo, &cbinfo);
|
GetComboBoxInfo(hFindCombo, &cbinfo);
|
||||||
|
if (!cbinfo.hwndItem) return FALSE;
|
||||||
|
|
||||||
originalComboEditProc = SetWindowLongPtr(cbinfo.hwndItem, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(comboEditProc));
|
originalComboEditProc = SetWindowLongPtr(cbinfo.hwndItem, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(comboEditProc));
|
||||||
SetWindowLongPtr(cbinfo.hwndItem, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(cbinfo.hwndCombo));
|
SetWindowLongPtr(cbinfo.hwndItem, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(cbinfo.hwndCombo));
|
||||||
GetComboBoxInfo(hReplaceCombo, &cbinfo);
|
GetComboBoxInfo(hReplaceCombo, &cbinfo);
|
||||||
@ -4036,7 +4038,7 @@ void Finder::add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline)
|
|||||||
str += TEXT(" ");
|
str += TEXT(" ");
|
||||||
|
|
||||||
TCHAR lnb[16];
|
TCHAR lnb[16];
|
||||||
wsprintf(lnb, TEXT("%d"), fi._lineNumber);
|
wsprintf(lnb, TEXT("%d"), static_cast<int>(fi._lineNumber));
|
||||||
str += lnb;
|
str += lnb;
|
||||||
str += TEXT(": ");
|
str += TEXT(": ");
|
||||||
mi._start += static_cast<int32_t>(str.length());
|
mi._start += static_cast<int32_t>(str.length());
|
||||||
|
@ -326,7 +326,7 @@ size_t Printer::doPrint(bool justDoIt)
|
|||||||
if (!nppGUI._printSettings._printLineNumber)
|
if (!nppGUI._printSettings._printLineNumber)
|
||||||
_pSEView->showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, false);
|
_pSEView->showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, false);
|
||||||
|
|
||||||
size_t pageNum = 1;
|
int pageNum = 1;
|
||||||
const TCHAR pageVar[] = TEXT("$(CURRENT_PRINTING_PAGE)");
|
const TCHAR pageVar[] = TEXT("$(CURRENT_PRINTING_PAGE)");
|
||||||
|
|
||||||
_pSEView->execute(SCI_SETPRINTCOLOURMODE, nppGUI._printSettings._printOption); // setting mode once is enough
|
_pSEView->execute(SCI_SETPRINTCOLOURMODE, nppGUI._printSettings._printOption); // setting mode once is enough
|
||||||
|
@ -3549,7 +3549,9 @@ void ScintillaEditView::runMarkers(bool doHide, size_t searchStart, bool endOfDo
|
|||||||
|
|
||||||
void ScintillaEditView::setTabSettings(Lang *lang)
|
void ScintillaEditView::setTabSettings(Lang *lang)
|
||||||
{
|
{
|
||||||
if (lang && lang->_tabSize != -1 && lang->_tabSize != 0)
|
if (!lang) return;
|
||||||
|
|
||||||
|
if (lang->_tabSize != -1 && lang->_tabSize != 0)
|
||||||
{
|
{
|
||||||
if (lang->_langID == L_JAVASCRIPT)
|
if (lang->_langID == L_JAVASCRIPT)
|
||||||
{
|
{
|
||||||
|
@ -1134,7 +1134,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
{
|
{
|
||||||
TCHAR ext[extsLenMax];
|
TCHAR ext[extsLenMax] = { '\0' };
|
||||||
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, reinterpret_cast<LPARAM>(ext));
|
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, reinterpret_cast<LPARAM>(ext));
|
||||||
_pUserLang->_ext = ext;
|
_pUserLang->_ext = ext;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -272,8 +272,14 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detect WINE
|
// Detect WINE
|
||||||
PWINEGETVERSION pWGV = (PWINEGETVERSION)GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "wine_get_version");
|
PWINEGETVERSION pWGV = nullptr;
|
||||||
if (pWGV != NULL)
|
HMODULE hNtdllModule = GetModuleHandle(L"ntdll.dll");
|
||||||
|
if (hNtdllModule)
|
||||||
|
{
|
||||||
|
pWGV = (PWINEGETVERSION)GetProcAddress(hNtdllModule, "wine_get_version");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pWGV != nullptr)
|
||||||
{
|
{
|
||||||
TCHAR szWINEVersion[32];
|
TCHAR szWINEVersion[32];
|
||||||
generic_sprintf(szWINEVersion, TEXT("%hs"), pWGV());
|
generic_sprintf(szWINEVersion, TEXT("%hs"), pWGV());
|
||||||
|
@ -119,7 +119,7 @@ size_t ListView::findAlphabeticalOrderPos(const generic_string& string2Cmp, Sort
|
|||||||
|
|
||||||
for (size_t i = 0; i < nbItem; ++i)
|
for (size_t i = 0; i < nbItem; ++i)
|
||||||
{
|
{
|
||||||
TCHAR str[MAX_PATH];
|
TCHAR str[MAX_PATH] = { '\0' };
|
||||||
ListView_GetItemText(_hSelf, i, 0, str, sizeof(str));
|
ListView_GetItemText(_hSelf, i, 0, str, sizeof(str));
|
||||||
|
|
||||||
int res = lstrcmp(string2Cmp.c_str(), str);
|
int res = lstrcmp(string2Cmp.c_str(), str);
|
||||||
|
@ -568,7 +568,7 @@ int WordStyleDlg::whichTabColourIndex()
|
|||||||
if (i == LB_ERR)
|
if (i == LB_ERR)
|
||||||
return -1;
|
return -1;
|
||||||
const size_t styleNameLen = 128;
|
const size_t styleNameLen = 128;
|
||||||
TCHAR styleName[styleNameLen + 1];
|
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||||
if (lbTextLen > styleNameLen)
|
if (lbTextLen > styleNameLen)
|
||||||
return -1;
|
return -1;
|
||||||
@ -673,7 +673,8 @@ void WordStyleDlg::updateUserKeywords()
|
|||||||
//TCHAR kw[NB_MAX];
|
//TCHAR kw[NB_MAX];
|
||||||
auto len = ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXTLENGTH, 0, 0);
|
auto len = ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXTLENGTH, 0, 0);
|
||||||
len += 1;
|
len += 1;
|
||||||
TCHAR *kw = new TCHAR[len];
|
TCHAR* kw = new TCHAR[len];
|
||||||
|
::memset(kw, 0, len * sizeof(TCHAR));
|
||||||
::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXT, len, reinterpret_cast<LPARAM>(kw));
|
::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXT, len, reinterpret_cast<LPARAM>(kw));
|
||||||
style._keywords = kw;
|
style._keywords = kw;
|
||||||
|
|
||||||
@ -833,7 +834,7 @@ void WordStyleDlg::setVisualFromStyleList()
|
|||||||
|
|
||||||
COLORREF c = NppDarkMode::isEnabled() ? NppDarkMode::getLinkTextColor() : RGB(0x00, 0x00, 0xFF);
|
COLORREF c = NppDarkMode::isEnabled() ? NppDarkMode::getLinkTextColor() : RGB(0x00, 0x00, 0xFF);
|
||||||
const size_t strLen = 256;
|
const size_t strLen = 256;
|
||||||
TCHAR str[strLen + 1];
|
TCHAR str[strLen + 1] = { '\0' };
|
||||||
|
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
@ -850,7 +851,7 @@ void WordStyleDlg::setVisualFromStyleList()
|
|||||||
if (i == LB_ERR)
|
if (i == LB_ERR)
|
||||||
return;
|
return;
|
||||||
const size_t styleNameLen = 64;
|
const size_t styleNameLen = 64;
|
||||||
TCHAR styleName[styleNameLen + 1];
|
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||||
lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||||
if (lbTextLen > styleNameLen)
|
if (lbTextLen > styleNameLen)
|
||||||
return;
|
return;
|
||||||
|
@ -496,7 +496,7 @@ void Gripper::doTabReordering(POINT pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select the tab only in source tab window
|
// select the tab only in source tab window
|
||||||
if ((_hTab == _hTabSource) && (_iItem != -1))
|
if ((_hTab != nullptr && _hTab == _hTabSource) && (_iItem != -1))
|
||||||
{
|
{
|
||||||
::SendMessage(_hTab, TCM_SETCURSEL, _iItem, 0);
|
::SendMessage(_hTab, TCM_SETCURSEL, _iItem, 0);
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ bool FileBrowser::selectItemFromPath(const generic_string& itemPath) const
|
|||||||
|
|
||||||
bool FileBrowser::selectCurrentEditingFile() const
|
bool FileBrowser::selectCurrentEditingFile() const
|
||||||
{
|
{
|
||||||
TCHAR currentDocPath[MAX_PATH] = { '0' };
|
TCHAR currentDocPath[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hParent, NPPM_GETFULLCURRENTPATH, MAX_PATH, reinterpret_cast<LPARAM>(currentDocPath));
|
::SendMessage(_hParent, NPPM_GETFULLCURRENTPATH, MAX_PATH, reinterpret_cast<LPARAM>(currentDocPath));
|
||||||
generic_string currentDocPathStr = currentDocPath;
|
generic_string currentDocPathStr = currentDocPath;
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ void FileBrowser::notified(LPNMHDR notification)
|
|||||||
}
|
}
|
||||||
else if ((notification->hwndFrom == _treeView.getHSelf()))
|
else if ((notification->hwndFrom == _treeView.getHSelf()))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -1068,7 +1068,7 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
|||||||
patterns2Match.push_back(TEXT("*.*"));
|
patterns2Match.push_back(TEXT("*.*"));
|
||||||
|
|
||||||
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
|
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
|
||||||
TCHAR rootLabel[MAX_PATH];
|
TCHAR rootLabel[MAX_PATH] = {'\0'};
|
||||||
wcscpy_s(rootLabel, label);
|
wcscpy_s(rootLabel, label);
|
||||||
size_t len = lstrlen(rootLabel);
|
size_t len = lstrlen(rootLabel);
|
||||||
if (rootLabel[len - 1] == '\\')
|
if (rootLabel[len - 1] == '\\')
|
||||||
@ -1087,7 +1087,7 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
|
|||||||
HTREEITEM hFolderItem = nullptr;
|
HTREEITEM hFolderItem = nullptr;
|
||||||
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
||||||
{
|
{
|
||||||
TCHAR rootPath[MAX_PATH];
|
TCHAR rootPath[MAX_PATH] = { '\0' };
|
||||||
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
|
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
|
||||||
size_t len = lstrlen(rootPath);
|
size_t len = lstrlen(rootPath);
|
||||||
if (rootPath[len - 1] == '\\')
|
if (rootPath[len - 1] == '\\')
|
||||||
@ -1149,7 +1149,7 @@ HTREEITEM FileBrowser::findChildNodeFromName(HTREEITEM parent, const generic_str
|
|||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -1309,7 +1309,7 @@ bool FileBrowser::addToTree(FilesToChange & group, HTREEITEM node)
|
|||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -1370,7 +1370,7 @@ HTREEITEM FileBrowser::findInTree(const generic_string& rootPath, HTREEITEM node
|
|||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -1411,7 +1411,7 @@ std::vector<HTREEITEM> FileBrowser::findInTree(FilesToChange & group, HTREEITEM
|
|||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = {'\0'};
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1732,7 +1732,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
//count lines
|
//count lines
|
||||||
{
|
{
|
||||||
int count=1;
|
int count=1;
|
||||||
TCHAR tbuffer[255];
|
TCHAR tbuffer[255] = { '\0' };
|
||||||
wcscpy_s(tbuffer,(TCHAR*)lParam);
|
wcscpy_s(tbuffer,(TCHAR*)lParam);
|
||||||
for(int j=0;j<(int)lstrlen(tbuffer);j++)
|
for(int j=0;j<(int)lstrlen(tbuffer);j++)
|
||||||
{
|
{
|
||||||
|
@ -918,6 +918,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nbElem = theMacros.size();
|
nbElem = theMacros.size();
|
||||||
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
||||||
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
|
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
|
||||||
|
|
||||||
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
|
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
|
||||||
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
||||||
{
|
{
|
||||||
@ -952,6 +953,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nbElem = theUserCmds.size();
|
nbElem = theUserCmds.size();
|
||||||
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
||||||
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
|
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
|
||||||
|
|
||||||
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
|
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
|
||||||
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
||||||
{
|
{
|
||||||
@ -967,6 +969,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParam.getAccelerator()->updateShortcuts();
|
nppParam.getAccelerator()->updateShortcuts();
|
||||||
nppParam.setShortcutDirty();
|
nppParam.setShortcutDirty();
|
||||||
|
|
||||||
|
if (!hMenu) return FALSE;
|
||||||
|
|
||||||
// All menu items are shifted up. So we delete the last item
|
// All menu items are shifted up. So we delete the last item
|
||||||
::RemoveMenu(hMenu, posBase + static_cast<int32_t>(nbElem), MF_BYPOSITION);
|
::RemoveMenu(hMenu, posBase + static_cast<int32_t>(nbElem), MF_BYPOSITION);
|
||||||
|
|
||||||
|
@ -72,6 +72,9 @@ void Version::setVersionFrom(const generic_string& filePath)
|
|||||||
DWORD handle = 0;
|
DWORD handle = 0;
|
||||||
DWORD bufferSize = ::GetFileVersionInfoSize(filePath.c_str(), &handle);
|
DWORD bufferSize = ::GetFileVersionInfoSize(filePath.c_str(), &handle);
|
||||||
|
|
||||||
|
if (handle == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (bufferSize <= 0)
|
if (bufferSize <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1530,7 +1530,7 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
|
|||||||
{
|
{
|
||||||
if (LOWORD(wParam) == IDC_COLUMNPOS_EDIT)
|
if (LOWORD(wParam) == IDC_COLUMNPOS_EDIT)
|
||||||
{
|
{
|
||||||
TCHAR text[MAX_PATH];
|
TCHAR text[MAX_PATH] = {'\0'};
|
||||||
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text));
|
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text));
|
||||||
|
|
||||||
if (str2numberVector(text, svp._edgeMultiColumnPos))
|
if (str2numberVector(text, svp._edgeMultiColumnPos))
|
||||||
@ -2138,7 +2138,7 @@ INT_PTR CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wParam
|
|||||||
{
|
{
|
||||||
case IDC_OPENSAVEDIR_ALWAYSON_EDIT:
|
case IDC_OPENSAVEDIR_ALWAYSON_EDIT:
|
||||||
{
|
{
|
||||||
TCHAR inputDir[MAX_PATH];
|
TCHAR inputDir[MAX_PATH] = { '\0' };
|
||||||
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
||||||
wcscpy_s(nppGUI._defaultDir, inputDir);
|
wcscpy_s(nppGUI._defaultDir, inputDir);
|
||||||
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
|
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
|
||||||
@ -2988,7 +2988,7 @@ INT_PTR CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
|||||||
::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str());
|
::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str());
|
||||||
|
|
||||||
TCHAR intStr[5];
|
TCHAR intStr[5];
|
||||||
for (size_t i = 6 ; i < 15 ; ++i)
|
for (int i = 6 ; i < 15 ; ++i)
|
||||||
{
|
{
|
||||||
wsprintf(intStr, TEXT("%d"), i);
|
wsprintf(intStr, TEXT("%d"), i);
|
||||||
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
|
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
|
||||||
@ -3383,7 +3383,7 @@ INT_PTR CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||||||
{
|
{
|
||||||
case IDC_BACKUPDIR_EDIT:
|
case IDC_BACKUPDIR_EDIT:
|
||||||
{
|
{
|
||||||
TCHAR inputDir[MAX_PATH];
|
TCHAR inputDir[MAX_PATH] = {'\0'};
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
||||||
nppGUI._backupDir = inputDir;
|
nppGUI._backupDir = inputDir;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4195,14 +4195,14 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
case IDC_EDIT_OPENDELIMITER:
|
case IDC_EDIT_OPENDELIMITER:
|
||||||
{
|
{
|
||||||
TCHAR opener[2];
|
TCHAR opener[2] = { '\0' };
|
||||||
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener));
|
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener));
|
||||||
nppGUI._leftmostDelimiter = static_cast<char>(opener[0]);
|
nppGUI._leftmostDelimiter = static_cast<char>(opener[0]);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDC_EDIT_CLOSEDELIMITER:
|
case IDC_EDIT_CLOSEDELIMITER:
|
||||||
{
|
{
|
||||||
TCHAR closer[2];
|
TCHAR closer[2] = { '\0' };
|
||||||
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer));
|
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer));
|
||||||
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
|
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -664,7 +664,7 @@ void ProjectPanel::notified(LPNMHDR notification)
|
|||||||
}
|
}
|
||||||
else if ((notification->hwndFrom == _treeView.getHSelf()))
|
else if ((notification->hwndFrom == _treeView.getHSelf()))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -140,10 +140,10 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR expandedStr[CURRENTWORD_MAXLENGTH];
|
TCHAR expandedStr[CURRENTWORD_MAXLENGTH] = { '\0' };
|
||||||
if (internalVar == CURRENT_LINE || internalVar == CURRENT_COLUMN)
|
if (internalVar == CURRENT_LINE || internalVar == CURRENT_COLUMN)
|
||||||
{
|
{
|
||||||
auto lineNumber = ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, 0, 0);
|
int lineNumber = static_cast<int>(::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, 0, 0));
|
||||||
wsprintf(expandedStr, TEXT("%d"), lineNumber);
|
wsprintf(expandedStr, TEXT("%d"), lineNumber);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -190,11 +190,16 @@ HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplat
|
|||||||
// Duplicate Dlg Template resource
|
// Duplicate Dlg Template resource
|
||||||
unsigned long sizeDlg = ::SizeofResource(_hInst, hDialogRC);
|
unsigned long sizeDlg = ::SizeofResource(_hInst, hDialogRC);
|
||||||
HGLOBAL hMyDlgTemplate = ::GlobalAlloc(GPTR, sizeDlg);
|
HGLOBAL hMyDlgTemplate = ::GlobalAlloc(GPTR, sizeDlg);
|
||||||
|
if (!hMyDlgTemplate) return nullptr;
|
||||||
|
|
||||||
*ppMyDlgTemplate = static_cast<DLGTEMPLATE *>(::GlobalLock(hMyDlgTemplate));
|
*ppMyDlgTemplate = static_cast<DLGTEMPLATE *>(::GlobalLock(hMyDlgTemplate));
|
||||||
|
if (!*ppMyDlgTemplate) return nullptr;
|
||||||
|
|
||||||
::memcpy(*ppMyDlgTemplate, pDlgTemplate, sizeDlg);
|
::memcpy(*ppMyDlgTemplate, pDlgTemplate, sizeDlg);
|
||||||
|
|
||||||
DLGTEMPLATEEX *pMyDlgTemplateEx = reinterpret_cast<DLGTEMPLATEEX *>(*ppMyDlgTemplate);
|
DLGTEMPLATEEX* pMyDlgTemplateEx = reinterpret_cast<DLGTEMPLATEEX *>(*ppMyDlgTemplate);
|
||||||
|
if (!pMyDlgTemplateEx) return nullptr;
|
||||||
|
|
||||||
if (pMyDlgTemplateEx->signature == 0xFFFF)
|
if (pMyDlgTemplateEx->signature == 0xFFFF)
|
||||||
pMyDlgTemplateEx->exStyle |= WS_EX_LAYOUTRTL;
|
pMyDlgTemplateEx->exStyle |= WS_EX_LAYOUTRTL;
|
||||||
else
|
else
|
||||||
|
@ -140,7 +140,7 @@ generic_string TreeView::getItemDisplayName(HTREEITEM Item2Set) const
|
|||||||
{
|
{
|
||||||
if (!Item2Set)
|
if (!Item2Set)
|
||||||
return TEXT("");
|
return TEXT("");
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.hItem = Item2Set;
|
tvItem.hItem = Item2Set;
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
@ -245,7 +245,7 @@ HTREEITEM TreeView::searchSubItemByName(const TCHAR *itemName, HTREEITEM hParent
|
|||||||
|
|
||||||
for ( ; hItem != NULL; hItem = getNextSibling(hItem))
|
for ( ; hItem != NULL; hItem = getNextSibling(hItem))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.hItem = hItem;
|
tvItem.hItem = hItem;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -596,7 +596,7 @@ bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const gene
|
|||||||
if (!tree2Search)
|
if (!tree2Search)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.hItem = tree2Search;
|
tvItem.hItem = tree2Search;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
@ -638,7 +638,7 @@ bool TreeView::retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREE
|
|||||||
if (!treeviewNode)
|
if (!treeviewNode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TCHAR textBuffer[MAX_PATH];
|
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
tvItem.hItem = treeviewNode;
|
tvItem.hItem = treeviewNode;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
{
|
{
|
||||||
sortCompareData* sortData = (sortCompareData*)lParamSort;
|
sortCompareData* sortData = (sortCompareData*)lParamSort;
|
||||||
TCHAR str1[MAX_PATH];
|
TCHAR str1[MAX_PATH] = { '\0' };
|
||||||
TCHAR str2[MAX_PATH];
|
TCHAR str2[MAX_PATH] = { '\0' };
|
||||||
|
|
||||||
ListView_GetItemText(sortData->hListView, lParam1, sortData->columnIndex, str1, sizeof(str1));
|
ListView_GetItemText(sortData->hListView, lParam1, sortData->columnIndex, str1, sizeof(str1));
|
||||||
ListView_GetItemText(sortData->hListView, lParam2, sortData->columnIndex, str2, sizeof(str2));
|
ListView_GetItemText(sortData->hListView, lParam2, sortData->columnIndex, str2, sizeof(str2));
|
||||||
@ -313,7 +313,7 @@ void VerticalFileSwitcher::popupMenuCmd(int cmdID)
|
|||||||
{
|
{
|
||||||
bool& isExtColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool& isExtColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
isExtColumn = !isExtColumn;
|
isExtColumn = !isExtColumn;
|
||||||
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | isExtColumn ? MF_UNCHECKED : MF_CHECKED);
|
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | (isExtColumn ? MF_UNCHECKED : MF_CHECKED));
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -208,7 +208,7 @@ public:
|
|||||||
int getMenuCmdID() const {return _menuCmdID;};
|
int getMenuCmdID() const {return _menuCmdID;};
|
||||||
size_t toKeyDef(size_t index) const {
|
size_t toKeyDef(size_t index) const {
|
||||||
KeyCombo kc = _keyCombos[index];
|
KeyCombo kc = _keyCombos[index];
|
||||||
int keymod = (kc._isCtrl?SCMOD_CTRL:0) | (kc._isAlt?SCMOD_ALT:0) | (kc._isShift?SCMOD_SHIFT:0);
|
size_t keymod = (kc._isCtrl ? SCMOD_CTRL : 0) | (kc._isAlt ? SCMOD_ALT : 0) | (kc._isShift ? SCMOD_SHIFT : 0);
|
||||||
return keyTranslate(kc._key) + (keymod << 16);
|
return keyTranslate(kc._key) + (keymod << 16);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1201,18 +1201,16 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
|
|||||||
int id;
|
int id;
|
||||||
element->Attribute("id", &id);
|
element->Attribute("id", &id);
|
||||||
HWND hCombo = ::GetDlgItem(hDlg, id);
|
HWND hCombo = ::GetDlgItem(hDlg, id);
|
||||||
|
if (!hCombo) return false;
|
||||||
|
|
||||||
if (hCombo)
|
for (TiXmlNodeA *gChildNode = childNode->FirstChildElement("Element");
|
||||||
|
gChildNode;
|
||||||
|
gChildNode = gChildNode->NextSibling("Element"))
|
||||||
{
|
{
|
||||||
for (TiXmlNodeA *gChildNode = childNode->FirstChildElement("Element");
|
TiXmlElementA *comBoelement = gChildNode->ToElement();
|
||||||
gChildNode;
|
const char *name = comBoelement->Attribute("name");
|
||||||
gChildNode = gChildNode->NextSibling("Element"))
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
{
|
comboElms.push_back(nameW);
|
||||||
TiXmlElementA *comBoelement = gChildNode->ToElement();
|
|
||||||
const char *name = comBoelement->Attribute("name");
|
|
||||||
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
|
||||||
comboElms.push_back(nameW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t count = ::SendMessage(hCombo, CB_GETCOUNT, 0, 0);
|
size_t count = ::SendMessage(hCombo, CB_GETCOUNT, 0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user