diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/FloatingContacts/src | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/FloatingContacts/src')
-rw-r--r-- | plugins/FloatingContacts/src/bitmap_funcs.cpp | 46 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/filedrop.cpp | 40 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/main.cpp | 66 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/thumbs.cpp | 74 |
5 files changed, 115 insertions, 115 deletions
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index 577bd7ecc7..f49cc3d69c 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -36,30 +36,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. MyBitmap::MyBitmap()
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
}
MyBitmap::MyBitmap(int w, int h)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
allocate(w, h);
}
MyBitmap::MyBitmap(const char *fn, const char *fnAlpha)
{
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
- bitsSave = 0;
+ bitsSave = nullptr;
loadFromFile(fn, fnAlpha);
}
@@ -174,7 +174,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) }
delete[] bitsSave;
- bitsSave = 0;
+ bitsSave = nullptr;
}
void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h)
@@ -686,7 +686,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) }
else {
this->saveAlpha(x, y, w, h);
- DrawIconEx(this->getDC(), x, y, hic, w, h, 0, NULL, DI_NORMAL);
+ DrawIconEx(this->getDC(), x, y, hic, w, h, 0, nullptr, DI_NORMAL);
this->restoreAlpha(x, y, w, h);
}
@@ -726,7 +726,7 @@ void MyBitmap::DrawText(wchar_t *str, int x, int y, int blur, int strength) RECT rc; SetRect(&rc, 0, 0, sz.cx, sz.cy);
SetTextColor(tmp.getDC(), RGB(255, 255, 255));
SetBkColor(tmp.getDC(), RGB(0, 0, 0));
- ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, NULL);
+ ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr);
::DrawText(tmp.getDC(), str, -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
SelectObject(tmp.getDC(), hfnTmp);
@@ -872,7 +872,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) }
- HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
+ HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
delete[] pRgnData;
return hRgn;
}
@@ -940,9 +940,9 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha) return false;
BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm);
- SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL);
+ SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
- HDC dcTmp = CreateCompatibleDC(0);
+ HDC dcTmp = CreateCompatibleDC(nullptr);
GetBitmapDimensionEx(hBmpLoaded, &sz);
HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
@@ -997,8 +997,8 @@ void MyBitmap::allocate(int w, int h) DeleteDC(dcBmp);
}
- hBmp = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void **)&bits, 0, 0);
- dcBmp = CreateCompatibleDC(0);
+ hBmp = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void **)&bits, nullptr, 0);
+ dcBmp = CreateCompatibleDC(nullptr);
hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmp);
GdiFlush();
@@ -1011,9 +1011,9 @@ void MyBitmap::free() DeleteObject(SelectObject(dcBmp, hBmpSave));
DeleteDC(dcBmp);
- dcBmp = 0;
- hBmp = 0;
- bits = 0;
+ dcBmp = nullptr;
+ hBmp = nullptr;
+ bits = nullptr;
width = height = 0;
}
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 2b3fffc4a6..e9f3c97618 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -12,7 +12,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid, LPVOID *ppvOb return S_OK;
}
- *ppvObj = NULL;
+ *ppvObj = nullptr;
return (E_NOINTERFACE);
}
@@ -33,7 +33,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) {
*pdwEffect = 0;
- if (hwndCurDrag == NULL) {
+ if (hwndCurDrag == nullptr) {
*pdwEffect = DROPEFFECT_NONE;
}
else {
@@ -44,8 +44,8 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
{
- FORMATETC feFile = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
- FORMATETC feText = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feFile = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feText = { CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
if (S_OK == pData->QueryGetData(&feFile) ||
S_OK == pData->QueryGetData(&feText)) {
@@ -70,11 +70,11 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() {
ThumbInfo *pThumb = thumbList.FindThumb(hwndCurDrag);
- if (NULL != pThumb) {
+ if (nullptr != pThumb) {
pThumb->ThumbDeselect(TRUE);
}
- hwndCurDrag = NULL;
+ hwndCurDrag = nullptr;
return S_OK;
}
@@ -82,15 +82,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, DWORD *pdwEffect)
{
- FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC fe = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
*pdwEffect = DROPEFFECT_NONE;
- if (hwndCurDrag == NULL)
+ if (hwndCurDrag == nullptr)
return S_OK;
ThumbInfo *pThumb = (ThumbInfo*)GetWindowLongPtr(hwndCurDrag, GWLP_USERDATA);
- if (pThumb == NULL)
+ if (pThumb == nullptr)
return S_OK;
STGMEDIUM stg;
@@ -108,19 +108,19 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D if (!bFormatText) {
HDROP hDrop = (HDROP)stg.hGlobal;
- if (hDrop != NULL) {
+ if (hDrop != nullptr) {
OnDropFiles(hDrop, pThumb);
}
}
else {
wchar_t *pText = (wchar_t*)GlobalLock(stg.hGlobal);
- if (pText != NULL) {
+ if (pText != nullptr) {
SendMsgDialog(hwndCurDrag, pText);
GlobalUnlock(stg.hGlobal);
}
}
- if (stg.pUnkForRelease != NULL) {
+ if (stg.pUnkForRelease != nullptr) {
stg.pUnkForRelease->Release();
}
else {
@@ -137,15 +137,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb)
{
- UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
+ UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
char **ppDroppedItems = (char**)malloc(sizeof(char*)*(nDroppedItemsCount + 1));
- if (ppDroppedItems == NULL) {
+ if (ppDroppedItems == nullptr) {
return FALSE;
}
- ppDroppedItems[nDroppedItemsCount] = NULL;
+ ppDroppedItems[nDroppedItemsCount] = nullptr;
char szFilename[MAX_PATH];
for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) {
@@ -158,8 +158,8 @@ BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) char **ppFiles = (char**)malloc(sizeof(char *)* (nFilesCount + 1));
BOOL bSuccess = FALSE;
- if (ppFiles != NULL) {
- ppFiles[nFilesCount] = NULL;
+ if (ppFiles != nullptr) {
+ ppFiles[nFilesCount] = nullptr;
ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles);
@@ -198,7 +198,7 @@ static int CountFiles(char *szItem) char szDirName[MAX_PATH];
strncpy(szDirName, szItem, MAX_PATH - 1);
- if (NULL != strstr(szItem, "*.*")) {
+ if (nullptr != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
@@ -233,7 +233,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) char szDirName[MAX_PATH];
strncpy(szDirName, szItem, MAX_PATH - 1);
- if (NULL != strstr(szItem, "*.*")) {
+ if (nullptr != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
@@ -252,7 +252,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) strncpy(szFile, szItem, nSize - 1);
- if (NULL != strstr(szFile, "*.*")) {
+ if (nullptr != strstr(szFile, "*.*")) {
szFile[mir_strlen(szFile) - 3] = '\0';
mir_strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile));
}
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 9ac311a663..d840c61e62 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -161,7 +161,7 @@ static int OnContactDrag(WPARAM hContact, LPARAM) GetCursorPos(&pt);
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb == NULL) {
+ if (pThumb == nullptr) {
int idStatus = GetContactStatus(hContact);
if (!fcOpt.bHideAll && !HideOnFullScreen() && (!fcOpt.bHideOffline || IsStatusVisible(idStatus)) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) {
@@ -186,7 +186,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (hNewContact == hContact && pThumb != NULL) {
+ if (hNewContact == hContact && pThumb != nullptr) {
hNewContact = NULL;
GetWindowRect(hwndMiranda, &rcMiranda);
@@ -200,7 +200,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) static int OnContactDragStop(WPARAM hContact, LPARAM)
{
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb != NULL && hNewContact == hContact) {
+ if (pThumb != nullptr && hNewContact == hContact) {
thumbList.RemoveThumb(pThumb);
hNewContact = NULL;
}
@@ -236,7 +236,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
- if (pThumb == NULL)
+ if (pThumb == nullptr)
return 0;
// Only on these 2 events we need to refresh
@@ -278,7 +278,7 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM) {
ThumbInfo *pThumb = thumbList.FindThumbByContact(wParam);
- Menu_ShowItem(hMenuItemRemove, pThumb != NULL);
+ Menu_ShowItem(hMenuItemRemove, pThumb != nullptr);
Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll);
return 0;
}
@@ -313,19 +313,19 @@ static void LoadDBSettings() void SendMsgDialog(HWND hwnd, wchar_t *pText)
{
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- if (pThumb != NULL)
+ if (pThumb != nullptr)
CallService(MS_MSG_SENDMESSAGEW, (WPARAM)pThumb->hContact, (LPARAM)pText);
}
static void ShowContactMenu(HWND hwnd, POINT pt)
{
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- if (pThumb != NULL) {
+ if (pThumb != nullptr) {
hContactMenu = Menu_BuildContactMenu(pThumb->hContact);
- if (hContactMenu == NULL)
+ if (hContactMenu == nullptr)
return;
- int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
Clist_MenuProcessCommand(idCommand, MPCF_CONTACTMENU, pThumb->hContact);
}
}
@@ -358,7 +358,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM BitBlt(hdc, 0, 0, pThumb->bmpContent.getWidth(), pThumb->bmpContent.getHeight(), pThumb->bmpContent.getDC(), 0, 0, SRCCOPY);
//RepaintWindow( hwnd, hdc );
ReleaseDC(hwnd, hdc);
- ValidateRect(hwnd, NULL);
+ ValidateRect(hwnd, nullptr);
return 0;
}
@@ -463,15 +463,15 @@ void ApplyOptionsChanges() CreateBackgroundBrush();
if (!fcOpt.bToTop && ToTopTimerID) {
- KillTimer(NULL, ToTopTimerID);
+ KillTimer(nullptr, ToTopTimerID);
ToTopTimerID = 0;
}
if (fcOpt.bToTop) {
- if (ToTopTimerID) KillTimer(NULL, ToTopTimerID);
+ if (ToTopTimerID) KillTimer(nullptr, ToTopTimerID);
fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
- ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
+ ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
OnStatusChanged();
@@ -503,12 +503,12 @@ static void UnregisterWindowClass() static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY)
{
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if (pThumb != NULL)
+ if (pThumb != nullptr)
return;
// Prepare for window creation
- HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, NULL, NULL, hInst, NULL);
- if (hwnd == NULL)
+ HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, nullptr, nullptr, hInst, nullptr);
+ if (hwnd == nullptr)
return;
pThumb = thumbList.AddThumb(hwnd, ptszName, hContact);
@@ -526,9 +526,9 @@ static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY) static void CreateThumbsFont()
{
for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++) {
- if (NULL != hFont[nFontId]) {
+ if (nullptr != hFont[nFontId]) {
DeleteObject(hFont[nFontId]);
- hFont[nFontId] = NULL;
+ hFont[nFontId] = nullptr;
}
LOGFONT lf;
@@ -541,25 +541,25 @@ static void CreateBackgroundBrush() {
bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
- if (NULL != hLTEdgesPen) {
+ if (nullptr != hLTEdgesPen) {
DeleteObject(hLTEdgesPen);
- hLTEdgesPen = NULL;
+ hLTEdgesPen = nullptr;
}
- if (NULL != hRBEdgesPen) {
+ if (nullptr != hRBEdgesPen) {
DeleteObject(hRBEdgesPen);
- hRBEdgesPen = NULL;
+ hRBEdgesPen = nullptr;
}
- if (NULL != hBmpBackground) {
+ if (nullptr != hBmpBackground) {
DeleteObject(hBmpBackground);
- hBmpBackground = NULL;
+ hBmpBackground = nullptr;
}
- if (NULL != hBkBrush) {
+ if (nullptr != hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
DeleteObject(hBkBrush);
- hBkBrush = NULL;
+ hBkBrush = nullptr;
}
if (db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
@@ -591,7 +591,7 @@ static int GetContactStatus(MCONTACT hContact) }
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -765,7 +765,7 @@ static void LoadContact(MCONTACT hContact) DWORD dwPos = db_get_dw(hContact, MODULE, "ThumbsPos", (DWORD)-1);
if (dwPos != -1) {
wchar_t *ptName = pcli->pfnGetContactDisplayName(hContact, 0);
- if (ptName != NULL) {
+ if (ptName != nullptr) {
int nX = DB_POS_GETX(dwPos);
int nY = DB_POS_GETY(dwPos);
@@ -778,7 +778,7 @@ static void LoadContact(MCONTACT hContact) BOOL HideOnFullScreen()
{
BOOL bFullscreen = FALSE;
- HWND hWnd = 0;
+ HWND hWnd = nullptr;
if (fcOpt.bHideWhenFullscreen) {
int w = GetSystemMetrics(SM_CXSCREEN);
@@ -893,7 +893,7 @@ static int OnModulesLoded(WPARAM, LPARAM) if (fcOpt.bToTop) {
fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
- ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
+ ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
return 0;
}
@@ -924,7 +924,7 @@ extern "C" int __declspec(dllexport) Load() char szId[20];
mir_snprintf(szId, "Font%d", i);
- FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], NULL, NULL, i + 1, false, &lf, defColor);
+ FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], nullptr, nullptr, i + 1, false, &lf, defColor);
}
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
@@ -945,11 +945,11 @@ extern "C" int __declspec(dllexport) Unload() if (hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
DeleteObject(hBkBrush);
- hBkBrush = NULL;
+ hBkBrush = nullptr;
}
for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++)
- if (NULL != hFont[nFontId])
+ if (nullptr != hFont[nFontId])
DeleteObject(hFont[nFontId]);
UnregisterWindowClass();
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b9338223b4..c27c29b242 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -202,8 +202,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP mir_snprintf(szPercent, "%d%%", btOpacity);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != nullptr);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != nullptr);
}
return TRUE;
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index f1d3447e74..27f953a689 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -12,15 +12,15 @@ static BOOL bMouseMoved = FALSE; static int nLeft = 0;
static int nTop = 0;
static int nOffs = 5;
-static ThumbInfo *pThumbMouseIn = NULL;
+static ThumbInfo *pThumbMouseIn = nullptr;
static void SnapToScreen(RECT rcThumb, int nX, int nY, int *pX, int *pY)
{
int nWidth;
int nHeight;
- assert(NULL != pX);
- assert(NULL != pY);
+ assert(nullptr != pX);
+ assert(nullptr != pY);
nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
@@ -41,7 +41,7 @@ ThumbInfo::ThumbInfo() ThumbInfo::~ThumbInfo()
{
if (pThumbMouseIn == this) {
- pThumbMouseIn = NULL;
+ pThumbMouseIn = nullptr;
KillTimer(hwnd, TIMERID_LEAVE_T);
}
dropTarget->Release();
@@ -64,13 +64,13 @@ void ThumbInfo::PositionThumb(int nX, int nY) ThumbInfo *pThumb = this;
while (pThumb) {
pThumb->PositionThumbWorker(pos.x, pos.y, &pos);
- if (NULL != pThumb->hwnd) /* Wine fix. */
+ if (nullptr != pThumb->hwnd) /* Wine fix. */
hdwp = DeferWindowPos(hdwp, pThumb->hwnd, HWND_TOPMOST, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
pThumb->ptPos = pos;
pos.x += pThumb->szSize.cx;
- pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : NULL;
+ pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : nullptr;
}
EndDeferWindowPos(hdwp);
@@ -102,7 +102,7 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos) // Docking and screen boundaries check
SnapToScreen(rcThumb, nX, nY, &nNewX, &nNewY);
- bLeading = dockOpt.hwndRight != NULL;
+ bLeading = dockOpt.hwndRight != nullptr;
if (fcOpt.bMoveTogether)
UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft));
@@ -238,7 +238,7 @@ void ThumbInfo::ResizeThumb() int index = FLT_FONTID_NOTONLIST;
himlMiranda = Clist_GetImageList();
- if (himlMiranda == NULL)
+ if (himlMiranda == nullptr)
return;
SIZEL sizeIcon;
@@ -247,7 +247,7 @@ void ThumbInfo::ResizeThumb() HDC hdc = GetWindowDC(hwnd);
if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
char *szProto = GetContactProto(hContact);
- if (NULL != szProto) {
+ if (nullptr != szProto) {
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
@@ -352,7 +352,7 @@ void ThumbInfo::OnLButtonUp() if (bMouseDown) {
bMouseDown = FALSE;
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
// Check whether we shoud remove the window
GetWindowRect(hwndMiranda, &rcMiranda);
@@ -390,11 +390,11 @@ void ThumbInfo::OnMouseMove(int nX, int nY) ptOld = ptNew;
}
- else SetCursor(LoadCursor(NULL, IDC_ARROW));
+ else SetCursor(LoadCursor(nullptr, IDC_ARROW));
// Update selection status
if (!pThumbMouseIn) {
- SetTimer(hwnd, TIMERID_LEAVE_T, 10, NULL);
+ SetTimer(hwnd, TIMERID_LEAVE_T, 10, nullptr);
pThumbMouseIn = this;
ThumbSelect(TRUE);
@@ -423,7 +423,7 @@ void ThumbInfo::OnMouseMove(int nX, int nY) return;
tmpTimeIn = (fcOpt.TimeIn > 0) ? fcOpt.TimeIn : CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
- SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, 0);
+ SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, nullptr);
fTipTimerActive = TRUE;
}
}
@@ -483,10 +483,10 @@ void ThumbInfo::UpdateContent() HDC hdcDraw = bmpContent.getDC();
SetRect(&rc, 0, 0, szSize.cx, szSize.cy);
- if (NULL != hBmpBackground) {
+ if (nullptr != hBmpBackground) {
RECT rcBkgnd;
SetRect(&rcBkgnd, 0, 0, szSize.cx, szSize.cy);
- if (NULL != hLTEdgesPen)
+ if (nullptr != hLTEdgesPen)
InflateRect(&rcBkgnd, -1, -1);
int width = rcBkgnd.right - rcBkgnd.left;
int height = rcBkgnd.bottom - rcBkgnd.top;
@@ -549,19 +549,19 @@ void ThumbInfo::UpdateContent() }
else FillRect(hdcDraw, &rc, hBkBrush);
- if (NULL != hLTEdgesPen) {
+ if (nullptr != hLTEdgesPen) {
HPEN hOldPen = (HPEN)SelectObject(hdcDraw, hLTEdgesPen);
- MoveToEx(hdcDraw, 0, 0, NULL);
+ MoveToEx(hdcDraw, 0, 0, nullptr);
LineTo(hdcDraw, szSize.cx, 0);
- MoveToEx(hdcDraw, 0, 0, NULL);
+ MoveToEx(hdcDraw, 0, 0, nullptr);
LineTo(hdcDraw, 0, szSize.cy);
SelectObject(hdcDraw, hRBEdgesPen);
- MoveToEx(hdcDraw, 0, szSize.cy - 1, NULL);
+ MoveToEx(hdcDraw, 0, szSize.cy - 1, nullptr);
LineTo(hdcDraw, szSize.cx - 1, szSize.cy - 1);
- MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, NULL);
+ MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, nullptr);
LineTo(hdcDraw, szSize.cx - 1, 0);
SelectObject(hdcDraw, hOldPen);
@@ -575,7 +575,7 @@ void ThumbInfo::UpdateContent() if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
char *szProto = GetContactProto(hContact);
- if (NULL != szProto) {
+ if (nullptr != szProto) {
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
@@ -656,7 +656,7 @@ void ThumbInfo::UpdateContent() blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
- UpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
+ UpdateLayeredWindow(hwnd, nullptr, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
}
void ThumbInfo::PopupMessageDialog()
@@ -678,7 +678,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) GetThumbRect(&rc);
if (!PtInRect(&rc, pt)) {
KillTimer(hwnd, TIMERID_LEAVE_T);
- pThumbMouseIn = NULL;
+ pThumbMouseIn = nullptr;
ThumbDeselect(TRUE);
}
}
@@ -704,7 +704,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight)
{
- if (pThumbRight->dockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL) {
+ if (pThumbRight->dockOpt.hwndLeft == nullptr && pThumbLeft->dockOpt.hwndRight == nullptr) {
pThumbRight->dockOpt.hwndLeft = pThumbLeft->hwnd;
pThumbLeft->dockOpt.hwndRight = pThumbRight->hwnd;
}
@@ -713,20 +713,20 @@ void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight) void UndockThumbs(ThumbInfo *pThumb1, ThumbInfo *pThumb2)
{
- if (pThumb1 == NULL || pThumb2 == NULL)
+ if (pThumb1 == nullptr || pThumb2 == nullptr)
return;
if (pThumb1->dockOpt.hwndRight == pThumb2->hwnd)
- pThumb1->dockOpt.hwndRight = NULL;
+ pThumb1->dockOpt.hwndRight = nullptr;
if (pThumb1->dockOpt.hwndLeft == pThumb2->hwnd)
- pThumb1->dockOpt.hwndLeft = NULL;
+ pThumb1->dockOpt.hwndLeft = nullptr;
if (pThumb2->dockOpt.hwndRight == pThumb1->hwnd)
- pThumb2->dockOpt.hwndRight = NULL;
+ pThumb2->dockOpt.hwndRight = nullptr;
if (pThumb2->dockOpt.hwndLeft == pThumb1->hwnd)
- pThumb2->dockOpt.hwndLeft = NULL;
+ pThumb2->dockOpt.hwndLeft = nullptr;
}
/////////////////////////////////////////////////////////////////////////////
@@ -740,16 +740,16 @@ ThumbList::~ThumbList() ThumbInfo *ThumbList::AddThumb(HWND hwnd, wchar_t *ptszName, MCONTACT hContact)
{
- if (ptszName == NULL || hContact == NULL || hwnd == NULL)
- return NULL;
+ if (ptszName == nullptr || hContact == NULL || hwnd == nullptr)
+ return nullptr;
ThumbInfo *pThumb = new ThumbInfo;
wcsncpy_s(pThumb->ptszName, ptszName, _TRUNCATE);
pThumb->hContact = hContact;
pThumb->hwnd = hwnd;
- pThumb->dockOpt.hwndLeft = NULL;
- pThumb->dockOpt.hwndRight = NULL;
+ pThumb->dockOpt.hwndLeft = nullptr;
+ pThumb->dockOpt.hwndRight = nullptr;
pThumb->fTipActive = FALSE;
RegHotkey(hContact, hwnd);
@@ -774,22 +774,22 @@ void ThumbList::RemoveThumb(ThumbInfo *pThumb) ThumbInfo* ThumbList::FindThumb(HWND hwnd)
{
- if (!hwnd) return NULL;
+ if (!hwnd) return nullptr;
for (int i = 0; i < getCount(); ++i)
if (items[i]->hwnd == hwnd)
return items[i];
- return NULL;
+ return nullptr;
}
ThumbInfo *ThumbList::FindThumbByContact(MCONTACT hContact)
{
- if (!hContact) return NULL;
+ if (!hContact) return nullptr;
for (int i = 0; i < getCount(); ++i)
if (items[i]->hContact == hContact)
return items[i];
- return NULL;
+ return nullptr;
}
|