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(); }
void Clear() { row = col = -1; }
int row; // 0 based.
int col; // 0 based.
int row = -1; // 0 based.
int col = -1; // 0 based.
};
@ -1115,10 +1115,10 @@ protected :
#endif
private:
bool error;
int errorId;
bool error = false;
int errorId = 0;
TIXMLA_STRING errorDesc;
int tabsize;
int tabsize = 4;
TiXmlCursorA errorLocation;
};

View File

@ -1114,10 +1114,10 @@ protected :
#endif
private:
bool error;
int errorId;
bool error = false;
int errorId = 0;
TIXML_STRING errorDesc;
int tabsize;
int tabsize = 4;
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_GILETJAUNE), 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);
::DrawIconEx(pdis->hDC, 0, 0, _hIcon, iconSize, iconSize, 0, nullptr, DI_NORMAL);
return TRUE;
}
@ -332,7 +334,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
HMODULE hNtdllModule = GetModuleHandle(L"ntdll.dll");
if (hNtdllModule)
{
pWGV = (PWINEGETVERSION)GetProcAddress(hNtdllModule, "wine_get_version");
pWGV = reinterpret_cast<PWINEGETVERSION>(GetProcAddress(hNtdllModule, "wine_get_version"));
}
if (pWGV != nullptr)

View File

@ -82,7 +82,7 @@ ClipboardDataInfo ClipboardHistoryPanel::getClipboadData()
return clipboardData;
}
ByteArray::ByteArray(ClipboardDataInfo cd)
ByteArray::ByteArray(const ClipboardDataInfo& cd)
{
_length = cd._data.size();
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();
@ -132,7 +132,7 @@ StringArray::StringArray(ClipboardDataInfo cd, size_t maxLen)
// Search clipboard data in internal storage
// 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;
bool found = false;

View File

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

View File

@ -363,8 +363,8 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
{
if (_isDirty)
{
LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
const LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
const StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
_lsArray = lsa;
_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_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)
{
@ -931,7 +931,7 @@ std::pair<intptr_t, intptr_t> WordStyleDlg::goToPreferencesSettings()
misc
};
Style& style = getCurrentStyler();
const Style& style = getCurrentStyler();
// Global override style
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());
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());
lastIsSep = true;

View File

