From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/TopToolBar/src/InternalButtons.cpp | 14 +++--- plugins/TopToolBar/src/toolbar.cpp | 70 +++++++++++++++--------------- plugins/TopToolBar/src/toolbarwnd.cpp | 22 +++++----- plugins/TopToolBar/src/topbutton.cpp | 6 +-- plugins/TopToolBar/src/ttbopt.cpp | 44 +++++++++---------- 5 files changed, 78 insertions(+), 78 deletions(-) (limited to 'plugins/TopToolBar') diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 5855153e75..c4171d781d 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -13,7 +13,7 @@ HANDLE hMainMenu, hOptions, hAccManager, hFindAdd, hStatusMenu, hShowHideOffline int OnSettingChanging(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; - if (hContact != 0 || dbcws == NULL) + if (hContact != 0 || dbcws == nullptr) return 0; if (!strcmp(dbcws->szModule, "CList")) { @@ -38,7 +38,7 @@ INT_PTR TTBInternalMainMenuButt(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -46,7 +46,7 @@ INT_PTR TTBInternalStatusMenuButt(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -67,7 +67,7 @@ void InitInternalButtons() CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt); CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt); - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.name = LPGEN("Show main menu"); ttb.pszService = TTBI_MAINMENUBUTT; ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE; @@ -110,7 +110,7 @@ void InitInternalButtons() ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON; ttb.pszTooltipDn = LPGEN("Show offline contacts"); ttb.pszTooltipUp = LPGEN("Hide offline contacts"); - ttb.hIconHandleDn = ttb.hIconHandleUp = NULL; + ttb.hIconHandleDn = ttb.hIconHandleUp = nullptr; ttb.hIconUp = IcoLib_GetIconByHandle(iconList[1].hIcolib); ttb.hIconDn = IcoLib_GetIconByHandle(iconList[2].hIcolib); hShowHideOffline = TopToolbar_AddButton(&ttb); @@ -147,8 +147,8 @@ void InitInternalButtons() ttb.dwFlags = TTBBF_INTERNAL | TTBBF_VISIBLE; ttb.pszTooltipUp = LPGEN("Minimize contact list"); ttb.hIconHandleUp = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE); - ttb.pszTooltipDn = NULL; - ttb.hIconUp = ttb.hIconDn = NULL; + ttb.pszTooltipDn = nullptr; + ttb.hIconUp = ttb.hIconDn = nullptr; hMinimize = TopToolbar_AddButton(&ttb); ttb.name = LPGEN("Exit"); diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 392cbe1fbe..2bf222f327 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -1,13 +1,13 @@ #include "stdafx.h" -pfnCustomProc g_CustomProc = NULL; +pfnCustomProc g_CustomProc = nullptr; LPARAM g_CustomProcParam = 0; -TTBCtrl *g_ctrl = NULL; +TTBCtrl *g_ctrl = nullptr; void CALLBACK OnEventFire(); -HWND hwndContactList = 0; +HWND hwndContactList = nullptr; int nextButtonId = 200; @@ -34,13 +34,13 @@ TopButtonInt *idtopos(int id, int *pPos) if (pPos) *pPos = -1; - return NULL; + return nullptr; } //----- Service buttons ----- void InsertSBut(int i) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSBUTTON | TTBBF_INTERNAL; @@ -65,7 +65,7 @@ INT_PTR LaunchService(WPARAM, LPARAM lParam) STARTUPINFO si = {0}; si.cb = sizeof(si); - if (CreateProcess(NULL, Buttons[lParam]->ptszProgram, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + if (CreateProcess(nullptr, Buttons[lParam]->ptszProgram, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) { CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } @@ -75,7 +75,7 @@ INT_PTR LaunchService(WPARAM, LPARAM lParam) void InsertLBut(int i) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL; ttb.name = LPGEN("Default"); @@ -95,7 +95,7 @@ void LoadAllLButs() //----- Separators ----- void InsertSeparator(int i) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL; ttb.wParamDown = i; TTBAddButton((WPARAM)&ttb, 0); @@ -125,7 +125,7 @@ int SaveAllButtonsOptions() static bool nameexists(const char *name) { - if (name == NULL) + if (name == nullptr) return false; for (int i = 0; i < Buttons.getCount(); i++) @@ -138,8 +138,8 @@ static bool nameexists(const char *name) static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsUp) { HANDLE hSrc = bIsUp ? but->hIconHandleUp : but->hIconHandleDn; - if (hSrc == NULL) { - hIcoLib = NULL, hIcon = NULL; + if (hSrc == nullptr) { + hIcoLib = nullptr, hIcon = nullptr; return; } @@ -148,10 +148,10 @@ static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsU char buf[256]; mir_snprintf(buf, "toptoolbar_%s%s", but->name, bIsUp ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn"); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.section.a = "Toolbar"; sid.pszName = buf; - sid.defaultFile.a = NULL; + sid.defaultFile.a = nullptr; mir_snprintf(buf, "%s%s", but->name, bIsUp ? "" : " (pressed)"); sid.description.a = buf; sid.hDefaultIcon = bIsUp ? but->hIconUp : but->hIconDn; @@ -181,7 +181,7 @@ TopButtonInt *CreateButton(TTBButton *but) b->pszService = mir_strdup(TTB_LAUNCHSERVICE); } else { - b->ptszProgram = NULL; + b->ptszProgram = nullptr; b->pszService = mir_strdup(but->pszService); } @@ -229,7 +229,7 @@ int ArrangeButtons() for (i = iFirstButtonId; i < Buttons.getCount(); i++) { TopButtonInt *b = Buttons[i]; - if (b->hwnd == NULL) + if (b->hwnd == nullptr) continue; int width = 0; @@ -245,7 +245,7 @@ int ArrangeButtons() for (i = iFirstButtonId; i < iLastButtonId; i++) { TopButtonInt *b = Buttons[i]; - if (b->hwnd == NULL) + if (b->hwnd == nullptr) continue; bool bOldVisible = IsWindowVisible(b->hwnd) != 0; @@ -253,15 +253,15 @@ int ArrangeButtons() g_ctrl->bOrderChanged = TRUE; if (b->isVisible()) { - if (NULL != b->hwnd) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, b->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); + if (nullptr != b->hwnd) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, b->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); if (b->isSep()) nextX += SEPWIDTH + 2; else nextX += g_ctrl->nButtonWidth + g_ctrl->nButtonSpace; } else { - if (NULL != Buttons[i]->hwnd) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW); + if (nullptr != Buttons[i]->hwnd) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW); } } @@ -276,8 +276,8 @@ int ArrangeButtons() } while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top))); for (i = iLastButtonId; i < Buttons.getCount(); i++) { - if (NULL != Buttons[i]->hwnd) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW); + if (nullptr != Buttons[i]->hwnd) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW); } if (hdwp) @@ -304,7 +304,7 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) b->hLangpack = (int)lParam; b->LoadSettings(); b->CreateWnd(); - if (b->hwnd == NULL) { + if (b->hwnd == nullptr) { delete b; return -1; } @@ -325,7 +325,7 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM) int idx; TopButtonInt *b = idtopos(wParam, &idx); - if (b == NULL) + if (b == nullptr) return -1; RemoveFromOptions(b->id); @@ -345,7 +345,7 @@ INT_PTR TTBSetState(WPARAM wParam, LPARAM lParam) mir_cslock lck(csButtonsHook); TopButtonInt *b = idtopos(wParam); - if (b == NULL) + if (b == nullptr) return -1; b->bPushed = (lParam & TTBST_PUSHED) != 0; @@ -360,7 +360,7 @@ INT_PTR TTBGetState(WPARAM wParam, LPARAM) { mir_cslock lck(csButtonsHook); TopButtonInt *b = idtopos(wParam); - if (b == NULL) + if (b == nullptr) return -1; return ((b->bPushed == TRUE) ? TTBST_PUSHED : 0); @@ -370,7 +370,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) { mir_cslock lck(csButtonsHook); TopButtonInt *b = idtopos(wParam); - if (b == NULL) + if (b == nullptr) return -1; switch (LOWORD(wParam)) { @@ -417,7 +417,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) { mir_cslock lck(csButtonsHook); TopButtonInt *b = idtopos(HIWORD(wParam)); - if (b == NULL) + if (b == nullptr) return -1; switch (LOWORD(wParam)) { @@ -431,7 +431,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) b->SetBitmap(); if (retval & TTBBF_VISIBLE) { ArrangeButtons(); - b->SaveSettings(0, 0); + b->SaveSettings(nullptr, nullptr); } return 1; @@ -463,7 +463,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) if (retval & TTBBF_VISIBLE) { ArrangeButtons(); - b->SaveSettings(0, 0); + b->SaveSettings(nullptr, nullptr); } if (b->dwFlags & TTBBF_ISLBUTTON) @@ -590,11 +590,11 @@ static int OnShutdown(WPARAM, LPARAM) if (g_ctrl) { if (g_ctrl->hFrame) { CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)g_ctrl->hFrame, 0); - g_ctrl->hFrame = 0; + g_ctrl->hFrame = nullptr; } if (g_ctrl->hWnd) { DestroyWindow(g_ctrl->hWnd); - g_ctrl->hWnd = NULL; + g_ctrl->hWnd = nullptr; } } @@ -620,7 +620,7 @@ int LoadToolbarModule() { if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { if (!db_get_b(NULL, TTB_OPTDIR, "WarningDone", 0)) - MessageBox(0, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- Clist nicer\nYou can get them at https://wiki.miranda-ng.org/Download"), TranslateT("TopToolBar"), 0); + MessageBox(nullptr, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- Clist nicer\nYou can get them at https://wiki.miranda-ng.org/Download"), TranslateT("TopToolBar"), 0); db_set_b(NULL, TTB_OPTDIR, "WarningDone", 1); return 1; } @@ -664,9 +664,9 @@ int LoadToolbarModule() wc.cbSize = sizeof(wc); wc.lpszClassName = TTB_BUTTON_CLASS; wc.lpfnWndProc = TTBButtonWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(void *); - wc.hbrBackground = 0; + wc.hbrBackground = nullptr; wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); return 0; diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 2a73eb86ad..40bc4cf571 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -12,7 +12,7 @@ static wchar_t pluginname[] = L"TopToolBar"; static void PaintToolbar(HWND hwnd) { - InvalidateRect(hwnd, 0, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); PAINTSTRUCT paintst; HDC hdc = BeginPaint(hwnd, &paintst); @@ -24,7 +24,7 @@ static void PaintToolbar(HWND hwnd) int yScroll = 0; HDC hdcMem = CreateCompatibleDC(hdc); - HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr); HBITMAP hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb); SetBkMode(hdcMem, TRANSPARENT); @@ -122,7 +122,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return FALSE; case WM_DESTROY: - g_ctrl->hWnd = NULL; + g_ctrl->hWnd = nullptr; break; case WM_MOVE: @@ -178,7 +178,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (id != 0) { mir_cslock lck(csButtonsHook); TopButtonInt* b = idtopos(id); - if (b == NULL || b->isSep()) + if (b == nullptr || b->isSep()) return 0; if (b->dwFlags & TTBBF_ASPUSHBUTTON) @@ -186,11 +186,11 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara if (b->bPushed) { //Dn -> Up if (!(b->dwFlags & TTBBF_ISLBUTTON)) // must be always true - if (b->pszService != NULL) + if (b->pszService != nullptr) CallService(b->pszService, b->wParamUp, b->lParamUp); } else { //Up -> Dn - if (b->pszService != NULL) + if (b->pszService != nullptr) CallService(b->pszService, b->wParamDown, b->lParamDown); } @@ -241,14 +241,14 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara void CALLBACK OnEventFire() { HWND parent = pcli->hwndContactList; - if (parent == NULL) // no clist, no buttons + if (parent == nullptr) // no clist, no buttons return; WNDCLASS wndclass = {0}; wndclass.lpfnWndProc = TopToolBarProc; wndclass.cbWndExtra = sizeof(void *); wndclass.hInstance = hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndclass.lpszClassName = pluginname; RegisterClass(&wndclass); @@ -256,7 +256,7 @@ void CALLBACK OnEventFire() g_ctrl->pButtonList = (SortedList *)&Buttons; g_ctrl->hWnd = CreateWindow(pluginname, L"Toolbar", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - 0, 0, 0, g_ctrl->nLastHeight, parent, NULL, hInst, NULL); + 0, 0, 0, g_ctrl->nLastHeight, parent, nullptr, hInst, nullptr); SetWindowLongPtr(g_ctrl->hWnd, 0, (LONG_PTR)g_ctrl); LoadBackgroundOptions(); @@ -268,7 +268,7 @@ void CALLBACK OnEventFire() InitInternalButtons(); // if there's no customized frames, create our own - if (g_ctrl->hFrame == NULL) { + if (g_ctrl->hFrame == nullptr) { CLISTFrame Frame = { sizeof(Frame) }; Frame.tname = L"Toolbar"; Frame.hWnd = g_ctrl->hWnd; @@ -290,7 +290,7 @@ int LoadBackgroundOptions() bkColour = db_get_dw(NULL, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR); if (hBmpBackground) { DeleteObject(hBmpBackground); - hBmpBackground = NULL; + hBmpBackground = nullptr; } if (db_get_b(NULL, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) { diff --git a/plugins/TopToolBar/src/topbutton.cpp b/plugins/TopToolBar/src/topbutton.cpp index 4faef0753d..b16bdd84f7 100644 --- a/plugins/TopToolBar/src/topbutton.cpp +++ b/plugins/TopToolBar/src/topbutton.cpp @@ -13,7 +13,7 @@ TopButtonInt::~TopButtonInt() if (dwFlags & TTBBF_ISLBUTTON) { mir_free(ptszProgram); } - else if (pszService != NULL) + else if (pszService != nullptr) mir_free(pszService); mir_free(pszName); @@ -53,7 +53,7 @@ DWORD TopButtonInt::CheckFlags(DWORD Flags) void TopButtonInt::CreateWnd() { if (!(dwFlags & TTBBF_ISSEPARATOR)) { - hwnd = CreateWindow(TTB_BUTTON_CLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, this); + hwnd = CreateWindow(TTB_BUTTON_CLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, nullptr, hInst, this); if (dwFlags & TTBBF_ASPUSHBUTTON) SendMessage(hwnd, BUTTONSETASPUSHBTN, 1, 0); @@ -65,7 +65,7 @@ void TopButtonInt::CreateWnd() } // maybe SEPWIDTH, not g_ctrl->nButtonWidth? else - hwnd = CreateWindow(L"STATIC", L"", WS_CHILD | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, 0); + hwnd = CreateWindow(L"STATIC", L"", WS_CHILD | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, nullptr, hInst, nullptr); SetWindowLongPtr(hwnd, GWLP_USERDATA, id); SetBitmap(); diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index 4f0c2b3c93..843db24ac6 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -13,7 +13,7 @@ struct OrderData static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.hInsertAfter = hItem; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; @@ -23,7 +23,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST if (b->dwFlags & TTBBF_ISSEPARATOR) { tvis.item.pszText = L"------------------"; index = -1; - tmp = 0; + tmp = nullptr; } else { if (b->hIconHandleUp) { @@ -77,7 +77,7 @@ static void SaveTree(HWND hwndDlg) LIST tmpList(8); - while(tvi.hItem != NULL) { + while(tvi.hItem != nullptr) { TreeView_GetItem(hTree, &tvi); TopButtonInt* btn = (TopButtonInt*)tvi.lParam; @@ -110,7 +110,7 @@ void CancelProcess(HWND hwndDlg) TVITEM tvi = { 0 }; tvi.hItem = TreeView_GetRoot(hTree); - while(tvi.hItem != NULL) { + while(tvi.hItem != nullptr) { tvi.stateMask = TVIS_STATEIMAGEMASK; tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE; TreeView_GetItem(hTree, &tvi); @@ -165,7 +165,7 @@ void RemoveFromOptions(int id) tvi.mask = TVIF_PARAM | TVIF_HANDLE; TopButtonInt* btn; - while(tvi.hItem != NULL) { + while(tvi.hItem != nullptr) { TreeView_GetItem(hTree, &tvi); btn = (TopButtonInt*)tvi.lParam; if (btn->id == id) { @@ -245,8 +245,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetDlgItemText(hwndDlg, IDC_EPATH, str, _countof(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - ofn.lpstrFilter = NULL; + ofn.hInstance = nullptr; + ofn.lpstrFilter = nullptr; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER; ofn.nMaxFile = _countof(str); @@ -265,7 +265,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_LBUTTONSET) { TVITEM tvi ={0}; tvi.hItem = TreeView_GetSelection(hTree); - if (tvi.hItem == NULL) + if (tvi.hItem == nullptr) break; tvi.mask = TVIF_PARAM; @@ -277,11 +277,11 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (btn->dwFlags & TTBBF_ISLBUTTON) { if (!(btn->dwFlags & TTBBF_OPTIONAL)) { // create button - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL; - ttb.name = NULL; - ttb.program = NULL; + ttb.name = nullptr; + ttb.program = nullptr; int id = btn->id; btn = CreateButton(&ttb); btn->id = id; @@ -305,7 +305,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDLBUTTON) { // create button - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL; ttb.name = LPGEN("Default"); @@ -327,7 +327,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDSEP) { // create button - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL | TTBBF_OPTIONAL; TopButtonInt* b = CreateButton(&ttb); @@ -345,7 +345,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_REMOVEBUTTON) { TVITEM tvi = {0}; tvi.hItem = TreeView_GetSelection(hTree); - if (tvi.hItem == NULL) + if (tvi.hItem == nullptr) break; tvi.mask = TVIF_PARAM; @@ -373,9 +373,9 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - g_ctrl->nButtonHeight = GetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, NULL, FALSE); - g_ctrl->nButtonWidth = GetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, NULL, FALSE); - g_ctrl->nButtonSpace = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, NULL, FALSE); + g_ctrl->nButtonHeight = GetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, nullptr, FALSE); + g_ctrl->nButtonWidth = GetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, nullptr, FALSE); + g_ctrl->nButtonSpace = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, nullptr, FALSE); g_ctrl->bFlatButtons = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USEFLAT); g_ctrl->bAutoSize = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTORESIZE); @@ -421,7 +421,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case TVN_SELCHANGED: { HTREEITEM hti = TreeView_GetSelection(hTree); - if (hti == NULL) + if (hti == nullptr) break; TopButtonInt *btn = (TopButtonInt*)((LPNMTREEVIEW)lParam)->itemNew.lParam; @@ -434,12 +434,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), enable); EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), enable); EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), enable); - if (btn->pszName != NULL) + if (btn->pszName != nullptr) SetDlgItemTextA(hwndDlg, IDC_ENAME, btn->pszName); else SetDlgItemTextA(hwndDlg, IDC_ENAME, ""); - if (btn->ptszProgram != NULL) + if (btn->ptszProgram != nullptr) SetDlgItemText(hwndDlg, IDC_EPATH, btn->ptszProgram); else SetDlgItemTextA(hwndDlg, IDC_EPATH, ""); @@ -518,7 +518,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_GetItem(hTree, &tvis.item); TreeView_DeleteItem(hTree, dat->hDragItem); - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = hti.hItem; TreeView_SelectItem(hTree, TreeView_InsertItem(hTree, &tvis)); @@ -532,7 +532,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ImageList_Destroy(dat->himlButtonIcons); free(dat); } - OptionshWnd = NULL; + OptionshWnd = nullptr; break; } return FALSE; -- cgit v1.2.3