Several enhancements for code - part II
parent
b78b3bdef0
commit
bf72b5ec4a
|
@ -4237,7 +4237,7 @@ size_t Notepad_plus::getCurrentDocCharCount(UniMode u)
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
|
|
||||||
size_t endpos = _pEditView->execute(SCI_GETLENGTH);
|
size_t endpos = _pEditView->execute(SCI_GETLENGTH);
|
||||||
unsigned char* buf = (unsigned char*)_pEditView->execute(SCI_GETCHARACTERPOINTER); // Scintilla doc said the pointer can be invalidated by any other "execute"
|
const unsigned char* buf = (unsigned char*)_pEditView->execute(SCI_GETCHARACTERPOINTER); // Scintilla doc said the pointer can be invalidated by any other "execute"
|
||||||
|
|
||||||
#ifdef _OPENMP // parallel counting of characters with OpenMP
|
#ifdef _OPENMP // parallel counting of characters with OpenMP
|
||||||
if (endpos > 50000) // starting threads takes time; for small files it is better to simply count in one thread
|
if (endpos > 50000) // starting threads takes time; for small files it is better to simply count in one thread
|
||||||
|
@ -4825,25 +4825,25 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
|
||||||
|
|
||||||
wchar_t nppName[MAX_PATH];
|
wchar_t nppName[MAX_PATH];
|
||||||
::GetModuleFileName(NULL, nppName, MAX_PATH);
|
::GetModuleFileName(NULL, nppName, MAX_PATH);
|
||||||
wstring command = L"\"";
|
wstring cmdLine = L"\"";
|
||||||
command += nppName;
|
cmdLine += nppName;
|
||||||
command += L"\"";
|
cmdLine += L"\"";
|
||||||
command += L" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession";
|
cmdLine += L" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession";
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
wchar_t pX[10]{};
|
wchar_t pX[10]{};
|
||||||
_itow(x, pX, 10);
|
_itow(x, pX, 10);
|
||||||
command += L" -x";
|
cmdLine += L" -x";
|
||||||
command += pX;
|
cmdLine += pX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y)
|
if (y)
|
||||||
{
|
{
|
||||||
wchar_t pY[10]{};
|
wchar_t pY[10]{};
|
||||||
_itow(y, pY, 10);
|
_itow(y, pY, 10);
|
||||||
command += L" -y";
|
cmdLine += L" -y";
|
||||||
command += pY;
|
cmdLine += pY;
|
||||||
}
|
}
|
||||||
|
|
||||||
LangType lt = buf->getLangType();
|
LangType lt = buf->getLangType();
|
||||||
|
@ -4855,15 +4855,15 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
|
||||||
// user applies Markdown to a file named "myMarkdown.abc".
|
// user applies Markdown to a file named "myMarkdown.abc".
|
||||||
if (lt != L_USER)
|
if (lt != L_USER)
|
||||||
{
|
{
|
||||||
command += L" -l";
|
cmdLine += L" -l";
|
||||||
command += ScintillaEditView::_langNameInfoArray[lt]._langName;
|
cmdLine += ScintillaEditView::_langNameInfoArray[lt]._langName;
|
||||||
}
|
}
|
||||||
command += L" -n";
|
cmdLine += L" -n";
|
||||||
command += to_wstring(_pEditView->getCurrentLineNumber() + 1);
|
cmdLine += to_wstring(_pEditView->getCurrentLineNumber() + 1);
|
||||||
command += L" -c";
|
cmdLine += L" -c";
|
||||||
command += to_wstring(_pEditView->getCurrentColumnNumber() + 1);
|
cmdLine += to_wstring(_pEditView->getCurrentColumnNumber() + 1);
|
||||||
|
|
||||||
Command cmd(command);
|
Command cmd(cmdLine);
|
||||||
cmd.run(_pPublicInterface->getHSelf());
|
cmd.run(_pPublicInterface->getHSelf());
|
||||||
if (mode == TransferMove)
|
if (mode == TransferMove)
|
||||||
{
|
{
|
||||||
|
@ -9121,7 +9121,7 @@ BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, std::vector<int> cmdIDs)
|
BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector<int>& cmdIDs)
|
||||||
{
|
{
|
||||||
if (cmdIDs.empty())
|
if (cmdIDs.empty())
|
||||||
return notifyTBShowMenu(lpnmtb, menuPosId);
|
return notifyTBShowMenu(lpnmtb, menuPosId);
|
||||||
|
|
|
@ -657,5 +657,5 @@ private:
|
||||||
|
|
||||||
HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector<int>& commandIds);
|
HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector<int>& commandIds);
|
||||||
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId);
|
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId);
|
||||||
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, std::vector<int> cmdIDs);
|
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector<int>& cmdIDs);
|
||||||
};
|
};
|
||||||
|
|
|
@ -464,7 +464,7 @@ namespace NppDarkMode
|
||||||
|
|
||||||
void initAdvancedOptions()
|
void initAdvancedOptions()
|
||||||
{
|
{
|
||||||
NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
||||||
g_advOptions = nppGui._darkmode._advOptions;
|
g_advOptions = nppGui._darkmode._advOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2324,7 +2324,7 @@ namespace NppDarkMode
|
||||||
::EnableThemeDialogTexture(hwndParent, theme && !NppDarkMode::isEnabled() ? ETDT_ENABLETAB : ETDT_DISABLE);
|
::EnableThemeDialogTexture(hwndParent, theme && !NppDarkMode::isEnabled() ? ETDT_ENABLETAB : ETDT_DISABLE);
|
||||||
|
|
||||||
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA {
|
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA {
|
||||||
auto& p = *reinterpret_cast<NppDarkModeParams*>(lParam);
|
const auto& p = *reinterpret_cast<NppDarkModeParams*>(lParam);
|
||||||
constexpr size_t classNameLen = 32;
|
constexpr size_t classNameLen = 32;
|
||||||
wchar_t className[classNameLen]{};
|
wchar_t className[classNameLen]{};
|
||||||
GetClassName(hwnd, className, classNameLen);
|
GetClassName(hwnd, className, classNameLen);
|
||||||
|
|
|
@ -2195,8 +2195,6 @@ int NppParameters::getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const
|
||||||
|
|
||||||
bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu, bool isEditCM)
|
bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu, bool isEditCM)
|
||||||
{
|
{
|
||||||
std::vector<MenuItemUnit>& contextMenuItems = isEditCM ? _contextMenuItems : _tabContextMenuItems;
|
|
||||||
|
|
||||||
TiXmlDocumentA* pXmlContextMenuDocA = isEditCM ? _pXmlContextMenuDocA : _pXmlTabContextMenuDocA;
|
TiXmlDocumentA* pXmlContextMenuDocA = isEditCM ? _pXmlContextMenuDocA : _pXmlTabContextMenuDocA;
|
||||||
std::string cmName = isEditCM ? "ScintillaContextMenu" : "TabContextMenu";
|
std::string cmName = isEditCM ? "ScintillaContextMenu" : "TabContextMenu";
|
||||||
|
|
||||||
|
@ -2212,6 +2210,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
|
||||||
TiXmlNodeA *contextMenuRoot = root->FirstChildElement(cmName.c_str());
|
TiXmlNodeA *contextMenuRoot = root->FirstChildElement(cmName.c_str());
|
||||||
if (contextMenuRoot)
|
if (contextMenuRoot)
|
||||||
{
|
{
|
||||||
|
std::vector<MenuItemUnit>& contextMenuItems = isEditCM ? _contextMenuItems : _tabContextMenuItems;
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = contextMenuRoot->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = contextMenuRoot->FirstChildElement("Item");
|
||||||
childNode ;
|
childNode ;
|
||||||
childNode = childNode->NextSibling("Item") )
|
childNode = childNode->NextSibling("Item") )
|
||||||
|
@ -6192,10 +6192,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||||
}
|
}
|
||||||
else if (!lstrcmp(nm, L"commandLineInterpreter"))
|
else if (!lstrcmp(nm, L"commandLineInterpreter"))
|
||||||
{
|
{
|
||||||
TiXmlNode *node = childNode->FirstChild();
|
TiXmlNode *cmdLineInterpreterNode = childNode->FirstChild();
|
||||||
if (node)
|
if (cmdLineInterpreterNode)
|
||||||
{
|
{
|
||||||
const wchar_t *cli = node->Value();
|
const wchar_t *cli = cmdLineInterpreterNode->Value();
|
||||||
if (cli && cli[0])
|
if (cli && cli[0])
|
||||||
_nppGUI._commandLineInterpreter.assign(cli);
|
_nppGUI._commandLineInterpreter.assign(cli);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,21 +239,21 @@ public:
|
||||||
const wchar_t * getUserDefineLangName() const { return _userLangExt.c_str(); }
|
const wchar_t * getUserDefineLangName() const { return _userLangExt.c_str(); }
|
||||||
|
|
||||||
const wchar_t * getCommentLineSymbol() const {
|
const wchar_t * getCommentLineSymbol() const {
|
||||||
Lang *l = getCurrentLang();
|
const Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
return l->_pCommentLineSymbol;
|
return l->_pCommentLineSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t * getCommentStart() const {
|
const wchar_t * getCommentStart() const {
|
||||||
Lang *l = getCurrentLang();
|
const Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
return l->_pCommentStart;
|
return l->_pCommentStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t * getCommentEnd() const {
|
const wchar_t * getCommentEnd() const {
|
||||||
Lang *l = getCurrentLang();
|
const Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
return l->_pCommentEnd;
|
return l->_pCommentEnd;
|
||||||
|
|
|
@ -129,7 +129,7 @@ BufferID DocTabView::findBufferByName(const wchar_t * fullfilename) //-1 if not
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
|
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
|
||||||
BufferID id = reinterpret_cast<BufferID>(tie.lParam);
|
BufferID id = reinterpret_cast<BufferID>(tie.lParam);
|
||||||
Buffer * buf = MainFileManager.getBufferByID(id);
|
const Buffer* buf = MainFileManager.getBufferByID(id);
|
||||||
if (wcsicmp(fullfilename, buf->getFullPathName()) == 0)
|
if (wcsicmp(fullfilename, buf->getFullPathName()) == 0)
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -1785,7 +1785,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
||||||
RECT rcStatusBar{};
|
RECT rcStatusBar{};
|
||||||
::GetWindowRect(_statusBar.getHSelf(), &rcStatusBar);
|
::GetWindowRect(_statusBar.getHSelf(), &rcStatusBar);
|
||||||
|
|
||||||
const LONG padding = _dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER);
|
LONG padding = _dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER);
|
||||||
_szBorder.cx = ((_dpiManager.getSystemMetricsForDpi(SM_CXFRAME) + padding) * 2);
|
_szBorder.cx = ((_dpiManager.getSystemMetricsForDpi(SM_CXFRAME) + padding) * 2);
|
||||||
_szBorder.cy = ((_dpiManager.getSystemMetricsForDpi(SM_CYFRAME) + padding) * 2
|
_szBorder.cy = ((_dpiManager.getSystemMetricsForDpi(SM_CYFRAME) + padding) * 2
|
||||||
+ _dpiManager.getSystemMetricsForDpi(SM_CYCAPTION)
|
+ _dpiManager.getSystemMetricsForDpi(SM_CYCAPTION)
|
||||||
|
@ -1793,7 +1793,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
||||||
|
|
||||||
if (prevDpi > _dpiManager.getDpi())
|
if (prevDpi > _dpiManager.getDpi())
|
||||||
{
|
{
|
||||||
const auto padding = static_cast<LONG>(_dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER));
|
padding = static_cast<LONG>(_dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER));
|
||||||
_szBorder.cx += padding;
|
_szBorder.cx += padding;
|
||||||
_szBorder.cy += padding;
|
_szBorder.cy += padding;
|
||||||
}
|
}
|
||||||
|
@ -3567,7 +3567,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
|
||||||
_pFinder->_scintView.execute(SCI_SETUSETABS, true);
|
_pFinder->_scintView.execute(SCI_SETUSETABS, true);
|
||||||
_pFinder->_scintView.execute(SCI_SETTABWIDTH, 4);
|
_pFinder->_scintView.execute(SCI_SETTABWIDTH, 4);
|
||||||
|
|
||||||
NppGUI& nppGUI = nppParam.getNppGUI();
|
const NppGUI& nppGUI = nppParam.getNppGUI();
|
||||||
_pFinder->_longLinesAreWrapped = nppGUI._finderLinesAreCurrentlyWrapped;
|
_pFinder->_longLinesAreWrapped = nppGUI._finderLinesAreCurrentlyWrapped;
|
||||||
_pFinder->_scintView.wrap(_pFinder->_longLinesAreWrapped);
|
_pFinder->_scintView.wrap(_pFinder->_longLinesAreWrapped);
|
||||||
_pFinder->_scintView.setWrapMode(LINEWRAP_INDENT);
|
_pFinder->_scintView.setWrapMode(LINEWRAP_INDENT);
|
||||||
|
@ -4063,7 +4063,7 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType)
|
||||||
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
|
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, wstring tooltipMsg)
|
void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, const wstring& tooltipMsg)
|
||||||
{
|
{
|
||||||
if (_statusbarTooltipWnd)
|
if (_statusbarTooltipWnd)
|
||||||
{
|
{
|
||||||
|
@ -5037,7 +5037,7 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindReplaceDlg::replaceInFilesConfirmCheck(wstring directory, wstring fileTypes)
|
bool FindReplaceDlg::replaceInFilesConfirmCheck(const wstring& directory, const wstring& fileTypes)
|
||||||
{
|
{
|
||||||
bool confirmed = false;
|
bool confirmed = false;
|
||||||
|
|
||||||
|
@ -5573,7 +5573,7 @@ void Finder::setFinderStyle()
|
||||||
_scintView.execute(SCI_COLOURISE, 0, -1);
|
_scintView.execute(SCI_COLOURISE, 0, -1);
|
||||||
|
|
||||||
// finder fold style follows user preference but use box when user selects none
|
// finder fold style follows user preference but use box when user selects none
|
||||||
ScintillaViewParams& svp = (ScintillaViewParams&)NppParameters::getInstance().getSVP();
|
const ScintillaViewParams& svp = (ScintillaViewParams&)NppParameters::getInstance().getSVP();
|
||||||
_scintView.setMakerStyle(svp._folderStyle == FOLDER_STYLE_NONE ? FOLDER_STYLE_BOX : svp._folderStyle);
|
_scintView.setMakerStyle(svp._folderStyle == FOLDER_STYLE_NONE ? FOLDER_STYLE_BOX : svp._folderStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6499,7 +6499,7 @@ LRESULT APIENTRY Progress::wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM l
|
||||||
|
|
||||||
case WM_GETDPISCALEDSIZE:
|
case WM_GETDPISCALEDSIZE:
|
||||||
{
|
{
|
||||||
auto pw = reinterpret_cast<Progress*>(static_cast<LONG_PTR>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)));
|
const auto pw = reinterpret_cast<Progress*>(static_cast<LONG_PTR>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)));
|
||||||
|
|
||||||
const UINT newDpi = static_cast<UINT>(wparam);
|
const UINT newDpi = static_cast<UINT>(wparam);
|
||||||
RECT rcWindow = pw->getDpiScaledWindowRect(newDpi);
|
RECT rcWindow = pw->getDpiScaledWindowRect(newDpi);
|
||||||
|
|
|
@ -391,7 +391,7 @@ public :
|
||||||
|
|
||||||
void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue);
|
void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue);
|
||||||
void clearMarks(const FindOption& opt);
|
void clearMarks(const FindOption& opt);
|
||||||
void setStatusbarMessage(const std::wstring & msg, FindStatus staus, std::wstring tooltipMsg = L"");
|
void setStatusbarMessage(const std::wstring & msg, FindStatus staus, const std::wstring& tooltipMsg = L"");
|
||||||
void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView);
|
void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView);
|
||||||
std::wstring getScopeInfoForStatusBar(FindOption const *pFindOpt) const;
|
std::wstring getScopeInfoForStatusBar(FindOption const *pFindOpt) const;
|
||||||
Finder * createFinder();
|
Finder * createFinder();
|
||||||
|
@ -500,7 +500,7 @@ private:
|
||||||
static const int FR_OP_FIP = 16;
|
static const int FR_OP_FIP = 16;
|
||||||
void saveInMacro(size_t cmd, int cmdType);
|
void saveInMacro(size_t cmd, int cmdType);
|
||||||
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
bool replaceInFilesConfirmCheck(std::wstring directory, std::wstring fileTypes);
|
bool replaceInFilesConfirmCheck(const std::wstring& directory, const std::wstring& fileTypes);
|
||||||
bool replaceInProjectsConfirmCheck();
|
bool replaceInProjectsConfirmCheck();
|
||||||
bool replaceInOpenDocsConfirmCheck(void);
|
bool replaceInOpenDocsConfirmCheck(void);
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ bool FunctionCallTip::getCursorFunction()
|
||||||
int scopeLevel = 0;
|
int scopeLevel = 0;
|
||||||
for (size_t i = 0; i < vsize; ++i)
|
for (size_t i = 0; i < vsize; ++i)
|
||||||
{
|
{
|
||||||
Token & curToken = tokenVector.at(i);
|
const Token & curToken = tokenVector.at(i);
|
||||||
if (curToken.isIdentifier)
|
if (curToken.isIdentifier)
|
||||||
{
|
{
|
||||||
curValue.lastIdentifier = static_cast<int32_t>(i);
|
curValue.lastIdentifier = static_cast<int32_t>(i);
|
||||||
|
|
|
@ -368,7 +368,7 @@ LRESULT CALLBACK ScintillaEditView::scintillaStatic_Proc(HWND hwnd, UINT Message
|
||||||
if (pScint && (isSynpnatic || makeTouchPadCompetible))
|
if (pScint && (isSynpnatic || makeTouchPadCompetible))
|
||||||
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
||||||
|
|
||||||
ScintillaEditView *pScintillaOnMouse = (ScintillaEditView *)(::GetWindowLongPtr(hwndOnMouse, GWLP_USERDATA));
|
const ScintillaEditView* pScintillaOnMouse = reinterpret_cast<const ScintillaEditView *>(::GetWindowLongPtr(hwndOnMouse, GWLP_USERDATA));
|
||||||
if (pScintillaOnMouse != pScint)
|
if (pScintillaOnMouse != pScint)
|
||||||
return ::SendMessage(hwndOnMouse, Message, wParam, lParam);
|
return ::SendMessage(hwndOnMouse, Message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
@ -1804,12 +1804,12 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||||
|
|
||||||
if (pStyler)
|
if (pStyler)
|
||||||
{
|
{
|
||||||
const Style * pStyle = pStyler->findByName(L"DEFAULT");
|
const Style * pDefStyle = pStyler->findByName(L"DEFAULT");
|
||||||
if (pStyle)
|
if (pDefStyle)
|
||||||
{
|
{
|
||||||
nfoStyle._bgColor = pStyle->_bgColor;
|
nfoStyle._bgColor = pDefStyle->_bgColor;
|
||||||
nfoStyle._fgColor = pStyle->_fgColor;
|
nfoStyle._fgColor = pDefStyle->_fgColor;
|
||||||
nfoStyle._colorStyle = pStyle->_colorStyle;
|
nfoStyle._colorStyle = pDefStyle->_colorStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSpecialStyle(nfoStyle);
|
setSpecialStyle(nfoStyle);
|
||||||
|
@ -2113,7 +2113,7 @@ void ScintillaEditView::saveCurrentPos()
|
||||||
void ScintillaEditView::restoreCurrentPosPreStep()
|
void ScintillaEditView::restoreCurrentPosPreStep()
|
||||||
{
|
{
|
||||||
Buffer * buf = MainFileManager.getBufferByID(_currentBufferID);
|
Buffer * buf = MainFileManager.getBufferByID(_currentBufferID);
|
||||||
Position & pos = buf->getPosition(this);
|
const Position & pos = buf->getPosition(this);
|
||||||
|
|
||||||
execute(SCI_SETSELECTIONMODE, pos._selMode); //enable
|
execute(SCI_SETSELECTIONMODE, pos._selMode); //enable
|
||||||
execute(SCI_SETANCHOR, pos._startPos);
|
execute(SCI_SETANCHOR, pos._startPos);
|
||||||
|
@ -2145,7 +2145,7 @@ void ScintillaEditView::restoreCurrentPosPostStep()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Buffer * buf = MainFileManager.getBufferByID(_currentBufferID);
|
Buffer * buf = MainFileManager.getBufferByID(_currentBufferID);
|
||||||
Position & pos = buf->getPosition(this);
|
const Position & pos = buf->getPosition(this);
|
||||||
|
|
||||||
++_restorePositionRetryCount;
|
++_restorePositionRetryCount;
|
||||||
|
|
||||||
|
@ -3145,7 +3145,7 @@ void ScintillaEditView::performGlobalStyles()
|
||||||
|
|
||||||
void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult)
|
void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult)
|
||||||
{
|
{
|
||||||
auto& svp = NppParameters::getInstance().getSVP();
|
const auto& svp = NppParameters::getInstance().getSVP();
|
||||||
|
|
||||||
if (willBeShowed)
|
if (willBeShowed)
|
||||||
{
|
{
|
||||||
|
@ -3180,7 +3180,7 @@ void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult)
|
||||||
|
|
||||||
void ScintillaEditView::showCcUniEol(bool willBeShowed, bool isSearchResult)
|
void ScintillaEditView::showCcUniEol(bool willBeShowed, bool isSearchResult)
|
||||||
{
|
{
|
||||||
auto& svp = NppParameters::getInstance().getSVP();
|
const auto& svp = NppParameters::getInstance().getSVP();
|
||||||
|
|
||||||
if (willBeShowed)
|
if (willBeShowed)
|
||||||
{
|
{
|
||||||
|
@ -4404,7 +4404,7 @@ pair<size_t, size_t> ScintillaEditView::getSelectedCharsAndLinesCount(long long
|
||||||
}
|
}
|
||||||
sort(v.begin(), v.end());
|
sort(v.begin(), v.end());
|
||||||
intptr_t previousSecondLine = -1;
|
intptr_t previousSecondLine = -1;
|
||||||
for (auto& lineRange : v)
|
for (const auto& lineRange : v)
|
||||||
{
|
{
|
||||||
selectedCharsAndLines.second += lineRange.second - lineRange.first;
|
selectedCharsAndLines.second += lineRange.second - lineRange.first;
|
||||||
if (lineRange.first != static_cast<size_t>(previousSecondLine))
|
if (lineRange.first != static_cast<size_t>(previousSecondLine))
|
||||||
|
@ -4504,7 +4504,7 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
|
||||||
L"\r\n----\r\n" : L"\r\n";
|
L"\r\n----\r\n" : L"\r\n";
|
||||||
|
|
||||||
wstring joined;
|
wstring joined;
|
||||||
for (auto& item : styledVect)
|
for (const auto& item : styledVect)
|
||||||
{
|
{
|
||||||
joined += delim + item.second;
|
joined += delim + item.second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,7 +371,7 @@ struct ColumnModeInfo {
|
||||||
// SortClass for vector<ColumnModeInfo>
|
// SortClass for vector<ColumnModeInfo>
|
||||||
// sort in _order : increased order
|
// sort in _order : increased order
|
||||||
struct SortInSelectOrder {
|
struct SortInSelectOrder {
|
||||||
bool operator() (ColumnModeInfo & l, ColumnModeInfo & r) {
|
bool operator() (const ColumnModeInfo & l, const ColumnModeInfo & r) {
|
||||||
return (l._order < r._order);
|
return (l._order < r._order);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -380,7 +380,7 @@ struct SortInSelectOrder {
|
||||||
// SortClass for vector<ColumnModeInfo>
|
// SortClass for vector<ColumnModeInfo>
|
||||||
// sort in _selLpos : increased order
|
// sort in _selLpos : increased order
|
||||||
struct SortInPositionOrder {
|
struct SortInPositionOrder {
|
||||||
bool operator() (ColumnModeInfo & l, ColumnModeInfo & r) {
|
bool operator() (const ColumnModeInfo & l, const ColumnModeInfo & r) {
|
||||||
return (l._selLpos < r._selLpos);
|
return (l._selLpos < r._selLpos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -586,7 +586,7 @@ public:
|
||||||
void showNpc(bool willBeShowed = true, bool isSearchResult = false);
|
void showNpc(bool willBeShowed = true, bool isSearchResult = false);
|
||||||
|
|
||||||
bool isShownNpc() {
|
bool isShownNpc() {
|
||||||
auto& svp = NppParameters::getInstance().getSVP();
|
const auto& svp = NppParameters::getInstance().getSVP();
|
||||||
return svp._npcShow;
|
return svp._npcShow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ public:
|
||||||
void showCcUniEol(bool willBeShowed = true, bool isSearchResult = false);
|
void showCcUniEol(bool willBeShowed = true, bool isSearchResult = false);
|
||||||
|
|
||||||
bool isShownCcUniEol() {
|
bool isShownCcUniEol() {
|
||||||
auto& svp = NppParameters::getInstance().getSVP();
|
const auto& svp = NppParameters::getInstance().getSVP();
|
||||||
return svp._ccUniEolShow;
|
return svp._ccUniEolShow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView,
|
||||||
{
|
{
|
||||||
// fetch find dialog's setting
|
// fetch find dialog's setting
|
||||||
NppParameters& nppParams = NppParameters::getInstance();
|
NppParameters& nppParams = NppParameters::getInstance();
|
||||||
FindHistory &findHistory = nppParams.getFindHistory();
|
const FindHistory &findHistory = nppParams.getFindHistory();
|
||||||
isWordOnly = findHistory._isMatchWord;
|
isWordOnly = findHistory._isMatchWord;
|
||||||
isCaseSensentive = findHistory._isMatchCase;
|
isCaseSensentive = findHistory._isMatchCase;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
|
||||||
{
|
{
|
||||||
// fetch find dialog's setting
|
// fetch find dialog's setting
|
||||||
NppParameters& nppParams = NppParameters::getInstance();
|
NppParameters& nppParams = NppParameters::getInstance();
|
||||||
FindHistory &findHistory = nppParams.getFindHistory();
|
const FindHistory &findHistory = nppParams.getFindHistory();
|
||||||
isWordOnly = findHistory._isMatchWord;
|
isWordOnly = findHistory._isMatchWord;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1132,7 +1132,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
NMHDR *nmhdr = (NMHDR *)lParam;
|
const NMHDR *nmhdr = reinterpret_cast<const NMHDR *>(lParam);
|
||||||
if (nmhdr->code == TCN_SELCHANGE)
|
if (nmhdr->code == TCN_SELCHANGE)
|
||||||
{
|
{
|
||||||
if (nmhdr->hwndFrom == _ctrlTab.getHSelf())
|
if (nmhdr->hwndFrom == _ctrlTab.getHSelf())
|
||||||
|
|
|
@ -49,7 +49,7 @@ ClipboardDataInfo ClipboardHistoryPanel::getClipboadData()
|
||||||
unsigned char* pData_bin = static_cast<unsigned char*>(GlobalLock(hglb_binText));
|
unsigned char* pData_bin = static_cast<unsigned char*>(GlobalLock(hglb_binText));
|
||||||
if (pData_bin != NULL)
|
if (pData_bin != NULL)
|
||||||
{
|
{
|
||||||
unsigned long* lpLen = (unsigned long*)GlobalLock(hglbLen);
|
const unsigned long* lpLen = (unsigned long*)GlobalLock(hglbLen);
|
||||||
if (lpLen != NULL) // Special copy-paste: Binary data
|
if (lpLen != NULL) // Special copy-paste: Binary data
|
||||||
{
|
{
|
||||||
size_t nbBytes = (*lpLen);
|
size_t nbBytes = (*lpLen);
|
||||||
|
|
|
@ -1183,10 +1183,10 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
|
|
||||||
//-- font size
|
//-- font size
|
||||||
constexpr size_t intStrLen = 3;
|
constexpr size_t intStrLen = 3;
|
||||||
wchar_t intStr[intStrLen]{};
|
|
||||||
LRESULT iFontSize = 0;
|
LRESULT iFontSize = 0;
|
||||||
if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits
|
if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits
|
||||||
{
|
{
|
||||||
|
wchar_t intStr[intStrLen]{};
|
||||||
wsprintf(intStr, L"%d", style._fontSize);
|
wsprintf(intStr, L"%d", style._fontSize);
|
||||||
iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(intStr));
|
iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(intStr));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
FileInfo() = delete; // constructor by default is forbidden
|
FileInfo() = delete; // constructor by default is forbidden
|
||||||
FileInfo(const std::wstring & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
FileInfo(const std::wstring & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
||||||
std::wstring getName() const { return _name; };
|
std::wstring getName() const { return _name; };
|
||||||
void setName(std::wstring name) { _name = name; };
|
void setName(const std::wstring& name) { _name = name; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::wstring _name;
|
std::wstring _name;
|
||||||
|
|
|
@ -202,7 +202,7 @@ void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const wchar_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeParams* FunctionListPanel::getFromStateArray(wstring fullFilePath)
|
TreeParams* FunctionListPanel::getFromStateArray(const wstring& fullFilePath)
|
||||||
{
|
{
|
||||||
for (size_t i = 0, len = _treeParams.size(); i < len; ++i)
|
for (size_t i = 0, len = _treeParams.size(); i < len; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,7 +139,7 @@ private:
|
||||||
size_t getBodyClosePos(size_t begin, const wchar_t *bodyOpenSymbol, const wchar_t *bodyCloseSymbol);
|
size_t getBodyClosePos(size_t begin, const wchar_t *bodyOpenSymbol, const wchar_t *bodyCloseSymbol);
|
||||||
void notified(LPNMHDR notification);
|
void notified(LPNMHDR notification);
|
||||||
void addInStateArray(TreeStateNode tree2Update, const wchar_t *searchText, bool isSorted);
|
void addInStateArray(TreeStateNode tree2Update, const wchar_t *searchText, bool isSorted);
|
||||||
TreeParams* getFromStateArray(std::wstring fullFilePath);
|
TreeParams* getFromStateArray(const std::wstring& fullFilePath);
|
||||||
bool openSelection(const TreeView &treeView);
|
bool openSelection(const TreeView &treeView);
|
||||||
bool shouldSort();
|
bool shouldSort();
|
||||||
void setSort(bool isEnabled);
|
void setSort(bool isEnabled);
|
||||||
|
|
|
@ -221,9 +221,9 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const wstring & xmlDirPath,
|
||||||
std::vector<wstring> classNameExprArray2;
|
std::vector<wstring> classNameExprArray2;
|
||||||
std::vector<wstring> functionNameExprArray2;
|
std::vector<wstring> functionNameExprArray2;
|
||||||
getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2);
|
getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2);
|
||||||
FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2);
|
FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2, functionNameExprArray2, classNameExprArray2);
|
||||||
|
|
||||||
_parsers[index]->_parser = new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray, funcUnitPaser);
|
_parsers[index]->_parser = new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray, funcUnitPaser);
|
||||||
}
|
}
|
||||||
else if (classRangeParser)
|
else if (classRangeParser)
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,7 +234,7 @@ int GetColOfMouse(int SI, int x)
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL OutOfRange(BGCELL* cell)
|
BOOL OutOfRange(const BGCELL* cell)
|
||||||
{
|
{
|
||||||
if ((cell->row > MAX_ROWS) || (cell->col > MAX_COLS))
|
if ((cell->row > MAX_ROWS) || (cell->col > MAX_COLS))
|
||||||
{
|
{
|
||||||
|
@ -472,8 +472,8 @@ void DisplayColumn(HWND hWnd, int SI, int c, int offset, HFONT hfont, HFONT hcol
|
||||||
rect.bottom = rect.top + BGHS[SI].rowheight;
|
rect.bottom = rect.top + BGHS[SI].rowheight;
|
||||||
rectsave = rect;
|
rectsave = rect;
|
||||||
|
|
||||||
BGCELL BGcell;
|
BGCELL BGcell2;
|
||||||
SetCell(&BGcell, r, c);
|
SetCell(&BGcell2, r, c);
|
||||||
wcscpy_s(buffer, L"");
|
wcscpy_s(buffer, L"");
|
||||||
int iProperty = 0;
|
int iProperty = 0;
|
||||||
if ((c == 0) && (BGHS[SI].ROWSNUMBERED))
|
if ((c == 0) && (BGHS[SI].ROWSNUMBERED))
|
||||||
|
@ -485,7 +485,7 @@ void DisplayColumn(HWND hWnd, int SI, int c, int offset, HFONT hfont, HFONT hcol
|
||||||
{
|
{
|
||||||
// iProperty will combine (iDataType << 4) and (iProtection & 0xf),
|
// iProperty will combine (iDataType << 4) and (iProtection & 0xf),
|
||||||
// this will reduce some unnecessary and 'heavy' message calls for getting iDataType and iProtection separately
|
// this will reduce some unnecessary and 'heavy' message calls for getting iDataType and iProtection separately
|
||||||
iProperty = static_cast<int32_t>(SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast<WPARAM>(&BGcell), reinterpret_cast<LPARAM>(buffer)));
|
iProperty = static_cast<int32_t>(SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast<WPARAM>(&BGcell2), reinterpret_cast<LPARAM>(buffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
|
|
|
@ -501,7 +501,7 @@ std::pair<Version, Version> getIntervalVersions(wstring intervalVerStr)
|
||||||
// "[4.2,6.6.6][6.4,8.9]" : The 1st interval from version 4.2 to 6.6.6 inclusive, the 2nd interval from version 6.4 to 8.9
|
// "[4.2,6.6.6][6.4,8.9]" : The 1st interval from version 4.2 to 6.6.6 inclusive, the 2nd interval from version 6.4 to 8.9
|
||||||
// "[8.3,][6.9,6.9]" : The 1st interval any version from 8.3 to the latest version, the 2nd interval present only version 6.9
|
// "[8.3,][6.9,6.9]" : The 1st interval any version from 8.3 to the latest version, the 2nd interval present only version 6.9
|
||||||
// "[,8.2.1][4.4,]" : The 1st interval 8.2.1 and any previous version, , the 2nd interval any version from 4.4 to the latest version
|
// "[,8.2.1][4.4,]" : The 1st interval 8.2.1 and any previous version, , the 2nd interval any version from 4.4 to the latest version
|
||||||
std::pair<std::pair<Version, Version>, std::pair<Version, Version>> getTwoIntervalVersions(wstring twoIntervalVerStr)
|
std::pair<std::pair<Version, Version>, std::pair<Version, Version>> getTwoIntervalVersions(const wstring& twoIntervalVerStr)
|
||||||
{
|
{
|
||||||
std::pair<std::pair<Version, Version>, std::pair<Version, Version>> r;
|
std::pair<std::pair<Version, Version>, std::pair<Version, Version>> r;
|
||||||
wstring sep = L"][";
|
wstring sep = L"][";
|
||||||
|
@ -841,7 +841,7 @@ bool PluginsAdminDlg::loadFromPluginInfos()
|
||||||
// Search from unloaded incompatible plugins
|
// Search from unloaded incompatible plugins
|
||||||
for (size_t j = 0, nb = _incompatibleList.nbItem(); j < nb; j++)
|
for (size_t j = 0, nb = _incompatibleList.nbItem(); j < nb; j++)
|
||||||
{
|
{
|
||||||
PluginUpdateInfo* incompatiblePluginInfo = _incompatibleList.getPluginInfoFromUiIndex(j);
|
const PluginUpdateInfo* incompatiblePluginInfo = _incompatibleList.getPluginInfoFromUiIndex(j);
|
||||||
int listIndex;
|
int listIndex;
|
||||||
PluginUpdateInfo* foundInfoOfAvailable = _availableList.findPluginInfoFromFolderName(incompatiblePluginInfo->_folderName, listIndex);
|
PluginUpdateInfo* foundInfoOfAvailable = _availableList.findPluginInfoFromFolderName(incompatiblePluginInfo->_folderName, listIndex);
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ enum SORT_TYPE { DISPLAY_NAME_ALPHABET_ENCREASE, DISPLAY_NAME_ALPHABET_DECREASE
|
||||||
|
|
||||||
struct SortDisplayNameDecrease final
|
struct SortDisplayNameDecrease final
|
||||||
{
|
{
|
||||||
bool operator() (PluginUpdateInfo* l, PluginUpdateInfo* r)
|
bool operator() (const PluginUpdateInfo* l, const PluginUpdateInfo* r)
|
||||||
{
|
{
|
||||||
return (l->_displayName.compare(r->_displayName) <= 0);
|
return (l->_displayName.compare(r->_displayName) <= 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue