Enhance source code

This commit is contained in:
Don Ho 2024-04-08 01:15:41 +02:00
parent 8672d95ca4
commit e6558a3618
43 changed files with 200 additions and 256 deletions

View File

@ -80,8 +80,8 @@ struct TiXmlCursorA
TiXmlCursorA() { Clear(); } TiXmlCursorA() { Clear(); }
void Clear() { row = col = -1; } void Clear() { row = col = -1; }
int row; // 0 based. int row = -1; // 0 based.
int col; // 0 based. int col = -1; // 0 based.
}; };
@ -1115,10 +1115,10 @@ protected :
#endif #endif
private: private:
bool error; bool error = false;
int errorId; int errorId = 0;
TIXMLA_STRING errorDesc; TIXMLA_STRING errorDesc;
int tabsize; int tabsize = 4;
TiXmlCursorA errorLocation; TiXmlCursorA errorLocation;
}; };

View File

@ -1114,10 +1114,10 @@ protected :
#endif #endif
private: private:
bool error; bool error = false;
int errorId; int errorId = 0;
TIXML_STRING errorDesc; TIXML_STRING errorDesc;
int tabsize; int tabsize = 4;
TiXmlCursor errorLocation; TiXmlCursor errorLocation;
}; };

View File

@ -114,8 +114,10 @@ intptr_t CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
//HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_JESUISCHARLIE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE); //HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_JESUISCHARLIE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE);
//HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_GILETJAUNE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE); //HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_GILETJAUNE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE);
//HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_SAMESEXMARRIAGE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE); //HICON hIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_SAMESEXMARRIAGE), IMAGE_ICON, 64, 64, LR_DEFAULTSIZE);
auto pdis = reinterpret_cast<DRAWITEMSTRUCT*>(lParam); auto pdis = reinterpret_cast<DRAWITEMSTRUCT*>(lParam);
::DrawIconEx(pdis->hDC, 0, 0, _hIcon, iconSize, iconSize, 0, nullptr, DI_NORMAL); ::DrawIconEx(pdis->hDC, 0, 0, _hIcon, iconSize, iconSize, 0, nullptr, DI_NORMAL);
return TRUE; return TRUE;
} }
@ -332,7 +334,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
HMODULE hNtdllModule = GetModuleHandle(L"ntdll.dll"); HMODULE hNtdllModule = GetModuleHandle(L"ntdll.dll");
if (hNtdllModule) if (hNtdllModule)
{ {
pWGV = (PWINEGETVERSION)GetProcAddress(hNtdllModule, "wine_get_version"); pWGV = reinterpret_cast<PWINEGETVERSION>(GetProcAddress(hNtdllModule, "wine_get_version"));
} }
if (pWGV != nullptr) if (pWGV != nullptr)

View File

@ -82,7 +82,7 @@ ClipboardDataInfo ClipboardHistoryPanel::getClipboadData()
return clipboardData; return clipboardData;
} }
ByteArray::ByteArray(ClipboardDataInfo cd) ByteArray::ByteArray(const ClipboardDataInfo& cd)
{ {
_length = cd._data.size(); _length = cd._data.size();
if (!_length) if (!_length)
@ -97,7 +97,7 @@ ByteArray::ByteArray(ClipboardDataInfo cd)
} }
} }
StringArray::StringArray(ClipboardDataInfo cd, size_t maxLen) StringArray::StringArray(const ClipboardDataInfo& cd, size_t maxLen)
{ {
size_t len = cd._data.size(); size_t len = cd._data.size();
@ -132,7 +132,7 @@ StringArray::StringArray(ClipboardDataInfo cd, size_t maxLen)
// Search clipboard data in internal storage // Search clipboard data in internal storage
// return -1 if not found, else return the index of internal array // return -1 if not found, else return the index of internal array
int ClipboardHistoryPanel::getClipboardDataIndex(ClipboardDataInfo cbd) int ClipboardHistoryPanel::getClipboardDataIndex(const ClipboardDataInfo& cbd)
{ {
int iFound = -1; int iFound = -1;
bool found = false; bool found = false;

View File

@ -33,7 +33,7 @@ struct ClipboardDataInfo {
class ByteArray { class ByteArray {
public: public:
ByteArray() = default; ByteArray() = default;
explicit ByteArray(ClipboardDataInfo cd); explicit ByteArray(const ClipboardDataInfo& cd);
~ByteArray() { ~ByteArray() {
if (_pBytes) if (_pBytes)
@ -48,7 +48,7 @@ protected:
class StringArray : public ByteArray { class StringArray : public ByteArray {
public: public:
StringArray(ClipboardDataInfo cd, size_t maxLen); StringArray(const ClipboardDataInfo& cd, size_t maxLen);
}; };
class ClipboardHistoryPanel : public DockingDlgInterface { class ClipboardHistoryPanel : public DockingDlgInterface {
@ -66,7 +66,7 @@ public:
ClipboardDataInfo getClipboadData(); ClipboardDataInfo getClipboadData();
void addToClipboadHistory(ClipboardDataInfo cbd); void addToClipboadHistory(ClipboardDataInfo cbd);
int getClipboardDataIndex(ClipboardDataInfo cbd); int getClipboardDataIndex(const ClipboardDataInfo& cbd);
virtual void setBackgroundColor(COLORREF bgColour) { virtual void setBackgroundColor(COLORREF bgColour) {
_lbBgColor = bgColour; _lbBgColor = bgColour;

View File

@ -363,8 +363,8 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
{ {
if (_isDirty) if (_isDirty)
{ {
LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray(); const LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers(); const StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
_lsArray = lsa; _lsArray = lsa;
_globalStyles = globalStyles; _globalStyles = globalStyles;
@ -890,7 +890,7 @@ void WordStyleDlg::setStyleListFromLexer(int index)
::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_STATIC), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_STATIC), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL2_STATIC), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL2_STATIC), index?SW_SHOW:SW_HIDE);
StyleArray & lexerStyler = index?_lsArray.getLexerFromIndex(index-1):_globalStyles; StyleArray & lexerStyler = index ? _lsArray.getLexerFromIndex(index-1) : _globalStyles;
for (const Style & style : lexerStyler) for (const Style & style : lexerStyler)
{ {
@ -931,7 +931,7 @@ std::pair<intptr_t, intptr_t> WordStyleDlg::goToPreferencesSettings()
misc misc
}; };
Style& style = getCurrentStyler(); const Style& style = getCurrentStyler();
// Global override style // Global override style
if (style._styleDesc == TEXT("Current line background colour")) if (style._styleDesc == TEXT("Current line background colour"))

View File

@ -92,7 +92,7 @@ void ContextMenu::create(HWND hParent, const std::vector<MenuItemUnit> & menuIte
::InsertMenu(_hMenu, static_cast<UINT>(i), flag, item._cmdID, item._itemName.c_str()); ::InsertMenu(_hMenu, static_cast<UINT>(i), flag, item._cmdID, item._itemName.c_str());
lastIsSep = false; lastIsSep = false;
} }
else if (item._cmdID == 0 && !lastIsSep) else if (/*item._cmdID == 0 &&*/ !lastIsSep)
{ {
::InsertMenu(_hMenu, static_cast<int32_t>(i), flag, item._cmdID, item._itemName.c_str()); ::InsertMenu(_hMenu, static_cast<int32_t>(i), flag, item._cmdID, item._itemName.c_str());
lastIsSep = true; lastIsSep = true;

View File

@ -58,24 +58,6 @@ static LRESULT CALLBACK hookProcMouse(int nCode, WPARAM wParam, LPARAM lParam)
DockingCont::DockingCont() DockingCont::DockingCont()
{ {
_isMouseOver = FALSE;
_isMouseClose = FALSE;
_isMouseDown = FALSE;
_isFloating = false;
_isTopCaption = CAPTION_TOP;
_dragFromTab = FALSE;
_hContTab = NULL;
_hDefaultTabProc = NULL;
_beginDrag = FALSE;
_prevItem = 0;
_hFont = NULL;
_bTabTTHover = FALSE;
_bCaptionTT = FALSE;
_bCapTTHover = FALSE;
_hoverMPos = posClose;
_bDrawOgLine = TRUE;
_vTbData.clear();
_captionHeightDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionHeightDynamic); _captionHeightDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionHeightDynamic);
_captionGapDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionGapDynamic); _captionGapDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionGapDynamic);
_closeButtonPosLeftDynamic = NppParameters::getInstance()._dpiManager.scaleX(_closeButtonPosLeftDynamic); _closeButtonPosLeftDynamic = NppParameters::getInstance()._dpiManager.scaleX(_closeButtonPosLeftDynamic);
@ -135,7 +117,7 @@ void DockingCont::doDialog(bool willBeShown, bool isFloating)
} }
tTbData* DockingCont::createToolbar(tTbData data) tTbData* DockingCont::createToolbar(const tTbData& data)
{ {
tTbData *pTbData = new tTbData; tTbData *pTbData = new tTbData;
@ -164,13 +146,13 @@ tTbData* DockingCont::createToolbar(tTbData data)
} }
void DockingCont::removeToolbar(tTbData TbData) void DockingCont::removeToolbar(const tTbData& data)
{ {
// remove from list // remove from list
// items in _vTbData are removed in the loop so _vTbData.size() should be checked in every iteration // items in _vTbData are removed in the loop so _vTbData.size() should be checked in every iteration
for (size_t iTb = 0 ; iTb < _vTbData.size(); ++iTb) for (size_t iTb = 0 ; iTb < _vTbData.size(); ++iTb)
{ {
if (_vTbData[iTb]->hClient == TbData.hClient) if (_vTbData[iTb]->hClient == data.hClient)
{ {
// remove tab // remove tab
removeTab(_vTbData[iTb]); removeTab(_vTbData[iTb]);
@ -240,7 +222,7 @@ tTbData* DockingCont::getDataOfActiveTb()
if (iItem != -1) if (iItem != -1)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem)); ::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
@ -253,7 +235,7 @@ tTbData* DockingCont::getDataOfActiveTb()
vector<tTbData*> DockingCont::getDataOfVisTb() vector<tTbData*> DockingCont::getDataOfVisTb()
{ {
vector<tTbData*> vTbData; vector<tTbData*> vTbData;
TCITEM tcItem = {}; TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
@ -268,7 +250,7 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
bool DockingCont::isTbVis(tTbData* data) bool DockingCont::isTbVis(tTbData* data)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
@ -363,7 +345,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
} }
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
POINT pt = {}; POINT pt {};
// get correct cursor position // get correct cursor position
::GetCursorPos(&pt); ::GetCursorPos(&pt);
@ -422,8 +404,8 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
} }
case WM_MOUSEHOVER: case WM_MOUSEHOVER:
{ {
RECT rc = {}; RECT rc {};
POINT pt = {}; POINT pt {};
// get mouse position // get mouse position
@ -473,7 +455,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
RECT rc = pDrawItemStruct->rcItem; RECT rc = pDrawItemStruct->rcItem;
HDC hDc = pDrawItemStruct->hDC; HDC hDc = pDrawItemStruct->hDC;
HPEN hPen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW)); HPEN hPen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW));
BITMAP bmp = {}; BITMAP bmp {};
HBITMAP hBmpCur = NULL; HBITMAP hBmpCur = NULL;
HBITMAP hBmpOld = NULL; HBITMAP hBmpOld = NULL;
HBITMAP hBmpNew = NULL; HBITMAP hBmpNew = NULL;
@ -670,7 +652,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
eMousePos DockingCont::isInRect(HWND hwnd, int x, int y) eMousePos DockingCont::isInRect(HWND hwnd, int x, int y)
{ {
RECT rc; RECT rc {};
eMousePos ret = posOutside; eMousePos ret = posOutside;
::GetWindowRect(hwnd, &rc); ::GetWindowRect(hwnd, &rc);
@ -721,7 +703,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
break; break;
} }
RECT rc{}; RECT rc {};
::GetClientRect(hwnd, &rc); ::GetClientRect(hwnd, &rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush()); ::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
@ -783,7 +765,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
dis.itemState |= ODS_NOFOCUSRECT; // maybe, does it handle it already? dis.itemState |= ODS_NOFOCUSRECT; // maybe, does it handle it already?
RECT rcIntersect = {}; RECT rcIntersect {};
if (IntersectRect(&rcIntersect, &ps.rcPaint, &dis.rcItem)) if (IntersectRect(&rcIntersect, &ps.rcPaint, &dis.rcItem))
{ {
dis.rcItem.top += NppParameters::getInstance()._dpiManager.scaleY(1); dis.rcItem.top += NppParameters::getInstance()._dpiManager.scaleY(1);
@ -859,8 +841,8 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
case WM_MBUTTONUP: case WM_MBUTTONUP:
{ {
int iItem = 0; int iItem = 0;
TCITEM tcItem = {}; TCITEM tcItem {};
TCHITTESTINFO info = {}; TCHITTESTINFO info {};
// get selected sub item // get selected sub item
info.pt.x = LOWORD(lParam); info.pt.x = LOWORD(lParam);
@ -925,8 +907,8 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
} }
else if (iItem != _iLastHovered) else if (iItem != _iLastHovered)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
RECT rc = {}; RECT rc {};
// destroy old tooltip // destroy old tooltip
toolTip.destroy(); toolTip.destroy();
@ -956,9 +938,9 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
case WM_MOUSEHOVER: case WM_MOUSEHOVER:
{ {
int iItem = 0; int iItem = 0;
TCITEM tcItem = {}; TCITEM tcItem {};
RECT rc = {}; RECT rc {};
TCHITTESTINFO info = {}; TCHITTESTINFO info {};
// get selected sub item // get selected sub item
info.pt.x = LOWORD(lParam); info.pt.x = LOWORD(lParam);
@ -1032,7 +1014,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct) void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
RECT rc = pDrawItemStruct->rcItem; RECT rc = pDrawItemStruct->rcItem;
int nTab = pDrawItemStruct->itemID; int nTab = pDrawItemStruct->itemID;
@ -1094,8 +1076,8 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
if ((hImageList != NULL) && (iPosImage >= 0)) if ((hImageList != NULL) && (iPosImage >= 0))
{ {
// Get height of image so we // Get height of image so we
IMAGEINFO info = {}; IMAGEINFO info {};
RECT & imageRect = info.rcImage; const RECT& imageRect = info.rcImage;
ImageList_GetImageInfo(hImageList, iPosImage, &info); ImageList_GetImageInfo(hImageList, iPosImage, &info);
@ -1177,7 +1159,7 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{ {
break; break;
} }
RECT rc{}; RECT rc {};
getClientRect(rc); getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush()); ::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE; return TRUE;
@ -1210,8 +1192,8 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
} }
case WM_NCLBUTTONDBLCLK : case WM_NCLBUTTONDBLCLK :
{ {
RECT rcWnd = {}; RECT rcWnd {};
RECT rcClient = {}; RECT rcClient {};
POINT pt = {HIWORD(lParam), LOWORD(lParam)}; POINT pt = {HIWORD(lParam), LOWORD(lParam)};
getWindowRect(rcWnd); getWindowRect(rcWnd);
@ -1261,9 +1243,9 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
void DockingCont::onSize() void DockingCont::onSize()
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
RECT rc = {}; RECT rc {};
RECT rcTemp = {}; RECT rcTemp {};
UINT iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); UINT iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
UINT iTabOff = 0; UINT iTabOff = 0;
@ -1394,31 +1376,29 @@ void DockingCont::onSize()
void DockingCont::doClose(BOOL closeAll) void DockingCont::doClose(BOOL closeAll)
{ {
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
// Always close active tab first // Always close active tab first
int iItemCur = getActiveTb(); int iItemCur = getActiveTb();
TCITEM tcItem = {}; TCITEM item {};
tcItem.mask = TCIF_PARAM; item.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItemCur, reinterpret_cast<LPARAM>(&tcItem)); ::SendMessage(_hContTab, TCM_GETITEM, iItemCur, reinterpret_cast<LPARAM>(&item));
if (tcItem.lParam) if (item.lParam)
{ {
// notify child windows // notify child windows
if (NotifyParent(DMM_CLOSE) == 0) if (NotifyParent(DMM_CLOSE) == 0)
{ {
// delete tab // delete tab
hideToolbar((tTbData*)tcItem.lParam); hideToolbar((tTbData*)item.lParam);
} }
} }
// Close all other tabs if requested // Close all other tabs if requested
if (closeAll) if (closeAll)
{ {
iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int nbItem = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
int iItemOff = 0; int iItemOff = 0;
for (int iItem = 0; iItem < iItemCnt; ++iItem) for (int iItem = 0; iItem < nbItem; ++iItem)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
// get item data // get item data
selectTab(iItemOff); selectTab(iItemOff);
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
@ -1440,7 +1420,7 @@ void DockingCont::doClose(BOOL closeAll)
} }
// Hide dialog window if all tabs closed // Hide dialog window if all tabs closed
iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
if (iItemCnt == 0) if (iItemCnt == 0)
{ {
// hide dialog first // hide dialog first
@ -1516,7 +1496,7 @@ int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
void DockingCont::viewToolbar(tTbData *pTbData) void DockingCont::viewToolbar(tTbData *pTbData)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
if (iItemCnt > 0) if (iItemCnt > 0)
@ -1563,7 +1543,7 @@ void DockingCont::viewToolbar(tTbData *pTbData)
int DockingCont::searchPosInTab(tTbData* pTbData) int DockingCont::searchPosInTab(tTbData* pTbData)
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
@ -1585,7 +1565,7 @@ void DockingCont::selectTab(int iTab)
if (iTab != -1) if (iTab != -1)
{ {
const TCHAR *pszMaxTxt = NULL; const TCHAR *pszMaxTxt = NULL;
TCITEM tcItem = {}; TCITEM tcItem {};
SIZE size = {}; SIZE size = {};
int maxWidth = 0; int maxWidth = 0;
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)); int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
@ -1601,11 +1581,11 @@ void DockingCont::selectTab(int iTab)
::SetFocus(((tTbData*)tcItem.lParam)->hClient); ::SetFocus(((tTbData*)tcItem.lParam)->hClient);
// Notify switch in // Notify switch in
NMHDR nmhdr{}; NMHDR nmhdrIn{};
nmhdr.code = DMN_SWITCHIN; nmhdrIn.code = DMN_SWITCHIN;
nmhdr.hwndFrom = _hSelf; nmhdrIn.hwndFrom = _hSelf;
nmhdr.idFrom = 0; nmhdrIn.idFrom = 0;
::SendMessage(reinterpret_cast<tTbData*>(tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(reinterpret_cast<tTbData*>(tcItem.lParam)->hClient, WM_NOTIFY, nmhdrIn.idFrom, reinterpret_cast<LPARAM>(&nmhdrIn));
if (static_cast<unsigned int>(iTab) != _prevItem) if (static_cast<unsigned int>(iTab) != _prevItem)
{ {
@ -1617,11 +1597,11 @@ void DockingCont::selectTab(int iTab)
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE); ::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
// Notify switch off // Notify switch off
NMHDR nmhdr{}; NMHDR nmhdrOff{};
nmhdr.code = DMN_SWITCHOFF; nmhdrOff.code = DMN_SWITCHOFF;
nmhdr.hwndFrom = _hSelf; nmhdrOff.hwndFrom = _hSelf;
nmhdr.idFrom = 0; nmhdrOff.idFrom = 0;
::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdrOff.idFrom, reinterpret_cast<LPARAM>(&nmhdrOff));
} }
// resize tab item // resize tab item
@ -1681,7 +1661,7 @@ bool DockingCont::updateCaption()
if (!_hContTab) if (!_hContTab)
return false; return false;
TCITEM tcItem = {}; TCITEM tcItem {};
int iItem = getActiveTb(); int iItem = getActiveTb();
if (iItem < 0) if (iItem < 0)
@ -1717,7 +1697,7 @@ bool DockingCont::updateCaption()
void DockingCont::focusClient() void DockingCont::focusClient()
{ {
TCITEM tcItem = {}; TCITEM tcItem {};
int iItem = getActiveTb(); int iItem = getActiveTb();
if (iItem != -1) if (iItem != -1)

View File

@ -59,8 +59,8 @@ public:
return _hSelf; return _hSelf;
}; };
tTbData* createToolbar(tTbData data); tTbData* createToolbar(const tTbData& data);
void removeToolbar(tTbData data); void removeToolbar(const tTbData& data);
tTbData* findToolbarByWnd(HWND hClient); tTbData* findToolbarByWnd(HWND hClient);
tTbData* findToolbarByName(TCHAR* pszName); tTbData* findToolbarByName(TCHAR* pszName);
@ -173,7 +173,7 @@ protected :
private: private:
// handles // handles
BOOL _isActive = FALSE; BOOL _isActive = FALSE;
bool _isFloating = FALSE; bool _isFloating = false;
HWND _hCaption = nullptr; HWND _hCaption = nullptr;
HWND _hContTab = nullptr; HWND _hContTab = nullptr;
HWND _hTabUpdown = nullptr; HWND _hTabUpdown = nullptr;
@ -183,7 +183,7 @@ private:
HFONT _hFontCaption = nullptr; HFONT _hFontCaption = nullptr;
// caption params // caption params
BOOL _isTopCaption = FALSE; BOOL _isTopCaption = CAPTION_TOP;
generic_string _pszCaption; generic_string _pszCaption;
BOOL _isMouseDown = FALSE; BOOL _isMouseDown = FALSE;
@ -192,7 +192,7 @@ private:
RECT _rcCaption{}; RECT _rcCaption{};
// tab style // tab style
BOOL _bDrawOgLine = FALSE; BOOL _bDrawOgLine = TRUE;
// Important value for DlgMoving class // Important value for DlgMoving class
BOOL _dragFromTab = FALSE; BOOL _dragFromTab = FALSE;
@ -213,7 +213,7 @@ private:
BOOL _bCaptionTT = FALSE; BOOL _bCaptionTT = FALSE;
BOOL _bCapTTHover = FALSE; BOOL _bCapTTHover = FALSE;
eMousePos _hoverMPos = posOutside; eMousePos _hoverMPos = posClose;
int _captionHeightDynamic = HIGH_CAPTION; int _captionHeightDynamic = HIGH_CAPTION;
int _captionGapDynamic = CAPTION_GAP; int _captionGapDynamic = CAPTION_GAP;

View File

@ -430,11 +430,11 @@ void DockingManager::reSizeTo(RECT & rc)
_rcWork.bottom -= _dockData.rcRegion[CONT_TOP].bottom + SPLITTER_WIDTH; _rcWork.bottom -= _dockData.rcRegion[CONT_TOP].bottom + SPLITTER_WIDTH;
// set size of splitter // set size of splitter
RECT rc = {_dockData.rcRegion[CONT_TOP].left , RECT rcSplitter = {_dockData.rcRegion[CONT_TOP].left ,
_dockData.rcRegion[CONT_TOP].top + _dockData.rcRegion[CONT_TOP].bottom, _dockData.rcRegion[CONT_TOP].top + _dockData.rcRegion[CONT_TOP].bottom,
_dockData.rcRegion[CONT_TOP].right , _dockData.rcRegion[CONT_TOP].right ,
SPLITTER_WIDTH}; SPLITTER_WIDTH};
_vSplitter[CONT_TOP]->reSizeTo(rc); _vSplitter[CONT_TOP]->reSizeTo(rcSplitter);
} }
// set bottom container // set bottom container
@ -464,11 +464,11 @@ void DockingManager::reSizeTo(RECT & rc)
} }
// set size of splitter // set size of splitter
RECT rc = {rcBottom.left, RECT rcSplitter = {rcBottom.left,
rcBottom.top - SPLITTER_WIDTH, rcBottom.top - SPLITTER_WIDTH,
rcBottom.right, rcBottom.right,
SPLITTER_WIDTH}; SPLITTER_WIDTH};
_vSplitter[CONT_BOTTOM]->reSizeTo(rc); _vSplitter[CONT_BOTTOM]->reSizeTo(rcSplitter);
} }
// set left container // set left container
@ -484,11 +484,11 @@ void DockingManager::reSizeTo(RECT & rc)
_rcWork.right -= _dockData.rcRegion[CONT_LEFT].right + SPLITTER_WIDTH; _rcWork.right -= _dockData.rcRegion[CONT_LEFT].right + SPLITTER_WIDTH;
// set size of splitter // set size of splitter
RECT rc = {_dockData.rcRegion[CONT_LEFT].right, RECT rcSplitter = {_dockData.rcRegion[CONT_LEFT].right,
_dockData.rcRegion[CONT_LEFT].top, _dockData.rcRegion[CONT_LEFT].top,
SPLITTER_WIDTH, SPLITTER_WIDTH,
_dockData.rcRegion[CONT_LEFT].bottom}; _dockData.rcRegion[CONT_LEFT].bottom};
_vSplitter[CONT_LEFT]->reSizeTo(rc); _vSplitter[CONT_LEFT]->reSizeTo(rcSplitter);
} }
// set right container // set right container
@ -513,11 +513,11 @@ void DockingManager::reSizeTo(RECT & rc)
} }
// set size of splitter // set size of splitter
RECT rc = {rcRight.left - SPLITTER_WIDTH, RECT rcSplitter = {rcRight.left - SPLITTER_WIDTH,
rcRight.top, rcRight.top,
SPLITTER_WIDTH, SPLITTER_WIDTH,
rcRight.bottom}; rcRight.bottom};
_vSplitter[CONT_RIGHT]->reSizeTo(rc); _vSplitter[CONT_RIGHT]->reSizeTo(rcSplitter);
} }
// set window positions of container // set window positions of container

View File

@ -179,7 +179,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam)
POINT ptBuf = {0,0}; POINT ptBuf = {0,0};
::GetCursorPos(&pt); ::GetCursorPos(&pt);
getMousePoints(&pt, &ptBuf); getMousePoints(pt, ptBuf);
/* erase last drawn rectangle */ /* erase last drawn rectangle */
drawRectangle(NULL); drawRectangle(NULL);
@ -267,7 +267,7 @@ void Gripper::onMove()
POINT ptBuf = {0,0}; POINT ptBuf = {0,0};
::GetCursorPos(&pt); ::GetCursorPos(&pt);
getMousePoints(&pt, &ptBuf); getMousePoints(pt, ptBuf);
/* tab reordering only when tab was selected */ /* tab reordering only when tab was selected */
if (_startMovingFromTab == TRUE) if (_startMovingFromTab == TRUE)
@ -287,7 +287,7 @@ void Gripper::onButtonUp()
RECT rcCorr = {}; RECT rcCorr = {};
::GetCursorPos(&pt); ::GetCursorPos(&pt);
getMousePoints(&pt, &ptBuf); getMousePoints(pt, ptBuf);
// do nothing, when old point is not valid // do nothing, when old point is not valid
if (_bPtOldValid == FALSE) if (_bPtOldValid == FALSE)
@ -623,10 +623,10 @@ void Gripper::drawRectangle(const POINT* pPt)
} }
void Gripper::getMousePoints(POINT* pt, POINT* ptPrev) void Gripper::getMousePoints(const POINT& pt, POINT& ptPrev)
{ {
*ptPrev = _ptOld; ptPrev = _ptOld;
_ptOld = *pt; _ptOld = pt;
} }