@ -58,24 +58,6 @@ static LRESULT CALLBACK hookProcMouse(int nCode, WPARAM wParam, LPARAM lParam)
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);
_captionGapDynamic = NppParameters::getInstance()._dpiManager.scaleY(_captionGapDynamic);
_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;
@ -164,13 +146,13 @@ tTbData* DockingCont::createToolbar(tTbData data)
}
void DockingCont::removeToolbar(tTbData TbData)
void DockingCont::removeToolbar(const tTbData& data)
{
// remove from list
// 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)
{
if (_vTbData[iTb]->hClient == TbData.hClient)
if (_vTbData[iTb]->hClient == data.hClient)
{
// remove tab
removeTab(_vTbData[iTb]);
@ -240,9 +222,9 @@ tTbData* DockingCont::getDataOfActiveTb()
if (iItem != -1)
{
TCITEM tcItem = {};
TCITEM tcItem {};
tcItem.mask = TCIF_PARAM;
tcItem.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
pTbData = (tTbData*)tcItem.lParam;
}
@ -253,7 +235,7 @@ tTbData* DockingCont::getDataOfActiveTb()
vector<tTbData*> DockingCont::getDataOfVisTb()
{
vector<tTbData*> vTbData;
TCITEM tcItem = {};
TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM;
@ -268,7 +250,7 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
bool DockingCont::isTbVis(tTbData* data)
{
TCITEM tcItem = {};
TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM;
@ -363,7 +345,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
}
case WM_MOUSEMOVE:
{
POINT pt = {};
POINT pt {};
// get correct cursor position
::GetCursorPos(&pt);
@ -422,8 +404,8 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
}
case WM_MOUSEHOVER:
{
RECT rc = {};
POINT pt = {};
RECT rc {};
POINT pt {};
// get mouse position
@ -468,18 +450,18 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
{
HBRUSH bgbrush = NULL;
HFONT hOldFont = NULL;
RECT rc = pDrawItemStruct->rcItem;
HDC hDc = pDrawItemStruct->hDC;
HPEN hPen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW));
BITMAP bmp = {};
HBITMAP hBmpCur = NULL;
HBITMAP hBmpOld = NULL;
HBITMAP hBmpNew = NULL;
HBRUSH bgbrush = NULL;
HFONT hOldFont = NULL;
RECT rc = pDrawItemStruct->rcItem;
HDC hDc = pDrawItemStruct->hDC;
HPEN hPen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW));
BITMAP bmp {};
HBITMAP hBmpCur = NULL;
HBITMAP hBmpOld = NULL;
HBITMAP hBmpNew = NULL;
int length = static_cast<int32_t>(_pszCaption.length());
int nSavedDC = ::SaveDC(hDc);
int nSavedDC = ::SaveDC(hDc);
// begin with paint
::SetBkMode(hDc, TRANSPARENT);
@ -670,7 +652,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
eMousePos DockingCont::isInRect(HWND hwnd, int x, int y)
{
RECT rc;
RECT rc {};
eMousePos ret = posOutside;
::GetWindowRect(hwnd, &rc);
@ -721,7 +703,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
break;
}
RECT rc{};
RECT rc {};
::GetClientRect(hwnd, &rc);
::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?
RECT rcIntersect = {};
RECT rcIntersect {};
if (IntersectRect(&rcIntersect, &ps.rcPaint, &dis.rcItem))
{
dis.rcItem.top += NppParameters::getInstance()._dpiManager.scaleY(1);
@ -858,9 +840,9 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
}
case WM_MBUTTONUP:
{
int iItem = 0;
TCITEM tcItem = {};
TCHITTESTINFO info = {};
int iItem = 0;
TCITEM tcItem {};
TCHITTESTINFO info {};
// get selected sub item
info.pt.x = LOWORD(lParam);
@ -925,8 +907,8 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
}
else if (iItem != _iLastHovered)
{
TCITEM tcItem = {};
RECT rc = {};
TCITEM tcItem {};
RECT rc {};
// destroy old tooltip
toolTip.destroy();
@ -955,10 +937,10 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
case WM_MOUSEHOVER:
{
int iItem = 0;
TCITEM tcItem = {};
RECT rc = {};
TCHITTESTINFO info = {};
int iItem = 0;
TCITEM tcItem {};
RECT rc {};
TCHITTESTINFO info {};
// get selected sub item
info.pt.x = LOWORD(lParam);
@ -1032,11 +1014,11 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
{
TCITEM tcItem = {};
RECT rc = pDrawItemStruct->rcItem;
TCITEM tcItem {};
RECT rc = pDrawItemStruct->rcItem;
int nTab = pDrawItemStruct->itemID;
bool isSelected = (nTab == getActiveTb());
int nTab = pDrawItemStruct->itemID;
bool isSelected = (nTab == getActiveTb());
// get current selected item
tcItem.mask = TCIF_PARAM;
@ -1045,7 +1027,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
return;
const TCHAR *text = reinterpret_cast<tTbData*>(tcItem.lParam)->pszName;
int length = lstrlen(reinterpret_cast<tTbData*>(tcItem.lParam)->pszName);
int length = lstrlen(reinterpret_cast<tTbData*>(tcItem.lParam)->pszName);
// get drawing context
@ -1094,8 +1076,8 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
if ((hImageList != NULL) && (iPosImage >= 0))
{
// Get height of image so we
IMAGEINFO info = {};
RECT & imageRect = info.rcImage;
IMAGEINFO info {};
const RECT& imageRect = info.rcImage;
ImageList_GetImageInfo(hImageList, iPosImage, &info);
@ -1177,7 +1159,7 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{
break;
}
RECT rc{};
RECT rc {};
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
@ -1210,9 +1192,9 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
}
case WM_NCLBUTTONDBLCLK :
{
RECT rcWnd = {};
RECT rcClient = {};
POINT pt = {HIWORD(lParam), LOWORD(lParam)};
RECT rcWnd {};
RECT rcClient {};
POINT pt = {HIWORD(lParam), LOWORD(lParam)};
getWindowRect(rcWnd);
getClientRect(rcClient);
@ -1261,9 +1243,9 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
void DockingCont::onSize()
{
TCITEM tcItem = {};
RECT rc = {};
RECT rcTemp = {};
TCITEM tcItem {};
RECT rc {};
RECT rcTemp {};
UINT iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
UINT iTabOff = 0;
@ -1394,31 +1376,29 @@ void DockingCont::onSize()
void DockingCont::doClose(BOOL closeAll)
{
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
// Always close active tab first
int iItemCur = getActiveTb();
TCITEM tcItem = {};
tcItem.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItemCur, reinterpret_cast<LPARAM>(&tcItem));
if (tcItem.lParam)
TCITEM item {};
item.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItemCur, reinterpret_cast<LPARAM>(&item));
if (item.lParam)
{
// notify child windows
if (NotifyParent(DMM_CLOSE) == 0)
{
// delete tab
hideToolbar((tTbData*)tcItem.lParam);
hideToolbar((tTbData*)item.lParam);
}
}
// Close all other tabs if requested
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;
for (int iItem = 0; iItem < iItemCnt; ++iItem)
for (int iItem = 0; iItem < nbItem; ++iItem)
{
TCITEM tcItem = {};
TCITEM tcItem {};
// get item data
selectTab(iItemOff);
tcItem.mask = TCIF_PARAM;
@ -1440,7 +1420,7 @@ void DockingCont::doClose(BOOL closeAll)
}
// 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)
{
// hide dialog first
@ -1516,7 +1496,7 @@ int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
void DockingCont::viewToolbar(tTbData *pTbData)
{
TCITEM tcItem = {};
TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
if (iItemCnt > 0)
@ -1563,7 +1543,7 @@ void DockingCont::viewToolbar(tTbData *pTbData)
int DockingCont::searchPosInTab(tTbData* pTbData)
{
TCITEM tcItem = {};
TCITEM tcItem {};
int iItemCnt = static_cast<int32_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
tcItem.mask = TCIF_PARAM;
@ -1585,7 +1565,7 @@ void DockingCont::selectTab(int iTab)
if (iTab != -1)
{
const TCHAR *pszMaxTxt = NULL;
TCITEM tcItem = {};
TCITEM tcItem {};
SIZE size = {};
int maxWidth = 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);
// Notify switch in
NMHDR nmhdr{};
nmhdr.code = DMN_SWITCHIN;
nmhdr.hwndFrom = _hSelf;
nmhdr.idFrom = 0;
::SendMessage(reinterpret_cast<tTbData*>(tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast<LPARAM>(&nmhdr));
NMHDR nmhdrIn{};
nmhdrIn.code = DMN_SWITCHIN;
nmhdrIn.hwndFrom = _hSelf;
nmhdrIn.idFrom = 0;
::SendMessage(reinterpret_cast<tTbData*>(tcItem.lParam)->hClient, WM_NOTIFY, nmhdrIn.idFrom, reinterpret_cast<LPARAM>(&nmhdrIn));
if (static_cast<unsigned int>(iTab) != _prevItem)
{
@ -1617,11 +1597,11 @@ void DockingCont::selectTab(int iTab)
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
// Notify switch off
NMHDR nmhdr{};
nmhdr.code = DMN_SWITCHOFF;
nmhdr.hwndFrom = _hSelf;
nmhdr.idFrom = 0;
::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast<LPARAM>(&nmhdr));
NMHDR nmhdrOff{};
nmhdrOff.code = DMN_SWITCHOFF;
nmhdrOff.hwndFrom = _hSelf;
nmhdrOff.idFrom = 0;
::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdrOff.idFrom, reinterpret_cast<LPARAM>(&nmhdrOff));
}
// resize tab item
@ -1681,8 +1661,8 @@ bool DockingCont::updateCaption()
if (!_hContTab)
return false;
TCITEM tcItem = {};
int iItem = getActiveTb();
TCITEM tcItem {};
int iItem = getActiveTb();
if (iItem < 0)
return false;
@ -1717,8 +1697,8 @@ bool DockingCont::updateCaption()
void DockingCont::focusClient()
{
TCITEM tcItem = {};
int iItem = getActiveTb();
TCITEM tcItem {};
int iItem = getActiveTb();
if (iItem != -1)
{

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ protected :
void doTabReordering(POINT pt);
void drawRectangle(const POINT* pPt);
void getMousePoints(POINT* pt, POINT* ptPrev);
void getMousePoints(const POINT& pt, POINT& ptPrev);
void getMovingRect(POINT pt, RECT *rc);
DockingCont * contHitTest(POINT pt);
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());
}
Buffer *buf = _pPeekerView->getCurrentBuffer();
_pPeekerView->defineDocType(buf->getLangType());
_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);
if (temp == nullptr)
{
SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(_treeView.getItemParam(parent));
const SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(_treeView.getItemParam(parent));
folderName = customData->_rootPath;
}
parent = temp;
@ -750,7 +750,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
{
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)
return;

View File

@ -366,7 +366,7 @@ void FunctionListPanel::reload()
udln = currentBuf->getUserDefineLangName();
}
TCHAR *ext = ::PathFindExtension(fn);
const wchar_t* ext = ::PathFindExtension(fn);
bool parsedOK = _funcParserMgr.parse(_foundFuncInfos, AssociationInfo(-1, langID, ext, udln));
if (parsedOK)
@ -429,7 +429,7 @@ void FunctionListPanel::reload()
void FunctionListPanel::initPreferencesMenu()
{
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);
@ -546,8 +546,6 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
}
else
{
generic_string funcListDefaultXmlPath = nppParams.getNppPath();
pathAppend(funcListDefaultXmlPath, TEXT("functionList"));
if (PathFileExists(funcListDefaultXmlPath.c_str()))
{
_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)
{
@ -708,7 +708,7 @@ void FunctionUnitParser::parse(std::vector<foundInfo> & foundInfos, size_t begin
// sort in _selLpos : increased order
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);
}

View File

@ -48,7 +48,7 @@ protected:
std::vector<generic_string> _functionNameExprArray;
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 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);
};
@ -61,7 +61,7 @@ public:
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) {};
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:
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)
{}
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
@ -99,7 +99,7 @@ public:
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:
FunctionUnitParser* _funcUnitPaser = nullptr;

View File

@ -68,7 +68,7 @@ bool IconList::changeIcon(size_t index, const TCHAR *iconLocation) const
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)
_tbiis.push_back(buttonUnitArray[i]);

View File

@ -96,7 +96,7 @@ class ToolBarIcons
public :
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 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
{
PluginUpdateInfo* pui = inWhichList.getPluginInfoFromUiIndex(index);
const PluginUpdateInfo* pui = inWhichList.getPluginInfoFromUiIndex(index);
generic_string searchIn;
if (inWhichPart == _inNames)
searchIn = pui->_displayName;
@ -412,7 +412,7 @@ bool PluginViewList::removeFromFolderName(const generic_string& folderName)
for (size_t i = 0; i < _ui.nbItem(); ++i)
{
PluginUpdateInfo* pi = getPluginInfoFromUiIndex(i);
const PluginUpdateInfo* pi = getPluginInfoFromUiIndex(i);
if (pi->_folderName == folderName)
{
if (!_ui.removeFromIndex(i))
@ -577,11 +577,11 @@ bool loadFromJson(std::vector<PluginUpdateInfo*>& pl, wstring& verStr, const jso
pi->_oldVersionCompatibility = getTwoIntervalVersions(oldVerCompatibilityStr);
}
}
catch (const wstring& s)
catch (const wstring& exceptionStr)
{
wstring msg = pi->_displayName;
msg += L": ";
throw msg + s;
throw msg + exceptionStr;
}
valStr = i.at("repository").get<std::string>();
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);
}
#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;
}
@ -1239,7 +1239,7 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
pnmh->hwndFrom == _installedList.getViewHwnd() ||
pnmh->hwndFrom == _incompatibleList.getViewHwnd())
{
PluginViewList* pViewList = nullptr;
const PluginViewList* pViewList = nullptr;
int buttonID = 0;
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 :
{
ScintillaViewParams & svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
switch (wParam)
{
case IDC_CHECK_SMOOTHFONT:
@ -5275,21 +5274,21 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
nppGUI._cloudPath = inputDirExpanded;
nppParams.setCloudChoice(inputDirExpanded);
generic_string message;
generic_string warningMsg;
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
{
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
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();
}
}
@ -5312,17 +5311,17 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{
case WM_INITDIALOG:
{
generic_string message = TEXT("");
generic_string errMsg = TEXT("");
bool withCloud = nppGUI._cloudPath != TEXT("");
if (withCloud)
{
// detect validation of path
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_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("");
nppParams.removeCloudChoice();
generic_string message;
generic_string warningMsg;
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
::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()));
::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:
{
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
generic_string errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), 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:
{
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings"));
folderBrowser(_hSelf, message, IDC_CLOUDPATH_EDIT);
generic_string warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings"));
folderBrowser(_hSelf, warningMsg, IDC_CLOUDPATH_EDIT);
}
break;

View File

@ -1250,8 +1250,6 @@ void ProjectPanel::addFiles(HTREEITEM hTreeItem)
void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTreeItem)
{
bool isRecursive = true;
bool isInHiddenDir = false;
generic_string dirFilter(folderPath);
if (folderPath[lstrlen(folderPath)-1] != '\\')
dirFilter += TEXT("\\");
@ -1268,11 +1266,11 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre
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
}
else if (isRecursive)
else // Always recursive
{
if ((OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT(".")) != 0) && (OrdinalIgnoreCaseCompareStrings(foundData.cFileName, TEXT("..")) != 0))
{

View File

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

View File

@ -41,13 +41,8 @@ namespace ReadDirectoryChangesPrivate
// CReadChangesRequest
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));
// The hEvent member is not used when there is a completion

View File

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

View File

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

View File

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

View File

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

View File

@ -721,7 +721,7 @@ void Splitter::adjustZoneToDraw(RECT& rc2def, ZONE_TYPE whichZone)
int x0, y0, x1, y1, w, h;
if ((4 <= _splitterSize) && (_splitterSize <= 8))
if (/*(4 <= _splitterSize) && */(_splitterSize <= 8))
{
w = (isVertical() ? 4 : 7);
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)));
::InsertMenu(hRunMenu, posBase + nbTopLevelItem, MF_BYPOSITION, cmdID, string2wstring(uc.toMenuItemString(), CP_UTF8).c_str());
NppParameters& nppParams = NppParameters::getInstance();
if (nbTopLevelItem == 0)
{
// Insert the separator and modify/delete command

View File

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

View File

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

View File

@ -225,7 +225,7 @@ LRESULT TaskList::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_GETDLGCODE :
{
MSG *msg = (MSG*)lParam;
const MSG *msg = (MSG*)lParam;
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.hwndFrom = _hSelf;
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;
::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.iGroupId = (fileNameStatus._iView == MAIN_VIEW) ? _groupID : _group2ID;
ListView_InsertItem(_hSelf, &item);
int colIndex = 0;
int colIndex2 = 0;
if (isExtColumn)
{
ListView_SetItemText(_hSelf, i, ++colIndex, ::PathFindExtension(fileNameStatus._fn.c_str()));
ListView_SetItemText(_hSelf, i, ++colIndex2, ::PathFindExtension(fileNameStatus._fn.c_str()));
}
if (isPathColumn)
{
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);
wcscat_s(drive, dir);
ListView_SetItemText(_hSelf, i, ++colIndex, drive);
ListView_SetItemText(_hSelf, i, ++colIndex2, drive);
}
}
_currentIndex = taskListInfo._currentIndex;
@ -294,7 +294,7 @@ generic_string VerticalFileSwitcherListView::getFullFilePath(size_t i) const
item.mask = LVIF_PARAM;
item.iItem = static_cast<int32_t>(i);
ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
const TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
return tlfs->_fn;
}
@ -330,7 +330,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
_currentIndex = ListView_GetItemCount(_hSelf);
Buffer *buf = bufferID;
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);
TCHAR fn[MAX_PATH] = { '\0' };
@ -412,7 +412,7 @@ int VerticalFileSwitcherListView::find(BufferID bufferID, int iView) const
item.mask = LVIF_PARAM;
item.iItem = i;
ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
const TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
if (tlfs->_bufID == bufferID && tlfs->_iView == iView)
{
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
if (wrc->Type() == WRCT_REST) {
// for REST type, use all remaining space
RECT& rc = wrc->GetRect();
const RECT& rc = wrc->GetRect();
hw = hwRemaining + (bRow ? RectHeight(rc) : RectWidth(rc));
}
@ -317,7 +317,7 @@ CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, HWND hWnd)
// not a group
WINRECT* parent = wrc->Parent();
assert(parent);
RECT& rcParent = parent->GetRect();
const RECT& rcParent = parent->GetRect();
BOOL bRow = parent->IsRowGroup();
int hw, hwMin, hwTotal, pct;

View File

@ -109,7 +109,7 @@ protected:
public:
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* 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
// 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);

View File

@ -242,8 +242,6 @@ RECT WindowsDlg::_lastKnownLocation;
WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap)
{
_szMinButton = SIZEZERO;
_szMinListCtrl = SIZEZERO;
}
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
{
NMLISTVIEW *pNMLV = (NMLISTVIEW *)pNMHDR;
const NMLISTVIEW *pNMLV = (NMLISTVIEW *)pNMHDR;
if (pNMLV->iItem == -1)
{
_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)
{
NMLVKEYDOWN *lvkd = (NMLVKEYDOWN *)pNMHDR;
const NMLVKEYDOWN *lvkd = (NMLVKEYDOWN *)pNMHDR;
short ctrl = GetKeyState(VK_CONTROL);
short alt = GetKeyState(VK_MENU);
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
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];
_idxMap[*kitr] = -1;
@ -1034,15 +1032,13 @@ void WindowsDlg::refreshMap()
if (count == oldSize)
return;
if (count != oldSize)
{
size_t lo = 0;
_idxMap.resize(count);
if (oldSize < count)
lo = oldSize;
for (size_t i = lo; i < count; ++i)
_idxMap[i] = int(i);
}
size_t lo = 0;
_idxMap.resize(count);
if (oldSize < count)
lo = oldSize;
for (size_t i = lo; i < count; ++i)
_idxMap[i] = int(i);
}
void WindowsDlg::doSortToTabs()

