summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp4
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp8
-rw-r--r--plugins/UserInfoEx/src/ctrl_button.cpp330
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp1743
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp568
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp34
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp14
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.h1
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp107
-rw-r--r--plugins/UserInfoEx/src/psp_anniversary.cpp408
-rw-r--r--plugins/UserInfoEx/src/psp_contact.cpp12
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp6
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp2
-rw-r--r--plugins/UserInfoEx/src/svc_homepage.cpp2
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp10
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp14
18 files changed, 1524 insertions, 1745 deletions
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index 7d63687ffd..794af36cc8 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -239,7 +239,7 @@ MZodiac MAnnivDate::Zodiac()
for (i = 0; i < 13 && (wDays < zodiac[i].startDays || wDays > zodiac[i].endDays); i++);
MZodiac mZodiac;
- mZodiac.hIcon = IcoLib_GetIcon(zodiac[i].szZodiacIcon);
+ mZodiac.hIcon = Skin_GetIcon(zodiac[i].szZodiacIcon);
mZodiac.pszName = zodiac[i].szZodiac;
return mZodiac;
}
@@ -689,7 +689,7 @@ static WORD AskUser(HANDLE hContact, MAnnivDate *pOldCustomDate, MAnnivDate *pNe
MB.cbSize = sizeof(MSGBOX);
MB.hParent = NULL;
- MB.hiLogo = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY);
+ MB.hiLogo = Skin_GetIcon(ICO_DLG_ANNIVERSARY);
MB.hiMsg = NULL;
MB.uType = MB_YESALLNO|MB_ICON_QUESTION|MB_INFOBAR|MB_NOPOPUP;
MB.ptszTitle = LPGENT("Update custom birthday");
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index c9bcf042c9..602557707a 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -282,7 +282,7 @@ HICON CPsTreeItem::ProtoIcon()
if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tcslen(pa[i]->tszAccountName))) {
CHAR szIconID[MAX_PATH];
mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName);
- HICON hIco = IcoLib_GetIcon(szIconID);
+ HICON hIco = Skin_GetIcon(szIconID);
if (!hIco)
hIco = (HICON)CallProtoService(pa[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL, NULL);
@@ -315,7 +315,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn
LPCSTR pszIconName = IconKey();
// use icolib to handle icons
- if (!(hIcon = IcoLib_GetIcon(pszIconName))) {
+ if (!(hIcon = Skin_GetIcon(pszIconName))) {
bool bNeedFree = false;
SKINICONDESC sid = { sizeof(sid) };
@@ -364,7 +364,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn
Skin_AddIcon(&sid);
if (!bInitIconsOnly)
- hIcon = IcoLib_GetIcon(pszIconName);
+ hIcon = Skin_GetIcon(pszIconName);
if (bNeedFree)
DestroyIcon(sid.hDefaultIcon);
}
@@ -601,7 +601,7 @@ void CPsTreeItem::OnIconsChanged(CPsTree *pTree)
RECT rc;
// update tree item icons
- if (pTree->ImageList() && (hIcon = IcoLib_GetIcon(IconKey())) != NULL) {
+ if (pTree->ImageList() && (hIcon = Skin_GetIcon(IconKey())) != NULL) {
_iImage = (_iImage > 0)
? ImageList_ReplaceIcon(pTree->ImageList(), _iImage, hIcon)
: ImageList_AddIcon(pTree->ImageList(), hIcon);
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp
index b0ada2b385..0a1e668e21 100644
--- a/plugins/UserInfoEx/src/ctrl_button.cpp
+++ b/plugins/UserInfoEx/src/ctrl_button.cpp
@@ -358,7 +358,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
LPBTNCTRL bct = (LPBTNCTRL)GetWindowLongPtr(hwndBtn, 0);
switch (uMsg) {
- case WM_NCCREATE:
+ case WM_NCCREATE:
{
LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
@@ -371,77 +371,75 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
bct->dwStyle = cs->style;
if (cs->style & MBS_DOWNARROW)
- bct->arrow = IcoLib_GetIcon(ICO_BTN_DOWNARROW);
+ bct->arrow = Skin_GetIcon(ICO_BTN_DOWNARROW);
LoadTheme(bct);
SetWindowLongPtr(hwndBtn, 0, (LONG_PTR)bct);
if (cs->lpszName) SetWindowText(hwndBtn, cs->lpszName);
return TRUE;
}
- case WM_DESTROY:
- if (bct) {
- EnterCriticalSection(&csTips);
- if (hwndToolTips) {
- TOOLINFO ti;
-
- ZeroMemory(&ti, sizeof(ti));
- ti.cbSize = sizeof(ti);
- ti.uFlags = TTF_IDISHWND;
- ti.hwnd = bct->hwnd;
- ti.uId = (UINT_PTR)bct->hwnd;
- if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) {
- SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
- }
- if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
- DestroyWindow(hwndToolTips);
- hwndToolTips = NULL;
- }
+ case WM_DESTROY:
+ if (bct) {
+ EnterCriticalSection(&csTips);
+ if (hwndToolTips) {
+ TOOLINFO ti;
+
+ ZeroMemory(&ti, sizeof(ti));
+ ti.cbSize = sizeof(ti);
+ ti.uFlags = TTF_IDISHWND;
+ ti.hwnd = bct->hwnd;
+ ti.uId = (UINT_PTR)bct->hwnd;
+ if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) {
+ SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
}
- LeaveCriticalSection(&csTips);
- DestroyTheme(bct);
- mir_free(bct);
- }
- SetWindowLongPtr(hwndBtn, 0, NULL);
- break;
- case WM_SETTEXT:
- bct->cHot = 0;
- if ((LPTSTR)lParam) {
- LPTSTR tmp = (LPTSTR)lParam;
-
- while (*tmp) {
- if (*tmp=='&' && *(tmp+1)) {
- bct->cHot = _totlower(*(tmp+1));
- break;
- }
- tmp++;
+ if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
+ DestroyWindow(hwndToolTips);
+ hwndToolTips = NULL;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
}
- break;
- case WM_SYSKEYUP:
- if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == _totlower((TCHAR)wParam)) {
- if (bct->dwStyle & MBS_PUSHBUTTON) {
- if (bct->pbState) bct->pbState = 0;
- else bct->pbState = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ LeaveCriticalSection(&csTips);
+ DestroyTheme(bct);
+ mir_free(bct);
+ }
+ SetWindowLongPtr(hwndBtn, 0, NULL);
+ break;
+ case WM_SETTEXT:
+ bct->cHot = 0;
+ if ((LPTSTR)lParam) {
+ LPTSTR tmp = (LPTSTR)lParam;
+
+ while (*tmp) {
+ if (*tmp == '&' && *(tmp + 1)) {
+ bct->cHot = _totlower(*(tmp + 1));
+ break;
}
- else
- SetFocus(hwndBtn);
- SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn);
- return 0;
+ tmp++;
}
- break;
- case WM_THEMECHANGED:
- {
- // themed changed, reload theme object
- LoadTheme(bct);
- InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
- break;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
}
- case WM_SETFONT: // remember the font so we can use it later
- bct->hFont = (HFONT)wParam; // maybe we should redraw?
- break;
- case WM_NCPAINT:
- case WM_PAINT:
+ break;
+ case WM_SYSKEYUP:
+ if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == _totlower((TCHAR)wParam)) {
+ if (bct->dwStyle & MBS_PUSHBUTTON) {
+ if (bct->pbState) bct->pbState = 0;
+ else bct->pbState = 1;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
+ else
+ SetFocus(hwndBtn);
+ SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn);
+ return 0;
+ }
+ break;
+ case WM_THEMECHANGED:
+ // themed changed, reload theme object
+ LoadTheme(bct);
+ InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
+ break;
+ case WM_SETFONT: // remember the font so we can use it later
+ bct->hFont = (HFONT)wParam; // maybe we should redraw?
+ break;
+ case WM_NCPAINT:
+ case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdcPaint;
@@ -470,51 +468,49 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
DeleteDC(hdcMem);
EndPaint(hwndBtn, &ps);
}
- return 0;
}
- case BM_SETIMAGE:
- if (wParam == IMAGE_ICON) {
- bct->hIcon = (HICON)lParam;
- bct->hBitmap = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- else if (wParam == IMAGE_BITMAP) {
- bct->hIcon = NULL;
- bct->hBitmap = (HBITMAP)lParam;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- else if (wParam == NULL && lParam == NULL) {
- bct->hIcon = NULL;
- bct->hBitmap = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- break;
- case BM_SETCHECK:
- if (!(bct->dwStyle & MBS_PUSHBUTTON)) break;
- if (wParam == BST_CHECKED) {
- bct->pbState = 1;
- bct->stateId = PBS_PRESSED;
- }
- else if (wParam == BST_UNCHECKED) {
- bct->pbState = 0;
- bct->stateId = PBS_NORMAL;
- }
+ return 0;
+ case BM_SETIMAGE:
+ if (wParam == IMAGE_ICON) {
+ bct->hIcon = (HICON)lParam;
+ bct->hBitmap = NULL;
InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case BM_GETCHECK:
- if (bct->dwStyle & MBS_PUSHBUTTON) return bct->pbState ? BST_CHECKED : BST_UNCHECKED;
- return 0;
- case BUTTONSETDEFAULT:
- bct->defbutton = (wParam != 0);
+ }
+ else if (wParam == IMAGE_BITMAP) {
+ bct->hIcon = NULL;
+ bct->hBitmap = (HBITMAP)lParam;
InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case BUTTONADDTOOLTIP:
- {
- if (!wParam) break;
- EnterCriticalSection(&csTips);
- if (!hwndToolTips) {
+ }
+ else if (wParam == NULL && lParam == NULL) {
+ bct->hIcon = NULL;
+ bct->hBitmap = NULL;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
+ break;
+ case BM_SETCHECK:
+ if (!(bct->dwStyle & MBS_PUSHBUTTON)) break;
+ if (wParam == BST_CHECKED) {
+ bct->pbState = 1;
+ bct->stateId = PBS_PRESSED;
+ }
+ else if (wParam == BST_UNCHECKED) {
+ bct->pbState = 0;
+ bct->stateId = PBS_NORMAL;
+ }
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case BM_GETCHECK:
+ if (bct->dwStyle & MBS_PUSHBUTTON) return bct->pbState ? BST_CHECKED : BST_UNCHECKED;
+ return 0;
+ case BUTTONSETDEFAULT:
+ bct->defbutton = (wParam != 0);
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case BUTTONADDTOOLTIP:
+ if (wParam) {
+ EnterCriticalSection(&csTips);
+ if (!hwndToolTips)
hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
- }
if (lParam == MBBF_UNICODE) {
TOOLINFOW ti;
@@ -548,82 +544,82 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
ti.lpszText=(LPSTR)wParam;
SendMessage(hwndToolTips, TTM_ADDTOOLA, 0, (LPARAM)&ti);
}
- LeaveCriticalSection(&csTips);
- break;
+ LeaveCriticalSection(&csTips);
}
- case BUTTONTRANSLATE:
+ break;
+ case BUTTONTRANSLATE:
{
TCHAR szButton[MAX_PATH];
GetWindowText(bct->hwnd, szButton, MAX_PATH);
SetWindowText(bct->hwnd, TranslateTS(szButton));
- break;
}
- case WM_SETFOCUS: // set keybord bFocus and redraw
- bct->bFocus = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case WM_KILLFOCUS: // kill bFocus and redraw
- bct->bFocus = 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case WM_WINDOWPOSCHANGED:
+ break;
+ case WM_SETFOCUS: // set keybord bFocus and redraw
+ bct->bFocus = 1;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case WM_KILLFOCUS: // kill bFocus and redraw
+ bct->bFocus = 0;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case WM_WINDOWPOSCHANGED:
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case WM_ENABLE: // windows tells us to enable/disable
+ bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ break;
+ case WM_MOUSELEAVE: // faked by the WM_TIMER
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
+ bct->stateId = PBS_NORMAL;
InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case WM_ENABLE: // windows tells us to enable/disable
- bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
+ }
+ break;
+ case WM_LBUTTONDOWN:
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
+ bct->stateId = PBS_PRESSED;
InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
- case WM_MOUSELEAVE: // faked by the WM_TIMER
- if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
- bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- break;
- case WM_LBUTTONDOWN:
- if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
- bct->stateId = PBS_PRESSED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
+ break;
+ case WM_LBUTTONUP:
+ if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
+ BYTE bPressed = bct->stateId == PBS_PRESSED;
+
+ if (bct->dwStyle & MBS_PUSHBUTTON) {
+ if (bct->pbState) bct->pbState = 0;
+ else bct->pbState = 1;
}
- break;
- case WM_LBUTTONUP:
- if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
- BYTE bPressed = bct->stateId == PBS_PRESSED;
-
- if (bct->dwStyle & MBS_PUSHBUTTON) {
- if (bct->pbState) bct->pbState = 0;
- else bct->pbState = 1;
- }
- bct->stateId = PBS_HOT;
+ bct->stateId = PBS_HOT;
- // Tell your daddy you got clicked, if mouse is still over the button.
- if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed)
- SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn);
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- break;
- case WM_MOUSEMOVE:
- if (bct->stateId == PBS_NORMAL) {
- bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ // Tell your daddy you got clicked, if mouse is still over the button.
+ if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed)
+ SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn);
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
+ break;
+ case WM_MOUSEMOVE:
+ if (bct->stateId == PBS_NORMAL) {
+ bct->stateId = PBS_HOT;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
+ // Call timer, used to start cheesy TrackMouseEvent faker
+ SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL);
+ break;
+ case WM_TIMER: // use a timer to check if they have did a mouseout
+ if (wParam == BUTTON_POLLID) {
+ RECT rc;
+ POINT pt;
+
+ GetWindowRect(hwndBtn, &rc);
+ GetCursorPos(&pt);
+ if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave
+ PostMessage(hwndBtn, WM_MOUSELEAVE, 0, 0L);
+ KillTimer(hwndBtn, BUTTON_POLLID);
}
- // Call timer, used to start cheesy TrackMouseEvent faker
- SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL);
- break;
- case WM_TIMER: // use a timer to check if they have did a mouseout
- if (wParam == BUTTON_POLLID) {
- RECT rc;
- POINT pt;
-
- GetWindowRect(hwndBtn, &rc);
- GetCursorPos(&pt);
- if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave
- PostMessage(hwndBtn, WM_MOUSELEAVE, 0, 0L);
- KillTimer(hwndBtn, BUTTON_POLLID);
- }
- }
- break;
- case WM_ERASEBKGND:
- return 1;
+ }
+ break;
+ case WM_ERASEBKGND:
+ return 1;
}
return DefWindowProc(hwndBtn, uMsg, wParam, lParam);
}
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index 10c0ab10c2..1efda63861 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -142,23 +142,23 @@ static int CheckPhoneSyntax(LPTSTR pszSrc, LPTSTR szNumber, WORD cchNumber, int&
**/
static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- LPCBEXITEM cbi = (LPCBEXITEM)lParam;
+ LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
- if (!cbi) return FALSE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ cbi = (LPCBEXITEM)lParam;
+ if (!cbi)
+ return FALSE;
SetUserData(hDlg, lParam);
-
- SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL));
- if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
- {
- SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
- SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
+
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)Skin_GetIcon(ICO_DLG_EMAIL, TRUE));
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
+ SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_OK));
+ SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_CANCEL));
}
- if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit E-Mail"));
+ if (*cbi->pszVal)
+ SetWindowText(hDlg, LPGENT("Edit E-Mail"));
TranslateDialogDefault(hDlg);
SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0);
SendDlgItemMessage(hDlg, EDIT_EMAIL, EM_LIMITTEXT, cbi->ccVal - 1, 0);
@@ -166,34 +166,29 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
SetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal);
EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY));
EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal);
+
// translate Userinfo buttons
{
TCHAR szButton[MAX_PATH];
- HWND hBtn;
-
- hBtn = GetDlgItem(hDlg, IDOK);
+ HWND hBtn = GetDlgItem(hDlg, IDOK);
GetWindowText(hBtn, szButton, MAX_PATH);
SetWindowText(hBtn, TranslateTS(szButton));
+
hBtn = GetDlgItem(hDlg, IDCANCEL);
GetWindowText(hBtn, szButton, MAX_PATH);
SetWindowText(hBtn, TranslateTS(szButton));
}
return TRUE;
- }
case WM_CTLCOLORSTATIC:
SetBkColor((HDC)wParam, RGB(255, 255, 255));
return (INT_PTR)GetStockObject(WHITE_BRUSH);
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
+ switch (LOWORD(wParam)) {
+ if (HIWORD(wParam) == BN_CLICKED) {
case IDOK:
{
- LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
-
if (cbi->pszVal && cbi->ccVal > 0)
GetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal, cbi->ccVal);
if (cbi->pszCat && cbi->ccCat > 0)
@@ -207,8 +202,6 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
if (HIWORD(wParam) == EN_UPDATE) {
TCHAR szText[MAXDATASIZE];
LPTSTR pszAdd, pszDot;
- LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
-
if (PtrIsValid(cbi)) {
GetWindowText((HWND)lParam, szText, SIZEOF(szText));
EnableWindow(GetDlgItem(hDlg, IDOK),
@@ -234,29 +227,31 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
**/
INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
+ static int noRecursion = 0;
+
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
- LPCBEXITEM cbi = (LPCBEXITEM)lParam;
UINT i, item, countryCount;
LPIDSTRLIST pCountries;
HWND hCombo = GetDlgItem(hDlg, EDIT_COUNTRY);
+ cbi = (LPCBEXITEM)lParam;
if (!cbi) return FALSE;
SetUserData(hDlg, lParam);
- SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE));
- if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
- {
- SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
- SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)Skin_GetIcon(ICO_DLG_PHONE, TRUE));
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
+ SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_OK));
+ SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_CANCEL));
}
// translate Userinfo buttons
{
TCHAR szButton[MAX_PATH];
HWND hBtn;
-
+
hBtn = GetDlgItem(hDlg, IDOK);
GetWindowText(hBtn, szButton, MAX_PATH);
SetWindowText(hBtn, TranslateTS(szButton));
@@ -267,13 +262,13 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit Phone Number"));
if (cbi->wFlags & CBEXIF_SMS) CheckDlgButton(hDlg, CHECK_SMS, BST_CHECKED);
TranslateDialogDefault(hDlg);
-
+
EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal);
SendDlgItemMessage(hDlg, EDIT_AREA, EM_LIMITTEXT, 31, 0);
SendDlgItemMessage(hDlg, EDIT_NUMBER, EM_LIMITTEXT, 63, 0);
SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0);
SendDlgItemMessage(hDlg, EDIT_PHONE, EM_LIMITTEXT, cbi->ccVal - 1, 0);
-
+
GetCountryList(&countryCount, &pCountries);
for (i = 0; i < countryCount; i++) {
if (pCountries[i].nID == 0 || pCountries[i].nID == 0xFFFF) continue;
@@ -284,122 +279,105 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
SetDlgItemText(hDlg, EDIT_PHONE, cbi->pszVal);
SetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat);
EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY));
- return TRUE;
}
+ return TRUE;
- case WM_CTLCOLORSTATIC:
- SetBkColor((HDC)wParam, RGB(255, 255, 255));
- return (INT_PTR)GetStockObject(WHITE_BRUSH);
+ case WM_CTLCOLORSTATIC:
+ SetBkColor((HDC)wParam, RGB(255, 255, 255));
+ return (INT_PTR)GetStockObject(WHITE_BRUSH);
- case WM_COMMAND:
- {
- static int noRecursion=0;
-
- switch (LOWORD(wParam)) {
- if (HIWORD(wParam) == BN_CLICKED) {
- case IDOK:
- {
- LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg);
- TCHAR szText[MAXDATASIZE];
- int errorPos;
-
- if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, MAXDATASIZE) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
- MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only."));
- /*
- EDITBALLOONTIP btt;
-
- btt.cbStruct = SIZEOF(btt);
-
- btt.pszTitle = TranslateW(L"Syntax Error");
- btt.pszText = TranslateW(L"The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.");
-
- SendDlgItemMessage(hDlg, EDIT_PHONE, EM_SHOWBALLOONTIP, NULL, (LPARAM)&btt);
- SetDlgItemText(hDlg, EDIT_PHONE, cbi->pszVal);
- SendDlgItemMessage(hDlg, EDIT_PHONE, EM_SETSEL, errorPos, errorPos);
- */
- break;
- }
- // save category string
- GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ case IDOK:
+ {
+ TCHAR szText[MAXDATASIZE];
+ int errorPos;
- // save SMS flag
- if (IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS)) {
- cbi->wFlags ^= CBEXIF_SMS;
- }
- }
- //fall through
- case IDCANCEL:
- EndDialog(hDlg, wParam);
+ if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, MAXDATASIZE) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
+ MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only."));
break;
- }
-
- case EDIT_COUNTRY:
- if (HIWORD(wParam) != CBN_SELCHANGE) break;
-
- case EDIT_AREA:
- case EDIT_NUMBER:
- if (LOWORD(wParam) != EDIT_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
- if (noRecursion) break;
- EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
- {
- TCHAR szPhone[MAXDATASIZE], szArea[32], szData[64];
- int nCurSel = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCURSEL, 0, 0);
- UINT nCountry = (nCurSel != CB_ERR) ? SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, nCurSel, 0) : 0;
-
- GetDlgItemText(hDlg, EDIT_AREA, szArea, SIZEOF(szArea));
- GetDlgItemText(hDlg, EDIT_NUMBER, szData, SIZEOF(szData));
- mir_sntprintf(szPhone, MAXDATASIZE, _T("+%u (%s) %s"), nCountry, szArea, szData);
- noRecursion = 1;
- SetDlgItemText(hDlg, EDIT_PHONE, szPhone);
- noRecursion = 0;
}
- break;
+ // save category string
+ GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
- case EDIT_PHONE:
- if (HIWORD(wParam) != EN_UPDATE) break;
- if (noRecursion) break;
- noRecursion = 1;
- {
- TCHAR szText[MAXDATASIZE], *pText, *pArea, *pNumber;
- int isValid = 1;
- GetDlgItemText(hDlg, EDIT_PHONE, szText, SIZEOF(szText));
- if (szText[0] != '+') isValid = 0;
- if (isValid) {
- int i,country = _tcstol(szText + 1, &pText, 10);
- if (pText - szText > 4)
- isValid = 0;
- else {
- for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
- if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) {
- SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0);
- break;
- }
- }
- }
- if (i < 0) isValid=0;
- }
- if (isValid) {
- pArea = pText + _tcscspn(pText, _T("0123456789"));
- pText = pArea + _tcsspn(pArea, _T("0123456789"));
- if (*pText) {
- *pText = '\0';
- pNumber = pText + 1 + _tcscspn(pText + 1, _T("0123456789"));
- SetDlgItemText(hDlg, EDIT_NUMBER, pNumber);
+ // save SMS flag
+ if (IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS))
+ cbi->wFlags ^= CBEXIF_SMS;
+ }
+ //fall through
+ case IDCANCEL:
+ EndDialog(hDlg, wParam);
+ break;
+ }
+
+ case EDIT_COUNTRY:
+ if (HIWORD(wParam) != CBN_SELCHANGE)
+ break;
+
+ case EDIT_AREA:
+ case EDIT_NUMBER:
+ if (LOWORD(wParam) != EDIT_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
+ if (noRecursion) break;
+ EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
+ {
+ TCHAR szPhone[MAXDATASIZE], szArea[32], szData[64];
+ int nCurSel = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCURSEL, 0, 0);
+ UINT nCountry = (nCurSel != CB_ERR) ? SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, nCurSel, 0) : 0;
+
+ GetDlgItemText(hDlg, EDIT_AREA, szArea, SIZEOF(szArea));
+ GetDlgItemText(hDlg, EDIT_NUMBER, szData, SIZEOF(szData));
+ mir_sntprintf(szPhone, MAXDATASIZE, _T("+%u (%s) %s"), nCountry, szArea, szData);
+ noRecursion = 1;
+ SetDlgItemText(hDlg, EDIT_PHONE, szPhone);
+ noRecursion = 0;
+ }
+ break;
+
+ case EDIT_PHONE:
+ if (HIWORD(wParam) != EN_UPDATE) break;
+ if (noRecursion) break;
+ noRecursion = 1;
+ {
+ TCHAR szText[MAXDATASIZE], *pText, *pArea, *pNumber;
+ int isValid = 1;
+ GetDlgItemText(hDlg, EDIT_PHONE, szText, SIZEOF(szText));
+ if (szText[0] != '+') isValid = 0;
+ if (isValid) {
+ int i, country = _tcstol(szText + 1, &pText, 10);
+ if (pText - szText > 4)
+ isValid = 0;
+ else {
+ for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
+ if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) {
+ SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0);
+ break;
}
- SetDlgItemText(hDlg, EDIT_AREA, pArea);
- }
- if (!isValid) {
- SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, -1, 0);
- SetDlgItemText(hDlg, EDIT_AREA, _T(""));
- SetDlgItemText(hDlg, EDIT_NUMBER, _T(""));
}
}
- noRecursion = 0;
- EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength(GetDlgItem(hDlg, EDIT_PHONE)));
- break;
+ if (i < 0) isValid = 0;
+ }
+ if (isValid) {
+ pArea = pText + _tcscspn(pText, _T("0123456789"));
+ pText = pArea + _tcsspn(pArea, _T("0123456789"));
+ if (*pText) {
+ *pText = '\0';
+ pNumber = pText + 1 + _tcscspn(pText + 1, _T("0123456789"));
+ SetDlgItemText(hDlg, EDIT_NUMBER, pNumber);
+ }
+ SetDlgItemText(hDlg, EDIT_AREA, pArea);
+ }
+ if (!isValid) {
+ SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, -1, 0);
+ SetDlgItemText(hDlg, EDIT_AREA, _T(""));
+ SetDlgItemText(hDlg, EDIT_NUMBER, _T(""));
+ }
}
+ noRecursion = 0;
+ EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength(GetDlgItem(hDlg, EDIT_PHONE)));
break;
}
+ break;
}
return FALSE;
}
@@ -419,831 +397,828 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
switch (msg) {
- /**
- * name: WM_NCCREATE
- * desc: is called to initiate the window creation
- * param: wParam - not used
- * lParam - pointer to a CREATESTRUCT
- *
- * return: FALSE on error, TRUE if initialisation was ok
- **/
- case WM_NCCREATE:
- {
- LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
-
- if (!(cbex = (LPCBEX)mir_calloc(1*sizeof(CBEX))))
- return FALSE;
- SetWindowLongPtr(hwnd, 0, (LONG_PTR)cbex);
- cbex->bLocked = 1;
- cbex->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
- cbex->hInstance = cs->hInstance;
- cbex->iSelectedItem = -1;
- cbex->rect.left = cs->x;
- cbex->rect.top = cs->y;
- cbex->rect.right = cs->x + cs->cx;
- cbex->rect.bottom = cs->y + cs->cy;
- return TRUE;
- }
+ /**
+ * name: WM_NCCREATE
+ * desc: is called to initiate the window creation
+ * param: wParam - not used
+ * lParam - pointer to a CREATESTRUCT
+ *
+ * return: FALSE on error, TRUE if initialisation was ok
+ **/
+ case WM_NCCREATE:
+ {
+ LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
- /**
- * name: WM_NCCREATE
- * desc: is called to create all subitems
- * param: wParam - not used
- * lParam - not used
- *
- * return: FALSE on error, TRUE if initialisation was ok
- **/
- case WM_CREATE:
- {
- WORD wHeight = (WORD)(cbex->rect.bottom - cbex->rect.top);
- WORD wWidth = 130;
- WORD x = 0;
-
- if (!(cbex->hBtnEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
- UINFOBUTTONCLASS,
- _T("none"),
- WS_VISIBLE|WS_CHILD|WS_TABSTOP, 0, 0,
- wWidth, wHeight,
- hwnd,
- NULL,
- cbex->hInstance, NULL))) {
- cbex->bLocked = 0;
- return FALSE;
- }
- x += wWidth + 2;
- wWidth = wHeight;
- if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
- UINFOBUTTONCLASS,
- NULL,
- WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_PUSHBUTTON|MBS_DOWNARROW,
- x, 0,
- wWidth, wHeight,
- hwnd,
- NULL,
- cbex->hInstance, NULL))) {
- DestroyWindow(cbex->hBtnEdit);
- cbex->bLocked = 0;
- return FALSE;
- }
- x += wWidth + 2;
- wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2)));
- if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
- _T("Edit"),
- NULL,
- WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL,
- x, 1,
- wWidth, wHeight - 2,
- hwnd,
- NULL,
- cbex->hInstance, NULL))) {
- DestroyWindow(cbex->hBtnEdit);
- DestroyWindow(cbex->hBtnMenu);
- cbex->bLocked = 0;
- return FALSE;
- }
- x += wWidth + 2;
- wWidth = wHeight;
- if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
- UINFOBUTTONCLASS,
- NULL,
- WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
- x, 0,
- wWidth, wHeight,
- hwnd,
- NULL,
- cbex->hInstance, NULL))) {
- DestroyWindow(cbex->hBtnEdit);
- DestroyWindow(cbex->hBtnMenu);
- DestroyWindow(cbex->hEdit);
- cbex->bLocked = 0;
- return FALSE;
- }
- x += wWidth + 2;
- if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
- UINFOBUTTONCLASS,
- NULL,
- WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
- x, 0,
- wWidth, wHeight,
- hwnd,
- NULL,
- cbex->hInstance, NULL))) {
- DestroyWindow(cbex->hBtnEdit);
- DestroyWindow(cbex->hBtnMenu);
- DestroyWindow(cbex->hEdit);
- DestroyWindow(cbex->hBtnAdd);
- cbex->bLocked = 0;
- return FALSE;
- }
+ if (!(cbex = (LPCBEX)mir_calloc(1*sizeof(CBEX))))
+ return FALSE;
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR)cbex);
+ cbex->bLocked = 1;
+ cbex->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
+ cbex->hInstance = cs->hInstance;
+ cbex->iSelectedItem = -1;
+ cbex->rect.left = cs->x;
+ cbex->rect.top = cs->y;
+ cbex->rect.right = cs->x + cs->cx;
+ cbex->rect.bottom = cs->y + cs->cy;
+ return TRUE;
+ }
- // set ids
- SetWindowLongPtr(cbex->hBtnEdit, GWLP_ID, BTN_EDIT);
- SetWindowLongPtr(cbex->hBtnMenu, GWLP_ID, BTN_MENU);
- SetWindowLongPtr(cbex->hEdit, GWLP_ID, EDIT_VALUE);
- SetWindowLongPtr(cbex->hBtnAdd, GWLP_ID, BTN_ADD);
- SetWindowLongPtr(cbex->hBtnDel, GWLP_ID, BTN_DEL);
- // set fonts & maximum edit control charachters
- SendMessage(cbex->hEdit, WM_SETFONT, (WPARAM)cbex->hFont, NULL);
- SendMessage(cbex->hEdit, EM_LIMITTEXT, (WPARAM)MAXDATASIZE, NULL);
- // add tooltips
- SendMessage(cbex->hBtnMenu, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Choose the item to display."), MBBF_TCHAR);
- SendMessage(cbex->hBtnEdit, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Edit the currently displayed item."), MBBF_TCHAR);
- SendMessage(cbex->hBtnAdd, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Add a new custom item."), MBBF_TCHAR);
- SendMessage(cbex->hBtnDel, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete the selected item."), MBBF_TCHAR);
- // reload icons
- CtrlContactWndProc(hwnd, WM_SETICON, NULL, NULL);
+ /**
+ * name: WM_NCCREATE
+ * desc: is called to create all subitems
+ * param: wParam - not used
+ * lParam - not used
+ *
+ * return: FALSE on error, TRUE if initialisation was ok
+ **/
+ case WM_CREATE:
+ {
+ WORD wHeight = (WORD)(cbex->rect.bottom - cbex->rect.top);
+ WORD wWidth = 130;
+ WORD x = 0;
+
+ if (!(cbex->hBtnEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
+ UINFOBUTTONCLASS,
+ _T("none"),
+ WS_VISIBLE|WS_CHILD|WS_TABSTOP, 0, 0,
+ wWidth, wHeight,
+ hwnd,
+ NULL,
+ cbex->hInstance, NULL))) {
cbex->bLocked = 0;
- return TRUE;
+ return FALSE;
}
-
- /**
- * name: WM_DESTROY
- * desc: default destroy message, so clear up memory
- * param: wParam - not used
- * lParam - not used
- * return: return value of DefWindowProc
- **/
- case WM_DESTROY:
- CtrlContactWndProc(hwnd, CBEXM_DELALLITEMS, NULL, NULL);
+ x += wWidth + 2;
+ wWidth = wHeight;
+ if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
+ UINFOBUTTONCLASS,
+ NULL,
+ WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_PUSHBUTTON|MBS_DOWNARROW,
+ x, 0,
+ wWidth, wHeight,
+ hwnd,
+ NULL,
+ cbex->hInstance, NULL))) {
+ DestroyWindow(cbex->hBtnEdit);
+ cbex->bLocked = 0;
+ return FALSE;
+ }
+ x += wWidth + 2;
+ wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2)));
+ if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
+ _T("Edit"),
+ NULL,
+ WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL,
+ x, 1,
+ wWidth, wHeight - 2,
+ hwnd,
+ NULL,
+ cbex->hInstance, NULL))) {
+ DestroyWindow(cbex->hBtnEdit);
+ DestroyWindow(cbex->hBtnMenu);
+ cbex->bLocked = 0;
+ return FALSE;
+ }
+ x += wWidth + 2;
+ wWidth = wHeight;
+ if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
+ UINFOBUTTONCLASS,
+ NULL,
+ WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
+ x, 0,
+ wWidth, wHeight,
+ hwnd,
+ NULL,
+ cbex->hInstance, NULL))) {
DestroyWindow(cbex->hBtnEdit);
DestroyWindow(cbex->hBtnMenu);
- DestroyWindow(cbex->hBtnAdd);
- DestroyWindow(cbex->hBtnDel);
DestroyWindow(cbex->hEdit);
- MIR_FREE(cbex);
- break;
+ cbex->bLocked = 0;
+ return FALSE;
+ }
+ x += wWidth + 2;
+ if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
+ UINFOBUTTONCLASS,
+ NULL,
+ WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT,
+ x, 0,
+ wWidth, wHeight,
+ hwnd,
+ NULL,
+ cbex->hInstance, NULL))) {
+ DestroyWindow(cbex->hBtnEdit);
+ DestroyWindow(cbex->hBtnMenu);
+ DestroyWindow(cbex->hEdit);
+ DestroyWindow(cbex->hBtnAdd);
+ cbex->bLocked = 0;
+ return FALSE;
+ }
- /**
- * name: WM_CTLCOLOREDIT
- * desc: is called on a paint message for a dialog item to determine its colour scheme
- * param: wParam - pointer to a HDC
- * lParam - pointer to a HWND
- * return: a brush
- **/
- case WM_CTLCOLOREDIT:
- if (!db_get_b(NULL, MODNAME, SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
- break;
- return Ctrl_SetTextColour((HDC)wParam, cbex->pItems[cbex->iSelectedItem].wFlags);
+ // set ids
+ SetWindowLongPtr(cbex->hBtnEdit, GWLP_ID, BTN_EDIT);
+ SetWindowLongPtr(cbex->hBtnMenu, GWLP_ID, BTN_MENU);
+ SetWindowLongPtr(cbex->hEdit, GWLP_ID, EDIT_VALUE);
+ SetWindowLongPtr(cbex->hBtnAdd, GWLP_ID, BTN_ADD);
+ SetWindowLongPtr(cbex->hBtnDel, GWLP_ID, BTN_DEL);
+ // set fonts & maximum edit control charachters
+ SendMessage(cbex->hEdit, WM_SETFONT, (WPARAM)cbex->hFont, NULL);
+ SendMessage(cbex->hEdit, EM_LIMITTEXT, (WPARAM)MAXDATASIZE, NULL);
+ // add tooltips
+ SendMessage(cbex->hBtnMenu, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Choose the item to display."), MBBF_TCHAR);
+ SendMessage(cbex->hBtnEdit, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Edit the currently displayed item."), MBBF_TCHAR);
+ SendMessage(cbex->hBtnAdd, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Add a new custom item."), MBBF_TCHAR);
+ SendMessage(cbex->hBtnDel, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete the selected item."), MBBF_TCHAR);
+ // reload icons
+ CtrlContactWndProc(hwnd, WM_SETICON, NULL, NULL);
+ cbex->bLocked = 0;
+ return TRUE;
+ }
- case WM_CTLCOLORSTATIC:
- if ((HWND)lParam == cbex->hEdit)
- return (BOOL)GetSysColor(COLOR_WINDOW);
- return FALSE;
- /**
- * name: WM_SETICON
- * desc: updates the icons of this control
- * param: wParam - not used
- * lParam - not used
- * return: always 0
- **/
- case WM_SETICON:
- {
- HICON hIcon;
- int i;
+ /**
+ * name: WM_DESTROY
+ * desc: default destroy message, so clear up memory
+ * param: wParam - not used
+ * lParam - not used
+ * return: return value of DefWindowProc
+ **/
+ case WM_DESTROY:
+ CtrlContactWndProc(hwnd, CBEXM_DELALLITEMS, NULL, NULL);
+ DestroyWindow(cbex->hBtnEdit);
+ DestroyWindow(cbex->hBtnMenu);
+ DestroyWindow(cbex->hBtnAdd);
+ DestroyWindow(cbex->hBtnDel);
+ DestroyWindow(cbex->hEdit);
+ MIR_FREE(cbex);
+ break;
+
+ /**
+ * name: WM_CTLCOLOREDIT
+ * desc: is called on a paint message for a dialog item to determine its colour scheme
+ * param: wParam - pointer to a HDC
+ * lParam - pointer to a HWND
+ * return: a brush
+ **/
+ case WM_CTLCOLOREDIT:
+ if (!db_get_b(NULL, MODNAME, SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
+ break;
+ return Ctrl_SetTextColour((HDC)wParam, cbex->pItems[cbex->iSelectedItem].wFlags);
- hIcon = IcoLib_GetIcon(ICO_BTN_ADD);
- SendMessage(cbex->hBtnAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendMessage(cbex->hBtnAdd, WM_SETTEXT, NULL, (LPARAM)(hIcon ? _T("") : _T("+")));
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam == cbex->hEdit)
+ return (BOOL)GetSysColor(COLOR_WINDOW);
+ return FALSE;
+ /**
+ * name: WM_SETICON
+ * desc: updates the icons of this control
+ * param: wParam - not used
+ * lParam - not used
+ * return: always 0
+ **/
+ case WM_SETICON:
+ {
+ HICON hIcon = Skin_GetIcon(ICO_BTN_ADD);
+ SendMessage(cbex->hBtnAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ SendMessage(cbex->hBtnAdd, WM_SETTEXT, NULL, (LPARAM)(hIcon ? _T("") : _T("+")));
- hIcon = IcoLib_GetIcon(ICO_BTN_DELETE);
- SendMessage(cbex->hBtnDel, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- SendMessage(cbex->hBtnDel, WM_SETTEXT, NULL, (LPARAM)(hIcon ? _T("") : _T("-")));
+ hIcon = Skin_GetIcon(ICO_BTN_DELETE);
+ SendMessage(cbex->hBtnDel, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ SendMessage(cbex->hBtnDel, WM_SETTEXT, NULL, (LPARAM)(hIcon ? _T("") : _T("-")));
- if (cbex->pItems && cbex->numItems > 0) {
- for (i = 0; i < cbex->numItems; i++) {
- cbex->pItems[i].hIcon = IcoLib_GetIcon(cbex->pItems[i].pszIcon);
- }
- if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems)
- SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon);
- }
- return 0;
+ if (cbex->pItems && cbex->numItems > 0) {
+ for (int i = 0; i < cbex->numItems; i++)
+ cbex->pItems[i].hIcon = Skin_GetIcon(cbex->pItems[i].pszIcon);
+
+ if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems)
+ SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon);
}
+ return 0;
+ }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- /**
- * name: BTN_MENU
- * desc: the button to dropdown the list to show all items is pressed
- **/
- case BTN_MENU:
- if (HIWORD(wParam) == BN_CLICKED) {
- POINT pt = { 0, 0 };
- RECT rc;
- MENUITEMINFO mii;
- int i, nItems;
- HMENU hMenu;
-
- if (!(hMenu = CreatePopupMenu())) return 0;
- SetFocus((HWND)lParam);
-
- ZeroMemory(&mii, sizeof(MENUITEMINFO));
- mii.cbSize = sizeof(MENUITEMINFO);
- mii.fMask = MIIM_ID|MIIM_STRING|MIIM_FTYPE|MIIM_STATE;
- mii.fType = MFT_STRING;
-
- // insert the items
- for (i = nItems = 0; i < cbex->numItems; i++) {
- if ((cbex->pItems[i].wFlags & CBEXIF_DELETED) || *cbex->pItems[i].szCat == 0) continue;
- mii.fState = (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) ? MFS_CHECKED : MFS_UNCHECKED;
- mii.wID = CBEXM_MENIITEMFIRST + i;
- mii.dwTypeData = cbex->pItems[i].szCat;
- if (!InsertMenuItem(hMenu, i, TRUE, &mii)) {
- DestroyMenu(hMenu);
- return 0;
- }
- nItems++;
- }
- // add separator between default and custom items
- if (nItems > 3) {
- mii.fMask = MIIM_FTYPE;
- mii.fType = MFT_SEPARATOR;
- mii.wID = 0;
- mii.dwItemData = 0;
- InsertMenuItem(hMenu, 3, TRUE, &mii);
- }
- ClientToScreen((HWND)lParam, &pt);
- GetClientRect((HWND)lParam, &rc);
- i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, NULL);
- SendMessage(cbex->hBtnMenu, BM_SETCHECK, NULL, NULL);
- if (i >= CBEXM_MENIITEMFIRST && i < CBEXM_MENIITEMFIRST + cbex->numItems) {
- CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, (WPARAM)i - CBEXM_MENIITEMFIRST, NULL);
- }
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ /**
+ * name: BTN_MENU
+ * desc: the button to dropdown the list to show all items is pressed
+ **/
+ case BTN_MENU:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ POINT pt = { 0, 0 };
+ RECT rc;
+ MENUITEMINFO mii;
+ int i, nItems;
+ HMENU hMenu;
+
+ if (!(hMenu = CreatePopupMenu())) return 0;
+ SetFocus((HWND)lParam);
+
+ ZeroMemory(&mii, sizeof(MENUITEMINFO));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_ID|MIIM_STRING|MIIM_FTYPE|MIIM_STATE;
+ mii.fType = MFT_STRING;
+
+ // insert the items
+ for (i = nItems = 0; i < cbex->numItems; i++) {
+ if ((cbex->pItems[i].wFlags & CBEXIF_DELETED) || *cbex->pItems[i].szCat == 0) continue;
+ mii.fState = (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) ? MFS_CHECKED : MFS_UNCHECKED;
+ mii.wID = CBEXM_MENIITEMFIRST + i;
+ mii.dwTypeData = cbex->pItems[i].szCat;
+ if (!InsertMenuItem(hMenu, i, TRUE, &mii)) {
DestroyMenu(hMenu);
return 0;
}
- break;
+ nItems++;
+ }
+ // add separator between default and custom items
+ if (nItems > 3) {
+ mii.fMask = MIIM_FTYPE;
+ mii.fType = MFT_SEPARATOR;
+ mii.wID = 0;
+ mii.dwItemData = 0;
+ InsertMenuItem(hMenu, 3, TRUE, &mii);
+ }
+ ClientToScreen((HWND)lParam, &pt);
+ GetClientRect((HWND)lParam, &rc);
+ i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, NULL);
+ SendMessage(cbex->hBtnMenu, BM_SETCHECK, NULL, NULL);
+ if (i >= CBEXM_MENIITEMFIRST && i < CBEXM_MENIITEMFIRST + cbex->numItems) {
+ CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, (WPARAM)i - CBEXM_MENIITEMFIRST, NULL);
+ }
+ DestroyMenu(hMenu);
+ return 0;
+ }
+ break;
- /**
- * name: BTN_ADD
- * desc: the button to add a new entry is pressed
- **/
- case BTN_ADD:
- if (HIWORD(wParam) == BN_CLICKED) {
- DLGPROC dlgProc;
- WORD dlgID;
- TCHAR szCat[MAX_CAT] = { 0 };
- TCHAR szVal[MAXDATASIZE] = { 0 };
- CBEXITEM cbi;
- HWND hDlgDetails;
-
- SetFocus((HWND)lParam);
- if (!(hDlgDetails = GetParent(GetParent(hwnd)))) return 1;
- if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL)) return 0;
+ /**
+ * name: BTN_ADD
+ * desc: the button to add a new entry is pressed
+ **/
+ case BTN_ADD:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ DLGPROC dlgProc;
+ WORD dlgID;
+ TCHAR szCat[MAX_CAT] = { 0 };
+ TCHAR szVal[MAXDATASIZE] = { 0 };
+ CBEXITEM cbi;
+ HWND hDlgDetails;
+
+ SetFocus((HWND)lParam);
+ if (!(hDlgDetails = GetParent(GetParent(hwnd)))) return 1;
+ if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL)) return 0;
- switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
- case EDIT_PHONE:
- dlgID = IDD_ADDPHONE;
- dlgProc = DlgProc_Phone;
- cbi.pszIcon = ICO_BTN_CUSTOMPHONE;
- break;
- case EDIT_EMAIL:
- dlgID = IDD_ADDEMAIL;
- dlgProc = DlgProc_EMail;
- cbi.pszIcon = ICO_BTN_EMAIL;
- break;
- default:
- return 1;
- }
+ switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
+ case EDIT_PHONE:
+ dlgID = IDD_ADDPHONE;
+ dlgProc = DlgProc_Phone;
+ cbi.pszIcon = ICO_BTN_CUSTOMPHONE;
+ break;
+ case EDIT_EMAIL:
+ dlgID = IDD_ADDEMAIL;
+ dlgProc = DlgProc_EMail;
+ cbi.pszIcon = ICO_BTN_EMAIL;
+ break;
+ default:
+ return 1;
+ }
- cbi.iItem = -1;
- cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS|CBEXIM_ICONTEXT;
- cbi.pszCat = szCat;
- cbi.pszVal = szVal;
- cbi.ccCat = MAX_CAT;
- cbi.ccVal = MAXDATASIZE;
- cbi.wFlags = 0;
- cbi.dwID = 0;
-
- if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
- HANDLE hContact = NULL;
+ cbi.iItem = -1;
+ cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS|CBEXIM_ICONTEXT;
+ cbi.pszCat = szCat;
+ cbi.pszVal = szVal;
+ cbi.ccCat = MAX_CAT;
+ cbi.ccVal = MAXDATASIZE;
+ cbi.wFlags = 0;
+ cbi.dwID = 0;
+
+ if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
+ HANDLE hContact = NULL;
- SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
- if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM;
- cbi.wFlags |= CTRLF_CHANGED;
- if (SendMessage(hwnd, CBEXM_ADDITEM, NULL, (LPARAM)&cbi) > CB_ERR) {
- SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
- cbex->bIsChanged = TRUE;
- SendMessage(hwnd, CBEXM_SETCURSEL, cbex->numItems - 1, NULL);
- }
- }
- return 0;
+ SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
+ if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM;
+ cbi.wFlags |= CTRLF_CHANGED;
+ if (SendMessage(hwnd, CBEXM_ADDITEM, NULL, (LPARAM)&cbi) > CB_ERR) {
+ SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
+ cbex->bIsChanged = TRUE;
+ SendMessage(hwnd, CBEXM_SETCURSEL, cbex->numItems - 1, NULL);
}
- break;
+ }
+ return 0;
+ }
+ break;
- /**
- * name: BTN_EDIT
- * desc: the button to edit an existing entry is pressed
- **/
- case BTN_EDIT:
- if (HIWORD(wParam) == BN_CLICKED) {
- DLGPROC dlgProc;
- WORD dlgID;
- TCHAR szCat[MAX_CAT] = { 0 };
- TCHAR szVal[MAXDATASIZE] = { 0 };
- CBEXITEM cbi;
- HWND hDlgDetails;
-
- SetFocus((HWND)lParam);
- if (!(hDlgDetails = GetParent(GetParent(hwnd)))) return 1;
- if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL)) return 0;
- if (!cbex->pItems || cbex->iSelectedItem == -1) return 0;
-
- switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
- case EDIT_PHONE:
- dlgID = IDD_ADDPHONE;
- dlgProc = DlgProc_Phone;
- break;
- case EDIT_EMAIL:
- dlgID = IDD_ADDEMAIL;
- dlgProc = DlgProc_EMail;
- break;
- default:
- return 1;
- }
- cbi.iItem = cbex->iSelectedItem;
- cbi.dwID = 0;
- cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS;
- cbi.pszCat = szCat;
- cbi.pszVal = szVal;
- cbi.ccCat = MAX_CAT;
- cbi.ccVal = MAXDATASIZE;
- if (!CtrlContactWndProc(hwnd, CBEXM_GETITEM, NULL, (LPARAM)&cbi)) {
- MsgErr(hwnd, LPGENT("CRITICAL: Unable to edit current entry!\nThis should not happen!"));
- return 1;
- }
+ /**
+ * name: BTN_EDIT
+ * desc: the button to edit an existing entry is pressed
+ **/
+ case BTN_EDIT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ DLGPROC dlgProc;
+ WORD dlgID;
+ TCHAR szCat[MAX_CAT] = { 0 };
+ TCHAR szVal[MAXDATASIZE] = { 0 };
+ CBEXITEM cbi;
+ HWND hDlgDetails;
+
+ SetFocus((HWND)lParam);
+ if (!(hDlgDetails = GetParent(GetParent(hwnd)))) return 1;
+ if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL)) return 0;
+ if (!cbex->pItems || cbex->iSelectedItem == -1) return 0;
+
+ switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
+ case EDIT_PHONE:
+ dlgID = IDD_ADDPHONE;
+ dlgProc = DlgProc_Phone;
+ break;
+ case EDIT_EMAIL:
+ dlgID = IDD_ADDEMAIL;
+ dlgProc = DlgProc_EMail;
+ break;
+ default:
+ return 1;
+ }
+ cbi.iItem = cbex->iSelectedItem;
+ cbi.dwID = 0;
+ cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS;
+ cbi.pszCat = szCat;
+ cbi.pszVal = szVal;
+ cbi.ccCat = MAX_CAT;
+ cbi.ccVal = MAXDATASIZE;
+ if (!CtrlContactWndProc(hwnd, CBEXM_GETITEM, NULL, (LPARAM)&cbi)) {
+ MsgErr(hwnd, LPGENT("CRITICAL: Unable to edit current entry!\nThis should not happen!"));
+ return 1;
+ }
- if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
- HANDLE hContact;
+ if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
+ HANDLE hContact;
- SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
- if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM;
- cbi.wFlags |= CTRLF_CHANGED;
- SendMessage(hwnd, CBEXM_SETITEM, NULL, (LPARAM)&cbi);
- SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
- cbex->bIsChanged = TRUE;
- }
- return 0;
- }
- break;
+ SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
+ if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM;
+ cbi.wFlags |= CTRLF_CHANGED;
+ SendMessage(hwnd, CBEXM_SETITEM, NULL, (LPARAM)&cbi);
+ SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
+ cbex->bIsChanged = TRUE;
+ }
+ return 0;
+ }
+ break;
- /**
- * name: BTN_DEL
- * desc: the button to delete an existing entry is pressed
- **/
- case BTN_DEL:
- if (HIWORD(wParam) == BN_CLICKED) {
- HWND hDlgDetails;
- MSGBOX mBox;
- TCHAR szMsg[MAXDATASIZE];
+ /**
+ * name: BTN_DEL
+ * desc: the button to delete an existing entry is pressed
+ **/
+ case BTN_DEL:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ HWND hDlgDetails;
+ MSGBOX mBox;
+ TCHAR szMsg[MAXDATASIZE];
- SetFocus((HWND)lParam);
- if (!(hDlgDetails = GetParent(GetParent(hwnd))) ||
- SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) ||
- !cbex->pItems ||
- cbex->iSelectedItem < 0 ||
- cbex->iSelectedItem >= cbex->numItems ||
- FAILED(mir_sntprintf(szMsg, MAXDATASIZE, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
- cbex->pItems[cbex->iSelectedItem].szCat, cbex->pItems[cbex->iSelectedItem].pszVal))
- )
- {
- return 1;
- }
- mBox.cbSize = sizeof(MSGBOX);
- mBox.hParent = hDlgDetails;
- mBox.hiLogo = IcoLib_GetIcon(ICO_DLG_PHONE);
- mBox.uType = MB_YESNO|MB_ICON_QUESTION|MB_NOPOPUP;
- mBox.ptszTitle = TranslateT("Delete");
- mBox.ptszMsg = szMsg;
- if (IDYES == MsgBoxService(NULL, (LPARAM)&mBox)) {
- // clear value for standard entry
- if (cbex->pItems[cbex->iSelectedItem].wFlags & CBEXIF_CATREADONLY) {
- MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
- SetWindowText(cbex->hEdit, _T(""));
- cbex->pItems[cbex->iSelectedItem].wFlags &= ~CBEXIF_SMS;
- cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
- }
- // clear values for customized database entry
- else
- if (cbex->pItems[cbex->iSelectedItem].dwID != 0) {
- MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
- *cbex->pItems[cbex->iSelectedItem].szCat = 0;
- cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED|CBEXIF_DELETED;
- CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, cbex->iSelectedItem - 1, FALSE);
- }
- // delete default entry
- else
- CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem);
-
- SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
- cbex->bIsChanged = TRUE;
- }
- return 0;
+ SetFocus((HWND)lParam);
+ if (!(hDlgDetails = GetParent(GetParent(hwnd))) ||
+ SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) ||
+ !cbex->pItems ||
+ cbex->iSelectedItem < 0 ||
+ cbex->iSelectedItem >= cbex->numItems ||
+ FAILED(mir_sntprintf(szMsg, MAXDATASIZE, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
+ cbex->pItems[cbex->iSelectedItem].szCat, cbex->pItems[cbex->iSelectedItem].pszVal))
+ )
+ {
+ return 1;
+ }
+ mBox.cbSize = sizeof(MSGBOX);
+ mBox.hParent = hDlgDetails;
+ mBox.hiLogo = Skin_GetIcon(ICO_DLG_PHONE);
+ mBox.uType = MB_YESNO|MB_ICON_QUESTION|MB_NOPOPUP;
+ mBox.ptszTitle = TranslateT("Delete");
+ mBox.ptszMsg = szMsg;
+ if (IDYES == MsgBoxService(NULL, (LPARAM)&mBox)) {
+ // clear value for standard entry
+ if (cbex->pItems[cbex->iSelectedItem].wFlags & CBEXIF_CATREADONLY) {
+ MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
+ SetWindowText(cbex->hEdit, _T(""));
+ cbex->pItems[cbex->iSelectedItem].wFlags &= ~CBEXIF_SMS;
+ cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
}
- break;
+ // clear values for customized database entry
+ else
+ if (cbex->pItems[cbex->iSelectedItem].dwID != 0) {
+ MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
+ *cbex->pItems[cbex->iSelectedItem].szCat = 0;
+ cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED|CBEXIF_DELETED;
+ CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, cbex->iSelectedItem - 1, FALSE);
+ }
+ // delete default entry
+ else
+ CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem);
- /**
- * name: EDIT_VALUE
- * desc: the edit control wants us to act
- **/
- case EDIT_VALUE:
- switch (HIWORD(wParam)) {
- case EN_UPDATE:
- {
- TCHAR szVal[MAXDATASIZE] = { 0 };
- int ccVal;
- HANDLE hContact;
- HWND hDlgDetails = GetParent(GetParent(hwnd));
+ SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
+ cbex->bIsChanged = TRUE;
+ }
+ return 0;
+ }
+ break;
+
+ /**
+ * name: EDIT_VALUE
+ * desc: the edit control wants us to act
+ **/
+ case EDIT_VALUE:
+ switch (HIWORD(wParam)) {
+ case EN_UPDATE:
+ {
+ TCHAR szVal[MAXDATASIZE] = { 0 };
+ int ccVal;
+ HANDLE hContact;
+ HWND hDlgDetails = GetParent(GetParent(hwnd));
- EnableWindow(cbex->hBtnDel, GetWindowTextLength(cbex->hEdit) > 0);
-
- if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) ||
- cbex->bLocked ||
- !cbex->pItems ||
- cbex->iSelectedItem < 0 ||
- cbex->iSelectedItem >= cbex->numItems) return 1;
-
- // get the edit control's text value and check it for syntax
- switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
- case EDIT_PHONE:
- {
- int errorPos;
- TCHAR szEdit[MAXDATASIZE];
-
- if (ccVal = GetWindowText(cbex->hEdit, szEdit, MAXDATASIZE)) {
- if (!(ccVal = CheckPhoneSyntax(szEdit, szVal, MAXDATASIZE, errorPos)) || errorPos > -1) {
- SetWindowText(cbex->hEdit, szVal);
- SendMessage(cbex->hEdit, EM_SETSEL, errorPos, errorPos);
- }
- }
- break;
+ EnableWindow(cbex->hBtnDel, GetWindowTextLength(cbex->hEdit) > 0);
+
+ if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) ||
+ cbex->bLocked ||
+ !cbex->pItems ||
+ cbex->iSelectedItem < 0 ||
+ cbex->iSelectedItem >= cbex->numItems) return 1;
+
+ // get the edit control's text value and check it for syntax
+ switch (GetWindowLongPtr(hwnd, GWLP_ID)) {
+ case EDIT_PHONE:
+ {
+ int errorPos;
+ TCHAR szEdit[MAXDATASIZE];
+
+ if (ccVal = GetWindowText(cbex->hEdit, szEdit, MAXDATASIZE)) {
+ if (!(ccVal = CheckPhoneSyntax(szEdit, szVal, MAXDATASIZE, errorPos)) || errorPos > -1) {
+ SetWindowText(cbex->hEdit, szVal);
+ SendMessage(cbex->hEdit, EM_SETSEL, errorPos, errorPos);
}
- case EDIT_EMAIL:
- ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
- break;
- default:
- ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
- break;
}
+ break;
+ }
+ case EDIT_EMAIL:
+ ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
+ break;
+ default:
+ ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
+ break;
+ }
- SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
- if ((cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED) && !(hContact && (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM))) return 0;
+ SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
+ if ((cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED) && !(hContact && (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM))) return 0;
- if (*szVal == 0 || !cbex->pItems[cbex->iSelectedItem].pszVal || _tcscmp(szVal, cbex->pItems[cbex->iSelectedItem].pszVal)) {
- cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
- cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO);
- cbex->bIsChanged = TRUE;
- InvalidateRect((HWND)lParam, NULL, TRUE);
- SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
- }
- return 0;
- }
- case EN_KILLFOCUS:
- {
- int ccText;
+ if (*szVal == 0 || !cbex->pItems[cbex->iSelectedItem].pszVal || _tcscmp(szVal, cbex->pItems[cbex->iSelectedItem].pszVal)) {
+ cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
+ cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO);
+ cbex->bIsChanged = TRUE;
+ InvalidateRect((HWND)lParam, NULL, TRUE);
+ SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL);
+ }
+ return 0;
+ }
+ case EN_KILLFOCUS:
+ {
+ int ccText;
- if (!cbex->pItems || cbex->iSelectedItem < 0 || cbex->iSelectedItem >= cbex->numItems) return 1;
- if (!(cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED)) return 0;
-
- if ((ccText = GetWindowTextLength(cbex->hEdit)) <= 0) {
- if (cbex->pItems[cbex->iSelectedItem].wFlags & CBEXIF_CATREADONLY) {
- MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
- SetWindowText(cbex->hEdit, _T(""));
- cbex->pItems[cbex->iSelectedItem].wFlags &= ~CBEXIF_SMS;
- }
- else
- CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem);
- SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, NULL, NULL);
- cbex->bIsChanged = TRUE;
- }
- else
- if (cbex->pItems[cbex->iSelectedItem].pszVal = (LPTSTR)mir_realloc(cbex->pItems[cbex->iSelectedItem].pszVal, (ccText + 2) * sizeof(TCHAR))) {
- cbex->pItems[cbex->iSelectedItem].pszVal[ccText + 1] = 0;
- GetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal, ccText + 1);
- }
- return 0;
+ if (!cbex->pItems || cbex->iSelectedItem < 0 || cbex->iSelectedItem >= cbex->numItems) return 1;
+ if (!(cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED)) return 0;
+
+ if ((ccText = GetWindowTextLength(cbex->hEdit)) <= 0) {
+ if (cbex->pItems[cbex->iSelectedItem].wFlags & CBEXIF_CATREADONLY) {
+ MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal);
+ SetWindowText(cbex->hEdit, _T(""));
+ cbex->pItems[cbex->iSelectedItem].wFlags &= ~CBEXIF_SMS;
}
+ else
+ CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem);
+ SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, NULL, NULL);
+ cbex->bIsChanged = TRUE;
}
- break;
+ else
+ if (cbex->pItems[cbex->iSelectedItem].pszVal = (LPTSTR)mir_realloc(cbex->pItems[cbex->iSelectedItem].pszVal, (ccText + 2) * sizeof(TCHAR))) {
+ cbex->pItems[cbex->iSelectedItem].pszVal[ccText + 1] = 0;
+ GetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal, ccText + 1);
+ }
+ return 0;
+ }
}
break;
+ }
+ break;
- /**
- * name: CBEXM_ADDITEM
- * desc: add a item to the control
- * param: wParam - not used
- * lParam - (LPCBEXITEM)&item
- * return: CB_ERR on failure, new item index if successful
- **/
- case CBEXM_ADDITEM:
- {
- LPCBEXITEM pItem = (LPCBEXITEM)lParam;
+ /**
+ * name: CBEXM_ADDITEM
+ * desc: add a item to the control
+ * param: wParam - not used
+ * lParam - (LPCBEXITEM)&item
+ * return: CB_ERR on failure, new item index if successful
+ **/
+ case CBEXM_ADDITEM:
+ {
+ LPCBEXITEM pItem = (LPCBEXITEM)lParam;
- if (!pItem) return FALSE;
+ if (!pItem) return FALSE;
- // if an item with the id of pItem exists, change it instead of adding a new one
- // but only if it has not been changed by the user yet.
- if ((pItem->wMask & CBEXIM_ID) && cbex->pItems && pItem->dwID != 0) {
- int iIndex;
+ // if an item with the id of pItem exists, change it instead of adding a new one
+ // but only if it has not been changed by the user yet.
+ if ((pItem->wMask & CBEXIM_ID) && cbex->pItems && pItem->dwID != 0) {
+ int iIndex;
- for (iIndex = 0; iIndex < cbex->numItems; iIndex++) {
- if (cbex->pItems[iIndex].dwID == pItem->dwID) {
- pItem->iItem = iIndex;
- if (cbex->pItems[iIndex].wFlags & CTRLF_CHANGED)
- pItem->wFlags |= CTRLF_CHANGED;
- else
- CtrlContactWndProc(hwnd, CBEXM_SETITEM, 0, lParam);
- return iIndex;
- }
+ for (iIndex = 0; iIndex < cbex->numItems; iIndex++) {
+ if (cbex->pItems[iIndex].dwID == pItem->dwID) {
+ pItem->iItem = iIndex;
+ if (cbex->pItems[iIndex].wFlags & CTRLF_CHANGED)
+ pItem->wFlags |= CTRLF_CHANGED;
+ else
+ CtrlContactWndProc(hwnd, CBEXM_SETITEM, 0, lParam);
+ return iIndex;
}
}
+ }
- // add a new item to the combobox
- if (!(cbex->pItems = (LPCBEXITEMINTERN)mir_realloc(cbex->pItems, (cbex->numItems + 1) * sizeof(CBEXITEMINTERN)))) {
- cbex->numItems = 0;
- return CB_ERR;
- }
+ // add a new item to the combobox
+ if (!(cbex->pItems = (LPCBEXITEMINTERN)mir_realloc(cbex->pItems, (cbex->numItems + 1) * sizeof(CBEXITEMINTERN)))) {
+ cbex->numItems = 0;
+ return CB_ERR;
+ }
- // set the ID
- cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0;
+ // set the ID
+ cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0;
- // set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
- mir_sntprintf(cbex->pItems[cbex->numItems].szCat, MAX_CAT, _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
- }
-
- // set value string
- if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0])
- cbex->pItems[cbex->numItems].pszVal = mir_tstrdup(pItem->pszVal);
- else
- cbex->pItems[cbex->numItems].pszVal = NULL;
- // set icon
- if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) {
- cbex->pItems[cbex->numItems].pszIcon = pItem->pszIcon;
- cbex->pItems[cbex->numItems].hIcon = IcoLib_GetIcon(pItem->pszIcon);
- }
- // set flags
- cbex->pItems[cbex->numItems].wFlags = (pItem->wMask & CBEXIM_CAT) ? pItem->wFlags : 0;
+ // set category string
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
+ mir_sntprintf(cbex->pItems[cbex->numItems].szCat, MAX_CAT, _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
+ }
- cbex->numItems++;
- return cbex->numItems;
+ // set value string
+ if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0])
+ cbex->pItems[cbex->numItems].pszVal = mir_tstrdup(pItem->pszVal);
+ else
+ cbex->pItems[cbex->numItems].pszVal = NULL;
+ // set icon
+ if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) {
+ cbex->pItems[cbex->numItems].pszIcon = pItem->pszIcon;
+ cbex->pItems[cbex->numItems].hIcon = Skin_GetIcon(pItem->pszIcon);
}
+ // set flags
+ cbex->pItems[cbex->numItems].wFlags = (pItem->wMask & CBEXIM_CAT) ? pItem->wFlags : 0;
- /**
- * name: CBEXM_SETITEM
- * desc: Set an item's information of the control.
- * If iItem member of CBEXITEM is -1, the currently selected item is changed.
- * param: wParam - not used
- * lParam - (LPCBEXITEM)&item
- * return: CB_ERR on failure, new item index if successful
- **/
- case CBEXM_SETITEM:
- {
- LPCBEXITEM pItem = (LPCBEXITEM)lParam;
-
- if (!PtrIsValid(pItem) || !pItem->wMask || !PtrIsValid(cbex->pItems)) return FALSE;
- if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem;
- if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE;
-
- // set new category string
- if (pItem->wMask & CBEXIM_CAT) {
- // set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
- mir_sntprintf(cbex->pItems[pItem->iItem].szCat, MAX_CAT, _T("%s %d\0"), TranslateT("Other"), ++cbex->numOther);
- if (pItem->iItem == cbex->iSelectedItem)
- SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
- }
- // set new value
- if (pItem->wMask & CBEXIM_VAL) {
- MIR_FREE(cbex->pItems[pItem->iItem].pszVal);
- if (pItem->pszVal && pItem->pszVal[0])
- cbex->pItems[pItem->iItem].pszVal = mir_tstrdup(pItem->pszVal);
- if (pItem->iItem == cbex->iSelectedItem)
- SetWindowText(cbex->hEdit, cbex->pItems[pItem->iItem].pszVal ? cbex->pItems[pItem->iItem].pszVal : _T(""));
- }
+ cbex->numItems++;
+ return cbex->numItems;
+ }
- // set icon
- if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) {
- cbex->pItems[pItem->iItem].pszIcon = pItem->pszIcon;
- cbex->pItems[pItem->iItem].hIcon = IcoLib_GetIcon(pItem->pszIcon);
- if (pItem->iItem == cbex->iSelectedItem)
- SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[pItem->iItem].hIcon);
- }
- if (pItem->wMask & CBEXIM_FLAGS) {
- cbex->pItems[pItem->iItem].wFlags = pItem->wFlags;
- CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL);
- }
- return TRUE;
+ /**
+ * name: CBEXM_SETITEM
+ * desc: Set an item's information of the control.
+ * If iItem member of CBEXITEM is -1, the currently selected item is changed.
+ * param: wParam - not used
+ * lParam - (LPCBEXITEM)&item
+ * return: CB_ERR on failure, new item index if successful
+ **/
+ case CBEXM_SETITEM:
+ {
+ LPCBEXITEM pItem = (LPCBEXITEM)lParam;
+
+ if (!PtrIsValid(pItem) || !pItem->wMask || !PtrIsValid(cbex->pItems)) return FALSE;
+ if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem;
+ if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE;
+
+ // set new category string
+ if (pItem->wMask & CBEXIM_CAT) {
+ // set category string
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
+ mir_sntprintf(cbex->pItems[pItem->iItem].szCat, MAX_CAT, _T("%s %d\0"), TranslateT("Other"), ++cbex->numOther);
+ if (pItem->iItem == cbex->iSelectedItem)
+ SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
+ }
+ // set new value
+ if (pItem->wMask & CBEXIM_VAL) {
+ MIR_FREE(cbex->pItems[pItem->iItem].pszVal);
+ if (pItem->pszVal && pItem->pszVal[0])
+ cbex->pItems[pItem->iItem].pszVal = mir_tstrdup(pItem->pszVal);
+ if (pItem->iItem == cbex->iSelectedItem)
+ SetWindowText(cbex->hEdit, cbex->pItems[pItem->iItem].pszVal ? cbex->pItems[pItem->iItem].pszVal : _T(""));
}
- /**
- * name: CBEXM_GETITEM
- * desc: Get an item from the control.
- * If iItem member of CBEXITEM is -1, the currently selected item is returned.
- * param: wParam - not used
- * lParam - (LPCBEXITEM)&item
- * return: CB_ERR on failure, new item index if successful
- **/
- case CBEXM_GETITEM:
- {
- LPCBEXITEM pItem = (LPCBEXITEM)lParam;
+ // set icon
+ if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) {
+ cbex->pItems[pItem->iItem].pszIcon = pItem->pszIcon;
+ cbex->pItems[pItem->iItem].hIcon = Skin_GetIcon(pItem->pszIcon);
+ if (pItem->iItem == cbex->iSelectedItem)
+ SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[pItem->iItem].hIcon);
+ }
+ if (pItem->wMask & CBEXIM_FLAGS) {
+ cbex->pItems[pItem->iItem].wFlags = pItem->wFlags;
+ CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL);
+ }
+ return TRUE;
+ }
- if (!pItem || !cbex->pItems) return FALSE;
+ /**
+ * name: CBEXM_GETITEM
+ * desc: Get an item from the control.
+ * If iItem member of CBEXITEM is -1, the currently selected item is returned.
+ * param: wParam - not used
+ * lParam - (LPCBEXITEM)&item
+ * return: CB_ERR on failure, new item index if successful
+ **/
+ case CBEXM_GETITEM:
+ {
+ LPCBEXITEM pItem = (LPCBEXITEM)lParam;
+
+ if (!pItem || !cbex->pItems) return FALSE;
- // try to find item by id
- if ((pItem->wMask & CBEXIM_ID) && pItem->dwID != 0) {
- int i;
+ // try to find item by id
+ if ((pItem->wMask & CBEXIM_ID) && pItem->dwID != 0) {
+ int i;
- for (i = 0; i < cbex->numItems; i++) {
- if (cbex->pItems[i].dwID == pItem->dwID)
- break;
- }
- pItem->iItem = i;
+ for (i = 0; i < cbex->numItems; i++) {
+ if (cbex->pItems[i].dwID == pItem->dwID)
+ break;
}
- else
- if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem;
- if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE;
+ pItem->iItem = i;
+ }
+ else
+ if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem;
+ if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE;
- // return only currently selected itemindex
- if (!pItem->wMask) return TRUE;
- // return the unique id
- if (pItem->wMask & CBEXIM_ID)
- pItem->dwID = cbex->pItems[pItem->iItem].dwID;
- // return category string
- if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) {
- if (*cbex->pItems[pItem->iItem].szCat != 0)
- mir_tcsncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
- else
- *pItem->pszCat = 0;
- }
- // return value string
- if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) {
- if (cbex->pItems[pItem->iItem].pszVal)
- mir_tcsncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
- else
- *pItem->pszVal = 0;
- }
- // return the icon
- if (pItem->wMask & CBEXIM_ICONTEXT)
- pItem->pszIcon = cbex->pItems[pItem->iItem].pszIcon;
- // return the flags
- if (pItem->wMask & CBEXIM_FLAGS)
- pItem->wFlags = cbex->pItems[pItem->iItem].wFlags;
- return TRUE;
+ // return only currently selected itemindex
+ if (!pItem->wMask) return TRUE;
+ // return the unique id
+ if (pItem->wMask & CBEXIM_ID)
+ pItem->dwID = cbex->pItems[pItem->iItem].dwID;
+ // return category string
+ if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) {
+ if (*cbex->pItems[pItem->iItem].szCat != 0)
+ mir_tcsncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
+ else
+ *pItem->pszCat = 0;
}
-
- /**
- * name: CBEXM_DELITEM
- * desc: delete an item from the control
- * param: wParam - not used
- * lParam - item index
- * return: CB_ERR on failure, new item index if successful
- **/
- case CBEXM_DELITEM:
- {
- if (!cbex->pItems || (int)lParam < 0 || (int)lParam >= cbex->numItems || (cbex->pItems[lParam].wFlags & CBEXIF_CATREADONLY))
- return FALSE;
- MIR_FREE(cbex->pItems[(int)lParam].pszVal);
- memmove(cbex->pItems + (int)lParam,
- cbex->pItems + (int)lParam + 1,
- (cbex->numItems - (int)lParam - 1) * sizeof(CBEXITEMINTERN));
- cbex->numItems--;
- ZeroMemory(cbex->pItems + cbex->numItems, sizeof(CBEXITEMINTERN));
- CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, lParam - 1, FALSE);
- return TRUE;
+ // return value string
+ if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) {
+ if (cbex->pItems[pItem->iItem].pszVal)
+ mir_tcsncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
+ else
+ *pItem->pszVal = 0;
}
+ // return the icon
+ if (pItem->wMask & CBEXIM_ICONTEXT)
+ pItem->pszIcon = cbex->pItems[pItem->iItem].pszIcon;
+ // return the flags
+ if (pItem->wMask & CBEXIM_FLAGS)
+ pItem->wFlags = cbex->pItems[pItem->iItem].wFlags;
+ return TRUE;
+ }
- /**
- * name: CBEXM_DELITEM
- * desc: delete an item from the control
- * param: wParam - not used
- * lParam - item index
- * return: CB_ERR on failure, new item index if successful
- **/
- case CBEXM_DELALLITEMS:
- {
- int i;
+ /**
+ * name: CBEXM_DELITEM
+ * desc: delete an item from the control
+ * param: wParam - not used
+ * lParam - item index
+ * return: CB_ERR on failure, new item index if successful
+ **/
+ case CBEXM_DELITEM:
+ {
+ if (!cbex->pItems || (int)lParam < 0 || (int)lParam >= cbex->numItems || (cbex->pItems[lParam].wFlags & CBEXIF_CATREADONLY))
+ return FALSE;
+ MIR_FREE(cbex->pItems[(int)lParam].pszVal);
+ memmove(cbex->pItems + (int)lParam,
+ cbex->pItems + (int)lParam + 1,
+ (cbex->numItems - (int)lParam - 1) * sizeof(CBEXITEMINTERN));
+ cbex->numItems--;
+ ZeroMemory(cbex->pItems + cbex->numItems, sizeof(CBEXITEMINTERN));
+ CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, lParam - 1, FALSE);
+ return TRUE;
+ }
- if (PtrIsValid(cbex)) {
- if (PtrIsValid(cbex->pItems)) {
- for (i = 0; i < cbex->numItems; i++) {
- MIR_FREE(cbex->pItems[i].pszVal);
- }
- MIR_FREE(cbex->pItems);
- cbex->pItems = NULL;
+ /**
+ * name: CBEXM_DELITEM
+ * desc: delete an item from the control
+ * param: wParam - not used
+ * lParam - item index
+ * return: CB_ERR on failure, new item index if successful
+ **/
+ case CBEXM_DELALLITEMS:
+ {
+ int i;
+
+ if (PtrIsValid(cbex)) {
+ if (PtrIsValid(cbex->pItems)) {
+ for (i = 0; i < cbex->numItems; i++) {
+ MIR_FREE(cbex->pItems[i].pszVal);
}
- cbex->numItems = 0;
- cbex->iSelectedItem = -1;
- SetWindowText(cbex->hEdit, _T(""));
- SetWindowText(cbex->hBtnEdit, _T(""));
- SendMessage(cbex->hBtnEdit, WM_SETICON, NULL, NULL);
+ MIR_FREE(cbex->pItems);
+ cbex->pItems = NULL;
}
- return TRUE;
+ cbex->numItems = 0;
+ cbex->iSelectedItem = -1;
+ SetWindowText(cbex->hEdit, _T(""));
+ SetWindowText(cbex->hBtnEdit, _T(""));
+ SendMessage(cbex->hBtnEdit, WM_SETICON, NULL, NULL);
}
+ return TRUE;
+ }
- /**
- * name: CBEXM_ENABLEITEM
- * desc: enables or disables the current item
- * param: wParam - not used
- * lParam - not used
- * return: always 0
- **/
- case CBEXM_ENABLEITEM:
- if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) {
- HANDLE hContact;
- BYTE bEnabled;
+ /**
+ * name: CBEXM_ENABLEITEM
+ * desc: enables or disables the current item
+ * param: wParam - not used
+ * lParam - not used
+ * return: always 0
+ **/
+ case CBEXM_ENABLEITEM:
+ if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) {
+ HANDLE hContact;
+ BYTE bEnabled;
- PSGetContact(GetParent(hwnd), hContact);
+ PSGetContact(GetParent(hwnd), hContact);
- bEnabled = !hContact ||
- (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) ||
- !(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
- !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0);
+ bEnabled = !hContact ||
+ (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) ||
+ !(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
+ !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0);
- EnableWindow(cbex->hBtnEdit, bEnabled);
- EnableWindow(cbex->hBtnDel, bEnabled && GetWindowTextLength(cbex->hEdit) > 0);
- EnableWindow(cbex->hEdit, bEnabled);
- }
- break;
-
- /**
- * name: CBEXM_ISCHANGED
- * desc: returns whether the control contains changed values or not
- * param: wParam - not used
- * lParam - not used
- * return: TRUE if control was changed, FALSE if nothing was edited
- **/
- case CBEXM_ISCHANGED:
- return cbex->bIsChanged;
-
- /**
- * name: CBEXM_RESETCHANGED
- * desc: resets changed flag to FALSE
- * param: wParam - not used
- * lParam - not used
- * return: always FALSE
- **/
- case CBEXM_RESETCHANGED:
- cbex->bIsChanged = 0;
- return 0;
+ EnableWindow(cbex->hBtnEdit, bEnabled);
+ EnableWindow(cbex->hBtnDel, bEnabled && GetWindowTextLength(cbex->hEdit) > 0);
+ EnableWindow(cbex->hEdit, bEnabled);
+ }
+ break;
- /**
- * name: CBEXM_SETCURSEL
- * desc: selects a certain item
- * param: wParam - index of the item to select
- * lParam - (BYTE)bValid - if TRUE, the next item with a value is selected
- * return: always FALSE
- **/
- case CBEXM_SETCURSEL:
- {
- int i;
+ /**
+ * name: CBEXM_ISCHANGED
+ * desc: returns whether the control contains changed values or not
+ * param: wParam - not used
+ * lParam - not used
+ * return: TRUE if control was changed, FALSE if nothing was edited
+ **/
+ case CBEXM_ISCHANGED:
+ return cbex->bIsChanged;
+
+ /**
+ * name: CBEXM_RESETCHANGED
+ * desc: resets changed flag to FALSE
+ * param: wParam - not used
+ * lParam - not used
+ * return: always FALSE
+ **/
+ case CBEXM_RESETCHANGED:
+ cbex->bIsChanged = 0;
+ return 0;
+
+ /**
+ * name: CBEXM_SETCURSEL
+ * desc: selects a certain item
+ * param: wParam - index of the item to select
+ * lParam - (BYTE)bValid - if TRUE, the next item with a value is selected
+ * return: always FALSE
+ **/
+ case CBEXM_SETCURSEL:
+ {
+ int i;
- if (!cbex->pItems) return 1;
- if ((int)wParam < 0 || (int)wParam >= cbex->numItems) wParam = max(cbex->iSelectedItem, 0);
- cbex->bLocked = 1;
+ if (!cbex->pItems) return 1;
+ if ((int)wParam < 0 || (int)wParam >= cbex->numItems) wParam = max(cbex->iSelectedItem, 0);
+ cbex->bLocked = 1;
- if ((BYTE)lParam == TRUE) {
- int i = (int)wParam;
+ if ((BYTE)lParam == TRUE) {
+ int i = (int)wParam;
- cbex->iSelectedItem = (int)wParam;
- while (i < cbex->numItems) {
- if (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) {
- cbex->iSelectedItem = i;
- break;
- }
- i++;
- }
- }
- else {
- // search for the next none deleted item
- for (i = (int)wParam; i < cbex->numItems && *cbex->pItems[i].szCat == 0; i++);
- if (i == cbex->numItems && (int)wParam > 0) {
- for (i = 0; i < (int)wParam && *cbex->pItems[i].szCat == 0; i++);
- cbex->iSelectedItem = i == (int)wParam ? 0 : i;
- }
- else
+ cbex->iSelectedItem = (int)wParam;
+ while (i < cbex->numItems) {
+ if (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) {
cbex->iSelectedItem = i;
-
+ break;
+ }
+ i++;
}
- SetWindowText(cbex->hBtnEdit, cbex->pItems[cbex->iSelectedItem].szCat);
- SetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal ? cbex->pItems[cbex->iSelectedItem].pszVal : _T(""));
- SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon);
- CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL);
- cbex->bLocked = 0;
- return 0;
}
- case CBEXM_SORT:
- if (cbex->numItems > 4) {
- qsort(cbex->pItems + 3, cbex->numItems - 3, sizeof(CBEXITEMINTERN), compareProc);
+ else {
+ // search for the next none deleted item
+ for (i = (int)wParam; i < cbex->numItems && *cbex->pItems[i].szCat == 0; i++);
+ if (i == cbex->numItems && (int)wParam > 0) {
+ for (i = 0; i < (int)wParam && *cbex->pItems[i].szCat == 0; i++);
+ cbex->iSelectedItem = i == (int)wParam ? 0 : i;
}
- return 0;
+ else
+ cbex->iSelectedItem = i;
- case WM_ERASEBKGND:
- return 1;
+ }
+ SetWindowText(cbex->hBtnEdit, cbex->pItems[cbex->iSelectedItem].szCat);
+ SetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal ? cbex->pItems[cbex->iSelectedItem].pszVal : _T(""));
+ SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon);
+ CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL);
+ cbex->bLocked = 0;
+ return 0;
+ }
+ case CBEXM_SORT:
+ if (cbex->numItems > 4) {
+ qsort(cbex->pItems + 3, cbex->numItems - 3, sizeof(CBEXITEMINTERN), compareProc);
+ }
+ return 0;
- case WM_SETFOCUS:
- SetFocus(cbex->hEdit);
- SendMessage(cbex->hEdit, EM_SETSEL, 0, (LPARAM)-1);
- return 0;
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_SETFOCUS:
+ SetFocus(cbex->hEdit);
+ SendMessage(cbex->hEdit, EM_SETSEL, 0, (LPARAM)-1);
+ return 0;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
@@ -1526,4 +1501,4 @@ int CtrlContactWriteMyItemsToDB(
DB::Setting::DeleteArray(hContact, pszModule, szFormatVal, i);
InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE);
return 0;
-} \ No newline at end of file
+}
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index cc31b1c4c6..00ad372ef0 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -332,7 +332,7 @@ class CAnnivList
}
// set icons
- hIcon = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY);
+ hIcon = Skin_GetIcon(ICO_DLG_ANNIVERSARY);
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 46e05375d4..9092de9fb4 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -53,26 +53,22 @@ static FORCEINLINE void MoveCtrl(HWND hDlg, int idCtrl, int dx, int dy, int dw,
}
/**
- * This function loads the icon to display for the current message.
- *
- * @param pMsgBox - pointer to a MSGBOX structure, with information about the message to display.
- *
- * @retval HICON - The function returns an icon to display with the message.
- * @retval NULL - There is no icon for the message.
- **/
+* This function loads the icon to display for the current message.
+*
+* @param pMsgBox - pointer to a MSGBOX structure, with information about the message to display.
+*
+* @retval HICON - The function returns an icon to display with the message.
+* @retval NULL - There is no icon for the message.
+**/
+
static HICON MsgLoadIcon(LPMSGBOX pMsgBox)
{
HICON hIcon;
// load the desired status icon
- switch (pMsgBox->uType & MB_ICONMASK)
- {
-
- // custom icon defined by caller function
- case MB_ICON_OTHER:
- {
- hIcon = pMsgBox->hiMsg;
- }
+ switch (pMsgBox->uType & MB_ICONMASK) {
+ case MB_ICON_OTHER: // custom icon defined by caller function
+ hIcon = pMsgBox->hiMsg;
break;
// default windows icons
@@ -88,9 +84,7 @@ static HICON MsgLoadIcon(LPMSGBOX pMsgBox)
// no icon
default:
- {
- hIcon = NULL;
- }
+ hIcon = NULL;
}
return hIcon;
}
@@ -113,77 +107,56 @@ static void MakePopupAction(POPUPACTION &pa, int id)
pa.wParam = MAKEWORD(id, BN_CLICKED);
pa.lParam = 0;
- switch (id)
- {
+ switch (id) {
case IDOK:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Ok");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Ok");
break;
case IDCLOSE:
case IDCANCEL:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Cancel");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Cancel");
break;
case IDABORT:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Abort");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Abort");
break;
case IDRETRY:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
- mir_strcpy(pa.lpzTitle, MODNAME"/Retry");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_UPDATE);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Retry");
break;
case IDIGNORE:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Ignore");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Ignore");
break;
case IDYES:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/Yes");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Yes");
break;
case IDNO:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/No");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
+ mir_strcpy(pa.lpzTitle, MODNAME"/No");
break;
-
+
case IDHELP:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/Help");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
+ mir_strcpy(pa.lpzTitle, MODNAME"/Help");
break;
case IDALL:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK);
- mir_strcpy(pa.lpzTitle, MODNAME"/All");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_OK);
+ mir_strcpy(pa.lpzTitle, MODNAME"/All");
break;
case IDNONE:
- {
- pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- mir_strcpy(pa.lpzTitle, MODNAME"/None");
- }
+ pa.lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
+ mir_strcpy(pa.lpzTitle, MODNAME"/None");
}
}
@@ -204,21 +177,17 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
static int retNon = IDNONE;
static int retCancel = IDCANCEL;
- switch (uMsg)
- {
+ switch (uMsg) {
case WM_INITDIALOG:
{
LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
-
- if (PtrIsValid(pMsgBox))
- {
+ if (PtrIsValid(pMsgBox)) {
int icoWidth = 0;
int InfoBarHeight = 0;
HFONT hNormalFont;
hNormalFont = (HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0);
- if (pMsgBox->uType & MB_INFOBAR)
- {
+ if (pMsgBox->uType & MB_INFOBAR) {
LOGFONT lf;
// set bold font for name in description area
@@ -231,32 +200,26 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
// set infobar's logo icon
SendDlgItemMessage(hDlg, ICO_DLGLOGO, STM_SETIMAGE, IMAGE_ICON,
- (LPARAM)((pMsgBox->hiLogo) ? pMsgBox->hiLogo : IcoLib_GetIcon(ICO_DLG_DETAILS)));
+ (LPARAM)((pMsgBox->hiLogo) ? pMsgBox->hiLogo : Skin_GetIcon(ICO_DLG_DETAILS, TRUE)));
// anable headerbar
ShowWindow(GetDlgItem(hDlg, TXT_NAME), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, ICO_DLGLOGO), SW_SHOW);
}
- else
- {
+ else {
RECT rc;
GetClientRect(GetDlgItem(hDlg, TXT_NAME), &rc);
InfoBarHeight = rc.bottom;
if (pMsgBox->hiLogo)
- {
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pMsgBox->hiLogo);
- }
}
// draw the desired status icon
HICON hIcon = MsgLoadIcon(pMsgBox);
if (hIcon)
- {
SendDlgItemMessage(hDlg, ICO_MSGDLG, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- }
- else
- {
+ else {
RECT ws;
GetWindowRect(GetDlgItem(hDlg, ICO_MSGDLG), &ws);
icoWidth = ws.right - ws.left;
@@ -264,33 +227,26 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
}
// resize the messagebox and reorganize the buttons
- if (HDC hDC = GetDC(hDlg))
- {
+ if (HDC hDC = GetDC(hDlg)) {
POINT mpt = {0,0};
RECT ws = {0,0,0,0};
- int txtWidth,
- txtHeight,
- needX, needY;
+ int txtWidth, txtHeight, needX, needY;
RECT rcDlg;
SIZE ts;
LPTSTR h, rs;
SelectObject(hDC, hNormalFont);
- for (rs = h = pMsgBox->ptszMsg, txtHeight = 0, txtWidth = 0; h; h++)
- {
- if (*h == '\n' || *h == '\0')
- {
+ for (rs = h = pMsgBox->ptszMsg, txtHeight = 0, txtWidth = 0; h; h++) {
+ if (*h == '\n' || *h == '\0') {
GetTextExtentPoint32(hDC, rs, h - rs, &ts);
if (ts.cx > txtWidth)
- {
txtWidth = ts.cx;
- }
+
txtHeight += ts.cy;
if (*h == '\0')
- {
break;
- }
+
rs = h + 1;
}
}
@@ -305,11 +261,7 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
rcDlg.top -= (needY-InfoBarHeight)/2; rcDlg.bottom += (needY-InfoBarHeight)/2;
// resize dialog window
- MoveWindow(hDlg,
- rcDlg.left, rcDlg.top,
- rcDlg.right - rcDlg.left,
- rcDlg.bottom - rcDlg.top,
- FALSE);
+ MoveWindow(hDlg, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, FALSE);
ClientToScreen(hDlg, &mpt);
MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight);
@@ -322,180 +274,144 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
//
// Do pushbutton positioning
//
- {
- RECT rcOk, rcAll, rcNone, rcCancel;
- LONG okWidth, caWidth, allWidth, noneWidth, dlgMid;
+ RECT rcOk, rcAll, rcNone, rcCancel;
- // get button rectangles
- GetWindowRect(GetDlgItem(hDlg, IDOK), &rcOk);
- OffsetRect(&rcOk, -mpt.x, -mpt.y + needY - InfoBarHeight);
+ // get button rectangles
+ GetWindowRect(GetDlgItem(hDlg, IDOK), &rcOk);
+ OffsetRect(&rcOk, -mpt.x, -mpt.y + needY - InfoBarHeight);
- GetWindowRect(GetDlgItem(hDlg, IDALL), &rcAll);
- OffsetRect(&rcAll, -mpt.x, -mpt.y + needY - InfoBarHeight);
+ GetWindowRect(GetDlgItem(hDlg, IDALL), &rcAll);
+ OffsetRect(&rcAll, -mpt.x, -mpt.y + needY - InfoBarHeight);
- GetWindowRect(GetDlgItem(hDlg, IDNONE), &rcNone);
- OffsetRect(&rcNone, -mpt.x, -mpt.y + needY - InfoBarHeight);
+ GetWindowRect(GetDlgItem(hDlg, IDNONE), &rcNone);
+ OffsetRect(&rcNone, -mpt.x, -mpt.y + needY - InfoBarHeight);
- GetWindowRect(GetDlgItem(hDlg, IDCANCEL), &rcCancel);
- OffsetRect(&rcCancel, -mpt.x, -mpt.y + needY - InfoBarHeight);
+ GetWindowRect(GetDlgItem(hDlg, IDCANCEL), &rcCancel);
+ OffsetRect(&rcCancel, -mpt.x, -mpt.y + needY - InfoBarHeight);
- okWidth = rcOk.right - rcOk.left;
- allWidth = rcAll.right - rcAll.left;
- noneWidth = rcNone.right - rcNone.left;
- caWidth = rcCancel.right - rcCancel.left;
- dlgMid = (rcDlg.right - rcDlg.left) / 2;
-
- // load button configuration
- switch (MB_TYPE(pMsgBox->uType))
- {
-
- case MB_OK:
- {
- rcOk.left = dlgMid - (okWidth / 2);
- rcOk.right = rcOk.left + okWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- }
- break;
-
- case MB_OKCANCEL:
- {
- retOk = IDRETRY;
- SetDlgItemText(hDlg, IDOK, LPGENT("OK"));
- retCancel = IDCANCEL;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
- rcOk.left = dlgMid - okWidth - 10;
- rcOk.right = rcOk.left + okWidth;
- rcCancel.left = dlgMid + 10;
- rcCancel.right = rcCancel.left + caWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- case MB_RETRYCANCEL:
- {
- retOk = IDRETRY;
- SetDlgItemText(hDlg, IDOK, LPGENT("Retry"));
- retCancel = IDCANCEL;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
- rcOk.left = dlgMid - okWidth - 10;
- rcOk.right = rcOk.left + okWidth;
- rcCancel.left = dlgMid + 10;
- rcCancel.right = rcCancel.left + caWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- case MB_YESNO:
- {
- retOk = IDYES;
- SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
- retCancel = IDNO;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
- rcOk.left = dlgMid - okWidth - 10;
- rcOk.right = rcOk.left + okWidth;
- rcCancel.left = dlgMid + 10;
- rcCancel.right = rcCancel.left + caWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- case MB_ABORTRETRYIGNORE:
- {
- retOk = IDABORT;
- SetDlgItemText(hDlg, IDOK, LPGENT("Abord"));
- retAll = IDABORT;
- SetDlgItemText(hDlg, IDALL, LPGENT("Retry"));
- retCancel = IDCANCEL;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("Ignore"));
- rcAll.left = dlgMid - (allWidth / 2);
- rcAll.right = rcAll.left + allWidth;
- rcOk.left = rcAll.left - okWidth - 5;
- rcOk.right = rcOk.left + okWidth;
- rcCancel.left = rcAll.right + 5;
- rcCancel.right = rcCancel.left + caWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- case MB_YESNOCANCEL:
- {
- retOk = IDYES;
- SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
- retAll = IDNO;
- SetDlgItemText(hDlg, IDALL, LPGENT("No"));
- retCancel = IDCANCEL;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
- rcAll.left = dlgMid - (allWidth / 2);
- rcAll.right = rcAll.left + allWidth;
- rcOk.left = rcAll.left - okWidth - 5;
- rcOk.right = rcOk.left + okWidth;
- rcCancel.left = rcAll.right + 5;
- rcCancel.right = rcCancel.left + caWidth;
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- case MB_YESALLNO:
- {
- retOk = IDYES;
- SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
- retAll = IDALL;
- SetDlgItemText(hDlg, IDALL, LPGENT("All"));
- //retNon = IDNONE;
- SetDlgItemText(hDlg, IDNONE, LPGENT("None"));
- retCancel = IDNO;
- SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
- rcCancel.right = rcDlg.right - rcDlg.left - 10;
- rcCancel.left = rcCancel.right - caWidth;
- rcNone.right = rcCancel.left - 5;
- rcNone.left = rcNone.right - noneWidth;
- rcAll.right = rcNone.left - 5;
- rcAll.left = rcAll.right - allWidth;
- rcOk.right = rcAll.left - 5;
- rcOk.left = rcOk.right - okWidth;
- // show buttons
- ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDNONE), SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
- }
- break;
-
- default:
- {
- rcOk.left = dlgMid - (okWidth / 2);
- rcOk.right = rcOk.left + okWidth;
- }
- }
- // move ok button
- MoveWindow(GetDlgItem(hDlg, IDOK),
- rcOk.left, rcOk.top,
- rcOk.right - rcOk.left, rcOk.bottom - rcOk.top,
- FALSE);
- // move all button
- MoveWindow(GetDlgItem(hDlg, IDALL),
- rcAll.left, rcAll.top,
- rcAll.right - rcAll.left, rcAll.bottom - rcAll.top,
- FALSE);
- // move none button
- MoveWindow(GetDlgItem(hDlg, IDNONE),
- rcNone.left, rcNone.top,
- rcNone.right - rcNone.left, rcNone.bottom - rcNone.top,
- FALSE);
- // move cancel button
- MoveWindow(GetDlgItem(hDlg, IDCANCEL),
- rcCancel.left, rcCancel.top,
- rcCancel.right - rcCancel.left, rcCancel.bottom - rcCancel.top,
- FALSE);
- } // end* Do pushbutton positioning
- } // end* resize the messagebox and reorganize the buttons
+ LONG okWidth = rcOk.right - rcOk.left;
+ LONG allWidth = rcAll.right - rcAll.left;
+ LONG noneWidth = rcNone.right - rcNone.left;
+ LONG caWidth = rcCancel.right - rcCancel.left;
+ LONG dlgMid = (rcDlg.right - rcDlg.left) / 2;
+
+ // load button configuration
+ switch (MB_TYPE(pMsgBox->uType)) {
+ case MB_OK:
+ rcOk.left = dlgMid - (okWidth / 2);
+ rcOk.right = rcOk.left + okWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ break;
+
+ case MB_OKCANCEL:
+ retOk = IDRETRY;
+ SetDlgItemText(hDlg, IDOK, LPGENT("OK"));
+ retCancel = IDCANCEL;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
+ rcOk.left = dlgMid - okWidth - 10;
+ rcOk.right = rcOk.left + okWidth;
+ rcCancel.left = dlgMid + 10;
+ rcCancel.right = rcCancel.left + caWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ case MB_RETRYCANCEL:
+ retOk = IDRETRY;
+ SetDlgItemText(hDlg, IDOK, LPGENT("Retry"));
+ retCancel = IDCANCEL;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
+ rcOk.left = dlgMid - okWidth - 10;
+ rcOk.right = rcOk.left + okWidth;
+ rcCancel.left = dlgMid + 10;
+ rcCancel.right = rcCancel.left + caWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ case MB_YESNO:
+ retOk = IDYES;
+ SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
+ retCancel = IDNO;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
+ rcOk.left = dlgMid - okWidth - 10;
+ rcOk.right = rcOk.left + okWidth;
+ rcCancel.left = dlgMid + 10;
+ rcCancel.right = rcCancel.left + caWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ case MB_ABORTRETRYIGNORE:
+ retOk = IDABORT;
+ SetDlgItemText(hDlg, IDOK, LPGENT("Abord"));
+ retAll = IDABORT;
+ SetDlgItemText(hDlg, IDALL, LPGENT("Retry"));
+ retCancel = IDCANCEL;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("Ignore"));
+ rcAll.left = dlgMid - (allWidth / 2);
+ rcAll.right = rcAll.left + allWidth;
+ rcOk.left = rcAll.left - okWidth - 5;
+ rcOk.right = rcOk.left + okWidth;
+ rcCancel.left = rcAll.right + 5;
+ rcCancel.right = rcCancel.left + caWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ case MB_YESNOCANCEL:
+ retOk = IDYES;
+ SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
+ retAll = IDNO;
+ SetDlgItemText(hDlg, IDALL, LPGENT("No"));
+ retCancel = IDCANCEL;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
+ rcAll.left = dlgMid - (allWidth / 2);
+ rcAll.right = rcAll.left + allWidth;
+ rcOk.left = rcAll.left - okWidth - 5;
+ rcOk.right = rcOk.left + okWidth;
+ rcCancel.left = rcAll.right + 5;
+ rcCancel.right = rcCancel.left + caWidth;
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ case MB_YESALLNO:
+ retOk = IDYES;
+ SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
+ retAll = IDALL;
+ SetDlgItemText(hDlg, IDALL, LPGENT("All"));
+ //retNon = IDNONE;
+ SetDlgItemText(hDlg, IDNONE, LPGENT("None"));
+ retCancel = IDNO;
+ SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
+ rcCancel.right = rcDlg.right - rcDlg.left - 10;
+ rcCancel.left = rcCancel.right - caWidth;
+ rcNone.right = rcCancel.left - 5;
+ rcNone.left = rcNone.right - noneWidth;
+ rcAll.right = rcNone.left - 5;
+ rcAll.left = rcAll.right - allWidth;
+ rcOk.right = rcAll.left - 5;
+ rcOk.left = rcOk.right - okWidth;
+ // show buttons
+ ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDNONE), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
+ break;
+
+ default:
+ rcOk.left = dlgMid - (okWidth / 2);
+ rcOk.right = rcOk.left + okWidth;
+ }
+
+ MoveWindow(GetDlgItem(hDlg, IDOK), rcOk.left, rcOk.top, rcOk.right - rcOk.left, rcOk.bottom - rcOk.top, FALSE);
+ MoveWindow(GetDlgItem(hDlg, IDALL), rcAll.left, rcAll.top, rcAll.right - rcAll.left, rcAll.bottom - rcAll.top, FALSE);
+ MoveWindow(GetDlgItem(hDlg, IDNONE), rcNone.left, rcNone.top, rcNone.right - rcNone.left, rcNone.bottom - rcNone.top, FALSE);
+ MoveWindow(GetDlgItem(hDlg, IDCANCEL), rcCancel.left, rcCancel.top, rcCancel.right - rcCancel.left, rcCancel.bottom - rcCancel.top, FALSE);
+ }
// set text's
SetWindowText(hDlg, pMsgBox->ptszTitle);
@@ -504,61 +420,51 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
TranslateDialogDefault(hDlg);
return TRUE;
- } // end* PtrIsValid(pMsgBox)
- } // end* WM_INITDIALOG:
+ }
+ }
break;
case WM_CTLCOLORSTATIC:
- {
- switch (GetWindowLongPtr((HWND)lParam, GWLP_ID))
- {
- case STATIC_WHITERECT:
- case ICO_DLGLOGO:
- case ICO_MSGDLG:
- case TXT_MESSAGE:
- case TXT_NAME:
- {
- SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
- return GetSysColor(COLOR_WINDOW);
- }
- }
+ switch (GetWindowLongPtr((HWND)lParam, GWLP_ID)) {
+ case STATIC_WHITERECT:
+ case ICO_DLGLOGO:
+ case ICO_MSGDLG:
+ case TXT_MESSAGE:
+ case TXT_NAME:
+ SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+ return GetSysColor(COLOR_WINDOW);
}
break;
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- EndDialog(hDlg, retOk);
- break;
- case IDCANCEL:
- EndDialog(hDlg, retCancel);
- break;
- case IDALL:
- EndDialog(hDlg, retAll);
- break;
- case IDNONE:
- EndDialog(hDlg, retNon);
- }
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ EndDialog(hDlg, retOk);
+ break;
+ case IDCANCEL:
+ EndDialog(hDlg, retCancel);
+ break;
+ case IDALL:
+ EndDialog(hDlg, retAll);
+ break;
+ case IDNONE:
+ EndDialog(hDlg, retNon);
}
break;
case WM_DESTROY:
- {
- DeleteObject((HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0));
- }
+ DeleteObject((HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0));
break;
}
return FALSE;
}
-
/**
- * Dummi modal MsgBox for popup,
- * this set call function in wait stait and do not freece miranda main thread
- * the window is outside the desktop
- */
+* Dummi modal MsgBox for popup,
+* this set call function in wait stait and do not freece miranda main thread
+* the window is outside the desktop
+*/
+
static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
@@ -655,15 +561,16 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
}
/**
- * This is the message procedure for popup
- *
- * @param hDlg - window handle
- * @param uMsg - message to handle
- * @param wParam - message specific parameter
- * @param lParam - message specific parameter
- *
- * @return TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL
- **/
+* This is the message procedure for popup
+*
+* @param hDlg - window handle
+* @param uMsg - message to handle
+* @param wParam - message specific parameter
+* @param lParam - message specific parameter
+*
+* @return TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL
+**/
+
static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
@@ -704,14 +611,15 @@ static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
}
/**
- * This is the service function for external plugins to use the nice messagebox
- *
- * @param wParam - HANDLE hContact which can display an avatar for popups
- * @param lParam - MSGBOX structure holding parameters
- *
- * @return The function returns the ID of the clicked button (IDOK, IDCANCEL, ...)
- * or -1 on error.
- **/
+* This is the service function for external plugins to use the nice messagebox
+*
+* @param wParam - HANDLE hContact which can display an avatar for popups
+* @param lParam - MSGBOX structure holding parameters
+*
+* @return The function returns the ID of the clicked button (IDOK, IDCANCEL, ...)
+* or -1 on error.
+**/
+
INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
{
LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
@@ -732,10 +640,11 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam)
}
/**
- * name: MsgBox
- * desc: calls a messagebox
- * param:
- **/
+* name: MsgBox
+* desc: calls a messagebox
+* param:
+**/
+
INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInfo, LPTSTR pszFormat, ...)
{
TCHAR tszMsg[MAX_SECONDLINE];
@@ -748,7 +657,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInf
MSGBOX mb = {0};
mb.cbSize = sizeof(MSGBOX);
mb.hParent = hParent;
- mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mb.hiLogo = Skin_GetIcon(ICO_COMMON_MAIN);
mb.hiMsg = NULL;
mb.ptszTitle = TranslateTS(pszTitle);
mb.ptszInfoText = TranslateTS(pszInfo);
@@ -758,10 +667,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPTSTR pszTitle, LPTSTR pszInf
}
/**
- * name: MsgErr
- * desc: calls a messagebox
- * param:
- **/
+* name: MsgErr
+* desc: calls a messagebox
+* param:
+**/
+
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
@@ -775,7 +685,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
MSGBOX mb = {0};
mb.cbSize = sizeof(MSGBOX);
mb.hParent = hParent;
- mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mb.hiLogo = Skin_GetIcon(ICO_COMMON_MAIN);
mb.hiMsg = NULL;
mb.ptszTitle = tszTitle;
mb.ptszMsg = tszMsg;
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 79fb013ac6..5b42e8fccc 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -79,21 +79,18 @@ _ignore(10, (LIST<TCHAR>::FTSortFunc)_tcscmp)
CPsHdr::~CPsHdr()
{
- int i;
-
// delete data
- for (i = 0 ; i < _ignore.getCount(); i++)
- {
- if (_ignore[i]) mir_free(_ignore[i]);
- }
+ for (int i = 0 ; i < _ignore.getCount(); i++)
+ mir_free(_ignore[i]);
+
// delete the list
_ignore.destroy();
}
void CPsHdr::Free_pPages()
{
- for ( int i = 0 ; i < _numPages; i++)
- if (_pPages[i]) delete _pPages[i];
+ for (int i = 0; i < _numPages; i++)
+ delete _pPages[i];
_numPages = 0;
MIR_FREE(_pPages);
}
@@ -131,10 +128,9 @@ private:
// check if icq is online
if (!IsProtoOnline((*_pPd)->szModuleName)) {
- TCHAR szMsg[MAX_PATH];
- LPTSTR ptszProto;
+ LPTSTR ptszProto = mir_a2t((*_pPd)->szModuleName);
- ptszProto = mir_a2t((*_pPd)->szModuleName);
+ TCHAR szMsg[MAX_PATH];
mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Protocol '%s' is offline"), ptszProto);
mir_free(ptszProto);
@@ -289,11 +285,10 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam)
return 1;
}
- hDefIcon = IcoLib_GetIcon(ICO_TREE_DEFAULT);
+ hDefIcon = Skin_GetIcon(ICO_TREE_DEFAULT);
if (!hDefIcon)
- {
hDefIcon = (HICON) LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, metrics.x, metrics.y, 0);
- }
+
// add the default icon to imagelist
ImageList_AddIcon(psh._hImages, hDefIcon);
@@ -576,11 +571,10 @@ void DlgContactInfoInitTreeIcons()
metrics.x = GetSystemMetrics(SM_CXSMICON);
metrics.y = GetSystemMetrics(SM_CYSMICON);
if (psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) {
- HICON hDefIcon = IcoLib_GetIcon(ICO_TREE_DEFAULT);
+ HICON hDefIcon = Skin_GetIcon(ICO_TREE_DEFAULT);
if (!hDefIcon)
- {
hDefIcon = (HICON) LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, metrics.x, metrics.y, 0);
- }
+
// add the default icon to imagelist
ImageList_AddIcon(psh._hImages, hDefIcon);
}
@@ -756,7 +750,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
//
// set icons
//
- SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_COMMON_MAIN));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon(ICO_COMMON_MAIN, TRUE));
DlgProc(hDlg, HM_RELOADICONS, NULL, NULL);
//
@@ -1237,12 +1231,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
if (hCtrl = GetDlgItem(hDlg, BTN_IMPORT)) {
- hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
SetWindowText(hCtrl, hIcon ? _T("") : _T("I"));
}
if (hCtrl = GetDlgItem(hDlg, BTN_EXPORT)) {
- hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
SetWindowText(hCtrl, hIcon ? _T("") : _T("E"));
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 1d9bb93b60..d170c6d993 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -187,8 +187,8 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
bImagesLoaded
- = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon))
- && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon)));
+ = ((((hIcon = Skin_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon))
+ && (((hIcon = Skin_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon)));
}
}
// do the translation stuff
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index e483aec7b2..ab1f1bedd9 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -177,18 +177,6 @@ static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack)
}
/**
- * Returns a icon, identified by a name
- *
- * @param pszIcon - name of the icon
- *
- * @return: HICON if the icon is loaded, NULL otherwise
- **/
-HICON IcoLib_GetIcon(LPCSTR pszIcon)
-{
- return (pszIcon) ? Skin_GetIcon(pszIcon) : NULL;
-}
-
-/**
* Set the icon of each control in the list
*
* @param hDlg - handle to the dialog control, that owns the controls
@@ -200,7 +188,7 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon)
void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls)
{
for (int i = 0; i < numCtrls; i++) {
- HICON hIcon = IcoLib_GetIcon(pCtrl[i].pszIcon);
+ HICON hIcon = Skin_GetIcon(pCtrl[i].pszIcon);
if (pCtrl[i].idCtrl) {
HWND hCtrl = GetDlgItem(hDlg, pCtrl[i].idCtrl);
switch (pCtrl[i].Message) {
diff --git a/plugins/UserInfoEx/src/mir_icolib.h b/plugins/UserInfoEx/src/mir_icolib.h
index 0c986ef9fd..cf6a815462 100644
--- a/plugins/UserInfoEx/src/mir_icolib.h
+++ b/plugins/UserInfoEx/src/mir_icolib.h
@@ -130,7 +130,6 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls);
HANDLE IcoLib_RegisterIconHandle(LPSTR szName, LPSTR szDescription, LPSTR szSection, int idIcon, int Size);
HICON IcoLib_RegisterIcon(LPSTR szName, LPSTR szDescription, LPSTR szSection, int idIcon, int Size);
-HICON IcoLib_GetIcon(LPCSTR pszIcon);
void IcoLib_LoadModule();
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index ccb0ddbc08..4ef12757bf 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -100,7 +100,7 @@ void RebuildContact()
//cascade all
mi.position = 1000050000;
mi.popupPosition = 1000050000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
mi.pszName = LPGEN(MODULELONGNAME);
mhRoot = Menu_AddContactMenuItem(&mi);
hMenuItem[item++] = mhRoot;
@@ -110,7 +110,7 @@ void RebuildContact()
//cascade Ex/Import
mi.position = 1000050100;
mi.popupPosition = 1000050100;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
mhExIm = Menu_AddContactMenuItem(&mi);
hMenuItem[item++] = mhExIm;
@@ -128,7 +128,7 @@ void RebuildContact()
mi.pszService = MS_USERINFO_SHOWDIALOG;
mi.pszName = LPGEN("User &details");
mi.position = 1000050000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
mi.hotKey = MAKELPARAM(VK_F3, MOD_ALT);
hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
mi.hotKey = NULL;
@@ -142,14 +142,14 @@ void RebuildContact()
mi.pszService = MS_USERINFO_VCARD_EXPORT;
mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export User Details");
mi.position = 1000050200;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORT;
mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import User Details");
mi.position = 1000050300;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
}
}
@@ -198,7 +198,7 @@ void RebuildMain()
//cascade all
mi.position = 500050000;
mi.popupPosition = 500050000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
mi.pszName = LPGEN(MODULELONGNAME);
mhRoot = Menu_AddMainMenuItem(&mi);
hMenuItem[item++] = mhRoot;
@@ -208,7 +208,7 @@ void RebuildMain()
//cascade Ex/Import
mi.position = 500050000;
mi.popupPosition = 500050000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
mhExIm = Menu_AddMainMenuItem(&mi);
hMenuItem[item++] = mhExIm;
@@ -226,7 +226,7 @@ void RebuildMain()
mi.pszService = MS_USERINFO_SHOWDIALOG;
mi.pszName = LPGEN("View/Change My &Details...");
mi.position = 500050000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
@@ -237,14 +237,14 @@ void RebuildMain()
mi.pszService = MS_USERINFO_VCARD_EXPORTALL;
mi.pszName = LPGEN("Export all contacts");
mi.position = 500150000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORTALL;
mi.pszName = LPGEN("Import all contacts");
mi.position = 500151000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
@@ -260,13 +260,13 @@ void RebuildMain()
mi.pszService = MS_USERINFO_REMINDER_AGGRASIVEBACKUP;
mi.pszName = LPGEN("Backup birthdays");
mi.position = 500253000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_BDAY_BACKUP);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_BDAY_BACKUP);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
// Check anniversaries
mi.pszService = MS_USERINFO_REMINDER_CHECK;
mi.pszName = LPGEN("Check anniversaries");
mi.position = 500251000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_SEARCH);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_SEARCH);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
else {
@@ -277,7 +277,7 @@ void RebuildMain()
mi.pszService = MS_USERINFO_REFRESH;
mi.pszName = LPGEN("Refresh Contact Details");
mi.position = 500254000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_UPDATE);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
@@ -286,7 +286,7 @@ void RebuildMain()
mi.pszService = MS_USERINFO_REMINDER_LIST;
mi.pszName = LPGEN("Anniversary list");
mi.position = 500252000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_ANNIVERSARY);
hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
}
@@ -343,7 +343,7 @@ void RebuildGroup()
//cascade all
mi.position = 250000;
mi.popupPosition = 250000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
mi.pszName = LPGEN(MODULELONGNAME);
mhRoot = Menu_AddGroupMenuItem(0, &mi);
hMenuItem[item++] = mhRoot;
@@ -353,7 +353,7 @@ void RebuildGroup()
//cascade Ex/Import
mi.position = 250100;
mi.popupPosition = 250100;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
mhExIm = Menu_AddGroupMenuItem(0, &mi);
hMenuItem[item++] = mhExIm;
@@ -372,14 +372,14 @@ void RebuildGroup()
mi.pszService = MS_USERINFO_VCARD_EXPORTALL;
mi.pszName = LPGEN("Export all contacts");
mi.position = 250200;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
hMenuItem[item++] = Menu_AddGroupMenuItem(0, &mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORTALL;
mi.pszName = LPGEN("Import all contacts");
mi.position = 250300;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
hMenuItem[item++] = Menu_AddGroupMenuItem(0, &mi);
}
}
@@ -440,7 +440,7 @@ void RebuildSubGroup()
//cascade all
mi.position = 1050000;
mi.popupPosition = 1050000;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
mi.pszName = LPGEN("Extended UserInfo");
mhRoot = Menu_AddSubGroupMenuItem(0, &mi);
hMenuItem[item++] = mhRoot;
@@ -450,7 +450,7 @@ void RebuildSubGroup()
//cascade Ex/Import
mi.position = 1050100;
mi.popupPosition = 1050100;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import Group");
mhExIm = Menu_AddSubGroupMenuItem(0, &mi);
hMenuItem[item++] = mhExIm;
@@ -470,7 +470,7 @@ void RebuildSubGroup()
if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service);
mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export Group");
mi.position = 1050200;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
gmp.lParam=0;
gmp.wParam=TRUE;
hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi);
@@ -480,7 +480,7 @@ void RebuildSubGroup()
if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service);
mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import Group");
mi.position = 1050300;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
gmp.lParam=0;
gmp.wParam=FALSE;
hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi);
@@ -560,36 +560,35 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR|CMIF_KEEPUNTRANSLATED;
mi.hParentMenu = mhRoot;
- switch (flag)
- {
- case 3:
- //cascade off
- mhExIm = mhRoot;
- // seperator
- mi.position = 50100;
- hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
- break;
- case 5:
- //cascade all
- mi.position = 50100;
- mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN);
- mi.ptszName = TranslateT(MODULELONGNAME);
- hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
- mhRoot = hMenuItemAccount[mItems*i + item++];
- mhExIm = mhRoot;
- break;
- case 9:
- //cascade Ex/Import
- mi.position = 50100;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
- mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("Ex-/Import"));
- mi.ptszName = sztName;
- hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
- mhExIm = hMenuItemAccount[mItems*i + item++];
- break;
- default:
- //disable Menue
- return 0;
+ switch (flag) {
+ case 3:
+ //cascade off
+ mhExIm = mhRoot;
+ // seperator
+ mi.position = 50100;
+ hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
+ break;
+ case 5:
+ //cascade all
+ mi.position = 50100;
+ mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN);
+ mi.ptszName = TranslateT(MODULELONGNAME);
+ hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
+ mhRoot = hMenuItemAccount[mItems*i + item++];
+ mhExIm = mhRoot;
+ break;
+ case 9:
+ //cascade Ex/Import
+ mi.position = 50100;
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT);
+ mir_sntprintf(sztName, SIZEOF(sztName), _T("%s %s"), pAccountName->tszAccountName, TranslateT("Ex-/Import"));
+ mi.ptszName = sztName;
+ hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
+ mhExIm = hMenuItemAccount[mItems*i + item++];
+ break;
+ default:
+ //disable Menue
+ return 0;
}
// VCard's Ex/Import menuitems
@@ -602,7 +601,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Export"));
mi.ptszName = sztName;
mi.position = 50200;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT);
hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
// Import
@@ -611,7 +610,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Import"));
mi.ptszName = sztName;
mi.position = 50300;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT);
hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
}
}
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp
index 8fea511a2a..d27ce5f7a0 100644
--- a/plugins/UserInfoEx/src/psp_anniversary.cpp
+++ b/plugins/UserInfoEx/src/psp_anniversary.cpp
@@ -33,82 +33,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**/
static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ MAnnivDate* pDlgEditAnniv = (MAnnivDate*)GetUserData(hDlg);
+
+ switch (uMsg) {
case WM_INITDIALOG:
- {
- MAnnivDate* pDlgEditAnniv = (MAnnivDate*)lParam;
+ pDlgEditAnniv = (MAnnivDate*)lParam;
+ if (!PtrIsValid(pDlgEditAnniv))
+ break;
- if (!PtrIsValid(pDlgEditAnniv))
- break;
- SetUserData(hDlg, lParam);
+ SetUserData(hDlg, lParam);
- // set icons
- if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1))
- {
- SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
- SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
- }
- SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY));
+ // set icons
+ if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) {
+ SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_OK));
+ SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_BTN_CANCEL));
+ }
+ SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)Skin_GetIcon(ICO_DLG_ANNIVERSARY, TRUE));
- // translate controls
- SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL);
- SendDlgItemMessage(hDlg, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
- TranslateDialogDefault(hDlg);
+ // translate controls
+ SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL);
+ SendDlgItemMessage(hDlg, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
+ TranslateDialogDefault(hDlg);
- // init controls
- EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), pDlgEditAnniv->Id() != ANID_BIRTHDAY);
- SetDlgItemText(hDlg, EDIT_CATEGORY, pDlgEditAnniv->Description());
- return TRUE;
- }
+ // init controls
+ EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), pDlgEditAnniv->Id() != ANID_BIRTHDAY);
+ SetDlgItemText(hDlg, EDIT_CATEGORY, pDlgEditAnniv->Description());
+ return TRUE;
case WM_CTLCOLORSTATIC:
- {
- SetBkColor((HDC)wParam, RGB(255, 255, 255));
- }
+ SetBkColor((HDC)wParam, RGB(255, 255, 255));
return (INT_PTR)GetStockObject(WHITE_BRUSH);
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam)) {
+ case EDIT_CATEGORY:
+ if (HIWORD(wParam) == EN_UPDATE)
+ EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength((HWND)lParam) > 0);
+ break;
+
+ case IDCANCEL:
+ return EndDialog(hDlg, LOWORD(wParam));
+
+ case IDOK:
+ // read new description
+ HWND hEdit = GetDlgItem(hDlg, EDIT_CATEGORY);
+ int len = Edit_GetTextLength(hEdit);
+ LPTSTR pszText;
+
+ if (len == 0 ||
+ (pszText = (LPTSTR)_alloca((len + 1) * sizeof(TCHAR))) == NULL ||
+ !Edit_GetText(hEdit, pszText, len + 1))
{
- case EDIT_CATEGORY:
- {
- if (HIWORD(wParam) == EN_UPDATE)
- {
- EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength((HWND)lParam) > 0);
- }
- }
+ MsgErr(hDlg, LPGENT("Please enter a valid Description first!"));
break;
+ }
- case IDOK:
- {
- MAnnivDate* pDlgEditAnniv = (MAnnivDate*)GetUserData(hDlg);
-
- // read new description
- {
- HWND hEdit = GetDlgItem(hDlg, EDIT_CATEGORY);
- int len = Edit_GetTextLength(hEdit);
- LPTSTR pszText;
-
- if (
- len == 0 ||
- (pszText = (LPTSTR)_alloca((len + 1) * sizeof(TCHAR))) == NULL ||
- !Edit_GetText(hEdit, pszText, len + 1)
- )
- {
- MsgErr(hDlg, LPGENT("Please enter a valid Description first!"));
- break;
- }
-
- if (_tcsicmp(pszText, pDlgEditAnniv->Description())) {
- pDlgEditAnniv->Description(pszText);
- pDlgEditAnniv->SetFlags(MAnnivDate::MADF_HASCUSTOM|MAnnivDate::MADF_CHANGED);
- }
- }
- }
- case IDCANCEL:
- return EndDialog(hDlg, LOWORD(wParam));
+ if (_tcsicmp(pszText, pDlgEditAnniv->Description())) {
+ pDlgEditAnniv->Description(pszText);
+ pDlgEditAnniv->SetFlags(MAnnivDate::MADF_HASCUSTOM | MAnnivDate::MADF_CHANGED);
}
}
}
@@ -116,32 +98,33 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w
}
/**
- * Dialog procedure for the anniversary propertysheetpage
- *
- * @param hDlg - handle to the dialog window
- * @param uMsg - the message to handle
- * @param wParam - parameter
- * @param lParam - parameter
- *
- * @return different values
- **/
+* Dialog procedure for the anniversary propertysheetpage
+*
+* @param hDlg - handle to the dialog window
+* @param uMsg - the message to handle
+* @param wParam - parameter
+* @param lParam - parameter
+*
+* @return different values
+**/
+
INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
+ CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
+
+ switch (uMsg) {
case WM_INITDIALOG:
{
CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg);
- if (pCtrlList)
- {
+ if (pCtrlList) {
HFONT hBoldFont;
PSGetBoldFont(hDlg, hBoldFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
TranslateDialogDefault(hDlg);
- pCtrlList->insert(CEditCtrl::CreateObj (hDlg, EDIT_AGE, SET_CONTACT_AGE, DBVT_BYTE));
- pCtrlList->insert(CAnnivEditCtrl::CreateObj (hDlg, EDIT_ANNIVERSARY_DATE, NULL));
+ pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_AGE, SET_CONTACT_AGE, DBVT_BYTE));
+ pCtrlList->insert(CAnnivEditCtrl::CreateObj(hDlg, EDIT_ANNIVERSARY_DATE, NULL));
// hContact == NULL or reminder disabled
CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE)->EnableReminderCtrl(lParam != NULL);
@@ -153,182 +136,121 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
break;
case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_ICONCHANGED:
- {
- const ICONCTRL idIcon[] = {
- { ICO_COMMON_BIRTHDAY, STM_SETIMAGE, ICO_BIRTHDAY },
- { ICO_BTN_ADD, BM_SETIMAGE, BTN_ADD },
- { ICO_BTN_DELETE, BM_SETIMAGE, BTN_DELETE }
- };
- IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon));
- }
- return FALSE;
- }
- }
- break; /* case 0 */
-
- case EDIT_ANNIVERSARY_DATE:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_ICONCHANGED:
{
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (!PspIsLocked(hDlg) && PtrIsValid(pDateCtrl))
- {
- LPNMHDR lpNmhdr = (LPNMHDR)lParam;
-
- switch (lpNmhdr->code)
- {
- case DTN_DATETIMECHANGE:
- {
- pDateCtrl->OnDateChanged((LPNMDATETIMECHANGE) lParam);
- }
- break;
- case DTN_DROPDOWN:
- {
- HWND hMonthCal = DateTime_GetMonthCal(lpNmhdr->hwndFrom);
- SetWindowLongPtr(hMonthCal, GWL_STYLE, GetWindowLongPtr(hMonthCal, GWL_STYLE)|MCS_WEEKNUMBERS);
- InvalidateRect(hMonthCal, NULL, TRUE);
- }
- }
- }
+ const ICONCTRL idIcon[] = {
+ { ICO_COMMON_BIRTHDAY, STM_SETIMAGE, ICO_BIRTHDAY },
+ { ICO_BTN_ADD, BM_SETIMAGE, BTN_ADD },
+ { ICO_BTN_DELETE, BM_SETIMAGE, BTN_DELETE }
+ };
+ IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon));
}
return FALSE;
- } /* switch (((LPNMHDR)lParam)->idFrom) */
+ }
+ break; /* case 0 */
+
+ case EDIT_ANNIVERSARY_DATE:
+ if (!PspIsLocked(hDlg) && PtrIsValid(pDateCtrl)) {
+ LPNMHDR lpNmhdr = (LPNMHDR)lParam;
+ switch (lpNmhdr->code) {
+ case DTN_DATETIMECHANGE:
+ pDateCtrl->OnDateChanged((LPNMDATETIMECHANGE)lParam);
+ break;
+ case DTN_DROPDOWN:
+ HWND hMonthCal = DateTime_GetMonthCal(lpNmhdr->hwndFrom);
+ SetWindowLongPtr(hMonthCal, GWL_STYLE, GetWindowLongPtr(hMonthCal, GWL_STYLE) | MCS_WEEKNUMBERS);
+ InvalidateRect(hMonthCal, NULL, TRUE);
+ }
+ }
+ return FALSE;
}
break;
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case EDIT_REMIND:
- {
- if (!PspIsLocked(hDlg) && HIWORD(wParam) == EN_UPDATE)
- {
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (PtrIsValid(pDateCtrl))
- {
- pDateCtrl->OnRemindEditChanged();
- }
- }
- }
- return FALSE;
-
- /**
- * name: BTN_MENU
- * desc: the button to dropdown the list to show all items is pressed
- **/
- case BTN_MENU:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (PtrIsValid(pDateCtrl))
- {
- pDateCtrl->OnMenuPopup();
- }
- }
- }
- return FALSE;
-
- /**
- * name: BTN_ADD
- * desc: creates a new dialog to add a new anniversary
- **/
- case BTN_ADD:
- {
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl))
- {
- MAnnivDate Date;
- if (IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date))
- {
- SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
- if (!pDateCtrl->AddDate(Date))
- {
- pDateCtrl->SetCurSel(pDateCtrl->NumDates() - 1);
- }
- }
- }
- }
- return FALSE;
-
- /**
- * name: BTN_EDIT
- * desc: edit the currently selected anniversary
- **/
- case BTN_EDIT:
- {
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl))
- {
- MAnnivDate *pDate = pDateCtrl->Current();
-
- if (!pDate)
- {
- MsgErr(hDlg, LPGENT("No valid date selected for editing!"));
- }
- else if (
- IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate)&&
- (pDate->Flags() & (MAnnivDate::MADF_CHANGED|MAnnivDate::MADF_REMINDER_CHANGED))
- )
- {
- SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
- pDateCtrl->SetCurSel(pDateCtrl->CurrentIndex());
- }
- }
+ switch (LOWORD(wParam)) {
+ case EDIT_REMIND:
+ if (!PspIsLocked(hDlg) && HIWORD(wParam) == EN_UPDATE)
+ if (PtrIsValid(pDateCtrl))
+ pDateCtrl->OnRemindEditChanged();
+ return FALSE;
+
+ /**
+ * name: BTN_MENU
+ * desc: the button to dropdown the list to show all items is pressed
+ **/
+ case BTN_MENU:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ if (PtrIsValid(pDateCtrl))
+ pDateCtrl->OnMenuPopup();
+ }
+ return FALSE;
+
+ /**
+ * name: BTN_ADD
+ * desc: creates a new dialog to add a new anniversary
+ **/
+ case BTN_ADD:
+ if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) {
+ MAnnivDate Date;
+ if (IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date)) {
+ SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
+ if (!pDateCtrl->AddDate(Date))
+ pDateCtrl->SetCurSel(pDateCtrl->NumDates() - 1);
}
- return FALSE;
-
- /**
- * name: BTN_DELETE
- * desc: user wants to delete an anniversary
- **/
- case BTN_DELETE:
+ }
+ return FALSE;
+
+ /**
+ * name: BTN_EDIT
+ * desc: edit the currently selected anniversary
+ **/
+ case BTN_EDIT:
+ if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) {
+ MAnnivDate *pDate = pDateCtrl->Current();
+ if (!pDate)
+ MsgErr(hDlg, LPGENT("No valid date selected for editing!"));
+ else if (
+ IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate) &&
+ (pDate->Flags() & (MAnnivDate::MADF_CHANGED | MAnnivDate::MADF_REMINDER_CHANGED)))
{
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl))
- {
- MAnnivDate *pCurrent;
-
- pCurrent = pDateCtrl->Current();
- if (pCurrent)
- {
- int rc = MsgBox(hDlg, MB_YESNO|MB_ICON_QUESTION|MB_NOPOPUP, LPGENT("Delete"), NULL,
- LPGENT("Do you really want to delete the %s?"), pCurrent->Description());
-
- if (rc == IDYES)
- {
- pDateCtrl->DeleteDate(pDateCtrl->CurrentIndex());
- }
- }
- }
+ SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
+ pDateCtrl->SetCurSel(pDateCtrl->CurrentIndex());
}
- return FALSE;
-
- /**
- * name: CHECK_REMIND
- * desc: state of reminder checkbox is changed
- **/
- case RADIO_REMIND1:
- case RADIO_REMIND2:
- case RADIO_REMIND3:
- {
- CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
- if (PtrIsValid(pDateCtrl) && HIWORD(wParam) == BN_CLICKED)
- {
- pDateCtrl->OnReminderChecked();
- }
+ }
+ return FALSE;
+
+ /**
+ * name: BTN_DELETE
+ * desc: user wants to delete an anniversary
+ **/
+ case BTN_DELETE:
+ if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) {
+ MAnnivDate *pCurrent = pDateCtrl->Current();
+ if (pCurrent) {
+ int rc = MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP, LPGENT("Delete"), NULL,
+ LPGENT("Do you really want to delete the %s?"), pCurrent->Description());
+
+ if (rc == IDYES)
+ pDateCtrl->DeleteDate(pDateCtrl->CurrentIndex());
}
- return FALSE;
-
- } /* switch (LOWORD(wParam)) */
- }
+ }
+ return FALSE;
+
+ /**
+ * name: CHECK_REMIND
+ * desc: state of reminder checkbox is changed
+ **/
+ case RADIO_REMIND1:
+ case RADIO_REMIND2:
+ case RADIO_REMIND3:
+ CAnnivEditCtrl *pDateCtrl = CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE);
+ if (PtrIsValid(pDateCtrl) && HIWORD(wParam) == BN_CLICKED)
+ pDateCtrl->OnReminderChecked();
+ return FALSE;
+ } /* switch (LOWORD(wParam)) */
break;
}
return PSPBaseProc(hDlg, uMsg, wParam, lParam);
diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp
index 9254fd392f..09f0604ba3 100644
--- a/plugins/UserInfoEx/src/psp_contact.cpp
+++ b/plugins/UserInfoEx/src/psp_contact.cpp
@@ -127,13 +127,11 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
case PSN_ICONCHANGED:
{
- HICON hIcon;
-
- hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
+ HICON hIcon = Skin_GetIcon(ICO_BTN_GOTO);
SendDlgItemMessage(hDlg, BTN_GOTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
SetDlgItemText(hDlg, BTN_GOTO, hIcon ? _T("") : _T("->"));
- hIcon = IcoLib_GetIcon(ICO_COMMON_ADDRESS);
+ hIcon = Skin_GetIcon(ICO_COMMON_ADDRESS);
SendDlgItemMessage(hDlg, ICO_ADDRESS, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
ShowWindow(GetDlgItem(hDlg, ICO_ADDRESS), hIcon ? SW_SHOW : SW_HIDE);
@@ -282,13 +280,11 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
case PSN_ICONCHANGED:
{
- HICON hIcon;
-
- hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
+ HICON hIcon = Skin_GetIcon(ICO_BTN_GOTO);
SendDlgItemMessage(hDlg, BTN_GOTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
SetDlgItemText(hDlg, BTN_GOTO, hIcon ? _T("") : _T("->"));
- hIcon = IcoLib_GetIcon(ICO_COMMON_ADDRESS);
+ hIcon = Skin_GetIcon(ICO_COMMON_ADDRESS);
SendDlgItemMessage(hDlg, ICO_ADDRESS, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
ShowWindow(GetDlgItem(hDlg, ICO_ADDRESS), hIcon ? SW_SHOW : SW_HIDE);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index b4267d85f0..92eb77a5c6 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -623,7 +623,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
{
ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), myGlobals.UseDbxTree ? SW_HIDE : SW_SHOW);
- SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY));
+ SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_DLG_ANNIVERSARY, TRUE));
// set colours
SendDlgItemMessage(hDlg, EDIT_REMIND, EM_LIMITTEXT, 2, 0);
@@ -930,7 +930,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// Birthday
mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
+ ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTB0);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -943,7 +943,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// Anniversary
mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
- ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
+ ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTAX);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 334b60bb49..9fae47b727 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -185,7 +185,7 @@ void SvcEMailRebuildMenu()
// insert contact menuitem
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000010000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_EMAIL);
mi.pszName = "&E-mail";
mi.pszService = MS_EMAIL_SENDEMAIL;
ghMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp
index 4f411a55d5..abc25bfdce 100644
--- a/plugins/UserInfoEx/src/svc_homepage.cpp
+++ b/plugins/UserInfoEx/src/svc_homepage.cpp
@@ -155,7 +155,7 @@ void SvcHomepageRebuildMenu()
// insert contact menuitem
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000010000;
- mi.hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
+ mi.hIcon = Skin_GetIcon(ICO_BTN_GOTO);
mi.pszName = LPGEN("&Homepage");
mi.pszService = MS_USERINFO_HOMEPAGE_OPENURL;
ghMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 905594a589..0b83a036cb 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -401,7 +401,7 @@ public:
_popupButtons[0].cbSize = sizeof(POPUPACTION);
_popupButtons[0].flags = PAF_ENABLED;
- _popupButtons[0].lchIcon = IcoLib_GetIcon(ICO_BTN_DOWNARROW);
+ _popupButtons[0].lchIcon = Skin_GetIcon(ICO_BTN_DOWNARROW);
_popupButtons[0].wParam = MAKEWORD(IDSKIP, BN_CLICKED);
_popupButtons[0].lParam = NULL;
strcpy(_popupButtons[0].lpzTitle, MODNAME"/Hide");
@@ -409,7 +409,7 @@ public:
// cancel button
_popupButtons[1].cbSize = sizeof(POPUPACTION);
_popupButtons[1].flags = PAF_ENABLED;
- _popupButtons[1].lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
+ _popupButtons[1].lchIcon = Skin_GetIcon(ICO_BTN_CANCEL);
_popupButtons[1].wParam = MAKEWORD(IDCANCEL, BN_CLICKED);
_popupButtons[1].lParam = NULL;
strcpy(_popupButtons[1].lpzTitle, MODNAME"/Cancel");
@@ -423,7 +423,7 @@ public:
{
POPUPDATAT_V2 pd = { 0 };
pd.cbSize = sizeof(pd);
- pd.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
+ pd.lchIcon = Skin_GetIcon(ICO_BTN_UPDATE);
pd.iSeconds = -1;
pd.PluginData = this;
pd.PluginWindowProc = CPopupUpdProgress::WndProc;
@@ -613,7 +613,7 @@ class CContactUpdater : public CContactQueue
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME|CMIM_ICON;
clmi.pszName = LPGEN("Refresh Contact Details");
- clmi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
+ clmi.hIcon = Skin_GetIcon(ICO_BTN_UPDATE);
Menu_ModifyItem(hMenuItemRefresh, &clmi);
}
}
@@ -733,7 +733,7 @@ public:
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME|CMIM_ICON;
clmi.pszName = LPGEN("Abort Refreshing Contact Details");
- clmi.hIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
+ clmi.hIcon = Skin_GetIcon(ICO_BTN_CANCEL);
Menu_ModifyItem(hMenuItemRefresh, &clmi);
}
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index ee03c1a221..e0dd88f83e 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -146,19 +146,19 @@ static HICON GetAnnivIcon(const CEvent &evt)
switch (evt._eType) {
case CEvent::BIRTHDAY:
if (evt._wDaysLeft > 9)
- hIcon = IcoLib_GetIcon(ICO_RMD_DTBX);
+ hIcon = Skin_GetIcon(ICO_RMD_DTBX);
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
- hIcon = IcoLib_GetIcon(szIcon);
+ hIcon = Skin_GetIcon(szIcon);
}
break;
case CEvent::ANNIVERSARY:
if (evt._wDaysLeft > 9)
- hIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
+ hIcon = Skin_GetIcon(ICO_RMD_DTAX);
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
- hIcon = IcoLib_GetIcon(szIcon);
+ hIcon = Skin_GetIcon(szIcon);
}
}
return hIcon;
@@ -319,12 +319,12 @@ static void NotifyFlashCListIcon(HANDLE hContact, const CEvent &evt)
switch (evt._eType) {
case CEvent::BIRTHDAY:
mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("Birthday"));
- cle.hIcon = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY);
+ cle.hIcon = Skin_GetIcon(ICO_COMMON_BIRTHDAY);
break;
case CEvent::ANNIVERSARY:
mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("an anniversary"));
- cle.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY);
+ cle.hIcon = Skin_GetIcon(ICO_COMMON_ANNIVERSARY);
break;
default:
@@ -747,7 +747,7 @@ static INT_PTR BackupBirthdayService(WPARAM wParam, LPARAM lParam)
MSGBOX mBox;
mBox.cbSize = sizeof(MSGBOX);
mBox.hParent = NULL;
- mBox.hiLogo = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY);
+ mBox.hiLogo = Skin_GetIcon(ICO_COMMON_BIRTHDAY);
mBox.uType = MB_ICON_INFO;
mBox.ptszTitle = TranslateT("Update custom birthday");
mBox.ptszMsg = TranslateT("Backing up and syncing all birthdays complete!");