View File

@ -83,7 +83,7 @@ protected :
void doTabReordering(POINT pt); void doTabReordering(POINT pt);
void drawRectangle(const POINT* pPt); void drawRectangle(const POINT* pPt);
void getMousePoints(POINT* pt, POINT* ptPrev); void getMousePoints(const POINT& pt, POINT& ptPrev);
void getMovingRect(POINT pt, RECT *rc); void getMovingRect(POINT pt, RECT *rc);
DockingCont * contHitTest(POINT pt); DockingCont * contHitTest(POINT pt);
DockingCont * workHitTest(POINT pt, RECT *rcCont = NULL); DockingCont * workHitTest(POINT pt, RECT *rcCont = NULL);

View File

@ -80,7 +80,6 @@ void DocumentPeeker::syncDisplay(Buffer *buf, const ScintillaEditView & scintSou
scrollSnapshotWith(mp, scintSource.getTextZoneWidth()); scrollSnapshotWith(mp, scintSource.getTextZoneWidth());
} }
Buffer *buf = _pPeekerView->getCurrentBuffer();
_pPeekerView->defineDocType(buf->getLangType()); _pPeekerView->defineDocType(buf->getLangType());
_pPeekerView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); _pPeekerView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false);

View File

@ -443,7 +443,7 @@ generic_string FileBrowser::getNodePath(HTREEITEM node) const
HTREEITEM temp = _treeView.getParent(parent); HTREEITEM temp = _treeView.getParent(parent);
if (temp == nullptr) if (temp == nullptr)
{ {
SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(_treeView.getItemParam(parent)); const SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(_treeView.getItemParam(parent));
folderName = customData->_rootPath; folderName = customData->_rootPath;
} }
parent = temp; parent = temp;
@ -750,7 +750,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
{ {
if (!selectedNode) return; if (!selectedNode) return;
generic_string *rootPath = (generic_string *)_treeView.getItemParam(selectedNode); const wstring* rootPath = (wstring *)_treeView.getItemParam(selectedNode);
if (_treeView.getParent(selectedNode) != nullptr || rootPath == nullptr) if (_treeView.getParent(selectedNode) != nullptr || rootPath == nullptr)
return; return;

View File

@ -366,7 +366,7 @@ void FunctionListPanel::reload()
udln = currentBuf->getUserDefineLangName(); udln = currentBuf->getUserDefineLangName();
} }
TCHAR *ext = ::PathFindExtension(fn); const wchar_t* ext = ::PathFindExtension(fn);
bool parsedOK = _funcParserMgr.parse(_foundFuncInfos, AssociationInfo(-1, langID, ext, udln)); bool parsedOK = _funcParserMgr.parse(_foundFuncInfos, AssociationInfo(-1, langID, ext, udln));
if (parsedOK) if (parsedOK)
@ -429,7 +429,7 @@ void FunctionListPanel::reload()
void FunctionListPanel::initPreferencesMenu() void FunctionListPanel::initPreferencesMenu()
{ {
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI(); const NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
generic_string shouldSortFunctionListStr = pNativeSpeaker->getAttrNameStr(TEXT("Sort functions (A to Z) by default"), FL_FUCTIONLISTROOTNODE, FL_PREFERENCE_INITIALSORT); generic_string shouldSortFunctionListStr = pNativeSpeaker->getAttrNameStr(TEXT("Sort functions (A to Z) by default"), FL_FUCTIONLISTROOTNODE, FL_PREFERENCE_INITIALSORT);
@ -546,8 +546,6 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
} }
else else
{ {
generic_string funcListDefaultXmlPath = nppParams.getNppPath();
pathAppend(funcListDefaultXmlPath, TEXT("functionList"));
if (PathFileExists(funcListDefaultXmlPath.c_str())) if (PathFileExists(funcListDefaultXmlPath.c_str()))
{ {
_funcParserMgr.init(funcListDefaultXmlPath, funcListDefaultXmlPath, ppEditView); _funcParserMgr.init(funcListDefaultXmlPath, funcListDefaultXmlPath, ppEditView);

View File

@ -652,7 +652,7 @@ bool FunctionParser::isInZones(size_t pos2Test, const std::vector< std::pair<siz
} }
void FunctionParser::getInvertZones(vector< pair<size_t, size_t> > & destZones, vector< pair<size_t, size_t> > & sourceZones, size_t begin, size_t end) void FunctionParser::getInvertZones(vector< pair<size_t, size_t> > & destZones, const vector< pair<size_t, size_t> > & sourceZones, size_t begin, size_t end)
{ {
if (sourceZones.size() == 0) if (sourceZones.size() == 0)
{ {
@ -708,7 +708,7 @@ void FunctionUnitParser::parse(std::vector<foundInfo> & foundInfos, size_t begin
// sort in _selLpos : increased order // sort in _selLpos : increased order
struct SortZones final struct SortZones final
{ {
bool operator() (pair<int, int> & l, pair<int, int> & r) bool operator() (const pair<int, int> & l, const pair<int, int> & r)
{ {
return (l.first < r.first); return (l.first < r.first);
} }

View File

@ -48,7 +48,7 @@ protected:
std::vector<generic_string> _functionNameExprArray; std::vector<generic_string> _functionNameExprArray;
std::vector<generic_string> _classNameExprArray; std::vector<generic_string> _classNameExprArray;
void getCommentZones(std::vector< std::pair<size_t, size_t> > & commentZone, size_t begin, size_t end, ScintillaEditView **ppEditView); void getCommentZones(std::vector< std::pair<size_t, size_t> > & commentZone, size_t begin, size_t end, ScintillaEditView **ppEditView);
void getInvertZones(std::vector< std::pair<size_t, size_t> > & destZones, std::vector< std::pair<size_t, size_t> > & sourceZones, size_t begin, size_t end); void getInvertZones(std::vector< std::pair<size_t, size_t> > & destZones, const std::vector< std::pair<size_t, size_t> > & sourceZones, size_t begin, size_t end);
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView); generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView);
}; };
@ -61,7 +61,7 @@ public:
const std::vector<generic_string>& classNameExprArray, const generic_string& functionExpr, const std::vector<generic_string>& functionNameExprArray): const std::vector<generic_string>& classNameExprArray, const generic_string& functionExpr, const std::vector<generic_string>& functionNameExprArray):
FunctionParser(id, displayName, commentExpr, functionExpr, functionNameExprArray, classNameExprArray), _rangeExpr(rangeExpr), _openSymbole(openSymbole), _closeSymbole(closeSymbole) {}; FunctionParser(id, displayName, commentExpr, functionExpr, functionNameExprArray, classNameExprArray), _rangeExpr(rangeExpr), _openSymbole(openSymbole), _closeSymbole(closeSymbole) {};
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")); void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override;
protected: protected:
void classParse(std::vector<foundInfo> & foundInfos, std::vector< std::pair<size_t, size_t> > & scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")); void classParse(std::vector<foundInfo> & foundInfos, std::vector< std::pair<size_t, size_t> > & scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT(""));
@ -84,7 +84,7 @@ public:
const std::vector<generic_string>& classNameExprArray): FunctionParser(id, displayName, commentExpr, mainExpr, functionNameExprArray, classNameExprArray) const std::vector<generic_string>& classNameExprArray): FunctionParser(id, displayName, commentExpr, mainExpr, functionNameExprArray, classNameExprArray)
{} {}
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")); void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override;
}; };
class FunctionMixParser : public FunctionZoneParser class FunctionMixParser : public FunctionZoneParser
@ -99,7 +99,7 @@ public:
delete _funcUnitPaser; delete _funcUnitPaser;
} }
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")); void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override;
private: private:
FunctionUnitParser* _funcUnitPaser = nullptr; FunctionUnitParser* _funcUnitPaser = nullptr;

View File

@ -68,7 +68,7 @@ bool IconList::changeIcon(size_t index, const TCHAR *iconLocation) const
return (i == index); return (i == index);
} }
void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize, std::vector<DynamicCmdIcoBmp> moreCmds) void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize, const std::vector<DynamicCmdIcoBmp>& moreCmds)
{ {
for (int i = 0 ; i < arraySize ; ++i) for (int i = 0 ; i < arraySize ; ++i)
_tbiis.push_back(buttonUnitArray[i]); _tbiis.push_back(buttonUnitArray[i]);

View File

@ -96,7 +96,7 @@ class ToolBarIcons
public : public :
ToolBarIcons() = default; ToolBarIcons() = default;
void init(ToolBarButtonUnit *buttonUnitArray, int arraySize, std::vector<DynamicCmdIcoBmp> cmds2add); void init(ToolBarButtonUnit *buttonUnitArray, int arraySize, const std::vector<DynamicCmdIcoBmp>& cmds2add);
void create(HINSTANCE hInst, int iconSize); void create(HINSTANCE hInst, int iconSize);
void destroy(); void destroy();

View File

@ -77,7 +77,7 @@ bool findStrNoCase(const generic_string & strHaystack, const generic_string & st
bool PluginsAdminDlg::isFoundInListFromIndex(const PluginViewList& inWhichList, int index, const generic_string& str2search, bool inWhichPart) const bool PluginsAdminDlg::isFoundInListFromIndex(const PluginViewList& inWhichList, int index, const generic_string& str2search, bool inWhichPart) const
{ {
PluginUpdateInfo* pui = inWhichList.getPluginInfoFromUiIndex(index); const PluginUpdateInfo* pui = inWhichList.getPluginInfoFromUiIndex(index);
generic_string searchIn; generic_string searchIn;
if (inWhichPart == _inNames) if (inWhichPart == _inNames)
searchIn = pui->_displayName; searchIn = pui->_displayName;
@ -412,7 +412,7 @@ bool PluginViewList::removeFromFolderName(const generic_string& folderName)
for (size_t i = 0; i < _ui.nbItem(); ++i) for (size_t i = 0; i < _ui.nbItem(); ++i)
{ {
PluginUpdateInfo* pi = getPluginInfoFromUiIndex(i); const PluginUpdateInfo* pi = getPluginInfoFromUiIndex(i);
if (pi->_folderName == folderName) if (pi->_folderName == folderName)
{ {
if (!_ui.removeFromIndex(i)) if (!_ui.removeFromIndex(i))
@ -577,11 +577,11 @@ bool loadFromJson(std::vector<PluginUpdateInfo*>& pl, wstring& verStr, const jso
pi->_oldVersionCompatibility = getTwoIntervalVersions(oldVerCompatibilityStr); pi->_oldVersionCompatibility = getTwoIntervalVersions(oldVerCompatibilityStr);
} }
} }
catch (const wstring& s) catch (const wstring& exceptionStr)
{ {
wstring msg = pi->_displayName; wstring msg = pi->_displayName;
msg += L": "; msg += L": ";
throw msg + s; throw msg + exceptionStr;
} }
valStr = i.at("repository").get<std::string>(); valStr = i.at("repository").get<std::string>();
pi->_repository = wmc.char2wchar(valStr.c_str(), CP_ACP); pi->_repository = wmc.char2wchar(valStr.c_str(), CP_ACP);
@ -592,9 +592,9 @@ bool loadFromJson(std::vector<PluginUpdateInfo*>& pl, wstring& verStr, const jso
pl.push_back(pi); pl.push_back(pi);
} }
#ifdef DEBUG #ifdef DEBUG
catch (const wstring& s) catch (const wstring& exceptionStr)
{ {
::MessageBox(NULL, s.c_str(), TEXT("Exception caught in: PluginsAdmin loadFromJson()"), MB_ICONERROR); ::MessageBox(NULL, exceptionStr.c_str(), TEXT("Exception caught in: PluginsAdmin loadFromJson()"), MB_ICONERROR);
continue; continue;
} }
@ -1239,7 +1239,7 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
pnmh->hwndFrom == _installedList.getViewHwnd() || pnmh->hwndFrom == _installedList.getViewHwnd() ||
pnmh->hwndFrom == _incompatibleList.getViewHwnd()) pnmh->hwndFrom == _incompatibleList.getViewHwnd())
{ {
PluginViewList* pViewList = nullptr; const PluginViewList* pViewList = nullptr;
int buttonID = 0; int buttonID = 0;
if (pnmh->hwndFrom == _availableList.getViewHwnd()) if (pnmh->hwndFrom == _availableList.getViewHwnd())

View File

@ -1043,7 +1043,6 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_COMMAND : case WM_COMMAND :
{ {
ScintillaViewParams & svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
switch (wParam) switch (wParam)
{ {
case IDC_CHECK_SMOOTHFONT: case IDC_CHECK_SMOOTHFONT:
@ -5275,21 +5274,21 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
nppGUI._cloudPath = inputDirExpanded; nppGUI._cloudPath = inputDirExpanded;
nppParams.setCloudChoice(inputDirExpanded); nppParams.setCloudChoice(inputDirExpanded);
generic_string message; generic_string warningMsg;
if (nppParams.isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
} }
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str());
} }
else else
{ {
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0)); bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
if (isChecked) if (isChecked)
{ {
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path.")); generic_string errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
nppParams.removeCloudChoice(); nppParams.removeCloudChoice();
} }
} }
@ -5312,17 +5311,17 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
generic_string message = TEXT(""); generic_string errMsg = TEXT("");
bool withCloud = nppGUI._cloudPath != TEXT(""); bool withCloud = nppGUI._cloudPath != TEXT("");
if (withCloud) if (withCloud)
{ {
// detect validation of path // detect validation of path
if (!::PathFileExists(nppGUI._cloudPath.c_str())) if (!::PathFileExists(nppGUI._cloudPath.c_str()))
message = TEXT("Invalid path"); errMsg = TEXT("Invalid path");
} }
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
::SendDlgItemMessage(_hSelf, IDC_NOCLOUD_RADIO, BM_SETCHECK, !withCloud ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_NOCLOUD_RADIO, BM_SETCHECK, !withCloud ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_SETCHECK, withCloud ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_SETCHECK, withCloud ? BST_CHECKED : BST_UNCHECKED, 0);
@ -5391,13 +5390,13 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
nppGUI._cloudPath = TEXT(""); nppGUI._cloudPath = TEXT("");
nppParams.removeCloudChoice(); nppParams.removeCloudChoice();
generic_string message; generic_string warningMsg;
if (nppParams.isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
} }
// else set empty string // else set empty string
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str());
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._cloudPath.c_str())); ::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._cloudPath.c_str()));
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), false); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), false);
@ -5407,8 +5406,8 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
case IDC_WITHCLOUD_RADIO: case IDC_WITHCLOUD_RADIO:
{ {
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path.")); generic_string errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true);
::EnableWindow(::GetDlgItem(_hSelf, IDD_CLOUDPATH_BROWSE_BUTTON), true); ::EnableWindow(::GetDlgItem(_hSelf, IDD_CLOUDPATH_BROWSE_BUTTON), true);
@ -5417,8 +5416,8 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
case IDD_CLOUDPATH_BROWSE_BUTTON: case IDD_CLOUDPATH_BROWSE_BUTTON:
{ {
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings")); generic_string warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings"));
folderBrowser(_hSelf, message, IDC_CLOUDPATH_EDIT); folderBrowser(_hSelf, warningMsg, IDC_CLOUDPATH_EDIT);
} }
break; break;

