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/Popup/src/avatars_gif.cpp | 10 ++-- plugins/Popup/src/avatars_simple.cpp | 4 +- plugins/Popup/src/bitmap_funcs.cpp | 44 +++++++-------- plugins/Popup/src/font.cpp | 2 +- plugins/Popup/src/history.cpp | 36 ++++++------ plugins/Popup/src/icons.cpp | 4 +- plugins/Popup/src/main.cpp | 26 ++++----- plugins/Popup/src/notifications.cpp | 10 ++-- plugins/Popup/src/opt_adv.cpp | 38 ++++++------- plugins/Popup/src/opt_class.cpp | 16 +++--- plugins/Popup/src/opt_contacts.cpp | 2 +- plugins/Popup/src/opt_gen.cpp | 30 +++++----- plugins/Popup/src/opt_skins.cpp | 48 ++++++++-------- plugins/Popup/src/opttree.cpp | 14 ++--- plugins/Popup/src/popup_gdiplus.cpp | 14 ++--- plugins/Popup/src/popup_thread.cpp | 26 ++++----- plugins/Popup/src/popup_wnd2.cpp | 104 +++++++++++++++++------------------ plugins/Popup/src/services.cpp | 14 ++--- plugins/Popup/src/skin.cpp | 54 +++++++++--------- plugins/Popup/src/srmm_menu.cpp | 4 +- 20 files changed, 250 insertions(+), 250 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 5b8cbac17c..3e8c257cc4 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.cpp @@ -30,8 +30,8 @@ GifAvatar::GifAvatar(MCONTACT hContact) : PopupAvatar() bIsValid = true; GDIPlus_GetGIFSize(av->szFilename, &this->width, &this->height); - hBitmap = NULL; - frameDelays = NULL; + hBitmap = nullptr; + frameDelays = nullptr; frameCount = 0; frameSize.cx = frameSize.cy = 0; @@ -44,7 +44,7 @@ GifAvatar::~GifAvatar() { if (frameDelays) { mir_free(frameDelays); - frameDelays = NULL; + frameDelays = nullptr; } if (hBitmap) DeleteObject(hBitmap); } @@ -65,7 +65,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op cachedHeight = h; if (frameDelays) { mir_free(frameDelays); - frameDelays = NULL; + frameDelays = nullptr; } if (hBitmap) DeleteObject(hBitmap); GDIPlus_ExtractAnimatedGIF(av->szFilename, w, h, hBitmap, frameDelays, frameCount, frameSize); @@ -113,7 +113,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op bmp->restoreAlpha(x, y, w, h); } DeleteObject(rgn); - SelectClipRgn(bmp->getDC(), NULL); + SelectClipRgn(bmp->getDC(), nullptr); DeleteDC(hdcTmp); activeFrame = (activeFrame + 1) % frameCount; diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index b887bb27fd..21ce9e0463 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.cpp @@ -60,7 +60,7 @@ SimpleAvatar::SimpleAvatar(HANDLE h, bool bUseBitmap) } width = height = 0; - av = NULL; + av = nullptr; avNeedFree = false; } @@ -119,6 +119,6 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS bmp->restoreAlpha(x, y, w, h); } DeleteObject(rgn); - SelectClipRgn(bmp->getDC(), NULL); + SelectClipRgn(bmp->getDC(), nullptr); DeleteDC(hdcTmp); } diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index a652e68980..4ca3ef3bf2 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -38,30 +38,30 @@ typedef long pu_koef; MyBitmap::MyBitmap() { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; } MyBitmap::MyBitmap(int w, int h) { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; allocate(w, h); } MyBitmap::MyBitmap(const wchar_t *fn) { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; loadFromFile(fn); } @@ -153,7 +153,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) } delete[] bitsSave; - bitsSave = 0; + bitsSave = nullptr; } void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h) @@ -586,7 +586,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) } else { this->saveAlpha(x, y, w, h); - DrawIconEx(this->getDC(), x, y, hic, w, h, 0, NULL, DI_NORMAL); + DrawIconEx(this->getDC(), x, y, hic, w, h, 0, nullptr, DI_NORMAL); this->restoreAlpha(x, y, w, h); } @@ -660,7 +660,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) } } - HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData); + HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData); delete[] pRgnData; return hRgn; } @@ -736,9 +736,9 @@ bool MyBitmap::loadFromFile(const wchar_t *fn) return false; BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm); - SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL); + SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr); - HDC dcTmp = CreateCompatibleDC(0); + HDC dcTmp = CreateCompatibleDC(nullptr); GetBitmapDimensionEx(hBmpLoaded, &sz); HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded); @@ -775,8 +775,8 @@ void MyBitmap::allocate(int w, int h) bi.bmiHeader.biBitCount = 32; bi.bmiHeader.biCompression = BI_RGB; - hBmp = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void **)&bits, 0, 0); - dcBmp = CreateCompatibleDC(0); + hBmp = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void **)&bits, nullptr, 0); + dcBmp = CreateCompatibleDC(nullptr); hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmp); GdiFlush(); @@ -789,9 +789,9 @@ void MyBitmap::freemem() DeleteObject(SelectObject(dcBmp, hBmpSave)); DeleteDC(dcBmp); - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; } diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 4f11e52471..aaf022f2ec 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -PopupFonts fonts = { 0 }; +PopupFonts fonts = {}; void InitFonts() { diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index 4746c4d4a9..860e777962 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -27,7 +27,7 @@ static mir_cs csPopupHistory; static LIST arPopupHistory(SETTING_HISTORYSIZE_DEFAULT); static int popupHistoryBuffer = 0; -static HWND hwndHistory = NULL; +static HWND hwndHistory = nullptr; #define UM_RESIZELIST (WM_USER+100) #define UM_SELECTLAST (WM_USER+101) @@ -82,7 +82,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) ppd->lpzText = mir_strdup(ppd->lpzText); } ppd->lpzSkin = mir_strdup(ppd->lpzSkin); - ppd->dwTimestamp = time(NULL); + ppd->dwTimestamp = time(nullptr); { mir_cslock lck(csPopupHistory); if (arPopupHistory.getCount() >= popupHistoryBuffer) { @@ -98,7 +98,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) void PopupHistoryShow() { if (!PopupOptions.EnableHistory) { - MessageBox(NULL, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK); + MessageBox(nullptr, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK); return; } @@ -109,7 +109,7 @@ void PopupHistoryShow() SetActiveWindow(hwndHistory); } else { - hwndHistory = CreateDialog(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc); + hwndHistory = CreateDialog(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryDlgProc); SetWindowText(hwndHistory, TranslateT("Popup History")); } } @@ -120,7 +120,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara static int loadItem = -1; static enum { LOG_NONE, LOG_DEFAULT, LOG_HPP } logType = LOG_NONE; - static HWND hwndLog = NULL; + static HWND hwndLog = nullptr; switch (msg) { case WM_INITDIALOG: @@ -176,7 +176,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieEvent.eventData = &ieData; ieEvent.count = 1; ieEvent.codepage = 0; - ieEvent.pszProto = NULL; + ieEvent.pszProto = nullptr; for (int i = 0; i < arPopupHistory.getCount(); ++i) { POPUPDATA2* ppd = arPopupHistory[i]; @@ -188,18 +188,18 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; ieData.pszNickW = ppd->lptzTitle; ieData.pszTextW = ppd->lptzText; - ieData.pszText2W = NULL; + ieData.pszText2W = nullptr; } else { ieData.dwFlags |= 0; ieData.pszNick = ppd->lpzTitle; ieData.pszText = ppd->lpzText; - ieData.pszText2 = NULL; + ieData.pszText2 = nullptr; } ieData.bIsMe = FALSE; ieData.time = ppd->dwTimestamp; ieData.dwData = 0; - ieData.next = NULL; + ieData.next = nullptr; CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent); } } @@ -301,7 +301,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara rcLst.right -= 10; rcLst.bottom -= 10; if (logType == LOG_HPP) { - SetWindowPos(hwndLog, NULL, + SetWindowPos(hwndLog, nullptr, rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top, SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW); @@ -317,7 +317,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); } else if (logType == LOG_DEFAULT) { - SetWindowPos(hwndLog, NULL, + SetWindowPos(hwndLog, nullptr, rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top, SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW); if (rcLst.right - rcLst.left != oldWidth) { @@ -343,8 +343,8 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ListBox_SetItemData(hwndLog, i, 0); ListBox_SetItemHeight(hwndLog, i, 50); } - ScrollWindow(hwndLog, 0, 100000, NULL, NULL); - InvalidateRect(hwndLog, NULL, TRUE); + ScrollWindow(hwndLog, 0, 100000, nullptr, nullptr); + InvalidateRect(hwndLog, nullptr, TRUE); } return TRUE; @@ -362,7 +362,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieEvent.eventData = &ieData; ieEvent.count = 1; ieEvent.codepage = 0; - ieEvent.pszProto = NULL; + ieEvent.pszProto = nullptr; ieData.cbSize = sizeof(ieData); ieData.dwFlags = 0; @@ -372,18 +372,18 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; ieData.pszNickW = ppd->lptzTitle; ieData.pszTextW = ppd->lptzText; - ieData.pszText2W = NULL; + ieData.pszText2W = nullptr; } else { ieData.dwFlags |= 0; ieData.pszNick = ppd->lpzTitle; ieData.pszText = ppd->lpzText; - ieData.pszText2 = NULL; + ieData.pszText2 = nullptr; } ieData.bIsMe = FALSE; ieData.time = ppd->dwTimestamp; ieData.dwData = 0; - ieData.next = NULL; + ieData.next = nullptr; CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent); } else if (logType == LOG_DEFAULT) { @@ -399,7 +399,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara case WM_CLOSE: Utils_SaveWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); DestroyWindow(hwnd); - hwndHistory = NULL; + hwndHistory = nullptr; return TRUE; case WM_DESTROY: diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 207b4991a2..fec8b0663d 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -73,7 +73,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId) return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); - return NULL; + return nullptr; } HANDLE GetIconHandle(int iconId) @@ -82,5 +82,5 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId) return iconList[i].hIcolib; - return NULL; + return nullptr; } diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 9fdd80632a..7471eddb29 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -40,11 +40,11 @@ int hLangpack = 0; CLIST_INTERFACE *pcli; //===== Global variables ================================================================ -HMODULE hUserDll = 0; -HMODULE hMsimgDll = 0; -HMODULE hKernelDll = 0; -HMODULE hGdiDll = 0; -HMODULE hDwmapiDll = 0; +HMODULE hUserDll = nullptr; +HMODULE hMsimgDll = nullptr; +HMODULE hKernelDll = nullptr; +HMODULE hGdiDll = nullptr; +HMODULE hDwmapiDll = nullptr; GLOBAL_WND_CLASSES g_wndClass = { 0 }; @@ -114,16 +114,16 @@ static int IconsChanged(WPARAM, LPARAM) ? GetIconHandle(IDI_POPUP) : GetIconHandle(IDI_NOPOPUP); - Menu_ModifyItem(hMenuItem, NULL, hIcon); - Menu_ModifyItem(hMenuRoot, NULL, hIcon); + Menu_ModifyItem(hMenuItem, nullptr, hIcon); + Menu_ModifyItem(hMenuRoot, nullptr, hIcon); - Menu_ModifyItem(hMenuItemHistory, NULL, GetIconHandle(IDI_HISTORY)); + Menu_ModifyItem(hMenuItemHistory, nullptr, GetIconHandle(IDI_HISTORY)); return 0; } static int TTBLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszService = MENUCOMMAND_SVC; ttb.lParamUp = 1; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON; @@ -157,7 +157,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP)); } - Menu_ModifyItem(hMenuRoot, NULL, hIcon); + Menu_ModifyItem(hMenuRoot, nullptr, hIcon); if (hTTButton) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopupOptions.ModuleIsEnabled) ? TTBST_PUSHED : 0); @@ -238,7 +238,7 @@ static int ModulesLoaded(WPARAM, LPARAM) htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT); htuTitle = MText.Register("Popup Plus/Title", MTEXT_FANCY_DEFAULT); } - else htuTitle = htuText = NULL; + else htuTitle = htuText = nullptr; // check if OptionLoaded if (!OptionLoaded) @@ -331,14 +331,14 @@ MIRAPI int Load(void) // Transparent and animation routines hDwmapiDll = LoadLibrary(L"dwmapi.dll"); - MyDwmEnableBlurBehindWindow = 0; + MyDwmEnableBlurBehindWindow = nullptr; if (hDwmapiDll) MyDwmEnableBlurBehindWindow = (HRESULT(WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow"); PopupHistoryLoad(); LoadPopupThread(); if (!LoadPopupWnd2()) { - MessageBox(0, TranslateT("Error: I could not register the Popup Window class.\r\nThe plugin will not operate."), MODULNAME_LONG, MB_ICONSTOP | MB_OK); + MessageBox(nullptr, TranslateT("Error: I could not register the Popup Window class.\r\nThe plugin will not operate."), MODULNAME_LONG, MB_ICONSTOP | MB_OK); return 0; // We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled. } RegisterOptPrevBox(); diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 1c9759e201..09bd94e332 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -42,7 +42,7 @@ void LoadNotifications() POPUPNOTIFICATION notification = { 0 }; notification.cbSize = sizeof(notification); notification.actionCount = 0; - notification.lpActions = 0; + notification.lpActions = nullptr; mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName)); @@ -158,12 +158,12 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName); char *szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction); mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction)); - mir_free(szTmp); szTmp = NULL; + mir_free(szTmp); szTmp = nullptr; mir_snprintf(setting, "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName); szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction); mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction)); - mir_free(szTmp); szTmp = NULL; + mir_free(szTmp); szTmp = nullptr; } } @@ -218,7 +218,7 @@ HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) if (p->typ == typ && (!group || (mir_wstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_wstrcmp(p->pszDescription, name) == 0))) return p; } - return NULL; + return nullptr; } void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) @@ -264,7 +264,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, return false; POPUPTREEDATA *ptd = (POPUPTREEDATA *)hNotification; - char *lpzAction = NULL; + char *lpzAction = nullptr; switch (message) { case WM_LBUTTONUP: case WM_COMMAND: diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 1de7bcbb81..41f1d8ced4 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -HWND hwndBox = NULL; +HWND hwndBox = nullptr; LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -89,16 +89,16 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hwndBox = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // dwStyleEx BOXPREVIEW_WNDCLASS, // Class name - NULL, // Title + nullptr, // Title DS_SETFONT | DS_FIXEDSYS | WS_POPUP, // dwStyle CW_USEDEFAULT, // x CW_USEDEFAULT, // y CW_USEDEFAULT, // Width CW_USEDEFAULT, // Height HWND_DESKTOP, // Parent - NULL, // menu handle + nullptr, // menu handle hInst, // Instance - (LPVOID)0); + (LPVOID)nullptr); ShowWindow(hwndBox, SW_HIDE); } // Group: History @@ -364,7 +364,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (idCtrl) { case IDC_MAXPOPUPS: { - int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int maxPop = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (maxPop > 0) { PopupOptions.MaxPopups = maxPop; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_HISTORYSIZE: { - int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int histSize = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (histSize > 0 && histSize <= SETTING_HISTORYSIZE_MAX) { PopupOptions.HistorySize = histSize; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -382,7 +382,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_AVT_RADIUS: { - int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int avtRadius = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (avtRadius <= SETTING_AVTSIZE_MAX / 2) { PopupOptions.avatarRadius = avtRadius; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -391,7 +391,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_FADEIN: { - int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int fadeIn = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (fadeIn >= SETTING_FADEINTIME_MIN && fadeIn <= SETTING_FADEINTIME_MAX) { PopupOptions.FadeIn = fadeIn; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -400,7 +400,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_FADEOUT: { - int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int fadeOut = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (fadeOut >= SETTING_FADEOUTTIME_MIN && fadeOut <= SETTING_FADEOUTTIME_MAX) { PopupOptions.FadeOut = fadeOut; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -415,7 +415,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (idCtrl) { case IDC_MAXPOPUPS: { - int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int maxPop = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (maxPop <= 0) PopupOptions.MaxPopups = 20; if (maxPop != PopupOptions.MaxPopups) { @@ -427,7 +427,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_HISTORYSIZE: { - int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int histSize = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (histSize <= 0) PopupOptions.HistorySize = SETTING_HISTORYSIZE_DEFAULT; else if (histSize > SETTING_HISTORYSIZE_MAX) @@ -441,7 +441,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_AVT_RADIUS: { - int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int avtRadius = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (avtRadius > SETTING_AVTSIZE_MAX / 2) PopupOptions.avatarRadius = SETTING_AVTSIZE_MAX / 2; if (avtRadius != PopupOptions.avatarRadius) { @@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_FADEIN: { - int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int fade = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (fade < SETTING_FADEINTIME_MIN) PopupOptions.FadeIn = SETTING_FADEINTIME_MIN; else if (fade > SETTING_FADEINTIME_MAX) @@ -467,7 +467,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_FADEOUT: { - int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + int fade = GetDlgItemInt(hwnd, idCtrl, nullptr, FALSE); if (fade < SETTING_FADEOUTTIME_MIN) PopupOptions.FadeOut = SETTING_FADEOUTTIME_MIN; else if (fade > SETTING_FADEOUTTIME_MAX) @@ -557,20 +557,20 @@ LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr(hwndBox, GWLP_USERDATA, 0); RECT rc; GetWindowRect(hwnd, &rc); - SetWindowPos(hwndBox, NULL, + SetWindowPos(hwndBox, nullptr, (rc.left + rc.right - newVal) / 2, rc.bottom + 2, newVal, newVal, SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); HRGN rgn = CreateRoundRectRgn(0, 0, newVal, newVal, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius); SetWindowRgn(hwndBox, rgn, TRUE); - InvalidateRect(hwndBox, NULL, FALSE); + InvalidateRect(hwndBox, nullptr, FALSE); oldVal = newVal; } } break; case WM_MOUSELEAVE: - SetWindowRgn(hwndBox, NULL, TRUE); + SetWindowRgn(hwndBox, nullptr, TRUE); ShowWindow(hwndBox, SW_HIDE); oldVal = -1; break; @@ -608,10 +608,10 @@ LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); RECT rc; GetWindowRect(hwnd, &rc); - SetWindowPos(hwndBox, NULL, + SetWindowPos(hwndBox, nullptr, (rc.left + rc.right - 170) / 2, rc.bottom + 2, 170, 50, SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); - SetWindowRgn(hwndBox, NULL, TRUE); + SetWindowRgn(hwndBox, nullptr, TRUE); } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA); diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 9a58419986..18905ee3aa 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // element typ1 (Notification) if (ptd->typ == 1) { - LPTSTR psztAction = NULL; + LPTSTR psztAction = nullptr; // Timeout SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE); SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1)); @@ -268,15 +268,15 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < ptd->notification.actionCount; ++i) { psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle); - mir_free(psztAction); psztAction = NULL; + mir_free(psztAction); psztAction = nullptr; } // combo right action (EXTRA) hCtrl = GetDlgItem(hwnd, IDC_RACTION); - psztAction = NULL; + psztAction = nullptr; for (i = 0; i < ptd->notification.actionCount; ++i) { psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle); - mir_free(psztAction); psztAction = NULL; + mir_free(psztAction); psztAction = nullptr; } // enable all controls for (i = 0; i < _countof(ctrlsAll); ++i){ @@ -348,7 +348,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ppd.iSeconds = ptd->timeoutValue; ppd.colorBack = ptd->colorBack; ppd.colorText = ptd->colorText; - POPUPTREEDATA *ptdPrev = NULL; + POPUPTREEDATA *ptdPrev = nullptr; if (ptd->typ == 1) { // we work with a copy for preview ptdPrev = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA)); @@ -365,7 +365,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ppd.lchIcon = ptd->pupClass.hIcon; CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - mir_free(ptdPrev); ptdPrev = NULL; + mir_free(ptdPrev); ptdPrev = nullptr; } break; @@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case EN_CHANGE: // Edit controls switch (idCtrl) { case IDC_TIMEOUT: - int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE); + int seconds = GetDlgItemInt(hwnd, idCtrl, nullptr, TRUE); if (seconds >= SETTING_LIFETIME_INFINITE && seconds <= SETTING_LIFETIME_MAX && seconds != ptd->timeoutValue) { ptd->timeoutValue = seconds; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case EN_KILLFOCUS: // Edit controls lost fokus switch (idCtrl) { case IDC_TIMEOUT: - int seconds = GetDlgItemInt(hwnd, idCtrl, NULL, TRUE); + int seconds = GetDlgItemInt(hwnd, idCtrl, nullptr, TRUE); if (seconds > SETTING_LIFETIME_MAX) ptd->timeoutValue = SETTING_LIFETIME_MAX; else if (seconds < SETTING_LIFETIME_INFINITE) diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 3434287acf..ae183f15b8 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -81,7 +81,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) DWORD hitFlags; HANDLE hItem = (HANDLE)SendDlgItemMessage(hwnd, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); - if (hItem == NULL) break; + if (hItem == nullptr) break; if (!(hitFlags&CLCHT_ONITEMEXTRA)) break; int iImage = SendDlgItemMessage(hwnd, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0)); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 32af64f767..677e1bc459 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -129,7 +129,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG - static OPTTREE_OPTION *statusOptions = NULL; + static OPTTREE_OPTION *statusOptions = nullptr; static int statusOptionsCount = 0; if (statusOptions) { int index; @@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_CUSTOMPOS: { RECT rcButton, rcBox; - HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), NULL, PositionBoxDlgProc); + HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), nullptr, PositionBoxDlgProc); GetWindowRect((HWND)lParam, &rcButton); GetWindowRect(hwndBox, &rcBox); MoveWindow(hwndBox, @@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // lParam = Handle to the control case IDC_SECONDS: { - int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); + int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE); if (seconds >= SETTING_LIFETIME_MIN && seconds <= SETTING_LIFETIME_MAX && seconds != PopupOptions.Seconds) { @@ -395,7 +395,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_MINIMUMWIDTH: { - int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, NULL, FALSE); + int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, nullptr, FALSE); if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MinimumWidth) { @@ -406,7 +406,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_MAXIMUMWIDTH: { - int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, NULL, FALSE); + int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, nullptr, FALSE); if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MaximumWidth) { @@ -423,7 +423,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // lParam = Handle to the control case IDC_SECONDS: { - int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); + int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE); if (seconds > SETTING_LIFETIME_MAX) PopupOptions.Seconds = SETTING_LIFETIME_MAX; else if (seconds < SETTING_LIFETIME_MIN) @@ -437,7 +437,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_MINIMUMWIDTH: { - int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); + int temp = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE); if (temp < SETTING_MINIMUMWIDTH_MIN) PopupOptions.MinimumWidth = SETTING_MINIMUMWIDTH_MIN; else if (temp > SETTING_MAXIMUMWIDTH_MAX) @@ -456,7 +456,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_MAXIMUMWIDTH: { - int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); + int temp = GetDlgItemInt(hwnd, LOWORD(wParam), nullptr, FALSE); if (temp >= SETTING_MAXIMUMWIDTH_MAX) PopupOptions.MaximumWidth = SETTING_MAXIMUMWIDTH_MAX; else if (temp < SETTING_MINIMUMWIDTH_MIN) @@ -570,7 +570,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mir_free(statusOptions[i].pszSettingName); } delete[] statusOptions; - statusOptions = NULL; + statusOptions = nullptr; statusOptionsCount = 0; bDlgInit = false; } @@ -614,7 +614,7 @@ void Check_ReorderPopups(HWND hwnd) { INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { LOGFONT lf; - static HFONT hFontTitle = 0; + static HFONT hFontTitle = nullptr; switch (msg) { case WM_INITDIALOG: @@ -645,11 +645,11 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND: if ((LOWORD(wParam)) == IDOK) { - PopupOptions.gapTop = GetDlgItemInt(hwndDlg, IDC_TXT_TOP, NULL, FALSE); - PopupOptions.gapBottom = GetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, NULL, FALSE); - PopupOptions.gapLeft = GetDlgItemInt(hwndDlg, IDC_TXT_LEFT, NULL, FALSE); - PopupOptions.gapRight = GetDlgItemInt(hwndDlg, IDC_TXT_RIGHT, NULL, FALSE); - PopupOptions.spacing = GetDlgItemInt(hwndDlg, IDC_TXT_SPACING, NULL, FALSE); + PopupOptions.gapTop = GetDlgItemInt(hwndDlg, IDC_TXT_TOP, nullptr, FALSE); + PopupOptions.gapBottom = GetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, nullptr, FALSE); + PopupOptions.gapLeft = GetDlgItemInt(hwndDlg, IDC_TXT_LEFT, nullptr, FALSE); + PopupOptions.gapRight = GetDlgItemInt(hwndDlg, IDC_TXT_RIGHT, nullptr, FALSE); + PopupOptions.spacing = GetDlgItemInt(hwndDlg, IDC_TXT_SPACING, nullptr, FALSE); PostMessage(hwndDlg, WM_CLOSE, 0, 0); } else if ((LOWORD(wParam)) == IDCANCEL) diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 249ea08e7d..925a7d2b5a 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" static volatile bool gPreviewOk = false; -static PopupWnd2 *wndPreview = NULL; +static PopupWnd2 *wndPreview = nullptr; INT_PTR CALLBACK BoxPreviewWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -38,10 +38,10 @@ void RegisterOptPrevBox() wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = hInst; - wcl.hIcon = NULL; - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); - wcl.hbrBackground = NULL; // (HBRUSH)GetStockObject(LTGRAY_BRUSH); - wcl.lpszMenuName = NULL; + wcl.hIcon = nullptr; + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcl.hbrBackground = nullptr; // (HBRUSH)GetStockObject(LTGRAY_BRUSH); + wcl.lpszMenuName = nullptr; wcl.lpszClassName = BOXPREVIEW_WNDCLASS; wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); g_wndClass.cPopupPreviewBoxWndclass = RegisterClassEx(&wcl); @@ -89,7 +89,7 @@ static void updatePreviewImage(HWND hwndBox) wndPreview->update(); gPreviewOk = true; - InvalidateRect(hwndBox, NULL, TRUE); + InvalidateRect(hwndBox, nullptr, TRUE); } static void DrawPreview(HWND hwnd, HDC hdc) @@ -101,8 +101,8 @@ static void DrawPreview(HWND hwnd, HDC hdc) bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 32; bi.bmiHeader.biCompression = BI_RGB; - HBITMAP hBmpBrush = CreateDIBSection(0, &bi, DIB_RGB_COLORS, 0, 0, 0); - HDC dcBmp = CreateCompatibleDC(0); + HBITMAP hBmpBrush = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, nullptr, nullptr, 0); + HDC dcBmp = CreateCompatibleDC(nullptr); HBITMAP hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmpBrush); HBRUSH hbr = CreateSolidBrush(RGB(0xcc, 0xcc, 0xcc)); @@ -121,7 +121,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) GetClientRect(hwnd, &rc); hbr = CreatePatternBrush(hBmpBrush); - SetBrushOrgEx(hdc, 1, 1, 0); + SetBrushOrgEx(hdc, 1, 1, nullptr); FillRect(hdc, &rc, hbr); DeleteObject(hbr); DeleteObject(hBmpBrush); @@ -155,7 +155,7 @@ LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch (msg) { case WM_PAINT: - if (GetUpdateRect(hwnd, 0, FALSE)) + if (GetUpdateRect(hwnd, nullptr, FALSE)) { PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); @@ -174,7 +174,7 @@ LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP } int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions) { - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) { for (int i = 1; i <= 10; i++) { if (!skin->getFlagName(i)) @@ -265,7 +265,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn mir_free(options[i].pszSettingName); } mir_free(options); - options = NULL; + options = nullptr; *OptionsCount = 0; } // add "Global options" @@ -306,8 +306,8 @@ void LoadOption_Skins() { INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG - static HANDLE hhkFontsReload = 0; - static OPTTREE_OPTION *skinOptions = NULL; + static HANDLE hhkFontsReload = nullptr; + static OPTTREE_OPTION *skinOptions = nullptr; static int skinOptionsCount = 0; if (skinOptions) { @@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR OptTree_ProcessMessage(hwndDlg, msg, wParam, lParam, &index, IDC_SKIN_LIST_OPT, skinOptions, skinOptionsCount); if (index != -1) { if (mir_wstrcmp(skinOptions[index].pszSettingName, L"Skin options") == 0) { - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) { skin->setFlag(skinOptions[index].Data, skinOptions[index].bState ? true : false); } @@ -385,7 +385,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND: { - HWND hCtrl = NULL; + HWND hCtrl = nullptr; UINT idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { case BN_KILLFOCUS: // Button controls @@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR PopupOptions.SkinPack = mir_wstrdup(szNewSkin); } - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) { // update Skin Option List from reload SkinPack bDlgInit = false; @@ -446,7 +446,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR LB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL, 0, 0), 0)); - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) { mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_wstrdup(skin->getName()); @@ -479,7 +479,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // skin pack db_set_ws(NULL, MODULNAME, "SkinPack", PopupOptions.SkinPack); // skin options - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) skin->saveOpts(); skins.freeAllButActive(); @@ -499,7 +499,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_DESTROY: if (wndPreview) { delete wndPreview; - wndPreview = NULL; + wndPreview = nullptr; gPreviewOk = false; } if (hhkFontsReload) UnhookEvent(hhkFontsReload); @@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_free(skinOptions[i].pszSettingName); } mir_free(skinOptions); - skinOptions = NULL; + skinOptions = nullptr; skinOptionsCount = 0; } return TRUE; @@ -578,9 +578,9 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) DeleteObject(hbr); HPEN hpen = (HPEN)SelectObject(mydc, CreatePen(PS_DOT, 1, RGB(0, 0, 0))); - MoveToEx(mydc, 0, 100, NULL); + MoveToEx(mydc, 0, 100, nullptr); LineTo(mydc, 201, 100); - MoveToEx(mydc, 100, 0, NULL); + MoveToEx(mydc, 100, 0, nullptr); LineTo(mydc, 100, 201); DeleteObject(SelectObject(mydc, hpen)); @@ -597,7 +597,7 @@ INT_PTR CALLBACK BoxPreviewWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP { switch (msg) { case WM_PAINT: - if (GetUpdateRect(hwnd, 0, FALSE)) { + if (GetUpdateRect(hwnd, nullptr, FALSE)) { PAINTSTRUCT ps; HDC mydc = BeginPaint(hwnd, &ps); BoxPreview_OnPaint(hwnd, mydc, GetWindowLongPtr(hwnd, GWLP_USERDATA)); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index a9abe4ca0e..1b5b4a8743 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -45,7 +45,7 @@ void OptTree_Translate(HWND hwndTree) while (hItem) { OptTree_TranslateItem(hwndTree, hItem); - HTREEITEM hItemTmp = 0; + HTREEITEM hItemTmp = nullptr; if (hItemTmp = TreeView_GetChild(hwndTree, hItem)) { hItem = hItemTmp; } @@ -90,7 +90,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); } - return NULL; + return nullptr; } HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconIndex) @@ -100,7 +100,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd wchar_t *sectionName; int sectionLevel = 0; - HTREEITEM hSection = NULL, result = NULL; + HTREEITEM hSection = nullptr, result = nullptr; mir_wstrcpy(itemName, name); sectionName = itemName; @@ -118,7 +118,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST;// TVI_SORT; @@ -175,7 +175,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res wchar_t *sectionName; int sectionLevel = 0; - HTREEITEM hSection = NULL; + HTREEITEM hSection = nullptr; mir_wstrcpy(itemName, options[indx].pszOptionName); sectionName = itemName; @@ -193,7 +193,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST;// TVI_SORT; @@ -225,7 +225,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res OptTree_Translate(hwndTree); ShowWindow(hwndTree, SW_SHOW); - TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL)); + TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, nullptr, nullptr)); break; } diff --git a/plugins/Popup/src/popup_gdiplus.cpp b/plugins/Popup/src/popup_gdiplus.cpp index 4c788a0679..b6fd4039a1 100644 --- a/plugins/Popup/src/popup_gdiplus.cpp +++ b/plugins/Popup/src/popup_gdiplus.cpp @@ -41,7 +41,7 @@ void LoadGDIPlus() gbGdiPlusLoaded = false; __try { if (g_gdiplusToken == 0) - Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL); + Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, nullptr); } __except (EXCEPTION_EXECUTE_HANDLER) { @@ -74,7 +74,7 @@ using namespace Gdiplus; HBITMAP SkinEngine_CreateDIB32(int cx, int cy) { if (cx < 0 || cy < 0) { - return NULL; + return nullptr; } BITMAPINFO RGB32BitsBITMAPINFO; @@ -88,8 +88,8 @@ HBITMAP SkinEngine_CreateDIB32(int cx, int cy) UINT *ptPixels; - HBITMAP DirectBitmap = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); - if ((DirectBitmap == NULL || ptPixels == NULL) && cx != 0 && cy != 0) { + HBITMAP DirectBitmap = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); + if ((DirectBitmap == nullptr || ptPixels == nullptr) && cx != 0 && cy != 0) { ; } else { @@ -163,7 +163,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP clipHeight = (int)(xscale*imHeight + .5); HBITMAP hBitmap = SkinEngine_CreateDIB32(clipWidth*nFrameCount, height); - HDC hdc = CreateCompatibleDC(NULL); + HDC hdc = CreateCompatibleDC(nullptr); HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hBitmap); Graphics graphics(hdc); ImageAttributes attr; @@ -175,7 +175,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP for (int i = 1; i < nFrameCount + 1; i++) { GUID pageGuid = FrameDimensionTime; RectF rect((float)(i - 1)*clipWidth, (float)0, (float)clipWidth, (float)clipHeight); - graphics.DrawImage(&image, rect, (float)0, (float)0, (float)imWidth, (float)imHeight, UnitPixel, &attr, NULL, NULL); + graphics.DrawImage(&image, rect, (float)0, (float)0, (float)imWidth, (float)imHeight, UnitPixel, &attr, nullptr, nullptr); image.SelectActiveFrame(&pageGuid, i); long lPause = ((long*)pPropertyItem->value)[i - 1] * 10; delays[i - 1] = (int)lPause; @@ -183,7 +183,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP SelectObject(hdc, oldBmp); DeleteDC(hdc); mir_free(pPropertyItem); - pPropertyItem = NULL; + pPropertyItem = nullptr; delete[]pDimensionIDs; pBitmap = hBitmap; diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 54dc146040..54531432b6 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // globals static int gIdleRequests = 0; static bool gTerminating = false; -static HWND gHwndManager = 0; +static HWND gHwndManager = nullptr; static int gLockCount = 0; static volatile int nPopups = 0; -static HANDLE hThread = 0; +static HANDLE hThread = nullptr; static LIST popupList(3); @@ -133,7 +133,7 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) void RepositionPopups() { - PopupWnd2 *prev = 0; + PopupWnd2 *prev = nullptr; if (PopupOptions.ReorderPopups) { for (int i = 0; i < popupList.getCount(); ++i) { UpdatePopupPosition(prev, popupList[i]); @@ -144,7 +144,7 @@ void RepositionPopups() static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - PopupWnd2 *wnd = NULL; + PopupWnd2 *wnd = nullptr; if (message == UTM_ADD_WINDOW || message == UTM_UPDATE_WINDOW || message == UTM_REMOVE_WINDOW || message == UTM_REQUEST_REMOVE) if (!(wnd = (PopupWnd2 *)lParam)) return 0; @@ -161,7 +161,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_ADD_WINDOW: if (gTerminating) break; - UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount() - 1] : 0, wnd); + UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount() - 1] : nullptr, wnd); popupList.insert(wnd); ++nPopups; wnd->callMethodAsync(&PopupWnd2::m_show, 0); @@ -222,10 +222,10 @@ static unsigned __stdcall PopupThread(void *) wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = hInst; - wcl.hIcon = NULL; - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); + wcl.hIcon = nullptr; + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); - wcl.lpszMenuName = NULL; + wcl.lpszMenuName = nullptr; wcl.lpszClassName = L"PopupThreadManagerWnd"; wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl); @@ -236,16 +236,16 @@ static unsigned __stdcall PopupThread(void *) MSGERROR(msg); } - gHwndManager = CreateWindow(L"PopupThreadManagerWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL); - SetWindowPos(gHwndManager, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); + gHwndManager = CreateWindow(L"PopupThreadManagerWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr); + SetWindowPos(gHwndManager, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { + while (GetMessage(&msg, nullptr, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } - DestroyWindow(gHwndManager); gHwndManager = NULL; + DestroyWindow(gHwndManager); gHwndManager = nullptr; return 0; } @@ -261,7 +261,7 @@ static int sttAvatarChanged(WPARAM wParam, LPARAM) void LoadPopupThread() { unsigned threadId; - hThread = mir_forkthreadex(PopupThread, NULL, &threadId); + hThread = mir_forkthreadex(PopupThread, nullptr, &threadId); HookEvent(ME_AV_AVATARCHANGED, sttAvatarChanged); } diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 3aa148af28..a3d5c3c425 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AVATAR_TIMER 1608 #define CURSOR_TIMER 1609 -HWND ghwndMenuHost = NULL; +HWND ghwndMenuHost = nullptr; void WindowThread(void *arg); @@ -52,7 +52,7 @@ bool LoadPopupWnd2() wcl.cbSize = sizeof(wcl); wcl.lpfnWndProc = PopupWnd2::WindowProc; wcl.hInstance = hInst; - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszClassName = POPUP_WNDCLASS; wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); @@ -62,12 +62,12 @@ bool LoadPopupWnd2() res = false; wchar_t msg[1024]; mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName); - MessageBox(NULL, msg, MODULNAME_LONG, MB_ICONSTOP | MB_OK); + MessageBox(nullptr, msg, MODULNAME_LONG, MB_ICONSTOP | MB_OK); } WNDCLASSEX wclw = { 0 }; wclw.cbSize = sizeof(wclw); - if (!GetClassInfoEx(NULL, L"EDIT", &wclw)) + if (!GetClassInfoEx(nullptr, L"EDIT", &wclw)) MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class.")); wclw.hInstance = hInst; wclw.lpszClassName = L"PopupEditBox"; @@ -90,10 +90,10 @@ bool LoadPopupWnd2() wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = hInst; - wcl.hIcon = NULL; - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); + wcl.hIcon = nullptr; + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); - wcl.lpszMenuName = NULL; + wcl.lpszMenuName = nullptr; wcl.lpszClassName = L"PopupMenuHostWnd"; wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); g_wndClass.cPopupMenuHostWnd = RegisterClassEx(&wcl); @@ -105,8 +105,8 @@ bool LoadPopupWnd2() MSGERROR(msg); } - ghwndMenuHost = CreateWindow(L"PopupMenuHostWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL); - SetWindowPos(ghwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); + ghwndMenuHost = CreateWindow(L"PopupMenuHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr); + SetWindowPos(ghwndMenuHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); INITCOMMONCONTROLSEX iccex; iccex.dwICC = ICC_WIN95_CLASSES; @@ -138,7 +138,7 @@ PopupWnd2::PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions, bool rende PopupWnd2::~PopupWnd2() { m_signature = 0; - setIcon(NULL); + setIcon(nullptr); mir_free(m_lpzSkin); mir_free(m_lptzTitle); @@ -167,14 +167,14 @@ void PopupWnd2::create() WS_EX_TRANSPARENT | // prevents unwanted clicks WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // dwStyleEx POPUP_WNDCLASS, // Class name - NULL, // Title + nullptr, // Title DS_SETFONT | DS_FIXEDSYS | WS_POPUP, // dwStyle CW_USEDEFAULT, // x CW_USEDEFAULT, // y CW_USEDEFAULT, // Width CW_USEDEFAULT, // Height HWND_DESKTOP, // Parent - NULL, // menu handle + nullptr, // menu handle hInst, // Instance (LPVOID)this); @@ -188,10 +188,10 @@ void PopupWnd2::create() SetClassLongPtr(m_hwnd, GCL_STYLE, style); // tooltips - m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, + m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - m_hwnd, NULL, hInst, NULL); + m_hwnd, nullptr, hInst, nullptr); SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); m_bWindowCreated = true; @@ -213,7 +213,7 @@ void PopupWnd2::updateLayered(BYTE opacity) blend.SourceConstantAlpha = opacity; // m_options->UseTransparency ? opacity : 255; blend.AlphaFormat = AC_SRC_ALPHA; - UpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz, + UpdateLayeredWindow(m_hwnd, nullptr, &ptDst, &m_sz, m_bmpAnimate ? m_bmpAnimate->getDC() : m_bmp->getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA); @@ -243,7 +243,7 @@ void PopupWnd2::update() // destroy content bitmap so animate() can reallocate it if needed if (m_bmp) { delete m_bmp; - m_bmp = NULL; + m_bmp = nullptr; } // measure popup @@ -285,7 +285,7 @@ void PopupWnd2::animate() if (m_bmpBase) { if (m_bmp) delete m_bmp; m_bmp = m_bmpBase; - m_bmpBase = NULL; + m_bmpBase = nullptr; } // update layered window if supported @@ -323,7 +323,7 @@ void PopupWnd2::animate() void PopupWnd2::show() { if ((m_options->UseEffect || (m_options->UseAnimations && !m_customPopup)) && m_options->FadeIn) { - IPopupPlusEffect *effect = NULL; + IPopupPlusEffect *effect = nullptr; m_bSlide = m_bFade = false; DWORD dwTime, dwTime0 = GetTickCount(); DWORD dwTime1 = dwTime0 + m_options->FadeIn; @@ -354,10 +354,10 @@ void PopupWnd2::show() m_ptPosition0.x -= m_sz.cx + 2 * 5; else m_ptPosition0.x += m_sz.cx + 2 * 5; - SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } else { - SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } while ((dwTime = GetTickCount()) < dwTime1) { if (m_bFade) { @@ -383,7 +383,7 @@ void PopupWnd2::show() } } if (m_bSlide) - SetWindowPos(m_hwnd, 0, + SetWindowPos(m_hwnd, nullptr, (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeIn, (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeIn, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); @@ -395,7 +395,7 @@ void PopupWnd2::show() effect->endEffect(); effect->destroy(); delete m_bmpAnimate; - m_bmpAnimate = NULL; + m_bmpAnimate = nullptr; } } @@ -403,14 +403,14 @@ void PopupWnd2::show() updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255); // updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); - SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } void PopupWnd2::hide() { if ((m_options->UseEffect || (m_options->UseAnimations && !m_customPopup)) && m_options->FadeOut) { m_bDestroy = true; - IPopupPlusEffect *effect = NULL; + IPopupPlusEffect *effect = nullptr; m_bFade = m_bSlide = false; DWORD dwTime, dwTime0 = GetTickCount(); DWORD dwTime1 = dwTime0 + m_options->FadeOut; @@ -438,7 +438,7 @@ void PopupWnd2::hide() m_ptPosition1.x -= m_sz.cx + 2 * 5; else m_ptPosition1.x += m_sz.cx + 2 * 5; - SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } while ((dwTime = GetTickCount()) < dwTime1) { if (m_bFade) { @@ -464,7 +464,7 @@ void PopupWnd2::hide() } } if (m_bSlide) - SetWindowPos(m_hwnd, 0, + SetWindowPos(m_hwnd, nullptr, (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeOut, (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeOut, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); @@ -476,11 +476,11 @@ void PopupWnd2::hide() effect->endEffect(); effect->destroy(); delete m_bmpAnimate; - m_bmpAnimate = NULL; + m_bmpAnimate = nullptr; } } - SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); + SetWindowPos(m_hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); DestroyWindow(m_hwnd); // hwnd = 0; } @@ -641,7 +641,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count, int additional) { m_actionCount = 0; if (m_actions) delete[] m_actions; - m_actions = NULL; + m_actions = nullptr; int i; @@ -697,7 +697,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) m_PluginWindowProc = ppd->PluginWindowProc; if (m_options->DisplayTime) - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", m_time, _countof(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", m_time, _countof(m_time)); else m_time[0] = 0; fixDefaults(); @@ -721,8 +721,8 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) replaceStrW(m_lptzText, ppd->lptzText); } else { - replaceStrW(m_lptzTitle, NULL); - replaceStrW(m_lptzText, NULL); + replaceStrW(m_lptzTitle, nullptr); + replaceStrW(m_lptzText, nullptr); } setIcon(ppd->lchIcon); @@ -739,7 +739,7 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (ppd->dwTimestamp) TimeZone_ToStringT(ppd->dwTimestamp, L"t", m_time, _countof(m_time)); else - GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", m_time, _countof(m_time)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, L"HH':'mm", m_time, _countof(m_time)); } else m_time[0] = 0; @@ -756,7 +756,7 @@ void PopupWnd2::buildMText() if (m_mtText) MText.Destroy(m_mtText); if (m_mtTitle)MText.Destroy(m_mtTitle); - m_mtText = m_mtTitle = NULL; + m_mtText = m_mtTitle = nullptr; if (m_lptzText && m_lptzTitle) { m_textType = TT_MTEXT; @@ -788,7 +788,7 @@ void PopupWnd2::updateTimer() { KillTimer(m_hwnd, POPUP_TIMER); if (m_iTimeout > 0) - SetTimer(m_hwnd, POPUP_TIMER, 1000, 0); + SetTimer(m_hwnd, POPUP_TIMER, 1000, nullptr); } LRESULT CALLBACK NullWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -815,7 +815,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = GetContactProto(hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(msg) + 1; dbei.pBlob = (PBYTE)msg; db_event_add(hContact, &dbei); @@ -824,7 +824,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { ReplyEditData *dat = (ReplyEditData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - WNDPROC oldWndProc = dat ? dat->oldWndProc : NULL; + WNDPROC oldWndProc = dat ? dat->oldWndProc : nullptr; switch (message) { case WM_KEYDOWN: @@ -880,14 +880,14 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara if (!m_customPopup) PopupThreadAddWindow(this); if (m_iTimeout > 0) - SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, 0); + SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, nullptr); if (m_avatar->activeFrameDelay() > 0) - SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), 0); + SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), nullptr); // prevent unwanted clicks, but allow wanted :) GetCursorPos(&m_ptPrevCursor); - SetTimer(m_hwnd, CURSOR_TIMER, 500, NULL); + SetTimer(m_hwnd, CURSOR_TIMER, 500, nullptr); break; case UM_POPUPSHOW: @@ -900,7 +900,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara m_avatar->invalidate(); update(); if (m_avatar->activeFrameDelay() > 0) - SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), 0); + SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), nullptr); break; case UM_POPUPACTION: @@ -919,9 +919,9 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara { HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT", - NULL, + nullptr, WS_BORDER | WS_POPUP | WS_VISIBLE | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN, - rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInst, NULL); + rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInst, nullptr); ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData)); dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC); @@ -950,7 +950,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara ADDCONTACTSTRUCT acs = { 0 }; acs.hContact = m_hContact; acs.handleType = HANDLE_CONTACT; - acs.szProto = 0; + acs.szProto = nullptr; CallServiceSync(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); if (!(PopupOptions.actions&ACT_DEF_KEEPWND)) PUDeletePopup(m_hwnd); @@ -959,7 +959,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case ACT_DEF_PIN: if (m_bIsPinned) - SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, NULL); + SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, nullptr); else KillTimer(m_hwnd, POPUP_TIMER); @@ -1106,7 +1106,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara animate(); if ((newDelay <= 0) || (newDelay != m_avatarFrameDelay)) KillTimer(m_hwnd, AVATAR_TIMER); if (newDelay > 0) { - SetTimer(m_hwnd, AVATAR_TIMER, newDelay, 0); + SetTimer(m_hwnd, AVATAR_TIMER, newDelay, nullptr); m_avatarFrameDelay = newDelay; } } @@ -1147,7 +1147,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case WM_PAINT: - if (GetUpdateRect(m_hwnd, 0, FALSE)) { + if (GetUpdateRect(m_hwnd, nullptr, FALSE)) { PAINTSTRUCT ps; HDC mydc = BeginPaint(m_hwnd, &ps); BitBlt(mydc, 0, 0, m_sz.cx, m_sz.cy, m_bmp->getDC(), 0, 0, SRCCOPY); @@ -1212,7 +1212,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara } SendMessage(m_hwnd, UM_FREEPLUGINDATA, 0, 0); SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); - m_hwnd = 0; + m_hwnd = nullptr; DestroyWindow(m_hwndToolTip); @@ -1243,7 +1243,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara LRESULT CALLBACK PopupWnd2::WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - PopupWnd2 *wnd = 0; + PopupWnd2 *wnd = nullptr; if (message == WM_CREATE) { LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam; wnd = (PopupWnd2 *)cs->lpCreateParams; @@ -1259,7 +1259,7 @@ void WindowThread(void *arg) { Thread_SetName("POPUP: WindowThread"); - CoInitialize(NULL); // we may need OLE in this thread for smiley substitution + CoInitialize(nullptr); // we may need OLE in this thread for smiley substitution PopupWnd2 *wnd = (PopupWnd2 *)arg; wnd->buildMText(); @@ -1267,7 +1267,7 @@ void WindowThread(void *arg) PostMessage(wnd->getHwnd(), UM_INITPOPUP, 0, 0); MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { + while (GetMessage(&msg, nullptr, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } @@ -1287,7 +1287,7 @@ LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM HMENU hMenu = Menu_BuildContactMenu(hContact); HWND hwndSave = GetForegroundWindow(); SetForegroundWindow(hwnd); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, nullptr); SetForegroundWindow(hwndSave); DestroyMenu(hMenu); PostMessage((HWND)wParam, UM_MENUDONE, 0, 0); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 767fa11096..d4dcd4418e 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -122,7 +122,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) return -1; // Check if contact handle is valid. - char *proto = NULL; + char *proto = nullptr; if (ppd->lchContact) proto = GetContactProto(ppd->lchContact); @@ -157,7 +157,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (lParam & APF_CUSTOM_POPUP) ppd->flags |= PU2_CUSTOM_POPUP; - PopupWnd2 *wnd = new PopupWnd2(ppd, NULL, false); + PopupWnd2 *wnd = new PopupWnd2(ppd, nullptr, false); if (lParam & APF_RETURN_HWND) { while (!wnd->m_bWindowCreated) Sleep(1); return (INT_PTR)wnd->getHwnd(); @@ -414,7 +414,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam) { POPUPTREEDATA *ptd = (POPUPTREEDATA*)lParam; - if (ptd == NULL) + if (ptd == nullptr) return 1; for (int i = 0; i < gTreeData.getCount(); i++) @@ -439,14 +439,14 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) pc = (POPUPCLASS*)wParam; else { LPTSTR group = mir_a2u(pdc->pszClassName); - POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2); + POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, nullptr, 2); if (ptd) pc = &ptd->pupClass; else - pc = NULL; + pc = nullptr; mir_free(group); } - if (pc == NULL) + if (pc == nullptr) return 1; POPUPDATA2 ppd2 = { sizeof(ppd2) }; @@ -484,7 +484,7 @@ INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam) PopupOptions.SkinPack = mir_a2u((char*)lParam); } - const PopupSkin *skin = 0; + const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) { mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_wstrdup(skin->getName()); diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 9fb5e34439..157c9aa981 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -31,9 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. PopupSkin::PopupSkin(LPCTSTR aName) { for (int i = 0; i < 32; i++) - m_flag_names[i] = NULL; - m_elements = 0; - m_name = aName ? mir_wstrdup(aName) : NULL; + m_flag_names[i] = nullptr; + m_elements = nullptr; + m_name = aName ? mir_wstrdup(aName) : nullptr; } PopupSkin::~PopupSkin() @@ -173,7 +173,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options if (!m_elements) return; - SKINELEMENT *head = NULL; + SKINELEMENT *head = nullptr; int STYLE_SZ_CLOCK = 0; if (!this->useInternalClock()) @@ -240,7 +240,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options { RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc, - DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr); szNew.cx = rc.right; szNew.cy = rc.bottom; } @@ -283,7 +283,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options { RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc, - DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr); szNew.cx = rc.right; szNew.cy = rc.bottom; } @@ -417,7 +417,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW if (!m_elements) return; HDC hdc = bmp->getDC(); - SKINELEMENT *head = NULL; + SKINELEMENT *head = nullptr; int STYLE_SZ_CLOCK = 0; if (!this->useInternalClock()) @@ -502,7 +502,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW { RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy); DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc, - DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr); } break; case PopupWnd2::TT_MTEXT: @@ -550,7 +550,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy); DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc, - DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr); SelectObject(hdc, hFntSave); } break; @@ -718,7 +718,7 @@ bool PopupSkin::onMouseMove(PopupWnd2 *wnd, int x, int y) const } } - SetCursor(LoadCursor(NULL, hovered ? IDC_HAND : IDC_ARROW)); + SetCursor(LoadCursor(nullptr, hovered ? IDC_HAND : IDC_ARROW)); return res; } @@ -734,7 +734,7 @@ bool PopupSkin::onMouseLeave(PopupWnd2 *wnd) const } } - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return res; } @@ -778,7 +778,7 @@ bool PopupSkin::load(LPCTSTR dir) for (int i = 0; i < 32; i++) { if (m_flag_names[i]) { mir_free(m_flag_names[i]); - m_flag_names[i] = NULL; + m_flag_names[i] = nullptr; } } m_flags = 0; @@ -826,7 +826,7 @@ void PopupSkin::loadSkin(std::wistream &f) SKINELEMENT *head = new SKINELEMENT; m_elements = head; head->type = ST_NOTHING; - head->next = NULL; + head->next = nullptr; while (!f.eof()) { wchar_t buf[1024]; @@ -871,7 +871,7 @@ void PopupSkin::loadSkin(std::wistream &f) if (head->next && ((head->next->type & ST_TYPEMASK) == ST_CLOCK)) m_internalClock = false; head = head->next; - head->next = NULL; + head->next = nullptr; } else if (!mir_wstrcmp(buf, L"options")) { loadOptions(f); @@ -911,10 +911,10 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) SKINELEMENT *element = new SKINELEMENT; element->proportional = 0; element->type = ST_NOTHING | ST_BADPOS; - element->next = NULL; + element->next = nullptr; element->flag_mask = 0; element->flags = 0; - element->myBmp = NULL; + element->myBmp = nullptr; while (!f.eof()) { wchar_t buf[1024]; @@ -937,12 +937,12 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) else if (!mir_wstrcmp(buf, L"text")) { element->type = (element->type & ~ST_TYPEMASK) | ST_TEXT; element->textColor = (COLORREF)0xffffffff; - element->hfn = 0; + element->hfn = nullptr; } else if (!mir_wstrcmp(buf, L"title")) { element->type = (element->type & ~ST_TYPEMASK) | ST_TITLE; element->textColor = (COLORREF)0xffffffff; - element->hfn = 0; + element->hfn = nullptr; } else if (!mir_wstrcmp(buf, L"avatar")) { element->type = (element->type & ~ST_TYPEMASK) | ST_AVATAR; @@ -950,7 +950,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) else if (!mir_wstrcmp(buf, L"clock")) { element->type = (element->type & ~ST_TYPEMASK) | ST_CLOCK; element->textColor = (COLORREF)0xffffffff; - element->hfn = 0; + element->hfn = nullptr; } } else if (!mir_wstrcmp(buf, L"source")) { @@ -1057,7 +1057,7 @@ Skins skins; Skins::Skins() { - m_skins = 0; + m_skins = nullptr; } Skins::~Skins() @@ -1089,12 +1089,12 @@ bool Skins::load() m_skins->name = mir_wstrdup(L"* Popup Classic"); m_skins->dir = new wchar_t[1024]; mir_wstrcpy(m_skins->dir, L"res:classic.popupskin"); - m_skins->skin = 0; + m_skins->skin = nullptr; wchar_t dir[1024] = { '\0' }; if (ServiceExists(MS_FOLDERS_GET_PATH)) { - if (FoldersGetCustomPathT(folderId, dir, _countof(dir), NULL) != 0) + if (FoldersGetCustomPathT(folderId, dir, _countof(dir), nullptr) != 0) return false; } else { @@ -1120,7 +1120,7 @@ bool Skins::load() m_skins->name = mir_wstrdup(ffd.cFileName); m_skins->dir = new wchar_t[1024]; GetCurrentDirectory(1024, m_skins->dir); - m_skins->skin = 0; + m_skins->skin = nullptr; SetCurrentDirectory(L".."); } @@ -1137,7 +1137,7 @@ bool Skins::load() const PopupSkin *Skins::getSkin(LPCTSTR name) { - SKINLIST *any = 0; + SKINLIST *any = nullptr; for (SKINLIST *p = m_skins; p; p = p->next) { if (!mir_wstrcmp(p->name, L"* Popup Classic") || !any) any = p; @@ -1150,13 +1150,13 @@ const PopupSkin *Skins::getSkin(LPCTSTR name) if (any && any->skin) return any->skin; if (!any) - return 0; + return nullptr; any->skin = new PopupSkin(any->name); any->skin->load(any->dir); if (!any->skin->isCompatible()) - MessageBox(NULL, + MessageBox(nullptr, TranslateT("The skin you are trying to load is designed\r\nfor newer version of Popup plus. And will not\r\ndisplay properly.\r\n\r\nPlease choose another skin."), MODULNAME_LONG, MB_ICONSTOP | MB_OK); @@ -1181,6 +1181,6 @@ void Skins::freeAllButActive() for (SKINLIST *p = m_skins; p; p = p->next) if (mir_wstrcmpi(p->name, PopupOptions.SkinPack)) { delete p->skin; - p->skin = NULL; + p->skin = nullptr; } } diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index a13216a0f7..ba45fa7c30 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. on current active mode for user. *************************************************************************************/ -static MWindowList hDialogsList = NULL; +static MWindowList hDialogsList = nullptr; static void SrmmMenu_UpdateIcon(MCONTACT hContact) { @@ -88,7 +88,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam) CheckMenuItem(hMenu, 1 + mode, MF_BYCOMMAND | MF_CHECKED); - mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), NULL); + mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), nullptr); if (mode) { db_set_b(hContact, MODULNAME, "ShowMode", mode - 1); SrmmMenu_UpdateIcon(hContact); -- cgit v1.2.3