summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-15 21:47:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-15 21:47:10 +0000
commit9d482ed81c2a6a3361a5a9b2d0efbfc4b6b815c5 (patch)
treee5b304c159f7c79ab44926eee439eb93288acec6 /plugins/UserInfoEx/src
parent7fe6e93058f0e9253e2a79d7fc2d7a136784f791 (diff)
- POPUPDATAT_V2 replaced with POPUPDATAT in all possible cases;
- fix: wrong popup initialization code; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4057 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp325
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp278
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp22
4 files changed, 259 insertions, 370 deletions
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 065f274821..0b57e0d2e8 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -561,132 +561,96 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
*/
static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
- {
- POPUPDATAT_V2 pd;
- LPMSGPOPUPDATA pmpd;
- LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
-
- MoveWindow(hDlg,-10,-10,0,0,FALSE);
- pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
- if (pmpd)
- {
- ZeroMemory(&pd, sizeof(pd));
- pd.cbSize = sizeof(POPUPDATAT_V2);
- pd.lchContact = NULL; //(HANDLE)wParam;
- // icon
- pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
-
- // CALLBAC Proc
- pd.PluginWindowProc = PopupProc;
- //
- pd.PluginData = pmpd;
-
- pd.iSeconds = -1;
-
- pd.hNotification = NULL;
- pd.lpActions = pmpd->pa;
-
- // set color of popup
- switch (pMsgBox->uType & MB_ICONMASK)
- {
- case MB_ICON_ERROR:
- {
- pd.colorBack = RGB(200, 10, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
-
- case MB_ICON_WARNING:
- {
- pd.colorBack = RGB(200, 100, 0);
- pd.colorText = RGB(255, 255, 255);
- }
- break;
+ LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
+
+ MoveWindow(hDlg,-10,-10,0,0,FALSE);
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
+ if (pmpd) {
+ POPUPDATAT_V2 pd = { 0 };
+ pd.cbSize = sizeof(POPUPDATAT_V2);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+ // icon
+ pd.lchIcon = MsgLoadIcon(pMsgBox);
+ mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
+ mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+
+ // CALLBAC Proc
+ pd.PluginWindowProc = PopupProc;
+ pd.PluginData = pmpd;
+ pd.iSeconds = -1;
+ pd.lpActions = pmpd->pa;
+
+ // set color of popup
+ switch (pMsgBox->uType & MB_ICONMASK) {
+ case MB_ICON_ERROR:
+ pd.colorBack = RGB(200, 10, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- default:
- {
- if (pMsgBox->uType & MB_CUSTOMCOLOR)
- {
- pd.colorBack = pMsgBox->colorBack;
- pd.colorText = pMsgBox->colorText;
- }
- }
- }
+ case MB_ICON_WARNING:
+ pd.colorBack = RGB(200, 100, 0);
+ pd.colorText = RGB(255, 255, 255);
+ break;
- // handle for MakePopupAction
- pmpd->hDialog = hDlg;
+ default:
+ if (pMsgBox->uType & MB_CUSTOMCOLOR) {
+ pd.colorBack = pMsgBox->colorBack;
+ pd.colorText = pMsgBox->colorText;
+ }
+ }
- // active buttons
- switch (MB_TYPE(pMsgBox->uType))
- {
- case MB_OK:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- }
- break;
+ // handle for MakePopupAction
+ pmpd->hDialog = hDlg;
- case MB_OKCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ // active buttons
+ switch (MB_TYPE(pMsgBox->uType)) {
+ case MB_OK:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ break;
- case MB_RETRYCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_OKCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDOK);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_YESNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_RETRYCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- case MB_ABORTRETRYIGNORE:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
- }
- break;
+ case MB_YESNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
- case MB_YESNOCANCEL:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
- }
- break;
+ case MB_ABORTRETRYIGNORE:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDABORT);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDRETRY);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDIGNORE);
+ break;
- case MB_YESALLNO:
- {
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- }
- break;
+ case MB_YESNOCANCEL:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDCANCEL);
+ break;
- } // end* switch
+ case MB_YESALLNO:
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDALL);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
+ break;
+ }
- // create popup
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
- if (MB_TYPE(pMsgBox->uType) == MB_OK)
- {
- EndDialog(hDlg, IDOK);
- }
- } // end*if (pmpd)
- break;
- } // end* WM_INITDIALOG:
- } // end* switch (uMsg)
+ // create popup
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
+ if (MB_TYPE(pMsgBox->uType) == MB_OK)
+ EndDialog(hDlg, IDOK);
+ }
+ break;
+ }
return FALSE;
}
@@ -702,57 +666,39 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
**/
static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case UM_POPUPACTION:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
-
- if (pmpd)
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- case IDCANCEL:
- case IDABORT:
- case IDRETRY:
- case IDIGNORE:
- case IDYES:
- case IDNO:
- case IDALL:
- case IDNONE:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, LOWORD(wParam));
- }
+ switch (uMsg) {
+ case UM_POPUPACTION:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ case IDABORT:
+ case IDRETRY:
+ case IDIGNORE:
+ case IDYES:
+ case IDNO:
+ case IDALL:
+ case IDNONE:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, LOWORD(wParam));
break;
- default:
- {
- if (IsWindow(pmpd->hDialog))
- EndDialog(pmpd->hDialog, IDCANCEL);
- }
- }
+ default:
+ if (IsWindow(pmpd->hDialog))
+ EndDialog(pmpd->hDialog, IDCANCEL);
}
- PUDeletePopUp(hDlg);
- }
- }
- break;
-
- case UM_FREEPLUGINDATA:
- {
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
- if (pmpd > 0) {
- MIR_FREE(pmpd);
}
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
+ PUDeletePopUp(hDlg);
}
break;
- default:
- break;
+ case UM_FREEPLUGINDATA:
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)PUGetPluginData(hDlg);
+ if (pmpd > 0)
+ MIR_FREE(pmpd);
+ return TRUE;
}
return DefWindowProc(hDlg, uMsg, wParam, lParam);
}
@@ -768,28 +714,21 @@ static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
**/
INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
{
- INT rc = -1;
LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
// check input
- if (PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX))
- {
+ if ( PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX)) {
// Shall the MessageBox displayed as popup?
if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup?
ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist?
myGlobals.PopUpActionsExist == 1 && // popup support ext stuct?
(DB::Setting::GetDWord(NULL, "PopUp","Actions", 0) & 1) && // popup++ actions on?
- DB::Setting::GetByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX) // user likes popups?
- )
- {
- rc = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
- }
- else
- {
- rc = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
- }
+ DB::Setting::GetByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
+ return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
+
+ return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
}
- return rc;
+ return -1;
}
/**
@@ -799,22 +738,22 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
**/
INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInfo, LPTSTR pszFormat, ...)
{
- MSGBOX mb = {0};
- TCHAR tszMsg[MAX_SECONDLINE];
- va_list vl;
+ TCHAR tszMsg[MAX_SECONDLINE];
+ va_list vl;
va_start(vl, pszFormat);
mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
- mb.cbSize = sizeof(MSGBOX);
- mb.hParent = hParent;
- mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
- mb.hiMsg = NULL;
- mb.ptszTitle = TranslateTS(pszTitle);
- mb.ptszInfoText = TranslateTS(pszInfo);
- mb.ptszMsg = tszMsg;
- mb.uType = uType;
+ MSGBOX mb = {0};
+ mb.cbSize = sizeof(MSGBOX);
+ mb.hParent = hParent;
+ mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
+ mb.hiMsg = NULL;
+ mb.ptszTitle = TranslateTS(pszTitle);
+ mb.ptszInfoText = TranslateTS(pszInfo);
+ mb.ptszMsg = tszMsg;
+ mb.uType = uType;
return MsgBoxService(NULL, (LPARAM)&mb);
}
@@ -825,23 +764,21 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInf
**/
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
- MSGBOX mb = {0};
- TCHAR tszTitle[MAX_SECONDLINE];
- TCHAR tszMsg[MAX_SECONDLINE];
- va_list vl;
-
+ TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
mir_sntprintf(tszTitle, SIZEOF(tszMsg),_T("%s - %s") ,_T(MODNAME), TranslateT("Error"));
+ va_list vl;
va_start(vl, pszFormat);
mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
- mb.cbSize = sizeof(MSGBOX);
- mb.hParent = hParent;
- mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
- mb.hiMsg = NULL;
- mb.ptszTitle = tszTitle;
- mb.ptszMsg = tszMsg;
- mb.uType = MB_OK|MB_ICON_ERROR;
+ MSGBOX mb = {0};
+ mb.cbSize = sizeof(MSGBOX);
+ mb.hParent = hParent;
+ mb.hiLogo = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_MAIN));
+ mb.hiMsg = NULL;
+ mb.ptszTitle = tszTitle;
+ mb.ptszMsg = tszMsg;
+ mb.uType = MB_OK|MB_ICON_ERROR;
return MsgBoxService(NULL, (LPARAM)&mb);
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index ac7bc94f34..2a2af80bd3 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -1099,176 +1099,138 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
break;
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam)) {
+ case BTN_PREVIEW:
{
- case BTN_PREVIEW:
- {
- POPUPDATAT_V2 ppd;
-
- ZeroMemory(&ppd, sizeof(POPUPDATAT_V2));
- ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
- mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
-
- // Birthday
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
- if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else if (!IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR))
- {
- ppd.colorBack = SendDlgItemMessage(hDlg, CLR_BBACK, CPM_GETCOLOUR, 0, 0);
- ppd.colorText = SendDlgItemMessage(hDlg, CLR_BTEXT, CPM_GETCOLOUR, 0, 0);
- }
- PUAddPopUpT(&ppd);
-
- // Anniversary
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
- if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR))
- {
- ppd.colorBack = 0;
- ppd.colorText = 0;
- }
- else
- {
- ppd.colorBack = SendDlgItemMessage(hDlg, CLR_ABACK, CPM_GETCOLOUR, 0, 0);
- ppd.colorText = SendDlgItemMessage(hDlg, CLR_ATEXT, CPM_GETCOLOUR, 0, 0);
- }
- PUAddPopUpT(&ppd);
+ POPUPDATAT ppd = { 0 };
+ ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
+ mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
+
+ // Birthday
+ mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
+ ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
+ if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- break;
-
- case CHECK_OPT_POPUP_MSGBOX:
- case CHECK_OPT_POPUP_PROGRESS:
- {
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
+ else if (!IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR)) {
+ ppd.colorBack = SendDlgItemMessage(hDlg, CLR_BBACK, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hDlg, CLR_BTEXT, CPM_GETCOLOUR, 0, 0);
}
- break;
+ PUAddPopUpT(&ppd);
+
+ // Anniversary
+ mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
+ ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
+ if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR)) {
+ ppd.colorBack = 0;
+ ppd.colorText = 0;
+ }
+ else {
+ ppd.colorBack = SendDlgItemMessage(hDlg, CLR_ABACK, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hDlg, CLR_ATEXT, CPM_GETCOLOUR, 0, 0);
+ }
+ PUAddPopUpT(&ppd);
+ }
+ break;
- case CHECK_OPT_POPUP_ENABLED:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- const BOOL bEnabled = SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL);
- const INT idCtrl[] = {
- CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR,
- CLR_BBACK, TXT_OPT_POPUP_CLR_BACK,
- CLR_BTEXT, TXT_OPT_POPUP_CLR_TEXT,
- CHECK_OPT_POPUP_ADEFCLR, CHECK_OPT_POPUP_AWINCLR,
- CLR_ABACK, TXT_OPT_POPUP_CLR_ABACK,
- CLR_ATEXT, TXT_OPT_POPUP_CLR_ATEXT,
- RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM,
- RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY
- };
+ case CHECK_OPT_POPUP_MSGBOX:
+ case CHECK_OPT_POPUP_PROGRESS:
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ break;
+
+ case CHECK_OPT_POPUP_ENABLED:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ const BOOL bEnabled = SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL);
+ const INT idCtrl[] = {
+ CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR,
+ CLR_BBACK, TXT_OPT_POPUP_CLR_BACK,
+ CLR_BTEXT, TXT_OPT_POPUP_CLR_TEXT,
+ CHECK_OPT_POPUP_ADEFCLR, CHECK_OPT_POPUP_AWINCLR,
+ CLR_ABACK, TXT_OPT_POPUP_CLR_ABACK,
+ CLR_ATEXT, TXT_OPT_POPUP_CLR_ATEXT,
+ RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM,
+ RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY
+ };
- EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
+ EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case CHECK_OPT_POPUP_DEFCLR:
- case CHECK_OPT_POPUP_WINCLR:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL);
- INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL);
-
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_DEFCLR, !bWinClr);
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_WINCLR, !bDefClr);
- EnableDlgItem(hDlg, CLR_BBACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_BACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, CLR_BTEXT, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_TEXT, !(bDefClr || bWinClr));
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ case CHECK_OPT_POPUP_DEFCLR:
+ case CHECK_OPT_POPUP_WINCLR:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL);
+ INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL);
+
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_DEFCLR, !bWinClr);
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_WINCLR, !bDefClr);
+ EnableDlgItem(hDlg, CLR_BBACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_BACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, CLR_BTEXT, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_TEXT, !(bDefClr || bWinClr));
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case CHECK_OPT_POPUP_ADEFCLR:
- case CHECK_OPT_POPUP_AWINCLR:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL);
- INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL);
-
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_ADEFCLR, !bWinClr);
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_AWINCLR, !bDefClr);
- EnableDlgItem(hDlg, CLR_ABACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ABACK, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, CLR_ATEXT, !(bDefClr || bWinClr));
- EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ATEXT, !(bDefClr || bWinClr));
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- }
- break;
+ case CHECK_OPT_POPUP_ADEFCLR:
+ case CHECK_OPT_POPUP_AWINCLR:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ INT bDefClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL);
+ INT bWinClr = SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL);
+
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_ADEFCLR, !bWinClr);
+ EnableDlgItem(hDlg, CHECK_OPT_POPUP_AWINCLR, !bDefClr);
+ EnableDlgItem(hDlg, CLR_ABACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ABACK, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, CLR_ATEXT, !(bDefClr || bWinClr));
+ EnableDlgItem(hDlg, TXT_OPT_POPUP_CLR_ATEXT, !(bDefClr || bWinClr));
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
- case RADIO_OPT_POPUP_DEFAULT:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case RADIO_OPT_POPUP_CUSTOM:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, TRUE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case RADIO_OPT_POPUP_PERMANENT:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
- if (bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
- case EDIT_DELAY:
- if (bInitialized && HIWORD(wParam) == EN_UPDATE)
- {
+ case RADIO_OPT_POPUP_DEFAULT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
+ if (bInitialized)
NotifyParentOfChange(hDlg);
- }
- break;
- default:
- if (bInitialized && HIWORD(wParam) == CPN_COLOURCHANGED)
- {
+ }
+ break;
+
+ case RADIO_OPT_POPUP_CUSTOM:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, TRUE);
+ if (bInitialized)
NotifyParentOfChange(hDlg);
- }
}
+ break;
+
+ case RADIO_OPT_POPUP_PERMANENT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ EnableDlgItem(hDlg, EDIT_DELAY, FALSE);
+ if (bInitialized)
+ NotifyParentOfChange(hDlg);
+ }
+ break;
+
+ case EDIT_DELAY:
+ if (bInitialized && HIWORD(wParam) == EN_UPDATE)
+ NotifyParentOfChange(hDlg);
+ break;
+
+ default:
+ if (bInitialized && HIWORD(wParam) == CPN_COLOURCHANGED)
+ NotifyParentOfChange(hDlg);
}
}
return FALSE;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 74878359bb..d61aad666b 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -424,9 +424,7 @@ public:
**/
virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack)
{
- POPUPDATAT_V2 pd;
-
- ZeroMemory(&pd, sizeof(POPUPDATAT_V2));
+ POPUPDATAT_V2 pd = { 0 };
pd.cbSize = sizeof(POPUPDATAT_V2);
pd.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
pd.iSeconds = -1;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 3bfc5b6084..c5112d2a54 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -254,31 +254,24 @@ static INT NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, INT DaysToA
{
if (gRemindOpts.bPopups)
{
- POPUPDATAT_V2 ppd;
-
- ZeroMemory(&ppd, sizeof(POPUPDATAT_V2));
+ POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
ppd.iSeconds = (INT)DB::Setting::GetByte(SET_POPUP_DELAY, 0);
- if (hContact)
- {
+ if (hContact) {
ppd.lchContact = hContact;
mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),
_T("%s - %s"), TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else
- {
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
- }
+ else mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
+
mir_tcsncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
ppd.lchIcon = GetAnnivIcon(CEvent(eventType, DaysToAnniv));
- switch (eventType)
- {
+ switch (eventType) {
case CEvent::BIRTHDAY:
- switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM))
- {
+ switch (DB::Setting::GetByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -292,8 +285,7 @@ static INT NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, INT DaysToA
break;
case CEvent::ANNIVERSARY:
- switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM))
- {
+ switch (DB::Setting::GetByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);