View File

@ -1250,8 +1250,6 @@ void ProjectPanel::addFiles(HTREEITEM hTreeItem)
void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTreeItem) void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTreeItem)
{ {
bool isRecursive = true;
bool isInHiddenDir = false;
generic_string dirFilter(folderPath); generic_string dirFilter(folderPath);
if (folderPath[lstrlen(folderPath)-1] != '\\') if (folderPath[lstrlen(folderPath)-1] != '\\')
dirFilter += TEXT("\\"); dirFilter += TEXT("\\");
@ -1268,11 +1266,11 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre
if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
if (!isInHiddenDir && (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) if (foundData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) // Hidden directories are ignored
{ {
// do nothing // do nothing
} }
else if (isRecursive) else // Always recursive
{ {
if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0)) if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0))
{ {

View File

@ -35,11 +35,8 @@ using namespace ReadDirectoryChangesPrivate;
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// CReadDirectoryChanges // CReadDirectoryChanges
CReadDirectoryChanges::CReadDirectoryChanges() CReadDirectoryChanges::CReadDirectoryChanges(): m_Notifications()
: m_Notifications()
{ {
m_hThread = NULL;
m_dwThreadId= 0;
m_pServer = new CReadChangesServer(this); m_pServer = new CReadChangesServer(this);
} }

View File

@ -41,13 +41,8 @@ namespace ReadDirectoryChangesPrivate
// CReadChangesRequest // CReadChangesRequest
CReadChangesRequest::CReadChangesRequest(CReadChangesServer* pServer, LPCTSTR sz, BOOL b, DWORD dw, DWORD size) CReadChangesRequest::CReadChangesRequest(CReadChangesServer* pServer, LPCTSTR sz, BOOL b, DWORD dw, DWORD size)
: m_pServer(pServer), m_wstrDirectory(sz), m_bIncludeChildren(b), m_dwFilterFlags(dw)
{ {
m_pServer = pServer;
m_dwFilterFlags = dw;
m_bIncludeChildren = b;
m_wstrDirectory = sz;
m_hDirectory = 0;
::ZeroMemory(&m_Overlapped, sizeof(OVERLAPPED)); ::ZeroMemory(&m_Overlapped, sizeof(OVERLAPPED));
// The hEvent member is not used when there is a completion // The hEvent member is not used when there is a completion

View File

@ -106,10 +106,7 @@ protected:
class CReadChangesServer class CReadChangesServer
{ {
public: public:
explicit CReadChangesServer(CReadDirectoryChanges* pParent) explicit CReadChangesServer(CReadDirectoryChanges* pParent): m_pBase(pParent) {}
{
m_bTerminate=false; m_nOutstandingRequests=0;m_pBase=pParent;
}
static unsigned int WINAPI ThreadStartProc(LPVOID arg) static unsigned int WINAPI ThreadStartProc(LPVOID arg)
{ {
@ -134,7 +131,7 @@ public:
CReadDirectoryChanges* m_pBase = nullptr; CReadDirectoryChanges* m_pBase = nullptr;
volatile DWORD m_nOutstandingRequests; volatile DWORD m_nOutstandingRequests = 0;
protected: protected:

View File

@ -2,18 +2,6 @@
CReadFileChanges::CReadFileChanges()
{
_szFile = NULL;
_dwNotifyFilter = 0;
}
CReadFileChanges::~CReadFileChanges()
{
}
BOOL CReadFileChanges::DetectChanges() { BOOL CReadFileChanges::DetectChanges() {
WIN32_FILE_ATTRIBUTE_DATA fInfo; WIN32_FILE_ATTRIBUTE_DATA fInfo;

View File

@ -14,8 +14,8 @@
class CReadFileChanges class CReadFileChanges
{ {
public: public:
CReadFileChanges(); CReadFileChanges() {};
~CReadFileChanges(); ~CReadFileChanges() {};
void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter); void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter);
BOOL DetectChanges(); BOOL DetectChanges();
void Terminate(); void Terminate();

View File

@ -38,8 +38,7 @@ protected:
using Base = std::list<C>; using Base = std::list<C>;
public: public:
CThreadSafeQueue() CThreadSafeQueue() {
{
m_hEvent = ::CreateEvent( m_hEvent = ::CreateEvent(
NULL, // no security attributes NULL, // no security attributes
FALSE, // auto reset FALSE, // auto reset
@ -47,14 +46,12 @@ public:
NULL); // anonymous NULL); // anonymous
} }
~CThreadSafeQueue() ~CThreadSafeQueue() {
{
::CloseHandle(m_hEvent); ::CloseHandle(m_hEvent);
m_hEvent = NULL; m_hEvent = NULL;
} }
void push(C& c) void push(C& c) {
{
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
Base::push_back(c); Base::push_back(c);
@ -62,8 +59,7 @@ public:
::SetEvent(m_hEvent); ::SetEvent(m_hEvent);
} }
bool pop(C& c) bool pop(C& c) {
{
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (Base::empty()) if (Base::empty())
{ {

View File

@ -721,7 +721,7 @@ void Splitter::adjustZoneToDraw(RECT& rc2def, ZONE_TYPE whichZone)
int x0, y0, x1, y1, w, h; int x0, y0, x1, y1, w, h;
if ((4 <= _splitterSize) && (_splitterSize <= 8)) if (/*(4 <= _splitterSize) && */(_splitterSize <= 8))
{ {
w = (isVertical() ? 4 : 7); w = (isVertical() ? 4 : 7);
h = (isVertical() ? 7 : 4); h = (isVertical() ? 7 : 4);

View File

@ -360,7 +360,6 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
runMenu.push_back(MenuItemUnit(cmdID, string2wstring(uc.getName(), CP_UTF8))); runMenu.push_back(MenuItemUnit(cmdID, string2wstring(uc.getName(), CP_UTF8)));
::InsertMenu(hRunMenu, posBase + nbTopLevelItem, MF_BYPOSITION, cmdID, string2wstring(uc.toMenuItemString(), CP_UTF8).c_str()); ::InsertMenu(hRunMenu, posBase + nbTopLevelItem, MF_BYPOSITION, cmdID, string2wstring(uc.toMenuItemString(), CP_UTF8).c_str());
NppParameters& nppParams = NppParameters::getInstance();
if (nbTopLevelItem == 0) if (nbTopLevelItem == 0)
{ {
// Insert the separator and modify/delete command // Insert the separator and modify/delete command

View File

@ -211,7 +211,7 @@ HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplat
if (!hDlgTemplate) if (!hDlgTemplate)
return NULL; return NULL;
DLGTEMPLATE *pDlgTemplate = static_cast<DLGTEMPLATE *>(::LockResource(hDlgTemplate)); const DLGTEMPLATE *pDlgTemplate = static_cast<DLGTEMPLATE *>(::LockResource(hDlgTemplate));
if (!pDlgTemplate) if (!pDlgTemplate)
return NULL; return NULL;

View File

@ -1236,7 +1236,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
} }
else // inactive tabs else // inactive tabs
{ {
RECT rect = hasMultipleLines ? pDrawItemStruct->rcItem : barRect; RECT inactiveRect = hasMultipleLines ? pDrawItemStruct->rcItem : barRect;
COLORREF brushColour{}; COLORREF brushColour{};
if (_drawInactiveTab && individualColourId == -1) if (_drawInactiveTab && individualColourId == -1)
@ -1253,7 +1253,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
} }
hBrush = ::CreateSolidBrush(brushColour); hBrush = ::CreateSolidBrush(brushColour);
::FillRect(hDC, &rect, hBrush); ::FillRect(hDC, &inactiveRect, hBrush);
::DeleteObject((HGDIOBJ)hBrush); ::DeleteObject((HGDIOBJ)hBrush);
} }

View File

@ -225,7 +225,7 @@ LRESULT TaskList::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_GETDLGCODE : case WM_GETDLGCODE :
{ {
MSG *msg = (MSG*)lParam; const MSG *msg = (MSG*)lParam;
if ( msg != NULL) if ( msg != NULL)
{ {

View File

@ -87,7 +87,7 @@ LRESULT TreeView::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
nmtv.hdr.code = TVN_ITEMEXPANDED; nmtv.hdr.code = TVN_ITEMEXPANDED;
nmtv.hdr.hwndFrom = _hSelf; nmtv.hdr.hwndFrom = _hSelf;
nmtv.hdr.idFrom = 0; nmtv.hdr.idFrom = 0;
nmtv.action = wParam & TVE_COLLAPSE ? TVE_COLLAPSE : TVE_EXPAND; nmtv.action = (wParam & TVE_COLLAPSE) ? TVE_COLLAPSE : TVE_EXPAND;
nmtv.itemNew.hItem = tvItem.hItem; nmtv.itemNew.hItem = tvItem.hItem;
::SendMessage(_hParent, WM_NOTIFY, nmtv.hdr.idFrom, reinterpret_cast<LPARAM>(&nmtv)); ::SendMessage(_hParent, WM_NOTIFY, nmtv.hdr.idFrom, reinterpret_cast<LPARAM>(&nmtv));
} }

View File

@ -149,17 +149,17 @@ void VerticalFileSwitcherListView::initList()
item.lParam = reinterpret_cast<LPARAM>(tl); item.lParam = reinterpret_cast<LPARAM>(tl);
item.iGroupId = (fileNameStatus._iView == MAIN_VIEW) ? _groupID : _group2ID; item.iGroupId = (fileNameStatus._iView == MAIN_VIEW) ? _groupID : _group2ID;
ListView_InsertItem(_hSelf, &item); ListView_InsertItem(_hSelf, &item);
int colIndex = 0; int colIndex2 = 0;
if (isExtColumn) if (isExtColumn)
{ {
ListView_SetItemText(_hSelf, i, ++colIndex, ::PathFindExtension(fileNameStatus._fn.c_str())); ListView_SetItemText(_hSelf, i, ++colIndex2, ::PathFindExtension(fileNameStatus._fn.c_str()));
} }
if (isPathColumn) if (isPathColumn)
{ {
TCHAR dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' }; TCHAR dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
_wsplitpath_s(fileNameStatus._fn.c_str(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0); _wsplitpath_s(fileNameStatus._fn.c_str(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
wcscat_s(drive, dir); wcscat_s(drive, dir);
ListView_SetItemText(_hSelf, i, ++colIndex, drive); ListView_SetItemText(_hSelf, i, ++colIndex2, drive);
} }
} }
_currentIndex = taskListInfo._currentIndex; _currentIndex = taskListInfo._currentIndex;
@ -294,7 +294,7 @@ generic_string VerticalFileSwitcherListView::getFullFilePath(size_t i) const
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
item.iItem = static_cast<int32_t>(i); item.iItem = static_cast<int32_t>(i);
ListView_GetItem(_hSelf, &item); ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam; const TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
return tlfs->_fn; return tlfs->_fn;
} }
@ -330,7 +330,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
_currentIndex = ListView_GetItemCount(_hSelf); _currentIndex = ListView_GetItemCount(_hSelf);
Buffer *buf = bufferID; Buffer *buf = bufferID;
const TCHAR *fileName = buf->getFileName(); const TCHAR *fileName = buf->getFileName();
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI(); const NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID, -1); TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID, -1);
TCHAR fn[MAX_PATH] = { '\0' }; TCHAR fn[MAX_PATH] = { '\0' };
@ -412,7 +412,7 @@ int VerticalFileSwitcherListView::find(BufferID bufferID, int iView) const
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
item.iItem = i; item.iItem = i;
ListView_GetItem(_hSelf, &item); ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam; const TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
if (tlfs->_bufID == bufferID && tlfs->_iView == iView) if (tlfs->_bufID == bufferID && tlfs->_iView == iView)
{ {
found = true; found = true;

View File

@ -212,7 +212,7 @@ CWinMgr::AdjustSize(WINRECT* wrc, BOOL bRow,
int hw = bRow ? szi.szDesired.cy : szi.szDesired.cx; // desired ht or wid int hw = bRow ? szi.szDesired.cy : szi.szDesired.cx; // desired ht or wid
if (wrc->Type() == WRCT_REST) { if (wrc->Type() == WRCT_REST) {
// for REST type, use all remaining space // for REST type, use all remaining space
RECT& rc = wrc->GetRect(); const RECT& rc = wrc->GetRect();
hw = hwRemaining + (bRow ? RectHeight(rc) : RectWidth(rc)); hw = hwRemaining + (bRow ? RectHeight(rc) : RectWidth(rc));
} }
@ -317,7 +317,7 @@ CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, HWND hWnd)
// not a group // not a group
WINRECT* parent = wrc->Parent(); WINRECT* parent = wrc->Parent();
assert(parent); assert(parent);
RECT& rcParent = parent->GetRect(); const RECT& rcParent = parent->GetRect();
BOOL bRow = parent->IsRowGroup(); BOOL bRow = parent->IsRowGroup();
int hw, hwMin, hwTotal, pct; int hw, hwMin, hwTotal, pct;

View File

@ -109,7 +109,7 @@ protected:
public: public:
WINRECT(WORD f, int id, LONG p); WINRECT(WORD f, int id, LONG p);
static WINRECT* InitMap(WINRECT* map, WINRECT* parent=NULL); static WINRECT* InitMap(WINRECT* map, const WINRECT* parent=NULL);
WINRECT* Prev() { return prev; } WINRECT* Prev() { return prev; }
WINRECT* Next() { return next; } WINRECT* Next() { return next; }

View File

@ -58,7 +58,7 @@ BOOL WINRECT::GetMargins(int& w, int& h)
// Initialize map: set up all the next/prev pointers. This converts the // Initialize map: set up all the next/prev pointers. This converts the
// linear array to a more convenient linked list. Called from END_WINDOW_MAP. // linear array to a more convenient linked list. Called from END_WINDOW_MAP.
// //
WINRECT* WINRECT::InitMap(WINRECT* pWinMap, WINRECT* parent) WINRECT* WINRECT::InitMap(WINRECT* pWinMap, const WINRECT* parent)
{ {
assert(pWinMap); assert(pWinMap);

View File

@ -242,8 +242,6 @@ RECT WindowsDlg::_lastKnownLocation;
WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap) WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap)
{ {
_szMinButton = SIZEZERO;
_szMinListCtrl = SIZEZERO;
} }
void WindowsDlg::init(HINSTANCE hInst, HWND parent, DocTabView *pTab) void WindowsDlg::init(HINSTANCE hInst, HWND parent, DocTabView *pTab)
@ -429,7 +427,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
} }
else if (pNMHDR->code == LVN_COLUMNCLICK) // sort columns with stable sort else if (pNMHDR->code == LVN_COLUMNCLICK) // sort columns with stable sort
{ {
NMLISTVIEW *pNMLV = (NMLISTVIEW *)pNMHDR; const NMLISTVIEW *pNMLV = (NMLISTVIEW *)pNMHDR;
if (pNMLV->iItem == -1) if (pNMLV->iItem == -1)
{ {
_currentColumn = pNMLV->iSubItem; _currentColumn = pNMLV->iSubItem;
@ -462,7 +460,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
} }
else if (pNMHDR->code == LVN_KEYDOWN) else if (pNMHDR->code == LVN_KEYDOWN)
{ {
NMLVKEYDOWN *lvkd = (NMLVKEYDOWN *)pNMHDR; const NMLVKEYDOWN *lvkd = (NMLVKEYDOWN *)pNMHDR;
short ctrl = GetKeyState(VK_CONTROL); short ctrl = GetKeyState(VK_CONTROL);
short alt = GetKeyState(VK_MENU); short alt = GetKeyState(VK_MENU);
short shift = GetKeyState(VK_SHIFT); short shift = GetKeyState(VK_SHIFT);
@ -889,9 +887,9 @@ void WindowsDlg::doClose()
{ {
// Trying to retain sort order. fairly sure there is a much better algorithm for this // Trying to retain sort order. fairly sure there is a much better algorithm for this
vector<int>::iterator kitr = key.begin(); vector<int>::iterator kitr = key.begin();
for (UINT i = 0; i < n; ++i, ++kitr) for (UINT k = 0; k < n; ++k, ++kitr)
{ {
if (nmdlg.Items[i] == ((UINT)-1)) if (nmdlg.Items[k] == ((UINT)-1))
{ {
int oldVal = _idxMap[*kitr]; int oldVal = _idxMap[*kitr];
_idxMap[*kitr] = -1; _idxMap[*kitr] = -1;
@ -1034,15 +1032,13 @@ void WindowsDlg::refreshMap()
if (count == oldSize) if (count == oldSize)
return; return;
if (count != oldSize)
{
size_t lo = 0; size_t lo = 0;
_idxMap.resize(count); _idxMap.resize(count);
if (oldSize < count) if (oldSize < count)
lo = oldSize; lo = oldSize;
for (size_t i = lo; i < count; ++i) for (size_t i = lo; i < count; ++i)
_idxMap[i] = int(i); _idxMap[i] = int(i);
}
} }
void WindowsDlg::doSortToTabs() void WindowsDlg::doSortToTabs()

View File

@ -89,8 +89,8 @@ protected :
HWND _hList = nullptr; HWND _hList = nullptr;
static RECT _lastKnownLocation; static RECT _lastKnownLocation;
SIZE _szMinButton{}; SIZE _szMinButton = SIZEZERO;
SIZE _szMinListCtrl{}; SIZE _szMinListCtrl = SIZEZERO;
DocTabView* _pTab = nullptr; DocTabView* _pTab = nullptr;
std::vector<int> _idxMap; std::vector<int> _idxMap;
int _currentColumn = -1; int _currentColumn = -1;

View File

@ -120,8 +120,8 @@ intptr_t CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
case IDC_M_RUN_MULTI: case IDC_M_RUN_MULTI:
case IDC_M_RUN_EOF: case IDC_M_RUN_EOF:
{ {
const bool isMulti = (wParam == IDC_M_RUN_MULTI); const bool isRunMulti = (wParam == IDC_M_RUN_MULTI);
if (isMulti) if (isRunMulti)
{ {
::EnableWindow(::GetDlgItem(_hSelf, IDC_M_RUN_TIMES), TRUE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_M_RUN_TIMES), TRUE);
_times = ::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, NULL, FALSE); _times = ::GetDlgItemInt(_hSelf, IDC_M_RUN_TIMES, NULL, FALSE);

View File

@ -249,7 +249,7 @@ int ScintillaKeyMap::addKeyCombo(KeyCombo combo)
for (size_t i = 0; i < _size; ++i) for (size_t i = 0; i < _size; ++i)
{ //if already in the list do not add it { //if already in the list do not add it
KeyCombo & kc = _keyCombos[i]; const KeyCombo& kc = _keyCombos[i];
if (combo._key == kc._key && combo._isCtrl == kc._isCtrl && combo._isAlt == kc._isAlt && combo._isShift == kc._isShift) if (combo._key == kc._key && combo._isCtrl == kc._isCtrl && combo._isAlt == kc._isAlt && combo._isShift == kc._isShift)
return static_cast<int32_t>(i); //already in the list return static_cast<int32_t>(i); //already in the list
} }
@ -291,19 +291,19 @@ void getNameStrFromCmd(DWORD cmd, wstring & str)
{ {
if ((cmd >= ID_MACRO) && (cmd < ID_MACRO_LIMIT)) if ((cmd >= ID_MACRO) && (cmd < ID_MACRO_LIMIT))
{ {
vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList(); const vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList();
int i = cmd - ID_MACRO; int i = cmd - ID_MACRO;
str = string2wstring(theMacros[i].getName(), CP_UTF8); str = string2wstring(theMacros[i].getName(), CP_UTF8);
} }
else if ((cmd >= ID_USER_CMD) && (cmd < ID_USER_CMD_LIMIT)) else if ((cmd >= ID_USER_CMD) && (cmd < ID_USER_CMD_LIMIT))
{ {
vector<UserCommand> & userCommands = (NppParameters::getInstance()).getUserCommandList(); const vector<UserCommand> & userCommands = (NppParameters::getInstance()).getUserCommandList();
int i = cmd - ID_USER_CMD; int i = cmd - ID_USER_CMD;
str = string2wstring(userCommands[i].getName(), CP_UTF8); str = string2wstring(userCommands[i].getName(), CP_UTF8);
} }
else if ((cmd >= ID_PLUGINS_CMD) && (cmd < ID_PLUGINS_CMD_LIMIT)) else if ((cmd >= ID_PLUGINS_CMD) && (cmd < ID_PLUGINS_CMD_LIMIT))
{ {
vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance()).getPluginCommandList(); const vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance()).getPluginCommandList();
size_t i = 0; size_t i = 0;
for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j) for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j)
{ {
@ -635,8 +635,8 @@ void Accelerator::updateShortcuts()
if (nbFindReplaceAcc) if (nbFindReplaceAcc)
{ {
ACCEL* tmpFindAccelArray = new ACCEL[nbFindReplaceAcc]; ACCEL* tmpFindAccelArray = new ACCEL[nbFindReplaceAcc];
for (size_t i = 0; i < nbFindReplaceAcc; ++i) for (size_t j = 0; j < nbFindReplaceAcc; ++j)
tmpFindAccelArray[i] = findReplaceAcc[i]; tmpFindAccelArray[j] = findReplaceAcc[j];
_hFindAccTab = ::CreateAcceleratorTable(tmpFindAccelArray, static_cast<int>(nbFindReplaceAcc)); _hFindAccTab = ::CreateAcceleratorTable(tmpFindAccelArray, static_cast<int>(nbFindReplaceAcc));
delete[] tmpFindAccelArray; delete[] tmpFindAccelArray;
} }
@ -929,7 +929,7 @@ void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND me
void ScintillaAccelerator::updateKeys() void ScintillaAccelerator::updateKeys()
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
vector<ScintillaKeyMap> & map = nppParam.getScintillaKeyList(); const vector<ScintillaKeyMap> & map = nppParam.getScintillaKeyList();
size_t mapSize = map.size(); size_t mapSize = map.size();
size_t index; size_t index;
size_t nb = nbScintillas(); size_t nb = nbScintillas();

View File

@ -294,7 +294,7 @@ struct recordedMacroStep {
recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam); recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam);
explicit recordedMacroStep(int iCommandID): _wParameter(iCommandID) {}; explicit recordedMacroStep(int iCommandID): _wParameter(iCommandID) {};
recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam, const char *sParam, int type) recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam, const char* sParam, int type)
: _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){ : _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){
_sParameter = (sParam) ? std::string(sParam) : ""; _sParameter = (sParam) ? std::string(sParam) : "";
}; };