View File

@ -89,8 +89,8 @@ protected :
HWND _hList = nullptr;
static RECT _lastKnownLocation;
SIZE _szMinButton{};
SIZE _szMinListCtrl{};
SIZE _szMinButton = SIZEZERO;
SIZE _szMinListCtrl = SIZEZERO;
DocTabView* _pTab = nullptr;
std::vector<int> _idxMap;
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_EOF:
{
const bool isMulti = (wParam == IDC_M_RUN_MULTI);
if (isMulti)
const bool isRunMulti = (wParam == IDC_M_RUN_MULTI);
if (isRunMulti)
{
::EnableWindow(::GetDlgItem(_hSelf, IDC_M_RUN_TIMES), TRUE);
_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)
{ //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)
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))
{
vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList();
const vector<MacroShortcut> & theMacros = (NppParameters::getInstance()).getMacroList();
int i = cmd - ID_MACRO;
str = string2wstring(theMacros[i].getName(), CP_UTF8);
}
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;
str = string2wstring(userCommands[i].getName(), CP_UTF8);
}
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;
for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j)
{
@ -635,8 +635,8 @@ void Accelerator::updateShortcuts()
if (nbFindReplaceAcc)
{
ACCEL* tmpFindAccelArray = new ACCEL[nbFindReplaceAcc];
for (size_t i = 0; i < nbFindReplaceAcc; ++i)
tmpFindAccelArray[i] = findReplaceAcc[i];
for (size_t j = 0; j < nbFindReplaceAcc; ++j)
tmpFindAccelArray[j] = findReplaceAcc[j];
_hFindAccTab = ::CreateAcceleratorTable(tmpFindAccelArray, static_cast<int>(nbFindReplaceAcc));
delete[] tmpFindAccelArray;
}
@ -929,7 +929,7 @@ void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND me
void ScintillaAccelerator::updateKeys()
{
NppParameters& nppParam = NppParameters::getInstance();
vector<ScintillaKeyMap> & map = nppParam.getScintillaKeyList();
const vector<ScintillaKeyMap> & map = nppParam.getScintillaKeyList();
size_t mapSize = map.size();
size_t index;
size_t nb = nbScintillas();

View File

@ -294,7 +294,7 @@ struct recordedMacroStep {
recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam);
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)){
_sParameter = (sParam) ? std::string(sParam) : "";
};