diff options
Diffstat (limited to 'src/mir_app/src/findadd.cpp')
-rw-r--r-- | src/mir_app/src/findadd.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 1400b1c9eb..e5af7a106a 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -30,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HM_SEARCHACK (WM_USER+10) #define M_SETGROUPVISIBILITIES (WM_USER+11) -static HWND hwndFindAdd = NULL; +static HWND hwndFindAdd = nullptr; static HANDLE hHookModulesLoaded = 0; -static HGENMENU hMainMenuItem = NULL; +static HGENMENU hMainMenuItem = nullptr; static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam); static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) @@ -136,7 +136,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) /* draw everything before the pivot */ int x = *pivot; while (x > (-height)) { - MoveToEx(hMemDC, x + height2, 0, NULL); + MoveToEx(hMemDC, x + height2, 0, nullptr); LineTo(hMemDC, x - height2, height); x -= 12; } @@ -144,7 +144,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) /* draw everything after the pivot */ x = *pivot; while (x < width + height) { - MoveToEx(hMemDC, x + height2, 0, NULL); + MoveToEx(hMemDC, x + height2, 0, nullptr); LineTo(hMemDC, x - height2, height); x += 12; } @@ -157,9 +157,9 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) DeleteObject(SelectObject(hMemDC, hPen)); /* cap the top and bottom */ hPen = (HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE))); - MoveToEx(hMemDC, 0, 0, NULL); + MoveToEx(hMemDC, 0, 0, nullptr); LineTo(hMemDC, width, 0); - MoveToEx(hMemDC, 0, height - 1, NULL); + MoveToEx(hMemDC, 0, height - 1, nullptr); LineTo(hMemDC, width, height - 1); /* select in the old pen and delete the new pen */ DeleteObject(SelectObject(hMemDC, hPen)); @@ -181,7 +181,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) static void StartThrobber(HWND hwndDlg, FindAddDlgData *dat) { dat->throbbing = 1; - SetTimer(hwndDlg, TIMERID_THROBBER, 25, NULL); + SetTimer(hwndDlg, TIMERID_THROBBER, 25, nullptr); } static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat) @@ -189,7 +189,7 @@ static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat) KillTimer(hwndDlg, TIMERID_THROBBER); dat->throbbing = 0; dat->pivot = 0; - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), nullptr, FALSE); } static LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -215,27 +215,27 @@ static LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WP static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - if (szProto == NULL) + if (szProto == nullptr) return; - if (dat->hwndAdvSearch == NULL) { + if (dat->hwndAdvSearch == nullptr) { RECT rc; - dat->hwndAdvSearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); - if (dat->hwndAdvSearch != NULL) + dat->hwndAdvSearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); + if (dat->hwndAdvSearch != nullptr) mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc); GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc); SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } AnimateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE | AW_SLIDE | AW_HOR_POSITIVE); - RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(dat->hwndAdvSearch, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_CHECKED); } static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) { - if (dat->hwndTinySearch == NULL) + if (dat->hwndTinySearch == nullptr) return; RECT rc; @@ -252,11 +252,11 @@ static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - if (szProto == NULL) + if (szProto == nullptr) return; - if (dat->hwndTinySearch == NULL) { - dat->hwndTinySearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); + if (dat->hwndTinySearch == nullptr) { + dat->hwndTinySearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); if (dat->hwndTinySearch) ReposTinySearchDlg(hwndDlg, dat); else @@ -267,7 +267,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) static void HideAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) { - if (dat->hwndAdvSearch == NULL) + if (dat->hwndAdvSearch == nullptr) return; AnimateWindow(dat->hwndAdvSearch, 150, AW_HIDE | AW_BLEND); @@ -293,7 +293,7 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl) static void SetListItemText(HWND hwndList, int idx, int col, wchar_t *szText) { - if (szText == NULL || *szText == 0) + if (szText == nullptr || *szText == 0) szText = TranslateT("<not specified>"); ListView_SetItemText(hwndList, idx, col, szText); @@ -363,8 +363,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0); SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); - wchar_t *szProto = NULL; - ptrW tszLast(db_get_wsa(NULL, "FindAdd", "LastSearched")); + wchar_t *szProto = nullptr; + ptrW tszLast(db_get_wsa(0, "FindAdd", "LastSearched")); if (tszLast) szProto = NEWWSTR_ALLOCA(tszLast); @@ -373,7 +373,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!Proto_IsAccountEnabled(accounts[i])) continue; - DWORD caps = (DWORD)CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD caps = (DWORD)CallProtoServiceInt(0, accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_ANYSEARCH) netProtoCount++; } @@ -401,7 +401,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!Proto_IsAccountEnabled(pa)) continue; - DWORD caps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD caps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps & PF1_ANYSEARCH)) continue; @@ -410,7 +410,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (textSize.cx > cbwidth) cbwidth = textSize.cx; - HICON hIcon = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); + HICON hIcon = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(dat->himlComboIcons, hIcon); DestroyIcon(hIcon); cbei.lParam = (LPARAM)pa->szModuleName; @@ -428,7 +428,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, index, 0); SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0); - Utils_RestoreWindowPosition(hwndDlg, NULL, "FindAdd", ""); + Utils_RestoreWindowPosition(hwndDlg, 0, "FindAdd", ""); } return TRUE; @@ -472,18 +472,18 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if (szProto == (char *)CB_ERR) break; - if (szProto == NULL) { + if (szProto == nullptr) { for (int i = 0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; if (Proto_IsAccountEnabled(pa)) { - DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD protoCaps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; } } } else { - DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD protoCaps = (DWORD)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_BASICSEARCH) dat->showProtoId = 1; if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; @@ -493,7 +493,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; } if (dat->showProtoId) { - char *szUniqueId = (char*)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + char *szUniqueId = (char*)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (szUniqueId) SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId); else @@ -510,7 +510,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowTinySearchDlg(hwndDlg, dat); else if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } #define en(id, t) ShowWindow( GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE) @@ -610,11 +610,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg, dat); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); - dat->hwndAdvSearch = NULL; + dat->hwndAdvSearch = nullptr; } if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0); } @@ -672,8 +672,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg, dat); if (dat->searchCount) { //cancel search SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); - if (dat->hResultHook) { UnhookEvent(dat->hResultHook); dat->hResultHook = NULL; } - if (dat->search) { mir_free(dat->search); dat->search = NULL; } + if (dat->hResultHook) { UnhookEvent(dat->hResultHook); dat->hResultHook = nullptr; } + if (dat->search) { mir_free(dat->search); dat->search = nullptr; } dat->searchCount = 0; StopThrobber(hwndDlg, dat); SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); @@ -681,7 +681,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if (dat->search) - mir_free(dat->search), dat->search = NULL; + mir_free(dat->search), dat->search = nullptr; dat->searchCount = 0; dat->hResultHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_SEARCHACK); if (IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) @@ -719,7 +719,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAME, PF1_SEARCHBYNAME, &psbn); } else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) { - if (dat->hwndAdvSearch == NULL) + if (dat->hwndAdvSearch == nullptr) MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK); else BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndAdvSearch); @@ -728,7 +728,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->searchCount == 0) { if (dat->hResultHook) { UnhookEvent(dat->hResultHook); - dat->hResultHook = NULL; + dat->hResultHook = nullptr; } break; } @@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP int i; for (i = 0; i < dat->searchCount; i++) - if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !mir_strcmp(dat->search[i].szProto, ack->szModule)) break; + if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != nullptr && !mir_strcmp(dat->search[i].szProto, ack->szModule)) break; if (i == dat->searchCount) break; @@ -828,9 +828,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP memmove(dat->search + i, dat->search + i + 1, sizeof(struct ProtoSearchInfo)*(dat->searchCount - i)); if (dat->searchCount == 0) { mir_free(dat->search); - dat->search = NULL; + dat->search = nullptr; UnhookEvent(dat->hResultHook); - dat->hResultHook = NULL; + dat->hResultHook = nullptr; SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); StopThrobber(hwndDlg, dat); } @@ -876,7 +876,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.lParam = (LPARAM)lsr; for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); - if (szComboProto == NULL) continue; + if (szComboProto == nullptr) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { COMBOBOXEXITEM cbei = { 0 }; cbei.mask = CBEIF_IMAGE; @@ -916,7 +916,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.lParam = (LPARAM)lsr; for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); - if (szComboProto == NULL) continue; + if (szComboProto == nullptr) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { COMBOBOXEXITEM cbei = { 0 }; cbei.mask = CBEIF_IMAGE; @@ -945,29 +945,29 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); wchar_t *szProto = (wchar_t*)alloca(sizeof(wchar_t)*(len + 1)); - if (szProto != NULL) { + if (szProto != nullptr) { *szProto = '\0'; SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto); - db_set_ws(NULL, "FindAdd", "LastSearched", szProto); + db_set_ws(0, "FindAdd", "LastSearched", szProto); } SaveColumnSizes(hwndList); - if (dat->hResultHook != NULL) + if (dat->hResultHook != nullptr) UnhookEvent(dat->hResultHook); FreeSearchResults(hwndList); ImageList_Destroy(dat->himlComboIcons); mir_free(dat->search); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); - dat->hwndAdvSearch = NULL; + dat->hwndAdvSearch = nullptr; } if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } mir_free(dat); Window_FreeIcon_IcoLib(hwndDlg); - Utils_SaveWindowPosition(hwndDlg, NULL, "FindAdd", ""); + Utils_SaveWindowPosition(hwndDlg, 0, "FindAdd", ""); break; } return FALSE; @@ -994,12 +994,12 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) if (!Proto_IsAccountEnabled(pa)) continue; - int protoCaps = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } if (netProtoCount > 0) - hwndFindAdd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_FINDADD), NULL, DlgProcFindAdd); + hwndFindAdd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_FINDADD), nullptr, DlgProcFindAdd); } return 0; } @@ -1008,7 +1008,7 @@ int FindAddPreShutdown(WPARAM, LPARAM) { if (IsWindow(hwndFindAdd)) DestroyWindow(hwndFindAdd); - hwndFindAdd = NULL; + hwndFindAdd = nullptr; return 0; } @@ -1037,7 +1037,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) // Make sure we have some networks to search on. for (int i = 0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; - int protoCaps = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } |