From 25d3cbef4a3a8fa09151de730deb7fcda94ffe4d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Sep 2017 22:22:27 +0300 Subject: Clist_Modern: - useless error message removed; - code cleaning; - version bump; --- plugins/Clist_modern/src/cluiframes.cpp | 252 ++++++------- plugins/Clist_modern/src/groupmenu.cpp | 2 +- plugins/Clist_modern/src/init.cpp | 4 +- plugins/Clist_modern/src/modern_aniavatars.cpp | 102 ++--- plugins/Clist_modern/src/modern_awaymsg.cpp | 16 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 60 +-- plugins/Clist_modern/src/modern_clc.cpp | 199 +++++----- plugins/Clist_modern/src/modern_clcidents.cpp | 6 +- plugins/Clist_modern/src/modern_clcitems.cpp | 64 ++-- plugins/Clist_modern/src/modern_clcmsgs.cpp | 42 +-- plugins/Clist_modern/src/modern_clcopts.cpp | 414 ++++++++++----------- plugins/Clist_modern/src/modern_clcpaint.cpp | 120 +++--- plugins/Clist_modern/src/modern_clcpaint.h | 10 +- plugins/Clist_modern/src/modern_clcutils.cpp | 206 +++++----- plugins/Clist_modern/src/modern_clist.h | 2 +- plugins/Clist_modern/src/modern_clistevents.cpp | 70 ++-- plugins/Clist_modern/src/modern_clistmenus.cpp | 6 +- plugins/Clist_modern/src/modern_clistmod.cpp | 48 +-- plugins/Clist_modern/src/modern_clistopts.cpp | 250 ++++++------- plugins/Clist_modern/src/modern_clistsettings.cpp | 32 +- plugins/Clist_modern/src/modern_clisttray.cpp | 110 +++--- plugins/Clist_modern/src/modern_clui.cpp | 362 +++++++++--------- plugins/Clist_modern/src/modern_contact.cpp | 10 +- plugins/Clist_modern/src/modern_docking.cpp | 38 +- plugins/Clist_modern/src/modern_gdiplus.cpp | 16 +- plugins/Clist_modern/src/modern_global.cpp | 6 +- plugins/Clist_modern/src/modern_global_structure.h | 101 ++--- plugins/Clist_modern/src/modern_image_array.cpp | 62 +-- plugins/Clist_modern/src/modern_image_array.h | 2 +- plugins/Clist_modern/src/modern_keyboard.cpp | 2 +- plugins/Clist_modern/src/modern_log.cpp | 2 +- plugins/Clist_modern/src/modern_newrowopts.cpp | 6 +- plugins/Clist_modern/src/modern_row.cpp | 28 +- .../Clist_modern/src/modern_rowheight_funcs.cpp | 52 +-- plugins/Clist_modern/src/modern_rowtemplateopt.cpp | 32 +- plugins/Clist_modern/src/modern_skinbutton.cpp | 78 ++-- plugins/Clist_modern/src/modern_skinengine.cpp | 294 +++++++-------- plugins/Clist_modern/src/modern_skinopt.cpp | 36 +- plugins/Clist_modern/src/modern_skinselector.cpp | 16 +- plugins/Clist_modern/src/modern_statusbar.cpp | 140 +++---- .../Clist_modern/src/modern_statusbar_options.cpp | 116 +++--- plugins/Clist_modern/src/modern_sync.cpp | 4 +- plugins/Clist_modern/src/modern_tbbutton.cpp | 60 +-- plugins/Clist_modern/src/modern_toolbar.cpp | 54 +-- plugins/Clist_modern/src/modern_utils.cpp | 12 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 136 +++---- plugins/Clist_modern/src/modern_xptheme.cpp | 2 +- plugins/Clist_modern/src/stdafx.h | 10 +- plugins/Clist_modern/src/version.h | 2 +- 49 files changed, 1846 insertions(+), 1848 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp index 9bb5405a88..ceb4d094c6 100644 --- a/plugins/Clist_modern/src/cluiframes.cpp +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -36,7 +36,7 @@ void _AniAva_OnModulesUnload(); void InitGroupMenus(void); // GLOBALS -FRAMEWND *g_pfwFrames = NULL; +FRAMEWND *g_pfwFrames = nullptr; int g_nFramesCount = 0; int g_nTitleBarHeight = DEFAULT_TITLEBAR_HEIGHT; @@ -61,13 +61,13 @@ static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam); static mir_cs _cluiFramesModuleCS; static BOOL _cluiFramesModuleCSInitialized = FALSE; static BOOL _fCluiFramesModuleNotStarted = TRUE; -static XPTHANDLE _hFrameTitleTheme = NULL; +static XPTHANDLE _hFrameTitleTheme = nullptr; static int _nClientFrameId = eUnknownId; //for fast access to frame with alclient properties static int _iNextFrameId = 100; -static HFONT _hTitleBarFont = NULL; +static HFONT _hTitleBarFont = nullptr; // menus -static FrameMenuHandles cont = { NULL }; +static FrameMenuHandles cont = { nullptr }; static LIST g_frameMenus(10); // others @@ -110,7 +110,7 @@ int CLUIFrames_OnMoving(HWND hwnd, RECT *r) for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (!F.floating && F.OwnerWindow != NULL && F.OwnerWindow != (HWND)-2) { + if (!F.floating && F.OwnerWindow != nullptr && F.OwnerWindow != (HWND)-2) { POINT pt = { 0 }; RECT wr; @@ -120,7 +120,7 @@ int CLUIFrames_OnMoving(HWND hwnd, RECT *r) int dy = (r->top - wr.top) + pt.y; int x = F.wndSize.left; int y = F.wndSize.top; - SetWindowPos(F.OwnerWindow, NULL, x + dx, y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOOWNERZORDER); + SetWindowPos(F.OwnerWindow, nullptr, x + dx, y + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOOWNERZORDER); } } @@ -133,19 +133,19 @@ int SetAlpha(BYTE Alpha) { for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (!F.floating && F.OwnerWindow != NULL && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { + if (!F.floating && F.OwnerWindow != nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { HWND hwnd = F.OwnerWindow; long l = GetWindowLongPtr(hwnd, GWL_EXSTYLE); if (!(l & WS_EX_LAYERED)) { - HWND parent = NULL; + HWND parent = nullptr; if (g_CluiData.fOnDesktop) { - HWND hProgMan = FindWindow(L"Progman", NULL); + HWND hProgMan = FindWindow(L"Progman", nullptr); if (IsWindow(hProgMan)) parent = hProgMan; } CLUI_ShowWindowMod(hwnd, SW_HIDE); - SetParent(hwnd, NULL); + SetParent(hwnd, nullptr); SetWindowLongPtr(hwnd, GWL_EXSTYLE, l | WS_EX_LAYERED); SetParent(hwnd, parent); if (l&WS_VISIBLE) CLUI_ShowWindowMod(hwnd, SW_SHOW); @@ -163,7 +163,7 @@ int CLUIFrames_RepaintSubContainers() for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) - RedrawWindow(F.hWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME); + RedrawWindow(F.hWnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME); } return 0; @@ -174,7 +174,7 @@ int CLUIFrames_ActivateSubContainers(BOOL active) for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; if (active && !F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { SetWindowPos(F.OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(F.OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } @@ -217,7 +217,7 @@ int CLUIFrames_OnShowHide(int mode) if (mode != SW_HIDE) { SetWindowPos(F.OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { SetWindowPos(F.OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(F.OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } @@ -261,7 +261,7 @@ static FRAMEWND* FindFrameByWnd(HWND hwnd) { int i; - if (hwnd == NULL) return(NULL); + if (hwnd == nullptr) return(nullptr); for (i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; @@ -269,7 +269,7 @@ static FRAMEWND* FindFrameByWnd(HWND hwnd) return &F; } - return NULL; + return nullptr; } @@ -279,9 +279,9 @@ int QueueAllFramesUpdating(bool queue) FRAMEWND &F = g_pfwFrames[i]; if (!g_CluiData.fLayered) { if (queue) - InvalidateRect(F.hWnd, NULL, FALSE); + InvalidateRect(F.hWnd, nullptr, FALSE); else - ValidateRect(F.hWnd, NULL); + ValidateRect(F.hWnd, nullptr); } if (F.PaintCallbackProc) { F.bQueued = queue; @@ -296,7 +296,7 @@ int QueueAllFramesUpdating(bool queue) int FindFrameID(HWND FrameHwnd) { - if (FrameHwnd == NULL) + if (FrameHwnd == nullptr) return 0; FRAMEWND *frm = FindFrameByItsHWND(FrameHwnd); @@ -305,17 +305,17 @@ int FindFrameID(HWND FrameHwnd) FRAMEWND* FindFrameByItsHWND(HWND FrameHwnd) { - if (FrameHwnd == NULL) return(NULL); + if (FrameHwnd == nullptr) return(nullptr); for (int i = 0; i < g_nFramesCount; i++) if (g_pfwFrames[i].hWnd == FrameHwnd) return &g_pfwFrames[i]; - return NULL; + return nullptr; } static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight) { - if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { + if ((pThumbRight->dockOpt.hwndLeft == nullptr) && (pThumbLeft->dockOpt.hwndRight == nullptr)) { pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; } @@ -324,20 +324,20 @@ static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight) static void UndockThumbs(FRAMEWND *pThumb1, FRAMEWND *pThumb2) { - if ((pThumb1 == NULL) || (pThumb2 == NULL)) + if ((pThumb1 == nullptr) || (pThumb2 == nullptr)) return; if (pThumb1->dockOpt.hwndRight == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndRight = NULL; + pThumb1->dockOpt.hwndRight = nullptr; if (pThumb1->dockOpt.hwndLeft == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndLeft = NULL; + pThumb1->dockOpt.hwndLeft = nullptr; if (pThumb2->dockOpt.hwndRight == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndRight = NULL; + pThumb2->dockOpt.hwndRight = nullptr; if (pThumb2->dockOpt.hwndLeft == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndLeft = NULL; + pThumb2->dockOpt.hwndLeft = nullptr; } static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) @@ -365,7 +365,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) BOOL bLeading; int frmidx = 0; - if (pThumb == NULL) return; + if (pThumb == nullptr) return; SIZE sizeScreen; sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN); @@ -382,7 +382,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) nNewY = nY < nOffs ? 0 : nY; nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - bLeading = pThumb->dockOpt.hwndRight != NULL; + bLeading = pThumb->dockOpt.hwndRight != nullptr; if (bMoveTogether) { UndockThumbs(pThumb, FindFrameByWnd(pThumb->dockOpt.hwndLeft)); @@ -398,7 +398,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) fakeTaskBarWindow.floating = TRUE; - while (pCurThumb != NULL) { + while (pCurThumb != nullptr) { if (pCurThumb->floating) { if (pCurThumb != pThumb) { @@ -600,7 +600,7 @@ static void GetBorderSize(HWND hwnd, RECT *rect) static char __inline *AS(char *str, const char *setting, char *addstr) { - if (str != NULL) { + if (str != nullptr) { mir_strcpy(str, setting); mir_strcat(str, addstr); } @@ -671,14 +671,14 @@ static int DBStoreFrameSettingsAtPos(int pos, int Frameid) static int LocateStorePosition(int Frameid, int maxstored) { - if (g_pfwFrames[Frameid].name == NULL) + if (g_pfwFrames[Frameid].name == nullptr) return -1; char settingname[255]; for (int i = 0; i < maxstored; i++) { mir_snprintf(settingname, "Name%d", i); DBVARIANT dbv = { 0 }; - if (db_get_ws(NULL, CLUIFrameModule, settingname, &dbv)) + if (db_get_ws(0, CLUIFrameModule, settingname, &dbv)) continue; if (mir_wstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) { @@ -763,7 +763,7 @@ static int CLUIFramesGetalClientFrame(void) static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) { HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi); - if (pmi->pszService != NULL) + if (pmi->pszService != nullptr) Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid); return res; } @@ -771,7 +771,7 @@ static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain) { if (_fCluiFramesModuleNotStarted) - return NULL; + return nullptr; int framepos = id2pos(frameid); FrameMenuHandles &fmh = (frameid == -1) ? cont : g_pfwFrames[framepos].MenuHandles; @@ -820,7 +820,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.position = popuppos++; mi.name.a = LPGEN("&Align"); mi.flags = CMIF_SYSTEM; - mi.pszService = NULL; + mi.pszService = nullptr; fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain); // align top @@ -846,7 +846,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.root = root; mi.position = popuppos++; mi.name.a = LPGEN("&Position"); - mi.pszService = NULL; + mi.pszService = nullptr; mi.root = addFrameMenuItem(&mi, frameid, bMain); mi.position = popuppos++; @@ -1064,7 +1064,7 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) else fw.TitleBar.tbname = mir_a2u((char*)lParam); - if (fw.floating && (fw.TitleBar.tbname != NULL)) + if (fw.floating && (fw.TitleBar.tbname != nullptr)) SetWindowText(fw.ContainerWnd, fw.TitleBar.tbname); return 0; @@ -1072,7 +1072,7 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) if (lParam == 0) return -1; - if (fw.TitleBar.tooltip != NULL) + if (fw.TitleBar.tooltip != nullptr) mir_free_and_nil(fw.TitleBar.tooltip); if (bUnicodeText) fw.TitleBar.tooltip = mir_wstrdup((LPTSTR)lParam); @@ -1398,7 +1398,7 @@ static int _us_DoCollapseFrame(WPARAM wParam, LPARAM lParam) g_pfwFrames[FrameId].collapsed = TRUE; } - SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); CLUIFramesStoreAllFrames(); @@ -1534,7 +1534,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) { int retval; LONG_PTR style; - //char * CustomName = NULL; + //char * CustomName = nullptr; CLISTFrame *clfrm = (CLISTFrame *)wParam; if (pcli->hwndContactList == 0) return -1; @@ -1564,13 +1564,13 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) }; g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags; - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { + if (clfrm->name == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(wchar_t)); GetClassName(g_pfwFrames[g_nFramesCount].hWnd, g_pfwFrames[g_nFramesCount].name, 255); } else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->wname) : mir_a2u(clfrm->name); - if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL + if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_wstrdup(g_pfwFrames[g_nFramesCount].name); else @@ -1595,15 +1595,15 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) | WS_CHILD | WS_CLIPCHILDREN | (g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | WS_CLIPCHILDREN, - 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); + 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_hInst, nullptr); SetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWLP_USERDATA, g_pfwFrames[g_nFramesCount].id); - g_pfwFrames[g_nFramesCount].TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, + g_pfwFrames[g_nFramesCount].TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - pcli->hwndContactList, NULL, g_hInst, - NULL); + pcli->hwndContactList, nullptr, g_hInst, + nullptr); SetWindowPos(g_pfwFrames[g_nFramesCount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); { @@ -1650,13 +1650,13 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) minHeight = CLUIFrames_GetTotalHeight(); if (mainHeight < minHeight) { BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(0, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); if (Upward) mainRect.top = mainRect.bottom - minHeight; else mainRect.bottom = mainRect.top + minHeight; - SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetWindowPos(pcli->hwndContactList, nullptr, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); } GetWindowRect(pcli->hwndContactList, &mainRect); mainHeight = mainRect.bottom - mainRect.top; @@ -1700,7 +1700,7 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) if (g_pfwFrames[pos].ContainerWnd && g_pfwFrames[pos].ContainerWnd != (HWND)-1) DestroyWindow(g_pfwFrames[pos].ContainerWnd); g_pfwFrames[pos].ContainerWnd = (HWND)-1; if (g_pfwFrames[pos].TitleBar.hmenu) DestroyMenu(g_pfwFrames[pos].TitleBar.hmenu); - g_pfwFrames[pos].PaintCallbackProc = NULL; + g_pfwFrames[pos].PaintCallbackProc = nullptr; if (g_pfwFrames[pos].UpdateRgn) DeleteObject(g_pfwFrames[pos].UpdateRgn); if (g_pfwFrames[pos].OwnerWindow != (HWND)-1 @@ -1708,12 +1708,12 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) && g_pfwFrames[pos].OwnerWindow != (HWND)0) DestroyWindow(g_pfwFrames[pos].OwnerWindow); - g_pfwFrames[pos].OwnerWindow = NULL; + g_pfwFrames[pos].OwnerWindow = nullptr; RemoveItemFromList(pos, &g_pfwFrames, &g_nFramesCount); - cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE); return 0; }; @@ -1722,7 +1722,7 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) { if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + RedrawWindow(Frame->TitleBar.hwnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); //UpdateWindow(Frame->TitleBar.hwnd); return 0; } @@ -1730,12 +1730,12 @@ static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) { if (Frame->hWnd != 0) { - RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(Frame->hWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); UpdateWindow(Frame->hWnd); } if (Frame->floating && Frame->ContainerWnd != 0) - RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + RedrawWindow(Frame->ContainerWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } @@ -1771,17 +1771,17 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame) } { - SetWindowPos(Frame->OwnerWindow, NULL, Frame->wndSize.left + Off.x, Frame->wndSize.top + Off.y, + SetWindowPos(Frame->OwnerWindow, nullptr, Frame->wndSize.left + Off.x, Frame->wndSize.top + Off.y, Frame->wndSize.right - Frame->wndSize.left, Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); //- -= -= - SetWindowPos(Frame->hWnd, NULL, 0, 0, + SetWindowPos(Frame->hWnd, nullptr, 0, 0, Frame->wndSize.right - Frame->wndSize.left, Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); } // set titlebar position if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, + SetWindowPos(Frame->TitleBar.hwnd, nullptr, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, Frame->wndSize.right - Frame->wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1793,12 +1793,12 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame) } else { // set frame position - SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left, Frame->wndSize.top, + SetWindowPos(Frame->hWnd, nullptr, Frame->wndSize.left, Frame->wndSize.top, Frame->wndSize.right - Frame->wndSize.left, Frame->wndSize.bottom - Frame->wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); // set titlebar position if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, + SetWindowPos(Frame->TitleBar.hwnd, nullptr, Frame->wndSize.left, Frame->wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, Frame->wndSize.right - Frame->wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); @@ -1834,7 +1834,7 @@ static BOOL CLUIFramesFitInSize(void) int CLUIFrames_GetTotalHeight() { - if (pcli->hwndContactList == NULL) return 0; + if (pcli->hwndContactList == nullptr) return 0; int sumheight = 0; RECT border; @@ -1855,7 +1855,7 @@ int CLUIFrames_GetTotalHeight() //TODO minsize sumheight += g_CluiData.TopClientMargin; sumheight += g_CluiData.BottomClientMargin; - return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), + return max(db_get_w(0, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), (sumheight + border.top + border.bottom)); } @@ -1864,7 +1864,7 @@ int CLUIFramesGetMinHeight() int tbh = 0, sumheight = 0; RECT border; int allbord = 0; - if (pcli->hwndContactList == NULL) return 0; + if (pcli->hwndContactList == nullptr) return 0; // search for alClient frame and get the titlebar's height @@ -1893,7 +1893,7 @@ int CLUIFramesGetMinHeight() //TODO minsize sumheight += g_CluiData.TopClientMargin; sumheight += g_CluiData.BottomClientMargin; - return max(db_get_w(NULL, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), + return max(db_get_w(0, "CLUI", "MinHeight", SETTING_MINHEIGTH_DEFAULT), (sumheight + border.top + border.bottom + allbord + tbh)); } @@ -1913,8 +1913,8 @@ static int CLUIFramesResizeFrames(const RECT newsize) SortData *sdarray; - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); if (g_nFramesCount < 1) return 0; newheight = newsize.bottom - newsize.top; @@ -1936,7 +1936,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) { //sorting stuff sdarray = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); - if (sdarray == NULL) return -1;; + if (sdarray == nullptr) return -1;; for (i = 0; i < g_nFramesCount; i++) { sdarray[i].order = g_pfwFrames[i].order; sdarray[i].realpos = i; @@ -2037,7 +2037,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) SetRect(&F.TitleBar.wndSize, F.wndSize.left, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, F.wndSize.right, F.wndSize.top - g_CluiData.nGapBetweenTitlebar); } - if (sdarray != NULL) + if (sdarray != nullptr) free(sdarray); return 0; @@ -2115,8 +2115,8 @@ static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam) int CLUIFrames_OnClistResize_mod(WPARAM, LPARAM mode) { int tick; - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); if (_fCluiFramesModuleNotStarted) return -1; RECT nRect; @@ -2146,8 +2146,8 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) RECT nRect; if (_fCluiFramesModuleNotStarted) return -1; - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); nRect.left = 0; nRect.top = 0; nRect.right = r->right - r->left; @@ -2168,16 +2168,16 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) } if (F.OwnerWindow && (INT_PTR)(F.OwnerWindow) != -2) { if (!(mode & 2)) { - if (NULL != F.OwnerWindow) { /* Wine fix. */ - *PosBatch = DeferWindowPos(*PosBatch, F.OwnerWindow, NULL, F.wndSize.left + r->left, F.wndSize.top + r->top, + if (nullptr != F.OwnerWindow) { /* Wine fix. */ + *PosBatch = DeferWindowPos(*PosBatch, F.OwnerWindow, nullptr, F.wndSize.left + r->left, F.wndSize.top + r->top, F.wndSize.right - F.wndSize.left, F.wndSize.bottom - F.wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE); - SetWindowPos(F.hWnd, NULL, 0, 0, + SetWindowPos(F.hWnd, nullptr, 0, 0, F.wndSize.right - F.wndSize.left, F.wndSize.bottom - F.wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE/*|SWP_NOSENDCHANGING*/); } } //Frame if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, F.wndSize.right - F.wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE); SetRect(&F.TitleBar.wndSize, F.wndSize.left, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, F.wndSize.right, F.wndSize.top - g_CluiData.nGapBetweenTitlebar); UpdateWindow(F.TitleBar.hwnd); @@ -2187,14 +2187,14 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) if (1) { int res = 0; // set frame position - res = SetWindowPos(F.hWnd, NULL, F.wndSize.left + dx, F.wndSize.top + dy, + res = SetWindowPos(F.hWnd, nullptr, F.wndSize.left + dx, F.wndSize.top + dy, F.wndSize.right - F.wndSize.left, F.wndSize.bottom - F.wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); } if (1) { // set titlebar position if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, F.wndSize.right - F.wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); SetRect(&F.TitleBar.wndSize, F.wndSize.left, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, F.wndSize.right, F.wndSize.top - g_CluiData.nGapBetweenTitlebar); @@ -2218,8 +2218,8 @@ int CheckFramesPos(RECT *wr) //CALLED only FROM MainWindow procedure at CLUI.c if (_fCluiFramesModuleNotStarted) return -1; - g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; @@ -2230,13 +2230,13 @@ int CheckFramesPos(RECT *wr) RECT r; GetWindowRect(F.hWnd, &r); if (r.top - wr->top != F.wndSize.top || r.left - wr->left != F.wndSize.left) - SetWindowPos(F.hWnd, NULL, F.wndSize.left, F.wndSize.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(F.hWnd, nullptr, F.wndSize.left, F.wndSize.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); } if (F.TitleBar.ShowTitleBar) { RECT r; GetWindowRect(F.TitleBar.hwnd, &r); if (r.top - wr->top != F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar || r.left - wr->left != F.wndSize.left) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + dx, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy, F.wndSize.right - F.wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); SetRect(&F.TitleBar.wndSize, F.wndSize.left, F.wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, F.wndSize.right, F.wndSize.top - g_CluiData.nGapBetweenTitlebar); } @@ -2251,8 +2251,8 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) { RECT nRect; int tick; - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); - g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + g_CluiData.nGapBetweenTitlebar = db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT); if (_fCluiFramesModuleNotStarted) return -1; @@ -2265,13 +2265,13 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) minHeight = CLUIFrames_GetTotalHeight(); if (mainHeight < minHeight) { BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(0, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT); if (Upward) mainRect.top = mainRect.bottom - minHeight; else mainRect.bottom = mainRect.top + minHeight; - SetWindowPos(pcli->hwndContactList, NULL, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetWindowPos(pcli->hwndContactList, nullptr, mainRect.left, mainRect.top, mainRect.right - mainRect.left, mainRect.bottom - mainRect.top, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING); } GetWindowRect(pcli->hwndContactList, &mainRect); mainHeight = mainRect.bottom - mainRect.top; @@ -2298,7 +2298,7 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) } - //if (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus); + //if (db_get_b(0,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT))GetWindowRect(pcli->hwndStatus,&rcStatus); //else rcStatus.top = rcStatus.bottom = 0; // nRect.top--; /* $$$ rcStatus.top = rcStatus.bottom = 0; @@ -2332,10 +2332,10 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick; - if (pcli->hwndContactList != 0) cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + if (pcli->hwndContactList != 0) cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE); if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); - if (lParam == 2) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); + if (lParam == 2) RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); Sleep(0); @@ -2350,29 +2350,29 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) { if (MirandaExiting()) return 0; { - AlignCOLLIconToLeft = db_get_b(NULL, "FrameTitleBar", "AlignCOLLIconToLeft", CLCDEFAULT_COLLICONTOLEFT); + AlignCOLLIconToLeft = db_get_b(0, "FrameTitleBar", "AlignCOLLIconToLeft", CLCDEFAULT_COLLICONTOLEFT); sttBkColour = cliGetColor("FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); - sttBkUseWinColours = db_get_b(NULL, "FrameTitleBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + sttBkUseWinColours = db_get_b(0, "FrameTitleBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); sttSelBkColour = cliGetColor("FrameTitleBar", "TextColour", CLCDEFAULT_TEXTCOLOUR); if (sttBmpBackground) { DeleteObject(sttBmpBackground); - sttBmpBackground = NULL; + sttBmpBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { - if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmapName(db_get_wsa(NULL, "FrameTitleBar", "BkBitmap")); + if (db_get_b(0, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmapName(db_get_wsa(0, "FrameTitleBar", "BkBitmap")); if (tszBitmapName) sttBmpBackground = Bitmap_Load(tszBitmapName); } - sttBackgroundBmpUse = db_get_w(NULL, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + sttBackgroundBmpUse = db_get_w(0, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } } cliInvalidateRect(pcli->hwndContactList, 0, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); return 0; } @@ -2390,7 +2390,7 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo if (mhdc) { hdc = mhdc; - rcPaint = NULL; + rcPaint = nullptr; } else { hdc = BeginPaint(hwnd, &paintst); @@ -2398,10 +2398,10 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo } GetClientRect(hwnd, &clRect); - if (rcPaint == NULL) rcPaint = &clRect; + if (rcPaint == nullptr) rcPaint = &clRect; if (rcPaint->right - rcPaint->left == 0 || rcPaint->top - rcPaint->bottom == 0) rcPaint = &clRect; 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); HFONT oFont = (HFONT)SelectObject(hdcMem, hFont); SetBkMode(hdcMem, TRANSPARENT); @@ -2485,7 +2485,7 @@ int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) BOOL bThemed = FALSE; HDC hdcMem; RECT rc = *rect; - HBITMAP b1 = NULL, b2 = NULL; + HBITMAP b1 = nullptr, b2 = nullptr; hdcMem = CreateCompatibleDC(hdcMem2); SetBkMode(hdcMem, TRANSPARENT); @@ -2538,8 +2538,8 @@ int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) RECT textrc = rc; if (!AlignCOLLIconToLeft) { - if (g_pfwFrames[pos].TitleBar.hicon != NULL) { - ske_DrawIconEx(hdcMem, rc.left + 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CYSMICON) >> 1)), g_pfwFrames[pos].TitleBar.hicon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + if (g_pfwFrames[pos].TitleBar.hicon != nullptr) { + ske_DrawIconEx(hdcMem, rc.left + 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CYSMICON) >> 1)), g_pfwFrames[pos].TitleBar.hicon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL); textrc.left += GetSystemMetrics(SM_CXSMICON) + 4; textrc.top += 2; } @@ -2555,9 +2555,9 @@ int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) ske_TextOut(hdcMem, textrc.left, textrc.top, g_pfwFrames[pos].TitleBar.tbname, (int)mir_wstrlen(g_pfwFrames[pos].TitleBar.tbname)); if (!AlignCOLLIconToLeft) - ske_DrawIconEx(hdcMem, g_pfwFrames[pos].TitleBar.wndSize.right - GetSystemMetrics(SM_CXSMICON) - 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + ske_DrawIconEx(hdcMem, g_pfwFrames[pos].TitleBar.wndSize.right - GetSystemMetrics(SM_CXSMICON) - 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL); else - ske_DrawIconEx(hdcMem, rc.left, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + ske_DrawIconEx(hdcMem, rc.left, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL); } if (g_pfwFrames[pos].floating || (!g_CluiData.fLayered)) { @@ -2607,7 +2607,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam case WM_ENABLE: if (hwnd != 0) - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return 0; case WM_ERASEBKGND: @@ -2698,7 +2698,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam //ScreenToClient(Frames[framepos].ContainerWnd,&Frames[framepos].TitleBar.oldpos); if ((!(wParam&MK_CONTROL)) && g_pfwFrames[framepos].Locked && (!(g_pfwFrames[framepos].floating))) { - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { POINT pt; int res; //pt = nm->pt; @@ -2952,7 +2952,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam break; case WM_SIZE: - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); case WM_PAINT: @@ -2961,7 +2961,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam HDC paintDC = GetDC(hwnd); DrawTitleBar(paintDC, &rect, Frameid); ReleaseDC(hwnd, paintDC); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -3020,7 +3020,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP BYTE alpha; if ((wParam != WA_INACTIVE || ((HWND)lParam == hwnd) || GetParent((HWND)lParam) == hwnd)) { HWND hw = lParam ? GetParent((HWND)lParam) : 0; - alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); + alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT); if (hw) SetWindowPos(hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); CLUI_SmoothAlphaTransition(hwnd, alpha, 1); } @@ -3068,7 +3068,7 @@ static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int h HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, 0, g_hInst, 0); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER)); if (g_CluiData.fOnDesktop) { - HWND hProgMan = FindWindow(L"Progman", NULL); + HWND hProgMan = FindWindow(L"Progman", nullptr); if (IsWindow(hProgMan)) SetParent(hwnd, hProgMan); } @@ -3199,7 +3199,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP return 0; case WM_LBUTTONDOWN: - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { POINT pt; GetCursorPos(&pt); return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); @@ -3323,7 +3323,7 @@ int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { /* HOOK */ CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false); + CLUIFramesCreateMenuForFrame(-1, nullptr, 000010000, false); return 0; } @@ -3332,7 +3332,7 @@ int CLUIFrameOnModulesUnload(WPARAM, LPARAM) g_CluiData.bSTATE = STATE_PREPARETOEXIT; if (cont.MIVisible) { - cont.MIVisible = NULL; + cont.MIVisible = nullptr; _AniAva_OnModulesUnload(); } return 0; @@ -3346,7 +3346,7 @@ int LoadCLUIFramesModule(void) wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; wndclass.lpfnWndProc = CLUIFrameTitleBarProc; wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); wndclass.lpszClassName = CLUIFrameTitleBarClassName; RegisterClass(&wndclass); @@ -3355,7 +3355,7 @@ int LoadCLUIFramesModule(void) subconclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; subconclass.lpfnWndProc = CLUIFrameSubContainerProc; subconclass.hInstance = g_hInst; - subconclass.hCursor = LoadCursor(NULL, IDC_ARROW); + subconclass.hCursor = LoadCursor(nullptr, IDC_ARROW); subconclass.lpszClassName = CLUIFrameSubContainerClassName; RegisterClass(&subconclass); @@ -3364,12 +3364,12 @@ int LoadCLUIFramesModule(void) cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | CS_DROPSHADOW; cntclass.lpfnWndProc = CLUIFrameContainerWndProc; cntclass.hInstance = g_hInst; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.hCursor = LoadCursor(nullptr, IDC_ARROW); cntclass.lpszClassName = L"FramesContainer"; RegisterClass(&cntclass); //end container helper - GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); + GapBetweenFrames = db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT); g_nFramesCount = 0; InitGroupMenus(); @@ -3384,7 +3384,7 @@ int LoadCLUIFramesModule(void) UNSET_UID(mi); mi.root = cont.MainMenuItem; - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.flags = CMIF_UNMOVABLE; // create "show all frames" menu @@ -3416,7 +3416,7 @@ int LoadCLUIFramesModule(void) CreateCluiFramesServices(); - hWndExplorerToolBar = FindWindowEx(0, 0, L"Shell_TrayWnd", NULL); + hWndExplorerToolBar = FindWindowEx(0, 0, L"Shell_TrayWnd", nullptr); OnFrameTitleBarBackgroundChange(0, 0); _fCluiFramesModuleNotStarted = FALSE; return 0; @@ -3427,15 +3427,15 @@ int UnLoadCLUIFramesModule(void) _fCluiFramesModuleNotStarted = TRUE; if (sttBmpBackground) { DeleteObject(sttBmpBackground); - sttBmpBackground = NULL; + sttBmpBackground = nullptr; } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); CLUIFramesStoreAllFrames(); CLUIFrameOnModulesUnload(0, 0); - if (cont.MainMenuItem != NULL) { + if (cont.MainMenuItem != nullptr) { Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = NULL; + cont.MainMenuItem = nullptr; } for (int i = 0; i < g_nFramesCount; i++) { @@ -3463,7 +3463,7 @@ int UnLoadCLUIFramesModule(void) } free(g_pfwFrames); - g_pfwFrames = NULL; + g_pfwFrames = nullptr; g_nFramesCount = 0; UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); DeleteObject(_hTitleBarFont); @@ -3482,7 +3482,7 @@ static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam) if (lParam) frm->PaintCallbackProc = (tPaintCallbackProc)lParam; else - frm->PaintCallbackProc = NULL; + frm->PaintCallbackProc = nullptr; return 1; } @@ -3491,7 +3491,7 @@ int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd) for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; if (fLayeredMode) { - if (F.visible && GetParent(F.hWnd) == pcli->hwndContactList && F.PaintCallbackProc == NULL) { + if (F.visible && GetParent(F.hWnd) == pcli->hwndContactList && F.PaintCallbackProc == nullptr) { //create owner window F.OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, F.FloatingPos.x, F.FloatingPos.y, 10, 10); SetParent(F.hWnd, F.OwnerWindow); @@ -3519,7 +3519,7 @@ int CLUIFrames_UpdateBorders() if (!g_CluiData.fLayered && F.UseBorder) style |= WS_BORDER; SetWindowLongPtr(F.hWnd, GWL_STYLE, style); CLUIFramesModifyMainMenuItems(F.id, 0); - RedrawWindow(F.hWnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(F.hWnd, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); } } diff --git a/plugins/Clist_modern/src/groupmenu.cpp b/plugins/Clist_modern/src/groupmenu.cpp index f912b9da89..3f1cc65679 100644 --- a/plugins/Clist_modern/src/groupmenu.cpp +++ b/plugins/Clist_modern/src/groupmenu.cpp @@ -34,7 +34,7 @@ void InitSubGroupMenus(void); INT_PTR GroupMenuOnAddService(WPARAM wParam, LPARAM lParam) { MENUITEMINFO *mii = (MENUITEMINFO*)wParam; - if (mii == NULL) + if (mii == nullptr) return 0; if (hGroupMainMenuItemProxy == (HANDLE)lParam) { diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index b987deaac7..381136d9d7 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CHECKRES(sub) if (sub != S_OK) return S_FALSE; HINSTANCE g_hInst = 0, g_hMirApp = 0; -CLIST_INTERFACE *pcli = NULL; +CLIST_INTERFACE *pcli = nullptr; CLIST_INTERFACE corecli = { 0 }; CLUIDATA g_CluiData = { 0 }; int hLangpack; @@ -104,7 +104,7 @@ extern "C" __declspec(dllexport) int Unload(void) if (IsWindow(pcli->hwndContactList)) DestroyWindow(pcli->hwndContactList); - pcli->hwndContactList = NULL; + pcli->hwndContactList = nullptr; ToolbarButtonUnloadModule(); BackgroundsUnloadModule(); diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 9a4a823174..8e374b19eb 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -155,8 +155,8 @@ static int _AniAva_SortAvatarInfo(const ANIAVA_INFO *aai1, const ANIAVA_INFO *aa if (aai1 && aai1->tcsFilename && aai2 && aai2->tcsFilename) res = mir_wstrcmpi(aai2->tcsFilename, aai1->tcsFilename); else { - int a1 = (aai1 != NULL && aai1->tcsFilename != NULL); - int a2 = (aai2 != NULL && aai2->tcsFilename != NULL); + int a1 = (aai1 != nullptr && aai1->tcsFilename != nullptr); + int a2 = (aai2 != nullptr && aai2->tcsFilename != nullptr); res = a1 - a2; } if (res) @@ -176,7 +176,7 @@ static BOOL s_bSeparateWindow; static void _AniAva_AnimationTreadProc(void*) { - Netlib_Logf(NULL, "AnimationTreadProc thread start"); + Netlib_Logf(nullptr, "AnimationTreadProc thread start"); // wait forever till hExitEvent signalled HANDLE hThread = 0; @@ -192,8 +192,8 @@ static void _AniAva_AnimationTreadProc(void*) ResetEvent(s_hExitEvent); if (rc == WAIT_OBJECT_0 + 1) { MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if (msg.hwnd != NULL && IsDialogMessage(msg.hwnd, &msg)) /* Wine fix. */ + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { + if (msg.hwnd != nullptr && IsDialogMessage(msg.hwnd, &msg)) /* Wine fix. */ continue; TranslateMessage(&msg); DispatchMessage(&msg); @@ -203,12 +203,12 @@ static void _AniAva_AnimationTreadProc(void*) break; } - Netlib_Logf(NULL, "AnimationTreadProc thread end"); + Netlib_Logf(nullptr, "AnimationTreadProc thread end"); CloseHandle(s_AnimationThreadHandle); - s_AnimationThreadHandle = NULL; + s_AnimationThreadHandle = nullptr; CloseHandle(s_hExitEvent); - s_hExitEvent = NULL; + s_hExitEvent = nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -229,19 +229,19 @@ static void CALLBACK _AniAva_SyncCallerUserAPCProc(DWORD_PTR dwParam) static INT_PTR _AniAva_CreateAvatarWindowSync_Worker(WPARAM tszName, LPARAM) { HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_NOPARENTNOTIFY, ANIAVAWINDOWCLASS, - (wchar_t*)tszName, WS_POPUP, 0, 0, 1, 1, pcli->hwndContactList, NULL, pcli->hInst, NULL); + (wchar_t*)tszName, WS_POPUP, 0, 0, 1, 1, pcli->hwndContactList, nullptr, pcli->hInst, nullptr); return (INT_PTR)hwnd; } static HWND _AniAva_CreateAvatarWindowSync(wchar_t *szFileName) { if (s_AnimationThreadHandle == 0 || s_AnimationThreadID == 0) - return NULL; + return nullptr; ANIAVA_SYNCCALLITEM item = { 0 }; item.wParam = (WPARAM)szFileName; item.pfnProc = _AniAva_CreateAvatarWindowSync_Worker; - item.hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + item.hDoneEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); if (GetCurrentThreadId() != s_AnimationThreadID) QueueUserAPC(_AniAva_SyncCallerUserAPCProc, s_AnimationThreadHandle, (DWORD_PTR)&item); else @@ -279,10 +279,10 @@ static void _AniAva_RemoveAniAvaDC() SelectObject(s_hAniAvaDC, s_hAniAvaOldBitmap); DeleteObject(s_hAniAvaBitmap); DeleteDC(s_hAniAvaDC); - s_hAniAvaDC = NULL; + s_hAniAvaDC = nullptr; s_height = 0; s_width = 0; - s_hAniAvaBitmap = NULL; + s_hAniAvaBitmap = nullptr; } } @@ -313,7 +313,7 @@ static void _AniAva_RealRemoveAvatar(DWORD UniqueID) if (i != j) newHeight = max(newHeight, s_AniAvatarList[i]->FrameSize.cy); - HDC hNewDC = CreateCompatibleDC(NULL); + HDC hNewDC = CreateCompatibleDC(nullptr); HBITMAP hNewBmp = ske_CreateDIB32(newWidth, newHeight); HBITMAP hNewOldBmp = (HBITMAP)SelectObject(hNewDC, hNewBmp); // copy from old and from new strip @@ -355,17 +355,17 @@ static int _AniAva_LoadAvatarFromImage(wchar_t * szFileName, int width, int heig paai->dwAvatarUniqId = rand(); // get image strip - HBITMAP hBitmap = NULL; + HBITMAP hBitmap = nullptr; GDIPlus_ExtractAnimatedGIF(szFileName, width, height, hBitmap, paai->pFrameDelays, paai->nFrameCount, paai->FrameSize); // copy image to temp DC - HDC hTempDC = CreateCompatibleDC(NULL); + HDC hTempDC = CreateCompatibleDC(nullptr); HBITMAP hOldBitmap = (HBITMAP)SelectObject(hTempDC, hBitmap); int newWidth = s_width + paai->FrameSize.cx*paai->nFrameCount; int newHeight = max(paai->FrameSize.cy, s_height); - HDC hNewDC = CreateCompatibleDC(NULL); + HDC hNewDC = CreateCompatibleDC(nullptr); HBITMAP hNewBmp = ske_CreateDIB32(newWidth, newHeight); HBITMAP hNewOldBmp = (HBITMAP)SelectObject(hNewDC, hNewBmp); @@ -399,7 +399,7 @@ static int _AniAva_LoadAvatarFromImage(wchar_t * szFileName, int width, int heig } else paai = s_AniAvatarList[idx]; - if (paai == NULL) + if (paai == nullptr) return 0; paai->nRefCount++; @@ -431,7 +431,7 @@ static BOOL _AniAva_GetAvatarImageInfo(DWORD dwAvatarUniqId, ANIAVATARIMAGEINFO static void _AniAva_Clear_ANIAVA_WINDOWINFO(ANIAVA_WINDOWINFO *pavwi) { - pavwi->delaysInterval = NULL; + pavwi->delaysInterval = nullptr; pavwi->nFramesCount = 0; KillTimer(pavwi->hWindow, 2); pavwi->bPlaying = FALSE; @@ -443,18 +443,18 @@ static void _AniAva_LoadOptions() aacheck; mir_cslock lck(s_CS); - s_bFlags = (db_get_b(NULL, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) ? AAO_HAS_BORDER : 0) | - (db_get_b(NULL, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) ? AAO_ROUND_CORNERS : 0) | - (db_get_b(NULL, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT) ? AAO_HAS_OVERLAY : 0) | + s_bFlags = (db_get_b(0, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) ? AAO_HAS_BORDER : 0) | + (db_get_b(0, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) ? AAO_ROUND_CORNERS : 0) | + (db_get_b(0, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT) ? AAO_HAS_OVERLAY : 0) | ((0) ? AAO_OPAQUE : 0); if (s_bFlags & AAO_HAS_BORDER) - s_borderColor = (COLORREF)db_get_dw(NULL, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT); + s_borderColor = (COLORREF)db_get_dw(0, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT); if (s_bFlags & AAO_ROUND_CORNERS) - s_cornerRadius = db_get_b(NULL, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) ? db_get_w(NULL, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT) : 0; + s_cornerRadius = db_get_b(0, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) ? db_get_w(0, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT) : 0; if (s_bFlags & AAO_HAS_OVERLAY) { // check image list - BYTE type = db_get_b(NULL, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT); + BYTE type = db_get_b(0, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT); switch (type) { case SETTING_AVATAR_OVERLAY_TYPE_NORMAL: s_overlayIconImageList = hAvatarOverlays; @@ -464,12 +464,12 @@ static void _AniAva_LoadOptions() s_overlayIconImageList = g_himlCListClc; break; default: - s_overlayIconImageList = NULL; + s_overlayIconImageList = nullptr; } } if (s_bFlags & AAO_OPAQUE) s_bkgColor = 0; - s_bSeparateWindow = db_get_b(NULL, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT); + s_bSeparateWindow = db_get_b(0, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT); } static void _AniAva_InvalidateParent(ANIAVA_WINDOWINFO * dat) @@ -480,12 +480,12 @@ static void _AniAva_InvalidateParent(ANIAVA_WINDOWINFO * dat) pcli->pfnInvalidateRect(hwndParent, &rcPos, FALSE); } -static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, RECT *rcInParent = NULL) +static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = nullptr, RECT *rcInParent = nullptr) { if (dat->bPaused > 0) { dat->bPended = TRUE; return; } else dat->bPended = FALSE; - if (IMMEDIATE_DRAW && hdcParent == NULL) return; + if (IMMEDIATE_DRAW && hdcParent == nullptr) return; GdiFlush(); if (dat->bPlaying && IsWindowVisible(dat->hWindow)) { @@ -493,12 +493,12 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, SIZE szWnd = { dat->rcPos.right - dat->rcPos.left, dat->rcPos.bottom - dat->rcPos.top }; BLENDFUNCTION bf = { AC_SRC_OVER, 0, BYTE(g_CluiData.bCurrentAlpha * dat->bAlpha / 256), AC_SRC_ALPHA }; POINT pt_from = { 0, 0 }; - HDC hDC_animation = GetDC(NULL); + HDC hDC_animation = GetDC(nullptr); HDC copyFromDC; RECT clistRect; - HDC tempDC = NULL; - HBITMAP hBmp = NULL; - HBITMAP hOldBmp = NULL; + HDC tempDC = nullptr; + HBITMAP hBmp = nullptr; + HBITMAP hOldBmp = nullptr; if (s_bFlags == 0) { //simple and fastest method - no borders, round corners and etc. just copy pt_from.x = dat->ptFromPoint.x + dat->currentFrame*dat->sizeAvatar.cx; @@ -507,9 +507,9 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, } else { // ... need to create additional hDC_animation - HRGN hRgn = NULL; + HRGN hRgn = nullptr; int cornerRadius = s_cornerRadius; - tempDC = CreateCompatibleDC(NULL); + tempDC = CreateCompatibleDC(nullptr); hBmp = ske_CreateDIB32(szWnd.cx, szWnd.cy); hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp); if (s_bFlags & AAO_ROUND_CORNERS) @@ -606,7 +606,7 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, } else dat->bPlaying = FALSE; - ReleaseDC(NULL, hDC_animation); + ReleaseDC(nullptr, hDC_animation); if (tempDC) { SelectObject(tempDC, hOldBmp); DeleteObject(hBmp); @@ -622,7 +622,7 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - ANIAVA_WINDOWINFO *dat = NULL; + ANIAVA_WINDOWINFO *dat = nullptr; if (msg == WM_TIMER || msg == WM_DESTROY || (msg > AAM_FIRST && msg < AAM_LAST)) dat = (ANIAVA_WINDOWINFO *)GetWindowLongPtr(hwnd, GWLP_USERDATA); @@ -669,7 +669,7 @@ static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case AAM_SETPOSITION: if (dat->delaysInterval) { ANIAVA_POSINFO *papi = (ANIAVA_POSINFO*)lParam; - if (papi != NULL) { + if (papi != nullptr) { dat->rcPos = papi->rcPos; dat->overlayIconIdx = papi->idxOverlay; dat->bAlpha = papi->bAlpha; @@ -679,7 +679,7 @@ static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR ShowWindow(hwnd, SW_SHOWNA); dat->currentFrame = 0; KillTimer(hwnd, 2); - SetTimer(hwnd, 2, dat->delaysInterval[0], NULL); + SetTimer(hwnd, 2, dat->delaysInterval[0], nullptr); } if (!IMMEDIATE_DRAW) _AniAva_RenderAvatar(dat); @@ -757,7 +757,7 @@ static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR _AniAva_InvalidateParent(dat); KillTimer(hwnd, 2); - SetTimer(hwnd, 2, dat->delaysInterval[dat->currentFrame] + 1, NULL); + SetTimer(hwnd, 2, dat->delaysInterval[dat->currentFrame] + 1, nullptr); return 0; case WM_DESTROY: @@ -782,14 +782,14 @@ int AniAva_AddAvatar(MCONTACT hContact, wchar_t * szFilename, int width, int hei mir_cslock lck(s_CS); // first try to find window for contact avatar - HWND hwnd = NULL; + HWND hwnd = nullptr; ANIAVA_OBJECT *pavi = FindAvatarByContact(hContact); - if (pavi != NULL) { + if (pavi != nullptr) { if (pavi->ObjectSize.cx == width && pavi->ObjectSize.cy == heigth) hwnd = pavi->hWindow; else { DestroyWindow(pavi->hWindow); - pavi->hWindow = NULL; + pavi->hWindow = nullptr; _AniAva_RealRemoveAvatar(pavi->dwAvatarUniqId); pavi->dwAvatarUniqId = 0; } @@ -882,7 +882,7 @@ int AniAva_RemoveInvalidatedAvatars() SendMessage(pai.hWindow, AAM_STOP, 0, 0); pai.bInvalidPos = 0; DestroyWindow(pai.hWindow); - pai.hWindow = NULL; + pai.hWindow = nullptr; } } return 1; @@ -909,7 +909,7 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha mir_cslock lck(s_CS); ANIAVA_OBJECT *pai = FindAvatarByContact(hContact); - if (pai == NULL) + if (pai == nullptr) return 1; ANIAVA_POSINFO *api = (ANIAVA_POSINFO *)malloc(sizeof(ANIAVA_POSINFO)); @@ -943,7 +943,7 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha int AniAva_UpdateOptions() { BOOL bReloadAvatars = FALSE; - BOOL bBeEnabled = db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)); + BOOL bBeEnabled = db_get_b(0, "CList", "AvatarsAnimated", db_get_b(0, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)); if (bBeEnabled && !s_bModuleStarted) { AniAva_InitModule(); bReloadAvatars = TRUE; @@ -956,7 +956,7 @@ int AniAva_UpdateOptions() BOOL oldSeparate = s_bSeparateWindow; _AniAva_LoadOptions(); if (oldSeparate != s_bSeparateWindow) { - AniAva_InvalidateAvatarPositions(NULL); + AniAva_InvalidateAvatarPositions(0); AniAva_RemoveInvalidatedAvatars(); } @@ -984,13 +984,13 @@ void AniAva_UpdateParent() int AniAva_InitModule() { - if (!db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT))) + if (!db_get_b(0, "CList", "AvatarsAnimated", db_get_b(0, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT))) return 0; WNDCLASSEX wc = { sizeof(wc) }; wc.lpszClassName = ANIAVAWINDOWCLASS; wc.lpfnWndProc = _AniAva_WndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(ANIAVA_WINDOWINFO*); wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); @@ -999,8 +999,8 @@ int AniAva_InitModule() _AniAva_LoadOptions(); - s_hExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - mir_forkthread(_AniAva_AnimationTreadProc, NULL); + s_hExitEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + mir_forkthread(_AniAva_AnimationTreadProc, nullptr); return 1; } diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 6a7839d8d1..7ece765d67 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static mir_cs amCS; static LIST amItems(10, PtrKeySortT); -static HANDLE hamProcessEvent = NULL; +static HANDLE hamProcessEvent = nullptr; static DWORD amRequestTick = 0; /* @@ -48,7 +48,7 @@ static DWORD amRequestTick = 0; static int amAddHandleToChain(MCONTACT hContact) { mir_cslockfull lck(amCS); - if (amItems.find((HANDLE)hContact) != NULL) + if (amItems.find((HANDLE)hContact) != nullptr) return 0; amItems.insert((HANDLE)hContact); @@ -64,7 +64,7 @@ static MCONTACT amGetCurrentChain() { mir_cslock lck(amCS); if (amItems.getCount() == 0) - return NULL; + return 0; MCONTACT res = (DWORD_PTR)amItems[0]; amItems.remove(0); @@ -76,7 +76,7 @@ static MCONTACT amGetCurrentChain() */ static void amThreadProc(void *) { - Netlib_Logf(NULL, "amThreadProc thread start"); + Netlib_Logf(nullptr, "amThreadProc thread start"); while (!MirandaExiting()) { MCONTACT hContact = amGetCurrentChain(); @@ -121,8 +121,8 @@ static void amThreadProc(void *) } LBL_Exit: - g_hAwayMsgThread = NULL; - Netlib_Logf(NULL, "amThreadProc thread end"); + g_hAwayMsgThread = nullptr; + Netlib_Logf(nullptr, "amThreadProc thread end"); } BOOL amWakeThread() @@ -145,13 +145,13 @@ void amRequestAwayMsg(MCONTACT hContact) //Do not re-ask for chat rooms char *szProto = GetContactProto(hContact); - if (szProto != NULL && !db_get_b(hContact, szProto, "ChatRoom", 0)) + if (szProto != nullptr && !db_get_b(hContact, szProto, "ChatRoom", 0)) amAddHandleToChain(hContact); } void InitAwayMsgModule() { - hamProcessEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + hamProcessEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); g_hAwayMsgThread = mir_forkthread(amThreadProc, 0); } diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index e5da6facf5..102aed2c9b 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -47,7 +47,7 @@ static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFun void Cache_GetTimezone(ClcData *dat, MCONTACT hContact) { ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); - if (dat == NULL && pcli->hwndContactTree) + if (dat == nullptr && pcli->hwndContactTree) dat = (ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); if (dat && dat->hWnd == pcli->hwndContactTree) { @@ -76,7 +76,7 @@ void CSmileyString::AddListeningToIcon(ClcData *dat, wchar_t *szText) iMaxSmileyHeight = 0; DestroySmileyList(); - if (szText == NULL) + if (szText == nullptr) return; int text_size = (int)mir_wstrlen(szText); @@ -128,7 +128,7 @@ void CSmileyString::_CopySmileyList(SortedList *plInput) plText = List_Create(0, 1); for (int i = 0; i < plInput->realCount; i++) { ClcContactTextPiece *pieceFrom = (ClcContactTextPiece *)plInput->items[i]; - if (pieceFrom != NULL) { + if (pieceFrom != nullptr) { ClcContactTextPiece *piece = (ClcContactTextPiece *)mir_alloc(sizeof(ClcContactTextPiece)); *piece = *pieceFrom; if (pieceFrom->type == TEXT_PIECE_TYPE_SMILEY) @@ -140,17 +140,17 @@ void CSmileyString::_CopySmileyList(SortedList *plInput) void CSmileyString::DestroySmileyList() { - if (plText == NULL) + if (plText == nullptr) return; if (IsBadReadPtr(plText, sizeof(SortedList))) { - plText = NULL; + plText = nullptr; return; } if (plText->realCount != 0) { for (int i = 0; i < plText->realCount; i++) { - if (plText->items[i] != NULL) { + if (plText->items[i] != nullptr) { ClcContactTextPiece *piece = (ClcContactTextPiece *)plText->items[i]; if (!IsBadWritePtr(piece, sizeof(ClcContactTextPiece))) { @@ -164,7 +164,7 @@ void CSmileyString::DestroySmileyList() } mir_free(plText); - plText = NULL; + plText = nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -177,7 +177,7 @@ void CSmileyString::ReplaceSmileys(ClcData *dat, ClcCacheEntry *pdnce, wchar_t * DestroySmileyList(); - if (!dat->text_replace_smileys || !replace_smileys || szText == NULL) + if (!dat->text_replace_smileys || !replace_smileys || szText == nullptr) return; int text_size = (int)mir_wstrlen(szText); @@ -189,7 +189,7 @@ void CSmileyString::ReplaceSmileys(ClcData *dat, ClcCacheEntry *pdnce, wchar_t * if (dat->text_use_protocol_smileys) { sp.Protocolname = pdnce->m_pszProto; - if (db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_pszProto != NULL && mir_strcmp(pdnce->m_pszProto, META_PROTO) == 0) { + if (db_get_b(0, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_pszProto != nullptr && mir_strcmp(pdnce->m_pszProto, META_PROTO) == 0) { MCONTACT hContact = db_mc_getMostOnline(pdnce->hContact); if (hContact != 0) sp.Protocolname = GetContactProto(hContact); @@ -203,14 +203,14 @@ void CSmileyString::ReplaceSmileys(ClcData *dat, ClcCacheEntry *pdnce, wchar_t * SMADD_BATCHPARSERES *spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp); // Did not find a simley - if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND) + if (spr == nullptr || (INT_PTR)spr == CALLSERVICE_NOTFOUND) return; // Lets add smileys plText = List_Create(0, 1); for (unsigned i = 0; i < sp.numSmileys; ++i) { - if (spr[i].hIcon != NULL) { // For deffective smileypacks + if (spr[i].hIcon != nullptr) { // For deffective smileypacks // Add text if (spr[i].startChar - last_pos > 0) { ClcContactTextPiece *piece = (ClcContactTextPiece *)mir_alloc(sizeof(ClcContactTextPiece)); @@ -325,7 +325,7 @@ void GetListeningTo(wchar_t *text, int text_size, ClcCacheEntry *pdnce) return; ptrW tszValue(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "ListeningTo")); - if (tszValue != NULL) + if (tszValue != nullptr) CopySkipUnprintableChars(text, tszValue, text_size - 1); } @@ -346,7 +346,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs // Get XStatusMsg if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) { ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); - if (tszXStatusMsg != NULL) { + if (tszXStatusMsg != nullptr) { CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') return -1; @@ -356,7 +356,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs // Get StatusMsg if (pdnce->hContact && text[0] == '\0') { ptrW tszStatusMsg(db_get_wsa(pdnce->hContact, "CList", "StatusMsg")); - if (tszStatusMsg != NULL) { + if (tszStatusMsg != nullptr) { CopySkipUnprintableChars(text, tszStatusMsg, text_size - 1); if (text[0] != '\0') return 1; @@ -367,7 +367,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto && text[0] == '\0') { // Try to get XStatusMsg ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); - if (tszXStatusMsg != NULL) { + if (tszXStatusMsg != nullptr) { CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') return -1; @@ -382,7 +382,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, ClcLineInfo &line) { - if (text == NULL) + if (text == nullptr) return TEXT_EMPTY; text[0] = '\0'; @@ -392,7 +392,7 @@ LBL_Status: if (GetStatusName(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusMsg ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); - if (tszXStatusMsg != NULL && tszXStatusMsg[0] != 0) { + if (tszXStatusMsg != nullptr && tszXStatusMsg[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg); CopySkipUnprintableChars(text, text, text_size - 1); @@ -403,7 +403,7 @@ LBL_Status: case TEXT_NICKNAME: if (pdnce->hContact && pdnce->m_pszProto) { ptrW tszNick(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "Nick")); - if (tszNick != NULL) { + if (tszNick != nullptr) { mir_wstrncpy(text, tszNick, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } @@ -414,7 +414,7 @@ LBL_Status: if (GetStatusMessage(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusName ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); - if (tszXStatusName != NULL && tszXStatusName[0] != 0) { + if (tszXStatusName != nullptr && tszXStatusName[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName, tmp); CopySkipUnprintableChars(text, text, text_size - 1); @@ -423,7 +423,7 @@ LBL_Status: else if (line.use_name_and_message_for_xstatus && line.xstatus_has_priority) { // Try to get XStatusName ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); - if (tszXStatusName != NULL && tszXStatusName[0] != 0) { + if (tszXStatusName != nullptr && tszXStatusName[0] != 0) { mir_wstrncpy(text, tszXStatusName, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } @@ -507,13 +507,13 @@ void Cache_GetNthLineText(ClcData *dat, ClcCacheEntry *pdnce, int n) // in most cases replaceStrW does nothing if (!line.show) { - replaceStrW(szText, NULL); + replaceStrW(szText, nullptr); return; } int type = Cache_GetLineText(pdnce, line.type, Text, _countof(Text), line); if (Text[0] == 0) { - replaceStrW(szText, NULL); + replaceStrW(szText, nullptr); return; } @@ -648,7 +648,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) AVATARCACHEENTRY *ace = contact->avatar_data; int old_pos = contact->avatar_pos; - if (ace == NULL || ace->dwFlags == AVS_BITMAP_EXPIRED || ace->hbmPic == NULL) { + if (ace == nullptr || ace->dwFlags == AVS_BITMAP_EXPIRED || ace->hbmPic == nullptr) { // Avatar was not ready or removed - need to remove it from cache if (old_pos >= 0) { ImageArray_RemoveImage(&dat->avatar_cache, old_pos); @@ -659,7 +659,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) return; } } - else if (contact->avatar_data->hbmPic != NULL) { // let's add it + else if (contact->avatar_data->hbmPic != nullptr) { // let's add it // Clipping width and height LONG width_clip = dat->avatars_maxwidth_size ? dat->avatars_maxwidth_size : dat->avatars_maxheight_size; LONG height_clip = dat->avatars_maxheight_size; @@ -713,19 +713,19 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) // workaround for avatar service if (g_CluiData.bSTATE != STATE_NORMAL) { contact->avatar_pos = AVATAR_POS_DONT_HAVE; - contact->avatar_data = NULL; + contact->avatar_data = nullptr; return; } if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { contact->avatar_data = (AVATARCACHEENTRY*)CallService(MS_AV_GETAVATARBITMAP, contact->hContact, 0); - if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(AVATARCACHEENTRY) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) - contact->avatar_data = NULL; + if (contact->avatar_data == nullptr || contact->avatar_data->cbSize != sizeof(AVATARCACHEENTRY) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) + contact->avatar_data = nullptr; - if (contact->avatar_data != NULL) - contact->avatar_data->t_lastAccess = (DWORD)time(NULL); + if (contact->avatar_data != nullptr) + contact->avatar_data->t_lastAccess = (DWORD)time(nullptr); } - else contact->avatar_data = NULL; + else contact->avatar_data = nullptr; Cache_ProceedAvatarInList(dat, contact); } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 997607814c..52f6ae07ce 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -41,7 +41,7 @@ static BYTE IsDragToScrollMode = 0; static int StartDragPos = 0; static int StartScrollPos = 0; static BOOL g_bSortTimerIsSet = FALSE; -static ClcContact *hitcontact = NULL; +static ClcContact *hitcontact = nullptr; HANDLE hSkinFolder; wchar_t SkinsFolder[MAX_PATH]; @@ -113,7 +113,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) return 0; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if (hContact == NULL) { + if (hContact == 0) { if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName")) cliCluiProtocolStatusChanged(0, cws->szModule); else if (!strcmp(cws->szModule, "CList")) { @@ -154,7 +154,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam) { - g_CluiData.t_now = time(NULL); + g_CluiData.t_now = time(nullptr); if (hContact && lParam) { DBEVENTINFO dbei = {}; db_event_get(lParam, &dbei); @@ -211,7 +211,7 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const wchar_ group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -226,7 +226,7 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const wchar_ else if (dat->bFilterSearch) { wchar_t *lowered_szText = CharLowerW(NEWWSTR_ALLOCA(cc->szText)); wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch)); - found = wcsstr(lowered_szText, lowered_search) != NULL; + found = wcsstr(lowered_szText, lowered_search) != nullptr; } else found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText))); @@ -296,7 +296,7 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (dat->contact_time_show || dat->secondLine.type == TEXT_CONTACT_TIME || dat->thirdLine.type == TEXT_CONTACT_TIME) - CLUI_SafeSetTimer(hwnd, TIMERID_INVALIDATE, 5000, NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_INVALIDATE, 5000, nullptr); else KillTimer(hwnd, TIMERID_INVALIDATE); @@ -312,7 +312,7 @@ static LRESULT clcOnHitTest(ClcData *, HWND hwnd, UINT, WPARAM wParam, LPARAM lP static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) { ClcContact *contact; - int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL); + int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, nullptr); if (hit != -1 && contact->type == CLCIT_GROUP) { switch (LOWORD(wParam)) { case POPUP_GROUPSHOWOFFLINE: @@ -343,8 +343,8 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA int depth = GetDeviceCaps(hdc, BITSPIXEL); if (depth < 16) depth = 16; - HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, NULL); - HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL); + HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, nullptr); + HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, nullptr); HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); HBRUSH hBrush = CreateSolidBrush((dat->bUseWindowsColours || dat->bForceInDialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour); @@ -366,7 +366,7 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA } else if (dat->himlHighlight) { ImageList_Destroy(dat->himlHighlight); - dat->himlHighlight = NULL; + dat->himlHighlight = nullptr; } return 0; } @@ -429,7 +429,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM } dat->selection = index; - pcli->pfnInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); return 0; } @@ -496,7 +496,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM } else if (changeGroupExpand == 1 && contact->bSubExpanded) { //Contract - ClcContact *ht = NULL; + ClcContact *ht = nullptr; KillTimer(hwnd, TIMERID_SUBEXPAND); contact->bSubExpanded = false; db_set_b(contact->hContact, "CList", "Expanded", 0); @@ -504,14 +504,14 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM dat->bNeedsResort = true; pcli->pfnSortCLC(hwnd, dat, 1); cliRecalcScrollBar(hwnd, dat); - hitcontact = NULL; + hitcontact = nullptr; } else if (changeGroupExpand == 2 && contact->bSubExpanded) { dat->selection++; selMoved = 1; } else if (changeGroupExpand == 2 && !contact->bSubExpanded && dat->bMetaExpanding) { - ClcContact *ht = NULL; + ClcContact *ht = nullptr; KillTimer(hwnd, TIMERID_SUBEXPAND); contact->bSubExpanded = true; db_set_b(contact->hContact, "CList", "Expanded", 1); @@ -522,12 +522,12 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM if (ht) { ClcContact *contact2; ClcGroup *group2; - if (Clist_FindItem(hwnd, dat, contact->hContact, &contact2, &group2, NULL)) { + if (Clist_FindItem(hwnd, dat, contact->hContact, &contact2, &group2, nullptr)) { int i = cliGetRowsPriorTo(&dat->list, group2, GetContactIndex(group2, contact2)); pcli->pfnEnsureVisible(hwnd, dat, i + contact->iSubAllocated, 0); } } - hitcontact = NULL; + hitcontact = nullptr; } } } @@ -562,7 +562,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM if (dat->selection < 0) dat->selection = 0; if (dat->bCompactMode) SendMessage(hwnd, WM_SIZE, 0, 0); - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); UpdateWindow(hwnd); } @@ -582,7 +582,7 @@ void clcSetDelayTimer(UINT_PTR uIDEvent, HWND hwnd, int nDelay) default: delay = 100; break; } } - CLUI_SafeSetTimer(hwnd, uIDEvent, delay, NULL); + CLUI_SafeSetTimer(hwnd, uIDEvent, delay, nullptr); } static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -590,9 +590,9 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR switch (wParam) { case TIMERID_INVALIDATE: { - time_t cur_time = (time(NULL) / 60); + time_t cur_time = (time(nullptr) / 60); if (cur_time != dat->last_tick_time) { - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); dat->last_tick_time = cur_time; } } @@ -601,7 +601,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR case TIMERID_SUBEXPAND: KillTimer(hwnd, TIMERID_SUBEXPAND); { - ClcContact *ht = NULL; + ClcContact *ht = nullptr; if (hitcontact && dat->bMetaExpanding) { hitcontact->bSubExpanded = !hitcontact->bSubExpanded; db_set_b(hitcontact->hContact, "CList", "Expanded", hitcontact->bSubExpanded); @@ -616,12 +616,12 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR int i = 0; ClcContact *contact; ClcGroup *group; - if (Clist_FindItem(hwnd, dat, hitcontact->hContact, &contact, &group, NULL)) { + if (Clist_FindItem(hwnd, dat, hitcontact->hContact, &contact, &group, nullptr)) { i = cliGetRowsPriorTo(&dat->list, group, GetContactIndex(group, contact)); pcli->pfnEnsureVisible(hwnd, dat, i + hitcontact->iSubAllocated, 0); } } - hitcontact = NULL; + hitcontact = nullptr; } return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); @@ -629,7 +629,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR TRACE("Do sort on Timer\n"); KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC); pcli->pfnSortCLC(hwnd, dat, 1); - pcli->pfnInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); return 0; case TIMERID_RECALCSCROLLBAR: @@ -647,7 +647,7 @@ static LRESULT clcOnActivate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, L TRACE("clcOnActivate\n"); if (dat->bCompactMode) { cliRecalcScrollBar(hwnd, dat); - if (dat->hwndRenameEdit == NULL) + if (dat->hwndRenameEdit == nullptr) PostMessage(hwnd, WM_SIZE, 0, 0); } dat->dragStage |= DRAGSTAGEF_SKIPRENAME; @@ -728,10 +728,10 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP fMouseUpped = TRUE; hitcontact = contact; KillTimer(hwnd, TIMERID_SUBEXPAND); - CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, nullptr); } } - else hitcontact = NULL; + else hitcontact = nullptr; if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP && (hitFlags & CLCHT_ONITEMICON)) { ClcGroup *selgroup; @@ -747,7 +747,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP if (dat->bCompactMode) SendMessage(hwnd, WM_SIZE, 0, 0); else { - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); UpdateWindow(hwnd); } return TRUE; @@ -761,7 +761,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP else pcli->pfnSetContactCheckboxes(contact, bNewState); pcli->pfnRecalculateGroupCheckboxes(hwnd, dat); - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); NMCLISTCONTROL nm; nm.hdr.code = CLN_CHECKCHANGED; @@ -778,7 +778,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; - nm.hItem = (hit == -1 || hitFlags & CLCHT_NOWHERE) ? NULL : Clist_ContactToItemHandle(contact, &nm.flags); + nm.hItem = (hit == -1 || hitFlags & CLCHT_NOWHERE) ? nullptr : Clist_ContactToItemHandle(contact, &nm.flags); nm.iColumn = hitFlags & CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1; nm.pt = dat->ptDragStart; SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); @@ -788,7 +788,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP return FALSE; dat->selection = (hitFlags & CLCHT_NOWHERE) ? -1 : hit; - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); UpdateWindow(hwnd); if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA | CLCHT_ONITEMCHECK | CLCHT_NOWHERE))) { @@ -848,7 +848,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR isOutside = TRUE; } - if (hitcontact != NULL) { + if (hitcontact != nullptr) { int x = (short)LOWORD(lParam); int y = (short)HIWORD(lParam); int xm = GetSystemMetrics(SM_CXDOUBLECLK); @@ -856,12 +856,12 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR if (abs(HitPoint.x - x) > xm || abs(HitPoint.y - y) > ym) { if (fMouseUpped) { KillTimer(hwnd, TIMERID_SUBEXPAND); - CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, nullptr); fMouseUpped = FALSE; } else { KillTimer(hwnd, TIMERID_SUBEXPAND); - hitcontact = NULL; + hitcontact = nullptr; fMouseUpped = FALSE; } } @@ -871,10 +871,10 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR DWORD flag = 0; int iOldHotTrack = dat->iHotTrack; - if (dat->hwndRenameEdit != NULL || GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000) + if (dat->hwndRenameEdit != nullptr || GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000) return 0; - dat->iHotTrack = isOutside ? -1 : cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, &flag); + dat->iHotTrack = isOutside ? -1 : cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, &flag); if (flag & CLCHT_NOWHERE) dat->iHotTrack = -1; @@ -896,10 +896,10 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR KillTimer(hwnd, TIMERID_INFOTIP); - if (wParam == 0 && dat->hInfoTipItem == NULL) { + if (wParam == 0 && dat->hInfoTipItem == 0) { dat->ptInfoTip.x = (short)LOWORD(lParam); dat->ptInfoTip.y = (short)HIWORD(lParam); - CLUI_SafeSetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, nullptr); } return 0; } @@ -913,8 +913,8 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR GetClientRect(hwnd, &clRect); POINT pt = UNPACK_POINT(lParam); - HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO); - cliInvalidateRect(hwnd, NULL, FALSE); + HCURSOR hNewCursor = LoadCursor(nullptr, IDC_NO); + cliInvalidateRect(hwnd, nullptr, FALSE); if (dat->dragAutoScrolling) { KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); dat->dragAutoScrolling = 0; @@ -922,7 +922,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR int target = GetDropTargetInformation(hwnd, dat, pt); if ((dat->dragStage & DRAGSTAGEF_OUTSIDE) && target != DROPTARGET_OUTSIDE) { ClcContact *contact; - cliGetRowByIndex(dat, dat->iDragItem, &contact, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contact, nullptr); NMCLISTCONTROL nm; nm.hdr.code = CLN_DRAGSTOP; @@ -941,7 +941,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; case DROPTARGET_ONCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { @@ -953,8 +953,8 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; case DROPTARGET_ONMETACONTACT: - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { @@ -968,8 +968,8 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; case DROPTARGET_ONSUBCONTACT: - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { @@ -994,7 +994,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR if (pt.x >= 0 && pt.x < clRect.right && ((pt.y < 0 && pt.y>-dat->dragAutoScrollHeight) || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) { if (!dat->dragAutoScrolling) { dat->dragAutoScrolling = (pt.y < 0) ? -1 : 1; - CLUI_SafeSetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, nullptr); } SendMessage(hwnd, WM_TIMER, TIMERID_DRAGAUTOSCROLL, 0); } @@ -1002,7 +1002,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR dat->dragStage |= DRAGSTAGEF_OUTSIDE; { ClcContact *contact; - cliGetRowByIndex(dat, dat->iDragItem, &contact, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contact, nullptr); NMCLISTCONTROL nm; nm.hdr.code = CLN_DRAGGING; @@ -1017,10 +1017,10 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; default: - ClcGroup *group = NULL; - cliGetRowByIndex(dat, dat->iDragItem, NULL, &group); + ClcGroup *group = nullptr; + cliGetRowByIndex(dat, dat->iDragItem, nullptr, &group); if (group && group->parent) { - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (!contSour->iSubNumber) hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); } @@ -1038,9 +1038,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, fMouseUpped = TRUE; - if (hitcontact != NULL && dat->bMetaExpanding) { - BYTE doubleClickExpand = db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); - CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, GetDoubleClickTime()*doubleClickExpand, NULL); + if (hitcontact != nullptr && dat->bMetaExpanding) { + BYTE doubleClickExpand = db_get_b(0, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, GetDoubleClickTime()*doubleClickExpand, nullptr); } else if (dat->iHotTrack == -1 && dat->iDragItem == -1) ReleaseCapture(); @@ -1051,15 +1051,15 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, SetCursor((HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR)); if (dat->exStyle & CLS_EX_TRACKSELECT) { DWORD flags; - dat->iHotTrack = cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, &flags); + dat->iHotTrack = cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, &flags); if (dat->iHotTrack == -1) ReleaseCapture(); } - else if (hitcontact == NULL) + else if (hitcontact == nullptr) ReleaseCapture(); KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); if (dat->dragStage == (DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME)) - CLUI_SafeSetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), nullptr); else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { wchar_t Wording[500]; ClcContact *contDest, *contSour; @@ -1070,8 +1070,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT) { @@ -1108,8 +1108,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONMETACONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT) { @@ -1150,8 +1150,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONSUBCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT) { @@ -1199,7 +1199,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); if (i != -1 && group->groupId != destgroup->groupId) { wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, 0)); - wchar_t *shortGroup = NULL; + wchar_t *shortGroup = nullptr; wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, 0)); if (groupName) { int len = (int)mir_wstrlen(groupName); @@ -1237,7 +1237,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); dat->iDragItem = -1; dat->iInsertionMark = -1; return 0; @@ -1246,7 +1246,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, static LRESULT clcOnLButtonDblClick(ClcData *, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { KillTimer(hwnd, TIMERID_SUBEXPAND); - hitcontact = NULL; + hitcontact = nullptr; return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } @@ -1255,15 +1255,15 @@ static LRESULT clcOnDestroy(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP for (int i = 0; i <= FONTID_MODERN_MAX; i++) { if (dat->fontModernInfo[i].hFont) DeleteObject(dat->fontModernInfo[i].hFont); - dat->fontModernInfo[i].hFont = NULL; + dat->fontModernInfo[i].hFont = nullptr; } if (dat->hMenuBackground) { DeleteObject(dat->hMenuBackground); - dat->hMenuBackground = NULL; + dat->hMenuBackground = nullptr; } if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); - dat->hBmpBackground = NULL; + dat->hBmpBackground = nullptr; } ImageArray_Clear(&dat->avatar_cache); @@ -1271,7 +1271,7 @@ static LRESULT clcOnDestroy(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP ImageArray_Free(&dat->avatar_cache, FALSE); if (dat->himlHighlight) { ImageList_Destroy(dat->himlHighlight); - dat->himlHighlight = NULL; + dat->himlHighlight = nullptr; } RowHeights_Free(dat); @@ -1286,7 +1286,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wPara BYTE flags = 0; ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -1296,7 +1296,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wPara if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1); - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -1317,13 +1317,13 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam { bool needRepaint = false; int contacticon = corecli.pfnGetContactIcon(wParam); - MCONTACT hSelItem = NULL; + MCONTACT hSelItem = 0; ClcGroup *selgroup; - ClcContact *selcontact = NULL; + ClcContact *selcontact = nullptr; char *szProto = GetContactProto(wParam); - WORD status = (szProto == NULL) ? ID_STATUS_OFFLINE : GetContactCachedStatus(wParam); + WORD status = (szProto == nullptr) ? ID_STATUS_OFFLINE : GetContactCachedStatus(wParam); bool bImageIsSpecial = (LOWORD(contacticon) != (LOWORD(lParam))); //check only base icons int nHiddenStatus = CLVM_GetContactHiddenStatus(wParam, szProto, dat); @@ -1338,15 +1338,15 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - ClcGroup *group = NULL; - ClcContact *contact = NULL; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL)) { + ClcGroup *group = nullptr; + ClcContact *contact = nullptr; + if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr)) { if (shouldShow && db_is_contact(wParam)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1) hSelItem = Clist_ContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0); needRepaint = TRUE; - Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL); + Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr); if (contact) { contact->iImage = lParam; contact->bImageIsSpecial = bImageIsSpecial; @@ -1364,7 +1364,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam shouldShow = TRUE; if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && ((style & CLS_HIDEOFFLINE) || group->hideOffline || g_CluiData.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1) hSelItem = Clist_ContactToHItem(selcontact); pcli->pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0); needRepaint = TRUE; @@ -1387,7 +1387,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam } if (hSelItem) { - if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr)) dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact)); else dat->selection = -1; @@ -1401,7 +1401,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam if (contact && contact->pos_icon.bottom != 0 && contact->pos_icon.right != 0) cliInvalidateRect(hwnd, &contact->pos_icon, FALSE); else - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); //try only needed rectangle } @@ -1411,19 +1411,19 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT, WPARAM hContact, LPARAM) { ClcContact *contact; - if (Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) + if (Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr)) Cache_GetAvatar(dat, contact); else if (hContact == 0) UpdateAllAvatars(dat); - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return 0; } static LRESULT clcOnIntmTimeZoneChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (contact) { @@ -1439,7 +1439,7 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP LRESULT ret = corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); ClcContact *contact; - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) Cache_GetText(dat, contact); return ret; @@ -1452,11 +1452,11 @@ static LRESULT clcOnIntmApparentModeChanged(ClcData *, HWND hwnd, UINT msg, WPAR static LRESULT clcOnIntmStatusMsgChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM hContact, LPARAM lParam) { - if (hContact == NULL || IsHContactInfo(hContact) || IsHContactGroup(hContact)) + if (hContact == 0 || IsHContactInfo(hContact) || IsHContactGroup(hContact)) return corecli.pfnContactListControlWndProc(hwnd, msg, hContact, lParam); ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr)) return corecli.pfnContactListControlWndProc(hwnd, msg, hContact, lParam); if (contact) { @@ -1472,7 +1472,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) /////////////// ?? + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) /////////////// ?? return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (contact->type != CLCIT_CONTACT) @@ -1483,7 +1483,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR else contact->flags |= CONTACTF_NOTONLIST; - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } @@ -1504,7 +1504,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (wParam != 0) { ClcContact *contact; - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { /////////////////// ?? + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { /////////////////// ?? ClcCacheEntry *pdnce = contact->pce; if (pdnce && pdnce->m_pszProto) { if (!dat->bForceInDialog) { @@ -1534,7 +1534,7 @@ static LRESULT clcOnIntmReloadOptions(ClcData *dat, HWND hwnd, UINT msg, WPARAM pcli->pfnSaveStateAndRebuildList(hwnd, dat); pcli->pfnSortCLC(hwnd, dat, 1); if (IsWindowVisible(hwnd)) - pcli->pfnInvalidateRect(GetParent(hwnd), NULL, FALSE); + pcli->pfnInvalidateRect(GetParent(hwnd), nullptr, FALSE); return TRUE; } @@ -1543,10 +1543,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) if (MirandaExiting()) return 0; - if (!ServiceExists(MS_AV_GETAVATARBITMAP)) - MessageBox(NULL, - TranslateT("Clist Modern requires AVS plugin to be present. Install it using PluginUpdater or download from https://wiki.miranda-ng.org/Download"), - TranslateT("Error loading plugin"), MB_ICONERROR | MB_OK); + g_CluiData.bAvsPresent = ServiceExists(MS_AV_GETAVATARBITMAP) != 0; HookEvent(ME_AV_AVATARCHANGED, clcHookAvatarChanged); @@ -1631,9 +1628,9 @@ HRESULT ClcLoadModule() int ClcUnloadModule() { if (g_CluiData.bOldUseGroups != (BYTE)-1) - db_set_b(NULL, "CList", "UseGroups", (BYTE)g_CluiData.bOldUseGroups); + db_set_b(0, "CList", "UseGroups", (BYTE)g_CluiData.bOldUseGroups); if (g_CluiData.boldHideOffline != (BYTE)-1) - db_set_b(NULL, "CList", "HideOffline", (BYTE)g_CluiData.boldHideOffline); + db_set_b(0, "CList", "HideOffline", (BYTE)g_CluiData.boldHideOffline); return 0; } @@ -1655,7 +1652,7 @@ int ClcDoProtoAck(ACKDATA *ack) } else if (ack->type == ACKTYPE_AWAYMSG) { if (ack->result == ACKRESULT_SUCCESS && ack->lParam) { - if (ack->szModule != NULL) + if (ack->szModule != nullptr) if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; @@ -1663,7 +1660,7 @@ int ClcDoProtoAck(ACKDATA *ack) Clist_Broadcast(INTM_STATUSCHANGED, ack->hContact, 0); } else { - if (ack->szModule != NULL) + if (ack->szModule != nullptr) if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 24c87848a7..dde2266bc4 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -37,11 +37,11 @@ int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex) { int count = 0; int subcontactscount = 0; - bool bMetaExpanding = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; + bool bMetaExpanding = db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -100,7 +100,7 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 627904187d..a7f0588630 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -26,11 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) { - cont->bSubExpanded = db_get_b(cont->hContact, "CList", "Expanded", 0) && db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); + cont->bSubExpanded = db_get_b(cont->hContact, "CList", "Expanded", 0) && db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); int subcount = db_mc_getSubCount(cont->hContact); if (subcount <= 0) { cont->iSubNumber = 0; - cont->subcontacts = NULL; + cont->subcontacts = nullptr; cont->iSubAllocated = 0; return; } @@ -40,7 +40,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) cont->subcontacts = (ClcContact *)mir_calloc(sizeof(ClcContact)*subcount); cont->iSubAllocated = subcount; int i = 0; - int bHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + int bHideOffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (int j = 0; j < subcount; j++) { MCONTACT hsub = db_mc_getSub(cont->hContact, j); ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hsub); @@ -69,20 +69,20 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) Cache_GetText(dat, &p); char *szProto = pdnce->m_pszProto; - if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, wStatus)) + if (szProto != nullptr && !pcli->pfnIsHiddenMode(dat, wStatus)) p.flags |= CONTACTF_ONLINE; - int apparentMode = szProto != NULL ? pdnce->ApparentMode : 0; + int apparentMode = szProto != nullptr ? pdnce->ApparentMode : 0; if (apparentMode == ID_STATUS_OFFLINE) p.flags |= CONTACTF_INVISTO; else if (apparentMode == ID_STATUS_ONLINE) p.flags |= CONTACTF_VISTO; else if (apparentMode) p.flags |= CONTACTF_VISTO | CONTACTF_INVISTO; if (pdnce->NotOnList) p.flags |= CONTACTF_NOTONLIST; - int idleMode = szProto != NULL ? pdnce->IdleTS : 0; + int idleMode = szProto != nullptr ? pdnce->IdleTS : 0; if (idleMode) p.flags |= CONTACTF_IDLE; i++; } cont->iSubAllocated = i; - if (!i && cont->subcontacts != NULL) + if (!i && cont->subcontacts != nullptr) mir_free_and_nil(cont->subcontacts); } @@ -119,17 +119,17 @@ static void _LoadDataToContact(ClcContact *cont, ClcCacheEntry *pdnce, ClcGroup cont->pce = pdnce; cont->iSubAllocated = 0; cont->iSubNumber = 0; - cont->subcontacts = NULL; + cont->subcontacts = nullptr; cont->szText[0] = 0; cont->lastPaintCounter = 0; cont->bImageIsSpecial = false; cont->hContact = hContact; cont->proto = szProto; - if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, pdnce->m_iStatus)) + if (szProto != nullptr && !pcli->pfnIsHiddenMode(dat, pdnce->m_iStatus)) cont->flags |= CONTACTF_ONLINE; - WORD apparentMode = szProto != NULL ? pdnce->ApparentMode : 0; + WORD apparentMode = szProto != nullptr ? pdnce->ApparentMode : 0; if (apparentMode) switch (apparentMode) { case ID_STATUS_OFFLINE: @@ -145,7 +145,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcCacheEntry *pdnce, ClcGroup if (pdnce->NotOnList) cont->flags |= CONTACTF_NOTONLIST; - DWORD idleMode = szProto != NULL ? pdnce->IdleTS : 0; + DWORD idleMode = szProto != nullptr ? pdnce->IdleTS : 0; if (idleMode) cont->flags |= CONTACTF_IDLE; @@ -186,7 +186,7 @@ void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int update ClcGroup *group; ClcContact *cont; - if (Clist_FindItem(hwnd, dat, hContact, &cont, &group, NULL)) + if (Clist_FindItem(hwnd, dat, hContact, &cont, &group, nullptr)) _LoadDataToContact(cont, pdnce, group, dat, hContact); } @@ -202,18 +202,18 @@ bool CLCItems_IsShowOfflineGroup(ClcGroup *group) MCONTACT SaveSelection(ClcData *dat) { - ClcContact *selcontact = NULL; - if (pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) - return NULL; + ClcContact *selcontact = nullptr; + if (pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) == -1) + return 0; return Clist_ContactToHItem(selcontact); } int RestoreSelection(ClcData *dat, MCONTACT hSelected) { - ClcGroup *selgroup = NULL; - ClcContact *selcontact = NULL; - if (!hSelected || !Clist_FindItem(dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL)) { + ClcGroup *selgroup = nullptr; + ClcContact *selcontact = nullptr; + if (!hSelected || !Clist_FindItem(dat->hWnd, dat, hSelected, &selcontact, &selgroup, nullptr)) { dat->selection = -1; return dat->selection; } @@ -251,8 +251,8 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) MCONTACT hSelected = SaveSelection(dat); dat->selection = -1; dat->bNeedsResort = true; - dat->HiLightMode = db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT); - dat->bPlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; + dat->HiLightMode = db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT); + dat->bPlaceOfflineToRoot = db_get_b(0, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; corecli.pfnRebuildEntireList(hwnd, dat); @@ -278,7 +278,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -314,12 +314,12 @@ ClcContact* cliCreateClcContact() ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact) { - if (hContact == NULL) - return NULL; + if (hContact == 0) + return nullptr; ClcCacheEntry *pdnce = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry)); - if (pdnce == NULL) - return NULL; + if (pdnce == nullptr) + return nullptr; pdnce->hContact = hContact; pdnce->m_pszProto = GetContactProto(hContact); @@ -377,7 +377,7 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) count += group->cl.getCount(); continue; } - if (cc->type == CLCIT_CONTACT && cc->subcontacts != NULL && (cc->bSubExpanded || !visibleOnly)) + if (cc->type == CLCIT_CONTACT && cc->subcontacts != nullptr && (cc->bSubExpanded || !visibleOnly)) count += cc->iSubAllocated; group->scanIndex++; @@ -398,21 +398,21 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); // always hide subcontacts (but show them on embedded contact lists) - if (dat != NULL && dat->IsMetaContactsEnabled && db_mc_isSub(hContact)) + if (dat != nullptr && dat->IsMetaContactsEnabled && db_mc_isSub(hContact)) return -1; //subcontact - if (pdnce && pdnce->m_bIsUnknown && dat != NULL && !dat->bForceInDialog) + if (pdnce && pdnce->m_bIsUnknown && dat != nullptr && !dat->bForceInDialog) return 1; //'Unknown Contact' - if (dat != NULL && dat->bFilterSearch && pdnce && pdnce->tszName) { + if (dat != nullptr && dat->bFilterSearch && pdnce && pdnce->tszName) { // search filtering wchar_t *lowered_name = CharLowerW(NEWWSTR_ALLOCA(pdnce->tszName)); wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch)); searchResult = wcsstr(lowered_name, lowered_search) ? 0 : 1; } - if (pdnce && g_CluiData.bFilterEffective && dat != NULL && !dat->bForceInDialog) { - if (szProto == NULL) + if (pdnce && g_CluiData.bFilterEffective && dat != nullptr && !dat->bForceInDialog) { + if (szProto == nullptr) szProto = GetContactProto(hContact); // check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set). if (g_CluiData.bFilterEffective & CLVM_STICKY_CONTACTS) { @@ -434,7 +434,7 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) { ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); - if (tszGroup != NULL) { + if (tszGroup != nullptr) { wchar_t szGroupMask[256]; mir_snwprintf(szGroupMask, L"%s|", tszGroup); filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)); diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 4bf18982e9..f09532cd54 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -29,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam) { - ClcContact *contact = NULL; - ClcGroup *group = NULL; + ClcContact *contact = nullptr; + ClcGroup *group = nullptr; switch (msg) { case CLM_DELETEITEM: @@ -56,7 +56,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP RowHeights_GetMaxRowHeight(dat, hwnd); if (LOWORD(lParam)) - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return 0; case CLM_SETHIDEEMPTYGROUPS: @@ -106,24 +106,24 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP { int i = 0; if (wParam != CLGN_ROOT) { - if (!Clist_FindItem(hwnd, dat, lParam, &contact, &group, NULL)) - return NULL; + if (!Clist_FindItem(hwnd, dat, lParam, &contact, &group, nullptr)) + return 0; i = group->cl.indexOf(contact); - if (i < 0) return 0; + if (i < 0) + return 0; } switch (wParam) { case CLGN_ROOT: if (dat->list.cl.getCount()) return Clist_ContactToHItem(dat->list.cl[0]); - else - return NULL; + return 0; case CLGN_CHILD: if (contact->type != CLCIT_GROUP) - return NULL; + return 0; group = contact->group; if (group->cl.getCount() == 0) - return NULL; + return 0; return Clist_ContactToHItem(group->cl[0]); case CLGN_PARENT: @@ -132,14 +132,14 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP case CLGN_NEXT: do { if (++i >= group->cl.getCount()) - return NULL; + return 0; } while (group->cl[i]->type == CLCIT_DIVIDER); return Clist_ContactToHItem(group->cl[i]); case CLGN_PREVIOUS: do { if (--i < 0) - return NULL; + return 0; } while (group->cl[i]->type == CLCIT_DIVIDER); return Clist_ContactToHItem(group->cl[i]); @@ -148,17 +148,17 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP if (group->cl[i]->type == CLCIT_CONTACT) break; if (i >= group->cl.getCount()) - return NULL; + return 0; return Clist_ContactToHItem(group->cl[i]); case CLGN_PREVIOUSCONTACT: if (i >= group->cl.getCount()) - return NULL; + return 0; for (i--; i >= 0; i--) if (group->cl[i]->type == CLCIT_CONTACT) break; if (i < 0) - return NULL; + return 0; return Clist_ContactToHItem(group->cl[i]); case CLGN_NEXTGROUP: @@ -166,28 +166,28 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP if (group->cl[i]->type == CLCIT_GROUP) break; if (i >= group->cl.getCount()) - return NULL; + return 0; return Clist_ContactToHItem(group->cl[i]); case CLGN_PREVIOUSGROUP: if (i >= group->cl.getCount()) - return NULL; + return 0; for (i--; i >= 0; i--) if (group->cl[i]->type == CLCIT_GROUP) break; if (i < 0) - return NULL; + return 0; return Clist_ContactToHItem(group->cl[i]); } } - return NULL; + return 0; case CLM_SELECTITEM: ClcGroup *tgroup; { int index = -1; int mainindex = -1; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -202,7 +202,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP index += contact->iSubNumber; } - BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); + BYTE k = db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); if (k) { for (int i = 0; i < mainindex; i++) { ClcContact *tempCont = group->cl[i]; diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index d490f48ee3..b06bccc39c 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -210,11 +210,11 @@ void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF if (effect) { mir_snprintf(idstr, "Font%dEffect", i); - *effect = db_get_b(NULL, "CLC", idstr, 0); + *effect = db_get_b(0, "CLC", idstr, 0); mir_snprintf(idstr, "Font%dEffectCol1", i); - *eColour1 = db_get_dw(NULL, "CLC", idstr, 0); + *eColour1 = db_get_dw(0, "CLC", idstr, 0); mir_snprintf(idstr, "Font%dEffectCol2", i); - *eColour2 = db_get_dw(NULL, "CLC", idstr, 0); + *eColour2 = db_get_dw(0, "CLC", idstr, 0); } } @@ -274,7 +274,7 @@ static const struct CheckBoxValues_t offlineValues[] = { static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (int i = 0; i < nValues; i++) { @@ -317,18 +317,18 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_META, db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METADBLCLK, db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METAEXPAND, db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, db_get_b(NULL, "ModernData", "InternalAwayMsgDiscovery", SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, db_get_b(NULL, "ModernData", "RemoveAwayMessageForOffline", SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_FILTER_SEARCH, db_get_b(NULL, "CLC", "FilterSearch", SETTING_FILTERSEARCH_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by Robyer + CheckDlgButton(hwndDlg, IDC_META, db_get_b(0, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METADBLCLK, db_get_b(0, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, db_get_b(0, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(0, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METAEXPAND, db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, db_get_b(0, "ModernData", "InternalAwayMsgDiscovery", SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, db_get_b(0, "ModernData", "RemoveAwayMessageForOffline", SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_FILTER_SEARCH, db_get_b(0, "CLC", "FilterSearch", SETTING_FILTERSEARCH_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by Robyer SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SUBINDENT), 0); SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "CLC", "SubIndent", CLCDEFAULT_GROUPINDENT), 0)); + SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(0, "CLC", "SubIndent", CLCDEFAULT_GROUPINDENT), 0)); CheckButtons(hwndDlg); return TRUE; @@ -346,16 +346,16 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CLC", "Meta", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_META)); - db_set_b(NULL, "CLC", "MetaDoubleClick", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METADBLCLK)); - db_set_b(NULL, "CLC", "MetaHideExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA)); - db_set_b(NULL, "CLC", "MetaIgnoreEmptyExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA_IGN)); - db_set_b(NULL, "CLC", "MetaExpanding", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METAEXPAND)); - db_set_b(NULL, "ModernData", "InternalAwayMsgDiscovery", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISCOVER_AWAYMSG)); - db_set_b(NULL, "ModernData", "RemoveAwayMessageForOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG)); - db_set_b(NULL, "CLC", "FilterSearch", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FILTER_SEARCH)); - - db_set_b(NULL, "CLC", "SubIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "Meta", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_META)); + db_set_b(0, "CLC", "MetaDoubleClick", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METADBLCLK)); + db_set_b(0, "CLC", "MetaHideExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA)); + db_set_b(0, "CLC", "MetaIgnoreEmptyExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA_IGN)); + db_set_b(0, "CLC", "MetaExpanding", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METAEXPAND)); + db_set_b(0, "ModernData", "InternalAwayMsgDiscovery", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISCOVER_AWAYMSG)); + db_set_b(0, "ModernData", "RemoveAwayMessageForOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG)); + db_set_b(0, "CLC", "FilterSearch", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FILTER_SEARCH)); + + db_set_b(0, "CLC", "SubIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SUBINDENTSPIN, UDM_GETPOS, 0, 0)); ClcOptionsChanged(); CLUI_ReloadCLUIOptions(); PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); @@ -377,26 +377,26 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); { - DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", GetDefaultExStyle()); + DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", GetDefaultExStyle()); for (int i = 0; i < _countof(checkBoxToStyleEx); i++) CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle&checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].neg) ? BST_CHECKED : BST_UNCHECKED); UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } }; SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0)); SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel); - SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); + SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); } - CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(0, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0)); - CheckDlgButton(hwndDlg, IDC_GREYOUT, db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(0, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0)); + CheckDlgButton(hwndDlg, IDC_GREYOUT, db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING)); EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues), db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS)); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues), db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES)); - CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", CLCDEFAULT_NOVSCROLL) ? BST_CHECKED : BST_UNCHECKED); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues), db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues), db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES)); + CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", CLCDEFAULT_NOVSCROLL) ? BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_VSCROLL: @@ -442,20 +442,20 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar for (int i = 0; i < _countof(checkBoxToStyleEx); i++) if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].neg) exStyle |= checkBoxToStyleEx[i].flag; - db_set_dw(NULL, "CLC", "ExStyle", exStyle); + db_set_dw(0, "CLC", "ExStyle", exStyle); DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS)); - db_set_dw(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags); + db_set_dw(0, "CLC", "FullGreyoutFlags", fullGreyoutFlags); if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)) - db_set_dw(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags); + db_set_dw(0, "CLC", "GreyoutFlags", fullGreyoutFlags); else - db_set_dw(NULL, "CLC", "GreyoutFlags", 0); + db_set_dw(0, "CLC", "GreyoutFlags", 0); - db_set_b(NULL, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); - db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS))); - db_set_w(NULL, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); + db_set_b(0, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); + db_set_dw(0, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS))); + db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); ClcOptionsChanged(); return TRUE; @@ -489,16 +489,16 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HILIGHTMODE, db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HILIGHTMODE1, db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HILIGHTMODE2, db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HILIGHTMODE3, db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 3 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, db_get_b(0, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HILIGHTMODE, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HILIGHTMODE1, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HILIGHTMODE2, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HILIGHTMODE3, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 3 ? BST_CHECKED : BST_UNCHECKED); { int i, item; int s1, s2, s3; @@ -511,9 +511,9 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_CLSORT3, CB_SETITEMDATA, item, 0); } - s1 = db_get_b(NULL, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); - s2 = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); - s3 = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); + s1 = db_get_b(0, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); + s2 = db_get_b(0, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); + s3 = db_get_b(0, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); for (i = 0; i < _countof(sortby); i++) { if (s1 == sortbyValue[i]) @@ -524,8 +524,8 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_CLSORT3, CB_SETCURSEL, i, 0); } - CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(0, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(0, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); } return TRUE; @@ -540,17 +540,17 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); - db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); - db_set_b(NULL, "CList", "UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); - db_set_b(NULL, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); + db_set_b(0, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); + db_set_b(0, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); + db_set_b(0, "CList", "UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); + db_set_b(0, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); - db_set_b(NULL, "CLC", "GammaCorrect", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); + db_set_b(0, "CLC", "GammaCorrect", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); int hil = 0; if (IsDlgButtonChecked(hwndDlg, IDC_HILIGHTMODE1)) hil = 1; if (IsDlgButtonChecked(hwndDlg, IDC_HILIGHTMODE2)) hil = 2; if (IsDlgButtonChecked(hwndDlg, IDC_HILIGHTMODE3)) hil = 3; - db_set_b(NULL, "CLC", "HiLightMode", (BYTE)hil); + db_set_b(0, "CLC", "HiLightMode", (BYTE)hil); int s1 = SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_GETCURSEL, 0, 0); int s2 = SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_GETCURSEL, 0, 0); @@ -558,12 +558,12 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (s1 >= 0) s1 = sortbyValue[s1]; if (s2 >= 0) s2 = sortbyValue[s2]; if (s3 >= 0) s3 = sortbyValue[s3]; - db_set_b(NULL, "CList", "SortBy1", (BYTE)s1); - db_set_b(NULL, "CList", "SortBy2", (BYTE)s2); - db_set_b(NULL, "CList", "SortBy3", (BYTE)s3); + db_set_b(0, "CList", "SortBy1", (BYTE)s1); + db_set_b(0, "CList", "SortBy2", (BYTE)s2); + db_set_b(0, "CList", "SortBy3", (BYTE)s3); - db_set_b(NULL, "CList", "NoOfflineBottom", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOOFFLINEMOVE)); - db_set_b(NULL, "CList", "PlaceOfflineToRoot", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINETOROOT)); + db_set_b(0, "CList", "NoOfflineBottom", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOOFFLINEMOVE)); + db_set_b(0, "CList", "PlaceOfflineToRoot", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINETOROOT)); pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */ pcli->pfnInitAutoRebuild(pcli->hwndContactTree); /* force reshuffle */ @@ -585,11 +585,11 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(0, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(0, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { - BYTE trayOption = db_get_b(NULL, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT); + BYTE trayOption = db_get_b(0, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT); CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, (trayOption & 3) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWNORMAL, (trayOption & 2) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_TRANSPARENTOVERLAY, (trayOption & 4) ? BST_CHECKED : BST_UNCHECKED); @@ -597,12 +597,12 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS)); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL)); } - CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL, "CList", "DisableTrayFlash", SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(0, "CList", "DisableTrayFlash", SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", SETTING_ICONFLASHTIME_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "IconFlashTime", SETTING_ICONFLASHTIME_DEFAULT), 0)); // == Tray icon mode == // preparing account list. @@ -616,13 +616,13 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_S, CB_ADDSTRING, 0, (LPARAM)acc[i]->tszAccountName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_S, CB_SETITEMDATA, item, (LPARAM)acc[i]); - if (!mir_strcmp(acc[i]->szModuleName, db_get_sa(NULL, "CList", "tiAccS"))) + if (!mir_strcmp(acc[i]->szModuleName, db_get_sa(0, "CList", "tiAccS"))) siS = item; item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_V, CB_ADDSTRING, 0, (LPARAM)acc[i]->tszAccountName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_V, CB_SETITEMDATA, item, (LPARAM)acc[i]); - if (!mir_strcmp(acc[i]->szModuleName, db_get_sa(NULL, "CList", "tiAccV"))) + if (!mir_strcmp(acc[i]->szModuleName, db_get_sa(0, "CList", "tiAccV"))) siV = item; } @@ -637,10 +637,10 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L // setting icon cycling period SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); - SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); // setting icon mode - switch (db_get_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL)) { + switch (db_get_b(0, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL)) { case TRAY_ICON_MODE_GLOBAL: CheckDlgButton(hwndDlg, IDC_ICON_GLOBAL_S, 1); break; @@ -656,7 +656,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; } - switch (db_get_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL)) { + switch (db_get_b(0, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL)) { case TRAY_ICON_MODE_GLOBAL: CheckDlgButton(hwndDlg, IDC_ICON_GLOBAL_V, 1); break; @@ -705,42 +705,42 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); - db_set_b(NULL, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); + db_set_b(0, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); + db_set_b(0, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); - db_set_w(NULL, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + db_set_w(0, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); BYTE xOptions = 0; xOptions = IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) ? 1 : 0; xOptions |= (xOptions && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL)) ? 2 : 0; xOptions |= (xOptions && IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENTOVERLAY)) ? 4 : 0; - db_set_b(NULL, "CLUI", "XStatusTray", xOptions); + db_set_b(0, "CLUI", "XStatusTray", xOptions); // == Tray icon mode == // chosen account name. int idx = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_S, CB_GETCURSEL, 0, 0); if (idx != CB_ERR) { PROTOACCOUNT *pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_S, CB_GETITEMDATA, idx, 0); - db_set_s(NULL, "CList", "tiAccS", pa->szModuleName); + db_set_s(0, "CList", "tiAccS", pa->szModuleName); } idx = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_V, CB_GETCURSEL, 0, 0); if (idx != CB_ERR) { PROTOACCOUNT *pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS_V, CB_GETITEMDATA, idx, 0); - db_set_s(NULL, "CList", "tiAccV", pa->szModuleName); + db_set_s(0, "CList", "tiAccV", pa->szModuleName); } // icon cycling timeout. - db_set_w(NULL, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); // icon modes - db_set_b(NULL, "CList", "tiModeS", + db_set_b(0, "CList", "tiModeS", IsDlgButtonChecked(hwndDlg, IDC_ICON_GLOBAL_S) << 0 | IsDlgButtonChecked(hwndDlg, IDC_ICON_ACC_S) << 1 | IsDlgButtonChecked(hwndDlg, IDC_ICON_CYCLE_S) << 2 | IsDlgButtonChecked(hwndDlg, IDC_ICON_ALL_S) << 3); - db_set_b(NULL, "CList", "tiModeV", + db_set_b(0, "CList", "tiModeV", IsDlgButtonChecked(hwndDlg, IDC_ICON_GLOBAL_V) << 0 | IsDlgButtonChecked(hwndDlg, IDC_ICON_ACC_V) << 1 | IsDlgButtonChecked(hwndDlg, IDC_ICON_CYCLE_V) << 2 @@ -766,34 +766,34 @@ void ClcOptionsChanged(void) Clist_Broadcast(INTM_INVALIDATE, 0, 0); } -HWND g_hCLUIOptionsWnd = NULL; +HWND g_hCLUIOptionsWnd = nullptr; static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (db_get_b(NULL, "CLUI", "DragToScroll", SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (db_get_b(0, "CLUI", "DragToScroll", SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOSIZE, g_CluiData.fAutoSize ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOCKSIZING, db_get_b(NULL, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LOCKSIZING, db_get_b(0, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT)); SendDlgItemMessage(hwndDlg, IDC_MINSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_MINSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MinSizeHeight", SETTING_MINSIZEHEIGHT_DEFAULT)); - CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SNAPTOEDGES, db_get_b(NULL, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DOCKTOSIDES, db_get_b(NULL, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_MINSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MinSizeHeight", SETTING_MINSIZEHEIGHT_DEFAULT)); + CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(0, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SNAPTOEDGES, db_get_b(0, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DOCKTOSIDES, db_get_b(0, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EVENTAREA_NONE, db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EVENTAREA, db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EVENTAREA_ALWAYS, db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EVENTAREA_NONE, db_get_b(0, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EVENTAREA, db_get_b(0, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EVENTAREA_ALWAYS, db_get_b(0, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); - SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); @@ -802,15 +802,15 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM for (int i = 0; i < _countof(hidemode); i++) { int item = SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_ADDSTRING, 0, (LPARAM)hidemode[i]); SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETITEMDATA, item, 0); - SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETCURSEL, db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETCURSEL, db_get_b(0, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT), 0); } } SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN2, UDM_SETRANGE, 0, MAKELONG(600, 0)); - SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "ModernData", "ShowDelay", SETTING_SHOWDELAY_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "ModernData", "ShowDelay", SETTING_SHOWDELAY_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN3, UDM_SETRANGE, 0, MAKELONG(600, 0)); - SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "ModernData", "HideDelay", SETTING_HIDEDELAY_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "ModernData", "HideDelay", SETTING_HIDEDELAY_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN4, UDM_SETRANGE, 0, MAKELONG(50, 1)); - SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "ModernData", "HideBehindBorderSize", SETTING_HIDEBEHINDBORDERSIZE_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "ModernData", "HideBehindBorderSize", SETTING_HIDEBEHINDBORDERSIZE_DEFAULT), 0)); { int mode = SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_GETCURSEL, 0, 0); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDELAY), mode != 0); @@ -888,29 +888,29 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "ModernData", "HideBehind", (BYTE)SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_GETCURSEL, 0, 0)); - db_set_w(NULL, "ModernData", "ShowDelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN2, UDM_GETPOS, 0, 0)); - db_set_w(NULL, "ModernData", "HideDelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN3, UDM_GETPOS, 0, 0)); - db_set_w(NULL, "ModernData", "HideBehindBorderSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN4, UDM_GETPOS, 0, 0)); + db_set_b(0, "ModernData", "HideBehind", (BYTE)SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_GETCURSEL, 0, 0)); + db_set_w(0, "ModernData", "ShowDelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN2, UDM_GETPOS, 0, 0)); + db_set_w(0, "ModernData", "HideDelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN3, UDM_GETPOS, 0, 0)); + db_set_w(0, "ModernData", "HideBehindBorderSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN4, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "DragToScroll", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAGTOSCROLL)); - db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); + db_set_b(0, "CLUI", "DragToScroll", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAGTOSCROLL)); + db_set_b(0, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); g_mutex_bChangingMode = TRUE; - db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); - db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); - db_set_b(NULL, "CLUI", "LockSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOCKSIZING)); - db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); - db_set_b(NULL, "CLUI", "MinSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MINSIZEHEIGHT, NULL, FALSE)); - db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); - db_set_b(NULL, "CLUI", "SnapToEdges", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SNAPTOEDGES)); + db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); + db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + db_set_b(0, "CLUI", "LockSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOCKSIZING)); + db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE)); + db_set_b(0, "CLUI", "MinSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MINSIZEHEIGHT, nullptr, FALSE)); + db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); + db_set_b(0, "CLUI", "SnapToEdges", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SNAPTOEDGES)); - db_set_b(NULL, "CLUI", "DockToSides", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DOCKTOSIDES)); + db_set_b(0, "CLUI", "DockToSides", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DOCKTOSIDES)); - db_set_b(NULL, "CLUI", "EventArea", + db_set_b(0, "CLUI", "EventArea", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_EVENTAREA_ALWAYS) ? 2 : (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EVENTAREA) ? 1 : 0)); - db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); - db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + db_set_w(0, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); CLUI_ChangeWindowMode(); SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged CLUI_ReloadCLUIOptions(); @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); g_hCLUIOptionsWnd = hwndDlg; - CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { //====== Activate/Deactivate Non-Layered items ======= fEnabled = !g_CluiData.fLayered || g_CluiData.fDisableSkinEngine; @@ -945,20 +945,20 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWMAINMENU), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_DROPSHADOW), fEnabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_AEROGLASS), !fEnabled && (g_proc_DWMEnableBlurBehindWindow != NULL)); + EnableWindow(GetDlgItem(hwndDlg, IDC_AEROGLASS), !fEnabled && (g_proc_DWMEnableBlurBehindWindow != nullptr)); EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEBAR_STATIC), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_ROUNDCORNERS), fEnabled); } { //====== Non-Layered Mode ===== - CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_BORDER, db_get_b(NULL, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOBORDERWND, db_get_b(NULL, "CList", "NoBorder", SETTING_NOBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_BORDER, db_get_b(0, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOBORDERWND, db_get_b(0, "CList", "NoBorder", SETTING_NOBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); - CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) { EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE); @@ -970,35 +970,35 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCAPTION), FALSE); } - CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, db_get_b(NULL, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(0, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, db_get_b(0, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); } //====== End of Non-Layered Mode ===== - CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(0, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_FRAMESSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); SendDlgItemMessage(hwndDlg, IDC_CAPTIONSSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_FRAMESSPIN, UDM_SETPOS, 0, db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_CAPTIONSSPIN, UDM_SETPOS, 0, db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_FRAMESSPIN, UDM_SETPOS, 0, db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_CAPTIONSSPIN, UDM_SETPOS, 0, db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT)); SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(250, 0)); SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(250, 0)); SendDlgItemMessage(hwndDlg, IDC_TOPMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(250, 0)); SendDlgItemMessage(hwndDlg, IDC_BOTTOMMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(250, 0)); - SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); - CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AEROGLASS, db_get_b(NULL, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AEROGLASS, db_get_b(0, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_LAYERENGINE), !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? TRUE : FALSE); - CheckDlgButton(hwndDlg, IDC_LAYERENGINE, (db_get_b(NULL, "ModernData", "EnableLayering", SETTING_ENABLELAYERING_DEFAULT) && !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED : BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_LAYERENGINE), !db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? TRUE : FALSE); + CheckDlgButton(hwndDlg, IDC_LAYERENGINE, (db_get_b(0, "ModernData", "EnableLayering", SETTING_ENABLELAYERING_DEFAULT) && !db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED : BST_CHECKED); { DBVARIANT dbv = { 0 }; wchar_t *s; - if (!db_get_ws(NULL, "CList", "TitleText", &dbv)) + if (!db_get_ws(0, "CList", "TitleText", &dbv)) s = dbv.ptszVal; else s = _A2W(MIRANDANAME); @@ -1008,26 +1008,26 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)MIRANDANAME); char szUin[20]; - mir_snprintf(szUin, "%u", db_get_dw(NULL, "ICQ", "UIN", 0)); + mir_snprintf(szUin, "%u", db_get_dw(0, "ICQ", "UIN", 0)); SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)szUin); - if (!db_get_s(NULL, "ICQ", "Nick", &dbv)) { + if (!db_get_s(0, "ICQ", "Nick", &dbv)) { SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)dbv.pszVal); db_free(&dbv); - dbv.pszVal = NULL; + dbv.pszVal = nullptr; } - if (!db_get_s(NULL, "ICQ", "FirstName", &dbv)) { + if (!db_get_s(0, "ICQ", "FirstName", &dbv)) { SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)dbv.pszVal); db_free(&dbv); - dbv.pszVal = NULL; + dbv.pszVal = nullptr; } - if (!db_get_s(NULL, "ICQ", "e-mail", &dbv)) { + if (!db_get_s(0, "ICQ", "e-mail", &dbv)) { SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)dbv.pszVal); db_free(&dbv); - dbv.pszVal = NULL; + dbv.pszVal = nullptr; } } - CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC12), FALSE); @@ -1038,8 +1038,8 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); - SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT)); SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0); return TRUE; @@ -1063,7 +1063,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_NOBORDERWND), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWMAINMENU), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_DROPSHADOW), fEnabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_AEROGLASS), !fEnabled && (g_proc_DWMEnableBlurBehindWindow != NULL)); + EnableWindow(GetDlgItem(hwndDlg, IDC_AEROGLASS), !fEnabled && (g_proc_DWMEnableBlurBehindWindow != nullptr)); EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEBAR_STATIC), fEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_ROUNDCORNERS), fEnabled); if (LOWORD(wParam) == IDC_DISABLEENGINE) { @@ -1118,43 +1118,43 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CLUI", "LeftClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "RightClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "TopClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TOPMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "BottomClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_BOTTOMMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "ModernData", "DisableEngine", IsDlgButtonChecked(hwndDlg, IDC_DISABLEENGINE)); - db_set_b(NULL, "ModernData", "AeroGlass", IsDlgButtonChecked(hwndDlg, IDC_AEROGLASS)); + db_set_b(0, "CLUI", "LeftClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLUI", "RightClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLUI", "TopClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TOPMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLUI", "BottomClientMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_BOTTOMMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "ModernData", "DisableEngine", IsDlgButtonChecked(hwndDlg, IDC_DISABLEENGINE)); + db_set_b(0, "ModernData", "AeroGlass", IsDlgButtonChecked(hwndDlg, IDC_AEROGLASS)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEENGINE)) { if (IsDlgButtonChecked(hwndDlg, IDC_LAYERENGINE)) - db_set_b(NULL, "ModernData", "EnableLayering", 0); + db_set_b(0, "ModernData", "EnableLayering", 0); else - db_unset(NULL, "ModernData", "EnableLayering"); + db_unset(0, "ModernData", "EnableLayering"); } - g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); - db_set_b(NULL, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); - db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); + g_CluiData.dwKeyColor = db_get_dw(0, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); + db_set_b(0, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); + db_set_b(0, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - db_set_b(NULL, "CLUI", "DragToScroll", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAGTOSCROLL)); + db_set_b(0, "CLUI", "DragToScroll", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAGTOSCROLL)); { //====== Non-Layered Mode ====== - db_set_b(NULL, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); - db_set_b(NULL, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); - db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); - db_set_b(NULL, "CList", "ThinBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BORDER)); - db_set_b(NULL, "CList", "NoBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOBORDERWND)); + db_set_b(0, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); + db_set_b(0, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); + db_set_b(0, "CList", "ThinBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BORDER)); + db_set_b(0, "CList", "NoBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOBORDERWND)); { wchar_t title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); - db_set_ws(NULL, "CList", "TitleText", title); + db_set_ws(0, "CList", "TitleText", title); } - db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); - db_set_b(NULL, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); - db_set_b(NULL, "CLC", "RoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ROUNDCORNERS)); + db_set_b(0, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); + db_set_b(0, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); + db_set_b(0, "CLC", "RoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ROUNDCORNERS)); } //====== End of Non-Layered Mode ====== g_mutex_bChangingMode = TRUE; if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { - HWND hProgMan = FindWindow(L"Progman", NULL); + HWND hProgMan = FindWindow(L"Progman", nullptr); if (IsWindow(hProgMan)) { SetParent(pcli->hwndContactList, hProgMan); Sync(CLUIFrames_SetParentForContainers, (HWND)hProgMan); @@ -1163,26 +1163,26 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } else { if (GetParent(pcli->hwndContactList)) { - SetParent(pcli->hwndContactList, NULL); - Sync(CLUIFrames_SetParentForContainers, (HWND)NULL); + SetParent(pcli->hwndContactList, nullptr); + Sync(CLUIFrames_SetParentForContainers, (HWND)nullptr); } g_CluiData.fOnDesktop = 0; } AniAva_UpdateParent(); - db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); + db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); g_CluiData.fSmoothAnimation = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT); { int i1 = SendDlgItemMessage(hwndDlg, IDC_FRAMESSPIN, UDM_GETPOS, 0, 0); int i2 = SendDlgItemMessage(hwndDlg, IDC_CAPTIONSSPIN, UDM_GETPOS, 0, 0); - db_set_dw(NULL, "CLUIFrames", "GapBetweenFrames", (DWORD)i1); - db_set_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", (DWORD)i2); + db_set_dw(0, "CLUIFrames", "GapBetweenFrames", (DWORD)i1); + db_set_dw(0, "CLUIFrames", "GapBetweenTitleBar", (DWORD)i2); Sync(CLUIFramesOnClistResize, (WPARAM)pcli->hwndContactList, 0); } - db_set_b(NULL, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); - db_set_b(NULL, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); + db_set_b(0, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + db_set_b(0, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); + db_set_b(0, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); + db_set_b(0, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); ske_LoadSkinFromDB(); CLUI_UpdateLayeredMode(); @@ -1208,7 +1208,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP extern HINSTANCE g_hInst; -char **bkgrList = NULL; +char **bkgrList = nullptr; int bkgrCount = 0; #define M_BKGR_UPDATE (WM_USER+10) @@ -1262,13 +1262,13 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int jndx; dat->item[indx].changed = FALSE; - dat->item[indx].useBitmap = db_get_b(NULL, module, "UseBitmap", DEFAULT_USEBITMAP); - dat->item[indx].bkColor = db_get_dw(NULL, module, "BkColour", DEFAULT_BKCOLOUR); - dat->item[indx].selColor = db_get_dw(NULL, module, "SelBkColour", DEFAULT_SELBKCOLOUR); - dat->item[indx].useWinColours = db_get_b(NULL, module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + dat->item[indx].useBitmap = db_get_b(0, module, "UseBitmap", DEFAULT_USEBITMAP); + dat->item[indx].bkColor = db_get_dw(0, module, "BkColour", DEFAULT_BKCOLOUR); + dat->item[indx].selColor = db_get_dw(0, module, "SelBkColour", DEFAULT_SELBKCOLOUR); + dat->item[indx].useWinColours = db_get_b(0, module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); DBVARIANT dbv; - if (!db_get_s(NULL, module, "BkBitmap", &dbv)) { + if (!db_get_s(0, module, "BkBitmap", &dbv)) { int retval = PathToAbsolute(dbv.pszVal, dat->item[indx].filename); if (!retval || retval == CALLSERVICE_NOTFOUND) mir_strncpy(dat->item[indx].filename, dbv.pszVal, _countof(dat->item[indx].filename)); @@ -1276,7 +1276,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } else *dat->item[indx].filename = 0; - dat->item[indx].flags = db_get_w(NULL, module, "BkBmpUse", DEFAULT_BKBMPUSE); + dat->item[indx].flags = db_get_w(0, module, "BkBmpUse", DEFAULT_BKBMPUSE); jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx])); SendMessage(hList, CB_SETITEMDATA, jndx, indx); } @@ -1424,29 +1424,29 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, continue; char *module = bkgrList[indx] + mir_strlen(bkgrList[indx]) + 1; - db_set_b(NULL, module, "UseBitmap", (BYTE)p.useBitmap); + db_set_b(0, module, "UseBitmap", (BYTE)p.useBitmap); COLORREF col; if ((col = p.bkColor) == DEFAULT_BKCOLOUR) - db_unset(NULL, module, "BkColour"); + db_unset(0, module, "BkColour"); else - db_set_dw(NULL, module, "BkColour", col); + db_set_dw(0, module, "BkColour", col); if ((col = p.selColor) == DEFAULT_SELBKCOLOUR) - db_unset(NULL, module, "SelBkColour"); + db_unset(0, module, "SelBkColour"); else - db_set_dw(NULL, module, "SelBkColour", col); + db_set_dw(0, module, "SelBkColour", col); - db_set_b(NULL, module, "UseWinColours", (BYTE)p.useWinColours); + db_set_b(0, module, "UseWinColours", (BYTE)p.useWinColours); char str[MAX_PATH]; int retval = PathToAbsolute(p.filename, str); if (!retval || retval == CALLSERVICE_NOTFOUND) - db_set_s(NULL, module, "BkBitmap", p.filename); + db_set_s(0, module, "BkBitmap", p.filename); else - db_set_s(NULL, module, "BkBitmap", str); + db_set_s(0, module, "BkBitmap", str); - db_set_w(NULL, module, "BkBmpUse", p.flags); + db_set_w(0, module, "BkBmpUse", p.flags); p.changed = FALSE; NotifyEventHooks(g_CluiData.hEventBkgrChanged, (WPARAM)module, 0); } @@ -1466,7 +1466,7 @@ static INT_PTR BkgrCfg_Register(WPARAM wParam, LPARAM lParam) char *value = (char *)mir_alloc(len + 4); // add room for flags (DWORD) memcpy(value, szSetting, len); char *tok = strchr(value, '/'); - if (tok == NULL) { + if (tok == nullptr) { mir_free(value); return 1; } @@ -1487,13 +1487,13 @@ HRESULT BackgroundsLoadModule() int BackgroundsUnloadModule(void) { - if (bkgrList != NULL) { + if (bkgrList != nullptr) { for (int indx = 0; indx < bkgrCount; indx++) mir_free(bkgrList[indx]); mir_free(bkgrList); } DestroyHookableEvent(g_CluiData.hEventBkgrChanged); - g_CluiData.hEventBkgrChanged = NULL; + g_CluiData.hEventBkgrChanged = nullptr; return 0; } diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 4f86443288..1537729272 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -128,7 +128,7 @@ HFONT CLCPaint::ChangeToFont(HDC hdc, ClcData *dat, int id, int *fontHeight) dat = (ClcData*)GetWindowLongPtr(pcli->hwndContactTree, 0); if (!dat) - return NULL; + return nullptr; HFONT res = (HFONT)SelectObject(hdc, dat->fontModernInfo[id].hFont); SetTextColor(hdc, dat->fontModernInfo[id].colour); @@ -186,7 +186,7 @@ int CLCPaint::GetBasicFontID(ClcContact *contact) void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, wchar_t *szText, SortedList *plText, UINT uTextFormat, int smiley_height) { - if (szText == NULL || !szText[0]) { + if (szText == nullptr || !szText[0]) { text_size->cy = 0; text_size->cx = 0; } @@ -201,7 +201,7 @@ void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, wchar_ // Always need cy... text_size->cy = ske_DrawText(hdcMem, szText, (int)mir_wstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat); text_size->cy = min(text_size->cy, free_height); - if (plText == NULL) + if (plText == nullptr) text_size->cx = min(text_rc.right - text_rc.left + 2, free_width); else { // See each item of list @@ -400,11 +400,11 @@ RECT CLCPaint::_GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, wchar_t *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley) { - if (szText == NULL) + if (szText == nullptr) return; uTextFormat &= ~DT_RIGHT; - if (plText == NULL) { + if (plText == nullptr) { if (start) { SIZE size; GetTextExtentPoint32(hdcMem, szText, start, &size); @@ -483,7 +483,7 @@ void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, wcha text_rc.top += (row_height - fac_height) >> 1; ske_DrawIconEx(hdcMem, text_rc.left, text_rc.top, piece->smiley, - fac_width, fac_height, 0, NULL, DI_NORMAL | ((factor < 1) ? 128 : 0)); //TO DO enchance drawing quality + fac_width, fac_height, 0, nullptr, DI_NORMAL | ((factor < 1) ? 128 : 0)); //TO DO enchance drawing quality } else { ske_DrawText(hdcMem, L"...", 3, &text_rc, uTextFormat); @@ -519,7 +519,7 @@ void CLCPaint::_FillParam(MASKPARAM *lpParam, DWORD dwParamHash, const char* con if (szValue) lpParam->szValue = mir_strndup(szValue, (int)mir_strlen(szValue)); else - lpParam->szValue = NULL; + lpParam->szValue = nullptr; } void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex) @@ -529,7 +529,7 @@ void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWOR MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat) { - if (Drawing == NULL) + if (Drawing == nullptr) return 0; char buf[BUF2SIZE] = { 0 }; @@ -568,7 +568,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac else _AddParamShort(mpModernMask, hi_Type, hi_Contact); AddParam(mpModernMask, HASH[hi_Protocol], Drawing->proto, 0); - _AddParamShort(mpModernMask, hi_RootGroup, (group && group->parent == NULL) ? hi_True : hi_False); + _AddParamShort(mpModernMask, hi_RootGroup, (group && group->parent == nullptr) ? hi_True : hi_False); switch (GetContactCachedStatus(Drawing->hContact)) { case ID_STATUS_ONLINE: _AddParamShort(mpModernMask, hi_Status, hi_ONLINE); break; case ID_STATUS_AWAY: _AddParamShort(mpModernMask, hi_Status, hi_AWAY); break; @@ -582,7 +582,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac case ID_STATUS_IDLE: _AddParamShort(mpModernMask, hi_Status, hi_IDLE); break; default: _AddParamShort(mpModernMask, hi_Status, hi_OFFLINE); } - _AddParamShort(mpModernMask, hi_HasAvatar, (dat->avatars_show && Drawing->avatar_data != NULL) ? hi_True : hi_False); + _AddParamShort(mpModernMask, hi_HasAvatar, (dat->avatars_show && Drawing->avatar_data != nullptr) ? hi_True : hi_False); _AddParamShort(mpModernMask, hi_Rate, hi_None + Drawing->bContactRate); } break; @@ -763,13 +763,13 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R // 3 draw text { SIZE text_size = { 0 }; - wchar_t *szCounts = NULL; + wchar_t *szCounts = nullptr; RECT text_rect = fr_rc; RECT counts_rc = { 0 }; UINT uTextFormat = DT_LEFT | DT_VCENTER | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE; uTextFormat |= dat->text_rtl ? DT_RTLREADING : 0; // Select font - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); // Get text size GetTextSize(&text_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, uTextFormat, @@ -785,7 +785,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R // Has to draw the count? if (szCounts && mir_wstrlen(szCounts) > 0) { // calc width and height - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); ske_DrawText(hdcMem, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX); count_size.cx = count_rc.right - count_rc.left; space_width = count_size.cx; @@ -799,7 +799,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R { SIZE grp_size = { 0 }; int wid = fr_rc.right - fr_rc.left; - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr); GetTextSize(&grp_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); if (wid - count_size.cx > grp_size.cx) { @@ -827,7 +827,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R } uTextFormat |= DT_VCENTER; - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr); if (selected) SetTextColor(hdcMem, dat->selTextColour); else if (hottrack) @@ -841,7 +841,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R } if (szCounts && mir_wstrlen(szCounts) > 0) { - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); if (selected) SetTextColor(hdcMem, dat->selTextColour); else if (hottrack) @@ -868,7 +868,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R space_size.cx = space_rc.right - space_rc.left; space_size.cy = min(space_rc.bottom - space_rc.top, fr_rc.bottom - fr_rc.top); - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, DT_CALCRECT); counts_size.cx = counts_rc.right - counts_rc.left; @@ -891,7 +891,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R counts_rc.right = counts_rc.left + counts_size.cx; } } - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); // Set color if (selected) @@ -913,7 +913,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, (int)mir_wstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys); } if (Drawing->type == CLCIT_GROUP && szCounts && szCounts[0] && counts_rc.right - counts_rc.left > 0) { - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); if (dat->text_rtl != 0) _RTLRect(&counts_rc, free_row_rc.right); ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, uTextFormat); if (dat->text_rtl == 0) @@ -951,7 +951,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R // Call Placement cppCalculateRowItemsPos(gl_RowRoot, free_row_rc.right - free_row_rc.left); // Now paint - while ((gl_RowTabAccess[i] != NULL || (i < 2 && Drawing->type == CLCIT_GROUP)) && !(i >= 2 && Drawing->type == CLCIT_GROUP)) { + while ((gl_RowTabAccess[i] != nullptr || (i < 2 && Drawing->type == CLCIT_GROUP)) && !(i >= 2 && Drawing->type == CLCIT_GROUP)) { if (gl_RowTabAccess[i]->r.right - gl_RowTabAccess[i]->r.left > 0 && gl_RowTabAccess[i]->r.bottom - gl_RowTabAccess[i]->r.top > 0) { RECT p_rect = gl_RowTabAccess[i]->r; OffsetRect(&p_rect, dx, dy); @@ -966,7 +966,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R UINT uTextFormat = (dat->text_rtl ? DT_RTLREADING : 0); text_size.cx = p_rect.right - p_rect.left; text_size.cy = p_rect.bottom - p_rect.top; - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0; uTextFormat |= (gl_RowTabAccess[i]->halign == TC_HCENTER) ? DT_CENTER : (gl_RowTabAccess[i]->halign == TC_RIGHT) ? DT_RIGHT : 0; @@ -1006,7 +1006,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R // Has to draw the count? if (szCounts && mir_wstrlen(szCounts) > 0) { // calc width and height - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); ske_DrawText(hdcMem, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX); count_size.cx = count_rc.right - count_rc.left; space_width = count_size.cx; @@ -1020,7 +1020,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R { SIZE grp_size = { 0 }; int wid = p_rect.right - p_rect.left; - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr); GetTextSize(&grp_size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); if (wid - count_size.cx > grp_size.cx) { @@ -1048,7 +1048,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R } uTextFormat |= DT_VCENTER; - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr); if (selected) SetTextColor(hdcMem, dat->selTextColour); else if (hottrack) @@ -1059,7 +1059,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys); } if (szCounts && mir_wstrlen(szCounts) > 0) { - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); if (selected) SetTextColor(hdcMem, dat->selTextColour); else if (hottrack) @@ -1093,7 +1093,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R text_size.cx = p_rect.right - p_rect.left; text_size.cy = p_rect.bottom - p_rect.top; - ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL); + ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, nullptr); uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE; if (Drawing->type == CLCIT_CONTACT) _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, (int)mir_wstrlen(pdnce->szSecondLineText), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys); @@ -1121,7 +1121,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R text_size.cx = p_rect.right - p_rect.left; text_size.cy = p_rect.bottom - p_rect.top; - ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL); + ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, nullptr); uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE; if (Drawing->type == CLCIT_CONTACT) _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, (int)mir_wstrlen(pdnce->szThirdLineText), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys); @@ -1130,7 +1130,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R case TC_STATUS: if ((Drawing->type == CLCIT_GROUP && !dat->row_hide_group_icon) || (Drawing->type == CLCIT_CONTACT && Drawing->iImage != -1 - && !(dat->icon_hide_on_avatar && dat->avatars_show && Drawing->avatar_data != NULL && !Drawing->bImageIsSpecial))) { + && !(dat->icon_hide_on_avatar && dat->avatars_show && Drawing->avatar_data != nullptr && !Drawing->bImageIsSpecial))) { int iImage = -1; // Get image if (Drawing->type == CLCIT_GROUP) { @@ -1170,7 +1170,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R case TC_AVATAR: { - BOOL hasAvatar = Drawing->avatar_data != NULL; + BOOL hasAvatar = Drawing->avatar_data != nullptr; BYTE blendmode = 255; if (hottrack) blendmode = 255; @@ -1209,7 +1209,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R } } else { - HRGN rgn = NULL; + HRGN rgn = nullptr; int round_radius = 0; int ava_width = p_rect.right - p_rect.left; int ava_height = p_rect.bottom - p_rect.top; @@ -1286,7 +1286,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R break; case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL: { - int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); + int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == nullptr ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); if (item != -1) _DrawStatusIcon(Drawing, dat, item, hdcMem, p_rect.left, p_rect.top, ICON_HEIGHT, ICON_HEIGHT, @@ -1394,7 +1394,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R wchar_t szResult[80]; if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) { // Select font - ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, nullptr); ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0)); } break; @@ -1532,7 +1532,7 @@ void CLCPaint::_PreparePaintContext(ClcData *dat, HDC hdc, int paintMode, RECT& if ((paintMode & DM_GRAY) && !(paintMode & DM_LAYERED)) { pc.hdcMem2 = CreateCompatibleDC(hdc); if (paintMode & DM_CLASSIC) - pc.hBmpOsb2 = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + pc.hBmpOsb2 = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr); else pc.hBmpOsb2 = ske_CreateDIB32(clRect.right, clRect.bottom); pc.oldbmp2 = (HBITMAP)SelectObject(pc.hdcMem2, pc.hBmpOsb2); @@ -1576,7 +1576,7 @@ void CLCPaint::_PreparePaintContext(ClcData *dat, HDC hdc, int paintMode, RECT& POINT org; GetBrushOrgEx(pc.hdcMem, &org); - SetBrushOrgEx(pc.hdcMem, org.x, org.y, NULL); + SetBrushOrgEx(pc.hdcMem, org.x, org.y, nullptr); } void CLCPaint::_DrawBackground(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, RECT& clRect, _PaintContext& pc) @@ -1620,7 +1620,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, if (group->scanIndex >= group->cl.getCount()) { group = group->parent; indent--; - if (group == NULL) break; // Finished list + if (group == nullptr) break; // Finished list group->scanIndex++; continue; } @@ -1643,7 +1643,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, subident = dat->subIndent; } } - else Drawing = NULL; + else Drawing = nullptr; // Something to draw? if (Drawing) { @@ -1654,7 +1654,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, RowHeight_CalcRowHeight(dat, Drawing, line_num); // Init settings - int selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != NULL || dat->bShowSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER); + int selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != nullptr || dat->bShowSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER); int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == line_num; int left_pos = clRect.left + dat->leftMargin + indent * dat->groupIndent + subident; int right_pos = dat->rightMargin; // Border @@ -1690,7 +1690,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, else SkinDrawGlyph(pc.hdcMem, &row_rc, rcPaint, "CL,ID=GreyAlternate"); } - MODERNMASK *mpRequest = NULL; + MODERNMASK *mpRequest = nullptr; if (!(paintMode & (DM_CLASSIC | DM_CONTROL))) { // Row background if (!(paintMode & DM_CONTROL)) { //Build mpRequest string @@ -1800,7 +1800,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, // increment by subcontacts ClcContact *cc = group->cl[group->scanIndex]; - if (cc != NULL && cc->subcontacts != NULL && cc->type != CLCIT_GROUP && cc->bSubExpanded && dat->bMetaExpanding) { + if (cc != nullptr && cc->subcontacts != nullptr && cc->type != CLCIT_GROUP && cc->bSubExpanded && dat->bMetaExpanding) { if (subindex < cc->iSubAllocated - 1) subindex++; else @@ -1821,7 +1821,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, subindex = -1; } } - SelectClipRgn(pc.hdcMem, NULL); + SelectClipRgn(pc.hdcMem, nullptr); } void CLCPaint::_DrawInsertionMark(ClcData *dat, RECT &clRect, _PaintContext &pc) @@ -1889,7 +1889,7 @@ void CLCPaint::_FreePaintContext(_PaintContext &pc) void CLCPaint::_PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *_rcPaint) { - g_CluiData.t_now = time(NULL); + g_CluiData.t_now = time(nullptr); if (_rcPaint && IsRectEmpty(_rcPaint)) return; // check if draw area is not empty if (!IsWindowVisible(hwnd)) return; // and window is visible @@ -1901,7 +1901,7 @@ void CLCPaint::_PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *_rcPaint) // Invalidate ani avatars, avatars have to be validated in row paint routine below if (rcPaint->top == 0 && rcPaint->bottom == clRect.bottom && dat->avatars_show) - AniAva_InvalidateAvatarPositions(NULL); + AniAva_InvalidateAvatarPositions(0); // Now determine paint mode int paintMode = _DetermineDrawMode(hwnd, dat); @@ -1996,7 +1996,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT max_width = dat->avatars_maxheight_size; // Has to draw? - if (Drawing->avatar_data == NULL || miniMode) { + if (Drawing->avatar_data == nullptr || miniMode) { // Don't have to draw avatar // Has to draw icon instead? @@ -2057,7 +2057,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT case ITEM_ICON: ///////////////////////////////////////////////////////////////////////////////////////////////////// { int iImage = -1; - BOOL has_avatar = Drawing->avatar_data != NULL && !CheckMiniMode(dat, selected); + BOOL has_avatar = Drawing->avatar_data != nullptr && !CheckMiniMode(dat, selected); if (Drawing->type == CLCIT_CONTACT && dat->icon_hide_on_avatar @@ -2107,7 +2107,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) { // Select font - ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, nullptr); // Get text size RECT rc; @@ -2172,7 +2172,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT int free_height = free_row_rc.bottom - free_row_rc.top; // Select font - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); // Get text size SIZE text_size = { 0 }; @@ -2212,7 +2212,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT space_size.cx = space_rc.right - space_rc.left; space_size.cy = min(space_rc.bottom - space_rc.top, free_height); - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, DT_CALCRECT); counts_size.cx = counts_rc.right - counts_rc.left; @@ -2244,7 +2244,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT selection_text_rc = text_rc; full_text_width = text_width; - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr); } if (dat->row_align_group_mode == 1) { // center @@ -2271,7 +2271,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT } if (pdnce->szSecondLineText && pdnce->szSecondLineText[0] && free_height > dat->secondLine.top_space) { - ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL); + ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, nullptr); // Get sizes GetTextSize(&second_line_text_size, hdcMem, free_row_rc, pdnce->szSecondLineText, pdnce->ssSecondLine.plText, @@ -2302,8 +2302,8 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0); replaceStrW(pdnce->szThirdLineText, buf); } - if (pdnce->szThirdLineText != NULL && pdnce->szThirdLineText[0] && free_height > dat->thirdLine.top_space) { - ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL); + if (pdnce->szThirdLineText != nullptr && pdnce->szThirdLineText[0] && free_height > dat->thirdLine.top_space) { + ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, nullptr); // Get sizes GetTextSize(&third_line_text_size, hdcMem, free_row_rc, pdnce->szThirdLineText, pdnce->ssThirdLine.plText, @@ -2328,7 +2328,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT } } - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); } selection_text_rc.left = text_rc.left; @@ -2525,14 +2525,14 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, overlayIdx = g_pAvatarOverlayIcons[GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE].listID; break; case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL: - overlayIdx = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); + overlayIdx = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == nullptr ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); break; case SETTING_AVATAR_OVERLAY_TYPE_CONTACT: overlayIdx = Drawing->iImage; break; } } - _GetBlendMode(dat, Drawing, selected, hottrack, GIM_AVATAR_AFFECT, NULL, &blendmode); + _GetBlendMode(dat, Drawing, selected, hottrack, GIM_AVATAR_AFFECT, nullptr, &blendmode); AniAva_SetAvatarPos(Drawing->hContact, prcItem, overlayIdx, blendmode); AniAva_RenderAvatar(Drawing->hContact, hdcMem, prcItem); } @@ -2541,7 +2541,7 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, HRGN rgn; int blendmode = 255; - _GetBlendMode(dat, Drawing, selected, hottrack, GIM_AVATAR_AFFECT, NULL, &blendmode); + _GetBlendMode(dat, Drawing, selected, hottrack, GIM_AVATAR_AFFECT, nullptr, &blendmode); //get round corner radius if (dat->avatars_round_corners) { @@ -2599,7 +2599,7 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, break; case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL: { - int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); + int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == nullptr ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); if (item != -1) _DrawStatusIcon(Drawing, dat, item, hdcMem, ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, @@ -2642,7 +2642,7 @@ void CLCPaint::_DrawContactIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat) { - ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); + ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr); if (selected) SetTextColor(hdcMem, dat->bForceInDialog ? GetSysColor(COLOR_HIGHLIGHTTEXT) : dat->selTextColour); else if (hottrack || (dat->bFilterSearch && dat->szQuickSearch[0] != '\0' && Drawing->type != CLCIT_GROUP)) @@ -2688,7 +2688,7 @@ void CLCPaint::_DrawContactSubText(HDC hdcMem, ClcData *dat, ClcContact *Drawing // Has to draw the count? if (szCounts && szCounts[0]) { - ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); if (selected) SetTextColor(hdcMem, dat->selTextColour); else if (hottrack) @@ -2700,7 +2700,7 @@ void CLCPaint::_DrawContactSubText(HDC hdcMem, ClcData *dat, ClcContact *Drawing else if (Drawing->type == CLCIT_CONTACT) { ClcCacheEntry *pdnce = Drawing->pce; SIZE text_size = { _rcWidth(prcItem), _rcHeight(prcItem) }; - ChangeToFont(hdcMem, dat, itemType == CIT_SUBTEXT1 ? FONTID_SECONDLINE : FONTID_THIRDLINE, NULL); + ChangeToFont(hdcMem, dat, itemType == CIT_SUBTEXT1 ? FONTID_SECONDLINE : FONTID_THIRDLINE, nullptr); //draw second and third line if (selected) SetTextColor(hdcMem, dat->selTextColour); @@ -2725,7 +2725,7 @@ void CLCPaint::_DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) { // Select font - ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, nullptr); ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), prcItem, DT_NOPREFIX | DT_SINGLELINE); } } diff --git a/plugins/Clist_modern/src/modern_clcpaint.h b/plugins/Clist_modern/src/modern_clcpaint.h index 5a3d53adb0..0fde745194 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.h +++ b/plugins/Clist_modern/src/modern_clcpaint.h @@ -167,11 +167,11 @@ private: COLORREF tmpforecolour; DWORD fRelease; - _PaintContext(HDC _hdcMem = NULL) : - hdcMem(_hdcMem), hdcMem2(NULL), - hBmpOsb2(NULL), oldbmp2(NULL), - hBmpOsb(NULL), oldbmp(NULL), - hBrushAlternateGrey(NULL), + _PaintContext(HDC _hdcMem = nullptr) : + hdcMem(_hdcMem), hdcMem2(nullptr), + hBmpOsb2(nullptr), oldbmp2(nullptr), + hBmpOsb(nullptr), oldbmp(nullptr), + hBrushAlternateGrey(nullptr), tmpbkcolour(0), tmpforecolour(0), fRelease(release_none) {}; }; diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 3a127962e8..b37ab12ffd 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -33,8 +33,8 @@ BOOL RectHitTest(RECT *rc, int testx, int testy) int cliHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags) { - ClcContact *hitcontact = NULL; - ClcGroup *hitgroup = NULL; + ClcContact *hitcontact = nullptr; + ClcGroup *hitgroup = nullptr; int hit = -1; RECT clRect; if (CLUI_TestCursorOnBorders() != 0) { @@ -149,8 +149,8 @@ void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) nowTick = GetTickCount(); if (nowTick >= startTick + dat->scrollTime) break; dat->yScroll = oldy + (desty - oldy)*(int)(nowTick - startTick) / dat->scrollTime; - if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL && */FALSE) - ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); + if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == nullptr && */FALSE) + ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE); else CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, 0); @@ -161,7 +161,7 @@ void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) } } dat->yScroll = desty; - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); } @@ -281,9 +281,9 @@ void cliBeginRenameSelection(HWND hwnd, ClcData *dat) if (dat->text_rtl) a |= EN_ALIGN_RTL_EC; if (contact->type == CLCIT_GROUP) - dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, NULL, g_hInst, NULL); + dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_hInst, nullptr); else - dat->hwndRenameEdit = CreateWindow(L"EDIT", pcli->pfnGetContactDisplayName(contact->hContact, 0), WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, NULL, g_hInst, NULL); + dat->hwndRenameEdit = CreateWindow(L"EDIT", pcli->pfnGetContactDisplayName(contact->hContact, 0), WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_hInst, nullptr); SetWindowLongPtr(dat->hwndRenameEdit, GWL_STYLE, GetWindowLongPtr(dat->hwndRenameEdit, GWL_STYLE)&(~WS_CAPTION) | WS_BORDER); SetWindowLongPtr(dat->hwndRenameEdit, GWLP_USERDATA, (LONG_PTR)dat); @@ -306,7 +306,7 @@ void cliBeginRenameSelection(HWND hwnd, ClcData *dat) int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) { - ClcContact *contact = NULL, *movecontact = NULL; + ClcContact *contact = nullptr, *movecontact = nullptr; ClcGroup *group, *movegroup; RECT clRect; @@ -327,8 +327,8 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) int nSetSelection = -1; if (movecontact->type == CLCIT_GROUP) { - ClcContact *bottomcontact = NULL, *topcontact = NULL; - ClcGroup *topgroup = NULL, *bottomgroup = NULL; + ClcContact *bottomcontact = nullptr, *topcontact = nullptr; + ClcGroup *topgroup = nullptr, *bottomgroup = nullptr; int topItem = -1, bottomItem = -1; int ok = 0; if (pt.y + dat->yScroll < cliGetRowTopY(dat, hit) + dat->insertionMarkHitHeight || contact->type != CLCIT_GROUP) { @@ -414,9 +414,9 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) COLORREF cliGetColor(char *module, char *color, COLORREF defColor) { - BOOL useWinColor = db_get_b(NULL, module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + BOOL useWinColor = db_get_b(0, module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); if (useWinColor) return defColor; - else return db_get_dw(NULL, module, color, defColor); + else return db_get_dw(0, module, color, defColor); } void RegisterCLUIFonts(void); @@ -435,7 +435,7 @@ void LoadCLCFonts(HWND hwnd, ClcData *dat) // Issue 40: Do not reload font colors for embedded clists // Parent window is responsible to re-set fonts colors if needed LOGFONT lf; - GetFontSetting(i, &lf, dat->bForceInDialog ? NULL : &dat->fontModernInfo[i].colour, &dat->fontModernInfo[i].effect, &dat->fontModernInfo[i].effectColour1, &dat->fontModernInfo[i].effectColour2); + GetFontSetting(i, &lf, dat->bForceInDialog ? nullptr : &dat->fontModernInfo[i].colour, &dat->fontModernInfo[i].effect, &dat->fontModernInfo[i].effectColour1, &dat->fontModernInfo[i].effectColour2); dat->fontModernInfo[i].hFont = CreateFontIndirect(&lf); dat->fontModernInfo[i].changed = 0; @@ -450,33 +450,33 @@ void LoadCLCFonts(HWND hwnd, ClcData *dat) void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) { - g_CluiData.fDisableSkinEngine = db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fDisableSkinEngine = db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); LoadCLCFonts(hwnd, dat); - g_CluiData.bSortByOrder[0] = db_get_b(NULL, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); - g_CluiData.bSortByOrder[1] = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); - g_CluiData.bSortByOrder[2] = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); - g_CluiData.fSortNoOfflineBottom = db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT); + g_CluiData.bSortByOrder[0] = db_get_b(0, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); + g_CluiData.bSortByOrder[1] = db_get_b(0, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); + g_CluiData.bSortByOrder[2] = db_get_b(0, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); + g_CluiData.fSortNoOfflineBottom = db_get_b(0, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT); // Row - dat->row_min_heigh = db_get_w(NULL, "CList", "MinRowHeight", CLCDEFAULT_ROWHEIGHT); - dat->row_border = db_get_w(NULL, "CList", "RowBorder", SETTING_ROWBORDER_DEFAULT); - dat->row_before_group_space = ((hwnd != pcli->hwndContactTree && pcli->hwndContactTree != NULL) - || !db_get_b(NULL, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) ? 0 : db_get_w(NULL, "ModernSkin", "SpaceBeforeGroup", SKIN_SPACEBEFOREGROUP_DEFAULT); - dat->row_variable_height = db_get_b(NULL, "CList", "VariableRowHeight", SETTING_VARIABLEROWHEIGHT_DEFAULT); - dat->row_align_left_items_to_left = db_get_b(NULL, "CList", "AlignLeftItemsToLeft", SETTING_ALIGNLEFTTOLEFT_DEFAULT); - dat->row_hide_group_icon = db_get_b(NULL, "CList", "HideGroupsIcon", SETTING_HIDEGROUPSICON_DEFAULT); - dat->row_align_right_items_to_right = db_get_b(NULL, "CList", "AlignRightItemsToRight", SETTING_ALIGNRIGHTORIGHT_DEFAULT); + dat->row_min_heigh = db_get_w(0, "CList", "MinRowHeight", CLCDEFAULT_ROWHEIGHT); + dat->row_border = db_get_w(0, "CList", "RowBorder", SETTING_ROWBORDER_DEFAULT); + dat->row_before_group_space = ((hwnd != pcli->hwndContactTree && pcli->hwndContactTree != nullptr) + || !db_get_b(0, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) ? 0 : db_get_w(0, "ModernSkin", "SpaceBeforeGroup", SKIN_SPACEBEFOREGROUP_DEFAULT); + dat->row_variable_height = db_get_b(0, "CList", "VariableRowHeight", SETTING_VARIABLEROWHEIGHT_DEFAULT); + dat->row_align_left_items_to_left = db_get_b(0, "CList", "AlignLeftItemsToLeft", SETTING_ALIGNLEFTTOLEFT_DEFAULT); + dat->row_hide_group_icon = db_get_b(0, "CList", "HideGroupsIcon", SETTING_HIDEGROUPSICON_DEFAULT); + dat->row_align_right_items_to_right = db_get_b(0, "CList", "AlignRightItemsToRight", SETTING_ALIGNRIGHTORIGHT_DEFAULT); //TODO: Add to settings - dat->row_align_group_mode = db_get_b(NULL, "CList", "AlignGroupCaptions", SETTING_ALIGNGROPCAPTION_DEFAULT); - if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree) { + dat->row_align_group_mode = db_get_b(0, "CList", "AlignGroupCaptions", SETTING_ALIGNGROPCAPTION_DEFAULT); + if (pcli->hwndContactTree == nullptr || dat->hWnd == pcli->hwndContactTree) { int defItemsOrder[NUM_ITEM_TYPE] = SETTINS_ROWITEMORDER_DEFAULT; for (int i = 0; i < NUM_ITEM_TYPE; i++) { char tmp[128]; mir_snprintf(tmp, "RowPos%d", i); - dat->row_items[i] = db_get_w(NULL, "CList", tmp, defItemsOrder[i]); + dat->row_items[i] = db_get_w(0, "CList", tmp, defItemsOrder[i]); } } else { @@ -486,18 +486,18 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) } // Avatar - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { - dat->avatars_show = db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT); - dat->avatars_draw_border = db_get_b(NULL, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT); - dat->avatars_border_color = (COLORREF)db_get_dw(NULL, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT); - dat->avatars_round_corners = db_get_b(NULL, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT); - dat->avatars_use_custom_corner_size = db_get_b(NULL, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT); - dat->avatars_custom_corner_size = db_get_w(NULL, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT); - dat->avatars_ignore_size_for_row_height = db_get_b(NULL, "CList", "AvatarsIgnoreSizeForRow", SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT); - dat->avatars_draw_overlay = db_get_b(NULL, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT); - dat->avatars_overlay_type = db_get_b(NULL, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT); - dat->avatars_maxheight_size = db_get_w(NULL, "CList", "AvatarsSize", SETTING_AVATARHEIGHT_DEFAULT); - dat->avatars_maxwidth_size = db_get_w(NULL, "CList", "AvatarsWidth", SETTING_AVATARWIDTH_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) { + dat->avatars_show = g_CluiData.bAvsPresent && db_get_b(0, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT); + dat->avatars_draw_border = db_get_b(0, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT); + dat->avatars_border_color = (COLORREF)db_get_dw(0, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT); + dat->avatars_round_corners = db_get_b(0, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT); + dat->avatars_use_custom_corner_size = db_get_b(0, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT); + dat->avatars_custom_corner_size = db_get_w(0, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT); + dat->avatars_ignore_size_for_row_height = db_get_b(0, "CList", "AvatarsIgnoreSizeForRow", SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT); + dat->avatars_draw_overlay = db_get_b(0, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT); + dat->avatars_overlay_type = db_get_b(0, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT); + dat->avatars_maxheight_size = db_get_w(0, "CList", "AvatarsSize", SETTING_AVATARHEIGHT_DEFAULT); + dat->avatars_maxwidth_size = db_get_w(0, "CList", "AvatarsWidth", SETTING_AVATARWIDTH_DEFAULT); } else { dat->avatars_show = 0; @@ -514,10 +514,10 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) } // Icon - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { - dat->icon_hide_on_avatar = db_get_b(NULL, "CList", "IconHideOnAvatar", SETTING_HIDEICONONAVATAR_DEFAULT); - dat->icon_draw_on_avatar_space = db_get_b(NULL, "CList", "IconDrawOnAvatarSpace", SETTING_ICONONAVATARPLACE_DEFAULT); - dat->icon_ignore_size_for_row_height = db_get_b(NULL, "CList", "IconIgnoreSizeForRownHeight", SETTING_ICONIGNORESIZE_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) { + dat->icon_hide_on_avatar = db_get_b(0, "CList", "IconHideOnAvatar", SETTING_HIDEICONONAVATAR_DEFAULT); + dat->icon_draw_on_avatar_space = db_get_b(0, "CList", "IconDrawOnAvatarSpace", SETTING_ICONONAVATARPLACE_DEFAULT); + dat->icon_ignore_size_for_row_height = db_get_b(0, "CList", "IconIgnoreSizeForRownHeight", SETTING_ICONIGNORESIZE_DEFAULT); } else { dat->icon_hide_on_avatar = 0; @@ -526,9 +526,9 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) } // Contact time - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { - dat->contact_time_show = db_get_b(NULL, "CList", "ContactTimeShow", SETTING_SHOWTIME_DEFAULT); - dat->contact_time_show_only_if_different = db_get_b(NULL, "CList", "ContactTimeShowOnlyIfDifferent", SETTING_SHOWTIMEIFDIFF_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) { + dat->contact_time_show = db_get_b(0, "CList", "ContactTimeShow", SETTING_SHOWTIME_DEFAULT); + dat->contact_time_show_only_if_different = db_get_b(0, "CList", "ContactTimeShowOnlyIfDifferent", SETTING_SHOWTIMEIFDIFF_DEFAULT); } else { dat->contact_time_show = 0; @@ -536,69 +536,69 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) } // Text - dat->text_rtl = db_get_b(NULL, "CList", "TextRTL", SETTING_TEXT_RTL_DEFAULT); - dat->text_align_right = db_get_b(NULL, "CList", "TextAlignToRight", SETTING_TEXT_RIGHTALIGN_DEFAULT); - dat->text_replace_smileys = db_get_b(NULL, "CList", "TextReplaceSmileys", SETTING_TEXT_SMILEY_DEFAULT); - dat->text_resize_smileys = db_get_b(NULL, "CList", "TextResizeSmileys", SETTING_TEXT_RESIZESMILEY_DEFAULT); + dat->text_rtl = db_get_b(0, "CList", "TextRTL", SETTING_TEXT_RTL_DEFAULT); + dat->text_align_right = db_get_b(0, "CList", "TextAlignToRight", SETTING_TEXT_RIGHTALIGN_DEFAULT); + dat->text_replace_smileys = db_get_b(0, "CList", "TextReplaceSmileys", SETTING_TEXT_SMILEY_DEFAULT); + dat->text_resize_smileys = db_get_b(0, "CList", "TextResizeSmileys", SETTING_TEXT_RESIZESMILEY_DEFAULT); dat->text_smiley_height = 0; - dat->text_use_protocol_smileys = db_get_b(NULL, "CList", "TextUseProtocolSmileys", SETTING_TEXT_PROTOSMILEY_DEFAULT); + dat->text_use_protocol_smileys = db_get_b(0, "CList", "TextUseProtocolSmileys", SETTING_TEXT_PROTOSMILEY_DEFAULT); - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) - dat->text_ignore_size_for_row_height = db_get_b(NULL, "CList", "TextIgnoreSizeForRownHeight", SETTING_TEXT_IGNORESIZE_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) + dat->text_ignore_size_for_row_height = db_get_b(0, "CList", "TextIgnoreSizeForRownHeight", SETTING_TEXT_IGNORESIZE_DEFAULT); else dat->text_ignore_size_for_row_height = 0; // First line - dat->first_line_draw_smileys = db_get_b(NULL, "CList", "FirstLineDrawSmileys", SETTING_FIRSTLINE_SMILEYS_DEFAULT); - dat->first_line_append_nick = db_get_b(NULL, "CList", "FirstLineAppendNick", SETTING_FIRSTLINE_APPENDNICK_DEFAULT); - gl_TrimText = db_get_b(NULL, "CList", "TrimText", SETTING_FIRSTLINE_TRIMTEXT_DEFAULT); + dat->first_line_draw_smileys = db_get_b(0, "CList", "FirstLineDrawSmileys", SETTING_FIRSTLINE_SMILEYS_DEFAULT); + dat->first_line_append_nick = db_get_b(0, "CList", "FirstLineAppendNick", SETTING_FIRSTLINE_APPENDNICK_DEFAULT); + gl_TrimText = db_get_b(0, "CList", "TrimText", SETTING_FIRSTLINE_TRIMTEXT_DEFAULT); // Second line - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { - dat->secondLine.show = db_get_b(NULL, "CList", "SecondLineShow", SETTING_SECONDLINE_SHOW_DEFAULT); - dat->secondLine.top_space = db_get_w(NULL, "CList", "SecondLineTopSpace", SETTING_SECONDLINE_TOPSPACE_DEFAULT); - dat->secondLine.draw_smileys = db_get_b(NULL, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT); - dat->secondLine.type = db_get_w(NULL, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) { + dat->secondLine.show = db_get_b(0, "CList", "SecondLineShow", SETTING_SECONDLINE_SHOW_DEFAULT); + dat->secondLine.top_space = db_get_w(0, "CList", "SecondLineTopSpace", SETTING_SECONDLINE_TOPSPACE_DEFAULT); + dat->secondLine.draw_smileys = db_get_b(0, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT); + dat->secondLine.type = db_get_w(0, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT); - ptrW tszLineText(db_get_wsa(NULL, "CList", "SecondLineText")); + ptrW tszLineText(db_get_wsa(0, "CList", "SecondLineText")); if (tszLineText) mir_wstrncpy(dat->secondLine.text, tszLineText, _countof(dat->secondLine.text)); else dat->secondLine.text[0] = '\0'; - dat->secondLine.xstatus_has_priority = db_get_b(NULL, "CList", "SecondLineXStatusHasPriority", SETTING_SECONDLINE_XSTATUS_DEFAULT); - dat->secondLine.show_status_if_no_away = db_get_b(NULL, "CList", "SecondLineShowStatusIfNoAway", SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT); - dat->secondLine.show_listening_if_no_away = db_get_b(NULL, "CList", "SecondLineShowListeningIfNoAway", SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT); - dat->secondLine.use_name_and_message_for_xstatus = db_get_b(NULL, "CList", "SecondLineUseNameAndMessageForXStatus", SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT); + dat->secondLine.xstatus_has_priority = db_get_b(0, "CList", "SecondLineXStatusHasPriority", SETTING_SECONDLINE_XSTATUS_DEFAULT); + dat->secondLine.show_status_if_no_away = db_get_b(0, "CList", "SecondLineShowStatusIfNoAway", SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT); + dat->secondLine.show_listening_if_no_away = db_get_b(0, "CList", "SecondLineShowListeningIfNoAway", SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT); + dat->secondLine.use_name_and_message_for_xstatus = db_get_b(0, "CList", "SecondLineUseNameAndMessageForXStatus", SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT); } else memset(&dat->secondLine, 0, sizeof(dat->secondLine)); // Third line - if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { - dat->thirdLine.show = db_get_b(NULL, "CList", "ThirdLineShow", SETTING_THIRDLINE_SHOW_DEFAULT); - dat->thirdLine.top_space = db_get_w(NULL, "CList", "ThirdLineTopSpace", SETTING_THIRDLINE_TOPSPACE_DEFAULT); - dat->thirdLine.draw_smileys = db_get_b(NULL, "CList", "ThirdLineDrawSmileys", SETTING_THIRDLINE_SMILEYS_DEFAULT); - dat->thirdLine.type = db_get_w(NULL, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT); + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == nullptr) { + dat->thirdLine.show = db_get_b(0, "CList", "ThirdLineShow", SETTING_THIRDLINE_SHOW_DEFAULT); + dat->thirdLine.top_space = db_get_w(0, "CList", "ThirdLineTopSpace", SETTING_THIRDLINE_TOPSPACE_DEFAULT); + dat->thirdLine.draw_smileys = db_get_b(0, "CList", "ThirdLineDrawSmileys", SETTING_THIRDLINE_SMILEYS_DEFAULT); + dat->thirdLine.type = db_get_w(0, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT); - ptrW tszLineText(db_get_wsa(NULL, "CList", "ThirdLineText")); + ptrW tszLineText(db_get_wsa(0, "CList", "ThirdLineText")); if (tszLineText) mir_wstrncpy(dat->thirdLine.text, tszLineText, _countof(dat->thirdLine.text)); else dat->thirdLine.text[0] = '\0'; - dat->thirdLine.xstatus_has_priority = db_get_b(NULL, "CList", "ThirdLineXStatusHasPriority", SETTING_THIRDLINE_XSTATUS_DEFAULT); - dat->thirdLine.show_status_if_no_away = db_get_b(NULL, "CList", "ThirdLineShowStatusIfNoAway", SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT); - dat->thirdLine.show_listening_if_no_away = db_get_b(NULL, "CList", "ThirdLineShowListeningIfNoAway", SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT); - dat->thirdLine.use_name_and_message_for_xstatus = db_get_b(NULL, "CList", "ThirdLineUseNameAndMessageForXStatus", SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT); + dat->thirdLine.xstatus_has_priority = db_get_b(0, "CList", "ThirdLineXStatusHasPriority", SETTING_THIRDLINE_XSTATUS_DEFAULT); + dat->thirdLine.show_status_if_no_away = db_get_b(0, "CList", "ThirdLineShowStatusIfNoAway", SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT); + dat->thirdLine.show_listening_if_no_away = db_get_b(0, "CList", "ThirdLineShowListeningIfNoAway", SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT); + dat->thirdLine.use_name_and_message_for_xstatus = db_get_b(0, "CList", "ThirdLineUseNameAndMessageForXStatus", SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT); } else memset(&dat->thirdLine, 0, sizeof(dat->thirdLine)); - dat->rightMargin = db_get_b(NULL, "CLC", "RightMargin", CLCDEFAULT_RIGHTMARGIN); + dat->rightMargin = db_get_b(0, "CLC", "RightMargin", CLCDEFAULT_RIGHTMARGIN); dat->bForceInDialog = (pcli->hwndContactTree) ? (hwnd != pcli->hwndContactTree) : 0; - dat->subIndent = db_get_b(NULL, "CLC", "SubIndent", CLCDEFAULT_GROUPINDENT); + dat->subIndent = db_get_b(0, "CLC", "SubIndent", CLCDEFAULT_GROUPINDENT); - if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } - if (dat->hMenuBackground) { DeleteObject(dat->hMenuBackground); dat->hMenuBackground = NULL; } + if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = nullptr; } + if (dat->hMenuBackground) { DeleteObject(dat->hMenuBackground); dat->hMenuBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { dat->MenuBkColor = cliGetColor("Menu", "BkColour", CLCDEFAULT_BKCOLOUR); @@ -607,43 +607,43 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->MenuTextColor = cliGetColor("Menu", "TextColour", CLCDEFAULT_TEXTCOLOUR); dat->MenuTextHiColor = cliGetColor("Menu", "SelTextColour", CLCDEFAULT_MODERN_SELTEXTCOLOUR); - if (db_get_b(NULL, "Menu", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmap(db_get_wsa(NULL, "Menu", "BkBitmap")); - if (tszBitmap != NULL) + if (db_get_b(0, "Menu", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmap(db_get_wsa(0, "Menu", "BkBitmap")); + if (tszBitmap != nullptr) dat->hMenuBackground = Bitmap_Load(tszBitmap); } - dat->MenuBmpUse = db_get_w(NULL, "Menu", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + dat->MenuBmpUse = db_get_w(0, "Menu", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } - dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_MANUALUPDATE)) && db_get_b(NULL, META_PROTO, "Enabled", 1); + dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_MANUALUPDATE)) && db_get_b(0, META_PROTO, "Enabled", 1); - if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree) - dat->bMetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT) != 0; + if (pcli->hwndContactTree == nullptr || dat->hWnd == pcli->hwndContactTree) + dat->bMetaIgnoreEmptyExtra = db_get_b(0, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT) != 0; else dat->bMetaIgnoreEmptyExtra = false; - dat->bMetaExpanding = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; + dat->bMetaExpanding = db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; - dat->bPlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; - dat->drawOverlayedStatus = db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); + dat->bPlaceOfflineToRoot = db_get_b(0, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; + dat->drawOverlayedStatus = db_get_b(0, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); - dat->dbbMetaHideExtra = db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT); - dat->dbbBlendInActiveState = db_get_b(NULL, "CLC", "BlendInActiveState", SETTING_BLENDINACTIVESTATE_DEFAULT); - dat->dbbBlend25 = db_get_b(NULL, "CLC", "Blend25%", SETTING_BLENDINACTIVESTATE_DEFAULT); - dat->bCompactMode = db_get_b(NULL, "CLC", "CompactMode", SETTING_COMPACTMODE_DEFAULT); + dat->dbbMetaHideExtra = db_get_b(0, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT); + dat->dbbBlendInActiveState = db_get_b(0, "CLC", "BlendInActiveState", SETTING_BLENDINACTIVESTATE_DEFAULT); + dat->dbbBlend25 = db_get_b(0, "CLC", "Blend25%", SETTING_BLENDINACTIVESTATE_DEFAULT); + dat->bCompactMode = db_get_b(0, "CLC", "CompactMode", SETTING_COMPACTMODE_DEFAULT); corecli.pfnLoadClcOptions(hwnd, dat, bFirst); - dat->selTextColour = db_get_dw(NULL, "CLC", "SelTextColour", CLCDEFAULT_MODERN_SELTEXTCOLOUR); - dat->hotTextColour = db_get_dw(NULL, "CLC", "HotTextColour", CLCDEFAULT_MODERN_HOTTEXTCOLOUR); - dat->quickSearchColour = db_get_dw(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR); + dat->selTextColour = db_get_dw(0, "CLC", "SelTextColour", CLCDEFAULT_MODERN_SELTEXTCOLOUR); + dat->hotTextColour = db_get_dw(0, "CLC", "HotTextColour", CLCDEFAULT_MODERN_HOTTEXTCOLOUR); + dat->quickSearchColour = db_get_dw(0, "CLC", "QuickSearchColour", CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR); dat->bUseWindowsColours = false; // because it's missing in the options } int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat) { KillTimer(hwnd, TIMERID_SUBEXPAND); - if (contact->type != CLCIT_CONTACT || contact->iSubAllocated == 0 || contact->bSubExpanded || !db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT)) + if (contact->type != CLCIT_CONTACT || contact->iSubAllocated == 0 || contact->bSubExpanded || !db_get_b(0, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT)) return 0; contact->bSubExpanded = true; @@ -663,7 +663,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -675,7 +675,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) if (dat->bFilterSearch) { wchar_t *lowered_szText = CharLowerW(NEWWSTR_ALLOCA(cc->szText)); wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text)); - found = wcsstr(lowered_szText, lowered_text) != NULL; + found = wcsstr(lowered_szText, lowered_text) != nullptr; } else found = (prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText)); @@ -706,7 +706,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) if (dat->bFilterSearch) { wchar_t *lowered_szText = CharLowerW(NEWWSTR_ALLOCA(ccSub.szText)); wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text)); - found = wcsstr(lowered_szText, lowered_text) != NULL; + found = wcsstr(lowered_szText, lowered_text) != nullptr; } else found = (prefixOk && !wcsnicmp(text, ccSub.szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, ccSub.szText)); diff --git a/plugins/Clist_modern/src/modern_clist.h b/plugins/Clist_modern/src/modern_clist.h index c0348f6aff..f8774fb3d0 100644 --- a/plugins/Clist_modern/src/modern_clist.h +++ b/plugins/Clist_modern/src/modern_clist.h @@ -39,7 +39,7 @@ public: SortedList* plText; int iMaxSmileyHeight; - CSmileyString() : plText(NULL), iMaxSmileyHeight(0) {}; + CSmileyString() : plText(nullptr), iMaxSmileyHeight(0) {}; CSmileyString(const CSmileyString& ssIn) { _CopySmileyList(ssIn.plText); diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index c9e9a7702a..d7f95d0bfa 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /**************************************************/ /* Declarations */ -static HANDLE hNotifyFrame = NULL; +static HANDLE hNotifyFrame = nullptr; /**************************************************/ @@ -61,7 +61,7 @@ static CLISTEVENT* MyGetEvent(int iSelection) if (p.menuId == iSelection) return &p; } - return NULL; + return nullptr; } static void EventArea_HideShowNotifyFrame() @@ -89,8 +89,8 @@ static void EventArea_HideShowNotifyFrame() CListEvent* cli_AddEvent(CLISTEVENT *cle) { CListEvent *p = corecli.pfnAddEvent(cle); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; if (p->hContact != 0 && p->hDbEvent != 1 && !(p->flags & CLEF_ONLYAFEW)) { MENUITEMINFO mii = { 0 }; @@ -144,14 +144,14 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) } if (pcli->events->getCount() > 0) { - g_CluiData.bEventAreaEnabled = TRUE; - if (g_CluiData.bNotifyActive == FALSE) { - g_CluiData.bNotifyActive = TRUE; + g_CluiData.bEventAreaEnabled = true; + if (g_CluiData.bNotifyActive == false) { + g_CluiData.bNotifyActive = true; EventArea_HideShowNotifyFrame(); } } - cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); + cliInvalidateRect(g_CluiData.hwndEventFrame, nullptr, FALSE); return p; } @@ -188,13 +188,13 @@ int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) int res = corecli.pfnRemoveEvent(hContact, hDbEvent); if (pcli->events->getCount() == 0) { - g_CluiData.bNotifyActive = FALSE; + g_CluiData.bNotifyActive = false; EventArea_HideShowNotifyFrame(); } if (hContact == g_CluiData.hUpdateContact || (INT_PTR)hDbEvent == 1) g_CluiData.hUpdateContact = 0; - cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); + cliInvalidateRect(g_CluiData.hwndEventFrame, nullptr, FALSE); return res; } @@ -209,7 +209,7 @@ struct event_area_t int backgroundBmpUse; event_area_t() : - hBmpBackground(NULL), + hBmpBackground(nullptr), bkColour(CLCDEFAULT_BKCOLOUR), useWinColors(CLCDEFAULT_USEWINDOWSCOLOURS), backgroundBmpUse(CLCDEFAULT_USEBITMAP) @@ -243,18 +243,18 @@ static int ehhEventAreaBackgroundSettingsChanged(WPARAM, LPARAM) { if (event_area.hBmpBackground) { DeleteObject(event_area.hBmpBackground); - event_area.hBmpBackground = NULL; + event_area.hBmpBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { event_area.bkColour = cliGetColor("EventArea", "BkColour", CLCDEFAULT_BKCOLOUR); - if (db_get_b(NULL, "EventArea", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmap(db_get_wsa(NULL, "EventArea", "BkBitmap")); - if (tszBitmap != NULL) + if (db_get_b(0, "EventArea", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmap(db_get_wsa(0, "EventArea", "BkBitmap")); + if (tszBitmap != nullptr) event_area.hBmpBackground = Bitmap_Load(tszBitmap); } - event_area.useWinColors = db_get_b(NULL, "EventArea", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - event_area.backgroundBmpUse = db_get_w(NULL, "EventArea", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + event_area.useWinColors = db_get_b(0, "EventArea", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + event_area.backgroundBmpUse = db_get_w(0, "EventArea", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); return 0; @@ -265,15 +265,15 @@ void EventArea_ConfigureEventArea() int iCount = pcli->events->getCount(); g_CluiData.dwFlags &= ~(CLUI_FRAME_AUTOHIDENOTIFY | CLUI_FRAME_SHOWALWAYS); - if (db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 1) g_CluiData.dwFlags |= CLUI_FRAME_AUTOHIDENOTIFY; - if (db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 2) g_CluiData.dwFlags |= CLUI_FRAME_SHOWALWAYS; + if (db_get_b(0, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 1) g_CluiData.dwFlags |= CLUI_FRAME_AUTOHIDENOTIFY; + if (db_get_b(0, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 2) g_CluiData.dwFlags |= CLUI_FRAME_SHOWALWAYS; if (g_CluiData.dwFlags & CLUI_FRAME_SHOWALWAYS) - g_CluiData.bNotifyActive = 1; + g_CluiData.bNotifyActive = true; else if (g_CluiData.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) - g_CluiData.bNotifyActive = iCount > 0 ? 1 : 0; + g_CluiData.bNotifyActive = iCount > 0; else - g_CluiData.bNotifyActive = 0; + g_CluiData.bNotifyActive = false; EventArea_HideShowNotifyFrame(); } @@ -290,7 +290,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC) else SkinDrawGlyph(hDC, &rc, &rc, "Main,ID=EventArea"); - HFONT hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_EVENTAREA, NULL); + HFONT hOldFont = g_clcPainter.ChangeToFont(hDC, nullptr, FONTID_EVENTAREA, nullptr); SetBkMode(hDC, TRANSPARENT); int iCount = GetMenuItemCount(g_CluiData.hMenuNotify); @@ -337,7 +337,7 @@ static int EventArea_Draw(HWND hwnd, HDC hDC) if (GetParent(hwnd) == pcli->hwndContactList) return EventArea_DrawWorker(hwnd, hDC); - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return 0; } @@ -401,7 +401,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP int iSelection; if (GetMenuItemCount(g_CluiData.hMenuNotify) > 1) - iSelection = TrackPopupMenu(g_CluiData.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + iSelection = TrackPopupMenu(g_CluiData.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); else iSelection = GetMenuItemID(g_CluiData.hMenuNotify, 0); BOOL result = GetMenuItemInfo(g_CluiData.hMenuNotify, (UINT)iSelection, FALSE, &mii); @@ -410,12 +410,12 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP if (nmi) { CLISTEVENT *cle = MyGetEvent(iSelection); if (cle) { - CLISTEVENT *cle1 = NULL; - CallService(cle->pszService, (WPARAM)NULL, (LPARAM)cle); + CLISTEVENT *cle1 = nullptr; + CallService(cle->pszService, (WPARAM)nullptr, (LPARAM)cle); // re-obtain the pointer, it may already be invalid/point to another event if the // event we're interested in was removed by the service (nasty one...) cle1 = MyGetEvent(iSelection); - if (cle1 != NULL) + if (cle1 != nullptr) pcli->pfnRemoveEvent(cle->hContact, cle->hDbEvent); } } @@ -426,7 +426,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP case WM_SIZE: if (!g_CluiData.fLayered) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); case WM_ERASEBKGND: @@ -453,7 +453,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP DeleteDC(hdc2); SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); ReleaseDC(hwnd, hdc); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); } else { RECT rc; @@ -496,22 +496,22 @@ int EventArea_Create(HWND hCluiWnd) wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hIcon = nullptr; + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); - wndclass.lpszMenuName = NULL; + wndclass.lpszMenuName = nullptr; wndclass.lpszClassName = pluginname; RegisterClass(&wndclass); } g_CluiData.hwndEventFrame = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, - 0, 0, 0, h, hCluiWnd, NULL, g_hInst, NULL); + 0, 0, 0, h, hCluiWnd, nullptr, g_hInst, nullptr); // register frame CLISTFrame Frame = { sizeof(Frame) }; Frame.hWnd = g_CluiData.hwndEventFrame; Frame.align = alBottom; Frame.hIcon = Skin_LoadIcon(SKINICON_OTHER_FRAME); - Frame.Flags = (db_get_b(NULL, "CLUI", "ShowEventArea", SETTING_SHOWEVENTAREAFRAME_DEFAULT) ? F_VISIBLE : 0) | F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE; + Frame.Flags = (db_get_b(0, "CLUI", "ShowEventArea", SETTING_SHOWEVENTAREAFRAME_DEFAULT) ? F_VISIBLE : 0) | F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE; Frame.height = h; Frame.tname = L"EventArea"; //do not translate Frame.TBtname = TranslateT("Event area"); diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 4c548dbe2d..4148a30712 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -69,7 +69,7 @@ static wchar_t *rates[] = { LPGENW("High") }; -static HGENMENU hFavoriteContactMenu = NULL, hShowIfOflineItem = NULL; +static HGENMENU hFavoriteContactMenu = nullptr, hShowIfOflineItem = nullptr; static HGENMENU hFavoriteContactMenuItems[_countof(rates)]; static IconItem iconList[] = @@ -142,7 +142,7 @@ int LoadFavoriteContactMenu() Menu_ConfigureItem(hFavoriteContactMenuItems[i], MCI_OPT_EXECPARAM, i); } - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE; mi.position = -100000000; mi.name.w = LPGENW("Show even if offline"); @@ -153,6 +153,6 @@ int LoadFavoriteContactMenu() int UnloadFavoriteContactMenu() { - Menu_RemoveItem(hFavoriteContactMenu); hFavoriteContactMenu = NULL; + Menu_RemoveItem(hFavoriteContactMenu); hFavoriteContactMenu = nullptr; return 0; } diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index f9a943b72c..e9d6901940 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -49,8 +49,8 @@ INT_PTR TrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status) { // check if options is turned on - BYTE trayOption = db_get_b(NULL, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT); - if ((trayOption & 3) && szProto != NULL) { + BYTE trayOption = db_get_b(0, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT); + if ((trayOption & 3) && szProto != nullptr) { if (ProtoServiceExists(szProto, PS_GETCUSTOMSTATUSICON)) { // check status is online if (status > ID_STATUS_OFFLINE) { @@ -81,7 +81,7 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact) char *szActProto = (char*)szProto; int nActStatus = nStatus; MCONTACT hActContact = hContact; - if (!db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) { + if (!db_get_b(0, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) { // substitute params by mostonline contact datas MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact); if (hMostOnlineContact) { @@ -100,7 +100,7 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact) if (result == -1 || !(LOWORD(result))) { //Get normal Icon - int basicIcon = corecli.pfnIconFromStatusMode(szActProto, nActStatus, NULL); + int basicIcon = corecli.pfnIconFromStatusMode(szActProto, nActStatus, 0); if (result != -1 && basicIcon != 1) result |= basicIcon; else @@ -109,7 +109,7 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact) return result; } - return corecli.pfnIconFromStatusMode(szProto, nStatus, NULL); + return corecli.pfnIconFromStatusMode(szProto, nStatus, 0); } int cli_GetContactIcon(MCONTACT hContact) @@ -122,7 +122,7 @@ int cli_GetContactIcon(MCONTACT hContact) int GetContactIconC(ClcCacheEntry *p) { - return pcli->pfnIconFromStatusMode(p->m_pszProto, p->m_pszProto == NULL ? ID_STATUS_OFFLINE : p->m_iStatus, p->hContact); + return pcli->pfnIconFromStatusMode(p->m_pszProto, p->m_pszProto == nullptr ? ID_STATUS_OFFLINE : p->m_iStatus, p->hContact); } //lParam @@ -196,7 +196,7 @@ __inline DWORD GetDIBPixelColor(int X, int Y, int Width, int Height, int ByteWid int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { - if (hWnd == NULL) { + if (hWnd == nullptr) { SetLastError(0x00000006); // Wrong handle return -1; } @@ -204,7 +204,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (IsIconic(hWnd) || !IsWindowVisible(hWnd)) return GWVS_HIDDEN; - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT) || !db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) + if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT) || !db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) return GWVS_VISIBLE; HWND hwndFocused = GetFocus(); @@ -218,8 +218,8 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) int maxx = 0; int maxy = 0; int wx = 0; - BYTE *ptr = NULL; - HRGN rgn = NULL; + BYTE *ptr = nullptr; + HRGN rgn = nullptr; HBITMAP WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : 0; if (WindowImage && g_CluiData.fLayered) { BITMAP bmp; @@ -277,7 +277,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (po || (!rgn && ptr == 0)) { BOOL hWndFound = FALSE; - HWND hAuxOld = NULL; + HWND hAuxOld = nullptr; HWND hAux = WindowFromPoint(pt); do { if (hAux == hWnd) { @@ -295,7 +295,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) break; } } - } while (hAux != NULL && hAuxOld != hAux); + } while (hAux != nullptr && hAuxOld != hAux); if (hWndFound) // There's window! iNotCoveredDots++; // Let's count the not covered dots. @@ -323,9 +323,9 @@ int cliShowHide(bool bAlwaysShow) BOOL bShow = FALSE; int iVisibleState = GetWindowVisibleState(pcli->hwndContactList, 0, 0); - int method = db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT); //(0-none, 1-leftedge, 2-rightedge); + int method = db_get_b(0, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT); //(0-none, 1-leftedge, 2-rightedge); if (method) { - if (db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0 && !bAlwaysShow) + if (db_get_b(0, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0 && !bAlwaysShow) CLUI_HideBehindEdge(); //hide else CLUI_ShowFromBehindEdge(); @@ -334,12 +334,12 @@ int cliShowHide(bool bAlwaysShow) iVisibleState = GWVS_HIDDEN; } - if (!method && db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) > 0) { - g_CluiData.bBehindEdgeSettings = db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT); + if (!method && db_get_b(0, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) > 0) { + g_CluiData.bBehindEdgeSettings = db_get_b(0, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT); CLUI_ShowFromBehindEdge(); g_CluiData.bBehindEdgeSettings = 0; g_CluiData.nBehindEdgeState = 0; - db_unset(NULL, "ModernData", "BehindEdge"); + db_unset(0, "ModernData", "BehindEdge"); } // bShow is FALSE when we enter the switch if no hide behind edge. @@ -360,11 +360,11 @@ int cliShowHide(bool bAlwaysShow) Sync(CLUIFrames_ActivateSubContainers, TRUE); CLUI_ShowWindowMod(pcli->hwndContactList, SW_RESTORE); - if (!db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + if (!db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { Sync(CLUIFrames_OnShowHide, 1); //TO BE PROXIED SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); g_bCalledFromShowHide = 1; - if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) + if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); g_bCalledFromShowHide = 0; } @@ -373,7 +373,7 @@ int cliShowHide(bool bAlwaysShow) Sync(CLUIFrames_OnShowHide, 1); SetForegroundWindow(pcli->hwndContactList); } - db_set_b(NULL, "CList", "State", SETTING_STATE_NORMAL); + db_set_b(0, "CList", "State", SETTING_STATE_NORMAL); RECT rcWindow; GetWindowRect(pcli->hwndContactList, &rcWindow); @@ -384,15 +384,15 @@ int cliShowHide(bool bAlwaysShow) else { // It needs to be hidden if (GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) { CListMod_HideWindow(); - db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); + db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN); } - else if (db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) { + else if (db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) { CLUI_ShowWindowMod(pcli->hwndContactList, SW_HIDE); - db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); + db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN); } else { CLUI_ShowWindowMod(pcli->hwndContactList, SW_MINIMIZE); - db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); + db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED); } SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 2bca057cec..0c54ddf98c 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -31,25 +31,25 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_MIN_ROW_HEIGHT), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "MinRowHeight", CLCDEFAULT_ROWHEIGHT), 0)); + SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "MinRowHeight", CLCDEFAULT_ROWHEIGHT), 0)); SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ROW_BORDER), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "RowBorder", SETTING_ROWBORDER_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "RowBorder", SETTING_ROWBORDER_DEFAULT), 0)); - CheckDlgButton(hwndDlg, IDC_VARIABLE_ROW_HEIGHT, db_get_b(NULL, "CList", "VariableRowHeight", SETTING_VARIABLEROWHEIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALIGN_TO_LEFT, db_get_b(NULL, "CList", "AlignLeftItemsToLeft", SETTING_ALIGNLEFTTOLEFT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALIGN_TO_RIGHT, db_get_b(NULL, "CList", "AlignRightItemsToRight", SETTING_ALIGNRIGHTORIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_VARIABLE_ROW_HEIGHT, db_get_b(0, "CList", "VariableRowHeight", SETTING_VARIABLEROWHEIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALIGN_TO_LEFT, db_get_b(0, "CList", "AlignLeftItemsToLeft", SETTING_ALIGNLEFTTOLEFT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALIGN_TO_RIGHT, db_get_b(0, "CList", "AlignRightItemsToRight", SETTING_ALIGNRIGHTORIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MINIMODE, db_get_b(NULL, "CLC", "CompactMode", SETTING_COMPACTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MINIMODE, db_get_b(0, "CLC", "CompactMode", SETTING_COMPACTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_LEFTMARGIN), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0)); - SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0)); + SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(0, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0)); SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_RIGHTMARGIN), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0)); - SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "CLC", "RightMargin", CLCDEFAULT_RIGHTMARGIN), 0)); + SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(0, "CLC", "RightMargin", CLCDEFAULT_RIGHTMARGIN), 0)); // Listbox { @@ -60,7 +60,7 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam int pos = 0; mir_snprintf(tmp, "RowPos%d", i); - type = db_get_w(NULL, "CList", tmp, i); + type = db_get_w(0, "CList", tmp, i); switch (type) { case ITEM_AVATAR: @@ -192,20 +192,20 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_w(NULL, "CList", "MinRowHeight", (WORD)SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, "CList", "RowBorder", (WORD)SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "VariableRowHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_VARIABLE_ROW_HEIGHT)); - db_set_b(NULL, "CList", "AlignLeftItemsToLeft", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_TO_LEFT)); - db_set_b(NULL, "CList", "AlignRightItemsToRight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_TO_RIGHT)); - db_set_b(NULL, "CLC", "CompactMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MINIMODE)); - db_set_b(NULL, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "RightMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, "CList", "MinRowHeight", (WORD)SendDlgItemMessage(hwndDlg, IDC_MIN_ROW_HEIGHT_SPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, "CList", "RowBorder", (WORD)SendDlgItemMessage(hwndDlg, IDC_ROW_BORDER_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "VariableRowHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_VARIABLE_ROW_HEIGHT)); + db_set_b(0, "CList", "AlignLeftItemsToLeft", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_TO_LEFT)); + db_set_b(0, "CList", "AlignRightItemsToRight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_TO_RIGHT)); + db_set_b(0, "CLC", "CompactMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MINIMODE)); + db_set_b(0, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLC", "RightMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0)); { HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST_ORDER); for (int i = 0; i < NUM_ITEM_TYPE; i++) { char tmp[128]; mir_snprintf(tmp, "RowPos%d", i); - db_set_w(NULL, "CList", tmp, (WORD)SendMessage(hwndList, LB_GETITEMDATA, i, 0)); + db_set_w(0, "CList", tmp, (WORD)SendMessage(hwndList, LB_GETITEMDATA, i, 0)); } } @@ -224,16 +224,16 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", BST_CHECKED)); - CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, db_get_b(NULL, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AVATAR_IGNORE_SIZE, db_get_b(NULL, "CList", "AvatarsIgnoreSizeForRow", SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AVATAR_OVERLAY_ICONS, db_get_b(NULL, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - - switch (db_get_b(NULL, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT)) { + CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(0, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(0, "CList", "AvatarsAnimated", BST_CHECKED)); + CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(0, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(0, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(0, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, db_get_b(0, "CList", "AvatarsUseCustomCornerSize", SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AVATAR_IGNORE_SIZE, db_get_b(0, "CList", "AvatarsIgnoreSizeForRow", SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AVATAR_OVERLAY_ICONS, db_get_b(0, "CList", "AvatarsDrawOverlay", SETTINGS_AVATARDRAWOVERLAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + + switch (db_get_b(0, "CList", "AvatarsOverlayType", SETTINGS_AVATAROVERLAYTYPE_DEFAULT)) { case SETTING_AVATAR_OVERLAY_TYPE_NORMAL: CheckDlgButton(hwndDlg, IDC_AVATAR_OVERLAY_ICON_NORMAL, BST_CHECKED); break; @@ -247,17 +247,17 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_AVATAR_SIZE), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 1)); - SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "AvatarsSize", SETTING_AVATARHEIGHT_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "AvatarsSize", SETTING_AVATARHEIGHT_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_AVATAR_WIDTH), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "AvatarsWidth", SETTING_AVATARWIDTH_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "AvatarsWidth", SETTING_AVATARWIDTH_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 1)); - SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "AvatarsCustomCornerSize", SETTINGS_AVATARCORNERSIZE_DEFAULT), 0)); - SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_SETCOLOUR, 0, (COLORREF)db_get_dw(NULL, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_SETCOLOUR, 0, (COLORREF)db_get_dw(0, "CList", "AvatarsBorderColor", SETTINGS_AVATARBORDERCOLOR_DEFAULT)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOW_AVATARS)) { EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_DRAW_BORDER), FALSE); @@ -375,26 +375,26 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "AvatarsShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_AVATARS)); - db_set_b(NULL, "CList", "AvatarsAnimated", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ANIAVATARS)); - db_set_b(NULL, "CList", "AvatarsInSeparateWnd", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_FASTDRAW)); - - db_set_b(NULL, "CList", "AvatarsDrawBorders", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_DRAW_BORDER)); - db_set_dw(NULL, "CList", "AvatarsBorderColor", (DWORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_GETCOLOUR, 0, 0)); - db_set_b(NULL, "CList", "AvatarsRoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS)); - db_set_b(NULL, "CList", "AvatarsIgnoreSizeForRow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_IGNORE_SIZE)); - db_set_b(NULL, "CList", "AvatarsUseCustomCornerSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); - db_set_w(NULL, "CList", "AvatarsCustomCornerSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "AvatarsDrawOverlay", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_OVERLAY_ICONS)); - db_set_w(NULL, "CList", "AvatarsSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, "CList", "AvatarsWidth", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "AvatarsShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_AVATARS)); + db_set_b(0, "CList", "AvatarsAnimated", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ANIAVATARS)); + db_set_b(0, "CList", "AvatarsInSeparateWnd", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_FASTDRAW)); + + db_set_b(0, "CList", "AvatarsDrawBorders", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_DRAW_BORDER)); + db_set_dw(0, "CList", "AvatarsBorderColor", (DWORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_GETCOLOUR, 0, 0)); + db_set_b(0, "CList", "AvatarsRoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS)); + db_set_b(0, "CList", "AvatarsIgnoreSizeForRow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_IGNORE_SIZE)); + db_set_b(0, "CList", "AvatarsUseCustomCornerSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); + db_set_w(0, "CList", "AvatarsCustomCornerSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "AvatarsDrawOverlay", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATAR_OVERLAY_ICONS)); + db_set_w(0, "CList", "AvatarsSize", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_SIZE_SPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, "CList", "AvatarsWidth", (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_WIDTH_SPIN, UDM_GETPOS, 0, 0)); if (IsDlgButtonChecked(hwndDlg, IDC_AVATAR_OVERLAY_ICON_NORMAL)) - db_set_b(NULL, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_NORMAL); + db_set_b(0, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_NORMAL); else if (IsDlgButtonChecked(hwndDlg, IDC_AVATAR_OVERLAY_ICON_PROTOCOL)) - db_set_b(NULL, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL); + db_set_b(0, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL); else if (IsDlgButtonChecked(hwndDlg, IDC_AVATAR_OVERLAY_ICON_CONTACT)) - db_set_b(NULL, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_CONTACT); + db_set_b(0, "CList", "AvatarsOverlayType", SETTING_AVATAR_OVERLAY_TYPE_CONTACT); ClcOptionsChanged(); AniAva_UpdateOptions(); return TRUE; @@ -413,14 +413,14 @@ static INT_PTR CALLBACK DlgProcItemIconOpts(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(NULL, "CList", "IconHideOnAvatar", SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE, db_get_b(NULL, "CList", "IconDrawOnAvatarSpace", SETTING_ICONONAVATARPLACE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL, "CList", "NoIconBlink", SETTING_NOICONBLINF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDE_GROUPSICON, db_get_b(NULL, "CList", "HideGroupsIcon", SETTING_HIDEGROUPSICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOTCHECKICONSIZE, db_get_b(NULL, "CList", "IconIgnoreSizeForRownHeight", SETTING_ICONIGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALWAYS_VISIBLEICON, db_get_b(NULL, "CList", "AlwaysShowAlwaysVisIcon", SETTING_ALWAYSVISICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USEXSTATUS, (db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT) & 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DRAWSTATUSOVERLAY, (db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT) & 2) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(0, "CList", "IconHideOnAvatar", SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE, db_get_b(0, "CList", "IconDrawOnAvatarSpace", SETTING_ICONONAVATARPLACE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(0, "CList", "NoIconBlink", SETTING_NOICONBLINF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDE_GROUPSICON, db_get_b(0, "CList", "HideGroupsIcon", SETTING_HIDEGROUPSICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOTCHECKICONSIZE, db_get_b(0, "CList", "IconIgnoreSizeForRownHeight", SETTING_ICONIGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYS_VISIBLEICON, db_get_b(0, "CList", "AlwaysShowAlwaysVisIcon", SETTING_ALWAYSVISICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USEXSTATUS, (db_get_b(0, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT) & 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAWSTATUSOVERLAY, (db_get_b(0, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT) & 2) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_DRAWSTATUSOVERLAY), IsDlgButtonChecked(hwndDlg, IDC_USEXSTATUS)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_HIDE_ICON_ON_AVATAR)) @@ -445,16 +445,16 @@ static INT_PTR CALLBACK DlgProcItemIconOpts(HWND hwndDlg, UINT msg, WPARAM wPara case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "IconHideOnAvatar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_ICON_ON_AVATAR)); - db_set_b(NULL, "CList", "IconDrawOnAvatarSpace", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE)); - db_set_b(NULL, "CList", "HideGroupsIcon", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_GROUPSICON)); - db_set_b(NULL, "CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); - db_set_b(NULL, "CList", "IconIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTCHECKICONSIZE)); - db_set_b(NULL, "CList", "AlwaysShowAlwaysVisIcon", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_VISIBLEICON)); + db_set_b(0, "CList", "IconHideOnAvatar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_ICON_ON_AVATAR)); + db_set_b(0, "CList", "IconDrawOnAvatarSpace", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE)); + db_set_b(0, "CList", "HideGroupsIcon", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_GROUPSICON)); + db_set_b(0, "CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); + db_set_b(0, "CList", "IconIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTCHECKICONSIZE)); + db_set_b(0, "CList", "AlwaysShowAlwaysVisIcon", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_VISIBLEICON)); { BYTE ovr = IsDlgButtonChecked(hwndDlg, IDC_USEXSTATUS) ? 1 : 0; if (ovr) ovr += IsDlgButtonChecked(hwndDlg, IDC_DRAWSTATUSOVERLAY) ? 2 : 0; - db_set_b(NULL, "CLC", "DrawOverlayedStatus", ovr); + db_set_b(0, "CLC", "DrawOverlayedStatus", ovr); } ClcOptionsChanged(); return TRUE; @@ -472,8 +472,8 @@ static INT_PTR CALLBACK DlgProcItemContactTimeOpts(HWND hwndDlg, UINT msg, WPARA switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL, "CList", "ContactTimeShow", SETTING_SHOWTIME_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT, db_get_b(NULL, "CList", "ContactTimeShowOnlyIfDifferent", SETTING_SHOWTIMEIFDIFF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(0, "CList", "ContactTimeShow", SETTING_SHOWTIME_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT, db_get_b(0, "CList", "ContactTimeShowOnlyIfDifferent", SETTING_SHOWTIMEIFDIFF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); break; case WM_COMMAND: @@ -485,8 +485,8 @@ static INT_PTR CALLBACK DlgProcItemContactTimeOpts(HWND hwndDlg, UINT msg, WPARA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "ContactTimeShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); - db_set_b(NULL, "CList", "ContactTimeShowOnlyIfDifferent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT)); + db_set_b(0, "CList", "ContactTimeShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); + db_set_b(0, "CList", "ContactTimeShowOnlyIfDifferent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT)); ClcOptionsChanged(); return TRUE; } @@ -504,24 +504,24 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_RTL, db_get_b(NULL, "CList", "TextRTL", SETTING_TEXT_RTL_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - //TODO: init IDC_ALIGNGROUPCOMBO from db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT); + CheckDlgButton(hwndDlg, IDC_RTL, db_get_b(0, "CList", "TextRTL", SETTING_TEXT_RTL_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + //TODO: init IDC_ALIGNGROUPCOMBO from db_get_b(0,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT); { int item; wchar_t *align[] = { LPGENW("Left align group names"), LPGENW("Center group names"), LPGENW("Right align group names") }; for (int i = 0; i < sizeof(align) / sizeof(char*); i++) item = SendDlgItemMessage(hwndDlg, IDC_ALIGNGROUPCOMBO, CB_ADDSTRING, 0, (LPARAM)TranslateW(align[i])); - SendDlgItemMessage(hwndDlg, IDC_ALIGNGROUPCOMBO, CB_SETCURSEL, db_get_b(NULL, "CList", "AlignGroupCaptions", SETTING_ALIGNGROPCAPTION_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_ALIGNGROUPCOMBO, CB_SETCURSEL, db_get_b(0, "CList", "AlignGroupCaptions", SETTING_ALIGNGROPCAPTION_DEFAULT), 0); } - CheckDlgButton(hwndDlg, IDC_ALIGN_RIGHT, db_get_b(NULL, "CList", "TextAlignToRight", SETTING_TEXT_RIGHTALIGN_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_REPLACE_SMILEYS, db_get_b(NULL, "CList", "TextReplaceSmileys", SETTING_TEXT_SMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_RESIZE_SMILEYS, db_get_b(NULL, "CList", "TextResizeSmileys", SETTING_TEXT_RESIZESMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USE_PROTOCOL_SMILEYS, db_get_b(NULL, "CList", "TextUseProtocolSmileys", SETTING_TEXT_PROTOSMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IGNORE_SIZE, db_get_b(NULL, "CList", "TextIgnoreSizeForRownHeight", SETTING_TEXT_IGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALIGN_RIGHT, db_get_b(0, "CList", "TextAlignToRight", SETTING_TEXT_RIGHTALIGN_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_REPLACE_SMILEYS, db_get_b(0, "CList", "TextReplaceSmileys", SETTING_TEXT_SMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RESIZE_SMILEYS, db_get_b(0, "CList", "TextResizeSmileys", SETTING_TEXT_RESIZESMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USE_PROTOCOL_SMILEYS, db_get_b(0, "CList", "TextUseProtocolSmileys", SETTING_TEXT_PROTOSMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IGNORE_SIZE, db_get_b(0, "CList", "TextIgnoreSizeForRownHeight", SETTING_TEXT_IGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE, db_get_b(NULL, "CList", "FirstLineDrawSmileys", SETTING_FIRSTLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_APPEND_NICK, db_get_b(NULL, "CList", "FirstLineAppendNick", SETTING_FIRSTLINE_APPENDNICK_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TRIM_TEXT, db_get_b(NULL, "CList", "TrimText", SETTING_FIRSTLINE_TRIMTEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE, db_get_b(0, "CList", "FirstLineDrawSmileys", SETTING_FIRSTLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_APPEND_NICK, db_get_b(0, "CList", "FirstLineAppendNick", SETTING_FIRSTLINE_APPENDNICK_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TRIM_TEXT, db_get_b(0, "CList", "TrimText", SETTING_FIRSTLINE_TRIMTEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); { bool smileAddPresent = ServiceExists(MS_SMILEYADD_BATCHPARSE) != 0; CLUI_ShowWindowMod(GetDlgItem(hwndDlg, IDC_REPLACE_SMILEYS), smileAddPresent ? SW_SHOW : SW_HIDE); @@ -550,17 +550,17 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "TextRTL", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RTL)); - //TODO: Store IDC_ALIGNGROUPCOMBO at db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT); - db_set_b(NULL, "CList", "AlignGroupCaptions", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ALIGNGROUPCOMBO, CB_GETCURSEL, 0, 0)); - db_set_b(NULL, "CList", "TextAlignToRight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_RIGHT)); - db_set_b(NULL, "CList", "TextReplaceSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS)); - db_set_b(NULL, "CList", "TextResizeSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RESIZE_SMILEYS)); - db_set_b(NULL, "CList", "TextUseProtocolSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_PROTOCOL_SMILEYS)); - db_set_b(NULL, "CList", "TextIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNORE_SIZE)); - db_set_b(NULL, "CList", "FirstLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE)); - db_set_b(NULL, "CList", "FirstLineAppendNick", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND_NICK)); - db_set_b(NULL, "CList", "TrimText", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRIM_TEXT)); + db_set_b(0, "CList", "TextRTL", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RTL)); + //TODO: Store IDC_ALIGNGROUPCOMBO at db_get_b(0,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT); + db_set_b(0, "CList", "AlignGroupCaptions", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ALIGNGROUPCOMBO, CB_GETCURSEL, 0, 0)); + db_set_b(0, "CList", "TextAlignToRight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALIGN_RIGHT)); + db_set_b(0, "CList", "TextReplaceSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS)); + db_set_b(0, "CList", "TextResizeSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RESIZE_SMILEYS)); + db_set_b(0, "CList", "TextUseProtocolSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_PROTOCOL_SMILEYS)); + db_set_b(0, "CList", "TextIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNORE_SIZE)); + db_set_b(0, "CList", "FirstLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE)); + db_set_b(0, "CList", "FirstLineAppendNick", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND_NICK)); + db_set_b(0, "CList", "TrimText", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRIM_TEXT)); ClcOptionsChanged(); return TRUE; } @@ -576,21 +576,21 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL, "CList", "SecondLineShow", SETTING_SECONDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(0, "CList", "SecondLineShow", SETTING_SECONDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_TOP_SPACE), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "SecondLineTopSpace", SETTING_SECONDLINE_TOPSPACE_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "SecondLineTopSpace", SETTING_SECONDLINE_TOPSPACE_DEFAULT), 0)); - CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(0, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); { - ptrW tszText(db_get_wsa(NULL, "CList", "SecondLineText")); + ptrW tszText(db_get_wsa(0, "CList", "SecondLineText")); if (tszText) SetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, tszText); } SendDlgItemMessage(hwndDlg, IDC_VARIABLE_TEXT, EM_SETLIMITTEXT, TEXT_TEXT_MAX_LENGTH, 0); { - int radio = db_get_w(NULL, "CList", "SecondLineType", TEXT_STATUS_MESSAGE); + int radio = db_get_w(0, "CList", "SecondLineType", TEXT_STATUS_MESSAGE); CheckDlgButton(hwndDlg, IDC_STATUS, radio == TEXT_STATUS ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_NICKNAME, radio == TEXT_NICKNAME ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STATUS_MESSAGE, radio == TEXT_STATUS_MESSAGE ? BST_CHECKED : BST_UNCHECKED); @@ -598,10 +598,10 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM CheckDlgButton(hwndDlg, IDC_CONTACT_TIME, radio == TEXT_CONTACT_TIME ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_TEXT, radio == TEXT_TEXT ? BST_CHECKED : BST_UNCHECKED); } - CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(NULL, "CList", "SecondLineXStatusHasPriority", SETTING_SECONDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(NULL, "CList", "SecondLineShowStatusIfNoAway", SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(NULL, "CList", "SecondLineShowListeningIfNoAway", SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(NULL, "CList", "SecondLineUseNameAndMessageForXStatus", SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(0, "CList", "SecondLineXStatusHasPriority", SETTING_SECONDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(0, "CList", "SecondLineShowStatusIfNoAway", SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(0, "CList", "SecondLineShowListeningIfNoAway", SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(0, "CList", "SecondLineUseNameAndMessageForXStatus", SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOW)) { EnableWindow(GetDlgItem(hwndDlg, IDC_USE_PROTOCOL_SMILEYS), FALSE); @@ -697,9 +697,9 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "SecondLineShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); - db_set_w(NULL, "CList", "SecondLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "SecondLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS)); + db_set_b(0, "CList", "SecondLineShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); + db_set_w(0, "CList", "SecondLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "SecondLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS)); int radio; if (IsDlgButtonChecked(hwndDlg, IDC_STATUS)) @@ -714,17 +714,17 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM radio = TEXT_LISTENING_TO; else radio = TEXT_STATUS_MESSAGE; - db_set_w(NULL, "CList", "SecondLineType", (WORD)radio); + db_set_w(0, "CList", "SecondLineType", (WORD)radio); wchar_t t[TEXT_TEXT_MAX_LENGTH]; GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, _countof(t)); t[TEXT_TEXT_MAX_LENGTH - 1] = '\0'; - db_set_ws(NULL, "CList", "SecondLineText", t); + db_set_ws(0, "CList", "SecondLineText", t); - db_set_b(NULL, "CList", "SecondLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_XSTATUS_HAS_PRIORITY)); - db_set_b(NULL, "CList", "SecondLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY)); - db_set_b(NULL, "CList", "SecondLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY)); - db_set_b(NULL, "CList", "SecondLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_NAME_AND_MESSAGE)); + db_set_b(0, "CList", "SecondLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_XSTATUS_HAS_PRIORITY)); + db_set_b(0, "CList", "SecondLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY)); + db_set_b(0, "CList", "SecondLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY)); + db_set_b(0, "CList", "SecondLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_NAME_AND_MESSAGE)); ClcOptionsChanged(); return TRUE; } @@ -741,23 +741,23 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL, "CList", "ThirdLineShow", SETTING_THIRDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(0, "CList", "ThirdLineShow", SETTING_THIRDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_TOP_SPACE), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "ThirdLineTopSpace", SETTING_THIRDLINE_TOPSPACE_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "ThirdLineTopSpace", SETTING_THIRDLINE_TOPSPACE_DEFAULT), 0)); - CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL, "CList", "ThirdLineDrawSmileys", SETTING_THIRDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(0, "CList", "ThirdLineDrawSmileys", SETTING_THIRDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); { DBVARIANT dbv; - if (!db_get_ws(NULL, "CList", "ThirdLineText", &dbv)) { + if (!db_get_ws(0, "CList", "ThirdLineText", &dbv)) { SetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, dbv.ptszVal); db_free(&dbv); } } SendDlgItemMessage(hwndDlg, IDC_VARIABLE_TEXT, EM_SETLIMITTEXT, TEXT_TEXT_MAX_LENGTH, 0); { - int radio = db_get_w(NULL, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT); + int radio = db_get_w(0, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT); CheckDlgButton(hwndDlg, IDC_STATUS, radio == TEXT_STATUS ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_NICKNAME, radio == TEXT_NICKNAME ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STATUS_MESSAGE, radio == TEXT_STATUS_MESSAGE ? BST_CHECKED : BST_UNCHECKED); @@ -766,10 +766,10 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM CheckDlgButton(hwndDlg, IDC_TEXT, radio == TEXT_TEXT ? BST_CHECKED : BST_UNCHECKED); } - CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(NULL, "CList", "ThirdLineXStatusHasPriority", SETTING_THIRDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(NULL, "CList", "ThirdLineShowStatusIfNoAway", SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(NULL, "CList", "ThirdLineShowListeningIfNoAway", SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(NULL, "CList", "ThirdLineUseNameAndMessageForXStatus", SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(0, "CList", "ThirdLineXStatusHasPriority", SETTING_THIRDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(0, "CList", "ThirdLineShowStatusIfNoAway", SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(0, "CList", "ThirdLineShowListeningIfNoAway", SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(0, "CList", "ThirdLineUseNameAndMessageForXStatus", SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOW)) { EnableWindow(GetDlgItem(hwndDlg, IDC_USE_PROTOCOL_SMILEYS), FALSE); @@ -862,9 +862,9 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CList", "ThirdLineShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); - db_set_w(NULL, "CList", "ThirdLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "ThirdLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS)); + db_set_b(0, "CList", "ThirdLineShow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW)); + db_set_w(0, "CList", "ThirdLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg, IDC_TOP_SPACE_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CList", "ThirdLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAW_SMILEYS)); { int radio; if (IsDlgButtonChecked(hwndDlg, IDC_STATUS)) @@ -879,7 +879,7 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM radio = TEXT_LISTENING_TO; else radio = TEXT_STATUS_MESSAGE; - db_set_w(NULL, "CList", "ThirdLineType", (WORD)radio); + db_set_w(0, "CList", "ThirdLineType", (WORD)radio); } { wchar_t t[TEXT_TEXT_MAX_LENGTH]; @@ -887,13 +887,13 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, _countof(t)); t[TEXT_TEXT_MAX_LENGTH - 1] = '\0'; - db_set_ws(NULL, "CList", "ThirdLineText", t); + db_set_ws(0, "CList", "ThirdLineText", t); } - db_set_b(NULL, "CList", "ThirdLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_XSTATUS_HAS_PRIORITY)); - db_set_b(NULL, "CList", "ThirdLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_NAME_AND_MESSAGE)); - db_set_b(NULL, "CList", "ThirdLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY)); - db_set_b(NULL, "CList", "ThirdLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY)); + db_set_b(0, "CList", "ThirdLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_XSTATUS_HAS_PRIORITY)); + db_set_b(0, "CList", "ThirdLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_NAME_AND_MESSAGE)); + db_set_b(0, "CList", "ThirdLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY)); + db_set_b(0, "CList", "ThirdLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY)); ClcOptionsChanged(); return TRUE; } diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 0ea8463963..33a6105608 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void InsertContactIntoTree(MCONTACT hContact, int status); -wchar_t* UnknownConctactTranslatedName = NULL; +wchar_t* UnknownConctactTranslatedName = nullptr; void cliFreeCacheItem(ClcCacheEntry *p) { @@ -40,22 +40,22 @@ void cliFreeCacheItem(ClcCacheEntry *p) void cliCheckCacheItem(ClcCacheEntry *pdnce) { - if (pdnce == NULL) + if (pdnce == nullptr) return; - if (pdnce->hContact == NULL) { //selfcontact + if (pdnce->hContact == 0) { //selfcontact if (!pdnce->tszName) - pdnce->tszName = pcli->pfnGetContactDisplayName(NULL, GCDNF_NOCACHE); + pdnce->tszName = pcli->pfnGetContactDisplayName(0, GCDNF_NOCACHE); return; } - if (pdnce->m_pszProto == NULL) { + if (pdnce->m_pszProto == nullptr) { pdnce->m_pszProto = GetContactProto(pdnce->hContact); if (pdnce->m_pszProto && pdnce->tszName) mir_free_and_nil(pdnce->tszName); } - if (pdnce->tszName == NULL) { + if (pdnce->tszName == nullptr) { pdnce->tszName = pcli->pfnGetContactDisplayName(pdnce->hContact, GCDNF_NOCACHE); pdnce->m_bIsUnknown = !mir_wstrcmp(pdnce->tszName, UnknownConctactTranslatedName); } @@ -81,10 +81,10 @@ int GetStatusForContact(MCONTACT hContact, char *szProto) int GetContactInfosForSort(MCONTACT hContact, char **Proto, wchar_t **Name, int *Status) { ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); - if (cacheEntry != NULL) { - if (Proto != NULL) *Proto = cacheEntry->m_pszProto; - if (Name != NULL) *Name = cacheEntry->tszName; - if (Status != NULL) *Status = cacheEntry->m_iStatus; + if (cacheEntry != nullptr) { + if (Proto != nullptr) *Proto = cacheEntry->m_pszProto; + if (Name != nullptr) *Name = cacheEntry->tszName; + if (Status != nullptr) *Status = cacheEntry->m_iStatus; } return 0; } @@ -113,16 +113,16 @@ int MetaStatusChanged(WPARAM hMeta, LPARAM) int ContactSettingChanged(WPARAM hContact, LPARAM lParam) { - if (MirandaExiting() || !pcli || hContact == NULL) + if (MirandaExiting() || !pcli || !hContact) return 0; ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); - if (pdnce == NULL) { + if (pdnce == nullptr) { TRACE("!!! Very bad pdnce not found."); return 0; } - if (pdnce->m_pszProto == NULL) + if (pdnce->m_pszProto == nullptr) return 0; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; @@ -136,7 +136,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (g_CluiData.bRemoveAwayMessageForOffline) db_set_s(hContact, "CList", "StatusMsg", ""); - if ((db_get_w(NULL, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(NULL, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto) + if ((db_get_w(0, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto) amRequestAwayMsg(hContact); Clist_Broadcast(INTM_STATUSCHANGED, hContact, 0); @@ -145,7 +145,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) pcli->pfnInitAutoRebuild(pcli->hwndContactTree); - if ((db_get_w(NULL, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(NULL, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto) + if ((db_get_w(0, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto) amRequestAwayMsg(hContact); } else if (!strcmp(cws->szSetting, "ApparentMode")) @@ -184,7 +184,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) else if (!strcmp(cws->szModule, "Protocol")) { if (!strcmp(cws->szSetting, "p")) { pdnce->m_pszProto = GetContactProto(hContact); - char *szProto = (cws->value.type == DBVT_DELETED) ? NULL : cws->value.pszVal; + char *szProto = (cws->value.type == DBVT_DELETED) ? nullptr : cws->value.pszVal; pcli->pfnChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(szProto, pdnce->getStatus(), hContact)); } } diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index d3585f3891..53c1edb5b4 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -52,7 +52,7 @@ typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *); #endif BOOL g_MultiConnectionMode = FALSE; -char* g_szConnectingProto = NULL; +char* g_szConnectingProto = nullptr; int GetStatusVal(int status) { @@ -83,7 +83,7 @@ int GetStatusOrder(int currentStatus, int newStatus) INT_PTR CListTray_GetGlobalStatus(WPARAM, LPARAM) { - g_szConnectingProto = NULL; + g_szConnectingProto = nullptr; int curstatus = 0; int connectingCount = 0; @@ -127,10 +127,10 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd, UINT, UINT_PTR idEvent, DW int cliTrayIconPauseAutoHide(WPARAM, LPARAM) { - if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { + if (db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { if (GetActiveWindow() != pcli->hwndContactList && GetWindow(GetParent(GetActiveWindow()), GW_OWNER) != pcli->hwndContactList) { - KillTimer(NULL, autoHideTimerId); - autoHideTimerId = CLUI_SafeSetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); + KillTimer(nullptr, autoHideTimerId); + autoHideTimerId = CLUI_SafeSetTimer(nullptr, 0, 1000 * db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); } } @@ -150,7 +150,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break; case TIM_CALLBACK: - if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && msg->lParam == WM_LBUTTONDOWN && !db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT)) { + if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && msg->lParam == WM_LBUTTONDOWN && !db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT)) { POINT pt; HMENU hMenu = Menu_GetStatusMenu(); g_mutex_bOnTrayRightClick = 1; @@ -159,7 +159,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) SetFocus(msg->hwnd); GetCursorPos(&pt); pcli->bTrayMenuOnScreen = TRUE; - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr); PostMessage(msg->hwnd, WM_NULL, 0, 0); g_mutex_bOnTrayRightClick = 0; IS_WM_MOUSE_DOWN_IN_TRAY = 0; @@ -172,20 +172,20 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) return TRUE; case WM_ACTIVATE: - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); { HWND h1 = (HWND)msg->lParam; - HWND h2 = h1 ? GetParent(h1) : NULL; - if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { + HWND h2 = h1 ? GetParent(h1) : nullptr; + if (db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { if (LOWORD(msg->wParam) == WA_INACTIVE && h2 != pcli->hwndContactList) - autoHideTimerId = CLUI_SafeSetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); + autoHideTimerId = CLUI_SafeSetTimer(nullptr, 0, 1000 * db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); else { - KillTimer(NULL, autoHideTimerId); + KillTimer(nullptr, autoHideTimerId); autoHideTimerId = 0; } } else if (autoHideTimerId) { - KillTimer(NULL, autoHideTimerId); + KillTimer(nullptr, autoHideTimerId); autoHideTimerId = 0; } } @@ -223,47 +223,47 @@ VOID CALLBACK cliTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) void SettingsMigrate(void) { - BYTE TrayIcon = db_get_b(NULL, "CList", "TrayIcon", 0); - BYTE AlwaysPrimary = db_get_b(NULL, "CList", "AlwaysPrimary", 0); - BYTE AlwaysMulti = db_get_b(NULL, "CList", "AlwaysMulti", 0); - ptrA PrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus")); + BYTE TrayIcon = db_get_b(0, "CList", "TrayIcon", 0); + BYTE AlwaysPrimary = db_get_b(0, "CList", "AlwaysPrimary", 0); + BYTE AlwaysMulti = db_get_b(0, "CList", "AlwaysMulti", 0); + ptrA PrimaryStatus(db_get_sa(0, "CList", "PrimaryStatus")); // these strings must always be set if (PrimaryStatus) { - db_set_s(NULL, "CList", "tiAccS", PrimaryStatus); - db_set_s(NULL, "CList", "tiAccV", PrimaryStatus); + db_set_s(0, "CList", "tiAccS", PrimaryStatus); + db_set_s(0, "CList", "tiAccV", PrimaryStatus); } else { - db_set_s(NULL, "CList", "tiAccS", ""); - db_set_s(NULL, "CList", "tiAccV", ""); + db_set_s(0, "CList", "tiAccS", ""); + db_set_s(0, "CList", "tiAccV", ""); } switch (TrayIcon) { case 0: // global or single acc if (AlwaysPrimary) { if (!PrimaryStatus) { // global always - db_set_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); - db_set_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL); + db_set_b(0, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); + db_set_b(0, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL); } else { // single acc always - db_set_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_ACC); - db_set_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_ACC); + db_set_b(0, "CList", "tiModeS", TRAY_ICON_MODE_ACC); + db_set_b(0, "CList", "tiModeV", TRAY_ICON_MODE_ACC); } } else { - db_set_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); - db_set_b(NULL, "CList", "tiModeV", (PrimaryStatus) ? TRAY_ICON_MODE_ACC : TRAY_ICON_MODE_GLOBAL); + db_set_b(0, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); + db_set_b(0, "CList", "tiModeV", (PrimaryStatus) ? TRAY_ICON_MODE_ACC : TRAY_ICON_MODE_GLOBAL); } break; case 1: // cycle - db_set_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_CYCLE); - db_set_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_CYCLE); + db_set_b(0, "CList", "tiModeS", TRAY_ICON_MODE_CYCLE); + db_set_b(0, "CList", "tiModeV", TRAY_ICON_MODE_CYCLE); break; case 2: // multiple - db_set_b(NULL, "CList", "tiModeS", (AlwaysMulti) ? TRAY_ICON_MODE_ALL : TRAY_ICON_MODE_GLOBAL); - db_set_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_ALL); + db_set_b(0, "CList", "tiModeS", (AlwaysMulti) ? TRAY_ICON_MODE_ALL : TRAY_ICON_MODE_GLOBAL); + db_set_b(0, "CList", "tiModeV", TRAY_ICON_MODE_ALL); break; } } @@ -314,30 +314,30 @@ int cliTrayIconInit(HWND hwnd) if (TimerID) { - KillTimer(NULL, TimerID); + KillTimer(nullptr, TimerID); TimerID = 0; } // Ïðèñóòñòâóþò ëè â áàçå íîâûå íàñòðîéêè? Åñëè äà, òî îáíîâëåíèå íå íóæíî. - if (-1 == db_get_b(NULL, "CList", "tiModeS", -1)) + if (-1 == db_get_b(0, "CList", "tiModeS", -1)) SettingsMigrate(); // Íóæíî óçíàòü êîëè÷åñòâî ãîäíûõ àêêàóíòîâ è íåîäèíàêîâîñòü èõ ñòàòóñîâ. bool bDiffers; - pcli->trayIconCount = GetGoodAccNum(&bDiffers, NULL); + pcli->trayIconCount = GetGoodAccNum(&bDiffers, nullptr); // Åñëè òàêîâûõ àêêàóíòîâ íå íàøëîñü âîîáùå, òî áóäåì ïîêàçûâàòü îñíîâíóþ èêîíêó Ìèðàíäû. if (!pcli->trayIconCount) { pcli->trayIconCount = 1; pcli->trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * pcli->trayIconCount); - pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0)); + pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0)); OldMode = TRAY_ICON_MODE_GLOBAL; return 0; } if (!bDiffers) // all equal - OldMode = Mode = db_get_b(NULL, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); + OldMode = Mode = db_get_b(0, "CList", "tiModeS", TRAY_ICON_MODE_GLOBAL); else - OldMode = Mode = db_get_b(NULL, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL); + OldMode = Mode = db_get_b(0, "CList", "tiModeV", TRAY_ICON_MODE_GLOBAL); // Íåêîòîðûå ðåæèìû âñåãäà ïîêàçûâàþò åäèíñòâåííóþ èêîíêó. if (Mode < 8) @@ -348,29 +348,29 @@ int cliTrayIconInit(HWND hwnd) // Äîáàâëÿåì èêîíêè. switch (Mode) { case TRAY_ICON_MODE_GLOBAL: - pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0)); + pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0)); break; case TRAY_ICON_MODE_ACC: { - ptrA szProto(db_get_sa(NULL, "CList", (!bDiffers) ? "tiAccS" : "tiAccV")); + ptrA szProto(db_get_sa(0, "CList", (!bDiffers) ? "tiAccS" : "tiAccV")); if (!szProto) break; PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (!pa || !pa->ppro) - pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0)); + pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0)); else - pcli->pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, pa->ppro->m_iStatus); + pcli->pfnTrayIconAdd(hwnd, pa->szModuleName, nullptr, pa->ppro->m_iStatus); } break; case TRAY_ICON_MODE_CYCLE: - pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0)); + pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0)); pcli->cycleStep = 0; cliTrayCycleTimerProc(0, 0, 0, 0); // force icon update // Íå ñîõðàíÿåì ID òàéìåðà â pcli, ÷òîáû fnTrayIconUpdateBase íå óáèâàëà åãî. - TimerID = CLUI_SafeSetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cliTrayCycleTimerProc); + TimerID = CLUI_SafeSetTimer(nullptr, 0, db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cliTrayCycleTimerProc); break; case TRAY_ICON_MODE_ALL: @@ -380,7 +380,7 @@ int cliTrayIconInit(HWND hwnd) for (i = AccNum; i--;) { if (!acc[i]->bIsVirtual && acc[i]->bIsVisible && !acc[i]->bDynDisabled && acc[i]->ppro) - pcli->pfnTrayIconAdd(hwnd, acc[i]->szModuleName, NULL, acc[i]->ppro->m_iStatus); + pcli->pfnTrayIconAdd(hwnd, acc[i]->szModuleName, nullptr, acc[i]->ppro->m_iStatus); } break; } @@ -403,19 +403,19 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) GetGoodAccNum(&bDiffers, &bConn); // if the icon number to be changed, reinitialize module from scratch - BYTE Mode = db_get_b(NULL, "CList", (!bDiffers) ? "tiModeS" : "tiModeV", TRAY_ICON_MODE_GLOBAL); + BYTE Mode = db_get_b(0, "CList", (!bDiffers) ? "tiModeS" : "tiModeV", TRAY_ICON_MODE_GLOBAL); if (Mode != OldMode) { OldMode = Mode; pcli->pfnTrayIconIconsChanged(); } - HICON hIcon = NULL; + HICON hIcon = nullptr; int i = 0, iStatus; switch (Mode) { case TRAY_ICON_MODE_GLOBAL: - hIcon = pcli->pfnGetIconFromStatusMode(NULL, NULL, CListTray_GetGlobalStatus(0, 0)); - pcli->pfnTrayIconMakeTooltip(NULL, NULL); + hIcon = pcli->pfnGetIconFromStatusMode(0, nullptr, CListTray_GetGlobalStatus(0, 0)); + pcli->pfnTrayIconMakeTooltip(nullptr, nullptr); break; case TRAY_ICON_MODE_ACC: @@ -429,9 +429,9 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus)) hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szProto, 0); else - hIcon = pcli->pfnGetIconFromStatusMode(NULL, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0)); + hIcon = pcli->pfnGetIconFromStatusMode(0, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0)); - pcli->pfnTrayIconMakeTooltip(NULL, szProto); + pcli->pfnTrayIconMakeTooltip(nullptr, szProto); } break; @@ -440,8 +440,8 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus)) hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0); else if (!bConn) - hIcon = pcli->pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)); - pcli->pfnTrayIconMakeTooltip(NULL, NULL); + hIcon = pcli->pfnGetIconFromStatusMode(0, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)); + pcli->pfnTrayIconMakeTooltip(nullptr, nullptr); break; case TRAY_ICON_MODE_ALL: @@ -454,8 +454,8 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus)) hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0); else - hIcon = pcli->pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)); - pcli->pfnTrayIconMakeTooltip(NULL, pcli->trayIcon[i].szProto); + hIcon = pcli->pfnGetIconFromStatusMode(0, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)); + pcli->pfnTrayIconMakeTooltip(nullptr, pcli->trayIcon[i].szProto); break; } @@ -471,7 +471,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) nid.uFlags = NIF_ICON | NIF_TIP; // if Tipper is missing or turned off for tray, use system tooltips - if (!ServiceExists("mToolTip/ShowTip") || !db_get_b(NULL, "Tipper", "TrayTip", 1)) + if (!ServiceExists("mToolTip/ShowTip") || !db_get_b(0, "Tipper", "TrayTip", 1)) mir_wstrncpy(nid.szTip, pcli->szTip, _countof(nid.szTip)); Shell_NotifyIcon(NIM_MODIFY, &nid); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index d78428fc42..7d4926d9f4 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -110,7 +110,7 @@ static HANDLE hFrameContactTree; static int nAnimatedIconStep = 100; -HIMAGELIST hAvatarOverlays = NULL; +HIMAGELIST hAvatarOverlays = nullptr; OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] = { @@ -143,9 +143,9 @@ OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + //////////////// CLUI CLASS IMPLEMENTATION // /////////////////////////////// #include "modern_clui.h" -CLUI* CLUI::m_pCLUI = NULL; +CLUI* CLUI::m_pCLUI = nullptr; BOOL CLUI::m_fMainMenuInited = FALSE; -HWND CLUI::m_hWnd = NULL; +HWND CLUI::m_hWnd = nullptr; static wchar_t tszFolderPath[MAX_PATH]; @@ -172,7 +172,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) { Clist_Broadcast(INTM_RELOADOPTIONS, wParam, lParam); - g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); + g_CluiData.dwKeyColor = db_get_dw(0, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); cliInvalidateRect(pcli->hwndContactList, 0, 0); return 0; @@ -192,7 +192,7 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM) MCONTACT hItem = (MCONTACT)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); Menu_ShowItem(hRenameMenuItem, hItem != 0); - if (!hItem || !IsHContactContact(hItem) || !db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)) { + if (!hItem || !IsHContactContact(hItem) || !db_get_b(0, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)) { Menu_ShowItem(hShowAvatarMenuItem, false); Menu_ShowItem(hHideAvatarMenuItem, false); } @@ -209,7 +209,7 @@ INT_PTR CLUI::Service_ShowMainMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -217,7 +217,7 @@ INT_PTR CLUI::Service_ShowStatusMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -267,12 +267,12 @@ HRESULT CLUI::CreateCluiFrames() } CLUI::CLUI() : -m_hDwmapiDll(NULL) +m_hDwmapiDll(nullptr) { m_pCLUI = this; g_CluiData.bSTATE = STATE_CLUI_LOADING; LoadDllsRuntime(); - hFrameContactTree = NULL; + hFrameContactTree = nullptr; CLUIServices_LoadModule(); @@ -287,23 +287,23 @@ m_hDwmapiDll(NULL) LoadCLUIFramesModule(); g_CluiData.boldHideOffline = -1; - bOldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + bOldHideOffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); g_CluiData.bOldUseGroups = -1; - bOldUseGroups = db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT); + bOldUseGroups = db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT); } CLUI::~CLUI() { FreeLibrary(m_hDwmapiDll); - m_pCLUI = NULL; + m_pCLUI = nullptr; } HRESULT CLUI::LoadDllsRuntime() { - g_CluiData.fLayered = !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); - g_CluiData.fSmoothAnimation = db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); - g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fLayered = !db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fSmoothAnimation = db_get_b(0, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); + g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(0, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); if (IsWinVerVistaPlus() && !IsWinVer8Plus()) { m_hDwmapiDll = LoadLibrary(L"dwmapi.dll"); @@ -350,11 +350,11 @@ HRESULT CLUI::CreateCLCWindow(const HWND hwndClui) { pcli->hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"", WS_CHILD | WS_CLIPCHILDREN | CLS_CONTACTLIST - | (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) - | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) - | (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0 + | (db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) + | (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) + | (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0 | CLS_MULTICOLUMN), - 0, 0, 0, 0, hwndClui, NULL, g_hInst, NULL); + 0, 0, 0, 0, hwndClui, nullptr, g_hInst, nullptr); return S_OK; } @@ -390,7 +390,7 @@ HRESULT CLUI::FillAlphaChannel(HDC hDC, RECT *prcParent) return S_FALSE; } - DWORD dwRgnSize = GetRegionData(hRgn, 0, NULL); + DWORD dwRgnSize = GetRegionData(hRgn, 0, nullptr); RGNDATA *rgnData = (RGNDATA *)malloc(dwRgnSize); GetRegionData(hRgn, dwRgnSize, rgnData); @@ -436,7 +436,7 @@ HRESULT CLUI::CreateCLC() HRESULT CLUI::SnappingToEdge(WINDOWPOS *lpWindowPos) { - if (db_get_b(NULL, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT)) { + if (db_get_b(0, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT)) { HMONITOR curMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); MONITORINFO monInfo; monInfo.cbSize = sizeof(monInfo); @@ -475,9 +475,9 @@ void UnloadAvatarOverlayIcon() g_pStatusOverlayIcons[i].listID = -1; } ImageList_Destroy(hAvatarOverlays); - hAvatarOverlays = NULL; + hAvatarOverlays = nullptr; DestroyIcon_protect(g_hListeningToIcon); - g_hListeningToIcon = NULL; + g_hListeningToIcon = nullptr; } BOOL CLUI_CheckOwnedByClui(HWND hWnd) @@ -501,7 +501,7 @@ BOOL CLUI_CheckOwnedByClui(HWND hWnd) int CLUI_ShowWindowMod(HWND hWnd, int nCmd) { if (hWnd == pcli->hwndContactList && (nCmd == SW_HIDE || nCmd == SW_MINIMIZE)) { - AniAva_InvalidateAvatarPositions(NULL); + AniAva_InvalidateAvatarPositions(0); AniAva_RemoveInvalidatedAvatars(); } @@ -509,7 +509,7 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) !g_mutex_bChangingMode && nCmd == SW_HIDE && !g_CluiData.fLayered && - db_get_b(NULL, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT)) + db_get_b(0, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT)) { ShowWindow(hWnd, SW_MINIMIZE); // removing of shadow return ShowWindow(hWnd, nCmd); @@ -521,7 +521,7 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) g_CluiData.fSmoothAnimation && !g_bTransparentFlag) { - if (db_get_b(NULL, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT)) + if (db_get_b(0, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT)) CLUI_SmoothAlphaTransition(hWnd, 255, 1); else { int ret = ShowWindow(hWnd, nCmd); @@ -556,9 +556,9 @@ static BOOL CLUI_WaitThreadsCompletion() void CLUI_UpdateLayeredMode() { - g_CluiData.fDisableSkinEngine = db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fDisableSkinEngine = db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); BOOL tLayeredFlag = TRUE; - tLayeredFlag &= (db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag) && !g_CluiData.fDisableSkinEngine); + tLayeredFlag &= (db_get_b(0, "ModernData", "EnableLayering", tLayeredFlag) && !g_CluiData.fDisableSkinEngine); if (g_CluiData.fLayered != tLayeredFlag) { BOOL fWasVisible = IsWindowVisible(pcli->hwndContactList); @@ -585,7 +585,7 @@ void CLUI_UpdateLayeredMode() void CLUI_UpdateAeroGlass() { - BOOL tAeroGlass = db_get_b(NULL, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) && (g_CluiData.fLayered); + BOOL tAeroGlass = db_get_b(0, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) && (g_CluiData.fLayered); if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass)) { if (g_CluiData.hAeroGlassRgn) { DeleteObject(g_CluiData.hAeroGlassRgn); @@ -620,8 +620,8 @@ void CLUI_ChangeWindowMode() if (!pcli->hwndContactList) return; g_mutex_bChangingMode = TRUE; - g_bTransparentFlag = db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT); - g_CluiData.fSmoothAnimation = db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); + g_bTransparentFlag = db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT); + g_CluiData.fSmoothAnimation = db_get_b(0, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); if (g_bTransparentFlag == 0 && g_CluiData.bCurrentAlpha != 0) g_CluiData.bCurrentAlpha = 255; @@ -629,17 +629,17 @@ void CLUI_ChangeWindowMode() if (!g_CluiData.fLayered) { style = 0; styleEx = 0; - if (db_get_b(NULL, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) || (db_get_b(NULL, "CList", "NoBorder", SETTING_NOBORDER_DEFAULT))) { - style = WS_CLIPCHILDREN | (db_get_b(NULL, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) ? WS_BORDER : 0); + if (db_get_b(0, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) || (db_get_b(0, "CList", "NoBorder", SETTING_NOBORDER_DEFAULT))) { + style = WS_CLIPCHILDREN | (db_get_b(0, "CList", "ThinBorder", SETTING_THINBORDER_DEFAULT) ? WS_BORDER : 0); styleEx = WS_EX_TOOLWINDOW; styleMaskEx |= WS_EX_APPWINDOW; } - else if (db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) && db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT)) { + else if (db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) && db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT)) { styleEx = WS_EX_TOOLWINDOW/*|WS_EX_WINDOWEDGE*/; style = WS_CAPTION | WS_POPUPWINDOW | WS_CLIPCHILDREN | WS_THICKFRAME; styleMaskEx |= WS_EX_APPWINDOW; } - else if (db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT)) + else if (db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT)) style = WS_CAPTION | WS_SYSMENU | WS_POPUPWINDOW | WS_CLIPCHILDREN | WS_THICKFRAME | WS_MINIMIZEBOX; else { style = WS_POPUPWINDOW | WS_CLIPCHILDREN | WS_THICKFRAME; @@ -660,7 +660,7 @@ void CLUI_ChangeWindowMode() // 4 - Set Title wchar_t titleText[255] = { 0 }; DBVARIANT dbv; - if (db_get_ws(NULL, "CList", "TitleText", &dbv)) + if (db_get_ws(0, "CList", "TitleText", &dbv)) mir_wstrncpy(titleText, _A2W(MIRANDANAME), _countof(titleText)); else { mir_wstrncpy(titleText, dbv.ptszVal, _countof(titleText)); @@ -670,9 +670,9 @@ void CLUI_ChangeWindowMode() // < -> // 1 - If visible store it and hide - if (g_CluiData.fLayered && (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT))) { - SetParent(pcli->hwndContactList, NULL); - Sync(CLUIFrames_SetParentForContainers, (HWND)NULL); + if (g_CluiData.fLayered && (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT))) { + SetParent(pcli->hwndContactList, nullptr); + Sync(CLUIFrames_SetParentForContainers, (HWND)nullptr); UpdateWindow(pcli->hwndContactList); g_CluiData.fOnDesktop = 0; } @@ -696,17 +696,17 @@ void CLUI_ChangeWindowMode() CLUI_UpdateAeroGlass(); - if (g_CluiData.fLayered || !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) { - SetMenu(pcli->hwndContactList, NULL); + if (g_CluiData.fLayered || !db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) { + SetMenu(pcli->hwndContactList, nullptr); } else SetMenu(pcli->hwndContactList, g_hMenuMain); - if (g_CluiData.fLayered && (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT))) + if (g_CluiData.fLayered && (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT))) ske_UpdateWindowImage(); // 6 - Pin to desktop mode - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { - HWND hProgMan = FindWindow(L"Progman", NULL); + if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + HWND hProgMan = FindWindow(L"Progman", nullptr); if (IsWindow(hProgMan)) { SetParent(pcli->hwndContactList, hProgMan); Sync(CLUIFrames_SetParentForContainers, (HWND)hProgMan); @@ -714,8 +714,8 @@ void CLUI_ChangeWindowMode() } } else { - SetParent(pcli->hwndContactList, NULL); - Sync(CLUIFrames_SetParentForContainers, (HWND)NULL); + SetParent(pcli->hwndContactList, nullptr); + Sync(CLUIFrames_SetParentForContainers, (HWND)nullptr); g_CluiData.fOnDesktop = 0; } @@ -736,14 +736,14 @@ void CLUI_ChangeWindowMode() int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top); h = (h < v) ? h : v; HRGN hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h); - if (db_get_b(NULL, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) && !Clist_IsDocked()) + if (db_get_b(0, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) && !Clist_IsDocked()) SetWindowRgn(pcli->hwndContactList, hRgn1, 1); else { DeleteObject(hRgn1); - SetWindowRgn(pcli->hwndContactList, NULL, 1); + SetWindowRgn(pcli->hwndContactList, nullptr, 1); } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); } g_mutex_bChangingMode = FALSE; flag_bFirstTimeCall = TRUE; @@ -774,12 +774,12 @@ int CLUI_UpdateTimer() { if (g_CluiData.nBehindEdgeState == 0) { KillTimer(pcli->hwndContactList, TM_BRINGOUTTIMEOUT); - CLUI_SafeSetTimer(pcli->hwndContactList, TM_BRINGOUTTIMEOUT, wBehindEdgeHideDelay * 100, NULL); + CLUI_SafeSetTimer(pcli->hwndContactList, TM_BRINGOUTTIMEOUT, wBehindEdgeHideDelay * 100, nullptr); } if (bShowEventStarted == 0 && g_CluiData.nBehindEdgeState > 0) { KillTimer(pcli->hwndContactList, TM_BRINGINTIMEOUT); - bShowEventStarted = (BOOL)CLUI_SafeSetTimer(pcli->hwndContactList, TM_BRINGINTIMEOUT, wBehindEdgeShowDelay * 100, NULL); + bShowEventStarted = (BOOL)CLUI_SafeSetTimer(pcli->hwndContactList, TM_BRINGINTIMEOUT, wBehindEdgeShowDelay * 100, nullptr); } return 0; } @@ -807,12 +807,12 @@ int CLUI_HideBehindEdge() break; } g_CluiData.mutexPreventDockMoving = 0; - SetWindowPos(pcli->hwndContactList, NULL, rcWindow.left, rcWindow.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(pcli->hwndContactList, nullptr, rcWindow.left, rcWindow.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); Sync(CLUIFrames_OnMoving, pcli->hwndContactList, &rcWindow); g_CluiData.mutexPreventDockMoving = 1; //3. store setting - db_set_b(NULL, "ModernData", "BehindEdge", method); + db_set_b(0, "ModernData", "BehindEdge", method); g_CluiData.nBehindEdgeState = method; return 1; } @@ -847,12 +847,12 @@ int CLUI_ShowFromBehindEdge() break; } g_CluiData.mutexPreventDockMoving = 0; - SetWindowPos(pcli->hwndContactList, NULL, rcWindow.left, rcWindow.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(pcli->hwndContactList, nullptr, rcWindow.left, rcWindow.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); Sync(CLUIFrames_OnMoving, pcli->hwndContactList, &rcWindow); g_CluiData.mutexPreventDockMoving = 1; // 3. store setting - db_set_b(NULL, "ModernData", "BehindEdge", 0); + db_set_b(0, "ModernData", "BehindEdge", 0); g_CluiData.nBehindEdgeState = 0; } return 0; @@ -878,9 +878,9 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) if (!tszFolderPath[0]) { wchar_t szRelativePath[MAX_PATH]; - GetModuleFileName(GetModuleHandle(NULL), szRelativePath, MAX_PATH); + GetModuleFileName(GetModuleHandle(nullptr), szRelativePath, MAX_PATH); wchar_t *str = wcsrchr(szRelativePath, '\\'); - if (str != NULL) + if (str != nullptr) *str = 0; PathToAbsoluteW(szRelativePath, tszFolderPath); } @@ -888,7 +888,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) if (szAccoName) { // first of all try to find by account name( or empty - global ) mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, szAccoName); - if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1)) + if (count = ExtractIconEx(fileFull, -1, nullptr, nullptr, 1)) return count; if (szAccoName[0]) { @@ -896,7 +896,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) PROTOACCOUNT *acc = Proto_GetAccount(szAccoName); if (acc && !acc->bOldProto) { mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, acc->szProtoName); - if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1)) + if (count = ExtractIconEx(fileFull, -1, nullptr, nullptr, 1)) return count; } } @@ -904,7 +904,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) // third try global mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn.dll", tszFolderPath); - if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1)) + if (count = ExtractIconEx(fileFull, -1, nullptr, nullptr, 1)) return count; return 8; @@ -916,10 +916,10 @@ static HICON CLUI_LoadIconFromExternalFile(wchar_t *filename, int i) mir_snwprintf(szPath, L"Icons\\%s", filename); PathToAbsoluteW(szPath, szFullPath); if (_waccess(szPath, 0)) - return NULL; + return nullptr; - HICON hIcon = NULL; - ExtractIconEx(szFullPath, i, NULL, &hIcon, 1); + HICON hIcon = nullptr; + ExtractIconEx(szFullPath, i, nullptr, &hIcon, 1); return hIcon; } @@ -963,7 +963,7 @@ static PROTOTICKS* CLUI_GetProtoTicksByProto(char *szProto) pt->nCycleStartTick = 0; pt->nIndex = arTicks.getCount(); pt->bGlobal = (szProto[0] == 0); - pt->himlIconList = NULL; + pt->himlIconList = nullptr; arTicks.insert(pt); return pt; } @@ -1005,7 +1005,7 @@ INT_PTR CLUI_GetConnectingIconService(WPARAM wParam, LPARAM) return (INT_PTR)ske_ImageList_GetIcon(pt->himlIconList, b); } - return NULL; + return 0; } static BOOL CALLBACK BroadcastEnumChildProc(HWND hwndChild, LPARAM lParam) @@ -1030,14 +1030,14 @@ static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LP int CLUI_ReloadCLUIOptions() { KillTimer(pcli->hwndContactList, TM_UPDATEBRINGTIMER); - g_CluiData.bBehindEdgeSettings = db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT); - wBehindEdgeShowDelay = db_get_w(NULL, "ModernData", "ShowDelay", SETTING_SHOWDELAY_DEFAULT); - wBehindEdgeHideDelay = db_get_w(NULL, "ModernData", "HideDelay", SETTING_HIDEDELAY_DEFAULT); - wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", SETTING_HIDEBEHINDBORDERSIZE_DEFAULT); + g_CluiData.bBehindEdgeSettings = db_get_b(0, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT); + wBehindEdgeShowDelay = db_get_w(0, "ModernData", "ShowDelay", SETTING_SHOWDELAY_DEFAULT); + wBehindEdgeHideDelay = db_get_w(0, "ModernData", "HideDelay", SETTING_HIDEDELAY_DEFAULT); + wBehindEdgeBorderSize = db_get_w(0, "ModernData", "HideBehindBorderSize", SETTING_HIDEBEHINDBORDERSIZE_DEFAULT); - g_CluiData.fAutoSize = db_get_b(NULL, "CLUI", "AutoSize", SETTING_AUTOSIZE_DEFAULT); - g_CluiData.bInternalAwayMsgDiscovery = db_get_b(NULL, "ModernData", "InternalAwayMsgDiscovery", SETTING_INTERNALAWAYMSGREQUEST_DEFAULT); - g_CluiData.bRemoveAwayMessageForOffline = db_get_b(NULL, "ModernData", "RemoveAwayMessageForOffline", SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT); + g_CluiData.fAutoSize = db_get_b(0, "CLUI", "AutoSize", SETTING_AUTOSIZE_DEFAULT); + g_CluiData.bInternalAwayMsgDiscovery = db_get_b(0, "ModernData", "InternalAwayMsgDiscovery", SETTING_INTERNALAWAYMSGREQUEST_DEFAULT); + g_CluiData.bRemoveAwayMessageForOffline = db_get_b(0, "ModernData", "RemoveAwayMessageForOffline", SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT); // window borders if (g_CluiData.fDisableSkinEngine) { @@ -1048,10 +1048,10 @@ int CLUI_ReloadCLUIOptions() } else { // window borders - g_CluiData.LeftClientMargin = db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT); - g_CluiData.RightClientMargin = db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT); - g_CluiData.TopClientMargin = db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT); - g_CluiData.BottomClientMargin = db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT); + g_CluiData.LeftClientMargin = db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT); + g_CluiData.RightClientMargin = db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT); + g_CluiData.TopClientMargin = db_get_b(0, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT); + g_CluiData.BottomClientMargin = db_get_b(0, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT); } BroadCastMessageToChild(pcli->hwndContactList, WM_THEMECHANGED, 0, 0); @@ -1087,7 +1087,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) return 1; r1 = mbi.rcBar; - r1.bottom += !db_get_b(NULL, "CLUI", "LineUnderMenu", SETTING_LINEUNDERMENU_DEFAULT); + r1.bottom += !db_get_b(0, "CLUI", "LineUnderMenu", SETTING_LINEUNDERMENU_DEFAULT); if (item < 1) { treg = CreateRectRgn(mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, r1.bottom); if (item == 0) { // should remove item clips @@ -1101,7 +1101,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) } else { GetMenuBarInfo(hwnd, OBJID_MENU, item, &mbi); - treg = CreateRectRgn(mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom + !db_get_b(NULL, "CLUI", "LineUnderMenu", SETTING_LINEUNDERMENU_DEFAULT)); + treg = CreateRectRgn(mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom + !db_get_b(0, "CLUI", "LineUnderMenu", SETTING_LINEUNDERMENU_DEFAULT)); } OffsetRgn(treg, -ra.left, -ra.top); r1.left -= ra.left; @@ -1121,7 +1121,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) if (!g_CluiData.fDisableSkinEngine) SkinDrawGlyph(hdc, &r1, &r1, "Main,ID=MenuBar"); else { - HBRUSH hbr = NULL; + HBRUSH hbr = nullptr; if (dat->hMenuBackground) { RECT clRect = r1; @@ -1201,7 +1201,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) } } - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); return 0; } @@ -1232,14 +1232,14 @@ int CLUI_IconsChanged(WPARAM, LPARAM) void CLUI_cli_LoadCluiGlobalOpts() { BOOL tLayeredFlag = TRUE; - tLayeredFlag &= db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag); + tLayeredFlag &= db_get_b(0, "ModernData", "EnableLayering", tLayeredFlag); if (tLayeredFlag) { - if (db_get_b(NULL, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) == 1) - db_set_b(NULL, "CList", "WindowShadow", 2); + if (db_get_b(0, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) == 1) + db_set_b(0, "CList", "WindowShadow", 2); } else { - if (db_get_b(NULL, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) == 2) - db_set_b(NULL, "CList", "WindowShadow", 1); + if (db_get_b(0, "CList", "WindowShadow", SETTING_WINDOWSHADOW_DEFAULT) == 2) + db_set_b(0, "CList", "WindowShadow", 1); } corecli.pfnLoadCluiGlobalOpts(); } @@ -1248,7 +1248,7 @@ void CLUI_cli_LoadCluiGlobalOpts() int CLUI_TestCursorOnBorders() { HWND hwnd = pcli->hwndContactList; - HCURSOR hCurs1 = NULL; + HCURSOR hCurs1 = nullptr; POINT pt; int k = 0, fx, fy; BOOL mouse_in_window = 0; @@ -1258,9 +1258,9 @@ int CLUI_TestCursorOnBorders() if (CLUI_CheckOwnedByClui(hAux)) { if (g_bTransparentFlag) { if (!bTransparentFocus && gf != hwnd) { - CLUI_SmoothAlphaTransition(hwnd, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); + CLUI_SmoothAlphaTransition(hwnd, db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); bTransparentFocus = 1; - CLUI_SafeSetTimer(hwnd, TM_AUTOALPHA, 250, NULL); + CLUI_SafeSetTimer(hwnd, TM_AUTOALPHA, 250, nullptr); } } } @@ -1271,17 +1271,17 @@ int CLUI_TestCursorOnBorders() GetWindowRect(hwnd, &r); // Size borders offset (contract) - r.top += db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Top", SKIN_OFFSET_TOP_DEFAULT); - r.bottom -= db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Bottom", SKIN_OFFSET_BOTTOM_DEFAULT); - r.left += db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Left", SKIN_OFFSET_LEFT_DEFAULT); - r.right -= db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Right", SKIN_OFFSET_RIGHT_DEFAULT); + r.top += db_get_dw(0, "ModernSkin", "SizeMarginOffset_Top", SKIN_OFFSET_TOP_DEFAULT); + r.bottom -= db_get_dw(0, "ModernSkin", "SizeMarginOffset_Bottom", SKIN_OFFSET_BOTTOM_DEFAULT); + r.left += db_get_dw(0, "ModernSkin", "SizeMarginOffset_Left", SKIN_OFFSET_LEFT_DEFAULT); + r.right -= db_get_dw(0, "ModernSkin", "SizeMarginOffset_Right", SKIN_OFFSET_RIGHT_DEFAULT); if (r.right < r.left) r.right = r.left; if (r.bottom < r.top) r.bottom = r.top; // End of size borders offset (contract) hAux = WindowFromPoint(pt); - while (hAux != NULL) { + while (hAux != nullptr) { if (hAux == hwnd) { mouse_in_window = 1; break; } hAux = GetParent(hAux); } @@ -1294,18 +1294,18 @@ int CLUI_TestCursorOnBorders() else if (pt.x >= r.left && pt.x <= r.left + SIZING_MARGIN && g_CluiData.bBehindEdgeSettings != 1) k += 1; if (!(pt.x >= r.left && pt.x <= r.right && pt.y >= r.top && pt.y <= r.bottom)) k = 0; k *= mouse_in_window; - hCurs1 = LoadCursor(NULL, IDC_ARROW); - if (g_CluiData.nBehindEdgeState <= 0 && (!(db_get_b(NULL, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT)))) + hCurs1 = LoadCursor(nullptr, IDC_ARROW); + if (g_CluiData.nBehindEdgeState <= 0 && (!(db_get_b(0, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT)))) switch (k) { case 1: case 2: - if (!g_CluiData.fDocked || (g_CluiData.fDocked == 2 && k == 1) || (g_CluiData.fDocked == 1 && k == 2)) { hCurs1 = LoadCursor(NULL, IDC_SIZEWE); break; } - case 3: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENS); break; } - case 4: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENWSE); break; } - case 5: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENESW); break; } - case 6: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENS); break; } - case 7: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENESW); break; } - case 8: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(NULL, IDC_SIZENWSE); break; } + if (!g_CluiData.fDocked || (g_CluiData.fDocked == 2 && k == 1) || (g_CluiData.fDocked == 1 && k == 2)) { hCurs1 = LoadCursor(nullptr, IDC_SIZEWE); break; } + case 3: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENS); break; } + case 4: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENWSE); break; } + case 5: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENESW); break; } + case 6: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENS); break; } + case 7: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENESW); break; } + case 8: if (!g_CluiData.fDocked) { hCurs1 = LoadCursor(nullptr, IDC_SIZENWSE); break; } } if (hCurs1) SetCursor(hCurs1); return k; @@ -1316,17 +1316,17 @@ int CLUI_TestCursorOnBorders() int CLUI_SizingOnBorder(POINT pt, int PerformSize) { - if (!(db_get_b(NULL, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT))) { + if (!(db_get_b(0, "CLUI", "LockSize", SETTING_LOCKSIZE_DEFAULT))) { RECT r; HWND hwnd = pcli->hwndContactList; int sizeOnBorderFlag = 0; GetWindowRect(hwnd, &r); // Size borders offset (contract) - r.top += db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Top", SKIN_OFFSET_TOP_DEFAULT); - r.bottom -= db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Bottom", SKIN_OFFSET_BOTTOM_DEFAULT); - r.left += db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Left", SKIN_OFFSET_LEFT_DEFAULT); - r.right -= db_get_dw(NULL, "ModernSkin", "SizeMarginOffset_Right", SKIN_OFFSET_RIGHT_DEFAULT); + r.top += db_get_dw(0, "ModernSkin", "SizeMarginOffset_Top", SKIN_OFFSET_TOP_DEFAULT); + r.bottom -= db_get_dw(0, "ModernSkin", "SizeMarginOffset_Bottom", SKIN_OFFSET_BOTTOM_DEFAULT); + r.left += db_get_dw(0, "ModernSkin", "SizeMarginOffset_Left", SKIN_OFFSET_LEFT_DEFAULT); + r.right -= db_get_dw(0, "ModernSkin", "SizeMarginOffset_Right", SKIN_OFFSET_RIGHT_DEFAULT); if (r.right < r.left) r.right = r.left; if (r.bottom < r.top) r.bottom = r.top; @@ -1377,7 +1377,7 @@ static void CLUI_SmoothAnimationThreadProc(void *param) } while (mutex_bAnimationInProgress); } - g_hSmoothAnimationThread = NULL; + g_hSmoothAnimationThread = nullptr; } static int CLUI_SmoothAlphaThreadTransition() @@ -1395,7 +1395,7 @@ static int CLUI_SmoothAlphaThreadTransition() Sync(CLUIFrames_OnShowHide, 0); mutex_bShowHideCalledFromAnimation = 0; g_CluiData.bCurrentAlpha = 0; - if (!g_CluiData.fLayered) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_ERASE | RDW_FRAME); + if (!g_CluiData.fLayered) RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_ERASE | RDW_FRAME); return 0; } } @@ -1495,14 +1495,14 @@ BOOL cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase) static BOOL FileExists(wchar_t * tszFilename) { FILE * f = _wfopen(tszFilename, L"r"); - if (f == NULL) return FALSE; + if (f == nullptr) return FALSE; fclose(f); return TRUE; } HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDescription, wchar_t *tszDefaultFile, int iDefaultIndex, HINSTANCE hDefaultModuleInst, int iDefaultResource) { - if (hDefaultModuleInst == NULL) + if (hDefaultModuleInst == nullptr) return Skin_GetIconHandle(iDefaultResource); wchar_t fileFull[MAX_PATH] = { 0 }; @@ -1542,7 +1542,7 @@ LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bH // This registers a window message with RegisterWindowMessage() and then waits for such a message, // if it gets it, it tries to open a file mapping object and then maps it to this process space, - // it expects 256 bytes of data (incl. NULL) it will then write back the profile it is using the DB to fill in the answer. + // it expects 256 bytes of data (incl. nullptr) it will then write back the profile it is using the DB to fill in the answer. // // The caller is expected to create this mapping object and tell us the ID we need to open ours. if (g_CluiData.bSTATE == STATE_EXITING && msg != WM_DESTROY) { @@ -1555,8 +1555,8 @@ LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bH char szName[MAX_PATH]; mir_snprintf(szName, "Miranda::%u", wParam); // caller will tell us the ID of the map HANDLE hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, szName); - if (hMap != NULL) { - void *hView = NULL; + if (hMap != nullptr) { + void *hView = nullptr; hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH); if (hView) { char szFilePath[MAX_PATH], szProfile[MAX_PATH]; @@ -1681,11 +1681,11 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) Sync(CLUIFrames_OnMoving, m_hWnd, &rc); if (!IsIconic(m_hWnd)) { if (!Clist_IsDocked()) { // if g_CluiData.fDocked, dont remember pos (except for width) - db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top)); - db_set_dw(NULL, "CList", "x", (DWORD)rc.left); - db_set_dw(NULL, "CList", "y", (DWORD)rc.top); + db_set_dw(0, "CList", "Height", (DWORD)(rc.bottom - rc.top)); + db_set_dw(0, "CList", "x", (DWORD)rc.left); + db_set_dw(0, "CList", "y", (DWORD)rc.top); } - db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left)); + db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left)); } } return TRUE; @@ -1693,17 +1693,17 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: if (g_mutex_bSizing) return 0; if (wParam != SIZE_MINIMIZED /* && IsWindowVisible(m_hWnd)*/) { - if (pcli->hwndContactList == NULL) + if (pcli->hwndContactList == nullptr) return 0; if (!g_CluiData.fLayered && !g_CluiData.fDisableSkinEngine) - ske_ReCreateBackImage(TRUE, NULL); + ske_ReCreateBackImage(TRUE, nullptr); RECT rc; GetWindowRect(m_hWnd, &rc); CheckFramesPos(&rc); ModernSkinButton_ReposButtons(m_hWnd, SBRF_DO_NOT_DRAW, &rc); - ModernSkinButton_ReposButtons(m_hWnd, SBRF_REDRAW, NULL); + ModernSkinButton_ReposButtons(m_hWnd, SBRF_REDRAW, nullptr); if (g_CluiData.fLayered) CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)m_hWnd, 0); @@ -1718,12 +1718,12 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) // if g_CluiData.fDocked, dont remember pos (except for width) if (!Clist_IsDocked()) { - db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top)); - db_set_dw(NULL, "CList", "x", (DWORD)rc.left); - db_set_dw(NULL, "CList", "y", (DWORD)rc.top); + db_set_dw(0, "CList", "Height", (DWORD)(rc.bottom - rc.top)); + db_set_dw(0, "CList", "x", (DWORD)rc.left); + db_set_dw(0, "CList", "y", (DWORD)rc.top); } - else SetWindowRgn(m_hWnd, NULL, 0); - db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left)); + else SetWindowRgn(m_hWnd, nullptr, 0); + db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left)); if (!g_CluiData.fLayered) { HRGN hRgn1; @@ -1734,21 +1734,21 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top); h = (h < v) ? h : v; hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h); - if (db_get_b(NULL, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) && !Clist_IsDocked()) + if (db_get_b(0, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT) && !Clist_IsDocked()) SetWindowRgn(m_hWnd, hRgn1, FALSE); else { DeleteObject(hRgn1); - SetWindowRgn(m_hWnd, NULL, FALSE); + SetWindowRgn(m_hWnd, nullptr, FALSE); } - RedrawWindow(m_hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(m_hWnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); } } else { - if (db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) { + if (db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) { CLUI_ShowWindowMod(m_hWnd, SW_HIDE); - db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); + db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN); } - else db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); + else db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED); SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } return TRUE; @@ -1773,7 +1773,7 @@ LRESULT CLUI::OnUpdate(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) { if (g_flag_bPostWasCanceled) return FALSE; - return ske_ValidateFrameImageProc(NULL); + return ske_ValidateFrameImageProc(nullptr); } LRESULT CLUI::OnInitMenu(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) @@ -1788,8 +1788,8 @@ LRESULT CLUI::OnInitMenu(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) LRESULT CLUI::OnNcPaint(UINT msg, WPARAM wParam, LPARAM lParam) { int lRes = DefWindowProc(m_hWnd, msg, wParam, lParam); - if (!g_CluiData.fLayered && db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) { - HDC hdc = NULL; + if (!g_CluiData.fLayered && db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) { + HDC hdc = nullptr; if (msg == WM_PRINT) hdc = (HDC)wParam; if (!hdc) hdc = GetWindowDC(m_hWnd); CLUI_DrawMenuBackGround(m_hWnd, hdc, 0, 0); @@ -1826,7 +1826,7 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) HDC hdc = CreateCompatibleDC(paintDC); HBITMAP hbmp = ske_CreateDIB32(w.right, w.bottom); HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, hbmp); - ske_ReCreateBackImage(FALSE, NULL); + ske_ReCreateBackImage(FALSE, nullptr); BitBlt(paintDC, w2.left, w2.top, w2.right - w2.left, w2.bottom - w2.top, g_pCachedWindow->hBackDC, w2.left, w2.top, SRCCOPY); SelectObject(hdc, oldbmp); DeleteObject(hbmp); @@ -1840,13 +1840,13 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) EndPaint(m_hWnd, &ps); } - ValidateRect(m_hWnd, NULL); + ValidateRect(m_hWnd, nullptr); } - if (0 && (db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT) || db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT))) { + if (0 && (db_get_dw(0, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT) || db_get_dw(0, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT))) { if (IsWindowVisible(m_hWnd)) { if (g_CluiData.fLayered) - SkinInvalidateFrame(m_hWnd, NULL); + SkinInvalidateFrame(m_hWnd, nullptr); else { RECT w = { 0 }; RECT w2 = { 0 }; @@ -1878,7 +1878,7 @@ LRESULT CLUI::OnCreate(UINT, WPARAM, LPARAM) mii.fMask = MIIM_TYPE | MIIM_DATA; mii.dwItemData = MENU_MIRANDAMENU; mii.fType = MFT_OWNERDRAW; - mii.dwTypeData = NULL; + mii.dwTypeData = nullptr; SetMenuItemInfo(GetMenu(m_hWnd), 0, TRUE, &mii); // mii.fMask = MIIM_TYPE; @@ -1904,7 +1904,7 @@ LRESULT CLUI::OnSetAllExtraIcons(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lPara LRESULT CLUI::OnCreateClc(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) { CreateCLC(); - if (db_get_b(NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT)) + if (db_get_b(0, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT)) cliShowHide(true); pcli->pfnInitAutoRebuild(pcli->hwndContactTree); return FALSE; @@ -1963,7 +1963,7 @@ LRESULT CLUI::OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam) if (!IsStatusConnecting(status)) { pt->nCycleStartTick = 0; ImageList_Destroy(pt->himlIconList); - pt->himlIconList = NULL; + pt->himlIconList = nullptr; KillTimer(m_hWnd, TM_STATUSBARUPDATE + pt->nIndex); pt->bTimerCreated = 0; } @@ -1972,13 +1972,13 @@ LRESULT CLUI::OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam) PROTOTICKS *pt = &arTicks[wParam - TM_STATUSBARUPDATE]; if (IsWindowVisible(pcli->hwndStatus)) - pcli->pfnInvalidateRect(pcli->hwndStatus, NULL, 0); + pcli->pfnInvalidateRect(pcli->hwndStatus, nullptr, 0); if (pt->bGlobal) pcli->pfnTrayIconUpdateBase(g_szConnectingProto); else pcli->pfnTrayIconUpdateBase(pt->szProto); - pcli->pfnInvalidateRect(pcli->hwndStatus, NULL, TRUE); + pcli->pfnInvalidateRect(pcli->hwndStatus, nullptr, TRUE); return DefCluiWndProc(msg, wParam, lParam); } @@ -2003,9 +2003,9 @@ LRESULT CLUI::OnAutoAlphaTimer(UINT, WPARAM, LPARAM) // change bTransparentFocus = inwnd; if (bTransparentFocus) - CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); + CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); else - CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag ? db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT) : 255), 1); + CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag ? db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT) : 255), 1); } if (!bTransparentFocus) KillTimer(m_hWnd, TM_AUTOALPHA); @@ -2051,7 +2051,7 @@ LRESULT CLUI::OnBringInTimer(UINT, WPARAM, LPARAM) POINT pt; GetCursorPos(&pt); HWND hAux = WindowFromPoint(pt); BOOL mouse_in_window = FALSE; - while (hAux != NULL) { + while (hAux != nullptr) { if (hAux == m_hWnd) { mouse_in_window = TRUE; break; @@ -2094,9 +2094,9 @@ LRESULT CLUI::OnTimer(UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); SendMessage(pcli->hwndContactTree, WM_ACTIVATE, wParam, lParam); - if (db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT)) { + if (db_get_b(0, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT)) { if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && GetParent((HWND)lParam) != m_hWnd) { if (!g_bCalledFromShowHide) CLUI_UpdateTimer(); } @@ -2111,24 +2111,24 @@ LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && !CLUI_CheckOwnedByClui((HWND)lParam)) { if (g_bTransparentFlag && bTransparentFocus) - CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA, 250, NULL); + CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA, 250, nullptr); } else { - if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) + if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) Sync(CLUIFrames_ActivateSubContainers, TRUE); if (g_bTransparentFlag) { KillTimer(m_hWnd, TM_AUTOALPHA); - CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); + CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); bTransparentFocus = 1; } } - RedrawWindow(m_hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); + RedrawWindow(m_hWnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN); if (g_bTransparentFlag) { BYTE alpha; if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) - alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); + alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT); else - alpha = g_bTransparentFlag ? db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT) : 255; + alpha = g_bTransparentFlag ? db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT) : 255; CLUI_SmoothAlphaTransition(m_hWnd, alpha, 1); return 1; } @@ -2141,9 +2141,9 @@ LRESULT CLUI::OnSetCursor(UINT, WPARAM, LPARAM) if (g_CluiData.nBehindEdgeState >= 0) CLUI_UpdateTimer(); if (g_bTransparentFlag) { if (!bTransparentFocus && gf != m_hWnd) { - CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); + CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), 1); bTransparentFocus = 1; - CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA, 250, NULL); + CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA, 250, nullptr); } } int k = CLUI_TestCursorOnBorders(); @@ -2195,14 +2195,14 @@ LRESULT CLUI::OnNcHitTest(UINT, WPARAM wParam, LPARAM lParam) if (result == HTMENU) { POINT pt = UNPACK_POINT(lParam); int t = MenuItemFromPoint(m_hWnd, g_hMenuMain, pt); - if (t == -1 && (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT))) + if (t == -1 && (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT))) return HTCAPTION; } if (result == HTCLIENT) { POINT pt = UNPACK_POINT(lParam); int k = CLUI_SizingOnBorder(pt, 0); - if (!k && (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT))) + if (!k && (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT))) return HTCAPTION; else return k + 9; } @@ -2214,7 +2214,7 @@ LRESULT CLUI::OnShowWindow(UINT, WPARAM wParam, LPARAM lParam) if (lParam) return 0; if (mutex_bShowHideCalledFromAnimation) return 1; - BYTE gAlpha = (!wParam) ? 0 : (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT) : 255); + BYTE gAlpha = (!wParam) ? 0 : (db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT) : 255); if (wParam) { g_CluiData.bCurrentAlpha = 0; Sync(CLUIFrames_OnShowHide, 1); @@ -2236,7 +2236,7 @@ LRESULT CLUI::OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam) } DefWindowProc(m_hWnd, msg, wParam, lParam); - if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) + if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) Sync(CLUIFrames_ActivateSubContainers, TRUE); return FALSE; } @@ -2251,7 +2251,7 @@ LRESULT CLUI::OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CLUI::OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam) { DefWindowProc(m_hWnd, msg, wParam, lParam); - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = max(db_get_w(NULL, "CLUI", "MinWidth", SETTING_MINWIDTH_DEFAULT), max(18, db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT) + db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT) + 18)); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = max(db_get_w(0, "CLUI", "MinWidth", SETTING_MINWIDTH_DEFAULT), max(18, db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT) + db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT) + 18)); if (nRequiredHeight == 0) ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight(); @@ -2282,8 +2282,8 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) if (!g_CluiData.fAutoSize || pcli->hwndContactTree == 0 || Clist_IsDocked()) return FALSE; - maxHeight = db_get_b(NULL, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT); - minHeight = db_get_b(NULL, "CLUI", "MinSizeHeight", SETTING_MINSIZEHEIGHT_DEFAULT); + maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT); + minHeight = db_get_b(0, "CLUI", "MinSizeHeight", SETTING_MINSIZEHEIGHT_DEFAULT); rcOld = rcWindow; GetWindowRect(pcli->hwndContactTree, &rcTree); @@ -2314,7 +2314,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) if (newHeight == (rcWindow.bottom - rcWindow.top)) return 0; - if (db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT)) { + if (db_get_b(0, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT)) { rcWindow.top = rcWindow.bottom - newHeight; if (rcWindow.top < rcWorkArea.top) rcWindow.top = rcWorkArea.top; } @@ -2351,7 +2351,7 @@ LRESULT CLUI::OnClickNotify(NMCLISTCONTROL * pnmc) if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0) return DefCluiWndProc(WM_NOTIFY, 0, (LPARAM)pnmc); - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { POINT pt; int res; pt = pnmc->pt; @@ -2360,7 +2360,7 @@ LRESULT CLUI::OnClickNotify(NMCLISTCONTROL * pnmc) return res; } - if (db_get_b(NULL, "CLUI", "DragToScroll", SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) + if (db_get_b(0, "CLUI", "DragToScroll", SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) return ClcEnterDragToScroll(pcli->hwndContactTree, pnmc->pt.y); return 0; @@ -2396,7 +2396,7 @@ LRESULT CLUI::OnContextMenu(UINT, WPARAM, LPARAM lParam) } if (PtInRect(&rc, pt)) { HMENU hMenu = Menu_BuildGroupMenu(); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, m_hWnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, m_hWnd, nullptr); Menu_DestroyNestedMenu(hMenu); } return FALSE; @@ -2445,7 +2445,7 @@ LRESULT CLUI::OnDrawItem(UINT, WPARAM, LPARAM lParam) int x = (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + offset; int y = (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + offset; - DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, x, y, 0, 0, + DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, x, y, 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE && (((FALSE))) ? DSS_DISABLED : DSS_NORMAL)); IcoLib_ReleaseIcon(hIcon); @@ -2453,7 +2453,7 @@ LRESULT CLUI::OnDrawItem(UINT, WPARAM, LPARAM lParam) } else { nMirMenuState = dis->itemState; - pcli->pfnInvalidateRect(m_hWnd, NULL, 0); + pcli->pfnInvalidateRect(m_hWnd, nullptr, 0); } return TRUE; } @@ -2481,7 +2481,7 @@ LRESULT CLUI::OnDrawItem(UINT, WPARAM, LPARAM lParam) } else { nStatusMenuState = dis->itemState; - pcli->pfnInvalidateRect(m_hWnd, NULL, 0); + pcli->pfnInvalidateRect(m_hWnd, nullptr, 0); } return TRUE; } @@ -2494,7 +2494,7 @@ LRESULT CLUI::OnDrawItem(UINT, WPARAM, LPARAM lParam) CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 3, dis->itemState); mir_snprintf(buf, "Main,ID=MainMenu,Selected=%s,Hot=%s", (dis->itemState&ODS_SELECTED) ? "True" : "False", (dis->itemState&ODS_HOTLIGHT) ? "True" : "False"); SkinDrawGlyph(dis->hDC, &dis->rcItem, &dis->rcItem, buf); - DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + dx, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + dx, 0, 0, DST_ICON); + DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + dx, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + dx, 0, 0, DST_ICON); IcoLib_ReleaseIcon(hIcon); nMirMenuState = dis->itemState; } @@ -2504,7 +2504,7 @@ LRESULT CLUI::OnDrawItem(UINT, WPARAM, LPARAM lParam) LRESULT CLUI::OnDestroy(UINT, WPARAM, LPARAM) { - int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL); + int state = db_get_b(0, "CList", "State", SETTING_STATE_NORMAL); BOOL wait = FALSE; AniAva_UnloadModule(); @@ -2540,30 +2540,30 @@ LRESULT CLUI::OnDestroy(UINT, WPARAM, LPARAM) mutex_bAnimationInProgress = 0; CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)hFrameContactTree, 0); TRACE("CLUI.c: WM_DESTROY - hFrameContactTree removed\n"); - pcli->hwndContactTree = NULL; - pcli->hwndStatus = NULL; + pcli->hwndContactTree = nullptr; + pcli->hwndStatus = nullptr; if (g_CluiData.fAutoSize && !g_CluiData.fDocked) { RECT r; GetWindowRect(pcli->hwndContactList, &r); - if (db_get_b(NULL, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT)) + if (db_get_b(0, "CLUI", "AutoSizeUpward", SETTING_AUTOSIZEUPWARD_DEFAULT)) r.top = r.bottom - CLUIFrames_GetTotalHeight(); else r.bottom = r.top + CLUIFrames_GetTotalHeight(); - db_set_dw(NULL, "CList", "y", r.top); - db_set_dw(NULL, "CList", "Height", r.bottom - r.top); + db_set_dw(0, "CList", "y", r.top); + db_set_dw(0, "CList", "Height", r.bottom - r.top); } UnLoadCLUIFramesModule(); //ExtFrames_Uninit(); TRACE("CLUI.c: WM_DESTROY - UnLoadCLUIFramesModule DONE\n"); - db_set_b(NULL, "CList", "State", (BYTE)state); + db_set_b(0, "CList", "State", (BYTE)state); ske_UnloadSkin(&g_SkinObjectList); delete m_pCLUI; - pcli->hwndContactList = NULL; - pcli->hwndStatus = NULL; + pcli->hwndContactList = nullptr; + pcli->hwndStatus = nullptr; PostQuitMessage(0); return 0; } diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 696975a2e6..b18b5e2651 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -76,7 +76,7 @@ DWORD CompareContacts2_getLMTime(MCONTACT hContact) int GetProtoIndex(char * szName) { if (szName) { - PROTOACCOUNT **accs = NULL; + PROTOACCOUNT **accs = nullptr; int accCount = 0; Proto_EnumAccounts(&accCount, &accs); @@ -129,7 +129,7 @@ int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2) break; case SORTBY_PROTO: - if (contact1->proto == NULL || contact2->proto == NULL) + if (contact1->proto == nullptr || contact2->proto == nullptr) continue; r = GetProtoIndex(contact1->proto) - GetProtoIndex(contact2->proto); break; @@ -163,14 +163,14 @@ INT_PTR SetUseGroups(WPARAM wParam, LPARAM) if (!newVal == (int)wParam) return 0; newVal = wParam; } - db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal); + db_set_b(0, "CList", "UseGroups", (BYTE)newVal); SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal, 0); return 0; } INT_PTR ToggleSounds(WPARAM, LPARAM) { - db_set_b(NULL, "Skin", "UseSound", - (BYTE)!db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT)); + db_set_b(0, "Skin", "UseSound", + (BYTE)!db_get_b(0, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT)); return 0; } diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index a2550c141b..df8ef4b4a4 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -102,13 +102,13 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) MSG *msg = (MSG*)wParam; if (msg->message == WM_DESTROY) - db_set_b(NULL, "CList", "Docked", (BYTE)g_CluiData.fDocked); + db_set_b(0, "CList", "Docked", (BYTE)g_CluiData.fDocked); if (!g_CluiData.fDocked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE && msg->message != WM_SIZE) return 0; switch (msg->message) { case WM_CREATE: //if (GetSystemMetrics(SM_CMONITORS)>1) return 0; - if (db_get_b(NULL, "CList", "Docked", 0) && db_get_b(NULL, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT)) + if (db_get_b(0, "CList", "Docked", 0) && db_get_b(0, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT)) { PostMessage(msg->hwnd, WM_CREATEDOCKED, 0, 0); } @@ -117,7 +117,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) case WM_CREATEDOCKED: //we need to post a message just after creation to let main message function do some work - g_CluiData.fDocked = (BOOL)db_get_b(NULL, "CList", "Docked", 0); + g_CluiData.fDocked = (BOOL)db_get_b(0, "CList", "Docked", 0); if (IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) { RECT rc, rcMonitor; memset(&abd, 0, sizeof(abd)); @@ -133,11 +133,11 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.mutexPreventDockMoving = 0; Sync(CLUIFrames_OnMoving, msg->hwnd, &rc); g_CluiData.mutexPreventDockMoving = 1; - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); } break; case WM_CAPTURECHANGED: - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); return 0; case WM_ACTIVATE: memset(&abd, 0, sizeof(abd)); @@ -146,13 +146,13 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) SHAppBarMessage(ABM_ACTIVATE, &abd); return 0; case WM_SIZE: - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_REDRAW_ALL, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_REDRAW_ALL, nullptr); return 0; case WM_WINDOWPOSCHANGED: { if (g_CluiData.fDocked) - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); return 0; } case WM_MOVING: @@ -173,7 +173,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) - && db_get_b(NULL, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT)) + && db_get_b(0, "CLUI", "DockToSides", SETTING_DOCKTOSIDES_DEFAULT)) { memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); @@ -197,8 +197,8 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Sync(CLUIFrames_OnMoving, msg->hwnd, (LPRECT)msg->lParam); g_CluiData.mutexPreventDockMoving = 1; mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); - db_set_b(NULL, "CList", "Docked", (BYTE)g_CluiData.fDocked); - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + db_set_b(0, "CList", "Docked", (BYTE)g_CluiData.fDocked); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); return TRUE; } return 0; @@ -215,19 +215,19 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.mutexPreventDockMoving = 0; SetWindowPos(msg->hwnd, 0, rcWindow.left, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING); Sync(CLUIFrames_OnMoving, msg->hwnd, &rcWindow); - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);// -= -= -= + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr);// -= -= -= g_CluiData.mutexPreventDockMoving = 1; return 1; } case WM_MOVE: { - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_ALT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_ALT_DRAW, nullptr); return 0; } case WM_SIZING: { - if (g_CluiData.fDocked) ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + if (g_CluiData.fDocked) ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); return FALSE; } case WM_SHOWWINDOW: @@ -249,7 +249,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); MoveWindow(msg->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE); Sync(CLUIFrames_OnMoving, msg->hwnd, &rc); - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);// -= -= -= + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr);// -= -= -= } else { SHAppBarMessage(ABM_REMOVE, &abd); @@ -293,9 +293,9 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.fDocked = 0; GetCursorPos(&pt); PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); - SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(NULL, "CList", "Width", 0), db_get_dw(NULL, "CList", "Height", 0), SWP_NOZORDER); - db_set_b(NULL, "CList", "Docked", (BYTE)g_CluiData.fDocked); - // ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(0, "CList", "Width", 0), db_get_dw(0, "CList", "Height", 0), SWP_NOZORDER); + db_set_b(0, "CList", "Docked", (BYTE)g_CluiData.fDocked); + // ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); } return 1; } @@ -316,7 +316,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetWindowRect(msg->hwnd, &rc); Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rc); Sync(CLUIFrames_OnMoving, msg->hwnd, &rc); // -= -= -= - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); g_CluiData.mutexPreventDockMoving = 1; } @@ -329,7 +329,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_REMOVE, &abd); - ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL); + ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); } return 0; } diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index ce53d31913..cbc36d8f79 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -23,7 +23,7 @@ void InitGdiPlus(void) { GdiplusStartupInput gdiplusStartupInput; if (g_gdiplusToken == 0) - GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL); + GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, nullptr); } void ShutdownGdiPlus(void) @@ -55,7 +55,7 @@ HBITMAP GDIPlus_LoadGlyphImage(const wchar_t *tszFileName) // Clone a portion of the bitmap. Bitmap* clone = bitmap.Clone(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), PixelFormat32bppPARGB); - HBITMAP hbmp = NULL; + HBITMAP hbmp = nullptr; if (clone) { clone->GetHBITMAP(Color(0, 0, 0), &hbmp); delete clone; @@ -67,7 +67,7 @@ void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD heigh { BITMAP bmp; Bitmap *bm; - BYTE * bmbits = NULL; + BYTE * bmbits = nullptr; GetObject(hbmp, sizeof(BITMAP), &bmp); Graphics g(hDestDC); if (bmp.bmBitsPixel == 32 && (flag&AVS_PREMULTIPLIED)) { @@ -83,7 +83,7 @@ void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD heigh free(bmbits); } } - else bm = new Bitmap(hbmp, NULL); + else bm = new Bitmap(hbmp, nullptr); ImageAttributes attr; ColorMatrix Matrix = @@ -97,7 +97,7 @@ void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD heigh attr.SetColorMatrix(&Matrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap); g.SetInterpolationMode(InterpolationModeHighQualityBicubic); RectF rect((float)x, (float)y, (float)width, (float)height); - g.DrawImage(bm, rect, (float)x1, (float)y1, (float)width1, (float)height1, UnitPixel, &attr, NULL, NULL); + g.DrawImage(bm, rect, (float)x1, (float)y1, (float)width1, (float)height1, UnitPixel, &attr, nullptr, nullptr); delete bm; } @@ -113,7 +113,7 @@ BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWi bm = new Bitmap(bmp.bmWidth, bmp.bmHeight, bmp.bmWidthBytes, PixelFormat32bppPARGB, (BYTE*)bmp.bmBits); bm->RotateFlip(RotateNoneFlipY); } - else bm = new Bitmap(hbmp, NULL); + else bm = new Bitmap(hbmp, nullptr); ImageAttributes attr; ColorMatrix Matrix = @@ -134,7 +134,7 @@ BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWi else g.SetInterpolationMode(InterpolationModeLowQuality); RectF rect((float)nXOriginDest, (float)nYOriginDest, (float)nWidthDest, (float)nHeightDest); - g.DrawImage(bm, rect, (float)nXOriginSrc, (float)nYOriginSrc, (float)nWidthSrc, (float)nHeightSrc, UnitPixel, &attr, NULL, NULL); + g.DrawImage(bm, rect, (float)nXOriginSrc, (float)nYOriginSrc, (float)nWidthSrc, (float)nHeightSrc, UnitPixel, &attr, nullptr, nullptr); delete bm; return TRUE; } @@ -204,7 +204,7 @@ void GDIPlus_ExtractAnimatedGIF(wchar_t *szName, int width, int height, HBITMAP clipHeight = (int)(xscale*imHeight + .5); HBITMAP hBitmap = ske_CreateDIB32(clipWidth*nFrameCount, height); - HDC hdc = CreateCompatibleDC(NULL); + HDC hdc = CreateCompatibleDC(nullptr); HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hBitmap); Graphics graphics(hdc); ImageAttributes attr; diff --git a/plugins/Clist_modern/src/modern_global.cpp b/plugins/Clist_modern/src/modern_global.cpp index 8ce97e0965..073f4e948b 100644 --- a/plugins/Clist_modern/src/modern_global.cpp +++ b/plugins/Clist_modern/src/modern_global.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Global variables //int hClcProtoCount = 0; -//ClcProtoStatus *clcProto = NULL; -HIMAGELIST g_himlCListClc = NULL; -HICON g_hListeningToIcon = NULL; +//ClcProtoStatus *clcProto = nullptr; +HIMAGELIST g_himlCListClc = nullptr; +HICON g_hListeningToIcon = nullptr; char* g_szMetaModuleName = 0; diff --git a/plugins/Clist_modern/src/modern_global_structure.h b/plugins/Clist_modern/src/modern_global_structure.h index 242dc16c21..c29f3ea5b1 100644 --- a/plugins/Clist_modern/src/modern_global_structure.h +++ b/plugins/Clist_modern/src/modern_global_structure.h @@ -10,71 +10,72 @@ typedef struct tagCLUIDATA ************************************/ // NotifyArea menu - HMENU hMenuNotify; - WORD wNextMenuID; - int iIconNotify; - BOOL bEventAreaEnabled; - BOOL bNotifyActive; - DWORD dwFlags; - int hIconNotify; + HMENU hMenuNotify; + WORD wNextMenuID; + int iIconNotify; + DWORD dwFlags; + int hIconNotify; MCONTACT hUpdateContact; // Contact List View Mode wchar_t groupFilter[2048]; - char protoFilter[2048]; - char varFilter[2048]; - DWORD lastMsgFilter; - char current_viewmode[256], old_viewmode[256]; - BYTE boldHideOffline; - BYTE bOldUseGroups; - DWORD statusMaskFilter; - DWORD stickyMaskFilter; - DWORD filterFlags; - DWORD bFilterEffective; - DWORD t_now; + char protoFilter[2048]; + char varFilter[2048]; + DWORD lastMsgFilter; + char current_viewmode[256], old_viewmode[256]; + BYTE boldHideOffline; + BYTE bOldUseGroups; + DWORD statusMaskFilter; + DWORD stickyMaskFilter; + DWORD filterFlags; + DWORD bFilterEffective; + DWORD t_now; // Modern Global Variables - BOOL fDisableSkinEngine; - BOOL fOnDesktop; - BOOL fSmoothAnimation; - BOOL fLayered; - BOOL fDocked; - BOOL fSortNoOfflineBottom; - BOOL fAutoSize; - BOOL fAeroGlass; - HRGN hAeroGlassRgn; - - BOOL mutexPreventDockMoving; - BOOL mutexOnEdgeSizing; - BOOL mutexPaintLock; - - BYTE bCurrentAlpha; - BYTE bSTATE; - BYTE bBehindEdgeSettings; - BYTE bSortByOrder[3]; + bool bAvsPresent; + bool bEventAreaEnabled; + bool bNotifyActive; + BOOL fDisableSkinEngine; + BOOL fOnDesktop; + BOOL fSmoothAnimation; + BOOL fLayered; + BOOL fDocked; + BOOL fSortNoOfflineBottom; + BOOL fAutoSize; + BOOL fAeroGlass; + HRGN hAeroGlassRgn; + + BOOL mutexPreventDockMoving; + BOOL mutexOnEdgeSizing; + BOOL mutexPaintLock; + + BYTE bCurrentAlpha; + BYTE bSTATE; + BYTE bBehindEdgeSettings; + BYTE bSortByOrder[3]; signed char nBehindEdgeState; - DWORD dwKeyColor; + DWORD dwKeyColor; - HWND hwndEventFrame; + HWND hwndEventFrame; - int LeftClientMargin; - int RightClientMargin; - int TopClientMargin; - int BottomClientMargin; - - BOOL bInternalAwayMsgDiscovery; - BOOL bRemoveAwayMessageForOffline; + int LeftClientMargin; + int RightClientMargin; + int TopClientMargin; + int BottomClientMargin; + BOOL bInternalAwayMsgDiscovery; + BOOL bRemoveAwayMessageForOffline; + //hEventHandles - HANDLE hEventBkgrChanged; - HANDLE hEventStatusBarShowToolTip; - HANDLE hEventStatusBarHideToolTip; - HANDLE hEventSkinServicesCreated; + HANDLE hEventBkgrChanged; + HANDLE hEventStatusBarShowToolTip; + HANDLE hEventStatusBarHideToolTip; + HANDLE hEventSkinServicesCreated; - int nGapBetweenTitlebar; + int nGapBetweenTitlebar; } CLUIDATA; EXTERN_C CLUIDATA g_CluiData; diff --git a/plugins/Clist_modern/src/modern_image_array.cpp b/plugins/Clist_modern/src/modern_image_array.cpp index ff72ce44d0..6be2a08d61 100644 --- a/plugins/Clist_modern/src/modern_image_array.cpp +++ b/plugins/Clist_modern/src/modern_image_array.cpp @@ -45,12 +45,12 @@ static BOOL ImageArray_Alloc(IMAGE_ARRAY_DATA *iad, int size) if (size_grow > iad->nodes_allocated_size) { size_grow += iad->grow_step - (size_grow % iad->grow_step); - if (iad->nodes != NULL) { + if (iad->nodes != nullptr) { IMAGE_ARRAY_DATA_NODE *tmp = (IMAGE_ARRAY_DATA_NODE *)realloc((void *)iad->nodes, sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow); - if (tmp == NULL) { - TRACE("Out of memory: realloc returned NULL (ImageArray_Alloc)"); + if (tmp == nullptr) { + TRACE("Out of memory: realloc returned nullptr (ImageArray_Alloc)"); ImageArray_Free(iad, FALSE); return FALSE; } @@ -61,8 +61,8 @@ static BOOL ImageArray_Alloc(IMAGE_ARRAY_DATA *iad, int size) else { iad->nodes = (IMAGE_ARRAY_DATA_NODE *)malloc(sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow); - if (iad->nodes == NULL) { - TRACE("Out of memory: alloc returned NULL (ImageArray_Alloc)"); + if (iad->nodes == nullptr) { + TRACE("Out of memory: alloc returned nullptr (ImageArray_Alloc)"); ImageArray_Free(iad, FALSE); @@ -83,8 +83,8 @@ static BOOL ImageArray_Alloc(IMAGE_ARRAY_DATA *iad, int size) tmp = (IMAGE_ARRAY_DATA_NODE *)realloc((void *)iad->nodes, sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow); - if (tmp == NULL) { - TRACE("Out of memory: realloc returned NULL when reducing size! (ImageArray_Alloc)"); + if (tmp == nullptr) { + TRACE("Out of memory: realloc returned nullptr when reducing size! (ImageArray_Alloc)"); ImageArray_Free(iad, FALSE); @@ -109,34 +109,34 @@ void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_ste if (iad->grow_step <= 0) { iad->grow_step = 1; } - iad->hdc = CreateCompatibleDC(NULL); - iad->img = NULL; + iad->hdc = CreateCompatibleDC(nullptr); + iad->img = nullptr; iad->width = 0; iad->height = 0; - iad->nodes = NULL; + iad->nodes = nullptr; iad->nodes_allocated_size = 0; iad->nodes_size = 0; } // Free data -// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL +// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return nullptr HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap) { DeleteDC(iad->hdc); - if (iad->img != NULL && !keep_bitmap) { + if (iad->img != nullptr && !keep_bitmap) { DeleteObject(iad->img); - iad->img = NULL; + iad->img = nullptr; iad->width = 0; iad->height = 0; } - if (iad->nodes != NULL) { + if (iad->nodes != nullptr) { free(iad->nodes); - iad->nodes = NULL; + iad->nodes = nullptr; iad->nodes_allocated_size = 0; iad->nodes_size = 0; } @@ -151,16 +151,16 @@ void ImageArray_Clear(IMAGE_ARRAY_DATA *iad) if (iad->hdc) DeleteDC(iad->hdc); iad->hdc = tmpdc; - if (iad->img != NULL) { + if (iad->img != nullptr) { DeleteObject(iad->img); - iad->img = NULL; + iad->img = nullptr; iad->width = 0; iad->height = 0; } - if (iad->nodes != NULL) { + if (iad->nodes != nullptr) { free(iad->nodes); - iad->nodes = NULL; + iad->nodes = nullptr; iad->nodes_allocated_size = 0; iad->nodes_size = 0; } @@ -179,7 +179,7 @@ int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) int i; - if (hBmp == NULL) + if (hBmp == nullptr) return -1; mir_cslock lck(cs); @@ -211,7 +211,7 @@ int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) // Alloc image hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits)); - if (hNewBmp == NULL) + if (hNewBmp == nullptr) return -1; // Alloc array @@ -232,7 +232,7 @@ int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); - SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); + SetBrushOrgEx(iad->hdc, org.x, org.y, nullptr); } { @@ -304,7 +304,7 @@ int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) // restore things SelectObject(hdc_old, old_bmp); DeleteDC(hdc_old); - if (iad->img != NULL) DeleteObject(iad->img); + if (iad->img != nullptr) DeleteObject(iad->img); iad->img = hNewBmp; // Move array @@ -331,7 +331,7 @@ BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) HDC hdc_old; int i; - if (hBmp == NULL) + if (hBmp == nullptr) return FALSE; if (pos < 0) @@ -357,7 +357,7 @@ BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) // Alloc image hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits)); - if (hNewBmp == NULL) + if (hNewBmp == nullptr) return FALSE; // Move image... @@ -371,7 +371,7 @@ BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); - SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); + SetBrushOrgEx(iad->hdc, org.x, org.y, nullptr); } { @@ -442,7 +442,7 @@ BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) // restore things DeleteDC(hdc_old); - if (iad->img != NULL) DeleteObject(iad->img); + if (iad->img != nullptr) DeleteObject(iad->img); iad->img = hNewBmp; // Move array @@ -484,7 +484,7 @@ BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos) // Alloc image hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits)); - if (hNewBmp == NULL) + if (hNewBmp == nullptr) return FALSE; // Move image... @@ -498,7 +498,7 @@ BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos) POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); - SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); + SetBrushOrgEx(iad->hdc, org.x, org.y, nullptr); } { @@ -554,7 +554,7 @@ BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos) // restore things DeleteDC(hdc_old); - if (iad->img != NULL) DeleteObject(iad->img); + if (iad->img != nullptr) DeleteObject(iad->img); iad->img = hNewBmp; // Move array @@ -577,7 +577,7 @@ BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos) BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha) { - if (hdcDest == NULL || pos < 0 || pos >= iad->nodes_size) + if (hdcDest == nullptr || pos < 0 || pos >= iad->nodes_size) return FALSE; mir_cslock lck(cs); diff --git a/plugins/Clist_modern/src/modern_image_array.h b/plugins/Clist_modern/src/modern_image_array.h index 012576acba..90d1b9315e 100644 --- a/plugins/Clist_modern/src/modern_image_array.h +++ b/plugins/Clist_modern/src/modern_image_array.h @@ -65,7 +65,7 @@ void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_ste void ImageArray_Clear(IMAGE_ARRAY_DATA *iad); // Free data -// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL +// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return nullptr HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap); // Add image to the list (return the index of the image or -1 on error) diff --git a/plugins/Clist_modern/src/modern_keyboard.cpp b/plugins/Clist_modern/src/modern_keyboard.cpp index 3cf48c1687..5166ec57de 100644 --- a/plugins/Clist_modern/src/modern_keyboard.cpp +++ b/plugins/Clist_modern/src/modern_keyboard.cpp @@ -34,7 +34,7 @@ INT_PTR hkCloseMiranda(WPARAM, LPARAM) INT_PTR hkRestoreStatus(WPARAM, LPARAM) { - int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE); + int nStatus = db_get_w(0, "CList", "Status", ID_STATUS_OFFLINE); CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); return 0; diff --git a/plugins/Clist_modern/src/modern_log.cpp b/plugins/Clist_modern/src/modern_log.cpp index d051bb359d..10e76ae573 100644 --- a/plugins/Clist_modern/src/modern_log.cpp +++ b/plugins/Clist_modern/src/modern_log.cpp @@ -15,7 +15,7 @@ void Log(const char *file, int line, const char *fmt, ...) char buf[1024]; file_tmp = strrchr(file, '\\'); - if (file_tmp == NULL) + if (file_tmp == nullptr) file_tmp = file; else file_tmp++; diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index 59c897d94b..191619fe4a 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -46,7 +46,7 @@ typedef struct _NodeList struct _NodeList * itemParent; } NodeList; -NodeList * RootNode = NULL; +NodeList * RootNode = nullptr; NodeList * AddNode(NodeList * Parent) { @@ -149,7 +149,7 @@ BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara { NodeList * res1, *res2, *res3; int i = 0; - RootNode = AddNode(NULL); + RootNode = AddNode(nullptr); RootNode->pData = i++; res1 = AddNode(RootNode); res1->pData = i++; @@ -170,7 +170,7 @@ BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara if (RemoveNode(res1)) res1 = 0; TRACE("*********** Nodes DUMP 2 ***********\n"); TraceTreeLevel(RootNode); - //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); + //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(0,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); MessageBox(hwndDlg, L"Init NewRow Dialog", L"Notify", MB_OK); break; } diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp index 9ae57aa286..e5406aea4a 100644 --- a/plugins/Clist_modern/src/modern_row.cpp +++ b/plugins/Clist_modern/src/modern_row.cpp @@ -44,13 +44,13 @@ ROWCELL *cppInitModernRow(ROWCELL ** tabAccess) { int fsize; int seq = 0; - ROWCELL * RowRoot = NULL; + ROWCELL * RowRoot = nullptr; FILE * hFile; int i = 0; - if (!db_get_b(NULL, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return NULL; - tmplbuf = NULL; - if (db_get_b(NULL, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1) - tmplbuf = db_get_sa(NULL, "ModernData", "RowTemplate"); + if (!db_get_b(0, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return nullptr; + tmplbuf = nullptr; + if (db_get_b(0, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1) + tmplbuf = db_get_sa(0, "ModernData", "RowTemplate"); if (tmplbuf) { rowParse(RowRoot, RowRoot, tmplbuf, i, seq, tabAccess); mir_free(tmplbuf); @@ -66,12 +66,12 @@ ROWCELL *cppInitModernRow(ROWCELL ** tabAccess) tmplbuf[i] = 0; i = 0; rowParse(RowRoot, RowRoot, tmplbuf, i, seq, tabAccess); - db_set_s(NULL, "ModernData", "RowTemplate", tmplbuf); + db_set_s(0, "ModernData", "RowTemplate", tmplbuf); free(tmplbuf); fclose(hFile); return RowRoot; } - return NULL; + return nullptr; } @@ -83,7 +83,7 @@ void cppDeleteTree(ROWCELL * RowRoot) int cppCalculateRowHeight(ROWCELL *RowRoot) { - if (RowRoot == NULL) + if (RowRoot == nullptr) return 0; RowRoot->h = 0; RowRoot->w = 0; @@ -125,7 +125,7 @@ void rowDeleteTree(ROWCELL* cell) if (cell->next) rowDeleteTree((ROWCELL*)(cell->next)); free(cell); - cell = NULL; + cell = nullptr; return; } @@ -188,7 +188,7 @@ char * rowParserGetNextWord(char *tbuf, int &hbuf) } hbuf++; } - return NULL; + return nullptr; } // rowParserGetParam @@ -324,7 +324,7 @@ BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &seque if (!parent) { - RowTabAccess[sequence] = NULL; + RowTabAccess[sequence] = nullptr; return TRUE; } @@ -357,7 +357,7 @@ void rowResetEmptyRects(ROWCELL* cell) // void rowCalculateMinSize(ROWCELL* cell) { - ROWCELL* curchild = NULL; + ROWCELL* curchild = nullptr; int w = 0, h = 0; int wl = 0, hl = 0; int fullWidth = 0; @@ -431,7 +431,7 @@ void rowCalculateMinSize(ROWCELL* cell) // void rowEqualize(ROWCELL* cell) { - ROWCELL* curchild = NULL; + ROWCELL* curchild = nullptr; if (!cell) return; rowEqualize(cell->child); rowEqualize(cell->next); @@ -557,7 +557,7 @@ void rowLayerProc(pROWCELL cell, pROWCELL parent) // void rowPositioning(pROWCELL cell, int &dist) { - ROWCELL* curchild = NULL; + ROWCELL* curchild = nullptr; int x = cell->r.left; int y = cell->r.top; diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 1594659f4a..e69b80025a 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -85,10 +85,10 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) return tmp; } - bool hasAvatar = contact->avatar_data != NULL; + bool hasAvatar = contact->avatar_data != nullptr; for (int i = 0;; i++) { ROWCELL *pCell = gl_RowTabAccess[i]; - if (pCell == NULL) + if (pCell == nullptr) break; if (pCell->type != TC_SPACE) { @@ -104,15 +104,15 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) // calculate text width here SIZE size = { 0 }; RECT dummyRect = { 0, 0, 1024, pCell->h }; - HDC hdc = CreateCompatibleDC(NULL); - g_clcPainter.ChangeToFont(hdc, dat, g_clcPainter.GetBasicFontID(contact), NULL); + HDC hdc = CreateCompatibleDC(nullptr); + g_clcPainter.ChangeToFont(hdc, dat, g_clcPainter.GetBasicFontID(contact), nullptr); g_clcPainter.GetTextSize(&size, hdc, dummyRect, contact->szText, contact->ssText.plText, 0, dat->text_resize_smileys ? 0 : contact->ssText.iMaxSmileyHeight); if (contact->type == CLCIT_GROUP) { wchar_t *szCounts = pcli->pfnGetGroupCountsText(dat, contact); if (szCounts && mir_wstrlen(szCounts) > 0) { RECT count_rc = { 0 }; // calc width and height - g_clcPainter.ChangeToFont(hdc, dat, contact->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL); + g_clcPainter.ChangeToFont(hdc, dat, contact->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr); ske_DrawText(hdc, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX); size.cx += count_rc.right - count_rc.left; count_rc.right = 0; @@ -138,8 +138,8 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) // calculate text width here SIZE size = { 0 }; RECT dummyRect = { 0, 0, 1024, pCell->h }; - HDC hdc = CreateCompatibleDC(NULL); - g_clcPainter.ChangeToFont(hdc, dat, FONTID_SECONDLINE, NULL); + HDC hdc = CreateCompatibleDC(nullptr); + g_clcPainter.ChangeToFont(hdc, dat, FONTID_SECONDLINE, nullptr); g_clcPainter.GetTextSize(&size, hdc, dummyRect, pdnce->szSecondLineText, pdnce->ssSecondLine.plText, 0, dat->text_resize_smileys ? 0 : pdnce->ssSecondLine.iMaxSmileyHeight); pCell->w = size.cx; SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); @@ -158,8 +158,8 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) //calculate text width here SIZE size = { 0 }; RECT dummyRect = { 0, 0, 1024, pCell->h }; - HDC hdc = CreateCompatibleDC(NULL); - g_clcPainter.ChangeToFont(hdc, dat, FONTID_THIRDLINE, NULL); + HDC hdc = CreateCompatibleDC(nullptr); + g_clcPainter.ChangeToFont(hdc, dat, FONTID_THIRDLINE, nullptr); g_clcPainter.GetTextSize(&size, hdc, dummyRect, pdnce->szThirdLineText, pdnce->ssThirdLine.plText, 0, dat->text_resize_smileys ? 0 : pdnce->ssThirdLine.iMaxSmileyHeight); pCell->w = size.cx; SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); @@ -199,7 +199,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) case TC_EXTRA: // Draw extra icons if (contact->type == CLCIT_CONTACT && - (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { + (!contact->iSubNumber || db_get_b(0, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { bool hasExtra = false; int width = 0; for (int k = 0; k < dat->extraColumnsCount; k++) @@ -225,7 +225,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) case TC_EXTRA8: case TC_EXTRA9: if (contact->type == CLCIT_CONTACT && - (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { + (!contact->iSubNumber || db_get_b(0, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { int eNum = pCell->type - TC_EXTRA1; if (eNum < dat->extraColumnsCount) if (contact->iExtraImage[eNum] != EMPTY_EXTRA_ICON || !dat->bMetaIgnoreEmptyExtra) { @@ -245,8 +245,8 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) SIZE text_size = { 0 }; RECT rc = { 0 }; // Select font - HDC hdc = CreateCompatibleDC(NULL); - g_clcPainter.ChangeToFont(hdc, dat, FONTID_CONTACT_TIME, NULL); + HDC hdc = CreateCompatibleDC(nullptr); + g_clcPainter.ChangeToFont(hdc, dat, FONTID_CONTACT_TIME, nullptr); // Get text size text_size.cy = ske_DrawText(hdc, szResult, (int)mir_wstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); @@ -276,15 +276,15 @@ BOOL RowHeights_Initialize(struct ClcData *dat) dat->rowHeight = 0; dat->row_heights_size = 0; dat->row_heights_allocated = 0; - dat->row_heights = NULL; + dat->row_heights = nullptr; return TRUE; } void RowHeights_Free(ClcData *dat) { - if (dat->row_heights != NULL) { + if (dat->row_heights != nullptr) { free(dat->row_heights); - dat->row_heights = NULL; + dat->row_heights = nullptr; } dat->row_heights_allocated = 0; @@ -304,10 +304,10 @@ BOOL RowHeights_Alloc(ClcData *dat, int size) size_grow += 100 - (size_grow % 100); - if (dat->row_heights != NULL) { + if (dat->row_heights != nullptr) { int *tmp = (int *)realloc((void *)dat->row_heights, sizeof(int)* size_grow); - if (tmp == NULL) { - TRACE("Out of memory: realloc returned NULL (RowHeights_Alloc)"); + if (tmp == nullptr) { + TRACE("Out of memory: realloc returned nullptr (RowHeights_Alloc)"); RowHeights_Free(dat); return FALSE; } @@ -317,8 +317,8 @@ BOOL RowHeights_Alloc(ClcData *dat, int size) } else { dat->row_heights = (int *)malloc(sizeof(int)* size_grow); - if (dat->row_heights == NULL) { - TRACE("Out of memory: alloc returned NULL (RowHeights_Alloc)"); + if (dat->row_heights == nullptr) { + TRACE("Out of memory: alloc returned nullptr (RowHeights_Alloc)"); RowHeights_Free(dat); return FALSE; } @@ -418,7 +418,7 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) ClcContact *Drawing; if (subindex == -1) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; indent--; @@ -444,7 +444,7 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) RowHeight_CalcRowHeight(dat, Drawing, line_num); // increment by subcontacts - if (group->cl[group->scanIndex]->subcontacts != NULL && group->cl[group->scanIndex]->type != CLCIT_GROUP) { + if (group->cl[group->scanIndex]->subcontacts != nullptr && group->cl[group->scanIndex]->type != CLCIT_GROUP) { if (group->cl[group->scanIndex]->bSubExpanded && dat->bMetaExpanding) { if (subindex < group->cl[group->scanIndex]->iSubAllocated - 1) subindex++; @@ -474,7 +474,7 @@ int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int it DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); //TODO replace futher code with new rowheight definition - BOOL selected = ((item == dat->selection) && (dat->hwndRenameEdit != NULL || dat->bShowSelAlways || (dat->exStyle & CLS_EX_SHOWSELALWAYS) || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER); + BOOL selected = ((item == dat->selection) && (dat->hwndRenameEdit != nullptr || dat->bShowSelAlways || (dat->exStyle & CLS_EX_SHOWSELALWAYS) || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER); BOOL minimalistic = (g_clcPainter.CheckMiniMode(dat, selected)); if (!RowHeights_Alloc(dat, item + 1)) @@ -507,7 +507,7 @@ int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int it } // Avatar size - if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height && contact->type == CLCIT_CONTACT && contact->avatar_data != NULL && !minimalistic) + if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height && contact->type == CLCIT_CONTACT && contact->avatar_data != nullptr && !minimalistic) height = max(height, dat->avatars_maxheight_size); // Checkbox size @@ -517,7 +517,7 @@ int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int it // Icon size if (!dat->icon_ignore_size_for_row_height) { if (contact->type == CLCIT_GROUP || - (contact->type == CLCIT_CONTACT && contact->iImage != -1 && !(dat->icon_hide_on_avatar && dat->avatars_show && contact->avatar_data != NULL && !contact->bImageIsSpecial))) { + (contact->type == CLCIT_CONTACT && contact->iImage != -1 && !(dat->icon_hide_on_avatar && dat->avatars_show && contact->avatar_data != nullptr && !contact->bImageIsSpecial))) { height = max(height, ICON_HEIGHT); } } diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp index 6a41ce3742..c8aaffbded 100644 --- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp +++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp @@ -153,7 +153,7 @@ void rowOptGenerateTreeView(pROWCELL cell, HTREEITEM node, HWND hwnd) int rowOptFillRowTree(HWND hwnd) { TreeView_DeleteAllItems(hwnd); - rowOptGenerateTreeView(rowOptTmplRoot, NULL, hwnd); + rowOptGenerateTreeView(rowOptTmplRoot, nullptr, hwnd); TreeView_Expand(hwnd, TreeView_GetRoot(hwnd), TVM_EXPAND); return 0; } @@ -162,14 +162,14 @@ void rowOptAddContainer(HWND htree, HTREEITEM hti) { TVINSERTSTRUCT tvis; TVITEM tviparent; - ROWCELL *cell = NULL; + ROWCELL *cell = nullptr; if (!hti) { if (TreeView_GetRoot(htree)) return; rowAddCell(rowOptTmplRoot, TC_ROW); - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_ROOT; tvis.item.pszText = L"Line"; tvis.item.lParam = (LPARAM)rowOptTmplRoot; @@ -265,7 +265,7 @@ void rowOptDelContainer(HWND htree, HTREEITEM hti) } - ((pROWCELL)tvi.lParam)->next = NULL; + ((pROWCELL)tvi.lParam)->next = nullptr; rowDeleteTree((pROWCELL)tvi.lParam); { @@ -299,7 +299,7 @@ void RefreshTree(HWND hwndDlg, HTREEITEM hti) HWND htree = GetDlgItem(hwndDlg, IDC_ROWTREE); pROWCELL cell; TVITEM tvi = { 0 }; - if (hti == NULL) hti = TreeView_GetRoot(htree); + if (hti == nullptr) hti = TreeView_GetRoot(htree); while (hti) { tvi.hItem = hti; @@ -335,7 +335,7 @@ void RefreshTree(HWND hwndDlg, HTREEITEM hti) hti = TreeView_GetNextSibling(htree, hti); } - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -347,7 +347,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HWND htree = GetDlgItem(hwndDlg, IDC_ROWTREE); TranslateDialogDefault(hwndDlg); - rowOptTmplStr = db_get_sa(NULL, "ModernData", "RowTemplate"); + rowOptTmplStr = db_get_sa(0, "ModernData", "RowTemplate"); if (!rowOptTmplStr) rowOptTmplStr = mir_strdup(""); @@ -377,14 +377,14 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETCURSEL, 0, 0); rowDeleteTree(rowOptTmplRoot); - rowOptTmplRoot = NULL; + rowOptTmplRoot = nullptr; rowParse(rowOptTmplRoot, rowOptTmplRoot, rowOptTmplStr, hbuf, seq, rowOptTA); seq = 0; memset(rowOptTA, 0, sizeof(rowOptTA)); rowOptBuildTA(rowOptTmplRoot, (pROWCELL*)&rowOptTA, &seq); rowOptFillRowTree(htree); - RefreshTree(hwndDlg, NULL); + RefreshTree(hwndDlg, nullptr); TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_ROWTREE), TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_ROWTREE))); rowOptShowSettings(hwndDlg); } @@ -408,7 +408,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) == CBN_SELENDOK) { int index = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_GETCURSEL, 0, 0); cell->type = index; - RefreshTree(hwndDlg, NULL); + RefreshTree(hwndDlg, nullptr); } case IDC_VALIGN: @@ -424,7 +424,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM cell->valign = TC_BOTTOM; break; } - RefreshTree(hwndDlg, NULL); + RefreshTree(hwndDlg, nullptr); } case IDC_HALIGN: @@ -440,7 +440,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM cell->halign = TC_RIGHT; break; } - RefreshTree(hwndDlg, NULL); + RefreshTree(hwndDlg, nullptr); } } @@ -458,10 +458,10 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (lParam == (LPARAM)GetDlgItem(hwndDlg, IDC_CONTUP)) // Moving container to up { - RedrawWindow(htree, &da, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(htree, &da, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } - RefreshTree(hwndDlg, NULL); - RedrawWindow(GetParent(hwndDlg), NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RefreshTree(hwndDlg, nullptr); + RedrawWindow(GetParent(hwndDlg), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN); } return TRUE; } @@ -472,7 +472,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->code == NM_SETCURSOR) rowOptShowSettings(hwndDlg); if (((LPNMHDR)lParam)->code == NM_CLICK) - RedrawWindow(hwndDlg, &da, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); + RedrawWindow(hwndDlg, &da, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); break; case 0: // Apply or Ok button is pressed diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 943a92cb72..31c8dcfa01 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -64,7 +64,7 @@ typedef struct _HandleServiceParams } HandleServiceParams; static mir_cs csTips; -static HWND hwndToolTips = NULL; +static HWND hwndToolTips = nullptr; int ModernSkinButtonLoadModule() { @@ -73,7 +73,7 @@ int ModernSkinButtonLoadModule() wc.cbSize = sizeof(wc); wc.lpszClassName = _A2W(MODERNSKINBUTTONCLASS); wc.lpfnWndProc = ModernSkinButtonWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(ModernSkinButtonCtrl*); wc.hbrBackground = 0; wc.style = CS_GLOBALCLASS; @@ -94,23 +94,23 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) ModernSkinButtonCtrl* bct = (ModernSkinButtonCtrl *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (!bct) return 0; if (!IsWindowVisible(hwnd)) return 0; - if (!whdc && !g_CluiData.fLayered) InvalidateRect(hwnd, NULL, FALSE); + if (!whdc && !g_CluiData.fLayered) InvalidateRect(hwnd, nullptr, FALSE); if (whdc && g_CluiData.fLayered) hdc = whdc; else { //sdc = GetWindowDC(GetParent(hwnd)); - hdc = CreateCompatibleDC(NULL); + hdc = CreateCompatibleDC(nullptr); } GetClientRect(hwnd, &rc); HBITMAP bmp = ske_CreateDIB32(rc.right, rc.bottom); HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, bmp); if (!g_CluiData.fLayered) - ske_BltBackImage(bct->hwnd, hdc, NULL); + ske_BltBackImage(bct->hwnd, hdc, nullptr); { MODERNMASK Request = { 0 }; // int res; //HBRUSH br = CreateSolidBrush(RGB(255,255,255)); - char * Value = NULL; + char * Value = nullptr; { if (bct->ValueDBSection && bct->ValueTypeDef) { char * key; @@ -128,21 +128,21 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) switch (bct->ValueTypeDef[0]) { case 's': { - Value = db_get_sa(NULL, section, key); + Value = db_get_sa(0, section, key); if (!Value) Value = mir_strdup(bct->ValueTypeDef + 1); break; } case 'd': - defval = db_get_dw(NULL, section, key, defval); + defval = db_get_dw(0, section, key, defval); Value = mir_strdup(_ltoa(defval, buf, _countof(buf))); break; case 'w': - defval = db_get_w(NULL, section, key, defval); + defval = db_get_w(0, section, key, defval); Value = mir_strdup(_ltoa(defval, buf, _countof(buf))); break; case 'b': - defval = db_get_b(NULL, section, key, defval); + defval = db_get_b(0, section, key, defval); Value = mir_strdup(_ltoa(defval, buf, _countof(buf))); break; } @@ -216,31 +216,31 @@ static int ModernSkinButtonToggleDBValue(char * ValueDBSection, char *ValueTypeD switch (ValueTypeDef[0]) { case 's': - Value = db_get_sa(NULL, section, key); + Value = db_get_sa(0, section, key); if (!Value || (Value && !mir_strcmpi(Value, val2))) Value = mir_strdup(val); else Value = mir_strdup(val2); - db_set_s(NULL, section, key, Value); + db_set_s(0, section, key, Value); mir_free(Value); break; case 'd': - curval = db_get_dw(NULL, section, key, l2); + curval = db_get_dw(0, section, key, l2); curval = (curval == l2) ? l1 : l2; - db_set_dw(NULL, section, key, (DWORD)curval); + db_set_dw(0, section, key, (DWORD)curval); break; case 'w': - curval = db_get_w(NULL, section, key, l2); + curval = db_get_w(0, section, key, l2); curval = (curval == l2) ? l1 : l2; - db_set_w(NULL, section, key, (WORD)curval); + db_set_w(0, section, key, (WORD)curval); break; case 'b': - curval = db_get_b(NULL, section, key, l2); + curval = db_get_b(0, section, key, l2); curval = (curval == l2) ? l1 : l2; - db_set_b(NULL, section, key, (BYTE)curval); + db_set_b(0, section, key, (BYTE)curval); break; } mir_free(section); @@ -279,7 +279,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) *param2 = '\0'; param2++; _skipblank(param2); if (mir_strlen(param2) == 0) - param2 = NULL; + param2 = nullptr; } char *param1 = strrchr(pszService, '%'); if (param1) { @@ -287,7 +287,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) *param1 = '\0'; param1++; _skipblank(param1); if (mir_strlen(param1) == 0) - param1 = NULL; + param1 = nullptr; } if (param1 && *param1 == '\"') { param1++; @@ -305,7 +305,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) if (paramCount == 1) { param1 = param2; - param2 = NULL; + param2 = nullptr; } if (!ServiceExists(pszService)) { result = 0; @@ -325,7 +325,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : 0; if (bct) { if (bct->HandleService && IsBadStringPtrA(bct->HandleService, 255)) - bct->HandleService = NULL; + bct->HandleService = nullptr; else if (bct->HandleService && ServiceExists(bct->HandleService)) { HandleServiceParams MSG = { 0 }; MSG.hwnd = hwndDlg; @@ -345,7 +345,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w return TRUE; case WM_DESTROY: - if (bct == NULL) + if (bct == nullptr) break; if (hwndToolTips) { @@ -360,7 +360,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { DestroyWindow(hwndToolTips); - hwndToolTips = NULL; + hwndToolTips = nullptr; } } mir_free(bct->ID); @@ -376,7 +376,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w case WM_SETCURSOR: { - HCURSOR hCurs1 = LoadCursor(NULL, IDC_ARROW); + HCURSOR hCurs1 = LoadCursor(nullptr, IDC_ARROW); if (hCurs1) SetCursor(hCurs1); if (bct) SetToolTip(hwndDlg, bct->Hint); } @@ -426,10 +426,10 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w SetForegroundWindow(GetParent(bct->hwnd)); ModernSkinButtonPaintWorker(bct->hwnd, 0); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) - bct->CommandService = NULL; + bct->CommandService = nullptr; if (bct->fCallOnPress) { if (bct->CommandService) { - if (!_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) + if (!_CallServiceStrParams(bct->CommandService, nullptr) && (bct->ValueDBSection && bct->ValueTypeDef)) ModernSkinButtonToggleDBValue(bct->ValueDBSection, bct->ValueTypeDef); } bct->down = 0; @@ -446,9 +446,9 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w bct->down = 0; ModernSkinButtonPaintWorker(bct->hwnd, 0); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) - bct->CommandService = NULL; + bct->CommandService = nullptr; if (bct->CommandService) - if (_CallServiceStrParams(bct->CommandService, NULL)) { + if (_CallServiceStrParams(bct->CommandService, nullptr)) { } else if (bct->ValueDBSection && bct->ValueTypeDef) ModernSkinButtonToggleDBValue(bct->ValueDBSection, bct->ValueTypeDef); @@ -463,11 +463,11 @@ HWND SetToolTip(HWND hwnd, wchar_t * tip) if (!tip) return 0; mir_cslock lck(csTips); if (!hwndToolTips) { - hwndToolTips = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, + hwndToolTips = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, NULL, g_hMirApp, NULL); + hwnd, nullptr, g_hMirApp, nullptr); SetWindowPos(hwndToolTips, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -500,7 +500,7 @@ typedef struct _MButton ModernSkinButtonCtrl * bct; } MButton; -MButton * Buttons = NULL; +MButton * Buttons = nullptr; DWORD ButtonsCount = 0; #define _center_h( rc ) (((rc)->right + (rc)->left ) >> 1) @@ -558,12 +558,12 @@ int ModernSkinButton_AddButton(HWND parent, bct->HandleService = mir_strdup(HandeService); bct->CommandService = mir_strdup(CommandService); bct->StateService = mir_strdup(StateDefService); - if (DBkey && *DBkey != '\0') bct->ValueDBSection = mir_strdup(DBkey); else bct->ValueDBSection = NULL; + if (DBkey && *DBkey != '\0') bct->ValueDBSection = mir_strdup(DBkey); else bct->ValueDBSection = nullptr; if (TypeDef && *TypeDef != '\0') bct->ValueTypeDef = mir_strdup(TypeDef); else bct->ValueTypeDef = mir_strdup("sDefault"); bct->ID = mir_strdup(ID); bct->Hint = mir_wstrdup(Hint); Buttons[ButtonsCount].bct = bct; - Buttons[ButtonsCount].hwnd = NULL; + Buttons[ButtonsCount].hwnd = nullptr; Buttons[ButtonsCount].OrL = Left; Buttons[ButtonsCount].OrT = Top; Buttons[ButtonsCount].OrR = Right; @@ -588,7 +588,7 @@ static int ModernSkinButtonErase(int l, int t, int r, int b) if (!g_pCachedWindow->hImageDC || !g_pCachedWindow->hBackDC) return 0; if (!(l || r || t || b)) { for (i = 0; i < ButtonsCount; i++) { - if (pcli->hwndContactList && Buttons[i].hwnd != NULL) { + if (pcli->hwndContactList && Buttons[i].hwnd != nullptr) { //TODO: Erase button BitBlt(g_pCachedWindow->hImageDC, Buttons[i].bct->Left, Buttons[i].bct->Top, Buttons[i].bct->Right - Buttons[i].bct->Left, Buttons[i].bct->Bottom - Buttons[i].bct->Top, g_pCachedWindow->hBackDC, Buttons[i].bct->Left, Buttons[i].bct->Top, SRCCOPY); @@ -605,10 +605,10 @@ static HWND ModernSkinButtonCreateWindow(ModernSkinButtonCtrl * bct, HWND parent { HWND hwnd; - if (bct == NULL) return FALSE; + if (bct == nullptr) return FALSE; { wchar_t *UnicodeID = mir_a2u(bct->ID); - hwnd = CreateWindow(_A2W(MODERNSKINBUTTONCLASS), UnicodeID, WS_VISIBLE | WS_CHILD, bct->Left, bct->Top, bct->Right - bct->Left, bct->Bottom - bct->Top, parent, NULL, g_hInst, NULL); + hwnd = CreateWindow(_A2W(MODERNSKINBUTTONCLASS), UnicodeID, WS_VISIBLE | WS_CHILD, bct->Left, bct->Top, bct->Right - bct->Left, bct->Bottom - bct->Top, parent, nullptr, g_hInst, nullptr); mir_free(UnicodeID); } @@ -623,7 +623,7 @@ int ModernSkinButtonRedrawAll() if (!ModernSkinButtonModuleIsLoaded) return 0; g_mutex_bLockUpdating++; for (DWORD i = 0; i < ButtonsCount; i++) { - if (pcli->hwndContactList && Buttons[i].hwnd == NULL) + if (pcli->hwndContactList && Buttons[i].hwnd == nullptr) Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, pcli->hwndContactList); ModernSkinButtonPaintWorker(Buttons[i].hwnd, 0); } @@ -673,7 +673,7 @@ int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *pRect) rc.bottom = rc.top + (clr.bottom - clr.top); for (DWORD i = 0; i < ButtonsCount; i++) { int sbFlags = Buttons[i].ConstrainPositionFrom; - if (parent && Buttons[i].hwnd == NULL) { + if (parent && Buttons[i].hwnd == nullptr) { Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, parent); altDraw = FALSE; } diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 97f8bb31a5..e56ec5762a 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -59,20 +59,20 @@ struct tga_header_t /* Global variables */ SKINOBJECTSLIST g_SkinObjectList = { 0 }; -CURRWNDIMAGEDATA *g_pCachedWindow = NULL; +CURRWNDIMAGEDATA *g_pCachedWindow = nullptr; BOOL g_flag_bPostWasCanceled = FALSE; BOOL g_flag_bFullRepaint = FALSE; BOOL g_mutex_bLockUpdating = FALSE; -SortedList *gl_plGlyphTexts = NULL; -SortedList *gl_plSkinFonts = NULL; +SortedList *gl_plGlyphTexts = nullptr; +SortedList *gl_plSkinFonts = nullptr; /* Private module variables */ static HANDLE hSkinLoadedEvent; -static GLYPHIMAGE *pLoadedImages = NULL; +static GLYPHIMAGE *pLoadedImages = nullptr; static DWORD dwLoadedImagesCount = 0; static DWORD dwLoadedImagesAlocated = 0; @@ -81,8 +81,8 @@ static BOOL flag_bJustDrawNonFramedObjects = FALSE; static BOOL mutex_bLockUpdate = FALSE; static LIST arEffectStack(10, HandleKeySortT); -static SKINOBJECTSLIST *pCurrentSkin = NULL; -static char **pszSettingName = NULL; +static SKINOBJECTSLIST *pCurrentSkin = nullptr; +static char **pszSettingName = nullptr; static int nArrayLen = 0; static BYTE pbGammaWeight[256] = { 0 }; @@ -91,7 +91,7 @@ static BOOL bGammaWeightFilled = FALSE; static mir_cs cs_SkinChanging; -static LISTMODERNMASK *MainModernMaskList = NULL; +static LISTMODERNMASK *MainModernMaskList = nullptr; /* Private module procedures */ static BOOL ske_GetMaskBit(BYTE *line, int x); @@ -127,7 +127,7 @@ IniParser::IniParser(wchar_t * tcsFileName, BYTE flags) : _Flags(flags) } _hFile = _wfopen(tcsFileName, L"r"); - if (_hFile != NULL) { + if (_hFile != nullptr) { _eType = IT_FILE; _isValid = true; } @@ -148,9 +148,9 @@ IniParser::~IniParser() FreeResource(_hGlobalRes); } - _szSection = NULL; - _hGlobalRes = NULL; - _hFile = NULL; + _szSection = nullptr; + _hGlobalRes = nullptr; + _hFile = nullptr; _isValid = false; _eType = IT_UNKNOWN; } @@ -182,19 +182,19 @@ HRESULT IniParser::WriteStrToDb(const char * szSection, const char * szName, con switch (szValue[0]) { case 'b': - db_set_b(NULL, szSection, szName, (BYTE)atoi(szValue + 1)); + db_set_b(0, szSection, szName, (BYTE)atoi(szValue + 1)); break; case 'w': - db_set_w(NULL, szSection, szName, (WORD)atoi(szValue + 1)); + db_set_w(0, szSection, szName, (WORD)atoi(szValue + 1)); break; case 'd': - db_set_dw(NULL, szSection, szName, (DWORD)atoi(szValue + 1)); + db_set_dw(0, szSection, szName, (DWORD)atoi(szValue + 1)); break; case 's': - db_set_s(NULL, szSection, szName, szValue + 1); + db_set_s(0, szSection, szName, szValue + 1); break; } return S_OK; @@ -228,12 +228,12 @@ void IniParser::_DoInit() { _isValid = false; _eType = IT_UNKNOWN; - _szSection = NULL; - _hFile = NULL; - _hGlobalRes = NULL; + _szSection = nullptr; + _hFile = nullptr; + _hGlobalRes = nullptr; _dwSizeOfRes = 0; - _pPosition = NULL; - _pLineCallBackProc = NULL; + _pPosition = nullptr; + _pLineCallBackProc = nullptr; _SecCheck = 0; } @@ -261,7 +261,7 @@ HRESULT IniParser::_DoParseFile() { char szLine[MAX_LINE_LEN]; _nLine = 0; - while (fgets(szLine, _countof(szLine), _hFile) != NULL) { + while (fgets(szLine, _countof(szLine), _hFile) != nullptr) { size_t len = 0; char * pLine = (char*)_RemoveTailings(szLine, len); if (len > 0) { @@ -328,7 +328,7 @@ BOOL IniParser::_DoParseLine(char *szLine) case '[': //New section start here mir_free(_szSection); - _szSection = NULL; + _szSection = nullptr; { char *tbuf = szLine + 1; // skip [ @@ -386,7 +386,7 @@ HRESULT SkinEngineLoadModule() //init variables g_SkinObjectList.dwObjLPAlocated = 0; g_SkinObjectList.dwObjLPReserved = 0; - g_SkinObjectList.pObjects = NULL; + g_SkinObjectList.pObjects = nullptr; // Initialize GDI+ InitGdiPlus(); AniAva_InitModule(); @@ -426,7 +426,7 @@ int SkinEngineUnloadModule() DeleteObject(g_pCachedWindow->hImageDIB); DeleteDC(g_pCachedWindow->hBackDC); DeleteDC(g_pCachedWindow->hImageDC); - ReleaseDC(NULL, g_pCachedWindow->hScreenDC); + ReleaseDC(nullptr, g_pCachedWindow->hScreenDC); mir_free_and_nil(g_pCachedWindow); } GdiFlush(); @@ -490,7 +490,7 @@ HDC ske_RequestBufferDC(HDC hdcOwner, int dcID, int width, int height, BOOL fCle DCBUFFER buf; buf.hdcOwnedBy = hdcOwner; buf.nUsageID = dcID; - buf.hDC = NULL; + buf.hDC = nullptr; DCBUFFER *pBuf = BufferList.find(&buf); if (!pBuf) { //if not found - allocate it @@ -530,7 +530,7 @@ int ske_ReleaseBufferDC(HDC hDC, int keepTime) for (int i = 0; i < BufferList.getCount(); i++) { DCBUFFER *pBuf = BufferList[i]; if (pBuf) { - if (hDC != NULL && pBuf->hDC == hDC) { + if (hDC != nullptr && pBuf->hDC == hDC) { pBuf->dwDestroyAfterTime = dwCurrentTime + keepTime; break; } @@ -551,7 +551,7 @@ int ske_ReleaseBufferDC(HDC hDC, int keepTime) BOOL ske_SetRgnOpaque(HDC memdc, HRGN hrgn, BOOL force) { if (g_CluiData.fDisableSkinEngine && !force) return TRUE; - DWORD rgnsz = GetRegionData(hrgn, 0, NULL); + DWORD rgnsz = GetRegionData(hrgn, 0, nullptr); RGNDATA *rdata = (RGNDATA *)mir_alloc(rgnsz); GetRegionData(hrgn, rgnsz, rdata); RECT *rect = (RECT *)rdata->Buffer; @@ -616,8 +616,8 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r //initializations if (mode == FM_STRETCH) { - HDC mem2dc = NULL; - HBITMAP mem2bmp = NULL, oldbmp = NULL; + HDC mem2dc = nullptr; + HBITMAP mem2bmp = nullptr, oldbmp = nullptr; RECT wr; IntersectRect(&wr, rClip, rFill); if ((wr.bottom - wr.top)*(wr.right - wr.left) == 0) return 0; @@ -816,7 +816,7 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r HBITMAP oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); #ifdef _DEBUG if (!oldbmp) - (NULL, "Tile bitmap not selected", "ERROR", MB_OK); + (nullptr, "Tile bitmap not selected", "ERROR", MB_OK); #endif /// draw here { @@ -888,13 +888,13 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r HBITMAP ske_CreateDIB32(int cx, int cy) { - return ske_CreateDIB32Point(cx, cy, NULL); + return ske_CreateDIB32Point(cx, cy, nullptr); } HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits) { if (cx < 0 || cy < 0) - return NULL; + return nullptr; BITMAPINFO RGB32BitsBITMAPINFO = { 0 }; RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -905,31 +905,31 @@ HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits) // pointer used for direct Bitmap pixels access UINT *ptPixels; - HBITMAP DirectBitmap = CreateDIBSection(NULL, + HBITMAP DirectBitmap = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, - NULL, 0); - if ((DirectBitmap == NULL || ptPixels == NULL) && cx != 0 && cy != 0) { + nullptr, 0); + if ((DirectBitmap == nullptr || ptPixels == nullptr) && cx != 0 && cy != 0) { #ifdef _DEBUG - MessageBoxA(NULL, "Object not allocated. Check GDI object count", "ERROR", MB_OK | MB_ICONERROR); + MessageBoxA(nullptr, "Object not allocated. Check GDI object count", "ERROR", MB_OK | MB_ICONERROR); DebugBreak(); #endif ; } else memset(ptPixels, 0, cx*cy * 4); - if (bits != NULL) *bits = ptPixels; + if (bits != nullptr) *bits = ptPixels; return DirectBitmap; } HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque) { if (!g_pCachedWindow) - return NULL; + return nullptr; RGBQUAD *buf = (RGBQUAD *)g_pCachedWindow->hImageDIBByte; - if (buf == NULL) - return NULL; + if (buf == nullptr) + return nullptr; unsigned int cRect = 64; PRGNDATA pRgnData = (PRGNDATA)mir_alloc(sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT)); @@ -975,14 +975,14 @@ HRGN ske_CreateOpaqueRgn(BYTE 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); mir_free(pRgnData); return hRgn; } static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) { - HDC memdc = NULL, glyphdc = NULL; + HDC memdc = nullptr, glyphdc = nullptr; int k = 0; //BITMAP bmp = {0}; HBITMAP membmp = 0, oldbmp = 0, oldglyph = 0; @@ -1015,7 +1015,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) memdc = CreateCompatibleDC(preq->hDC); membmp = ske_CreateDIB32(PRect.right - PRect.left, PRect.bottom - PRect.top); oldbmp = (HBITMAP)SelectObject(memdc, membmp); - if (oldbmp == NULL) { + if (oldbmp == nullptr) { if (mode == 2) { SelectObject(memdc, oldbmp); DeleteDC(memdc); @@ -1334,10 +1334,10 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT } { //filling new objects field sk->pObjects[sk->dwObjLPAlocated].bType = lpDescr->bType; - sk->pObjects[sk->dwObjLPAlocated].Data = NULL; + sk->pObjects[sk->dwObjLPAlocated].Data = nullptr; sk->pObjects[sk->dwObjLPAlocated].szObjectID = mir_strdup(lpDescr->szObjectID); // sk->Objects[sk->dwObjLPAlocated].szObjectName = mir_strdup(lpDescr->szObjectName); - if (lpDescr->Data != NULL) { //Copy defaults values + if (lpDescr->Data != nullptr) { //Copy defaults values switch (lpDescr->bType) { case OT_GLYPHOBJECT: { @@ -1345,13 +1345,13 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT sk->pObjects[sk->dwObjLPAlocated].Data = mir_alloc(sizeof(GLYPHOBJECT)); GLYPHOBJECT *obdat = (GLYPHOBJECT*)sk->pObjects[sk->dwObjLPAlocated].Data; memcpy(obdat, gl, sizeof(GLYPHOBJECT)); - if (gl->szFileName != NULL) { + if (gl->szFileName != nullptr) { obdat->szFileName = mir_strdup(gl->szFileName); mir_free_and_nil(gl->szFileName); } - else obdat->szFileName = NULL; + else obdat->szFileName = nullptr; - obdat->hGlyph = NULL; + obdat->hGlyph = nullptr; break; } } @@ -1364,26 +1364,26 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT static LPSKINOBJECTDESCRIPTOR ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin) { - SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; + SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; return skin_FindObjectByRequest((char *)szName, sk->pMaskList); } static LPSKINOBJECTDESCRIPTOR ske_FindObjectByMask(MODERNMASK *pModernMask, SKINOBJECTSLIST *Skin) { - SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; - return sk->pMaskList ? skin_FindObjectByMask(pModernMask, sk->pMaskList) : NULL; + SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; + return sk->pMaskList ? skin_FindObjectByMask(pModernMask, sk->pMaskList) : nullptr; } LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin) { - SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; + SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; for (DWORD i = 0; i < sk->dwObjLPAlocated; i++) { if (sk->pObjects[i].bType == objType || objType == OT_ANY) { if (!mir_strcmp(sk->pObjects[i].szObjectID, szName)) return &(sk->pObjects[i]); } } - return NULL; + return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -1395,21 +1395,21 @@ LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, S INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam) { LPSKINDRAWREQUEST preq = (LPSKINDRAWREQUEST)wParam; - if (preq == NULL) + if (preq == nullptr) return -1; mir_cslock lck(cs_SkinChanging); - LPSKINOBJECTDESCRIPTOR pgl = (lParam ? ske_FindObjectByMask((MODERNMASK*)lParam, NULL) : ske_FindObject(preq->szObjectID, NULL)); - if (pgl == NULL) return -1; - if (pgl->Data == NULL) return -1; + LPSKINOBJECTDESCRIPTOR pgl = (lParam ? ske_FindObjectByMask((MODERNMASK*)lParam, nullptr) : ske_FindObject(preq->szObjectID, nullptr)); + if (pgl == nullptr) return -1; + if (pgl->Data == nullptr) return -1; LPGLYPHOBJECT gl = (LPGLYPHOBJECT)pgl->Data; int iStyle = gl->Style & 7; if (iStyle == ST_SKIP) return ST_SKIP; - if (gl->hGlyph == NULL && gl->hGlyph != (HBITMAP)-1 && (iStyle == ST_IMAGE || iStyle == ST_FRAGMENT || iStyle == ST_SOLARIZE)) { + if (gl->hGlyph == nullptr && gl->hGlyph != (HBITMAP)-1 && (iStyle == ST_IMAGE || iStyle == ST_FRAGMENT || iStyle == ST_SOLARIZE)) { if (gl->szFileName) { gl->hGlyph = ske_LoadGlyphImage(_A2T(gl->szFileName)); if (gl->hGlyph) { @@ -1438,7 +1438,7 @@ void ske_PreMultiplyChannels(HBITMAP hbmp, BYTE Mult) bh = bmp.bmHeight; bw = bmp.bmWidth; Len = bh*bw * 4; - flag = (bmp.bmBits == NULL); + flag = (bmp.bmBits == nullptr); if (flag) { pBitmapBits = (LPBYTE)mir_alloc(Len); GetBitmapBits(hbmp, Len, pBitmapBits); @@ -1469,13 +1469,13 @@ void ske_PreMultiplyChannels(HBITMAP hbmp, BYTE Mult) int ske_GetFullFilename(wchar_t *buf, const wchar_t *file, wchar_t *skinfolder, BOOL madeAbsolute) { - wchar_t *SkinPlace = db_get_wsa(NULL, SKIN, "SkinFolder"); - if (SkinPlace == NULL) + wchar_t *SkinPlace = db_get_wsa(0, SKIN, "SkinFolder"); + if (SkinPlace == nullptr) SkinPlace = mir_wstrdup(L"\\Skin\\default"); wchar_t b2[MAX_PATH]; if (file[0] != '\\' && file[1] != ':') - mir_snwprintf(b2, L"%s\\%s", (skinfolder == NULL) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : L"", file); + mir_snwprintf(b2, L"%s\\%s", (skinfolder == nullptr) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : L"", file); else mir_wstrncpy(b2, file, _countof(b2)); @@ -1499,8 +1499,8 @@ Major part of routines is from http://tfcduke.developpez.com/tutoriel/format/tga static BOOL ske_ReadTGAImageData(void * From, DWORD fromSize, BYTE * destBuf, DWORD bufSize, BOOL RLE) { BYTE * pos = destBuf; - BYTE * from = fromSize ? (BYTE*)From : NULL; - FILE * fp = !fromSize ? (FILE*)From : NULL; + BYTE * from = fromSize ? (BYTE*)From : nullptr; + FILE * fp = !fromSize ? (FILE*)From : nullptr; DWORD destCount = 0; DWORD fromCount = 0; if (!RLE) { @@ -1559,23 +1559,23 @@ static BOOL ske_ReadTGAImageData(void * From, DWORD fromSize, BYTE * destBuf, DW static HBITMAP ske_LoadGlyphImage_TGA(const wchar_t *szFilename) { - BYTE *colormap = NULL; + BYTE *colormap = nullptr; int cx = 0, cy = 0; BOOL err = FALSE; tga_header_t header; - if (!szFilename) return NULL; + if (!szFilename) return nullptr; if (!wildcmpiw(szFilename, L"*\\*%.tga")) { //Loading TGA image from file FILE *fp = _wfopen(szFilename, L"rb"); if (!fp) { TRACEVAR("error: couldn't open \"%s\"!\n", szFilename); - return NULL; + return nullptr; } /* read header */ fread(&header, sizeof(tga_header_t), 1, fp); if ((header.pixel_depth != 32) || ((header.image_type != 10) && (header.image_type != 2))) { fclose(fp); - return NULL; + return nullptr; } /*memory allocation */ @@ -1590,9 +1590,9 @@ static HBITMAP ske_LoadGlyphImage_TGA(const wchar_t *szFilename) else { /* reading from resources IDR_TGA_DEFAULT_SKIN */ HRSRC hRSrc = FindResourceA(g_hInst, MAKEINTRESOURCEA(IDR_TGA_DEFAULT_SKIN), "TGA"); - if (!hRSrc) return NULL; + if (!hRSrc) return nullptr; HGLOBAL hRes = LoadResource(g_hInst, hRSrc); - if (!hRes) return NULL; + if (!hRes) return nullptr; DWORD size = SizeofResource(g_hInst, hRSrc); BYTE *mem = (BYTE*)LockResource(hRes); if (size > sizeof(header)) { @@ -1615,17 +1615,17 @@ static HBITMAP ske_LoadGlyphImage_TGA(const wchar_t *szFilename) mir_free(colormap); return hbmp; } - return NULL; + return nullptr; } static HBITMAP ske_LoadGlyphImageByDecoders(const wchar_t *tszFileName) { if (!wcschr(tszFileName, '%') && !PathFileExists(tszFileName)) - return NULL; + return nullptr; const wchar_t *ext = wcsrchr(tszFileName, '.'); - if (ext == NULL) - return NULL; + if (ext == nullptr) + return nullptr; BITMAP bmpInfo; HBITMAP hBitmap; @@ -1637,15 +1637,15 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const wchar_t *tszFileName) } else hBitmap = Bitmap_Load(tszFileName); - if (hBitmap == NULL) - return NULL; + if (hBitmap == nullptr) + return nullptr; GetObject(hBitmap, sizeof(BITMAP), &bmpInfo); if (bmpInfo.bmBitsPixel == 32) ske_PreMultiplyChannels(hBitmap, f); else { - HDC dc32 = CreateCompatibleDC(NULL); - HDC dc24 = CreateCompatibleDC(NULL); + HDC dc32 = CreateCompatibleDC(nullptr); + HDC dc24 = CreateCompatibleDC(nullptr); HBITMAP hBitmap32 = ske_CreateDIB32(bmpInfo.bmWidth, bmpInfo.bmHeight); HBITMAP obmp24 = (HBITMAP)SelectObject(dc24, hBitmap); HBITMAP obmp32 = (HBITMAP)SelectObject(dc32, hBitmap32); @@ -1688,14 +1688,14 @@ HBITMAP ske_LoadGlyphImage(const wchar_t *tszFileName) // load new image HBITMAP hbmp = ske_skinLoadGlyphImage(szFile); - if (hbmp == NULL) - return NULL; + if (hbmp == nullptr) + return nullptr; // add to loaded list if (dwLoadedImagesCount + 1 > dwLoadedImagesAlocated) { pLoadedImages = (GLYPHIMAGE*)mir_realloc(pLoadedImages, sizeof(GLYPHIMAGE)*(dwLoadedImagesCount + 1)); if (!pLoadedImages) - return NULL; + return nullptr; dwLoadedImagesAlocated++; } @@ -1761,7 +1761,7 @@ int ske_UnloadSkin(SKINOBJECTSLIST * Skin) GLYPHOBJECT *dt = (GLYPHOBJECT*)Skin->pObjects[i].Data; if (dt->hGlyph && dt->hGlyph != (HBITMAP)-1) ske_UnloadGlyphImage(dt->hGlyph); - dt->hGlyph = NULL; + dt->hGlyph = nullptr; mir_free_and_nil(dt->szFileName); if (dt->plTextList && dt->plTextList->realCount > 0) { @@ -1784,7 +1784,7 @@ int ske_UnloadSkin(SKINOBJECTSLIST * Skin) mir_free_and_nil(Skin->pObjects[i].szObjectID); } mir_free_and_nil(Skin->pObjects); - Skin->pTextList = NULL; + Skin->pTextList = nullptr; Skin->dwObjLPAlocated = 0; Skin->dwObjLPReserved = 0; return 0; @@ -1830,7 +1830,7 @@ static int ske_ProcessLoadindString(const char *szSetting, char *szValue) static int ske_enumdb_SkinObjectsProc(const char *szSetting, LPARAM) { - ptrA value(db_get_sa(NULL, SKIN, szSetting)); + ptrA value(db_get_sa(0, SKIN, szSetting)); ske_ProcessLoadindString(szSetting, value); return 0; } @@ -1857,7 +1857,7 @@ static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList) GLYPHTEXT *glText = (GLYPHTEXT *)pObjectList->pTextList->items[i]; SKINOBJECTDESCRIPTOR *lpobj = ske_FindObjectByName(glText->szObjectName, OT_GLYPHOBJECT, pObjectList); mir_free_and_nil(glText->szObjectName); - GLYPHOBJECT *globj = NULL; + GLYPHOBJECT *globj = nullptr; if (lpobj) globj = (GLYPHOBJECT*)lpobj->Data; if (globj) { @@ -1867,7 +1867,7 @@ static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList) } List_Insert(globj->plTextList, (void*)glText, globj->plTextList->realCount); qsort(globj->plTextList->items, globj->plTextList->realCount, sizeof(void*), (int(*)(const void*, const void*))globj->plTextList->sortFunc); - pObjectList->pTextList->items[i] = NULL; + pObjectList->pTextList->items[i] = nullptr; } else { GLYPHTEXT *gt = glText; @@ -1889,9 +1889,9 @@ static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList) static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) { - if (Skin == NULL) return 0; + if (Skin == nullptr) return 0; ske_UnloadSkin(Skin); - g_CluiData.fDisableSkinEngine = db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fDisableSkinEngine = db_get_b(0, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); // window borders if (g_CluiData.fDisableSkinEngine) { g_CluiData.LeftClientMargin = 0; @@ -1901,10 +1901,10 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) } else { // window borders - g_CluiData.LeftClientMargin = (int)db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT); - g_CluiData.RightClientMargin = (int)db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT); - g_CluiData.TopClientMargin = (int)db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT); - g_CluiData.BottomClientMargin = (int)db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT); + g_CluiData.LeftClientMargin = (int)db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT); + g_CluiData.RightClientMargin = (int)db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT); + g_CluiData.TopClientMargin = (int)db_get_b(0, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT); + g_CluiData.BottomClientMargin = (int)db_get_b(0, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT); } if (g_CluiData.fDisableSkinEngine) @@ -1912,8 +1912,8 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) Skin->pMaskList = (LISTMODERNMASK*)mir_alloc(sizeof(LISTMODERNMASK)); memset(Skin->pMaskList, 0, sizeof(LISTMODERNMASK)); - Skin->szSkinPlace = db_get_wsa(NULL, SKIN, "SkinFolder"); - if (!Skin->szSkinPlace || (wcschr(Skin->szSkinPlace, '%') && !db_get_b(NULL, SKIN, "Modified", 0))) { + Skin->szSkinPlace = db_get_wsa(0, SKIN, "SkinFolder"); + if (!Skin->szSkinPlace || (wcschr(Skin->szSkinPlace, '%') && !db_get_b(0, SKIN, "Modified", 0))) { BOOL bOnlyObjects = FALSE; if (Skin->szSkinPlace && wcschr(Skin->szSkinPlace, '%')) bOnlyObjects = TRUE; @@ -1924,7 +1924,7 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) // Load objects pCurrentSkin = Skin; - db_enum_settings(NULL, ske_enumdb_SkinObjectsProc, SKIN); + db_enum_settings(0, ske_enumdb_SkinObjectsProc, SKIN); SortMaskList(pCurrentSkin->pMaskList); ske_LinkSkinObjects(pCurrentSkin); @@ -1937,7 +1937,7 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) void ske_LoadSkinFromDB(void) { ske_GetSkinFromDB(SKIN, &g_SkinObjectList); - g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); + g_CluiData.dwKeyColor = db_get_dw(0, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); } static int ske_LoadSkinFromResource(BOOL bOnlyObjects) @@ -1945,8 +1945,8 @@ static int ske_LoadSkinFromResource(BOOL bOnlyObjects) IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS); if (parser.CheckOK()) { db_delete_module(0, "ModernSkin"); - db_set_s(NULL, SKIN, "SkinFolder", "%Default%"); - db_set_s(NULL, SKIN, "SkinFile", "%Default%"); + db_set_s(0, SKIN, "SkinFolder", "%Default%"); + db_set_s(0, SKIN, "SkinFile", "%Default%"); parser.Parse(IniParser::WriteStrToDb, 0); } return 0; @@ -1968,8 +1968,8 @@ int ske_LoadSkinFromIniFile(wchar_t *szFileName, BOOL bOnlyObjects) IniParser::GetSkinFolder(szFileName, skinFolder); PathToRelativeW(szFileName, skinFile); - db_set_ws(NULL, SKIN, "SkinFolder", skinFolder); - db_set_ws(NULL, SKIN, "SkinFile", skinFile); + db_set_ws(0, SKIN, "SkinFolder", skinFolder); + db_set_ws(0, SKIN, "SkinFile", skinFile); parser.Parse(IniParser::WriteStrToDb, 1); return 0; @@ -2024,7 +2024,7 @@ bool ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD Second return ske_ResetTextEffect(hdc); EFFECTSSTACKITEM *effect = arEffectStack.find((EFFECTSSTACKITEM*)&hdc); - if (effect == NULL) { + if (effect == nullptr) { effect = (EFFECTSSTACKITEM *)mir_alloc(sizeof(EFFECTSSTACKITEM)); effect->hdc = hdc; arEffectStack.insert(effect); @@ -2042,7 +2042,7 @@ static bool ske_GetTextEffect(HDC hdc, MODERNEFFECT *modernEffect) return false; EFFECTSSTACKITEM *effect = arEffectStack.find((EFFECTSSTACKITEM*)&hdc); - if (effect == NULL) + if (effect == nullptr) return false; modernEffect->EffectID = effect->EffectID; @@ -2129,14 +2129,14 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he for (matrixVer = mcTopStart; matrixVer < mcBottomEnd; matrixVer++) { int buflineStep = width*(matrixVer - 2); int as = y + matrixVer - 2; - sbyte * buflineTopS = NULL; + sbyte * buflineTopS = nullptr; if (as >= 0 && (DWORD)as < height) buflineTopS = buflineMid + buflineStep; for (matrixHor = mcLeftStart; matrixHor < mcRightEnd; matrixHor++) { buflineTop = buflineTopS; int a = x + matrixHor - 2; if (buflineTop && a >= 0 && (DWORD)a < width) buflineTop += matrixHor - 2; - else buflineTop = NULL; + else buflineTop = nullptr; if (buflineTop) val += ((*buflineTop)*matrix[matrixVer * 5 + matrixHor]); } @@ -2198,10 +2198,10 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, static WORD redMulTbl[256]; // red coefficient multiplication table if (_tables_empty) { // fill tables - double gammaCfPw = 1000 / (double)DBGetContactSettingRangedWord(NULL, "ModernData", "AlphaTextOutGamma", 700, 1, 5000); - BYTE blueCf = db_get_b(NULL, "ModernData", "AlphaTextOutBlueCorrection", 28); - BYTE redCf = db_get_b(NULL, "ModernData", "AlphaTextOutRed Correction", 77); - BYTE greenCf = db_get_b(NULL, "ModernData", "AlphaTextOutGreen Correction", 151); + double gammaCfPw = 1000 / (double)DBGetContactSettingRangedWord(0, "ModernData", "AlphaTextOutGamma", 700, 1, 5000); + BYTE blueCf = db_get_b(0, "ModernData", "AlphaTextOutBlueCorrection", 28); + BYTE redCf = db_get_b(0, "ModernData", "AlphaTextOutRed Correction", 77); + BYTE greenCf = db_get_b(0, "ModernData", "AlphaTextOutGreen Correction", 151); for (int i = 0; i < 256; i++) { gammaTbl[i] = (BYTE)(255 * pow((double)i / 255, gammaCfPw)); @@ -2220,7 +2220,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, BITMAP bmpDest; GetObject(hDestBitmap, sizeof(BITMAP), &bmpDest); - bool destHasNotDIB = (bmpDest.bmBits == NULL); + bool destHasNotDIB = (bmpDest.bmBits == nullptr); BYTE *pDestBits; if (destHasNotDIB) { pDestBits = (BYTE*)mir_alloc(bmpDest.bmHeight * bmpDest.bmWidthBytes); @@ -2262,9 +2262,9 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, // Calc count of visible chars int visibleCharCount = nCount; if (workRectWidth > szEllipsis.cx) - GetTextExtentExPoint(hOffscreenDC, lpString, nCount, workRectWidth - szEllipsis.cx, &visibleCharCount, NULL, &textSize); + GetTextExtentExPoint(hOffscreenDC, lpString, nCount, workRectWidth - szEllipsis.cx, &visibleCharCount, nullptr, &textSize); else - GetTextExtentExPoint(hOffscreenDC, lpString, nCount, 0, &visibleCharCount, NULL, &textSize); + GetTextExtentExPoint(hOffscreenDC, lpString, nCount, 0, &visibleCharCount, nullptr, &textSize); // replace end of string by elipsis bNeedFreeWorkString = TRUE; @@ -2307,15 +2307,15 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, // probably here are mess ofscreen and temp buff dc //Create bitmap image for offscreen - BYTE *bits = NULL; + BYTE *bits = nullptr; HBITMAP hbmp = ske_CreateDIB32Point(textSize.cx, textSize.cy, (void**)&bits); - if (bits != NULL) { + if (bits != nullptr) { HBITMAP holdbmp = (HBITMAP)SelectObject(hOffscreenDC, hbmp); //Create buffer bitmap image for temp text - BYTE *bufbits = NULL; + BYTE *bufbits = nullptr; HBITMAP bufbmp = ske_CreateDIB32Point(textSize.cx, textSize.cy, (void**)&bufbits); - if (bufbits != NULL) { + if (bufbits != nullptr) { HDC bufDC = CreateCompatibleDC(hDC); HBITMAP bufoldbmp = (HBITMAP)SelectObject(bufDC, bufbmp); HFONT hOldBufFont = (HFONT)SelectObject(bufDC, hFont); @@ -2539,10 +2539,10 @@ BOOL ske_ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int alpha = 255; HICON hIcon = ske_ImageList_GetIcon(himl, i); - if (hIcon == NULL) + if (hIcon == nullptr) return FALSE; - ske_DrawIconEx(hdcDst, x, y, hIcon, dx ? dx : GetSystemMetrics(SM_CXSMICON), dy ? dy : GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL | (alpha << 24)); + ske_DrawIconEx(hdcDst, x, y, hIcon, dx ? dx : GetSystemMetrics(SM_CXSMICON), dy ? dy : GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL | (alpha << 24)); DestroyIcon(hIcon); return TRUE; } @@ -2562,7 +2562,7 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i ICONINFO ici; BYTE alpha = (BYTE)((diFlags & 0xFF000000) >> 24); - HBITMAP tBmp = NULL; + HBITMAP tBmp = nullptr; BYTE *imbits, *imimagbits, *immaskbits; BYTE *t1, *t2, *t3; @@ -2602,14 +2602,14 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i DeleteDC(tempDC1); } - bool NoDIBImage = (imbt.bmBits == NULL); + bool NoDIBImage = (imbt.bmBits == nullptr); if (NoDIBImage) { imimagbits = (BYTE*)mir_alloc(cy*imbt.bmWidthBytes); GetBitmapBits(ici.hbmColor, cy*imbt.bmWidthBytes, (void*)imimagbits); } else imimagbits = (BYTE*)imbt.bmBits; - if (immaskbt.bmBits == NULL) { + if (immaskbt.bmBits == nullptr) { immaskbits = (BYTE*)mir_alloc(cy*immaskbt.bmWidthBytes); GetBitmapBits(ici.hbmMask, cy*immaskbt.bmWidthBytes, (void*)immaskbits); } @@ -2620,7 +2620,7 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i DWORD cx = imbt.bmWidth; HBITMAP imBmp = ske_CreateDIB32Point(cx, icy, (void**)&imbits); HBITMAP oldBmp = (HBITMAP)SelectObject(imDC, imBmp); - if (imbits != NULL && imimagbits != NULL && immaskbits != NULL) { + if (imbits != nullptr && imimagbits != nullptr && immaskbits != nullptr) { int x, y; int mwb = immaskbt.bmWidthBytes; int mwb2 = imbt.bmWidthBytes; @@ -2684,8 +2684,8 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i BLENDFUNCTION bf = { AC_SRC_OVER, diFlags & 128, alpha, AC_SRC_ALPHA }; ske_AlphaBlend(hdcDst, xLeft, yTop, cxWidth, cyWidth, imDC, 0, 0, cx, icy, bf); - if (immaskbt.bmBits == NULL) mir_free(immaskbits); - if (imbt.bmBits == NULL) mir_free(imimagbits); + if (immaskbt.bmBits == nullptr) mir_free(immaskbits); + if (imbt.bmBits == nullptr) mir_free(imimagbits); SelectObject(imDC, oldBmp); DeleteObject(imBmp); if (no32bit)DeleteObject(tBmp); @@ -2714,14 +2714,14 @@ int ske_RedrawCompleteWindow() ske_DrawNonFramedObjects(TRUE, 0); CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); } - else RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + else RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } // Request to repaint frame or change/drop callback data // wParam = hWnd of called frame -// lParam = pointer to sPaintRequest (or NULL to redraw all) +// lParam = pointer to sPaintRequest (or nullptr to redraw all) // return 2 - already queued, data updated, 1-have been queued, 0 - failure static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) // Immideately recall paint routines for frame and refresh image @@ -2738,11 +2738,11 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) // wnd = g_rcEdgeSizingRect; if (!g_CluiData.fLayered) { - RedrawWindow((HWND)wParam, NULL, NULL, RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + RedrawWindow((HWND)wParam, nullptr, nullptr, RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } - if (g_pCachedWindow == NULL) ske_ValidateFrameImageProc(&wnd); + if (g_pCachedWindow == nullptr) ske_ValidateFrameImageProc(&wnd); else if (g_pCachedWindow->Width != wnd.right - wnd.left || g_pCachedWindow->Height != wnd.bottom - wnd.top) ske_ValidateFrameImageProc(&wnd); else if (wParam == 0) ske_ValidateFrameImageProc(&wnd); else { // all Ok Update Single Frame @@ -2784,10 +2784,10 @@ static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) FRAMEWND *frm = FindFrameByItsHWND((HWND)wParam); sPaintRequest *pr = (sPaintRequest*)lParam; if (!g_CluiData.fLayered || (frm && frm->floating)) - return InvalidateRect((HWND)wParam, pr ? (RECT*)&(pr->rcUpdate) : NULL, FALSE); + return InvalidateRect((HWND)wParam, pr ? (RECT*)&(pr->rcUpdate) : nullptr, FALSE); if (frm) { - if (frm->PaintCallbackProc != NULL) { + if (frm->PaintCallbackProc != nullptr) { frm->PaintData = (sPaintRequest *)pr; frm->bQueued = 1; if (pr) { @@ -2984,7 +2984,7 @@ int ske_BltBackImage(HWND destHWND, HDC destDC, RECT *BltClientRect) FillRect(destDC, BltClientRect, GetSysColorBrush(COLOR_3DFACE)); return 0; } - ske_ReCreateBackImage(FALSE, NULL); + ske_ReCreateBackImage(FALSE, nullptr); if (BltClientRect) w = *BltClientRect; else GetClientRect(destHWND, &w); ptChildWnd.x = w.left; @@ -3004,10 +3004,10 @@ int ske_ReCreateBackImage(BOOL Erase, RECT *w) GetClientRect(pcli->hwndContactList, &wnd); if (w) wnd = *w; //-- Check cached. - if (g_pCachedWindow == NULL) { + if (g_pCachedWindow == nullptr) { //-- Create New Cache g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); - g_pCachedWindow->hScreenDC = GetDC(NULL); + g_pCachedWindow->hScreenDC = GetDC(nullptr); g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); g_pCachedWindow->Width = wnd.right - wnd.left; @@ -3022,7 +3022,7 @@ int ske_ReCreateBackImage(BOOL Erase, RECT *w) } if (g_pCachedWindow->Width != wnd.right - wnd.left || g_pCachedWindow->Height != wnd.bottom - wnd.top) { - HBITMAP hb1 = NULL, hb2 = NULL; + HBITMAP hb1 = nullptr, hb2 = nullptr; g_pCachedWindow->Width = wnd.right - wnd.left; g_pCachedWindow->Height = wnd.bottom - wnd.top; if (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0) { @@ -3060,7 +3060,7 @@ int ske_DrawNonFramedObjects(BOOL Erase, RECT *r) if (r) w = *r; else CLUI_SizingGetWindowRect(pcli->hwndContactList, &w); if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); - if (g_pCachedWindow == NULL) + if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&w); wnd = w; @@ -3103,10 +3103,10 @@ int ske_ValidateFrameImageProc(RECT *r) g_mutex_bLockUpdating = 1; //-- Check cached. - if (g_pCachedWindow == NULL) { + if (g_pCachedWindow == nullptr) { //-- Create New Cache g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); - g_pCachedWindow->hScreenDC = GetDC(NULL); + g_pCachedWindow->hScreenDC = GetDC(nullptr); g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); g_pCachedWindow->Width = wnd.right - wnd.left; @@ -3184,7 +3184,7 @@ int ske_UpdateWindowImageRect(RECT *r) // Up RECT wnd = *r; if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); - if (g_pCachedWindow == NULL) return ske_ValidateFrameImageProc(&wnd); + if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&wnd); if (g_pCachedWindow->Width != wnd.right - wnd.left || g_pCachedWindow->Height != wnd.bottom - wnd.top) return ske_ValidateFrameImageProc(&wnd); if (g_flag_bFullRepaint) { g_flag_bFullRepaint = 0; @@ -3251,7 +3251,7 @@ int ske_JustUpdateWindowImageRect(RECT *rty) g_CluiData.fAeroGlass = false; CLUI_UpdateAeroGlass(); } - else InvalidateRect(pcli->hwndContactList, NULL, TRUE); + else InvalidateRect(pcli->hwndContactList, nullptr, TRUE); return 0; } @@ -3326,7 +3326,7 @@ wchar_t* ske_ReplaceVar(wchar_t *var) wchar_t *ske_ParseText(wchar_t *stzText) { size_t len = mir_wstrlen(stzText); - wchar_t *result = NULL; + wchar_t *result = nullptr; size_t stpos = 0, curpos = 0; while (curpos < len) { @@ -3431,7 +3431,7 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString) mir_strncpy(logfont.lfFaceName, GetParamN(szDefineString, buf, sizeof(buf), 0, ',', TRUE), _countof(logfont.lfFaceName)); logfont.lfHeight = atoi(GetParamN(szDefineString, buf, sizeof(buf), 1, ',', TRUE)); if (logfont.lfHeight < 0) { - HDC hdc = CreateCompatibleDC(NULL); + HDC hdc = CreateCompatibleDC(nullptr); logfont.lfHeight = (long)-MulDiv(logfont.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); DeleteDC(hdc); } @@ -3550,7 +3550,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) BITMAP bmp_bottom = { 0 }; BITMAP bmp_bottom_mask = { 0 }; - HDC tempDC = CreateCompatibleDC(NULL); + HDC tempDC = CreateCompatibleDC(nullptr); BYTE *ptPixels; HBITMAP nImage = ske_CreateDIB32Point(16, 16, (void**)&ptPixels); @@ -3646,8 +3646,8 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) if (!bmp_top_mask.bmBits) mir_free(TopMaskBuffer); } else { - ske_DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, NULL, DI_NORMAL); - ske_DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, NULL, DI_NORMAL | (alpha << 24)); + ske_DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, nullptr, DI_NORMAL); + ske_DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, nullptr, DI_NORMAL | (alpha << 24)); } DeleteObject(iciBottom.hbmColor); @@ -3661,13 +3661,13 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) BYTE p[32] = { 0 }; HBITMAP nMask = CreateBitmap(16, 16, 1, 1, (void*)&p); { - HDC tempDC2 = CreateCompatibleDC(NULL); - HDC tempDC3 = CreateCompatibleDC(NULL); + HDC tempDC2 = CreateCompatibleDC(nullptr); + HDC tempDC3 = CreateCompatibleDC(nullptr); HBITMAP hbm = CreateCompatibleBitmap(tempDC3, 16, 16); HBITMAP obmp = (HBITMAP)SelectObject(tempDC2, nMask); HBITMAP obmp2 = (HBITMAP)SelectObject(tempDC3, hbm); - DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, NULL, DI_MASK); - DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, NULL, DI_MASK); + DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, nullptr, DI_MASK); + DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, nullptr, DI_MASK); BitBlt(tempDC2, 0, 0, 16, 16, tempDC3, 0, 0, SRCAND); SelectObject(tempDC2, obmp); SelectObject(tempDC3, obmp2); diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index f636a3ece5..0c74046d59 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -36,7 +36,7 @@ struct SkinListData wchar_t File[MAX_PATH]; }; -HBITMAP hPreviewBitmap = NULL; +HBITMAP hPreviewBitmap = nullptr; HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data); HTREEITEM AddSkinToListFullName(HWND hwndDlg, wchar_t *fullName); HTREEITEM AddSkinToList(HWND hwndDlg, wchar_t *path, wchar_t *file); @@ -149,10 +149,10 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara Sync(CLUIFrames_OnMoving, pcli->hwndContactList, &rc); if (g_hCLUIOptionsWnd) { - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); } } break; @@ -220,19 +220,19 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara Clist_Broadcast(INTM_RELOADOPTIONS, 0, 0); NotifyEventHooks(g_CluiData.hEventBkgrChanged, 0, 0); Clist_Broadcast(INTM_INVALIDATE, 0, 0); - RedrawWindow(GetParent(pcli->hwndContactTree), NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); + RedrawWindow(GetParent(pcli->hwndContactTree), nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); } break; case IDC_TREE1: NMTREEVIEW *nmtv = (NMTREEVIEW *)lParam; - if (nmtv == NULL) + if (nmtv == nullptr) return 0; if (nmtv->hdr.code == TVN_SELCHANGED) { if (hPreviewBitmap) { ske_UnloadGlyphImage(hPreviewBitmap); - hPreviewBitmap = NULL; + hPreviewBitmap = nullptr; } if (nmtv->itemNew.lParam) { @@ -252,7 +252,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_APPLY_SKIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_INFO), TRUE); if (hPreviewBitmap) - InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), nullptr, TRUE); else { //prepare text HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); if (hti == 0) @@ -351,7 +351,7 @@ HTREEITEM FillAvailableSkinList(HWND hwndDlg) SearchSkinFiles(hwndDlg, SkinsFolder); { wchar_t skinfull[MAX_PATH]; - ptrW skinfile(db_get_wsa(NULL, SKIN, "SkinFile")); + ptrW skinfile(db_get_wsa(0, SKIN, "SkinFile")); if (skinfile) { PathToAbsoluteW(skinfile, skinfull); res = AddSkinToListFullName(hwndDlg, skinfull); @@ -403,7 +403,7 @@ HTREEITEM AddSkinToList(HWND hwndDlg, wchar_t * path, wchar_t* file) HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, wchar_t * Caption, void * data) { - HTREEITEM tmp = NULL; + HTREEITEM tmp = nullptr; if (Parent) tmp = TreeView_GetChild(hTree, Parent); else @@ -437,7 +437,7 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, wchar_t * Caption, void * data HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data) { - HTREEITEM cItem = NULL; + HTREEITEM cItem = nullptr; //Insert item node cItem = FindChild(hTree, 0, itemName, data); if (!cItem) { @@ -455,14 +455,14 @@ HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data) INT_PTR SvcActiveSkin(WPARAM, LPARAM) { - ptrW skinfile(db_get_wsa(NULL, SKIN, "SkinFile")); + ptrW skinfile(db_get_wsa(0, SKIN, "SkinFile")); if (skinfile) { wchar_t skinfull[MAX_PATH]; PathToAbsoluteW(skinfile, skinfull); return (INT_PTR)mir_wstrdup(skinfull); } - return NULL; + return 0; } INT_PTR SvcApplySkin(WPARAM, LPARAM lParam) @@ -488,10 +488,10 @@ INT_PTR SvcApplySkin(WPARAM, LPARAM lParam) g_mutex_bChangingMode = FALSE; if (g_hCLUIOptionsWnd) { - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); - SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); + SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); } return 0; } diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 951e2b0144..01b73ea92d 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -79,7 +79,7 @@ static int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) if (mmTemplateList->dwMaskCnt == 1) { SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[0])); mir_free_and_nil(mmTemplateList->pl_Masks); - mmTemplateList->pl_Masks = NULL; + mmTemplateList->pl_Masks = nullptr; mmTemplateList->dwMaskCnt--; } else { @@ -147,8 +147,8 @@ static BOOL _GetParamValue(char *szText, unsigned int &start, unsigned int lengt paramlen = 0; valuelen = 0; - value = NULL; - param = NULL; + value = nullptr; + param = nullptr; except = EXCEPTION_EQUAL; param = curChar; @@ -175,7 +175,7 @@ static BOOL _GetParamValue(char *szText, unsigned int &start, unsigned int lengt if (state == STATE_PARAM) { // no parameter name only value value = param; - param = NULL; + param = nullptr; paramlen = 0; state = STATE_VALUE; } @@ -345,7 +345,7 @@ SKINOBJECTDESCRIPTOR* skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK *mmTe if (CompareModernMask(mm, &(mmTemplateList->pl_Masks[i]))) return (SKINOBJECTDESCRIPTOR*)mmTemplateList->pl_Masks[i].pObject; - return NULL; + return nullptr; } SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mmTemplateList) @@ -354,7 +354,7 @@ SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mm mmTemplateList = g_SkinObjectList.pMaskList; if (!mmTemplateList) - return NULL; + return nullptr; MODERNMASK mm = { 0 }; ParseToModernMask(&mm, szValue); @@ -470,7 +470,7 @@ int RegisterButtonByParce(char * ObjectName, char * Params) + ((TL[4] == 'I') ? SBF_CALL_ON_PRESS : 0); if (a) return ModernSkinButton_AddButton(pcli->hwndContactList, ObjectName + 1, pServiceName, pStatusServiceName, "\0", Left, Top, Right, Bottom, alingnto, TranslateW(Hint), Section, Type, MinWidth, MinHeight); - return ModernSkinButton_AddButton(pcli->hwndContactList, ObjectName + 1, pServiceName, pStatusServiceName, "\0", Left, Top, Right, Bottom, alingnto, TranslateW(Hint), NULL, NULL, MinWidth, MinHeight); + return ModernSkinButton_AddButton(pcli->hwndContactList, ObjectName + 1, pServiceName, pStatusServiceName, "\0", Left, Top, Right, Bottom, alingnto, TranslateW(Hint), nullptr, nullptr, MinWidth, MinHeight); } //Parse DB string and add object @@ -542,7 +542,7 @@ int RegisterObjectByParce(char *ObjectName, char *Params) else gl.Style = ST_SKIP; // None obj.Data = ≷ - int res = ske_AddDescriptorToSkinObjectList(&obj, NULL); + int res = ske_AddDescriptorToSkinObjectList(&obj, nullptr); mir_free_and_nil(obj.szObjectID); mir_free_and_nil(gl.szFileName); return res; diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 0284519c59..ee88bafa9a 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -10,8 +10,8 @@ POINT lastpnt; #define TM_STATUSBAR 23435234 #define TM_STATUSBARHIDE 23435235 -HWND hModernStatusBar = NULL; -HANDLE hFramehModernStatusBar = NULL; +HWND hModernStatusBar = nullptr; +HANDLE hFramehModernStatusBar = nullptr; #define DBFONTF_BOLD 1 #define DBFONTF_ITALIC 2 @@ -62,31 +62,31 @@ char* ApendSubSetting(char * buf, int size, char *first, char *second) int LoadStatusBarData() { - g_StatusBarData.perProtoConfig = db_get_b(NULL, "CLUI", "SBarPerProto", SETTING_SBARPERPROTO_DEFAULT); - g_StatusBarData.bShowProtoIcon = (db_get_b(NULL, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 1) != 0; - g_StatusBarData.bShowProtoName = (db_get_b(NULL, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 2) != 0; - g_StatusBarData.bShowStatusName = (db_get_b(NULL, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 4) != 0; - g_StatusBarData.xStatusMode = db_get_b(NULL, "CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); - g_StatusBarData.bConnectingIcon = db_get_b(NULL, "CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT) != 0; - g_StatusBarData.bShowProtoEmails = db_get_b(NULL, "CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT) != 0; - g_StatusBarData.SBarRightClk = db_get_b(NULL, "CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); - - g_StatusBarData.nProtosPerLine = db_get_b(NULL, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT); - g_StatusBarData.Align = db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT); - g_StatusBarData.VAlign = db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT); - g_StatusBarData.sameWidth = db_get_b(NULL, "CLUI", "EqualSections", SETTING_EQUALSECTIONS_DEFAULT); - g_StatusBarData.rectBorders.left = db_get_dw(NULL, "CLUI", "LeftOffset", SETTING_LEFTOFFSET_DEFAULT); - g_StatusBarData.rectBorders.right = db_get_dw(NULL, "CLUI", "RightOffset", SETTING_RIGHTOFFSET_DEFAULT); - g_StatusBarData.rectBorders.top = db_get_dw(NULL, "CLUI", "TopOffset", SETTING_TOPOFFSET_DEFAULT); - g_StatusBarData.rectBorders.bottom = db_get_dw(NULL, "CLUI", "BottomOffset", SETTING_BOTTOMOFFSET_DEFAULT); - g_StatusBarData.extraspace = (BYTE)db_get_dw(NULL, "CLUI", "SpaceBetween", SETTING_SPACEBETWEEN_DEFAULT); + g_StatusBarData.perProtoConfig = db_get_b(0, "CLUI", "SBarPerProto", SETTING_SBARPERPROTO_DEFAULT); + g_StatusBarData.bShowProtoIcon = (db_get_b(0, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 1) != 0; + g_StatusBarData.bShowProtoName = (db_get_b(0, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 2) != 0; + g_StatusBarData.bShowStatusName = (db_get_b(0, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT) & 4) != 0; + g_StatusBarData.xStatusMode = db_get_b(0, "CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); + g_StatusBarData.bConnectingIcon = db_get_b(0, "CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT) != 0; + g_StatusBarData.bShowProtoEmails = db_get_b(0, "CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT) != 0; + g_StatusBarData.SBarRightClk = db_get_b(0, "CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); + + g_StatusBarData.nProtosPerLine = db_get_b(0, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT); + g_StatusBarData.Align = db_get_b(0, "CLUI", "Align", SETTING_ALIGN_DEFAULT); + g_StatusBarData.VAlign = db_get_b(0, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT); + g_StatusBarData.sameWidth = db_get_b(0, "CLUI", "EqualSections", SETTING_EQUALSECTIONS_DEFAULT); + g_StatusBarData.rectBorders.left = db_get_dw(0, "CLUI", "LeftOffset", SETTING_LEFTOFFSET_DEFAULT); + g_StatusBarData.rectBorders.right = db_get_dw(0, "CLUI", "RightOffset", SETTING_RIGHTOFFSET_DEFAULT); + g_StatusBarData.rectBorders.top = db_get_dw(0, "CLUI", "TopOffset", SETTING_TOPOFFSET_DEFAULT); + g_StatusBarData.rectBorders.bottom = db_get_dw(0, "CLUI", "BottomOffset", SETTING_BOTTOMOFFSET_DEFAULT); + g_StatusBarData.extraspace = (BYTE)db_get_dw(0, "CLUI", "SpaceBetween", SETTING_SPACEBETWEEN_DEFAULT); if (g_StatusBarData.BarFont) { DeleteObject(g_StatusBarData.BarFont); - g_StatusBarData.BarFont = NULL; + g_StatusBarData.BarFont = nullptr; } - int vis = db_get_b(NULL, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT); + int vis = db_get_b(0, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT); int frameID = Sync(FindFrameID, hModernStatusBar); int frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frameID), 0); frameopt = frameopt & (~F_VISIBLE); @@ -97,21 +97,21 @@ int LoadStatusBarData() else ShowWindow(hModernStatusBar, SW_HIDE); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frameID), frameopt); - g_StatusBarData.TextEffectID = db_get_b(NULL, "StatusBar", "TextEffectID", SETTING_TEXTEFFECTID_DEFAULT); - g_StatusBarData.TextEffectColor1 = db_get_dw(NULL, "StatusBar", "TextEffectColor1", SETTING_TEXTEFFECTCOLOR1_DEFAULT); - g_StatusBarData.TextEffectColor2 = db_get_dw(NULL, "StatusBar", "TextEffectColor2", SETTING_TEXTEFFECTCOLOR2_DEFAULT); + g_StatusBarData.TextEffectID = db_get_b(0, "StatusBar", "TextEffectID", SETTING_TEXTEFFECTID_DEFAULT); + g_StatusBarData.TextEffectColor1 = db_get_dw(0, "StatusBar", "TextEffectColor1", SETTING_TEXTEFFECTCOLOR1_DEFAULT); + g_StatusBarData.TextEffectColor2 = db_get_dw(0, "StatusBar", "TextEffectColor2", SETTING_TEXTEFFECTCOLOR2_DEFAULT); - if (g_StatusBarData.hBmpBackground) { DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground = NULL; } + if (g_StatusBarData.hBmpBackground) { DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { g_StatusBarData.bkColour = cliGetColor("StatusBar", "BkColour", CLCDEFAULT_BKCOLOUR); - if (db_get_b(NULL, "StatusBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmapName(db_get_wsa(NULL, "StatusBar", "BkBitmap")); + if (db_get_b(0, "StatusBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmapName(db_get_wsa(0, "StatusBar", "BkBitmap")); if (tszBitmapName) g_StatusBarData.hBmpBackground = Bitmap_Load(tszBitmapName); } - g_StatusBarData.bkUseWinColors = db_get_b(NULL, "StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - g_StatusBarData.backgroundBmpUse = db_get_w(NULL, "StatusBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + g_StatusBarData.bkUseWinColors = db_get_b(0, "StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + g_StatusBarData.backgroundBmpUse = db_get_w(0, "StatusBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); @@ -138,7 +138,7 @@ int ModernDrawStatusBar(HWND hwnd, HDC hDC) if (GetParent(hwnd) == pcli->hwndContactList) return ModernDrawStatusBarWorker(hwnd, hDC); - cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, nullptr, FALSE); return 0; } @@ -158,8 +158,8 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) } else SkinDrawGlyph(hDC, &rc, &rc, "Main,ID=StatusBar"); - g_StatusBarData.nProtosPerLine = db_get_b(NULL, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT); - HFONT hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_STATUSBAR_PROTONAME, NULL); + g_StatusBarData.nProtosPerLine = db_get_b(0, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT); + HFONT hOldFont = g_clcPainter.ChangeToFont(hDC, nullptr, FONTID_STATUSBAR_PROTONAME, nullptr); SIZE textSize = { 0 }; GetTextExtentPoint32A(hDC, " ", 1, &textSize); @@ -186,40 +186,40 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) char buf[256]; mir_snprintf(buf, "SBarAccountIsCustom_%s", szProto); - ProtoItemData *p = NULL; + ProtoItemData *p = nullptr; - if (g_StatusBarData.perProtoConfig && db_get_b(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT)) { + if (g_StatusBarData.perProtoConfig && db_get_b(0, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT)) { mir_snprintf(buf, "HideAccount_%s", szProto); - if (db_get_b(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT)) { + if (db_get_b(0, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT)) { iProtoInStatusMenu++; continue; } mir_snprintf(buf, "SBarShow_%s", szProto); - BYTE showOps = db_get_b(NULL, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); + BYTE showOps = db_get_b(0, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); p = new ProtoItemData; p->bShowProtoIcon = (showOps & 1) != 0; p->bShowProtoName = (showOps & 2) != 0; p->bShowStatusName = (showOps & 4) != 0; mir_snprintf(buf, "ShowXStatus_%s", szProto); - p->xStatusMode = db_get_b(NULL, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); + p->xStatusMode = db_get_b(0, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); mir_snprintf(buf, "UseConnectingIcon_%s", szProto); - p->bConnectingIcon = db_get_b(NULL, "CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT) != 0; + p->bConnectingIcon = db_get_b(0, "CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT) != 0; mir_snprintf(buf, "ShowUnreadEmails_%s", szProto); - p->bShowProtoEmails = db_get_b(NULL, "CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT) != 0; + p->bShowProtoEmails = db_get_b(0, "CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT) != 0; mir_snprintf(buf, "SBarRightClk_%s", szProto); - p->SBarRightClk = db_get_b(NULL, "CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT) != 0; + p->SBarRightClk = db_get_b(0, "CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT) != 0; mir_snprintf(buf, "PaddingLeft_%s", szProto); - p->PaddingLeft = db_get_dw(NULL, "CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); + p->PaddingLeft = db_get_dw(0, "CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); mir_snprintf(buf, "PaddingRight_%s", szProto); - p->PaddingRight = db_get_dw(NULL, "CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); + p->PaddingRight = db_get_dw(0, "CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); } else { p = new ProtoItemData; @@ -341,7 +341,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (p.bShowProtoIcon) { w += iconWidth + 1; - p.extraIcon = NULL; + p.extraIcon = nullptr; if ((p.xStatusMode & 8) && p.iProtoStatus > ID_STATUS_OFFLINE) { wchar_t str[512]; CUSTOM_STATUS cs = { sizeof(cs) }; @@ -428,8 +428,8 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) r.left += g_StatusBarData.rectBorders.left + aligndx; for (int i = 0; i < visProtoCount; i++) { ProtoItemData &p = ProtosData[line*protosperline + i]; - HICON hIcon = NULL; - HICON hxIcon = NULL; + HICON hIcon = nullptr; + HICON hxIcon = nullptr; BOOL bNeedDestroy = false; int x = r.left; x += p.PaddingLeft; @@ -447,13 +447,13 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) else if ((p.xStatusMode & 3) == 1) { hIcon = hxIcon; bNeedDestroy = true; - hxIcon = NULL; + hxIcon = nullptr; } } } } - if (hIcon == NULL && (hxIcon == NULL || ((p.xStatusMode & 3) == 3))) { + if (hIcon == nullptr && (hxIcon == nullptr || ((p.xStatusMode & 3) == 3))) { if ((p.bConnectingIcon == 1) && IsStatusConnecting(p.iProtoStatus)) { hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)p.szAccountName, 0); if (hIcon) @@ -484,25 +484,25 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if ((p.xStatusMode & 3) == 3) { if (hIcon) - ske_DrawIconEx(hDC, x, iconY, hIcon, iconWidth, iconHeight, 0, NULL, DI_NORMAL | dim); + ske_DrawIconEx(hDC, x, iconY, hIcon, iconWidth, iconHeight, 0, nullptr, DI_NORMAL | dim); if (hxIcon) { - ske_DrawIconEx(hDC, x + iconWidth + 1, iconY, hxIcon, iconWidth, iconHeight, 0, NULL, DI_NORMAL | dim); + ske_DrawIconEx(hDC, x + iconWidth + 1, iconY, hxIcon, iconWidth, iconHeight, 0, nullptr, DI_NORMAL | dim); x += iconWidth + 1; } p.bDoubleIcons = hIcon && hxIcon; } else { if (hxIcon) - ske_DrawIconEx(hDC, x, iconY, hxIcon, iconWidth, iconHeight, 0, NULL, DI_NORMAL | dim); + ske_DrawIconEx(hDC, x, iconY, hxIcon, iconWidth, iconHeight, 0, nullptr, DI_NORMAL | dim); if (hIcon) - ske_DrawIconEx(hDC, x, iconY, hIcon, iconWidth, iconHeight, 0, NULL, DI_NORMAL | ((hxIcon && (p.xStatusMode & 4)) ? (192 << 24) : 0) | dim); + ske_DrawIconEx(hDC, x, iconY, hIcon, iconWidth, iconHeight, 0, nullptr, DI_NORMAL | ((hxIcon && (p.xStatusMode & 4)) ? (192 << 24) : 0) | dim); } if (hxIcon || hIcon) { // TODO g_StatusBarData.bDrawLockOverlay options to draw locked proto - if (db_get_b(NULL, p.szAccountName, "LockMainStatus", 0)) { + if (db_get_b(0, p.szAccountName, "LockMainStatus", 0)) { HICON hLockOverlay = Skin_LoadIcon(SKINICON_OTHER_STATUS_LOCKED); - if (hLockOverlay != NULL) { - ske_DrawIconEx(hDC, x, iconY, hLockOverlay, iconWidth, iconHeight, 0, NULL, DI_NORMAL | dim); + if (hLockOverlay != nullptr) { + ske_DrawIconEx(hDC, x, iconY, hLockOverlay, iconWidth, iconHeight, 0, nullptr, DI_NORMAL | dim); IcoLib_ReleaseIcon(hLockOverlay); } } @@ -523,14 +523,14 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) rt.top = textY; ske_DrawText(hDC, p.tszProtoHumanName, cbLen, &rt, 0); - if ((p.bShowProtoEmails && p.szProtoEMailCount != NULL) || p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) { + if ((p.bShowProtoEmails && p.szProtoEMailCount != nullptr) || p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) { SIZE txtSize; GetTextExtentPoint32(hDC, p.tszProtoHumanName, cbLen, &txtSize); x += txtSize.cx + 3; } } - if (p.bShowProtoEmails && p.szProtoEMailCount != NULL) { + if (p.bShowProtoEmails && p.szProtoEMailCount != nullptr) { int cbLen = (int)mir_wstrlen(p.szProtoEMailCount); RECT rt = r; rt.left = x + (spaceWidth >> 1); @@ -591,7 +591,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_SIZE: if (!g_CluiData.fLayered || GetParent(hwnd) != pcli->hwndContactList) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); case WM_ERASEBKGND: @@ -619,7 +619,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); ReleaseDC(hwnd, hdc); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); } else { RECT rc; @@ -689,7 +689,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa rc = ProtosData[i].protoRect; if (PtInRect(&rc, pt)) { NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip, (WPARAM)ProtosData[i].szAccountName, 0); - CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(NULL, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), 0); + CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(0, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), 0); tooltipshoing = TRUE; ClientToScreen(hwnd, &pt); ptToolTipShow = pt; @@ -733,7 +733,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ReleaseCapture(); } KillTimer(hwnd, TM_STATUSBAR); - CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(NULL, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), 0); + CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(0, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), 0); } return CLUI_TestCursorOnBorders(); @@ -820,12 +820,12 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ApplyViewMode(filterName); } Clist_Broadcast(CLM_AUTOREBUILD, 0, 0); - cliInvalidateRect(hwnd, NULL, FALSE); - SetCapture(NULL); + cliInvalidateRect(hwnd, nullptr, FALSE); + SetCapture(nullptr); return 0; } - HMENU hMenu = NULL; + HMENU hMenu = nullptr; if (msg == WM_RBUTTONDOWN) { BOOL a = ((g_StatusBarData.perProtoConfig && p.SBarRightClk) || g_StatusBarData.SBarRightClk); if (a ^ bShift) @@ -844,7 +844,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa HWND parent = GetParent(hwnd); if (parent != pcli->hwndContactList) parent = GetParent(parent); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, parent, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, parent, nullptr); return 0; } } @@ -852,8 +852,8 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa GetClientRect(hwnd, &rc); if (PtInRect(&rc, pt) && msg == WM_LBUTTONDOWN && g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS) { ApplyViewMode(""); - cliInvalidateRect(hwnd, NULL, FALSE); - SetCapture(NULL); + cliInvalidateRect(hwnd, nullptr, FALSE); + SetCapture(nullptr); return 0; } return SendMessage(GetParent(hwnd), msg, wParam, lParam); @@ -870,13 +870,13 @@ HWND StatusBar_Create(HWND parent) if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) { wndclass.lpfnWndProc = ModernStatusProc; wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); wndclass.lpszClassName = pluginname; RegisterClass(&wndclass); } - hModernStatusBar = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 0, h, parent, NULL, g_hInst, NULL); + hModernStatusBar = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 0, h, parent, nullptr, g_hInst, nullptr); // register frame CLISTFrame Frame = { sizeof(Frame) }; @@ -884,7 +884,7 @@ HWND StatusBar_Create(HWND parent) Frame.align = alBottom; Frame.hIcon = Skin_LoadIcon(SKINICON_OTHER_FRAME); Frame.Flags = F_LOCKED | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE; - if (db_get_b(NULL, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT)) + if (db_get_b(0, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT)) Frame.Flags |= F_VISIBLE; Frame.height = h; Frame.tname = L"Status bar"; diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index f4a1d120ce..76c8b73eb8 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -68,11 +68,11 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) HWND hwndComboBox = GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST); BOOL perProto = IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO); - StatusBarProtocolOptions *dat = (StatusBarProtocolOptions*)SendMessage(hwndComboBox, CB_GETITEMDATA, SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0), NULL); - if (dat == NULL) + StatusBarProtocolOptions *dat = (StatusBarProtocolOptions*)SendMessage(hwndComboBox, CB_GETITEMDATA, SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0), 0); + if (dat == nullptr) perProto = FALSE; - StatusBarProtocolOptions &sbpo = (dat == NULL) ? _GlobalOptions : *dat; + StatusBarProtocolOptions &sbpo = (dat == nullptr) ? _GlobalOptions : *dat; if (perProto) { EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), TRUE); @@ -141,18 +141,18 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l HWND hwndComboBox = GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST); StatusBarProtocolOptions *dat = (StatusBarProtocolOptions*)SendMessage(hwndComboBox, CB_GETITEMDATA, SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0), 0); BOOL perProto = IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO); - if (dat == NULL) { + if (dat == nullptr) { perProto = FALSE; dat = &_GlobalOptions; } switch (msg) { case WM_INITDIALOG: - perProto = (BOOL)db_get_b(NULL, "CLUI", "SBarPerProto", SETTING_SBARPERPROTO_DEFAULT); + perProto = (BOOL)db_get_b(0, "CLUI", "SBarPerProto", SETTING_SBARPERPROTO_DEFAULT); TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(0, "CLUI", "ShowSBar", SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED); { // populate per-proto list box. @@ -178,31 +178,31 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l char buf[256]; mir_snprintf(buf, "SBarAccountIsCustom_%s", szName); - dat->AccountIsCustomized = db_get_b(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT); + dat->AccountIsCustomized = db_get_b(0, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT); mir_snprintf(buf, "HideAccount_%s", szName); - dat->HideAccount = db_get_b(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT); + dat->HideAccount = db_get_b(0, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT); mir_snprintf(buf, "SBarShow_%s", szName); - dat->SBarShow = db_get_b(NULL, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); + dat->SBarShow = db_get_b(0, "CLUI", buf, SETTING_SBARSHOW_DEFAULT); mir_snprintf(buf, "SBarRightClk_%s", szName); - dat->SBarRightClk = db_get_b(NULL, "CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT); + dat->SBarRightClk = db_get_b(0, "CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT); mir_snprintf(buf, "ShowUnreadEmails_%s", szName); - dat->ShowUnreadEmails = db_get_b(NULL, "CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT); + dat->ShowUnreadEmails = db_get_b(0, "CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT); mir_snprintf(buf, "ShowXStatus_%s", szName); - dat->ShowXStatus = db_get_b(NULL, "CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT); + dat->ShowXStatus = db_get_b(0, "CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT); mir_snprintf(buf, "UseConnectingIcon_%s", szName); - dat->UseConnectingIcon = db_get_b(NULL, "CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT); + dat->UseConnectingIcon = db_get_b(0, "CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT); mir_snprintf(buf, "PaddingLeft_%s", szName); - dat->PaddingLeft = db_get_dw(NULL, "CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); + dat->PaddingLeft = db_get_dw(0, "CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); mir_snprintf(buf, "PaddingRight_%s", szName); - dat->PaddingRight = db_get_dw(NULL, "CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); + dat->PaddingRight = db_get_dw(0, "CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); } if (count) @@ -210,44 +210,44 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } _GlobalOptions.AccountIsCustomized = TRUE; - _GlobalOptions.SBarRightClk = db_get_b(NULL, "CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); - _GlobalOptions.ShowUnreadEmails = db_get_b(NULL, "CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT); - _GlobalOptions.ShowXStatus = db_get_b(NULL, "CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); - _GlobalOptions.UseConnectingIcon = db_get_b(NULL, "CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT); - _GlobalOptions.SBarShow = db_get_b(NULL, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT); + _GlobalOptions.SBarRightClk = db_get_b(0, "CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); + _GlobalOptions.ShowUnreadEmails = db_get_b(0, "CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT); + _GlobalOptions.ShowXStatus = db_get_b(0, "CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); + _GlobalOptions.UseConnectingIcon = db_get_b(0, "CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT); + _GlobalOptions.SBarShow = db_get_b(0, "CLUI", "SBarShow", SETTING_SBARSHOW_DEFAULT); - CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL, "CLUI", "EqualSections", SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(0, "CLUI", "EqualSections", SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_MULTI_SPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_MULTI_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_MULTI_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_b(0, "CLUI", "StatusBarProtosPerLine", SETTING_PROTOSPERLINE_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(NULL, "CLUI", "LeftOffset", SETTING_LEFTOFFSET_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(0, "CLUI", "LeftOffset", SETTING_LEFTOFFSET_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN2, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN2, UDM_SETPOS, 0, MAKELONG(db_get_dw(NULL, "CLUI", "RightOffset", SETTING_RIGHTOFFSET_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN2, UDM_SETPOS, 0, MAKELONG(db_get_dw(0, "CLUI", "RightOffset", SETTING_RIGHTOFFSET_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_TOP_SPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_TOP_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(NULL, "CLUI", "TopOffset", SETTING_TOPOFFSET_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_TOP_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(0, "CLUI", "TopOffset", SETTING_TOPOFFSET_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_BOTTOM_SPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_BOTTOM_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(NULL, "CLUI", "BottomOffset", SETTING_BOTTOMOFFSET_DEFAULT), 0)); + SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_BOTTOM_SPIN, UDM_SETPOS, 0, MAKELONG(db_get_dw(0, "CLUI", "BottomOffset", SETTING_BOTTOMOFFSET_DEFAULT), 0)); SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN3, UDM_SETRANGE, 0, MAKELONG(50, 0)); - SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN3, UDM_SETPOS, 0, MAKELONG(db_get_dw(NULL, "CLUI", "SpaceBetween", SETTING_SPACEBETWEEN_DEFAULT), 2)); + SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN3, UDM_SETPOS, 0, MAKELONG(db_get_dw(0, "CLUI", "SpaceBetween", SETTING_SPACEBETWEEN_DEFAULT), 2)); { wchar_t *align[] = { LPGENW("Left"), LPGENW("Center"), LPGENW("Right") }; for (int i = 0; i < _countof(align); i++) SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(align[i])); - SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(0, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0); } { wchar_t *align[] = { LPGENW("Top"), LPGENW("Center"), LPGENW("Bottom") }; for (int i = 0; i < _countof(align); i++) SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(align[i])); - SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(0, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0); } { @@ -392,7 +392,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); + db_set_b(0, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); int count = SendMessage(hwndComboBox, CB_GETCOUNT, 0, 0); for (int i = 1; i < count; i++) { @@ -400,46 +400,46 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l char settingBuf[256]; mir_snprintf(settingBuf, "SBarAccountIsCustom_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->AccountIsCustomized); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->AccountIsCustomized); mir_snprintf(settingBuf, "HideAccount_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->HideAccount); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->HideAccount); mir_snprintf(settingBuf, "SBarShow_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->SBarShow); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->SBarShow); mir_snprintf(settingBuf, "SBarRightClk_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->SBarRightClk); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->SBarRightClk); mir_snprintf(settingBuf, "UseConnectingIcon_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->UseConnectingIcon); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->UseConnectingIcon); mir_snprintf(settingBuf, "ShowUnreadEmails_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->ShowUnreadEmails); + db_set_b(0, "CLUI", settingBuf, (BYTE)sbpo->ShowUnreadEmails); mir_snprintf(settingBuf, "ShowXStatus_%s", sbpo->szName); - db_set_b(NULL, "CLUI", settingBuf, sbpo->ShowXStatus); + db_set_b(0, "CLUI", settingBuf, sbpo->ShowXStatus); mir_snprintf(settingBuf, "PaddingLeft_%s", sbpo->szName); - db_set_dw(NULL, "CLUI", settingBuf, sbpo->PaddingLeft); + db_set_dw(0, "CLUI", settingBuf, sbpo->PaddingLeft); mir_snprintf(settingBuf, "PaddingRight_%s", sbpo->szName); - db_set_dw(NULL, "CLUI", settingBuf, sbpo->PaddingRight); + db_set_dw(0, "CLUI", settingBuf, sbpo->PaddingRight); } - db_set_b(NULL, "CLUI", "SBarShow", (BYTE)_GlobalOptions.SBarShow); - db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)_GlobalOptions.SBarRightClk); - db_set_b(NULL, "CLUI", "UseConnectingIcon", (BYTE)_GlobalOptions.UseConnectingIcon); - db_set_b(NULL, "CLUI", "ShowUnreadEmails", (BYTE)_GlobalOptions.ShowUnreadEmails); - db_set_b(NULL, "CLUI", "ShowXStatus", _GlobalOptions.ShowXStatus); - db_set_dw(NULL, "CLUI", "PaddingLeft", _GlobalOptions.PaddingLeft); - db_set_dw(NULL, "CLUI", "PaddingRight", _GlobalOptions.PaddingRight); - - - db_set_b(NULL, "CLUI", "StatusBarProtosPerLine", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MULTI_SPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); - db_set_b(NULL, "CLUI", "Align", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_GETCURSEL, 0, 0)); - db_set_b(NULL, "CLUI", "VAlign", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_GETCURSEL, 0, 0)); - db_set_dw(NULL, "CLUI", "LeftOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN, UDM_GETPOS, 0, 0)); - db_set_dw(NULL, "CLUI", "RightOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN2, UDM_GETPOS, 0, 0)); - db_set_dw(NULL, "CLUI", "TopOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_TOP_SPIN, UDM_GETPOS, 0, 0)); - db_set_dw(NULL, "CLUI", "BottomOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_BOTTOM_SPIN, UDM_GETPOS, 0, 0)); - db_set_dw(NULL, "CLUI", "SpaceBetween", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN3, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + db_set_b(0, "CLUI", "SBarShow", (BYTE)_GlobalOptions.SBarShow); + db_set_b(0, "CLUI", "SBarRightClk", (BYTE)_GlobalOptions.SBarRightClk); + db_set_b(0, "CLUI", "UseConnectingIcon", (BYTE)_GlobalOptions.UseConnectingIcon); + db_set_b(0, "CLUI", "ShowUnreadEmails", (BYTE)_GlobalOptions.ShowUnreadEmails); + db_set_b(0, "CLUI", "ShowXStatus", _GlobalOptions.ShowXStatus); + db_set_dw(0, "CLUI", "PaddingLeft", _GlobalOptions.PaddingLeft); + db_set_dw(0, "CLUI", "PaddingRight", _GlobalOptions.PaddingRight); + + + db_set_b(0, "CLUI", "StatusBarProtosPerLine", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MULTI_SPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); + db_set_b(0, "CLUI", "Align", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_GETCURSEL, 0, 0)); + db_set_b(0, "CLUI", "VAlign", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_GETCURSEL, 0, 0)); + db_set_dw(0, "CLUI", "LeftOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN, UDM_GETPOS, 0, 0)); + db_set_dw(0, "CLUI", "RightOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN2, UDM_GETPOS, 0, 0)); + db_set_dw(0, "CLUI", "TopOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_TOP_SPIN, UDM_GETPOS, 0, 0)); + db_set_dw(0, "CLUI", "BottomOffset", (DWORD)SendDlgItemMessage(hwndDlg, IDC_SBAR_BORDER_BOTTOM_SPIN, UDM_GETPOS, 0, 0)); + db_set_dw(0, "CLUI", "SpaceBetween", (DWORD)SendDlgItemMessage(hwndDlg, IDC_OFFSETSPIN3, UDM_GETPOS, 0, 0)); + db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); LoadStatusBarData(); cliCluiProtocolStatusChanged(0, 0); diff --git a/plugins/Clist_modern/src/modern_sync.cpp b/plugins/Clist_modern/src/modern_sync.cpp index 7285758066..2715e8da36 100644 --- a/plugins/Clist_modern/src/modern_sync.cpp +++ b/plugins/Clist_modern/src/modern_sync.cpp @@ -50,7 +50,7 @@ static void CALLBACK _SyncCallerUserAPCProc(void* param) static int SyncCallAPCProxy(PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam) { - if (pfnProc == NULL) + if (pfnProc == nullptr) return 0; if (GetCurrentThreadId() == g_dwMainThreadID) @@ -61,7 +61,7 @@ static int SyncCallAPCProxy(PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lPa item.lParam = lParam; item.pfnProc = pfnProc; item.nResult = 0; - item.hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + item.hDoneEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); CallFunctionAsync(_SyncCallerUserAPCProc, &item); diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index 24b642d0d9..4f53fb353e 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -30,10 +30,10 @@ struct TBBUTTONDATA : public MButtonCtrl }; static mir_cs csTips; -static HWND hwndToolTips = NULL; +static HWND hwndToolTips = nullptr; static BOOL bThemed = FALSE; -static MWindowList hButtonWindowList = NULL; +static MWindowList hButtonWindowList = nullptr; static int OnIconLibIconChanged(WPARAM, LPARAM) { @@ -87,8 +87,8 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset) int width = rcClient.right - rcClient.left; int height = rcClient.bottom - rcClient.top; - HBITMAP hbmMem = NULL; - HBITMAP hbmOld = NULL; + HBITMAP hbmMem = nullptr; + HBITMAP hbmOld = nullptr; HDC hdcMem = pOffset ? hdcPaint : CreateCompatibleDC(hdcPaint); HFONT hOldFont = (HFONT)SelectObject(hdcMem, bct->hFont); if (!pOffset) { @@ -114,7 +114,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset) xpt_DrawTheme(bct->hThemeToolbar, bct->hwnd, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), rc, rc); } else { - HBRUSH hbr = NULL; + HBRUSH hbr = nullptr; if (bct->stateId == PBS_PRESSED || bct->stateId == PBS_HOT) hbr = GetSysColorBrush(COLOR_3DLIGHT); @@ -123,7 +123,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset) POINT pt = { 0 }; int ret; HWND hwndParent = GetParent(bct->hwnd); - HDC dc = CreateCompatibleDC(NULL); + HDC dc = CreateCompatibleDC(nullptr); HBITMAP memBM, oldBM; GetWindowRect(hwndParent, &btnRect); memBM = ske_CreateDIB32(btnRect.right - btnRect.left, btnRect.bottom - btnRect.top); @@ -188,7 +188,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset) /* Check sizes*/ if (bct->hIcon && (rcIcon.right > rcTemp.right || rcIcon.bottom > rcTemp.bottom || rcIcon.left < rcTemp.left || rcIcon.top < rcTemp.top)) - bct->hIcon = NULL; + bct->hIcon = nullptr; if (bHasText && (rcText.right > rcTemp.right || rcText.bottom > rcTemp.bottom || rcText.left < rcTemp.left || rcText.top < rcTemp.top)) bHasText = FALSE; @@ -198,14 +198,14 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset) rcIcon.top += (rcClient.bottom - rcClient.top) / 2 - 8; /* CYSM_ICON/2 */ rcIcon.bottom = rcIcon.top + 16; /* CYSM_ICON */ /* draw it */ - ske_DrawIconEx(hdcMem, rcIcon.left + bPressed, rcIcon.top + bPressed, bct->hIcon, 16, 16, 0, NULL, DI_NORMAL); + ske_DrawIconEx(hdcMem, rcIcon.left + bPressed, rcIcon.top + bPressed, bct->hIcon, 16, 16, 0, nullptr, DI_NORMAL); } if (bHasText) { BOOL bCentered = TRUE; SetBkMode(hdcMem, TRANSPARENT); if (bct->nFontID >= 0) - g_clcPainter.ChangeToFont(hdcMem, NULL, bct->nFontID, NULL); + g_clcPainter.ChangeToFont(hdcMem, nullptr, bct->nFontID, nullptr); RECT TextRequiredRect = rcText; ske_DrawText(hdcMem, bct->szText, -1, &TextRequiredRect, DT_CENTER | DT_VCENTER | DT_CALCRECT | DT_SINGLELINE); @@ -272,18 +272,18 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam PAINTSTRUCT ps; HDC hdcPaint = BeginPaint(hwndDlg, &ps); if (hdcPaint) { - PaintWorker(bct, hdcPaint, NULL); + PaintWorker(bct, hdcPaint, nullptr); EndPaint(hwndDlg, &ps); } } - ValidateRect(hwndDlg, NULL); + ValidateRect(hwndDlg, nullptr); return 0; case WM_CAPTURECHANGED: if ((HWND)lParam != bct->hwnd && bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } break; @@ -293,7 +293,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_ENABLE: // windows tells us to enable/disable bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); return 0; case WM_LBUTTONDOWN: @@ -310,11 +310,11 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { bct->stateId = PBS_PRESSED; bct->bHotMark = true; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); if (bct->bSendOnDown) { SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); bct->stateId = PBS_NORMAL; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } } SetCapture(bct->hwnd); @@ -341,7 +341,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_HOT; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } if (!bct->bSendOnDown) { bct->bHotMark = false; @@ -350,7 +350,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam } else { bct->bHotMark = false; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } return 0; @@ -371,18 +371,18 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam SetCapture(bct->hwnd); if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } } if (!inClient && bct->stateId == PBS_PRESSED) { bct->stateId = PBS_HOT; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } else if (inClient && bct->stateId == PBS_HOT && bPressed) { if (bct->bHotMark) { bct->stateId = PBS_PRESSED; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); } } else if (!inClient && !bPressed) { @@ -406,17 +406,17 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam bct->bIsPushed = 1; else if (wParam == BST_UNCHECKED) bct->bIsPushed = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); return 0; case WM_SETFOCUS: // set keyboard focus and redraw bct->bFocused = true; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); break; case WM_KILLFOCUS: // kill focus and redraw bct->bFocused = false; - InvalidateParentRect(bct->hwnd, NULL, TRUE); + InvalidateParentRect(bct->hwnd, nullptr, TRUE); break; case WM_ERASEBKGND: @@ -424,16 +424,16 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case MBM_SETICOLIBHANDLE: bct->hIcolibHandle = (HANDLE)lParam; - bct->hIcon = (bct->hIcolibHandle) ? IcoLib_GetIconByHandle(bct->hIcolibHandle) : NULL; + bct->hIcon = (bct->hIcolibHandle) ? IcoLib_GetIconByHandle(bct->hIcolibHandle) : nullptr; return 1; case MBM_REFRESHICOLIBICON: if (bct->hIcolibHandle) bct->hIcon = IcoLib_GetIconByHandle(bct->hIcolibHandle); else - bct->hIcon = NULL; - InvalidateRect(hwndDlg, NULL, TRUE); - pcli->pfnInvalidateRect(GetParent(GetParent(hwndDlg)), NULL, TRUE); + bct->hIcon = nullptr; + InvalidateRect(hwndDlg, nullptr, TRUE); + pcli->pfnInvalidateRect(GetParent(GetParent(hwndDlg)), nullptr, TRUE); return 1; case MBM_UPDATETRANSPARENTFLAG: @@ -445,14 +445,14 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam if (lParam) flag |= WS_EX_TRANSPARENT; if (flag != oldFlag) { SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, flag); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } return 1; } LRESULT res = mir_callNextSubclass(hwndDlg, ToolbarButtonProc, msg, wParam, lParam); if (msg == BM_SETIMAGE) - InvalidateParentRect(hwndDlg, NULL, TRUE); + InvalidateParentRect(hwndDlg, nullptr, TRUE); return res; } @@ -465,7 +465,7 @@ void MakeButtonSkinned(HWND hWnd) p->nFontID = -1; p->hThemeButton = xpt_AddThemeHandle(p->hwnd, L"BUTTON"); p->hThemeToolbar = xpt_AddThemeHandle(p->hwnd, L"TOOLBAR"); - WindowList_Add(hButtonWindowList, hWnd, NULL); + WindowList_Add(hButtonWindowList, hWnd, 0); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 96ca20a52b..6cc33a1ecd 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -39,15 +39,15 @@ struct } static BTNS[] = { - { "MainMenu", LPGEN("Main menu"), "CList/ShowMainMenu", LPGEN("Main menu"), NULL, 100, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "StatusMenu", LPGEN("Status menu"), "CList/ShowStatusMenu", LPGEN("Status menu"), NULL, 105, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "AccoMgr", LPGEN("Accounts"), MS_PROTO_SHOWACCMGR, LPGEN("Accounts..."), NULL, 282, IDI_ACCMGR, IDI_ACCMGR, TRUE }, + { "MainMenu", LPGEN("Main menu"), "CList/ShowMainMenu", LPGEN("Main menu"), nullptr, 100, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "StatusMenu", LPGEN("Status menu"), "CList/ShowStatusMenu", LPGEN("Status menu"), nullptr, 105, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "AccoMgr", LPGEN("Accounts"), MS_PROTO_SHOWACCMGR, LPGEN("Accounts..."), nullptr, 282, IDI_ACCMGR, IDI_ACCMGR, TRUE }, { "ShowHideOffline", LPGEN("Show/Hide offline contacts"), MS_CLIST_TOGGLEHIDEOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 110, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "FindUser", LPGEN("Find user"), "FindAdd/FindAddCommand", LPGEN("Find user"), NULL, 140, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "Options", "Options", "Options/OptionsCommand", "Options", NULL, 150, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "FindUser", LPGEN("Find user"), "FindAdd/FindAddCommand", LPGEN("Find user"), nullptr, 140, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "Options", "Options", "Options/OptionsCommand", "Options", nullptr, 150, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, { "UseGroups", LPGEN("Use/Disable groups"), MS_CLIST_TOGGLEGROUPS, LPGEN("Use groups"), LPGEN("Disable groups"), 160, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, { "EnableSounds", LPGEN("Enable/Disable sounds"), MS_CLIST_TOGGLESOUNDS, LPGEN("Enable sounds"), LPGEN("Disable sounds"), 170, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, - { "Minimize", LPGEN("Minimize"), "CList/ShowHide", LPGEN("Minimize"), NULL, 180, IDI_RESETVIEW, IDI_RESETVIEW, FALSE } + { "Minimize", LPGEN("Minimize"), "CList/ShowHide", LPGEN("Minimize"), nullptr, 180, IDI_RESETVIEW, IDI_RESETVIEW, FALSE } }; static void SetButtonPressed(int i, int state) @@ -71,13 +71,13 @@ void Modern_InitButtons() mir_snprintf(buf, "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn"); tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx, g_hInst, BTNS[i].defResource); } - else tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, NULL, 0, NULL, SKINICON_OTHER_MAINMENU); + else tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, nullptr, 0, nullptr, SKINICON_OTHER_MAINMENU); if (BTNS[i].pszTooltipDn) { mir_snprintf(buf, "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up"); tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx + 1, g_hInst, BTNS[i].defResource2); } - else tbb.hIconHandleDn = NULL; + else tbb.hIconHandleDn = nullptr; } else tbb.dwFlags |= TTBBF_ISSEPARATOR; @@ -85,9 +85,9 @@ void Modern_InitButtons() BTNS[i].hButton = TopToolbar_AddButton(&tbb); } - SetButtonPressed(3, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); - SetButtonPressed(6, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)); - SetButtonPressed(7, db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT)); + SetButtonPressed(3, db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); + SetButtonPressed(6, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)); + SetButtonPressed(7, db_get_b(0, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT)); } /////////////////////////////////////////////////////////////////////////////// @@ -106,12 +106,12 @@ struct WORD mtb_backgroundBmpUse; BOOL mtb_useWinColors; } -static tbdat = { NULL, CLCDEFAULT_BKCOLOUR, CLCDEFAULT_BKBMPUSE, CLCDEFAULT_USEWINDOWSCOLOURS }; +static tbdat = { nullptr, CLCDEFAULT_BKCOLOUR, CLCDEFAULT_BKBMPUSE, CLCDEFAULT_USEWINDOWSCOLOURS }; static int ehhToolBarSettingsChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if (hContact != NULL) + if (hContact != 0) return 0; if (!strcmp(cws->szModule, "CList")) { @@ -132,18 +132,18 @@ static int ehhToolBarBackgroundSettingsChanged(WPARAM, LPARAM) { if (tbdat.mtb_hBmpBackground) { DeleteObject(tbdat.mtb_hBmpBackground); - tbdat.mtb_hBmpBackground = NULL; + tbdat.mtb_hBmpBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { tbdat.mtb_bkColour = cliGetColor("ToolBar", "BkColour", CLCDEFAULT_BKCOLOUR); - if (db_get_b(NULL, "ToolBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmapName(db_get_wsa(NULL, "ToolBar", "BkBitmap")); + if (db_get_b(0, "ToolBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmapName(db_get_wsa(0, "ToolBar", "BkBitmap")); if (tszBitmapName) tbdat.mtb_hBmpBackground = Bitmap_Load(tszBitmapName); } - tbdat.mtb_useWinColors = db_get_b(NULL, "ToolBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - tbdat.mtb_backgroundBmpUse = db_get_b(NULL, "ToolBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + tbdat.mtb_useWinColors = db_get_b(0, "ToolBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + tbdat.mtb_backgroundBmpUse = db_get_b(0, "ToolBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); return 0; @@ -203,7 +203,7 @@ static void sttDrawNonLayeredSkinedBar(HWND hwnd, HDC hdc) DeleteDC(hdc2); SelectObject(hdc, (HFONT)GetStockObject(DEFAULT_GUI_FONT)); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); } static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -212,7 +212,7 @@ static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA switch (msg) { case WM_ERASEBKGND: - return (g_CluiData.fDisableSkinEngine) ? sttDrawToolBarBackground(hwnd, (HDC)wParam, NULL, pMTBInfo) : 0; + return (g_CluiData.fDisableSkinEngine) ? sttDrawToolBarBackground(hwnd, (HDC)wParam, nullptr, pMTBInfo) : 0; case WM_NCPAINT: case WM_PAINT: @@ -232,7 +232,7 @@ static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY: if (((LPNMHDR)lParam)->code == BUTTONNEEDREDRAW) - pcli->pfnInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); return 0; case MTBM_LAYEREDPAINT: @@ -303,7 +303,7 @@ static wchar_t szWarning[] = LPGENW("To view a toolbar in Clist_modern you need static void CopySettings(const char* to, const char* from, int defValue) { - db_set_b(NULL, TTB_OPTDIR, to, db_get_b(NULL, "ModernToolBar", from, defValue)); + db_set_b(0, TTB_OPTDIR, to, db_get_b(0, "ModernToolBar", from, defValue)); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -328,23 +328,23 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) TopToolbar_SetCustomProc(CustomizeButton, 0); BYTE bOldSetting = 0; - if (!db_get_b(NULL, "Compatibility", "TTB_Upgrade", 0)) { - if (bOldSetting = db_get_b(NULL, "CLUI", "ShowButtonBar", 1)) { + if (!db_get_b(0, "Compatibility", "TTB_Upgrade", 0)) { + if (bOldSetting = db_get_b(0, "CLUI", "ShowButtonBar", 1)) { CopySettings("BUTTWIDTH", "option_Bar0_BtnWidth", 20); CopySettings("BUTTHEIGHT", "option_Bar0_BtnHeight", 20); CopySettings("BUTTGAP", "option_Bar0_BtnSpace", 1); CopySettings("BUTTAUTOSIZE", "option_Bar0_Autosize", 1); CopySettings("BUTTMULTI", "option_Bar0_Multiline", 1); - db_unset(NULL, "CLUI", "ShowButtonBar"); + db_unset(0, "CLUI", "ShowButtonBar"); db_delete_module(0, "ModernToolBar"); } - db_set_b(NULL, "Compatibility", "TTB_Upgrade", 1); + db_set_b(0, "Compatibility", "TTB_Upgrade", 1); } if (!ServiceExists(MS_TTB_REMOVEBUTTON) && bOldSetting == 1) - if (IDYES == MessageBox(NULL, TranslateW(szWarning), TranslateT("Toolbar upgrade"), MB_ICONQUESTION | MB_YESNO)) + if (IDYES == MessageBox(nullptr, TranslateW(szWarning), TranslateT("Toolbar upgrade"), MB_ICONQUESTION | MB_YESNO)) Utils_OpenUrl(szUrl); return 0; diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp index 07810bd37f..efbf5e77b3 100644 --- a/plugins/Clist_modern/src/modern_utils.cpp +++ b/plugins/Clist_modern/src/modern_utils.cpp @@ -20,7 +20,7 @@ char * __cdecl strstri(char *a, const char *b) } free(x); free(y); - return NULL; + return nullptr; } void TRACE_ERROR() @@ -31,18 +31,18 @@ void TRACE_ERROR() FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, t, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR)&lpMsgBuf, 0, - NULL)) + nullptr)) { // Handle the error. return; } #ifdef _DEBUG - MessageBox(NULL, (LPCTSTR)lpMsgBuf, L"Error", MB_OK | MB_ICONINFORMATION); + MessageBox(nullptr, (LPCTSTR)lpMsgBuf, L"Error", MB_OK | MB_ICONINFORMATION); DebugBreak(); #endif LocalFree(lpMsgBuf); @@ -54,8 +54,8 @@ HICON LoadSmallIcon(HINSTANCE hInstance, int index) wchar_t filename[MAX_PATH] = { 0 }; GetModuleFileName(hInstance, filename, MAX_PATH); - HICON hIcon = NULL; - ExtractIconEx(filename, index, NULL, &hIcon, 1); + HICON hIcon = nullptr; + ExtractIconEx(filename, index, nullptr, &hIcon, 1); return hIcon; } diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index c2a076802a..7252400df4 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -94,14 +94,14 @@ static int ViewModePaintCallbackProc(HWND hWnd, HDC hDC, RECT *, HRGN, DWORD, vo int CLVM_EnumProc(const char *szSetting, LPARAM lParam) { pfnEnumCallback EnumCallback = (pfnEnumCallback)lParam; - if (szSetting != NULL) + if (szSetting != nullptr) EnumCallback((char *)szSetting); return 0; } void CLVM_EnumModes(pfnEnumCallback EnumCallback) { - db_enum_settings(NULL, CLVM_EnumProc, CLVM_MODULE, EnumCallback); + db_enum_settings(0, CLVM_EnumProc, CLVM_MODULE, EnumCallback); } int FillModes(char *szsetting) @@ -112,7 +112,7 @@ int FillModes(char *szsetting) return 1; ptrW temp(mir_utf8decodeW(szsetting)); - if (temp != NULL) + if (temp != nullptr) SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)temp); return 1; } @@ -149,7 +149,7 @@ static void ShowPage(HWND hwnd, int page) } if (pageChange) { SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE); } } @@ -241,7 +241,7 @@ static int FillDialog(HWND hwnd) SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); wchar_t *szGroup; - for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { + for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) { item.pszText = szGroup; SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } @@ -346,19 +346,19 @@ void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *sz char szSetting[512]; mir_snprintf(szSetting, "%c%s_PF", 246, name); - db_set_s(NULL, CLVM_MODULE, szSetting, szProtoFilter); + db_set_s(0, CLVM_MODULE, szSetting, szProtoFilter); mir_snprintf(szSetting, "%c%s_GF", 246, name); - db_set_ws(NULL, CLVM_MODULE, szSetting, szGroupFilter); + db_set_ws(0, CLVM_MODULE, szSetting, szGroupFilter); mir_snprintf(szSetting, "%c%s_SM", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, dwStatusMask); + db_set_dw(0, CLVM_MODULE, szSetting, dwStatusMask); mir_snprintf(szSetting, "%c%s_SSM", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, dwStickyStatusMask); + db_set_dw(0, CLVM_MODULE, szSetting, dwStickyStatusMask); mir_snprintf(szSetting, "%c%s_OPT", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, options); + db_set_dw(0, CLVM_MODULE, szSetting, options); mir_snprintf(szSetting, "%c%s_LM", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, lmdat); + db_set_dw(0, CLVM_MODULE, szSetting, lmdat); - db_set_dw(NULL, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies)); + db_set_dw(0, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies)); } /* @@ -434,7 +434,7 @@ void SaveState() DWORD dwGlobalMask = GetMaskForItem(hInfoItem); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); - if (hItem == NULL) + if (hItem == nullptr) continue; if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { @@ -467,7 +467,7 @@ void SaveState() stickies, operators, lmdat); mir_free(szTempModeName); - szTempModeName = NULL; + szTempModeName = nullptr; } } EnableWindow(GetDlgItem(clvmHwnd, IDC_APPLY), FALSE); @@ -501,24 +501,24 @@ static void UpdateFilters() SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp); } mir_snprintf(szSetting, "%c%s_PF", 246, szBuf); - ptrA szPF(db_get_sa(NULL, CLVM_MODULE, szSetting)); - if (szPF == NULL) + ptrA szPF(db_get_sa(0, CLVM_MODULE, szSetting)); + if (szPF == nullptr) return; mir_snprintf(szSetting, "%c%s_GF", 246, szBuf); - ptrW szGF(db_get_wsa(NULL, CLVM_MODULE, szSetting)); - if (szGF == NULL) + ptrW szGF(db_get_wsa(0, CLVM_MODULE, szSetting)); + if (szGF == nullptr) return; mir_snprintf(szSetting, "%c%s_OPT", 246, szBuf); - if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1) + if ((opt = db_get_dw(0, CLVM_MODULE, szSetting, -1)) != -1) SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0)); mir_snprintf(szSetting, "%c%s_SM", 246, szBuf); - DWORD statusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, 0); + DWORD statusMask = db_get_dw(0, CLVM_MODULE, szSetting, 0); mir_snprintf(szSetting, "%c%s_SSM", 246, szBuf); - stickyStatusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, -1); - dwFlags = db_get_dw(NULL, CLVM_MODULE, szBuf, 0); + stickyStatusMask = db_get_dw(0, CLVM_MODULE, szSetting, -1); + dwFlags = db_get_dw(0, CLVM_MODULE, szBuf, 0); { LVITEMA item = { 0 }; char szTemp[256]; @@ -590,7 +590,7 @@ static void UpdateFilters() EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMESSAGEUNIT), useLastMsg); mir_snprintf(szSetting, "%c%s_LM", 246, szBuf); - DWORD lmdat = db_get_dw(NULL, CLVM_MODULE, szSetting, 0); + DWORD lmdat = db_get_dw(0, CLVM_MODULE, szSetting, 0); SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE); BYTE bTmp = LOBYTE(HIWORD(lmdat)); @@ -607,16 +607,16 @@ void DeleteViewMode(char * szName) char szSetting[256]; mir_snprintf(szSetting, "%c%s_PF", 246, szName); - db_unset(NULL, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szSetting); mir_snprintf(szSetting, "%c%s_GF", 246, szName); - db_unset(NULL, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szSetting); mir_snprintf(szSetting, "%c%s_SM", 246, szName); - db_unset(NULL, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szSetting); mir_snprintf(szSetting, "%c%s_VA", 246, szName); - db_unset(NULL, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szSetting); mir_snprintf(szSetting, "%c%s_SSM", 246, szName); - db_unset(NULL, CLVM_MODULE, szSetting); - db_unset(NULL, CLVM_MODULE, szName); + db_unset(0, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szName); if (!mir_strcmp(g_CluiData.current_viewmode, szName) && mir_strlen(szName) == mir_strlen(g_CluiData.current_viewmode)) { g_CluiData.bFilterEffective = 0; @@ -640,7 +640,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int i; for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - HICON hIcon = Skin_LoadProtoIcon(NULL, i); + HICON hIcon = Skin_LoadProtoIcon(nullptr, i); ImageList_AddIcon(himlViewModes, hIcon); IcoLib_ReleaseIcon(hIcon); } @@ -772,7 +772,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (szBuf[0] != 0) { T2Utf szUTF8Buf(szBuf); - if (db_get_dw(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1) + if (db_get_dw(0, CLVM_MODULE, szUTF8Buf, -1) != -1) MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK); else { int iNewItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf); @@ -840,7 +840,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP DWORD hitFlags; HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); - if (hItem == NULL) + if (hItem == nullptr) break; if (!(hitFlags & CLCHT_ONITEMEXTRA)) @@ -903,12 +903,12 @@ void BuildViewModeMenu() AppendMenu(hViewModeMenu, MFT_STRING, 10002, TranslateT("All contacts")); - AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, nullptr); CLVM_EnumModes(FillMenuCallback); if (GetMenuItemCount(hViewModeMenu) > 2) - AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hViewModeMenu, MFT_STRING, 10001, TranslateT("Setup view modes...")); } @@ -919,7 +919,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { RECT rcMargins = { 12, 0, 2, 0 }; hwndSelector = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_SELECTMODE, g_hInst, NULL); + hwnd, (HMENU)IDC_SELECTMODE, g_hInst, nullptr); MakeButtonSkinned(hwndSelector); SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE); SendMessage(hwndSelector, BUTTONSETMARGINS, 0, (LPARAM)&rcMargins); @@ -931,7 +931,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //SendMessage(hwndSelector, BM_SETASMENUACTION, 1, 0); HWND hwndButton = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, NULL); + hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, nullptr); MakeButtonSkinned(hwndButton); SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Setup view modes"), BATF_UNICODE); SendMessage(hwndButton, BUTTONSETID, 0, (LPARAM) "ViewMode.Setup"); @@ -939,7 +939,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(hwndButton, MBM_UPDATETRANSPARENTFLAG, 0, 2); hwndButton = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_RESETMODES, g_hInst, NULL); + hwnd, (HMENU)IDC_RESETMODES, g_hInst, nullptr); MakeButtonSkinned(hwndButton); SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Clear view mode and return to default display"), BATF_UNICODE); SendMessage(hwndButton, BUTTONSETID, 0, (LPARAM) "ViewMode.Clear"); @@ -969,10 +969,10 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_USER + 100: SendDlgItemMessage(hwnd, IDC_RESETMODES, MBM_SETICOLIBHANDLE, 0, - (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_reset", LPGEN("Contact list"), LPGEN("Reset view mode"), NULL, 0, g_hInst, IDI_RESETVIEW)); + (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_reset", LPGEN("Contact list"), LPGEN("Reset view mode"), nullptr, 0, g_hInst, IDI_RESETVIEW)); SendDlgItemMessage(hwnd, IDC_CONFIGUREMODES, MBM_SETICOLIBHANDLE, 0, - (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_set", LPGEN("Contact list"), LPGEN("Setup view modes"), NULL, 0, g_hInst, IDI_SETVIEW)); + (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_set", LPGEN("Contact list"), LPGEN("Setup view modes"), nullptr, 0, g_hInst, IDI_SETVIEW)); { for (int i = 0; _buttons[i] != 0; i++) { @@ -989,13 +989,13 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_ERASEBKGND: if (g_CluiData.fDisableSkinEngine) - return sttDrawViewModeBackground(hwnd, (HDC)wParam, NULL); + return sttDrawViewModeBackground(hwnd, (HDC)wParam, nullptr); return 0; case WM_NCPAINT: case WM_PAINT: if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered) - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); else if (GetParent(hwnd) != pcli->hwndContactList || !g_CluiData.fLayered) { RECT rc = { 0 }; @@ -1038,13 +1038,13 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); ReleaseDC(hwnd, hdc); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); } return 0; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == BUTTONNEEDREDRAW) - pcli->pfnInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); return 0; case WM_TIMER: @@ -1073,7 +1073,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rc; GetWindowRect((HWND)lParam, &rc); POINT pt = { rc.left, rc.bottom }; - int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, GetParent(hwnd), NULL); + int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, GetParent(hwnd), nullptr); PostMessage(hwnd, WM_NULL, 0, 0); if (selection) { if (selection == 10001) @@ -1123,7 +1123,7 @@ struct view_mode_t int backgroundBmpUse; view_mode_t() : - hBmpBackground(NULL), + hBmpBackground(nullptr), bkColour(CLCDEFAULT_BKCOLOUR), useWinColors(CLCDEFAULT_USEWINDOWSCOLOURS), backgroundBmpUse(CLCDEFAULT_USEBITMAP) @@ -1156,18 +1156,18 @@ static int ehhViewModeBackgroundSettingsChanged(WPARAM, LPARAM) { if (view_mode.hBmpBackground) { DeleteObject(view_mode.hBmpBackground); - view_mode.hBmpBackground = NULL; + view_mode.hBmpBackground = nullptr; } if (g_CluiData.fDisableSkinEngine) { view_mode.bkColour = cliGetColor("ViewMode", "BkColour", CLCDEFAULT_BKCOLOUR); - if (db_get_b(NULL, "ViewMode", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrW tszBitmapName(db_get_wsa(NULL, "ViewMode", "BkBitmap")); + if (db_get_b(0, "ViewMode", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrW tszBitmapName(db_get_wsa(0, "ViewMode", "BkBitmap")); if (tszBitmapName) view_mode.hBmpBackground = Bitmap_Load(tszBitmapName); } - view_mode.useWinColors = db_get_b(NULL, "ViewMode", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - view_mode.backgroundBmpUse = db_get_w(NULL, "ViewMode", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + view_mode.useWinColors = db_get_b(0, "ViewMode", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + view_mode.backgroundBmpUse = db_get_w(0, "ViewMode", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); return 0; @@ -1185,7 +1185,7 @@ void CreateViewModeFrame() wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); wndclass.lpszMenuName = 0; wndclass.lpszClassName = L"CLVMFrameWindow"; @@ -1199,14 +1199,14 @@ void CreateViewModeFrame() frame.TBtname = TranslateT("View modes"); frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE; frame.align = alBottom; - frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL); + frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, nullptr); g_hwndViewModeFrame = frame.hWnd; hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS); CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)frame.hWnd, (LPARAM)ViewModePaintCallbackProc); //$$$$$ register sub for frame - ApplyViewMode(NULL); //Apply last selected view mode + ApplyViewMode(nullptr); //Apply last selected view mode } void ApplyViewMode(const char *Name, bool onlySelector) @@ -1219,7 +1219,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) mir_snprintf(szSetting, "%c_LastMode", 246); if (!Name) { // Name is null - apply last stored view mode - if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) { + if (!db_get_s(0, CLVM_MODULE, szSetting, &dbv)) { Name = NEWSTR_ALLOCA(dbv.pszVal); db_free(&dbv); } @@ -1232,7 +1232,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) // remove last applied view mode mir_snprintf(szSetting, "%c_LastMode", 246); - db_unset(NULL, CLVM_MODULE, szSetting); + db_unset(0, CLVM_MODULE, szSetting); if (g_CluiData.bOldUseGroups != (BYTE)-1) CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0); @@ -1253,7 +1253,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) if (!onlySelector) { mir_snprintf(szSetting, "%c%s_PF", 246, Name); - if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) { + if (!db_get_s(0, CLVM_MODULE, szSetting, &dbv)) { if (mir_strlen(dbv.pszVal) >= 2) { mir_strncpy(g_CluiData.protoFilter, dbv.pszVal, _countof(g_CluiData.protoFilter)); g_CluiData.protoFilter[_countof(g_CluiData.protoFilter) - 1] = 0; @@ -1262,7 +1262,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) mir_free(dbv.pszVal); } mir_snprintf(szSetting, "%c%s_GF", 246, Name); - if (!db_get_ws(NULL, CLVM_MODULE, szSetting, &dbv)) { + if (!db_get_ws(0, CLVM_MODULE, szSetting, &dbv)) { if (mir_wstrlen(dbv.ptszVal) >= 2) { mir_wstrncpy(g_CluiData.groupFilter, dbv.ptszVal, _countof(g_CluiData.groupFilter)); g_CluiData.groupFilter[_countof(g_CluiData.groupFilter) - 1] = 0; @@ -1271,29 +1271,29 @@ void ApplyViewMode(const char *Name, bool onlySelector) mir_free(dbv.ptszVal); } mir_snprintf(szSetting, "%c%s_SM", 246, Name); - g_CluiData.statusMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1); + g_CluiData.statusMaskFilter = db_get_dw(0, CLVM_MODULE, szSetting, -1); if (g_CluiData.statusMaskFilter >= 1) g_CluiData.bFilterEffective |= CLVM_FILTER_STATUS; mir_snprintf(szSetting, "%c%s_SSM", 246, Name); - g_CluiData.stickyMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1); + g_CluiData.stickyMaskFilter = db_get_dw(0, CLVM_MODULE, szSetting, -1); if (g_CluiData.stickyMaskFilter != -1) g_CluiData.bFilterEffective |= CLVM_FILTER_STICKYSTATUS; - g_CluiData.filterFlags = db_get_dw(NULL, CLVM_MODULE, Name, 0); + g_CluiData.filterFlags = db_get_dw(0, CLVM_MODULE, Name, 0); KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE); if (g_CluiData.filterFlags & CLVM_AUTOCLEAR) { mir_snprintf(szSetting, "%c%s_OPT", 246, Name); - DWORD timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0)); + DWORD timerexpire = LOWORD(db_get_dw(0, CLVM_MODULE, szSetting, 0)); mir_strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, _countof(g_CluiData.old_viewmode)); g_CluiData.old_viewmode[255] = 0; - CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL); + CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, nullptr); } else { //store last selected view mode only if it is not autoclear mir_snprintf(szSetting, "%c_LastMode", 246); - db_set_s(NULL, CLVM_MODULE, szSetting, Name); + db_set_s(0, CLVM_MODULE, szSetting, Name); } mir_strncpy(g_CluiData.current_viewmode, Name, _countof(g_CluiData.current_viewmode)); g_CluiData.current_viewmode[255] = 0; @@ -1301,7 +1301,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) if (g_CluiData.filterFlags & CLVM_USELASTMSG) { g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG; mir_snprintf(szSetting, "%c%s_LM", 246, Name); - g_CluiData.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0); + g_CluiData.lastMsgFilter = db_get_dw(0, CLVM_MODULE, szSetting, 0); if (LOBYTE(HIWORD(g_CluiData.lastMsgFilter))) g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN; else @@ -1327,7 +1327,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) if (g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) { if (g_CluiData.boldHideOffline == (BYTE)-1) - g_CluiData.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + g_CluiData.boldHideOffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); pcli->pfnSetHideOffline(false); } @@ -1345,7 +1345,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) if (bUseGroups != -1) { if (g_CluiData.bOldUseGroups == (BYTE)-1) - g_CluiData.bOldUseGroups = db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT); + g_CluiData.bOldUseGroups = db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT); CallService(MS_CLIST_SETUSEGROUPS, bUseGroups, 0); } @@ -1358,13 +1358,13 @@ void ApplyViewMode(const char *Name, bool onlySelector) SetWindowText(hwndSelector, ptrW(mir_utf8decodeW((Name[0] == 13) ? Name + 1 : Name))); Clist_Broadcast(CLM_AUTOREBUILD, 0, 0); - cliInvalidateRect(pcli->hwndStatus, NULL, FALSE); + cliInvalidateRect(pcli->hwndStatus, nullptr, FALSE); } static int SkinSetViewMode(WPARAM wParam /*char * name*/, LPARAM lParam /*int index*/) { if (wParam == 0 && lParam == 0) - ApplyViewMode(NULL); + ApplyViewMode(nullptr); else if (wParam && !IsBadStringPtrA((const char*)wParam, -1)) ApplyViewMode((const char*)wParam); return 0; diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index 69c49e8a6b..56fb39f0cf 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -17,7 +17,7 @@ static mir_cs xptCS; static void _sttXptCloseThemeData(XPTObject * xptObject) { CloseThemeData(xptObject->hThemeHandle); - xptObject->hThemeHandle = NULL; + xptObject->hThemeHandle = nullptr; } static void _sttXptReloadThemeData(XPTObject * xptObject) diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h index 7fd4444024..a5ebb5df48 100644 --- a/plugins/Clist_modern/src/stdafx.h +++ b/plugins/Clist_modern/src/stdafx.h @@ -121,8 +121,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DEFAULT_SKIN_FOLDER "Skins\\Modern contact list" extern wchar_t SkinsFolder[MAX_PATH]; -//macros to free data and set it pointer to NULL -#define mir_free_and_nil(x) {mir_free((void*)x); x=NULL;} +//macros to free data and set it pointer to nullptr +#define mir_free_and_nil(x) {mir_free((void*)x); x = 0;} // shared vars #define CLUI_FRAME_AUTOHIDENOTIFY 512 @@ -307,9 +307,9 @@ public: HashStringKeyNoCase(const wchar_t* szKey) { int codepage = 0; - int cbLen = WideCharToMultiByte(codepage, 0, szKey, -1, NULL, 0, NULL, NULL); + int cbLen = WideCharToMultiByte(codepage, 0, szKey, -1, nullptr, 0, nullptr, nullptr); char* result = (char*)malloc(cbLen + 1); - WideCharToMultiByte(codepage, 0, szKey, -1, result, cbLen, NULL, NULL); + WideCharToMultiByte(codepage, 0, szKey, -1, result, cbLen, nullptr, nullptr); result[cbLen] = 0; _strKey = result; @@ -320,7 +320,7 @@ public: ~HashStringKeyNoCase() { free(_strKey); - _strKey = NULL; + _strKey = nullptr; _dwKey = 0; } diff --git a/plugins/Clist_modern/src/version.h b/plugins/Clist_modern/src/version.h index 3a4e75fcf8..8ce13d08d1 100644 --- a/plugins/Clist_modern/src/version.h +++ b/plugins/Clist_modern/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 #define __RELEASE_NUM 1 -#define __BUILD_NUM 5 +#define __BUILD_NUM 6 #include -- cgit v1.2.3