From 2bf82f155a0e98e6ab6c31a01315582f57bc9aa8 Mon Sep 17 00:00:00 2001 From: slotwin Date: Thu, 12 Jun 2014 20:43:30 +0000 Subject: UserInfoEx: rearranged option pages (changed options and icons group name to make it more descriptive, changes some other titles) proper capitalization code cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@9447 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/ctrl_annivedit.cpp | 1 - plugins/UserInfoEx/src/ctrl_contact.cpp | 12 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 717 +++++++++++-------------- plugins/UserInfoEx/src/dlg_msgbox.cpp | 87 ++- plugins/UserInfoEx/src/dlg_propsheet.cpp | 304 +++++------ plugins/UserInfoEx/src/init.cpp | 9 +- plugins/UserInfoEx/src/mir_icolib.cpp | 75 ++- plugins/UserInfoEx/src/mir_icolib.h | 12 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 30 +- plugins/UserInfoEx/src/psp_about.cpp | 34 +- plugins/UserInfoEx/src/psp_anniversary.cpp | 12 +- plugins/UserInfoEx/src/psp_base.cpp | 21 +- plugins/UserInfoEx/src/psp_company.cpp | 22 +- plugins/UserInfoEx/src/psp_contact.cpp | 95 ++-- plugins/UserInfoEx/src/psp_general.cpp | 77 ++- plugins/UserInfoEx/src/psp_options.cpp | 131 ++--- plugins/UserInfoEx/src/psp_origin.cpp | 52 +- plugins/UserInfoEx/src/psp_profile.cpp | 512 +++++++++--------- plugins/UserInfoEx/src/resource.h | 2 +- plugins/UserInfoEx/src/svc_constants.h | 2 +- 20 files changed, 984 insertions(+), 1223 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index f71a0ff047..181c6ed7ed 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -621,4 +621,3 @@ void CAnnivEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) DBWriteBirthDay(hContact); DBWriteAnniversaries(hContact); } - diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 7739fc9bf0..110a40f80e 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -158,7 +158,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM } if (*cbi->pszVal) - SetWindowText(hDlg, LPGENT("Edit E-Mail")); + 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); @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam GetWindowText(hBtn, szButton, MAX_PATH); SetWindowText(hBtn, TranslateTS(szButton)); } - if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit Phone Number")); + if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit phone number")); if (cbi->wFlags & CBEXIF_SMS) CheckDlgButton(hDlg, CHECK_SMS, BST_CHECKED); TranslateDialogDefault(hDlg); @@ -524,10 +524,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L 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); + 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; diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 745a82caa7..b62aee6d93 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -41,21 +41,21 @@ static CAnnivList *gpDlg = NULL; class CAnnivList { - HWND _hDlg; - HWND _hList; - SIZE _sizeMin; - RECT _rcWin; - SHORT _sortOrder; - int _sortHeader; - int _curSel; - int _numRows; - BYTE _bRemindEnable; - HANDLE _mHookExit; - bool _wmINIT; - - typedef int (CALLBACK* CMPPROC)(LPARAM, LPARAM LPARAM); - - enum EColumn + HWND _hDlg; + HWND _hList; + SIZE _sizeMin; + RECT _rcWin; + SHORT _sortOrder; + int _sortHeader; + int _curSel; + int _numRows; + BYTE _bRemindEnable; + HANDLE _mHookExit; + bool _wmINIT; + + typedef int (CALLBACK* CMPPROC)(LPARAM, LPARAM LPARAM); + + enum EColumn { COLUMN_ETA = 0, COLUMN_CONTACT, @@ -65,7 +65,7 @@ class CAnnivList COLUMN_DATE, }; - enum EFilter + enum EFilter { FILTER_ALL = 0, FILTER_BIRTHDAY, @@ -73,14 +73,14 @@ class CAnnivList FILTER_DISABLED_REMINDER }; - struct CFilter + struct CFilter { WORD wDaysBefore; BYTE bFilterIndex; LPSTR pszProto; LPTSTR pszAnniv; - CFilter() + CFilter() { wDaysBefore = (WORD)-1; bFilterIndex = 0; @@ -89,14 +89,14 @@ class CAnnivList } } _filter; - struct CItemData + struct CItemData { MCONTACT _hContact; - MAnnivDate* _pDate; + MAnnivDate *_pDate; WORD _wDaysBefore; BYTE _wReminderState; - CItemData(MCONTACT hContact, MAnnivDate &date) + CItemData(MCONTACT hContact, MAnnivDate &date) { _hContact = hContact; _wReminderState = date.RemindOption(); @@ -104,13 +104,11 @@ class CAnnivList _pDate = new MAnnivDate(date); } - ~CItemData() + ~CItemData() { - if (_pDate) - { + if (_pDate) { // save changes - if (_wReminderState != _pDate->RemindOption() || _wDaysBefore != _pDate->RemindOffset()) - { + if (_wReminderState != _pDate->RemindOption() || _wDaysBefore != _pDate->RemindOffset()) { _pDate->RemindOffset(_wDaysBefore); _pDate->RemindOption(_wReminderState); _pDate->DBWriteReminderOpts(_hContact); @@ -121,10 +119,8 @@ class CAnnivList } }; - /** - * This class handles the movement of child controls on size change. - **/ - class CAnchor + // This class handles the movement of child controls on size change. + class CAnchor { public: enum EAnchor @@ -137,89 +133,75 @@ class CAnnivList }; private: - WINDOWPOS* _wndPos; + WINDOWPOS *_wndPos; HDWP _hdWnds; RECT _rcParent; - void _ScreenToClient(HWND hWnd, LPRECT rc) + void _ScreenToClient(HWND hWnd, LPRECT rc) { POINT pt = { rc->left, rc->top }; ScreenToClient(hWnd, &pt); rc->right += pt.x - rc->left; rc->bottom += pt.y - rc->top; - rc->left = pt.x; - rc->top = pt.y; + rc->left = pt.x; + rc->top = pt.y; } - void _MoveWindow(HWND hWnd, int anchors) + void _MoveWindow(HWND hWnd, int anchors) { - if (!(_wndPos->flags & SWP_NOSIZE)) - { + if (!(_wndPos->flags & SWP_NOSIZE)) { RECT rcc = _CalcPos(hWnd, anchors); MoveWindow(hWnd, rcc.left, rcc.top, rcc.right - rcc.left, rcc.bottom - rcc.top, FALSE); } } - RECT _CalcPos(HWND hWnd, int anchors) + RECT _CalcPos(HWND hWnd, int anchors) { RECT rcc; GetWindowRect(hWnd, &rcc); _ScreenToClient(_wndPos->hwnd, &rcc); - if (!(_wndPos->flags & SWP_NOSIZE)) - { + if (!(_wndPos->flags & SWP_NOSIZE)) { // calculate difference between new and old size const int cx = _wndPos->cx - _rcParent.right + _rcParent.left; const int cy = _wndPos->cy - _rcParent.bottom + _rcParent.top; - if (cx != 0 || cy != 0) - { + if (cx != 0 || cy != 0) { // move client rect points to the desired new position if (!(anchors & ANCHOR_LEFT) || (anchors & ANCHOR_RIGHT)) - { rcc.right += cx; - } if (!(anchors & ANCHOR_TOP) || (anchors & ANCHOR_BOTTOM)) - { rcc.bottom += cy; - } if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT))) - { rcc.left += cx; - } if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP))) - { rcc.top += cy; - } } } return rcc; } public: - CAnchor(WINDOWPOS* wndPos, SIZE minSize) + CAnchor(WINDOWPOS *wndPos, SIZE minSize) { GetWindowRect(wndPos->hwnd, &_rcParent); - if (wndPos->cx < minSize.cx) { + if (wndPos->cx < minSize.cx) wndPos->cx = minSize.cx; - } - if (wndPos->cy < minSize.cy) { + if (wndPos->cy < minSize.cy) wndPos->cy = minSize.cy; - } _wndPos = wndPos; _hdWnds = BeginDeferWindowPos(2); } - ~CAnchor() + ~CAnchor() { EndDeferWindowPos(_hdWnds); } - void MoveCtrl(WORD idCtrl, int anchors) + void MoveCtrl(WORD idCtrl, int anchors) { - if (!(_wndPos->flags & SWP_NOSIZE)) - { + if (!(_wndPos->flags & SWP_NOSIZE)) { HWND hCtrl = GetDlgItem(_wndPos->hwnd, idCtrl); RECT rcc = _CalcPos(hCtrl, anchors); _hdWnds = DeferWindowPos( @@ -228,7 +210,7 @@ class CAnnivList HWND_NOTOPMOST, //hWndInsertAfter rcc.left, //int x rcc.top, //int y - rcc.right - rcc.left, + rcc.right - rcc.left, rcc.bottom - rcc.top, SWP_NOZORDER //UINT uFlags ); @@ -245,7 +227,7 @@ class CAnnivList * * @return This function returns a number indicating comparison result. **/ - static int CALLBACK cmpProc(int iItem1, int iItem2, CAnnivList* pDlg) + static int CALLBACK cmpProc(int iItem1, int iItem2, CAnnivList *pDlg) { int result; @@ -255,42 +237,36 @@ class CAnnivList szText1[0] = szText2[0] = 0; switch (pDlg->_sortHeader) { - case COLUMN_CONTACT: - case COLUMN_PROTO: - case COLUMN_DESC: - { - ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, MAX_PATH); - ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, MAX_PATH); - result = pDlg->_sortOrder * mir_tcscmp(szText1, szText2); - } break; - - case COLUMN_AGE: - case COLUMN_ETA: - { - ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, MAX_PATH); - ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, MAX_PATH); - result = pDlg->_sortOrder * (_ttoi(szText1) - _ttoi(szText2)); - } break; - - case COLUMN_DATE: - { - CItemData *id1 = pDlg->ItemData(iItem1), - *id2 = pDlg->ItemData(iItem2); + case COLUMN_CONTACT: + case COLUMN_PROTO: + case COLUMN_DESC: + ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, MAX_PATH); + ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, MAX_PATH); + result = pDlg->_sortOrder * mir_tcscmp(szText1, szText2); + break; + + case COLUMN_AGE: + case COLUMN_ETA: + ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, MAX_PATH); + ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, MAX_PATH); + result = pDlg->_sortOrder * (_ttoi(szText1) - _ttoi(szText2)); + break; + + case COLUMN_DATE: + { + CItemData *id1 = pDlg->ItemData(iItem1), *id2 = pDlg->ItemData(iItem2); - if (PtrIsValid(id1) && PtrIsValid(id2)) { - result = pDlg->_sortOrder * id1->_pDate->Compare(*id2->_pDate); - break; - } - } - default: - { - result = 0; + if (PtrIsValid(id1) && PtrIsValid(id2)) { + result = pDlg->_sortOrder * id1->_pDate->Compare(*id2->_pDate); + break; } + } + default: + result = 0; } } - else { + else result = 0; - } return result; } @@ -304,12 +280,11 @@ class CAnnivList * * @return depends on message **/ - static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) + static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - CAnnivList *pDlg = (CAnnivList*)GetUserData(hDlg); + CAnnivList *pDlg = (CAnnivList *)GetUserData(hDlg); - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { int i = 0; @@ -318,18 +293,16 @@ class CAnnivList RECT rc; // link the class to the window handle - pDlg = (CAnnivList*)lParam; - if (!pDlg) { + pDlg = (CAnnivList *)lParam; + if (!pDlg) break; - } SetUserData(hDlg, lParam); pDlg->_hDlg = hDlg; // init pointer listview control pDlg->_hList = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE); - if (!pDlg->_hList) { + if (!pDlg->_hList) break; - } // set icons hIcon = Skin_GetIcon(ICO_DLG_ANNIVERSARY); @@ -340,15 +313,13 @@ class CAnnivList ListView_SetExtendedListViewStyle(pDlg->_hList, LVS_EX_FULLROWSELECT); // add columns - if (pDlg->AddColumn(CAnnivList::COLUMN_ETA, LPGENT("ETA"), 40) || - pDlg->AddColumn(CAnnivList::COLUMN_CONTACT, LPGENT("Contact"), 160) || - pDlg->AddColumn(CAnnivList::COLUMN_PROTO, LPGENT("Proto"), 50) || - pDlg->AddColumn(CAnnivList::COLUMN_AGE, LPGENT("Age/Nr."), 40) || - pDlg->AddColumn(CAnnivList::COLUMN_DESC, LPGENT("Anniversary"), 100) || - pDlg->AddColumn(CAnnivList::COLUMN_DATE, LPGENT("Date"), 80)) - { + if (pDlg->AddColumn(CAnnivList::COLUMN_ETA, LPGENT("ETA"), 40) + || pDlg->AddColumn(CAnnivList::COLUMN_CONTACT, LPGENT("Contact"), 160) + || pDlg->AddColumn(CAnnivList::COLUMN_PROTO, LPGENT("Proto"), 50) + || pDlg->AddColumn(CAnnivList::COLUMN_AGE, LPGENT("Age/Nr."), 40) + || pDlg->AddColumn(CAnnivList::COLUMN_DESC, LPGENT("Anniversary"), 100) + || pDlg->AddColumn(CAnnivList::COLUMN_DATE, LPGENT("Date"), 80)) break; - } TranslateDialogDefault(hDlg); @@ -381,7 +352,7 @@ class CAnnivList CheckDlgButton(hDlg, CHECK_POPUP, db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE)); // set number of days to show contact in advance - SetDlgItemInt(hDlg, EDIT_DAYS, pDlg->_filter.wDaysBefore , FALSE); + SetDlgItemInt(hDlg, EDIT_DAYS, pDlg->_filter.wDaysBefore, FALSE); if (hCtrl = GetDlgItem(hDlg, CHECK_DAYS)) { Button_SetCheck(hCtrl, db_get_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE)); DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_DAYS, BN_CLICKED), (LPARAM)hCtrl); @@ -391,9 +362,7 @@ class CAnnivList } return TRUE; - /** - * set propertysheet page's background white in aero mode - **/ + // set propertysheet page's background white in aero mode case WM_CTLCOLORSTATIC: case WM_CTLCOLORDLG: if (IsAeroMode()) @@ -401,163 +370,130 @@ class CAnnivList break; case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->idFrom) - { - case EDIT_ANNIVERSARY_DATE: + switch (((LPNMHDR)lParam)->idFrom) { + case EDIT_ANNIVERSARY_DATE: + switch (((LPNMHDR)lParam)->code) { + // handle changed selection + case LVN_ITEMCHANGED: + { + CItemData *pid; + HWND hCheck; + + pDlg->_curSel = ((LPNMLISTVIEW)lParam)->iItem; + pid = pDlg->ItemData(pDlg->_curSel); + if (pid && pDlg->_bRemindEnable && (hCheck = GetDlgItem(hDlg, CHECK_REMIND))) { + SetDlgItemInt(hDlg, EDIT_REMIND, pid->_wDaysBefore, FALSE); + Button_SetCheck(hCheck, pid->_wReminderState); + DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_REMIND, BN_CLICKED), (LPARAM)hCheck); + } + } + break; + + // resort the list + case LVN_COLUMNCLICK: + { + LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam; + + if (pDlg->_sortHeader == pnmv->iSubItem) + pDlg->_sortOrder *= -1; + else { + pDlg->_sortOrder = 1; + pDlg->_sortHeader = pnmv->iSubItem; + } + ListView_SortItemsEx(pDlg->_hList, (CMPPROC)cmpProc, pDlg); + } + break; + + // show contact menu + case NM_RCLICK: { - switch (((LPNMHDR)lParam)->code) - { - /* - * handle changed selection - */ - case LVN_ITEMCHANGED: - { - CItemData* pid; - HWND hCheck; - - pDlg->_curSel = ((LPNMLISTVIEW)lParam)->iItem; - pid = pDlg->ItemData(pDlg->_curSel); - if (pid && pDlg->_bRemindEnable && (hCheck = GetDlgItem(hDlg, CHECK_REMIND))) { - SetDlgItemInt(hDlg, EDIT_REMIND, pid->_wDaysBefore, FALSE); - Button_SetCheck(hCheck, pid->_wReminderState); - DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_REMIND, BN_CLICKED), (LPARAM)hCheck); - } - } break; - - /* - * resort the list - */ - case LVN_COLUMNCLICK: - { - LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam; - - if (pDlg->_sortHeader == pnmv->iSubItem) { - pDlg->_sortOrder *= -1; - } - else { - pDlg->_sortOrder = 1; - pDlg->_sortHeader = pnmv->iSubItem; - } - ListView_SortItemsEx(pDlg->_hList, (CMPPROC)cmpProc, pDlg); - } break; - - /* - * show contact menu - */ - case NM_RCLICK: - { - CItemData* pid = pDlg->ItemData(pDlg->_curSel); - if (pid) { - HMENU hPopup = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) pid->_hContact, 0); - if (hPopup) { - POINT pt; - GetCursorPos(&pt); - TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL); - DestroyMenu(hPopup); - } - } - } break; - - /* - * handle double click on contact: show message dialog - */ - case NM_DBLCLK: - { - CItemData* pid = pDlg->ItemData(((LPNMITEMACTIVATE)lParam)->iItem); - if (pid) { - CallService(MS_MSG_SENDMESSAGE,(WPARAM)pid->_hContact, NULL); - } + CItemData *pid = pDlg->ItemData(pDlg->_curSel); + if (pid) { + HMENU hPopup = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pid->_hContact, 0); + if (hPopup) { + POINT pt; + GetCursorPos(&pt); + TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL); + DestroyMenu(hPopup); } } } + break; + + // handle double click on contact: show message dialog + case NM_DBLCLK: + { + CItemData *pid = pDlg->ItemData(((LPNMITEMACTIVATE)lParam)->iItem); + if (pid) + CallService(MS_MSG_SENDMESSAGE,(WPARAM)pid->_hContact, NULL); + } } - } break; + } + break; case WM_COMMAND: - { - if (PtrIsValid(pDlg)) { - CItemData* pid = pDlg->ItemData(pDlg->_curSel); + if (PtrIsValid(pDlg)) { + CItemData* pid = pDlg->ItemData(pDlg->_curSel); - // process contact menu command - if (pid && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)pid->_hContact)) { - break; + // process contact menu command + if (pid && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)pid->_hContact)) + break; + + switch (LOWORD(wParam)) { + // enable/disable reminder checkbox is clicked + case CHECK_REMIND: + if (pDlg->_bRemindEnable && HIWORD(wParam) == BN_CLICKED) { + BYTE checkState = Button_GetCheck((HWND)lParam); + + EnableWindow(GetDlgItem(hDlg, EDIT_REMIND), checkState == BST_CHECKED); + EnableWindow(GetDlgItem(hDlg, SPIN_REMIND), checkState == BST_CHECKED); + if (pid && pid->_wReminderState != checkState) + pid->_wReminderState = checkState; } + break; - switch (LOWORD(wParam)) - { + // number of days to remind in advance is edited + case EDIT_REMIND: + if (pid && pDlg->_bRemindEnable && HIWORD(wParam) == EN_CHANGE) { + WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); + if (pid->_wReminderState == BST_CHECKED && pid->_wDaysBefore != wDaysBefore) { + pid->_wDaysBefore = wDaysBefore; + } + } + break; - /* - * enable/disable reminder checkbox is clicked - */ - case CHECK_REMIND: - { - if (pDlg->_bRemindEnable && HIWORD(wParam) == BN_CLICKED) { - BYTE checkState = Button_GetCheck((HWND)lParam); - - EnableWindow(GetDlgItem(hDlg, EDIT_REMIND), checkState == BST_CHECKED); - EnableWindow(GetDlgItem(hDlg, SPIN_REMIND), checkState == BST_CHECKED); - if (pid && pid->_wReminderState != checkState) { - pid->_wReminderState = checkState; - } - } - } break; - - /* - * number of days to remind in advance is edited - */ - case EDIT_REMIND: - { - if (pid && pDlg->_bRemindEnable && HIWORD(wParam) == EN_CHANGE) { - WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); - if (pid->_wReminderState == BST_CHECKED && pid->_wDaysBefore != wDaysBefore) { - pid->_wDaysBefore = wDaysBefore; - } - } - } break; - - /* - * the filter to display only contacts which have an anniversary in a certain - * period of time is enabled/disabled - */ - case CHECK_DAYS: - { - if (HIWORD(wParam) == BN_CLICKED) { - BYTE isChecked = Button_GetCheck((HWND)lParam); - EnableWindow(GetDlgItem(hDlg, EDIT_DAYS), isChecked); - EnableWindow(GetDlgItem(hDlg, TXT_DAYS), isChecked); - pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, NULL, FALSE) : (WORD)-1; - pDlg->RebuildList(); - } - } break; - - /* - * the number of days a contact must have an anniversary in advance to be displayed is edited - */ - case EDIT_DAYS: - { - if (HIWORD(wParam) == EN_CHANGE) { - WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); - if (wNewDays != pDlg->_filter.wDaysBefore) { - pDlg->_filter.wDaysBefore = wNewDays; - pDlg->RebuildList(); - } - } - } break; - - /* - * the filter selection of the filter combobox has changed - */ - case COMBO_VIEW: - { - if (HIWORD(wParam) == CBN_SELCHANGE) { - pDlg->_filter.bFilterIndex = ComboBox_GetCurSel((HWND)lParam); - pDlg->RebuildList(); - } + // the filter to display only contacts which have an anniversary in a certain + // period of time is enabled/disabled + case CHECK_DAYS: + if (HIWORD(wParam) == BN_CLICKED) { + BYTE isChecked = Button_GetCheck((HWND)lParam); + EnableWindow(GetDlgItem(hDlg, EDIT_DAYS), isChecked); + EnableWindow(GetDlgItem(hDlg, TXT_DAYS), isChecked); + pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, NULL, FALSE) : (WORD)-1; + pDlg->RebuildList(); + } + break; + + // the number of days a contact must have an anniversary in advance to be displayed is edited + case EDIT_DAYS: + if (HIWORD(wParam) == EN_CHANGE) { + WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); + if (wNewDays != pDlg->_filter.wDaysBefore) { + pDlg->_filter.wDaysBefore = wNewDays; + pDlg->RebuildList(); } } + break; + + // the filter selection of the filter combobox has changed + case COMBO_VIEW: + if (HIWORD(wParam) == CBN_SELCHANGE) { + pDlg->_filter.bFilterIndex = ComboBox_GetCurSel((HWND)lParam); + pDlg->RebuildList(); + } } - } break; + } + break; case WM_DRAWITEM: return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); @@ -566,93 +502,81 @@ class CAnnivList return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_WINDOWPOSCHANGING: - { - if (PtrIsValid(pDlg)) { - WINDOWPOS* wndPos = (WINDOWPOS*)lParam; - if (!pDlg->_wmINIT && (wndPos->cx != 0 || wndPos->cy != 0)) { - //win pos change - if ( (wndPos->cx == pDlg->_rcWin.right - pDlg->_rcWin.left) && - (wndPos->cy == pDlg->_rcWin.bottom - pDlg->_rcWin.top)) { - //win pos change (store new pos) - GetWindowRect(hDlg, &pDlg->_rcWin); + if (PtrIsValid(pDlg)) { + WINDOWPOS *wndPos = (WINDOWPOS *)lParam; + if (!pDlg->_wmINIT && (wndPos->cx != 0 || wndPos->cy != 0)) { + //win pos change + if ((wndPos->cx == pDlg->_rcWin.right - pDlg->_rcWin.left) && (wndPos->cy == pDlg->_rcWin.bottom - pDlg->_rcWin.top)) + //win pos change (store new pos) + GetWindowRect(hDlg, &pDlg->_rcWin); + //win size change + else { + // l change + if ((wndPos->cx < pDlg->_sizeMin.cx) && (wndPos->x > pDlg->_rcWin.left)) { + wndPos->x = wndPos->x + wndPos->cx - pDlg->_sizeMin.cx; + wndPos->cx = pDlg->_sizeMin.cx; } - //win size change - else { - // l change - if ( (wndPos->cx < pDlg->_sizeMin.cx) && (wndPos->x > pDlg->_rcWin.left)) { - wndPos->x = wndPos->x + wndPos->cx - pDlg->_sizeMin.cx; - wndPos->cx = pDlg->_sizeMin.cx; - } - // r change - else if (wndPos->cx < pDlg->_sizeMin.cx) { - wndPos->cx = pDlg->_sizeMin.cx; - } - - // t change - if ( (wndPos->cy < pDlg->_sizeMin.cy) && (wndPos->y > pDlg->_rcWin.top)) { - wndPos->y = wndPos->y + wndPos->cy - pDlg->_sizeMin.cy; - wndPos->cy = pDlg->_sizeMin.cy; - } - // b change - else if (wndPos->cy < pDlg->_sizeMin.cy) { - wndPos->cy = pDlg->_sizeMin.cy; - } - - pDlg->_rcWin.left = wndPos->x; - pDlg->_rcWin.right = wndPos->x + wndPos->cx; - pDlg->_rcWin.top = wndPos->y; - pDlg->_rcWin.bottom = wndPos->y + wndPos->cy; + // r change + else if (wndPos->cx < pDlg->_sizeMin.cx) + wndPos->cx = pDlg->_sizeMin.cx; + + // t change + if ((wndPos->cy < pDlg->_sizeMin.cy) && (wndPos->y > pDlg->_rcWin.top)) { + wndPos->y = wndPos->y + wndPos->cy - pDlg->_sizeMin.cy; + wndPos->cy = pDlg->_sizeMin.cy; } + // b change + else if (wndPos->cy < pDlg->_sizeMin.cy) + wndPos->cy = pDlg->_sizeMin.cy; + + pDlg->_rcWin.left = wndPos->x; + pDlg->_rcWin.right = wndPos->x + wndPos->cx; + pDlg->_rcWin.top = wndPos->y; + pDlg->_rcWin.bottom = wndPos->y + wndPos->cy; } + } - CAnchor anchor(wndPos, pDlg->_sizeMin); - int anchorPos = CAnchor::ANCHOR_LEFT | CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_TOP; + CAnchor anchor(wndPos, pDlg->_sizeMin); + int anchorPos = CAnchor::ANCHOR_LEFT | CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_TOP; - anchor.MoveCtrl(IDC_HEADERBAR, anchorPos); - anchor.MoveCtrl(GROUP_STATS, anchorPos); + anchor.MoveCtrl(IDC_HEADERBAR, anchorPos); + anchor.MoveCtrl(GROUP_STATS, anchorPos); - // birthday list - anchor.MoveCtrl(EDIT_ANNIVERSARY_DATE, CAnchor::ANCHOR_ALL); + // birthday list + anchor.MoveCtrl(EDIT_ANNIVERSARY_DATE, CAnchor::ANCHOR_ALL); - anchorPos = CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_BOTTOM; + anchorPos = CAnchor::ANCHOR_RIGHT | CAnchor::ANCHOR_BOTTOM; - // filter group - anchor.MoveCtrl(GROUP_FILTER, anchorPos); - anchor.MoveCtrl(COMBO_VIEW, anchorPos); - anchor.MoveCtrl(CHECK_DAYS, anchorPos); - anchor.MoveCtrl(EDIT_DAYS, anchorPos); - anchor.MoveCtrl(TXT_DAYS, anchorPos); + // filter group + anchor.MoveCtrl(GROUP_FILTER, anchorPos); + anchor.MoveCtrl(COMBO_VIEW, anchorPos); + anchor.MoveCtrl(CHECK_DAYS, anchorPos); + anchor.MoveCtrl(EDIT_DAYS, anchorPos); + anchor.MoveCtrl(TXT_DAYS, anchorPos); - // filter group - anchor.MoveCtrl(GROUP_REMINDER, anchorPos); - anchor.MoveCtrl(CHECK_REMIND, anchorPos); - anchor.MoveCtrl(EDIT_REMIND, anchorPos); - anchor.MoveCtrl(SPIN_REMIND, anchorPos); - anchor.MoveCtrl(TXT_REMIND6, anchorPos); - anchor.MoveCtrl(CHECK_POPUP, anchorPos); - } - } break; + // filter group + anchor.MoveCtrl(GROUP_REMINDER, anchorPos); + anchor.MoveCtrl(CHECK_REMIND, anchorPos); + anchor.MoveCtrl(EDIT_REMIND, anchorPos); + anchor.MoveCtrl(SPIN_REMIND, anchorPos); + anchor.MoveCtrl(TXT_REMIND6, anchorPos); + anchor.MoveCtrl(CHECK_POPUP, anchorPos); + } + break; - /** - * This message is sent if eighter the user clicked on the close button or - * Miranda fires the ME_SYSTEM_SHUTDOWN event. - **/ + // This message is sent if eighter the user clicked on the close button or + // Miranda fires the ME_SYSTEM_SHUTDOWN event. case WM_CLOSE: - { - DestroyWindow(hDlg); - } break; + DestroyWindow(hDlg); + break; - /** - * If the anniversary list is destroyed somehow, the data class must be - * deleted, too. - **/ + // If the anniversary list is destroyed somehow, the data class must be deleted, too. case WM_DESTROY: - { - if (PtrIsValid(pDlg)) { - SetUserData(hDlg, NULL); - delete pDlg; - } - } break; + if (PtrIsValid(pDlg)) { + SetUserData(hDlg, NULL); + delete pDlg; + } + break; } return FALSE; } @@ -667,14 +591,14 @@ class CAnnivList * @retval 0 if successful * @retval 1 if failed **/ - BYTE AddColumn(int iSubItem, LPCTSTR pszText, int defaultWidth) + BYTE AddColumn(int iSubItem, LPCTSTR pszText, int defaultWidth) { LVCOLUMN lvc; CHAR pszSetting[MAXSETTING]; mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", iSubItem); lvc.cx = db_get_w(NULL, MODNAME, pszSetting, defaultWidth); - lvc.mask = LVCF_WIDTH|LVCF_TEXT; + lvc.mask = LVCF_WIDTH | LVCF_TEXT; lvc.iSubItem = iSubItem; lvc.pszText = TranslateTS(pszText); return ListView_InsertColumn(_hList, lvc.iSubItem++, &lvc) == -1; @@ -690,11 +614,10 @@ class CAnnivList * @retval TRUE if successful * @retval FALSE if failed **/ - BYTE AddSubItem(int iItem, int iSubItem, LPTSTR pszText) + BYTE AddSubItem(int iItem, int iSubItem, LPTSTR pszText) { LVITEM lvi; - if (iSubItem > 0) - { + if (iSubItem > 0) { lvi.iItem = iItem; lvi.iSubItem = iSubItem; lvi.pszText = pszText; @@ -723,7 +646,7 @@ class CAnnivList lvi.iItem = 0; lvi.iSubItem = 0; lvi.pszText = pszText; - lvi.mask = LVIF_TEXT|TVIF_PARAM; + lvi.mask = LVIF_TEXT | TVIF_PARAM; lvi.lParam = lParam; return ListView_InsertItem(_hList, &lvi); } @@ -746,36 +669,26 @@ class CAnnivList int diff, iItem = -1; CItemData *pdata; - // // first column: ETA - // diff = ad.CompareDays(mtNow); - if (diff < 0) - { + if (diff < 0) diff += IsLeap(mtNow.Year() + 1) ? 366 : 365; - } // is filtered - if (diff <= _filter.wDaysBefore) - { + if (diff <= _filter.wDaysBefore) { // read reminder options for the contact ad.DBGetReminderOpts(hContact); - if ((_filter.bFilterIndex != FILTER_DISABLED_REMINDER) || (ad.RemindOption() == BST_UNCHECKED)) - { + if ((_filter.bFilterIndex != FILTER_DISABLED_REMINDER) || (ad.RemindOption() == BST_UNCHECKED)) { // set default offset if required - if (ad.RemindOffset() == (WORD)-1) - { + if (ad.RemindOffset() == (WORD)-1) { ad.RemindOffset(wDaysBefore); // create data object pdata = new CItemData(hContact, ad); - if (!pdata) - { + if (!pdata) return FALSE; - } // add item iItem = AddItem(_itot(diff, szText, 10), (LPARAM)pdata); - if (iItem == -1) - { + if (iItem == -1) { delete pdata; return FALSE; } @@ -784,7 +697,7 @@ class CAnnivList AddSubItem(iItem, COLUMN_CONTACT, DB::Contact::DisplayName(hContact)); // third column: protocol - TCHAR* ptszProto = mir_a2t(pszProto); + TCHAR *ptszProto = mir_a2t(pszProto); AddSubItem(iItem, COLUMN_PROTO, ptszProto); mir_free(ptszProto); @@ -805,29 +718,26 @@ class CAnnivList return TRUE; } - /** - * This method clears the list and adds contacts again, according to the current filter settings. - **/ - void RebuildList() + // This method clears the list and adds contacts again, according to the current filter settings. + void RebuildList() { - LPSTR pszProto; - MTime mtNow; - MAnnivDate ad; - int i = 0; - DWORD age = 0; - WORD wDaysBefore = db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET); - WORD numMale = 0; - WORD numFemale = 0; - WORD numContacts = 0; - WORD numBirthContacts = 0; + LPSTR pszProto; + MTime mtNow; + MAnnivDate ad; + int i = 0; + DWORD age = 0; + WORD wDaysBefore = db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET); + WORD numMale = 0; + WORD numFemale = 0; + WORD numContacts = 0; + WORD numBirthContacts = 0; ShowWindow(_hList, SW_HIDE); DeleteAllItems(); mtNow.GetLocalTime(); // insert the items into the list - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) - { + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // ignore meta subcontacts here, as they are not interesting. if (!db_mc_isSub(hContact)) { // filter protocol @@ -838,7 +748,6 @@ class CAnnivList case 'M': numMale++; break; - case 'F': numFemale++; } @@ -871,20 +780,15 @@ class CAnnivList SetDlgItemInt(_hDlg, TXT_AGE, numBirthContacts > 0 ? max(0, (age - (age % numBirthContacts)) / numBirthContacts) : 0, FALSE); } - /** - * This method deletes all items from the listview - **/ - void DeleteAllItems() + // This method deletes all items from the listview + void DeleteAllItems() { CItemData *pid; - for (int i = 0; i < _numRows; i++) - { + for (int i = 0; i < _numRows; i++) { pid = ItemData(i); - if (pid) - { + if (pid) delete pid; - } } ListView_DeleteAllItems(_hList); _numRows = 0; @@ -897,36 +801,29 @@ class CAnnivList * * @return pointer to the data strucutre on success or NULL otherwise. **/ - CItemData* ItemData(int iItem) + CItemData *ItemData(int iItem) { - if (_hList && iItem >= 0 && iItem < _numRows) - { + if (_hList && iItem >= 0 && iItem < _numRows) { LVITEM lvi; lvi.mask = LVIF_PARAM; lvi.iItem = iItem; lvi.iSubItem = 0; if (ListView_GetItem(_hList, &lvi) && PtrIsValid(lvi.lParam)) - { - return (CItemData*)lvi.lParam; - } + return (CItemData *)lvi.lParam; } return NULL; } - /** - * This method loads all filter settings from db - **/ - void LoadFilter() + // This method loads all filter settings from db + void LoadFilter() { _filter.wDaysBefore = db_get_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, 9); _filter.bFilterIndex = db_get_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_INDEX, 0); } - /** - * This method saves all filter settings to db - **/ - void SaveFilter() + // This method saves all filter settings to db + void SaveFilter() { if (_hDlg) { db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, NULL, FALSE)); @@ -937,10 +834,8 @@ class CAnnivList public: - /** - * This is the default constructor. - **/ - CAnnivList() + // This is the default constructor. + CAnnivList() { _hList = NULL; _sortHeader = 0; @@ -960,10 +855,8 @@ public: } } - /** - * This is the default destructor. - **/ - ~CAnnivList() + // This is the default destructor. + ~CAnnivList() { // delete the shutdown hook if (_mHookExit) { @@ -1027,23 +920,20 @@ public: * * @return always 0 **/ -INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam) +INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam) { if (!gpDlg) { - try - { + try { myGlobals.WantAeroAdaption = db_get_b(NULL, MODNAME, SET_PROPSHEET_AEROADAPTION, TRUE); gpDlg = new CAnnivList(); } - catch(...) - { + catch(...) { delete gpDlg; gpDlg = NULL; } } - else { + else gpDlg->BringToFront(); - } return 0; } @@ -1062,7 +952,6 @@ INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam) * * @return nothing **/ - void DlgAnniversaryListOnTopToolBarLoaded() { TTBButton ttb = { sizeof(ttb) }; @@ -1085,10 +974,10 @@ void DlgAnniversaryListLoadModule() CreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; - hk.pszName = "AnniversaryList"; - hk.pszDescription = LPGEN("Popup Anniversary list"); - hk.pszService = MS_USERINFO_REMINDER_LIST; + hk.cbSize = sizeof(HOTKEYDESC); + hk.pszSection = MODNAME; + hk.pszName = "AnniversaryList"; + hk.pszDescription = LPGEN("Popup anniversary list"); + hk.pszService = MS_USERINFO_REMINDER_LIST; Hotkey_Register(&hk); } diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 3df5b58e95..9635a2cb70 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -26,10 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _MSGPOPUPDATA { - POPUPACTION pa[3]; - HWND hDialog; -} -MSGPOPUPDATA, *LPMSGPOPUPDATA; + POPUPACTION pa[3]; + HWND hDialog; +} MSGPOPUPDATA, *LPMSGPOPUPDATA; /** * This helper function moves and resizes a dialog box's control element. @@ -49,7 +48,7 @@ static FORCEINLINE void MoveCtrl(HWND hDlg, int idCtrl, int dx, int dy, int dw, HWND hCtrl = GetDlgItem(hDlg, idCtrl); GetWindowRect(hCtrl, &ws); OffsetRect(&ws, dx, dy); - MoveWindow(hCtrl, ws.left, ws.top, ws.right - ws.left + dw, ws.bottom - ws.top + dh, FALSE); + MoveWindow(hCtrl, ws.left, ws.top, ws.right - ws.left + dw, ws.bottom - ws.top + dh, FALSE); } /** @@ -60,7 +59,6 @@ static FORCEINLINE void MoveCtrl(HWND hDlg, int idCtrl, int dx, int dy, int dw, * @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; @@ -228,11 +226,11 @@ 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)) { - POINT mpt = {0,0}; - RECT ws = {0,0,0,0}; - int txtWidth, txtHeight, needX, needY; - RECT rcDlg; - SIZE ts; + POINT mpt = { 0, 0 }; + RECT ws = { 0, 0, 0, 0 }; + int txtWidth, txtHeight, needX, needY; + RECT rcDlg; + SIZE ts; LPTSTR h, rs; SelectObject(hDC, hNormalFont); @@ -257,23 +255,23 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l GetWindowRect(GetDlgItem(hDlg, TXT_MESSAGE), &ws); needX = txtWidth - (ws.right - ws.left) - icoWidth; needY = max(0, txtHeight - (ws.bottom - ws.top) + 5); - rcDlg.left -= needX/2; rcDlg.right += needX/2; - rcDlg.top -= (needY-InfoBarHeight)/2; rcDlg.bottom += (needY-InfoBarHeight)/2; + rcDlg.left -= needX / 2; + rcDlg.right += needX / 2; + 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); ClientToScreen(hDlg, &mpt); - MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight); - MoveCtrl(hDlg, TXT_NAME, -mpt.x, -mpt.y, needX, 0); - MoveCtrl(hDlg, ICO_DLGLOGO, -mpt.x + needX, -mpt.y, 0, 0); - MoveCtrl(hDlg, ICO_MSGDLG, -mpt.x, -mpt.y - InfoBarHeight, 0, 0); - MoveCtrl(hDlg, TXT_MESSAGE, -mpt.x - icoWidth, -mpt.y - InfoBarHeight, needX, needY); - MoveCtrl(hDlg, STATIC_LINE2, -mpt.x, -mpt.y + needY - InfoBarHeight, needX, 0); + MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight); + MoveCtrl(hDlg, TXT_NAME, -mpt.x, -mpt.y, needX, 0); + MoveCtrl(hDlg, ICO_DLGLOGO, -mpt.x + needX, -mpt.y, 0, 0); + MoveCtrl(hDlg, ICO_MSGDLG, -mpt.x, -mpt.y - InfoBarHeight, 0, 0); + MoveCtrl(hDlg, TXT_MESSAGE, -mpt.x - icoWidth, -mpt.y - InfoBarHeight, needX, needY); + MoveCtrl(hDlg, STATIC_LINE2, -mpt.x, -mpt.y + needY - InfoBarHeight, needX, 0); - // // Do pushbutton positioning - // RECT rcOk, rcAll, rcNone, rcCancel; // get button rectangles @@ -464,15 +462,14 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l * 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) { case WM_INITDIALOG: - LPMSGBOX pMsgBox = (LPMSGBOX)lParam; + LPMSGBOX pMsgBox = (LPMSGBOX)lParam; - MoveWindow(hDlg,-10,-10,0,0,FALSE); - LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA)); + MoveWindow(hDlg, -10, -10, 0, 0, FALSE); + LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA)); if (pmpd) { POPUPDATAT_V2 pd = { 0 }; pd.cbSize = sizeof(pd); @@ -491,12 +488,12 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP // set color of popup switch (pMsgBox->uType & MB_ICONMASK) { case MB_ICON_ERROR: - pd.colorBack = RGB(200, 10, 0); + pd.colorBack = RGB(200, 10, 0); pd.colorText = RGB(255, 255, 255); break; case MB_ICON_WARNING: - pd.colorBack = RGB(200, 100, 0); + pd.colorBack = RGB(200, 100, 0); pd.colorText = RGB(255, 255, 255); break; @@ -551,7 +548,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP } // create popup - CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA); + CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, APF_NEWDATA); if (MB_TYPE(pMsgBox->uType) == MB_OK) EndDialog(hDlg, IDOK); } @@ -570,7 +567,6 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP * * @return TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL **/ - static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -619,19 +615,18 @@ static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP * @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; // check input - if ( PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX)) { + if (PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX)) { // Shall the MessageBox displayed as popup? - if (!(pMsgBox->uType & (MB_INFOBAR|MB_NOPOPUP)) && // message box can be a popup? - ServiceExists(MS_POPUP_ADDPOPUPT) && // popups exist? - myGlobals.PopupActionsExist == 1 && // popup support ext stuct? - (db_get_dw(NULL, "Popup","Actions", 0) & 1) && // popup++ actions on? - db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups? + if (!(pMsgBox->uType & (MB_INFOBAR | MB_NOPOPUP)) // message box can be a popup? + && ServiceExists(MS_POPUP_ADDPOPUPT) // popups exist? + && myGlobals.PopupActionsExist == 1 // popup support ext stuct? + && (db_get_dw(NULL, "Popup", "Actions", 0) & 1) // popup++ actions on? + && db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups? return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam); return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam); @@ -641,20 +636,19 @@ INT_PTR MsgBoxService(WPARAM wParam, LPARAM lParam) /** * name: MsgBox -* desc: calls a messagebox -* param: +* desc: calls a messagebox +* param: **/ - INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszInfo, LPCTSTR pszFormat, ...) { TCHAR tszMsg[MAX_SECONDLINE]; - va_list vl; + va_list vl; va_start(vl, pszFormat); mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl); va_end(vl); - MSGBOX mb = {0}; + MSGBOX mb = { 0 }; mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = Skin_GetIcon(ICO_COMMON_MAIN); @@ -662,20 +656,19 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI mb.ptszTitle = TranslateTS(pszTitle); mb.ptszInfoText = TranslateTS(pszInfo); mb.ptszMsg = tszMsg; - mb.uType = uType; + mb.uType = uType; return MsgBoxService(NULL, (LPARAM)&mb); } /** * name: MsgErr -* desc: calls a messagebox +* desc: calls a messagebox * param: **/ - INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) { - TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE]; - mir_sntprintf(tszTitle, SIZEOF(tszMsg),_T("%s - %s") ,_T(MODNAME), TranslateT("Error")); + TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE]; + mir_sntprintf(tszTitle, SIZEOF(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error")); va_list vl; va_start(vl, pszFormat); @@ -689,6 +682,6 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) mb.hiMsg = NULL; mb.ptszTitle = tszTitle; mb.ptszMsg = tszMsg; - mb.uType = MB_OK|MB_ICON_ERROR; + mb.uType = MB_OK | MB_ICON_ERROR; return MsgBoxService(NULL, (LPARAM)&mb); } diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 05270fb469..ac6100ae30 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -28,16 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ex_import\svc_ExImport.h" #include "svc_reminder.h" -#define OPTIONPAGE_OLD_SIZE (offsetof(OPTIONSDIALOGPAGE, hLangpack)) +#define OPTIONPAGE_OLD_SIZE (offsetof(OPTIONSDIALOGPAGE, hLangpack)) #define UPDATEANIMFRAMES 20 // internal dialog message handler -#define M_CHECKONLINE (WM_USER+10) -#define HM_PROTOACK (WM_USER+11) -#define HM_SETTING_CHANGED (WM_USER+12) -#define HM_RELOADICONS (WM_USER+13) -#define HM_SETWINDOWTITLE (WM_USER+14) +#define M_CHECKONLINE (WM_USER + 10) +#define HM_PROTOACK (WM_USER + 11) +#define HM_SETTING_CHANGED (WM_USER + 12) +#define HM_RELOADICONS (WM_USER + 13) +#define HM_SETWINDOWTITLE (WM_USER + 14) #define TIMERID_UPDATING 1 #ifndef TIMERID_RENAME @@ -52,15 +52,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INIT_ICONS_NONE 0 #define INIT_ICONS_OWNER 1 #define INIT_ICONS_CONTACT 2 -#define INIT_ICONS_ALL (INIT_ICONS_OWNER|INIT_ICONS_CONTACT) +#define INIT_ICONS_ALL (INIT_ICONS_OWNER | INIT_ICONS_CONTACT) /*********************************************************************************************************** * internal variables ***********************************************************************************************************/ -static BYTE bInitIcons = INIT_ICONS_NONE; -static HANDLE ghWindowList = NULL; -static HANDLE ghDetailsInitEvent = NULL; +static BYTE bInitIcons = INIT_ICONS_NONE; +static HANDLE ghWindowList = NULL; +static HANDLE ghDetailsInitEvent = NULL; static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -77,14 +77,14 @@ _ignore(10, (LIST::FTSortFunc)_tcscmp) _hImages = NULL; } -CPsHdr::~CPsHdr() +CPsHdr::~CPsHdr() { // delete data for (int i = 0 ; i < _ignore.getCount(); i++) mir_free(_ignore[i]); } -void CPsHdr::Free_pPages() +void CPsHdr::Free_pPages() { for (int i = 0; i < _numPages; i++) delete _pPages[i]; @@ -106,10 +106,10 @@ public: private: PROTOACCOUNT **_pPd; - int _numProto; - BYTE _bExitAfterUploading; - HANDLE _hUploading; - LPPS _pPs; + int _numProto; + BYTE _bExitAfterUploading; + HANDLE _hUploading; + LPPS _pPs; /** * @class Upload @@ -123,7 +123,7 @@ private: { // check if icq is online if (!IsProtoOnline((*_pPd)->szModuleName)) - MsgBox(_pPs->hDlg, MB_ICON_WARNING, TranslateT("Upload Details"), + MsgBox(_pPs->hDlg, MB_ICON_WARNING, TranslateT("Upload details"), CMString(FORMAT, TranslateT("Protocol '%s' is offline"), _A2T((*_pPd)->szModuleName)), TranslateT("You are not currently connected to the ICQ network.\nYou must be online in order to update your information on the server.\n\nYour changes will be saved to database only.")); @@ -169,7 +169,6 @@ public: // create a list of all protocols which support uploading contact information if ( ProtoEnumAccounts(&_numProto, &_pPd)) return _bExitAfterUploading ? UPLOAD_FINISH_CLOSE : UPLOAD_FINISH; - return UploadNext(); } @@ -224,12 +223,13 @@ public: * * @return -1 or 0 or 1 **/ - -static int SortProc(CPsTreeItem** item1, CPsTreeItem** item2) +static int SortProc(CPsTreeItem **item1, CPsTreeItem **item2) { if (*item1 && *item2) { - if ((*item2)->Pos() > (*item1)->Pos()) return -1; - if ((*item2)->Pos() < (*item1)->Pos()) return 1; + if ((*item2)->Pos() > (*item1)->Pos()) + return -1; + if ((*item2)->Pos() < (*item1)->Pos()) + return 1; } return 0; } @@ -242,7 +242,6 @@ static int SortProc(CPsTreeItem** item1, CPsTreeItem** item2) * @retval 0 on success * @retval 1 on failure **/ - static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) { // update some cached settings @@ -276,7 +275,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) HICON hDefIcon = Skin_GetIcon(ICO_TREE_DEFAULT); if (!hDefIcon) - hDefIcon = (HICON) LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, metrics.x, metrics.y, 0); + 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); @@ -346,34 +345,34 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) **/ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) { - CPsHdr *pPsh = (CPsHdr*)wParam; - OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam; + CPsHdr *pPsh = (CPsHdr *)wParam; + OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE *)lParam; // check size of the handled structures if (pPsh == NULL || odp == NULL || pPsh->_dwSize != sizeof(CPsHdr)) return 1; if (odp->cbSize != sizeof(OPTIONSDIALOGPAGE) && odp->cbSize != OPTIONPAGE_OLD_SIZE) { - MsgErr(NULL, LPGENT("The Page to add has invalid size %d bytes!"), odp->cbSize); + MsgErr(NULL, LPGENT("The page to add has invalid size %d bytes!"), odp->cbSize); return 1; } // try to check whether the flag member is initialized or not - odp->flags = odp->flags > (ODPF_UNICODE|ODPF_BOLDGROUPS|ODPF_ICON|PSPF_PROTOPREPENDED) ? 0 : odp->flags; + odp->flags = odp->flags > (ODPF_UNICODE | ODPF_BOLDGROUPS | ODPF_ICON | PSPF_PROTOPREPENDED) ? 0 : odp->flags; - if (pPsh->_dwFlags & (PSF_PROTOPAGESONLY|PSF_PROTOPAGESONLY_INIT)) { + if (pPsh->_dwFlags & (PSF_PROTOPAGESONLY | PSF_PROTOPAGESONLY_INIT)) { BYTE bIsUnicode = (odp->flags & ODPF_UNICODE) == ODPF_UNICODE; - TCHAR* ptszTitle = bIsUnicode ? mir_tstrdup(odp->ptszTitle) : mir_a2t(odp->pszTitle); + TCHAR *ptszTitle = bIsUnicode ? mir_tstrdup(odp->ptszTitle) : mir_a2t(odp->pszTitle); // avoid adding pages for a meta subcontact, which have been added for a metacontact. - if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) { + if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) { if (pPsh->_ignore.getIndex(ptszTitle) != -1) { mir_free(ptszTitle); return 0; } } // init ignore list with pages added by metacontact - else if (pPsh->_dwFlags & PSF_PROTOPAGESONLY_INIT) + else if (pPsh->_dwFlags & PSF_PROTOPAGESONLY_INIT) pPsh->_ignore.insert(mir_tstrdup(ptszTitle)); mir_free(ptszTitle); @@ -388,7 +387,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) } // resize the array - pPsh->_pPages = (CPsTreeItem**)mir_realloc(pPsh->_pPages, (pPsh->_numPages + 1) * sizeof(CPsTreeItem*)); + pPsh->_pPages = (CPsTreeItem **)mir_realloc(pPsh->_pPages, (pPsh->_numPages + 1) * sizeof(CPsTreeItem*)); if (pPsh->_pPages != NULL) { pPsh->_pPages[pPsh->_numPages++] = pNew; return 0; @@ -420,8 +419,8 @@ static int OnDeleteContact(WPARAM wParam, LPARAM lParam) **/ static int OnShutdown(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(ghWindowList, WM_DESTROY, 0, 0); - return 0; + WindowList_BroadcastAsync(ghWindowList, WM_DESTROY, 0, 0); + return 0; } /** @@ -479,7 +478,7 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.position = 0x8000005; odp.pfnDlgProc = PSPProcContactWork; odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS); - mir_tcsncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (Work)"), SIZEOF(szTitle) - ofs); + mir_tcsncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); @@ -508,7 +507,7 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt **/ static int InitDetails(WPARAM wParam, LPARAM lParam) { - CPsHdr* pPsh = (CPsHdr*)wParam; + CPsHdr *pPsh = (CPsHdr *)wParam; if (!(pPsh->_dwFlags & PSF_PROTOPAGESONLY)) { BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE); if (lParam || bChangeDetailsEnabled) { @@ -523,7 +522,8 @@ static int InitDetails(WPARAM wParam, LPARAM lParam) AddProtocolPages(odp, wParam); odp.ptszTitle = LPGENT("About") _T("\\") LPGENT("Notes"); } - else odp.ptszTitle = LPGENT("Notes"); + else + odp.ptszTitle = LPGENT("Notes"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); odp.position = 0x8000008; @@ -547,9 +547,9 @@ void DlgContactInfoInitTreeIcons() { // make sure this is run only once if (!(bInitIcons & INIT_ICONS_ALL)) { - CPsHdr psh; - POINT metrics = {0}; - int i = 0; + CPsHdr psh; + POINT metrics = {0}; + int i = 0; psh._dwFlags = PSTVF_INITICONS; @@ -558,7 +558,7 @@ void DlgContactInfoInitTreeIcons() if (psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) { HICON hDefIcon = Skin_GetIcon(ICO_TREE_DEFAULT); if (!hDefIcon) - hDefIcon = (HICON) LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, metrics.x, metrics.y, 0); + 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); @@ -573,11 +573,10 @@ void DlgContactInfoInitTreeIcons() psh._dwFlags |= PSF_PROTOPAGESONLY_INIT; // enumerate all protocols - if ( !ProtoEnumAccounts(&ProtoCount, &pd)) { + if (!ProtoEnumAccounts(&ProtoCount, &pd)) { for (i = 0; i < ProtoCount; i++) { // enumerate all contacts - for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) - { + for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) { // compare contact's protocol to the current one, to add pszContactProto = DB::Contact::Proto(psh._hContact); if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pd[i]->szModuleName, pszContactProto)) { @@ -585,7 +584,7 @@ void DlgContactInfoInitTreeIcons() NotifyEventHooks(ghDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); if (psh._pPages) { psh.Free_pPages(); - psh._dwFlags = PSTVF_INITICONS|PSF_PROTOPAGESONLY; + psh._dwFlags = PSTVF_INITICONS | PSF_PROTOPAGESONLY; } break; } @@ -689,18 +688,16 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG: { - CPsHdr* pPsh = (CPsHdr*)lParam; - WORD needWidth = 0; - RECT rc; + CPsHdr* pPsh = (CPsHdr *)lParam; + WORD needWidth = 0; + RECT rc; if (!pPsh || pPsh->_dwSize != sizeof(CPsHdr)) return FALSE; TranslateDialogDefault(hDlg); - // // create data structures - // if (!(pPs = (LPPS)mir_alloc(sizeof(PS)))) return FALSE; @@ -719,19 +716,15 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar pPs->hSettingChanged = HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hDlg, HM_SETTING_CHANGED); pPs->hIconsChanged = HookEventMessage(ME_SKIN2_ICONSCHANGED, hDlg, HM_RELOADICONS); - ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG),IsAeroMode()); - ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG2),!IsAeroMode()); - - // + ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG), IsAeroMode()); + ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG2), !IsAeroMode()); + // set icons - // SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIcon(ICO_COMMON_MAIN)); SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon(ICO_COMMON_MAIN, 32)); DlgProc(hDlg, HM_RELOADICONS, NULL, NULL); - // // load basic protocol for current contact (for faster load later on and better handling for owner protocol) - // if (pPs->hContact) mir_strncpy(pPs->pszProto, pPsh->_pszPrefix, MAXMODULELABELLENGTH); @@ -746,9 +739,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hDlg, BTN_EXPORT, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Export to file"), MBBF_TCHAR); SendDlgItemMessage(hDlg, BTN_IMPORT, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Import from file"), MBBF_TCHAR); - // // set bold font for name in description area - // LOGFONT lf; HFONT hNormalFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0); @@ -762,15 +753,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar lf.lfWeight = FW_BOLD; pPs->hBoldFont = CreateFontIndirect(&lf); - // // initialize the optionpages and tree control - // if (!pPs->pTree->InitTreeItems((LPWORD)&needWidth)) return FALSE; - // // move and resize dialog and its controls - // { RECT rcTree; POINT pt = { 0, 0 }; @@ -797,8 +784,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar MoveWindow(pPs->pTree->Window(), rcTree.left, rcTree.top, rcTree.right - rcTree.left, rcTree.bottom - rcTree.top, FALSE); pPs->rcDisplay.right += addWidth; - MoveWindow(hDlg, pPs->rcDisplay.left, pPs->rcDisplay.top, - pPs->rcDisplay.right - pPs->rcDisplay.left, + MoveWindow(hDlg, pPs->rcDisplay.left, pPs->rcDisplay.top, + pPs->rcDisplay.right - pPs->rcDisplay.left, pPs->rcDisplay.bottom - pPs->rcDisplay.top, FALSE); } @@ -822,7 +809,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar OffsetRect(&rc, -pt.x, -pt.y); MoveWindow(hCtrl, rc.left, rc.top, rc.right - rc.left + addWidth, rc.bottom - rc.top, FALSE); } - } + } for (int k = 0; k < SIZEOF(idMove); k++) { if (hCtrl = GetDlgItem(hDlg, idMove[k])) { GetWindowRect(hCtrl, &rc); @@ -903,10 +890,10 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { COLORREF textCol = GetSysColor(COLOR_BTNTEXT); COLORREF bgCol = GetSysColor(COLOR_3DFACE); - int ratio = abs(UPDATEANIMFRAMES/2 - pPs->updateAnimFrame) * 510 / UPDATEANIMFRAMES; + int ratio = abs(UPDATEANIMFRAMES / 2 - pPs->updateAnimFrame) * 510 / UPDATEANIMFRAMES; COLORREF newCol = RGB(GetRValue(bgCol) + (GetRValue(textCol) - GetRValue(bgCol)) * ratio / 256, - GetGValue(bgCol) + (GetGValue(textCol) - GetGValue(bgCol)) * ratio / 256, - GetBValue(bgCol) + (GetBValue(textCol) - GetBValue(bgCol)) * ratio / 256); + GetGValue(bgCol) + (GetGValue(textCol) - GetGValue(bgCol)) * ratio / 256, + GetBValue(bgCol) + (GetBValue(textCol) - GetBValue(bgCol)) * ratio / 256); SetTextColor((HDC)wParam, newCol); SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE)); } @@ -952,11 +939,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case PSM_GETBOLDFONT: if (pPs->hBoldFont && lParam) { - *(HFONT*)lParam = pPs->hBoldFont; + *(HFONT *)lParam = pPs->hBoldFont; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hBoldFont); return TRUE; } - *(HFONT*)lParam = NULL; + *(HFONT *)lParam = NULL; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; @@ -970,24 +957,22 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case PSM_GETCONTACT: if (lParam) { - CPsTreeItem *pti = ((int)wParam != -1) - ? pPs->pTree->TreeItem((int)wParam) - : pPs->pTree->CurrentItem(); + CPsTreeItem *pti = ((int)wParam != -1) ? pPs->pTree->TreeItem((int)wParam) : pPs->pTree->CurrentItem(); // prefer to return the contact accociated with the current page if (pti && pti->hContact() != INVALID_CONTACT_ID) { - *(MCONTACT*)lParam = pti->hContact(); + *(MCONTACT *)lParam = pti->hContact(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->hContact()); return TRUE; } // return contact who owns the details dialog if (pPs->hContact != INVALID_CONTACT_ID) { - *(MCONTACT*)lParam = pPs->hContact; + *(MCONTACT *)lParam = pPs->hContact; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hContact); return TRUE; } - *(HANDLE*)lParam = NULL; + *(HANDLE *)lParam = NULL; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, NULL); } break; @@ -1002,25 +987,23 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case PSM_GETBASEPROTO: if (lParam) { - CPsTreeItem *pti = ((int)wParam != -1) - ? pPs->pTree->TreeItem((int)wParam) - : pPs->pTree->CurrentItem(); + CPsTreeItem *pti = ((int)wParam != -1) ? pPs->pTree->TreeItem((int)wParam) : pPs->pTree->CurrentItem(); if (pti && pti->Proto()) { // return custom protocol for the current page - *(LPCSTR*)lParam = pti->Proto(); + *(LPCSTR *)lParam = pti->Proto(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->Proto()); return TRUE; } if (*pPs->pszProto) { // return global protocol - *(LPSTR*)lParam = pPs->pszProto; + *(LPSTR *)lParam = pPs->pszProto; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->pszProto); return TRUE; } } - *(LPCSTR*)lParam = NULL; + *(LPCSTR *)lParam = NULL; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; @@ -1074,7 +1057,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar LPDLGCOMMAND pCmd = (LPDLGCOMMAND)lParam; CPsTreeItem *pti; - if (pCmd && (pti = pPs->pTree->FindItemByResource(pCmd->hInst, pCmd->idDlg)) && pti->Wnd()) { + if (pCmd && (pti = pPs->pTree->FindItemByResource(pCmd->hInst, pCmd->idDlg)) && pti->Wnd()) { if (!pCmd->idDlgItem) return SendMessage(pti->Wnd(), pCmd->uMsg, pCmd->wParam, pCmd->lParam); else @@ -1102,7 +1085,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { BYTE bIsAeroMode = IsAeroMode(); if (lParam) - *(BYTE*)lParam = bIsAeroMode; + *(BYTE *)lParam = bIsAeroMode; return (INT_PTR)bIsAeroMode; } @@ -1116,7 +1099,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case HM_SETWINDOWTITLE: { - DBCONTACTWRITESETTING* pdbcws = (DBCONTACTWRITESETTING*)lParam; + DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING *)lParam; LPCTSTR pszName; if (!pPs->hContact) @@ -1128,11 +1111,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar HWND hName = GetDlgItem(hDlg, TXT_NAME); SetWindowText(hName, pszName); - SetWindowText(hDlg, CMString(FORMAT, _T("%s - %s"), pszName, TranslateT("Edit Contact Information"))); - SetDlgItemText(hDlg, IDC_HEADERBAR, CMString(FORMAT, _T("%s\n%s"), TranslateT("Edit Contact Information"), pszName)); + SetWindowText(hDlg, CMString(FORMAT, _T("%s - %s"), pszName, TranslateT("edit contact information"))); + SetDlgItemText(hDlg, IDC_HEADERBAR, CMString(FORMAT, _T("%s\n%s"), TranslateT("Edit contact information"), pszName)); // redraw the name control - POINT pt = { 0, 0 }; + POINT pt = { 0, 0 }; ScreenToClient(hDlg, &pt); RECT rc; GetWindowRect(hName, &rc); @@ -1151,8 +1134,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case HM_RELOADICONS: { - HWND hCtrl; - HICON hIcon; + HWND hCtrl; + HICON hIcon; static const ICONCTRL idIcon[] = { { ICO_DLG_DETAILS, STM_SETIMAGE, ICO_DLGLOGO }, { ICO_BTN_UPDATE, BM_SETIMAGE, BTN_UPDATE }, @@ -1212,7 +1195,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case HM_PROTOACK: { - ACKDATA *ack = (ACKDATA*)lParam; + ACKDATA *ack = (ACKDATA *)lParam; int i, iSubContact; if (!ack->hContact && ack->type == ACKTYPE_STATUS) @@ -1243,9 +1226,9 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); pPs->dwFlags &= ~PSF_LOCKED; } - else if (ack->result == ACKRESULT_FAILED) { + else if (ack->result == ACKRESULT_FAILED) { MsgBox(hDlg, MB_ICON_WARNING, - LPGENT("Upload ICQ Details"), + LPGENT("Upload ICQ details"), LPGENT("Upload failed"), LPGENT("Your details were not uploaded successfully.\nThey were written to database only.")); KillTimer(hDlg, TIMERID_UPDATING); @@ -1288,7 +1271,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (i == pPs->nSubContacts) break; } - else iSubContact = 0; + else + iSubContact = 0; // if they're not gonna send any more ACK's don't let that mean we should crash if (!pPs->infosUpdated || (!ack->hProcess && !ack->lParam)) { @@ -1303,7 +1287,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (iSubContact < pPs->nSubContacts) { // init the acks structure for a sub contact if (pPs->infosUpdated[iSubContact].acks == NULL) { - pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int)* (int)(INT_PTR)ack->hProcess); + pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int) * (int)(INT_PTR)ack->hProcess); pPs->infosUpdated[iSubContact].count = (int)(INT_PTR)ack->hProcess; } @@ -1343,7 +1327,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case HM_SETTING_CHANGED: if (!(pPs->dwFlags & PSF_LOCKED)) { MCONTACT hContact = wParam; - DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam; + DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING *)lParam; if (hContact != pPs->hContact) { if (pPs->hContact != db_mc_getMeta(hContact)) @@ -1367,72 +1351,69 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_NOTIFY: switch (wParam) { + // Notification Messages sent by the TreeView + case STATIC_TREE: + switch (((LPNMHDR)lParam)->code) { + case TVN_SELCHANGING: + pPs->dwFlags |= PSF_LOCKED; + pPs->pTree->OnSelChanging(); + pPs->dwFlags &= ~PSF_LOCKED; + break; - // - // Notification Messages sent by the TreeView - // - case STATIC_TREE: - switch (((LPNMHDR)lParam)->code) { - case TVN_SELCHANGING: + case TVN_SELCHANGED: + if (pPs->dwFlags & PSF_INITIALIZED) { pPs->dwFlags |= PSF_LOCKED; - pPs->pTree->OnSelChanging(); - pPs->dwFlags &= ~PSF_LOCKED; - break; - - case TVN_SELCHANGED: - if (pPs->dwFlags & PSF_INITIALIZED) { - pPs->dwFlags |= PSF_LOCKED; - pPs->pTree->OnSelChanged((LPNMTREEVIEW)lParam); - if (pPs->pTree->CurrentItem()) { - RECT rc; - POINT pt = { 0, 0 }; - - GetWindowRect(GetDlgItem(hDlg, IDC_PAGETITLE), &rc); - ScreenToClient(hDlg, &pt); - OffsetRect(&rc, pt.x, pt.y); - SetDlgItemText(hDlg, IDC_PAGETITLE, pPs->pTree->CurrentItem()->Label()); - InvalidateRect(GetDlgItem(hDlg, IDC_PAGETITLEBG), &rc, TRUE); - InvalidateRect(hDlg, &rc, TRUE); - } - pPs->dwFlags &= ~PSF_LOCKED; + pPs->pTree->OnSelChanged((LPNMTREEVIEW)lParam); + if (pPs->pTree->CurrentItem()) { + RECT rc; + POINT pt = { 0, 0 }; + + GetWindowRect(GetDlgItem(hDlg, IDC_PAGETITLE), &rc); + ScreenToClient(hDlg, &pt); + OffsetRect(&rc, pt.x, pt.y); + SetDlgItemText(hDlg, IDC_PAGETITLE, pPs->pTree->CurrentItem()->Label()); + InvalidateRect(GetDlgItem(hDlg, IDC_PAGETITLEBG), &rc, TRUE); + InvalidateRect(hDlg, &rc, TRUE); } - break; + pPs->dwFlags &= ~PSF_LOCKED; + } + break; - case TVN_BEGINDRAG: - { - LPNMTREEVIEW nmtv = (LPNMTREEVIEW)lParam; - if (nmtv->itemNew.hItem == TreeView_GetSelection(nmtv->hdr.hwndFrom)) { - SetCapture(hDlg); - pPs->pTree->BeginDrag(nmtv->itemNew.hItem); - } - TreeView_SelectItem(nmtv->hdr.hwndFrom, nmtv->itemNew.hItem); + case TVN_BEGINDRAG: + { + LPNMTREEVIEW nmtv = (LPNMTREEVIEW)lParam; + if (nmtv->itemNew.hItem == TreeView_GetSelection(nmtv->hdr.hwndFrom)) { + SetCapture(hDlg); + pPs->pTree->BeginDrag(nmtv->itemNew.hItem); } - break; - - case TVN_ITEMEXPANDED: - pPs->pTree->AddFlags(PSTVF_STATE_CHANGED); - break; + TreeView_SelectItem(nmtv->hdr.hwndFrom, nmtv->itemNew.hItem); + } + break; - case NM_KILLFOCUS: - KillTimer(hDlg, TIMERID_RENAME); - break; + case TVN_ITEMEXPANDED: + pPs->pTree->AddFlags(PSTVF_STATE_CHANGED); + break; - case NM_CLICK: - { - TVHITTESTINFO hti; - GetCursorPos(&hti.pt); - ScreenToClient(pPs->pTree->Window(), &hti.pt); - TreeView_HitTest(pPs->pTree->Window(), &hti); - if ((hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) && hti.hItem == TreeView_GetSelection(pPs->pTree->Window())) - SetTimer(hDlg, TIMERID_RENAME, 500, NULL); - } - break; + case NM_KILLFOCUS: + KillTimer(hDlg, TIMERID_RENAME); + break; - case NM_RCLICK: - pPs->pTree->PopupMenu(); - return 0; + case NM_CLICK: + { + TVHITTESTINFO hti; + GetCursorPos(&hti.pt); + ScreenToClient(pPs->pTree->Window(), &hti.pt); + TreeView_HitTest(pPs->pTree->Window(), &hti); + if ((hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) && hti.hItem == TreeView_GetSelection(pPs->pTree->Window())) + SetTimer(hDlg, TIMERID_RENAME, 500, NULL); } break; + + case NM_RCLICK: + pPs->pTree->PopupMenu(); + return 0; + } + break; } break; @@ -1445,7 +1426,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar MapWindowPoints(hDlg, pPs->pTree->Window(), &hti.pt, 1); TreeView_HitTest(pPs->pTree->Window(), &hti); - if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { + if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) { // check where over the item, the pointer is RECT rc; if (TreeView_GetItemRect(pPs->pTree->Window(), hti.hItem, &rc, FALSE)) { @@ -1455,8 +1436,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetCursor(LoadCursor(NULL, IDC_ARROW)); TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 0); } - else - if (hti.pt.y + (height / 3) > rc.bottom) { + else if (hti.pt.y + (height / 3) > rc.bottom) { SetCursor(LoadCursor(NULL, IDC_ARROW)); TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 1); } @@ -1497,9 +1477,9 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (hti.flags & TVHT_ABOVE) hti.hItem = TVI_FIRST; - else if (hti.flags & (TVHT_NOWHERE|TVHT_BELOW)) + else if (hti.flags & (TVHT_NOWHERE | TVHT_BELOW)) hti.hItem = TVI_LAST; - else if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { + else if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) { // check where over the item, the pointer is if (!TreeView_GetItemRect(pPs->pTree->Window(), hti.hItem, &rc, FALSE)) { pPs->pTree->EndDrag(); @@ -1570,7 +1550,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (pPs->hContact != NULL) { ResetUpdateInfo(pPs); - mir_snprintf(pPs->szUpdating, SIZEOF(pPs->szUpdating), "%s (%s)", Translate("Updating"), pPs->pszProto); + mir_snprintf(pPs->szUpdating, SIZEOF(pPs->szUpdating), "%s (%s)", Translate("updating"), pPs->pszProto); // need meta contact's subcontact information if (DB::Module::IsMetaAndScan(pPs->pszProto)) { @@ -1580,7 +1560,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar MCONTACT hSubContact = db_mc_getSub(pPs->hContact, i); if (hSubContact != NULL) { if (ProtoServiceExists(DB::Contact::Proto(hSubContact), PSS_GETINFO)) { - pPs->infosUpdated = (TAckInfo*)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo)* (pPs->nSubContacts + 1)); + pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1)); pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact; pPs->infosUpdated[pPs->nSubContacts].acks = NULL; pPs->infosUpdated[pPs->nSubContacts].count = 0; @@ -1605,7 +1585,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } } else if (!CallContactService(pPs->hContact, PSS_GETINFO, NULL, NULL)) { - pPs->infosUpdated = (TAckInfo*)mir_calloc(sizeof(TAckInfo)); + pPs->infosUpdated = (TAckInfo *)mir_calloc(sizeof(TAckInfo)); pPs->infosUpdated[0].hContact = pPs->hContact; pPs->nSubContacts = 1; diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 63231377a0..80b970961c 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -86,7 +86,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) // build contact's menuitems RebuildMenu(); - HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount); + HookEvent(ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount); return 0; } @@ -132,7 +132,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD miranda * * @return array of interfaces **/ - extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_UIUSERINFO, // replace the default userinfo module MIID_SREMAIL, // Send/Receive E-Mail service is provided @@ -161,7 +160,7 @@ extern "C" int __declspec(dllexport) Load(void) // init common controls INITCOMMONCONTROLSEX ccEx; ccEx.dwSize = sizeof(ccEx); - ccEx.dwICC = ICC_WIN95_CLASSES|ICC_DATE_CLASSES; + ccEx.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES; InitCommonControlsEx(&ccEx); ZeroMemory(&myGlobals, sizeof(MGLOBAL)); @@ -178,14 +177,14 @@ extern "C" int __declspec(dllexport) Load(void) result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); if (FIP == NULL || result != S_OK) { - MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); + MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return 1; } if (IsWinVerVistaPlus()) { HMODULE hDwmApi = LoadLibraryA("dwmapi.dll"); if (hDwmApi) - dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled"); + dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi, "DwmIsCompositionEnabled"); } // check for dbx_tree diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index dcc2c3ffc6..4b8388382f 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -32,10 +32,9 @@ typedef struct _ICODESC HICON ghDefIcon = NULL; -static ICODESC icoDesc[] = -{ +static ICODESC icoDesc[] = { // common - { ICO_COMMON_IM, LPGEN("IM Naming"), SECT_COMMON, IDI_MIRANDA, 0 }, + { ICO_COMMON_IM, LPGEN("IM naming"), SECT_COMMON, IDI_MIRANDA, 0 }, { ICO_COMMON_PASSWORD, LPGEN("Password"), SECT_COMMON, IDI_PASSWORD, 0 }, { ICO_COMMON_FEMALE, LPGEN("Female"), SECT_COMMON, IDI_FEMALE, 0 }, { ICO_COMMON_MALE, LPGEN("Male"), SECT_COMMON, IDI_MALE, 0 }, @@ -44,8 +43,8 @@ static ICODESC icoDesc[] = { ICO_COMMON_MARITAL, LPGEN("Marital status"), SECT_COMMON, IDI_MARITAL, 0 }, { ICO_COMMON_ADDRESS, LPGEN("Address"), SECT_COMMON, IDI_TREE_ADDRESS, 0 }, { ICO_COMMON_ANNIVERSARY,LPGEN("Anniversary"), SECT_COMMON, IDI_ANNIVERSARY, 0 }, - - //zodiac + + //zodiac { ICO_ZOD_AQUARIUS, LPGEN("Aquarius"), SECT_COMMON, IDI_ZOD_AQUARIUS, 128 }, { ICO_ZOD_ARIES, LPGEN("Aries"), SECT_COMMON, IDI_ZOD_ARIES, 128 }, { ICO_ZOD_CANCER, LPGEN("Cancer"), SECT_COMMON, IDI_ZOD_CANCER, 128 }, @@ -58,21 +57,21 @@ static ICODESC icoDesc[] = { ICO_ZOD_SCORPIO, LPGEN("Scorpio"), SECT_COMMON, IDI_ZOD_SCORPIO, 128 }, { ICO_ZOD_TAURUS, LPGEN("Taurus"), SECT_COMMON, IDI_ZOD_TAURUS, 128 }, { ICO_ZOD_VIRGO, LPGEN("Virgo"), SECT_COMMON, IDI_ZOD_VIRGO, 128 }, - - // lists - { ICO_LST_MODULES, LPGEN("Export: Modules"), SECT_COMMON, IDI_LST_MODULES, 0 }, - { ICO_LST_FOLDER, LPGEN("Export: Folder"), SECT_COMMON, IDI_LST_FOLDER, 0 }, + + // lists + { ICO_LST_MODULES, LPGEN("Export: modules"), SECT_COMMON, IDI_LST_MODULES, 0 }, + { ICO_LST_FOLDER, LPGEN("Export: folder"), SECT_COMMON, IDI_LST_FOLDER, 0 }, { ICO_TREE_DEFAULT, LPGEN("Default"), SECT_TREE, IDI_LST_FOLDER, 0 }, - - // dialogs - { ICO_DLG_DETAILS, LPGEN("Details info bar"), SECT_DLG, IDI_DLG_DETAILS, 48 }, - { ICO_DLG_PHONE, LPGEN("Phone info bar"), SECT_DLG, IDI_DLG_PHONE, 1 }, - { ICO_DLG_EMAIL, LPGEN("E-Mail info bar"), SECT_DLG, IDI_DLG_EMAIL, 1 }, + + // dialogs + { ICO_DLG_DETAILS, LPGEN("Details info bar"), SECT_DLG, IDI_DLG_DETAILS, 48 }, + { ICO_DLG_PHONE, LPGEN("Phone info bar"), SECT_DLG, IDI_DLG_PHONE, 1 }, + { ICO_DLG_EMAIL, LPGEN("E-mail info bar"), SECT_DLG, IDI_DLG_EMAIL, 1 }, { ICO_DLG_EXPORT, LPGEN("Export VCard"), SECT_DLG, IDI_EXPORT, 1 }, { ICO_DLG_IMPORT, LPGEN("Import VCard"), SECT_DLG, IDI_IMPORT, 1 }, - { ICO_DLG_ANNIVERSARY, LPGEN("Anniversary info bar"), SECT_DLG, IDI_ANNIVERSARY, 1 }, - - // button icons + { ICO_DLG_ANNIVERSARY, LPGEN("Anniversary info bar"), SECT_DLG, IDI_ANNIVERSARY, 1 }, + + // button icons { ICO_BTN_UPDATE, LPGEN("Update"), SECT_BUTTONS, IDI_BTN_UPDATE, 0 }, { ICO_BTN_IMPORT, LPGEN("Import"), SECT_BUTTONS, IDI_IMPORT, 0 }, { ICO_BTN_EXPORT, LPGEN("Export"), SECT_BUTTONS, IDI_EXPORT, 0 }, @@ -83,17 +82,17 @@ static ICODESC icoDesc[] = { ICO_BTN_PHONE, LPGEN("Phone"), SECT_BUTTONS, IDI_BTN_PHONE, 0 }, { ICO_BTN_FAX, LPGEN("Fax"), SECT_BUTTONS, IDI_BTN_FAX, 0 }, { ICO_BTN_CELLULAR, LPGEN("Cellular"), SECT_BUTTONS, IDI_BTN_CELLULAR, 0 }, - { ICO_BTN_CUSTOMPHONE, LPGEN("Custom Phone"), SECT_BUTTONS, IDI_BTN_CUSTOMPHONE, 0 }, - { ICO_BTN_EMAIL, LPGEN("e-mail"), SECT_BUTTONS, IDI_BTN_EMAIL, 0 }, + { ICO_BTN_CUSTOMPHONE, LPGEN("Custom phone"), SECT_BUTTONS, IDI_BTN_CUSTOMPHONE, 0 }, + { ICO_BTN_EMAIL, LPGEN("E-mail"), SECT_BUTTONS, IDI_BTN_EMAIL, 0 }, { ICO_BTN_DOWNARROW, LPGEN("Down arrow"), SECT_BUTTONS, IDI_BTN_DOWNARROW, 0 }, { ICO_BTN_ADD, LPGEN("Add"), SECT_BUTTONS, IDI_BTN_ADD, 0 }, { ICO_BTN_EDIT, LPGEN("Edit"), SECT_BUTTONS, IDI_BTN_EDIT, 0 }, { ICO_BTN_DELETE, LPGEN("Delete"), SECT_BUTTONS, IDI_BTN_DELETE, 0 }, { ICO_BTN_SEARCH, LPGEN("Search"), SECT_BUTTONS, IDI_SEARCH, 0 }, - { ICO_BTN_EXIMPORT, LPGEN("Ex-/Import"), SECT_BUTTONS, IDI_BTN_EXIMPORT, 0 }, - { ICO_BTN_BDAY_BACKUP, LPGEN("Backup Birthday"), SECT_BUTTONS, IDI_BTN_BIRTHDAY_BACKUP, 0 }, - - //birthday and anniversary + { ICO_BTN_EXIMPORT, LPGEN("Export/import"), SECT_BUTTONS, IDI_BTN_EXIMPORT, 0 }, + { ICO_BTN_BDAY_BACKUP, LPGEN("Backup birthday"), SECT_BUTTONS, IDI_BTN_BIRTHDAY_BACKUP, 0 }, + + //birthday and anniversary { ICO_RMD_DTB0, LPGEN("Birthday today"), SECT_REMIND, IDI_RMD_DTB0, 0 }, { ICO_RMD_DTB1, LPGEN("Birthday tomorrow"), SECT_REMIND, IDI_RMD_DTB1, 0 }, { ICO_RMD_DTB2, LPGEN("Birthday in 2 days"), SECT_REMIND, IDI_RMD_DTB2, 0 }, @@ -105,7 +104,7 @@ static ICODESC icoDesc[] = { ICO_RMD_DTB8, LPGEN("Birthday in 8 days"), SECT_REMIND, IDI_RMD_DTB8, 0 }, { ICO_RMD_DTB9, LPGEN("Birthday in 9 days"), SECT_REMIND, IDI_RMD_DTB9, 0 }, { ICO_RMD_DTBX, LPGEN("Birthday later"), SECT_REMIND, IDI_RMD_DTBX, 0 }, - + { ICO_RMD_DTA0, LPGEN("Anniversary today"), SECT_REMIND, IDI_RMD_DTA0, 0 }, { ICO_RMD_DTA1, LPGEN("Anniversary tomorrow"), SECT_REMIND, IDI_RMD_DTA1, 0 }, { ICO_RMD_DTA2, LPGEN("Anniversary in 2 days"), SECT_REMIND, IDI_RMD_DTA2, 0 }, @@ -117,7 +116,7 @@ static ICODESC icoDesc[] = { ICO_RMD_DTA8, LPGEN("Anniversary in 8 days"), SECT_REMIND, IDI_RMD_DTA8, 0 }, { ICO_RMD_DTA9, LPGEN("Anniversary in 9 days"), SECT_REMIND, IDI_RMD_DTA9, 0 }, { ICO_RMD_DTAX, LPGEN("Anniversary later"), SECT_REMIND, IDI_RMD_DTAX, 0 }, -}; +}; /** * This function finds the default iconpack file and return its path. @@ -128,7 +127,7 @@ static ICODESC icoDesc[] = **/ LPTSTR IcoLib_GetDefaultIconFileName() { - static LPTSTR path[] = { + static LPTSTR path[] = { _T("Icons\\uinfoex_icons.dll"), _T("Plugins\\uinfoex_icons.dll"), _T("Customize\\Icons\\uinfoex_icons.dll") @@ -137,7 +136,7 @@ LPTSTR IcoLib_GetDefaultIconFileName() for (int i = 0; i < SIZEOF(path); i++) { PathToAbsoluteT(path[i], absolute); - if ( PathFileExists(absolute)) + if (PathFileExists(absolute)) return path[i]; } return NULL; @@ -164,15 +163,14 @@ static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack) if (hIconDll) { CHAR szFileVersion[64]; - if (!LoadStringA(hIconDll, IDS_ICOPACKVERSION, szFileVersion, sizeof(szFileVersion)) || - mir_strcmp(szFileVersion, "__UserInfoEx_IconPack_1.2__")) - { + if (!LoadStringA(hIconDll, IDS_ICOPACKVERSION, szFileVersion, sizeof(szFileVersion)) + || mir_strcmp(szFileVersion, "__UserInfoEx_IconPack_1.2__")) MsgErr(NULL, LPGENT("Warning: Your current IconPack's version differs from the one UserInfoEx is designed for.\nSome icons may not be displayed correctly")); - } FreeLibrary(hIconDll); } } - else MsgErr(NULL, LPGENT("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!")); + else + MsgErr(NULL, LPGENT("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!")); } } @@ -185,11 +183,11 @@ static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack) * * @return nothing **/ -void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls) +void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls) { for (int i = 0; i < numCtrls; i++) { HICON hIcon = Skin_GetIcon(pCtrl[i].pszIcon); - if (pCtrl[i].idCtrl) { + if (pCtrl[i].idCtrl) { HWND hCtrl = GetDlgItem(hDlg, pCtrl[i].idCtrl); switch (pCtrl[i].Message) { case STM_SETICON: @@ -197,10 +195,11 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls) ShowWindow(hCtrl, hIcon ? SW_SHOW : SW_HIDE); case BM_SETIMAGE: - SendMessage(hCtrl, pCtrl[i].Message, IMAGE_ICON, (LPARAM) hIcon); + SendMessage(hCtrl, pCtrl[i].Message, IMAGE_ICON, (LPARAM)hIcon); } } - else SendMessage(hDlg, pCtrl[i].Message, ICON_BIG, (LPARAM) hIcon); + else + SendMessage(hDlg, pCtrl[i].Message, ICON_BIG, (LPARAM)hIcon); } } @@ -315,7 +314,6 @@ HICON IcoLib_RegisterIcon(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, * * @return nothing **/ - static IconItem main = { LPGEN("Main"), ICO_COMMON_MAIN, IDI_MAIN }; void IcoLib_LoadModule() @@ -326,8 +324,7 @@ void IcoLib_LoadModule() IcoLib_CheckIconPackVersion(szDefaultFile); // load default icon if required - ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); + ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); for (int i = 0; i < SIZEOF(icoDesc); i++) IcoLib_RegisterIconHandleEx( diff --git a/plugins/UserInfoEx/src/mir_icolib.h b/plugins/UserInfoEx/src/mir_icolib.h index cf6a815462..7f726c9964 100644 --- a/plugins/UserInfoEx/src/mir_icolib.h +++ b/plugins/UserInfoEx/src/mir_icolib.h @@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _UINFOEX_ICONS_H_INCLUDED_ 1 // sections -#define SECT_COMMON LPGEN("UserInfoEx") -#define SECT_ZODIAC "UserInfoEx/Zodiacs" -#define SECT_DLG "UserInfoEx/Dialogs" -#define SECT_BUTTONS "UserInfoEx/Buttons" -#define SECT_TREE "UserInfoEx/TreeView" -#define SECT_REMIND "UserInfoEx/Reminder" +#define SECT_COMMON LPGEN("Extended user info") +#define SECT_ZODIAC "Extended user info/Zodiacs" +#define SECT_DLG "Extended user info/Dialogs" +#define SECT_BUTTONS "Extended user info/Buttons" +#define SECT_TREE "Extended user info/Treeview" +#define SECT_REMIND "Extended user info/Reminder" // icons #define ICO_COMMON_MAIN MODNAME"_common_main" diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 4ef12757bf..9a8649f26e 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -111,7 +111,7 @@ void RebuildContact() mi.position = 1000050100; mi.popupPosition = 1000050100; mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT); - mi.pszName = LPGEN("Ex-/Import contact"); + mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddContactMenuItem(&mi); hMenuItem[item++] = mhExIm; mhRoot = HGENMENU_ROOT; @@ -140,14 +140,14 @@ void RebuildContact() // Export mi.pszService = MS_USERINFO_VCARD_EXPORT; - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export User Details"); + mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export user details"); mi.position = 1000050200; 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.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import user details"); mi.position = 1000050300; mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT); hMenuItem[item++] = Menu_AddContactMenuItem(&mi); @@ -209,7 +209,7 @@ void RebuildMain() mi.position = 500050000; mi.popupPosition = 500050000; mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT); - mi.pszName = LPGEN("Ex-/Import contact"); + mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddMainMenuItem(&mi); hMenuItem[item++] = mhExIm; mhRoot = HGENMENU_ROOT; @@ -224,7 +224,7 @@ void RebuildMain() { mi.hParentMenu = mhRoot; mi.pszService = MS_USERINFO_SHOWDIALOG; - mi.pszName = LPGEN("View/Change My &Details..."); + mi.pszName = LPGEN("View/change my &details..."); mi.position = 500050000; mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); @@ -275,7 +275,7 @@ void RebuildMain() } // Refresh Contact Details mi.pszService = MS_USERINFO_REFRESH; - mi.pszName = LPGEN("Refresh Contact Details"); + mi.pszName = LPGEN("Refresh contact details"); mi.position = 500254000; mi.hIcon = Skin_GetIcon(ICO_BTN_UPDATE); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); @@ -354,7 +354,7 @@ void RebuildGroup() mi.position = 250100; mi.popupPosition = 250100; mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT); - mi.pszName = LPGEN("Ex-/Import contact"); + mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddGroupMenuItem(0, &mi); hMenuItem[item++] = mhExIm; mhRoot = HGENMENU_ROOT; @@ -441,7 +441,7 @@ void RebuildSubGroup() mi.position = 1050000; mi.popupPosition = 1050000; mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN); - mi.pszName = LPGEN("Extended UserInfo"); + mi.pszName = LPGEN(MODULELONGNAME); mhRoot = Menu_AddSubGroupMenuItem(0, &mi); hMenuItem[item++] = mhRoot; mhExIm = mhRoot; @@ -451,7 +451,7 @@ void RebuildSubGroup() mi.position = 1050100; mi.popupPosition = 1050100; mi.hIcon = Skin_GetIcon(ICO_BTN_EXIMPORT); - mi.pszName = LPGEN("Ex-/Import Group"); + mi.pszName = LPGEN("Export/import group"); mhExIm = Menu_AddSubGroupMenuItem(0, &mi); hMenuItem[item++] = mhExIm; mhRoot = HGENMENU_ROOT; @@ -468,7 +468,7 @@ void RebuildSubGroup() // Export strcpy( tDest, "/ExportGroup"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export Group"); + mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export group"); mi.position = 1050200; mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT); gmp.lParam=0; @@ -478,7 +478,7 @@ void RebuildSubGroup() // Import strcpy( tDest, "/ImportGroup"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import Group"); + mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import group"); mi.position = 1050300; mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT); gmp.lParam=0; @@ -572,7 +572,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) //cascade all mi.position = 50100; mi.hIcon = Skin_GetIcon(ICO_COMMON_MAIN); - mi.ptszName = TranslateT(MODULELONGNAME); + mi.pszName = LPGEN(MODULELONGNAME); hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi); mhRoot = hMenuItemAccount[mItems*i + item++]; mhExIm = mhRoot; @@ -581,7 +581,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) //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")); + mir_sntprintf(sztName, SIZEOF(sztName), _T("%s %s"), pAccountName->tszAccountName, TranslateT("export/import")); mi.ptszName = sztName; hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi); mhExIm = hMenuItemAccount[mItems*i + item++]; @@ -598,7 +598,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // Export strcpy( tDest, "/ExportAccount"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); - mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Export")); + mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&export")); mi.ptszName = sztName; mi.position = 50200; mi.hIcon = Skin_GetIcon(ICO_BTN_EXPORT); @@ -607,7 +607,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // Import strcpy( tDest, "/ImportAccount"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); - mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&Import")); + mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("&import")); mi.ptszName = sztName; mi.position = 50300; mi.hIcon = Skin_GetIcon(ICO_BTN_IMPORT); diff --git a/plugins/UserInfoEx/src/psp_about.cpp b/plugins/UserInfoEx/src/psp_about.cpp index 7963c6fc8d..aec494654a 100644 --- a/plugins/UserInfoEx/src/psp_about.cpp +++ b/plugins/UserInfoEx/src/psp_about.cpp @@ -31,21 +31,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * @return different values **/ -INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, const CHAR* pszSetting) +INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, const CHAR *pszSetting) { - switch (uMsg) - { + 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); - if ( !lstrcmpA(pszSetting, SET_CONTACT_MYNOTES)) - SetDlgItemText(hDlg, IDC_PAGETITLE, LPGENT("My Notes:")); + if (!lstrcmpA(pszSetting, SET_CONTACT_MYNOTES)) + SetDlgItemText(hDlg, IDC_PAGETITLE, LPGENT("My notes:")); else SetDlgItemText(hDlg, IDC_PAGETITLE, LPGENT("About:")); @@ -55,9 +53,9 @@ INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, // remove static edge in aero mode if (IsAeroMode()) - SetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE)&~WS_EX_STATICEDGE); + SetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); - SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_SETEVENTMASK, 0, /*ENM_KEYEVENTS|*/ENM_LINK|ENM_CHANGE); + SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_SETEVENTMASK, 0, /*ENM_KEYEVENTS | */ENM_LINK | ENM_CHANGE); SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_AUTOURLDETECT, TRUE, NULL); if (!lParam) SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_LIMITTEXT, 1024, NULL); } @@ -68,19 +66,14 @@ INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, { switch (((LPNMHDR)lParam)->idFrom) { - /** - * notification handler for richedit control - **/ + // notification handler for richedit control case EDIT_ABOUT: { - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { - /** - * notification handler for a link within the richedit control - **/ + // notification handler for a link within the richedit control case EN_LINK: - return CEditCtrl::GetObj(((LPNMHDR)lParam)->hwndFrom)->LinkNotificationHandler((ENLINK*)lParam); + return CEditCtrl::GetObj(((LPNMHDR)lParam)->hwndFrom)->LinkNotificationHandler((ENLINK *)lParam); } } return FALSE; @@ -90,8 +83,7 @@ INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, case WM_COMMAND: { - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case EDIT_ABOUT: { if (HIWORD(wParam) == EN_CHANGE) @@ -100,9 +92,7 @@ INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, pResult = CBaseCtrl::GetObj((HWND)lParam); if (PtrIsValid(pResult) && (pResult->_cbSize == sizeof(CBaseCtrl))) - { pResult->OnChangedByUser(HIWORD(wParam)); - } } } } diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index 17a6c8b257..f22af82f76 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -33,11 +33,11 @@ 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) { - MAnnivDate* pDlgEditAnniv = (MAnnivDate*)GetUserData(hDlg); + MAnnivDate *pDlgEditAnniv = (MAnnivDate *)GetUserData(hDlg); switch (uMsg) { case WM_INITDIALOG: - pDlgEditAnniv = (MAnnivDate*)lParam; + pDlgEditAnniv = (MAnnivDate *)lParam; if (!PtrIsValid(pDlgEditAnniv)) break; @@ -77,11 +77,11 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w int len = Edit_GetTextLength(hEdit); LPTSTR pszText; - if (len == 0 || - (pszText = (LPTSTR)_alloca((len + 1) * sizeof(TCHAR))) == NULL || - !Edit_GetText(hEdit, pszText, len + 1)) + 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!")); + MsgErr(hDlg, LPGENT("Please enter a valid description first!")); break; } diff --git a/plugins/UserInfoEx/src/psp_base.cpp b/plugins/UserInfoEx/src/psp_base.cpp index 611783f1c2..6ea57ed3b6 100644 --- a/plugins/UserInfoEx/src/psp_base.cpp +++ b/plugins/UserInfoEx/src/psp_base.cpp @@ -21,16 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -void UpDate_CountryIcon(HWND hCtrl, int countryID) { +void UpDate_CountryIcon(HWND hCtrl, int countryID) +{ HICON hIcon = LoadFlagIcon(countryID); HICON hOld = Static_SetIcon(hCtrl, hIcon); ShowWindow(hCtrl, hIcon ? SW_SHOW : SW_HIDE); Skin_ReleaseIcon(hOld); } -/** - * Default dialog procedure, which handles common functions - **/ +// Default dialog procedure, which handles common functions INT_PTR CALLBACK PSPBaseProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { CCtrlList *pCtrlList; @@ -38,20 +37,18 @@ INT_PTR CALLBACK PSPBaseProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) pCtrlList = CCtrlList::GetObj(hDlg); if (PtrIsValid(pCtrlList)) { switch (uMsg) { - case WM_INITDIALOG: return TRUE; + case WM_INITDIALOG: + return TRUE; - /** - * set propertysheet page's background white in aero mode - **/ + // set propertysheet page's background white in aero mode case WM_CTLCOLORSTATIC: - case WM_CTLCOLORDLG: { + case WM_CTLCOLORDLG: + { if (IsAeroMode()) return (INT_PTR)GetStockBrush(WHITE_BRUSH); } break; - /** - * Set text color of edit boxes according to the source of information they display. - **/ + // Set text color of edit boxes according to the source of information they display. case WM_CTLCOLOREDIT: return pCtrlList->OnSetTextColour((HWND)lParam, (HDC)wParam); diff --git a/plugins/UserInfoEx/src/psp_company.cpp b/plugins/UserInfoEx/src/psp_company.cpp index eebe42ceda..924b69f1da 100644 --- a/plugins/UserInfoEx/src/psp_company.cpp +++ b/plugins/UserInfoEx/src/psp_company.cpp @@ -33,13 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ INT_PTR CALLBACK PSPProcCompany(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); - if (pCtrlList) - { + if (pCtrlList) { LPIDSTRLIST pList; UINT nList; HFONT hBoldFont; @@ -48,17 +46,17 @@ INT_PTR CALLBACK PSPProcCompany(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TranslateDialogDefault(hDlg); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_COMPANY, SET_CONTACT_COMPANY, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_DEPARTMENT, SET_CONTACT_COMPANY_DEPARTMENT, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_OFFICE, SET_CONTACT_COMPANY_OFFICE, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_POSITION, SET_CONTACT_COMPANY_POSITION, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_SUPERIOR, SET_CONTACT_COMPANY_SUPERIOR, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ASSISTENT, SET_CONTACT_COMPANY_ASSISTENT, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_COMPANY, SET_CONTACT_COMPANY, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_DEPARTMENT, SET_CONTACT_COMPANY_DEPARTMENT, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_OFFICE, SET_CONTACT_COMPANY_OFFICE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_POSITION, SET_CONTACT_COMPANY_POSITION, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_SUPERIOR, SET_CONTACT_COMPANY_SUPERIOR, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ASSISTENT, SET_CONTACT_COMPANY_ASSISTENT, DBVT_TCHAR)); GetOccupationList(&nList, &pList); - pCtrlList->insert( CCombo::CreateObj(hDlg, EDIT_OCCUPATION, SET_CONTACT_COMPANY_OCCUPATION, DBVT_WORD, pList, nList)); + pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_OCCUPATION, SET_CONTACT_COMPANY_OCCUPATION, DBVT_WORD, pList, nList)); } } } return PSPBaseProc(hDlg, uMsg, wParam, lParam); -} +} diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp index c01c6c6257..467e0dc03c 100644 --- a/plugins/UserInfoEx/src/psp_contact.cpp +++ b/plugins/UserInfoEx/src/psp_contact.cpp @@ -33,13 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); - if (pCtrlList) - { + if (pCtrlList) { TCHAR szAddr[MAX_PATH]; MCONTACT hContact = lParam; LPIDSTRLIST pList; @@ -49,19 +47,19 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM PSGetBoldFont(hDlg, hBoldFont); SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0); - mir_sntprintf(szAddr, MAX_PATH, _T("%s (%s)"), TranslateT("Address"), TranslateT("Home")); + mir_sntprintf(szAddr, MAX_PATH, _T("%s (%s)"), TranslateT("Address"), TranslateT("home")); SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr); - SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in Browser"), MBBF_TCHAR); + SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR); TranslateDialogDefault(hDlg); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_STREET, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_CITY, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ZIP, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_STATE, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_HOMEPAGE, SET_CONTACT_HOMEPAGE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_STREET, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_CITY, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ZIP, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_STATE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_HOMEPAGE, SET_CONTACT_HOMEPAGE, DBVT_TCHAR)); GetCountryList(&nList, &pList); - pCtrlList->insert( CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_COUNTRY, DBVT_WORD, pList, nList)); + pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_COUNTRY, DBVT_WORD, pList, nList)); break; } @@ -70,21 +68,20 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_NOTIFY: { - switch (((LPNMHDR)lParam)->idFrom) - { + switch (((LPNMHDR)lParam)->idFrom) { case 0: { MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; HWND hCtrl; - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: { BYTE bChanged = 0; - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; // phone numbers hCtrl = GetDlgItem(hDlg, EDIT_PHONE); @@ -107,7 +104,8 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case PSN_APPLY: { - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; hCtrl = GetDlgItem(hDlg, EDIT_PHONE); CtrlContactWriteItemToDB(hCtrl, hContact, USERINFO, pszProto, SET_CONTACT_PHONE); @@ -147,21 +145,14 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_COMMAND: { - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case EDIT_HOMEPAGE: - { - if (HIWORD(wParam) == EN_UPDATE) - { - EnableWindow(GetDlgItem(hDlg, BTN_GOTO), GetWindowTextLength((HWND)lParam) > 0); - } - } + if (HIWORD(wParam) == EN_UPDATE) + EnableWindow(GetDlgItem(hDlg, BTN_GOTO), GetWindowTextLength((HWND)lParam) > 0); break; case BTN_GOTO: - { - CEditCtrl::GetObj(hDlg, EDIT_HOMEPAGE)->OpenUrl(); - } + CEditCtrl::GetObj(hDlg, EDIT_HOMEPAGE)->OpenUrl(); break; case EDIT_COUNTRY: @@ -188,8 +179,7 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM **/ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); @@ -204,40 +194,39 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM PSGetBoldFont(hDlg, hBoldFont); SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0); - mir_sntprintf(szAddr, MAX_PATH, _T("%s (%s)"), TranslateT("Address & Contact"), TranslateT("Company")); + mir_sntprintf(szAddr, MAX_PATH, _T("%s (%s)"), TranslateT("Address and contact"), TranslateT("company")); SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr); - SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in Browser"), MBBF_TCHAR); + SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR); TranslateDialogDefault(hDlg); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_COMPANY_STREET, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_COMPANY_CITY, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_COMPANY_ZIP, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_COMPANY_STATE, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_COMPANY_STREET, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_COMPANY_CITY, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_COMPANY_ZIP, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_COMPANY_STATE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE, DBVT_TCHAR)); GetCountryList(&nList, &pList); - pCtrlList->insert( CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_COMPANY_COUNTRY, DBVT_WORD, pList, nList)); + pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_COMPANY_COUNTRY, DBVT_WORD, pList, nList)); } } break; case WM_NOTIFY: { - switch (((LPNMHDR)lParam)->idFrom) - { + switch (((LPNMHDR)lParam)->idFrom) { case 0: { MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; HWND hCtrl; - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: { BYTE bChanged = 0; - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; // phone numbers hCtrl = GetDlgItem(hDlg, EDIT_PHONE); @@ -260,7 +249,8 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case PSN_APPLY: { - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; hCtrl = GetDlgItem(hDlg, EDIT_PHONE); CtrlContactWriteItemToDB(hCtrl, hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_PHONE); @@ -300,21 +290,14 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_COMMAND: { - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case EDIT_HOMEPAGE: - { - if (HIWORD(wParam) == EN_UPDATE) - { - EnableWindow(GetDlgItem(hDlg, BTN_GOTO), GetWindowTextLength((HWND)lParam) > 0); - } - } + if (HIWORD(wParam) == EN_UPDATE) + EnableWindow(GetDlgItem(hDlg, BTN_GOTO), GetWindowTextLength((HWND)lParam) > 0); break; case BTN_GOTO: - { - CEditCtrl::GetObj(hDlg, EDIT_HOMEPAGE)->OpenUrl(); - } + CEditCtrl::GetObj(hDlg, EDIT_HOMEPAGE)->OpenUrl(); break; case EDIT_COUNTRY: diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp index 44aa65c843..e01e8cecee 100644 --- a/plugins/UserInfoEx/src/psp_general.cpp +++ b/plugins/UserInfoEx/src/psp_general.cpp @@ -33,13 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); - if (pCtrlList) - { + if (pCtrlList) { LPIDSTRLIST pList; UINT nList; HFONT hBoldFont; @@ -48,13 +46,13 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0); TranslateDialogDefault(hDlg); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_TITLE, SET_CONTACT_TITLE, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_FIRSTNAME, SET_CONTACT_FIRSTNAME, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_SECONDNAME, SET_CONTACT_SECONDNAME, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_LASTNAME, SET_CONTACT_LASTNAME, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_NICK, SET_CONTACT_NICK, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_DISPLAYNAME, "CList", SET_CONTACT_MYHANDLE, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_PARTNER, SET_CONTACT_PARTNER, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_TITLE, SET_CONTACT_TITLE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_FIRSTNAME, SET_CONTACT_FIRSTNAME, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_SECONDNAME, SET_CONTACT_SECONDNAME, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_LASTNAME, SET_CONTACT_LASTNAME, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_NICK, SET_CONTACT_NICK, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_DISPLAYNAME, "CList", SET_CONTACT_MYHANDLE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_PARTNER, SET_CONTACT_PARTNER, DBVT_TCHAR)); GetNamePrefixList(&nList, &pList); pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_PREFIX, SET_CONTACT_PREFIX, DBVT_BYTE, pList, nList)); @@ -73,28 +71,23 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_NOTIFY: { - switch (((LPNMHDR)lParam)->idFrom) - { + switch (((LPNMHDR)lParam)->idFrom) { case 0: { MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; char* pszProto; - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: { BYTE bEnable; DBVARIANT dbv; CCtrlFlags Flags; - if (PSGetBaseProto(hDlg, pszProto) && *pszProto) - { + if (PSGetBaseProto(hDlg, pszProto) && *pszProto) { Flags.W = DB::Setting::GetTStringCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv); - if (Flags.B.hasCustom || Flags.B.hasProto || Flags.B.hasMeta) - { - if (dbv.type == DBVT_BYTE) - { + if (Flags.B.hasCustom || Flags.B.hasProto || Flags.B.hasMeta) { + if (dbv.type == DBVT_BYTE) { CheckDlgButton(hDlg, RADIO_FEMALE, (dbv.bVal == 'F')); CheckDlgButton(hDlg, RADIO_MALE, (dbv.bVal == 'M')); @@ -103,9 +96,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar EnableWindow(GetDlgItem(hDlg, RADIO_MALE), bEnable); } else - { db_free(&dbv); - } } } } @@ -113,9 +104,10 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case PSN_APPLY: { - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; - // gender + // gender { BYTE gender = SendDlgItemMessage(hDlg, RADIO_FEMALE, BM_GETCHECK, NULL, NULL) @@ -124,7 +116,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ? 'M' : 0; - if (gender) + if (gender) db_set_b(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER, gender); else db_unset(hContact, hContact ? USERINFO : pszProto, SET_CONTACT_GENDER); @@ -135,9 +127,9 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { - { ICO_COMMON_FEMALE, STM_SETIMAGE, ICO_FEMALE }, - { ICO_COMMON_MALE, STM_SETIMAGE, ICO_MALE }, - { ICO_COMMON_MARITAL, STM_SETIMAGE, ICO_MARITAL }, + { ICO_COMMON_FEMALE, STM_SETIMAGE, ICO_FEMALE }, + { ICO_COMMON_MALE, STM_SETIMAGE, ICO_MALE }, + { ICO_COMMON_MARITAL, STM_SETIMAGE, ICO_MARITAL }, }; IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon)); } @@ -152,44 +144,35 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar MCONTACT hContact; LPCSTR pszProto; - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case RADIO_FEMALE: { - if (!PspIsLocked(hDlg) && HIWORD(wParam) == BN_CLICKED) - { + if (!PspIsLocked(hDlg) && HIWORD(wParam) == BN_CLICKED) { DBVARIANT dbv; PSGetContact(hDlg, hContact); PSGetBaseProto(hDlg, pszProto); - if (!DB::Setting::GetAsIsCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv) || - dbv.type != DBVT_BYTE || - (dbv.bVal != 'F' && SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL)) - ) - { + if (!DB::Setting::GetAsIsCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv) + || dbv.type != DBVT_BYTE + || (dbv.bVal != 'F' && SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL))) SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL); - } } } break; case RADIO_MALE: { - if (!PspIsLocked(hDlg) && HIWORD(wParam) == BN_CLICKED) - { + if (!PspIsLocked(hDlg) && HIWORD(wParam) == BN_CLICKED) { DBVARIANT dbv; PSGetContact(hDlg, hContact); PSGetBaseProto(hDlg, pszProto); - if (!DB::Setting::GetAsIsCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv) || - dbv.type != DBVT_BYTE || - (dbv.bVal != 'M' && SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL)) - ) - { + if (!DB::Setting::GetAsIsCtrl(hContact, USERINFO, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv) + || dbv.type != DBVT_BYTE + || (dbv.bVal != 'M' && SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL))) SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL); - } } } } diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 2dc997080b..553ccc1623 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -21,21 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -#define PSM_ENABLE_TABITEM (WM_USER+106) - -static MenuOptionsList ctrl_Menu[]= -{ - {SET_MI_MAIN, CHECK_OPT_MI_MAIN, RADIO_OPT_MI_MAIN_NONE, RADIO_OPT_MI_MAIN_ALL, RADIO_OPT_MI_MAIN_EXIMPORT}, - {SET_MI_CONTACT, CHECK_OPT_MI_CONTACT, RADIO_OPT_MI_CONTACT_NONE, RADIO_OPT_MI_CONTACT_ALL, RADIO_OPT_MI_CONTACT_EXIMPORT}, - {SET_MI_GROUP, CHECK_OPT_MI_GROUP, RADIO_OPT_MI_GROUP_NONE, RADIO_OPT_MI_GROUP_ALL, RADIO_OPT_MI_GROUP_EXIMPORT}, - {SET_MI_SUBGROUP, CHECK_OPT_MI_SUBGROUP, RADIO_OPT_MI_SUBGROUP_NONE, RADIO_OPT_MI_SUBGROUP_ALL, RADIO_OPT_MI_SUBGROUP_EXIMPORT}, - {SET_MI_ACCOUNT, CHECK_OPT_MI_ACCOUNT, RADIO_OPT_MI_ACCOUNT_NONE, RADIO_OPT_MI_ACCOUNT_ALL, RADIO_OPT_MI_ACCOUNT_EXIMPORT}, +#define PSM_ENABLE_TABITEM (WM_USER+106) + +static MenuOptionsList ctrl_Menu[] = { + { SET_MI_MAIN, CHECK_OPT_MI_MAIN, RADIO_OPT_MI_MAIN_NONE, RADIO_OPT_MI_MAIN_ALL, RADIO_OPT_MI_MAIN_EXIMPORT }, + { SET_MI_CONTACT, CHECK_OPT_MI_CONTACT, RADIO_OPT_MI_CONTACT_NONE, RADIO_OPT_MI_CONTACT_ALL, RADIO_OPT_MI_CONTACT_EXIMPORT }, + { SET_MI_GROUP, CHECK_OPT_MI_GROUP, RADIO_OPT_MI_GROUP_NONE, RADIO_OPT_MI_GROUP_ALL, RADIO_OPT_MI_GROUP_EXIMPORT }, + { SET_MI_SUBGROUP, CHECK_OPT_MI_SUBGROUP, RADIO_OPT_MI_SUBGROUP_NONE, RADIO_OPT_MI_SUBGROUP_ALL, RADIO_OPT_MI_SUBGROUP_EXIMPORT }, + { SET_MI_ACCOUNT, CHECK_OPT_MI_ACCOUNT, RADIO_OPT_MI_ACCOUNT_NONE, RADIO_OPT_MI_ACCOUNT_ALL, RADIO_OPT_MI_ACCOUNT_EXIMPORT }, }; -/** - * - * - **/ static FORCEINLINE void NotifyParentOfChange(HWND hDlg) { SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); @@ -54,39 +49,25 @@ static void SendNotify_InfoChanged(HWND hDlg) // send info changed message pshn.hdr.code = PSN_INFOCHANGED; - SendMessage(hDlg, WM_NOTIFY, NULL, (LPARAM)&pshn); + SendMessage(hDlg, WM_NOTIFY, NULL, (LPARAM)&pshn); } -/** - * - * - **/ static int FORCEINLINE ComboBox_FindByItemDataPtr(HWND hCombo, LPARAM pData) { int nItemIndex; - for (nItemIndex = ComboBox_GetCount(hCombo); - (nItemIndex >= 0) && (ComboBox_GetItemData(hCombo, nItemIndex) != pData); - nItemIndex--); + for (nItemIndex = ComboBox_GetCount(hCombo); (nItemIndex >= 0) && (ComboBox_GetItemData(hCombo, nItemIndex) != pData); nItemIndex--); return nItemIndex; } -/** - * - * - **/ static void FORCEINLINE ComboBox_SetCurSelByItemDataPtr(HWND hCombo, LPARAM pData) { - ComboBox_SetCurSel(hCombo, ComboBox_FindByItemDataPtr(hCombo, pData)); + ComboBox_SetCurSel(hCombo, ComboBox_FindByItemDataPtr(hCombo, pData)); } -/** - * - * - **/ static void FORCEINLINE ComboBox_AddItemWithData(HWND hCombo, LPTSTR ptszText, LPARAM pData) { - ComboBox_SetItemData(hCombo, ComboBox_AddString(hCombo, TranslateTS(ptszText)), pData); + ComboBox_SetItemData(hCombo, ComboBox_AddString(hCombo, TranslateTS(ptszText)), pData); } /** @@ -118,8 +99,7 @@ static BYTE InitialEnableControls(HWND hDlg, const int *idCtrl, int countCtrl, B { HWND hCtrl; - while (countCtrl-- > 0) - { + while (countCtrl-- > 0) { hCtrl = GetDlgItem(hDlg, idCtrl[countCtrl]); EnableWindow(hCtrl, IsWindowEnabled(hCtrl) && bEnabled); } @@ -138,10 +118,8 @@ static BYTE InitialEnableControls(HWND hDlg, const int *idCtrl, int countCtrl, B **/ static BYTE EnableControls(HWND hDlg, const int *idCtrl, int countCtrl, BYTE bEnabled) { - while (countCtrl-- > 0) - { + while (countCtrl-- > 0) EnableDlgItem(hDlg, idCtrl[countCtrl], bEnabled); - } return bEnabled; } @@ -177,7 +155,7 @@ static BYTE DBWriteCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting) BYTE val = IsDlgButtonChecked(hDlg, idCtrl); int Temp = db_get_b(NULL, MODNAME, pszSetting, 0); Temp &= ~1; - db_set_b(NULL, MODNAME, pszSetting, Temp |= val ); + db_set_b(NULL, MODNAME, pszSetting, Temp |= val); return val; } @@ -232,9 +210,7 @@ static BYTE DBWriteEditByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE v = (BYTE)GetDlgItemInt(hDlg, idCtrl, &t, FALSE); if (t && (v != db_get_b(NULL, MODNAME, pszSetting, defVal))) - { return db_set_b(NULL, MODNAME, pszSetting, v) == 0; - } return FALSE; } @@ -259,7 +235,6 @@ static BYTE DBWriteEditWord(HWND hDlg, const int idCtrl, LPCSTR pszSetting, WORD v = (WORD)GetDlgItemInt(hDlg, idCtrl, &t, FALSE); if (t && (v != db_get_w(NULL, MODNAME, pszSetting, defVal))) return db_set_w(NULL, MODNAME, pszSetting, v) == 0; - return FALSE; } @@ -282,15 +257,13 @@ static BYTE DBWriteComboByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYT v = (BYTE)SendDlgItemMessage(hDlg, idCtrl, CB_GETCURSEL, NULL, NULL); if (v != db_get_b(NULL, MODNAME, pszSetting, defVal)) - { return db_set_b(NULL, MODNAME, pszSetting, v) == 0; - } return FALSE; } static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static BYTE bInitialized = 0; + static BYTE bInitialized = 0; switch (uMsg) { case WM_INITDIALOG: @@ -312,8 +285,10 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, EnableControls(hDlg, idEnable, SIZEOF(idEnable), DBGetCheckBtn(hDlg, ctrl_Menu[i].idCheckbox, ctrl_Menu[i].pszKey, 0)); // set radio button state int id = ctrl_Menu[i].idNONE; //default - if ((flag & 4) == 4) id = ctrl_Menu[i].idALL; - else if ((flag & 8) == 8) id = ctrl_Menu[i].idEXIMPORT; + if ((flag & 4) == 4) + id = ctrl_Menu[i].idALL; + else if ((flag & 8) == 8) + id = ctrl_Menu[i].idEXIMPORT; CheckRadioButton(hDlg, ctrl_Menu[i].idNONE, ctrl_Menu[i].idEXIMPORT, id); } } @@ -365,8 +340,10 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, FlagsClistChange |= SvcPhoneEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_PHONEICON), true); FlagsClistChange |= SvcGenderEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER), true); - if (FlagsClistChange) pcli->pfnSetAllExtraIcons(NULL); - if (FlagsMsgWndChange) UpdateStatusIcons(); + if (FlagsClistChange) + pcli->pfnSetAllExtraIcons(NULL); + if (FlagsMsgWndChange) + UpdateStatusIcons(); // misc BYTE bEnabled = IsDlgButtonChecked(hDlg, CHECK_OPT_ZODIACAVATAR); @@ -426,7 +403,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static BYTE bInitialized = 0; + static BYTE bInitialized = 0; switch (uMsg) { case WM_INITDIALOG: @@ -531,7 +508,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam static INT_PTR CALLBACK DlgProc_DetailsDlgOpts(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static BYTE bInitialized = 0; + static BYTE bInitialized = 0; switch (uMsg) { case WM_INITDIALOG: @@ -614,7 +591,7 @@ static INT_PTR CALLBACK DlgProc_DetailsDlgOpts(HWND hDlg, UINT uMsg, WPARAM wPar static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static BYTE bInitialized = 0; + static BYTE bInitialized = 0; switch (uMsg) { case WM_INITDIALOG: @@ -637,7 +614,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam ComboBox_AddString(hCtrl, TranslateT("Reminder disabled")); ComboBox_AddString(hCtrl, TranslateT("Anniversaries only")); ComboBox_AddString(hCtrl, TranslateT("Bithdays only")); - ComboBox_AddString(hCtrl, TranslateT("everything")); + ComboBox_AddString(hCtrl, TranslateT("Everything")); } if (hCtrl = GetDlgItem(hDlg, EDIT_BIRTHMODULE)) { ComboBox_AddString(hCtrl, TranslateT("mBirthday")); @@ -720,7 +697,8 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam SvcReminderEnable(FALSE); bReminderCheck = FALSE; } - else bReminderCheck = TRUE; + else + bReminderCheck = TRUE; } // update all contact list extra icons @@ -762,9 +740,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam NotifyParentOfChange(hDlg); break; - /* - * The user changes the number of days in advance of an anniversary to be notified by popups and clist extra icon. - */ + // The user changes the number of days in advance of an anniversary to be notified by popups and clist extra icon. case EDIT_REMIND: if (bInitialized && HIWORD(wParam) == EN_UPDATE) { BOOL t; @@ -774,9 +750,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam } break; - /* - * The user changes the number of days in advance of an anniversary to be notified by sound. - */ + // The user changes the number of days in advance of an anniversary to be notified by sound. case EDIT_REMIND_SOUNDOFFSET: if (bInitialized && HIWORD(wParam) == EN_UPDATE) { BOOL t; @@ -786,9 +760,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam } break; - /* - * The user changes the notification interval - */ + // The user changes the notification interval case EDIT_REMIND2: if (bInitialized && HIWORD(wParam) == EN_UPDATE) { BOOL t; @@ -803,9 +775,9 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static BYTE bInitialized = 0; + static BYTE bInitialized = 0; - switch (uMsg) { + switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hDlg); SendNotify_InfoChanged(hDlg); @@ -891,20 +863,20 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR DBWriteColor(hDlg, CLR_BBACK, SET_POPUP_BIRTHDAY_COLOR_BACK); DBWriteColor(hDlg, CLR_BTEXT, SET_POPUP_BIRTHDAY_COLOR_TEXT); db_set_b(NULL, MODNAME, SET_POPUP_BIRTHDAY_COLORTYPE, - SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL) - ? POPUP_COLOR_DEFAULT - : SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL) - ? POPUP_COLOR_WINDOWS + SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_DEFCLR, BM_GETCHECK, NULL, NULL) + ? POPUP_COLOR_DEFAULT + : SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_WINCLR, BM_GETCHECK, NULL, NULL) + ? POPUP_COLOR_WINDOWS : POPUP_COLOR_CUSTOM); // save popup style for anniversaries DBWriteColor(hDlg, CLR_ABACK, SET_POPUP_ANNIVERSARY_COLOR_BACK); DBWriteColor(hDlg, CLR_ATEXT, SET_POPUP_ANNIVERSARY_COLOR_TEXT); db_set_b(NULL, MODNAME, SET_POPUP_ANNIVERSARY_COLORTYPE, - SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL) - ? POPUP_COLOR_DEFAULT - : SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL) - ? POPUP_COLOR_WINDOWS + SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_ADEFCLR, BM_GETCHECK, NULL, NULL) + ? POPUP_COLOR_DEFAULT + : SendDlgItemMessage(hDlg, CHECK_OPT_POPUP_AWINCLR, BM_GETCHECK, NULL, NULL) + ? POPUP_COLOR_WINDOWS : POPUP_COLOR_CUSTOM); // save delay @@ -915,7 +887,8 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR GetDlgItemText(hDlg, EDIT_DELAY, szDelay, SIZEOF(szDelay)); db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)_tcstol(szDelay, NULL, 10)); } - else db_unset(NULL, MODNAME, SET_POPUP_DELAY); + else + db_unset(NULL, MODNAME, SET_POPUP_DELAY); } break; @@ -968,14 +941,14 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR case CHECK_OPT_POPUP_ENABLED: if (HIWORD(wParam) == BN_CLICKED) { const BOOL bEnabled = SendMessage((HWND)lParam, BM_GETCHECK, NULL, NULL); - const int idCtrl[] = { - CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR, - CLR_BBACK, TXT_OPT_POPUP_CLR_BACK, + const int idCtrl[] = { + CHECK_OPT_POPUP_DEFCLR, CHECK_OPT_POPUP_WINCLR, + CLR_BBACK, TXT_OPT_POPUP_CLR_BACK, CLR_BTEXT, TXT_OPT_POPUP_CLR_TEXT, CHECK_OPT_POPUP_ADEFCLR, CHECK_OPT_POPUP_AWINCLR, CLR_ABACK, TXT_OPT_POPUP_CLR_ABACK, CLR_ATEXT, TXT_OPT_POPUP_CLR_ATEXT, - RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM, + RADIO_OPT_POPUP_DEFAULT, RADIO_OPT_POPUP_CUSTOM, RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY }; @@ -1074,7 +1047,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 95400; odp.hInstance = ghInst; - odp.pszTitle = MODNAME; + odp.pszTitle = LPGEN(MODULELONGNAME); odp.pszGroup = LPGEN("Contacts"); odp.cbSize = sizeof(odp); @@ -1093,7 +1066,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM lParam) Options_AddPage(wParam, &odp); // Details Dialog page - odp.pszTab = LPGEN("Details Dialog"); + odp.pszTab = LPGEN("Details dialog"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DETAILSDLG); odp.pfnDlgProc = DlgProc_DetailsDlgOpts; odp.flags = ODPF_BOLDGROUPS; @@ -1108,7 +1081,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM lParam) // Popups page if (ServiceExists(MS_POPUP_ADDPOPUPT)) { - odp.pszTitle = MODNAME; + odp.pszTitle = LPGEN(MODULELONGNAME); odp.pszGroup = LPGEN("Popups"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP); odp.pfnDlgProc = DlgProc_Popups; diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 5c455e2a78..5d435f4e7d 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -19,9 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** - * System Includes: - **/ #include "commonheaders.h" /** @@ -36,13 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { + switch (uMsg) { case WM_INITDIALOG: { CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg); - if (pCtrlList) - { + if (pCtrlList) { LPIDSTRLIST pList; UINT nList; @@ -53,52 +48,46 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hDlg); SetTimer(hDlg, 1, 5000, NULL); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_ORIGIN_CITY, DBVT_TCHAR)); - pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_ORIGIN_STATE, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_CITY, SET_CONTACT_ORIGIN_CITY, DBVT_TCHAR)); + pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STATE, SET_CONTACT_ORIGIN_STATE, DBVT_TCHAR)); GetCountryList(&nList, &pList); - pCtrlList->insert(CCombo::CreateObj (hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList)); + pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList)); - pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL)); + pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL)); } } break; case WM_NOTIFY: { - switch (((LPNMHDR) lParam)->idFrom) - { + switch (((LPNMHDR) lParam)->idFrom) { case 0: { MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; - switch (((LPNMHDR) lParam)->code) - { + switch (((LPNMHDR) lParam)->code) { case PSN_INFOCHANGED: { BYTE bChanged = 0; - if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) break; + if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0) + break; - if (hContact) - { + if (hContact) { MTime mt; - if (mt.DBGetStamp(hContact, USERINFO, SET_CONTACT_ADDEDTIME) && strstr(pszProto, "ICQ")) - { + if (mt.DBGetStamp(hContact, USERINFO, SET_CONTACT_ADDEDTIME) && strstr(pszProto, "ICQ")) { DWORD dwStamp; dwStamp = DB::Contact::WhenAdded(db_get_dw(hContact, pszProto, "UIN", 0), pszProto); if (dwStamp > 0) - { mt.FromStampAsUTC(dwStamp); - } } - if (mt.IsValid()) - { + if (mt.IsValid()) { TCHAR szTime[MAX_PATH]; LPTSTR ptr; @@ -119,8 +108,8 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { - { ICO_COMMON_ADDRESS, STM_SETIMAGE, ICO_ADDRESS }, - { ICO_COMMON_CLOCK, STM_SETIMAGE, ICO_CLOCK }, + { ICO_COMMON_ADDRESS, STM_SETIMAGE, ICO_ADDRESS }, + { ICO_COMMON_CLOCK, STM_SETIMAGE, ICO_CLOCK }, }; IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon)); @@ -133,8 +122,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case WM_COMMAND: { - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case EDIT_COUNTRY: if (HIWORD(wParam) == CBN_SELCHANGE) { LPIDSTRLIST pd = (LPIDSTRLIST)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); @@ -154,9 +142,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara } case WM_DESTROY: - { - KillTimer(hDlg, 1); - } + KillTimer(hDlg, 1); } return PSPBaseProc(hDlg, uMsg, wParam, lParam); } diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index 11a1b73eaf..99c54b83d0 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -19,61 +19,57 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** - * system & local includes - **/ - #include "commonheaders.h" #define LVF_EDITLABEL 8 -#define CELIF_CUSTOM 8 // entry is userdefined (e.g. MyPhoneXX) -#define CELIF_SMS 16 // phone with ability to receive sms -#define LIF_TIPVISIBLE 32 // set if infotip is visible +#define CELIF_CUSTOM 8 // entry is userdefined (e.g. MyPhoneXX) +#define CELIF_SMS 16 // phone with ability to receive sms +#define LIF_TIPVISIBLE 32 // set if infotip is visible typedef struct TCECListItem : CTRL { - LPIDSTRLIST idstrList; - int idstrListCount; - int iListItem; - LPTSTR pszText[2]; + LPIDSTRLIST idstrList; + int idstrListCount; + int iListItem; + LPTSTR pszText[2]; } LCITEM, *LPLCITEM; typedef struct TListCtrl : CTRL { - HWND hList; - HWND hTip; - POINT ptTip; - int iHotItem; - int iHotSubItem; - HFONT hFont; + HWND hList; + HWND hTip; + POINT ptTip; + int iHotItem; + int iHotSubItem; + HFONT hFont; struct { - HWND hEdit; // handle to edit window - HWND hBtn; // button to open dropdown list - RECT rcCombo; + HWND hEdit; // handle to edit window + HWND hBtn; // button to open dropdown list + RECT rcCombo; struct { - HWND hDrop; // dropdown list - int iItem; // currently selected item of the dropdown - } dropDown; - LPLCITEM pItem; // the item beiing edited - int iItem; // zero based index to item in the listview - int iSubItem; // zero based index to subitem - int iTopIndex; // zero based index to first visible item on list + HWND hDrop; // dropdown list + int iItem; // currently selected item of the dropdown + } dropDown; + LPLCITEM pItem; // the item beiing edited + int iItem; // zero based index to item in the listview + int iSubItem; // zero based index to subitem + int iTopIndex; // zero based index to first visible item on list } labelEdit; } LISTCTRL, *LPLISTCTRL; typedef int (*MISERVICE)(WPARAM wParam, LPARAM lParam); typedef struct TProfileEntries { - LPTSTR szGroup; - LPCSTR szCatFmt; - LPCSTR szValFmt; - MIRANDASERVICE GetList; + LPTSTR szGroup; + LPCSTR szCatFmt; + LPCSTR szValFmt; + MIRANDASERVICE GetList; } PROFILEENTRY, *LPPROFILEENTRY; static const PROFILEENTRY pFmt[3] = { - { LPGENT("Past"), "Past%d", "Past%dText", (MIRANDASERVICE)GetPastList }, - { LPGENT("Affiliation"),"Affiliation%d", "Affiliation%dText", (MIRANDASERVICE)GetAffiliationsList }, - { LPGENT("Interest"), "Interest%dCat", "Interest%dText", (MIRANDASERVICE)GetInterestsList } + { LPGENT("Past"), "Past%d", "Past%dText", (MIRANDASERVICE)GetPastList }, + { LPGENT("Affiliation"), "Affiliation%d", "Affiliation%dText", (MIRANDASERVICE)GetAffiliationsList }, + { LPGENT("Interest"), "Interest%dCat", "Interest%dText", (MIRANDASERVICE)GetInterestsList } }; static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -95,7 +91,7 @@ extern COLORREF clrMeta; static int ProfileList_AddGroup(HWND hList, LPTSTR pszText, int iItem) { LVITEM lvi; - lvi.mask = LVIF_TEXT|LVIF_PARAM; + lvi.mask = LVIF_TEXT | LVIF_PARAM; lvi.iItem = iItem; lvi.iSubItem = 0; lvi.pszText = pszText; @@ -137,7 +133,8 @@ static LPLCITEM ProfileList_GetItemData(HWND hList, int iItem) { LVITEM lvi; - if (iItem < 0) return NULL; + if (iItem < 0) + return NULL; lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = iItem; @@ -199,7 +196,6 @@ static void ProfileList_Clear(HWND hList) * bSave - tells, whether to save changes (TRUE) or not (FALSE) * return: returns 0 on success or nonzero **/ - static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) { HWND hEdit; @@ -235,8 +231,7 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem] = szEdit; bChanged = TRUE; } - else - if (_tcscmp(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem], szEdit)) { + else if (_tcscmp(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem], szEdit)) { mir_free(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem]); pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem] = szEdit; bChanged = TRUE; @@ -251,8 +246,10 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) SendMessage(GetParent(GetParent(pList->hList)), PSM_CHANGED, 0, 0); } } - if (pList->labelEdit.hBtn) DestroyWindow(pList->labelEdit.hBtn); - if (pList->labelEdit.dropDown.hDrop) DestroyWindow(pList->labelEdit.dropDown.hDrop); + if (pList->labelEdit.hBtn) + DestroyWindow(pList->labelEdit.hBtn); + if (pList->labelEdit.dropDown.hDrop) + DestroyWindow(pList->labelEdit.dropDown.hDrop); DestroyWindow(hEdit); ListView_RedrawItems(pList->hList, pList->labelEdit.iItem, pList->labelEdit.iItem); ZeroMemory(&pList->labelEdit, sizeof(pList->labelEdit)); @@ -273,7 +270,6 @@ static int ProfileList_EndLabelEdit(HWND hList, BYTE bSave) * iSubItem - subitem (column) index * return: handle to the edit control **/ - static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem) { LVITEM lvi; @@ -286,7 +282,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem if (pList->labelEdit.hEdit) ProfileList_EndLabelEdit(pList, FALSE); - lvi.mask = LVIF_PARAM|LVIF_STATE; + lvi.mask = LVIF_PARAM | LVIF_STATE; lvi.stateMask = 0xFFFFFFFF; lvi.iItem = iItem; lvi.iSubItem = iSubItem; @@ -297,9 +293,9 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem pItem = (LPLCITEM)lvi.lParam; PSGetContact(GetParent(pList->hList), hContact); - + // do not edit deviders or protocol based contact information - if (!(lvi.state & LVIS_SELECTED) || !PtrIsValid(pItem) || (hContact && (pItem->wFlags & CTRLF_HASPROTO))) + if (!(lvi.state & LVIS_SELECTED) || !PtrIsValid(pItem) || (hContact && (pItem->wFlags & CTRLF_HASPROTO))) return NULL; ListView_EnsureVisible(pList->hList, iItem, FALSE); @@ -318,12 +314,11 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem // create the button control for the combobox if (!iSubItem && pItem->idstrList) { - pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, NULL, - WS_VISIBLE|WS_CHILD|MBS_DOWNARROW, - pList->labelEdit.rcCombo.right - (pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top), pList->labelEdit.rcCombo.top, - pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, - pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, - pList->hList, NULL, ghInst, NULL); + pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, NULL, WS_VISIBLE | WS_CHILD | MBS_DOWNARROW, + pList->labelEdit.rcCombo.right - (pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top), pList->labelEdit.rcCombo.top, + pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, + pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, + pList->hList, NULL, ghInst, NULL); if (pList->labelEdit.hBtn) { SetWindowLongPtr(pList->labelEdit.hBtn, GWLP_ID, BTN_EDIT); pList->labelEdit.rcCombo.right -= pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top; @@ -331,19 +326,18 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem } else { pList->labelEdit.rcCombo.bottom = 3 * pList->labelEdit.rcCombo.bottom - 2 * pList->labelEdit.rcCombo.top; - if (rcList.bottom < pList->labelEdit.rcCombo.bottom) { + if (rcList.bottom < pList->labelEdit.rcCombo.bottom) OffsetRect(&pList->labelEdit.rcCombo, 0, rcList.bottom - pList->labelEdit.rcCombo.bottom - 2); - } } // create the edit control - pList->labelEdit.hEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY|WS_EX_CLIENTEDGE, + pList->labelEdit.hEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE, _T("EDIT"), (!iSubItem && pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) ? pItem->idstrList[pItem->iListItem].ptszTranslated : (iSubItem >= 0 && iSubItem < 2 && pItem->pszText[iSubItem] && *pItem->pszText[iSubItem]) ? pItem->pszText[iSubItem] : _T(""), - WS_VISIBLE|WS_CHILD|(iSubItem ? (WS_VSCROLL|ES_MULTILINE|ES_AUTOVSCROLL) : ES_AUTOHSCROLL), + WS_VISIBLE | WS_CHILD | (iSubItem ? (WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL) : ES_AUTOHSCROLL), pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.top, pList->labelEdit.rcCombo.right - pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, @@ -386,9 +380,8 @@ static HWND ProfileList_BeginLabelEdit(HWND hList, int iItem, int iSubItem) **/ static int ProfileList_GetInsertIndex(HWND hList, LPTSTR pszGroup) { - LVFINDINFO lfi; - int iDevider, - iItem; + LVFINDINFO lfi; + int iDevider, iItem; // search for the devider to add the new item under lfi.flags = LVFI_STRING; @@ -397,16 +390,15 @@ static int ProfileList_GetInsertIndex(HWND hList, LPTSTR pszGroup) // devider does not exist yet, add it! if (iDevider == -1) { - LVITEM lvi; + LVITEM lvi; - lvi.mask = LVIF_PARAM|LVIF_TEXT; + lvi.mask = LVIF_PARAM | LVIF_TEXT; lvi.iSubItem = 0; lvi.iItem = 0xFFFF; lvi.lParam = NULL; lvi.pszText = (LPTSTR)lfi.psz; - if ((iItem = ListView_InsertItem(hList, &lvi)) == -1) { + if ((iItem = ListView_InsertItem(hList, &lvi)) == -1) return -1; - } iItem++; } else { @@ -443,9 +435,9 @@ static BYTE ProfileList_AddNewItem(HWND hDlg, LPLISTCTRL pList, const PROFILEENT // get category list pEntry->GetList((WPARAM)&pItem->idstrListCount, (LPARAM)&pItem->idstrList); - lvi.mask = LVIF_PARAM|LVIF_STATE; + lvi.mask = LVIF_PARAM | LVIF_STATE; lvi.stateMask = 0xFFFFFFFF; - lvi.state = LVIS_FOCUSED|LVIS_SELECTED; + lvi.state = LVIS_FOCUSED | LVIS_SELECTED; lvi.iItem = ProfileList_GetInsertIndex(pList->hList, pEntry->szGroup); lvi.iSubItem = 0; lvi.lParam = (LPARAM)pItem; @@ -484,11 +476,11 @@ static int ProfileList_AddItemlistFromDB( LPCSTR szValFormat, WORD wFlags) { - DBVARIANT dbvVal, dbvCat; - LPLCITEM pItem; - LVITEM lvi; - UINT i, j = 0; - CHAR pszSetting[MAXSETTING]; + DBVARIANT dbvVal, dbvCat; + LPLCITEM pItem; + LVITEM lvi; + UINT i, j = 0; + CHAR pszSetting[MAXSETTING]; lvi.iSubItem = 0; lvi.mask = LVIF_PARAM; @@ -496,8 +488,10 @@ static int ProfileList_AddItemlistFromDB( for (i = 0, lvi.iItem = iItem; ; i++) { // read the setting from db mir_snprintf(pszSetting, MAXSETTING, szValFormat, i); - if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbvVal)) break; - if (dbvVal.type != DBVT_TCHAR) continue; + if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbvVal)) + break; + if (dbvVal.type != DBVT_TCHAR) + continue; mir_snprintf(pszSetting, MAXSETTING, szCatFormat, i); DB::Setting::GetAString(hContact, pszModule, pszSetting, &dbvCat); // create the itemobject @@ -520,22 +514,22 @@ static int ProfileList_AddItemlistFromDB( if (idList != NULL) { for (j = 0; j < nList; j++) { switch (dbvCat.type) { - case DBVT_BYTE: - if (dbvCat.bVal != (BYTE)idList[j].nID) - continue; - break; - case DBVT_WORD: - if (dbvCat.wVal != (WORD)idList[j].nID) - continue; - break; - case DBVT_DWORD: - if (dbvCat.dVal != (DWORD)idList[j].nID) - continue; - break; - case DBVT_ASCIIZ: - if (strcmp(dbvCat.pszVal, idList[j].pszText)) - continue; - break; + case DBVT_BYTE: + if (dbvCat.bVal != (BYTE)idList[j].nID) + continue; + break; + case DBVT_WORD: + if (dbvCat.wVal != (WORD)idList[j].nID) + continue; + break; + case DBVT_DWORD: + if (dbvCat.dVal != (DWORD)idList[j].nID) + continue; + break; + case DBVT_ASCIIZ: + if (strcmp(dbvCat.pszVal, idList[j].pszText)) + continue; + break; } pItem->iListItem = j; break; @@ -568,8 +562,7 @@ static int ProfileList_AddItemlistFromDB( * lParam - message specific parameter * return: message specific **/ - -static LRESULT CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPLISTCTRL pList; @@ -585,7 +578,8 @@ static LRESULT CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wPa { LPIDSTRLIST pItem; - if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) return CB_ERR; + if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) + return CB_ERR; pList->labelEdit.dropDown.iItem = ListBox_GetCurSel(hwnd); if (pList->labelEdit.dropDown.iItem >= 0 && PtrIsValid(pItem = (LPIDSTRLIST)ListBox_GetItemData(hwnd, pList->labelEdit.dropDown.iItem))) SetWindowText(pList->labelEdit.hEdit, pItem->ptszTranslated); @@ -601,14 +595,15 @@ static LRESULT CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wPa POINT pt; LPIDSTRLIST pItem; - if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) return CB_ERR; + if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) + return CB_ERR; mir_callNextSubclass(hwnd, ProfileList_DropdownProc, msg, wParam, lParam); pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); ClientToScreen(hwnd, &pt); - if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) + if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) return CB_ERR; pList->labelEdit.dropDown.iItem = SendMessage(hwnd, LB_GETCURSEL, 0, 0); @@ -648,93 +643,92 @@ static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP LPLISTCTRL pList; switch (msg) { - case WM_KEYDOWN: - switch (wParam) { - case VK_ESCAPE: - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) - ProfileList_EndLabelEdit(pList, FALSE); - return 0; - case VK_F3: - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) && pList->labelEdit.hBtn) - SendMessage(pList->hList, WM_COMMAND, MAKEWPARAM(BTN_EDIT, BN_CLICKED), (LPARAM)pList->labelEdit.hBtn); - return 0; - case VK_RETURN: - { - BYTE bEditNext; - int iItem; + case WM_KEYDOWN: + switch (wParam) { + case VK_ESCAPE: + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) + ProfileList_EndLabelEdit(pList, FALSE); + return 0; + case VK_F3: + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) && pList->labelEdit.hBtn) + SendMessage(pList->hList, WM_COMMAND, MAKEWPARAM(BTN_EDIT, BN_CLICKED), (LPARAM)pList->labelEdit.hBtn); + return 0; + case VK_RETURN: + { + BYTE bEditNext; + int iItem; - if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_WANTRETURN && !(GetKeyState(VK_CONTROL) & 0x8000)) - break; - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) { - bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, NULL, NULL); - iItem = pList->labelEdit.iItem; - ProfileList_EndLabelEdit(pList->hList, TRUE); - if (bEditNext) ProfileList_BeginLabelEdit(pList->hList, pList->labelEdit.iItem, 1); - } - return 0; + if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_WANTRETURN && !(GetKeyState(VK_CONTROL) & 0x8000)) + break; + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) { + bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, NULL, NULL); + iItem = pList->labelEdit.iItem; + ProfileList_EndLabelEdit(pList->hList, TRUE); + if (bEditNext) ProfileList_BeginLabelEdit(pList->hList, pList->labelEdit.iItem, 1); } - case VK_TAB: - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) { - LVITEM lvi; + return 0; + } + case VK_TAB: + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) { + LVITEM lvi; - lvi.mask = LVIF_STATE; - lvi.stateMask = LVIS_FOCUSED|LVIS_SELECTED; - lvi.iItem = pList->labelEdit.iItem; + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_FOCUSED | LVIS_SELECTED; + lvi.iItem = pList->labelEdit.iItem; - if (wParam == VK_TAB && !pList->labelEdit.iSubItem) { - lvi.iSubItem = 1; - lvi.state = LVIS_FOCUSED|LVIS_SELECTED; - ProfileList_EndLabelEdit(pList->hList, TRUE); - } - else { - UINT iSubItem = (wParam == VK_TAB) ? 0 : pList->labelEdit.iSubItem; + if (wParam == VK_TAB && !pList->labelEdit.iSubItem) { + lvi.iSubItem = 1; + lvi.state = LVIS_FOCUSED | LVIS_SELECTED; + ProfileList_EndLabelEdit(pList->hList, TRUE); + } + else { + UINT iSubItem = (wParam == VK_TAB) ? 0 : pList->labelEdit.iSubItem; - lvi.iSubItem = 0; - lvi.state = 0; + lvi.iSubItem = 0; + lvi.state = 0; - ProfileList_EndLabelEdit(pList, TRUE); + ProfileList_EndLabelEdit(pList, TRUE); - // unselect current list item - if (!ListView_SetItem(pList->hList, &lvi)) - return 0; + // unselect current list item + if (!ListView_SetItem(pList->hList, &lvi)) + return 0; - // search for next valid list item (skip deviders) - lvi.iSubItem = iSubItem; - lvi.mask = LVIF_PARAM; - do { - if (wParam == VK_UP) - lvi.iItem--; - else - lvi.iItem++; + // search for next valid list item (skip deviders) + lvi.iSubItem = iSubItem; + lvi.mask = LVIF_PARAM; + do { + if (wParam == VK_UP) + lvi.iItem--; + else + lvi.iItem++; - if (lvi.iItem == -1 || !ListView_GetItem(pList->hList, &lvi)) { - return 0; - } - } while (!lvi.lParam); + if (lvi.iItem == -1 || !ListView_GetItem(pList->hList, &lvi)) + return 0; + } + while (!lvi.lParam); - // select new list item - lvi.mask = LVIF_STATE; - lvi.state = LVIS_FOCUSED|LVIS_SELECTED; - if (!ListView_SetItem(pList->hList, &lvi)) { - return 0; - } - } - ProfileList_BeginLabelEdit(pList->hList, lvi.iItem, lvi.iSubItem); + // select new list item + lvi.mask = LVIF_STATE; + lvi.state = LVIS_FOCUSED | LVIS_SELECTED; + if (!ListView_SetItem(pList->hList, &lvi)) return 0; - } - return 1; + } + ProfileList_BeginLabelEdit(pList->hList, lvi.iItem, lvi.iSubItem); + return 0; } - break; - case WM_GETDLGCODE: - return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, ProfileList_LabelEditProc, msg, wParam, lParam); - case WM_KILLFOCUS: + return 1; + } + break; + case WM_GETDLGCODE: + return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, ProfileList_LabelEditProc, msg, wParam, lParam); + case WM_KILLFOCUS: { HWND hwndFocus = GetFocus(); - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) && - hwndFocus != pList->labelEdit.dropDown.hDrop && - hwndFocus != pList->labelEdit.hEdit && - hwndFocus != pList->labelEdit.hBtn) + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) + && hwndFocus != pList->labelEdit.dropDown.hDrop + && hwndFocus != pList->labelEdit.hEdit + && hwndFocus != pList->labelEdit.hBtn) ProfileList_EndLabelEdit(pList, hwndFocus == pList->hList); return 0; } @@ -764,12 +758,14 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa switch (wParam) { case VK_F2: nCurSel = ListView_GetSelectionMark(hwnd); - if (nCurSel == -1) break; + if (nCurSel == -1) + break; ProfileList_BeginLabelEdit(hwnd, nCurSel, 0); return 0; case VK_F3: nCurSel = ListView_GetSelectionMark(hwnd); - if (nCurSel == -1) break; + if (nCurSel == -1) + break; ProfileList_BeginLabelEdit(hwnd, nCurSel, 1); return 0; case VK_UP: @@ -780,22 +776,24 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // find next valid item to select lvi.mask = LVIF_PARAM; do { - if (wParam == VK_UP) lvi.iItem--; - else lvi.iItem++; - if (lvi.iItem == -1 || !ListView_GetItem(hwnd, &lvi)) { + if (wParam == VK_UP) + lvi.iItem--; + else + lvi.iItem++; + if (lvi.iItem == -1 || !ListView_GetItem(hwnd, &lvi)) return 0; - } - } while (!lvi.lParam); + } + while (!lvi.lParam); ListView_EnsureVisible(hwnd, lvi.iItem, FALSE); newSel = lvi.iItem; lvi.iItem = nCurSel; lvi.mask = LVIF_STATE; - lvi.stateMask = LVIS_FOCUSED|LVIS_SELECTED; + lvi.stateMask = LVIS_FOCUSED | LVIS_SELECTED; lvi.state = 0; ListView_SetItem(hwnd, &lvi); lvi.iItem = newSel; - lvi.state = LVIS_FOCUSED|LVIS_SELECTED; + lvi.state = LVIS_FOCUSED | LVIS_SELECTED; ListView_SetItem(hwnd, &lvi); ListView_SetSelectionMark(hwnd, lvi.iItem); return 0; @@ -835,7 +833,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa if (textSize.cx > rchWnd.right - rchWnd.left || textSize.cx > rcItem.right - rcItem.left) { ZeroMemory(&ti, sizeof(TOOLINFO)); ti.cbSize = sizeof(TOOLINFO); - ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT; ti.hinst = ghInst; ti.hwnd = hwnd; ti.uId = (UINT_PTR)hwnd; @@ -849,7 +847,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa ? pItem->idstrList[pItem->iListItem].ptszTranslated : (pItem->pszText[0] && *pItem->pszText[0]) ? pItem->pszText[0] - : TranslateT("")) + : TranslateT("")) ); InvalidateRect(pList->hTip, NULL, TRUE); } @@ -862,7 +860,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa if (bReposition) { RECT rcTip; GetClientRect(pList->hTip, &rcTip); - SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); + SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); } pList->wFlags |= LIF_TIPVISIBLE; return 0; @@ -900,21 +898,21 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa switch (((LPNMHDR)lParam)->code) { case TTN_SHOW: - SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); + SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); return TRUE; } } break; case WM_COMMAND: switch (LOWORD(wParam)) { - - // show dropdown menu for category list + // show dropdown menu for category list case BTN_EDIT: { int i; TCHAR szEdit[MAX_PATH]; - if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) break; + if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) + break; GetWindowText(pList->labelEdit.hEdit, szEdit, MAX_PATH); // need to create the dropdown list? @@ -937,11 +935,12 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa rc.bottom = rc.top + listHeight; } - pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, - _T("LISTBOX"), NULL, WS_CHILD|WS_BORDER|WS_VSCROLL|LBS_COMBOBOX|LBS_HASSTRINGS, + pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, _T("LISTBOX"), NULL, + WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_COMBOBOX | LBS_HASSTRINGS, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, hwnd, NULL, ghInst, NULL); - if (!pList->labelEdit.dropDown.hDrop) return FALSE; + if (!pList->labelEdit.dropDown.hDrop) + return FALSE; SetUserData(pList->labelEdit.dropDown.hDrop, pList); mir_subclassWindow(pList->labelEdit.dropDown.hDrop, ProfileList_DropdownProc); SetWindowLongPtr(pList->labelEdit.dropDown.hDrop, GWLP_ID, LIST_DROPDOWN); @@ -992,10 +991,10 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa { HWND hwndFocus = GetFocus(); - if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) && - pList->labelEdit.hEdit != hwndFocus && - pList->labelEdit.dropDown.hDrop != hwndFocus && - pList->labelEdit.hBtn != hwndFocus) + if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)) + && pList->labelEdit.hEdit != hwndFocus + && pList->labelEdit.dropDown.hDrop != hwndFocus + && pList->labelEdit.hBtn != hwndFocus) ProfileList_EndLabelEdit(pList, FALSE); break; } @@ -1054,9 +1053,9 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // remove static edge in aero mode if (IsAeroMode()) - SetWindowLongPtr(hList, GWL_EXSTYLE, GetWindowLongPtr(hList, GWL_EXSTYLE)&~WS_EX_STATICEDGE); + SetWindowLongPtr(hList, GWL_EXSTYLE, GetWindowLongPtr(hList, GWL_EXSTYLE) & ~WS_EX_STATICEDGE); - // insert columns into the listboxes + // insert columns into the listboxes ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT); @@ -1075,26 +1074,23 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR rc.right -= GetSystemMetrics(SM_CXVSCROLL); // initiate the tooltips - pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, - WS_POPUP|TTS_BALLOON|TTS_NOPREFIX|TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hList, NULL, ghInst, NULL); + pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, NULL, ghInst, NULL); if (pList->hTip) { - SetWindowPos(pList->hTip, HWND_TOPMOST, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + SetWindowPos(pList->hTip, HWND_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); ZeroMemory(&ti, sizeof(TOOLINFO)); ti.cbSize = sizeof(TOOLINFO); - ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT; ti.hinst = ghInst; ti.hwnd = hList; ti.uId = (UINT_PTR)hList; SendMessage(pList->hTip, TTM_ADDTOOL, NULL, (LPARAM)&ti); SendMessage(pList->hTip, TTM_ACTIVATE, FALSE, (LPARAM)&ti); - } + } - // insert columns into the listboxes + // insert columns into the listboxes lvc.mask = LVCF_WIDTH; lvc.cx = rc.right / 8 * 3; ListView_InsertColumn(hList, 0, &lvc); @@ -1127,10 +1123,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR LPIDSTRLIST idList; UINT nList; BYTE i; - int iItem = 0, - iGrp = 0, - numProtoItems, - numUserItems; + int iItem = 0, iGrp = 0, numProtoItems, numUserItems; if (!(pList->wFlags & CTRLF_CHANGED) && PSGetBaseProto(hDlg, pszProto) && *pszProto != 0) { ProfileList_Clear(hList); @@ -1148,18 +1141,21 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR LPCSTR pszSubBaseProto; if ((hDefContact = db_mc_getSub(hContact, iDefault)) && (pszSubBaseProto = DB::Contact::Proto(hDefContact))) { - if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0) + if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA | CTRLF_HASPROTO)) < 0) return FALSE; // copy the missing settings from the other subcontacts int numSubs = db_mc_getSubCount(hContact); for (int j = 0; j < numSubs; j++) { - if (j == iDefault) continue; - if (!(hSubContact = db_mc_getSub(hContact, j))) continue; - if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) continue; - if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0) + if (j == iDefault) + continue; + if (!(hSubContact = db_mc_getSub(hContact, j))) + continue; + if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) + continue; + if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA | CTRLF_HASPROTO)) < 0) return FALSE; - //if ((numUserItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0) + //if ((numUserItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA | CTRLF_HASPROTO)) < 0) // return FALSE; } } @@ -1176,11 +1172,11 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR SetWindowLongPtr(hDlg, DWLP_MSGRESULT, msgResult); break; } - // user swiches to another propertysheetpage + // user swiches to another propertysheetpage case PSN_KILLACTIVE: ProfileList_EndLabelEdit(hList, TRUE); break; - // user selected to apply settings to the database + // user selected to apply settings to the database case PSN_APPLY: if (pList->wFlags & CTRLF_CHANGED) { BYTE iFmt = -1; @@ -1191,10 +1187,11 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR LPLCITEM pItem; LPSTR pszModule = USERINFO; - if (!hContact) PSGetBaseProto(hDlg, pszModule); + if (!hContact) + PSGetBaseProto(hDlg, pszModule); *szGroup = 0; - lvi.mask = LVIF_TEXT|LVIF_PARAM; + lvi.mask = LVIF_TEXT | LVIF_PARAM; lvi.pszText = szGroup; lvi.cchTextMax = MAX_PATH; @@ -1207,9 +1204,8 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR } // find information about the group for (iFmt = 0; iFmt < SIZEOF(pFmt); iFmt++) { - if (!_tcscmp(szGroup, pFmt[iFmt].szGroup)) { + if (!_tcscmp(szGroup, pFmt[iFmt].szGroup)) break; - } } // indicate, no group was found. should not happen!! if (iFmt == SIZEOF(pFmt)) { @@ -1218,31 +1214,29 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR } iItem = 0; } - else - if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) { - // save value - if (!pItem->pszText[1] || !*pItem->pszText[1]) - continue; - if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) { - mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem); - db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]); - // save category - mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem); - if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) - db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText); - else - if (pItem->pszText[0] && *pItem->pszText[0]) - db_set_ts(hContact, pszModule, pszSetting, (LPTSTR)pItem->pszText[0]); - else - db_unset(hContact, pszModule, pszSetting); - // redraw the item if required - if (pItem->wFlags & CTRLF_CHANGED) { - pItem->wFlags &= ~CTRLF_CHANGED; - ListView_RedrawItems(hList, lvi.iItem, lvi.iItem); - } - iItem++; + else if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) { + // save value + if (!pItem->pszText[1] || !*pItem->pszText[1]) + continue; + if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) { + mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem); + db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]); + // save category + mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem); + if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) + db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText); + else if (pItem->pszText[0] && *pItem->pszText[0]) + db_set_ts(hContact, pszModule, pszSetting, (LPTSTR)pItem->pszText[0]); + else + db_unset(hContact, pszModule, pszSetting); + // redraw the item if required + if (pItem->wFlags & CTRLF_CHANGED) { + pItem->wFlags &= ~CTRLF_CHANGED; + ListView_RedrawItems(hList, lvi.iItem, lvi.iItem); } + iItem++; } + } } // delete reluctant items if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) { @@ -1256,9 +1250,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR } break; - // // handle notification messages from the list control - // case LIST_PROFILE: pList = (LPLISTCTRL)GetUserData(((LPNMHDR)lParam)->hwndFrom); @@ -1272,7 +1264,8 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR LPLCITEM pItem; POINT pt; - if (!hMenu) return 1; + if (!hMenu) + return 1; PSGetContact(hDlg, hContact); GetCursorPos(&pt); hi.pt = pt; @@ -1286,13 +1279,13 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR mii.fMask = MIIM_ID|MIIM_STRING; // insert "Add" Menuitem mii.wID = BTN_ADD_intEREST; - mii.dwTypeData = TranslateT("Add Interest"); + mii.dwTypeData = TranslateT("Add interest"); InsertMenuItem(hMenu, 0, TRUE, &mii); mii.wID = BTN_ADD_AFFLIATION; - mii.dwTypeData = TranslateT("Add Affliation"); + mii.dwTypeData = TranslateT("Add affliation"); InsertMenuItem(hMenu, 1, TRUE, &mii); mii.wID = BTN_ADD_PAST; - mii.dwTypeData = TranslateT("Add Past"); + mii.dwTypeData = TranslateT("Add past"); InsertMenuItem(hMenu, 2, TRUE, &mii); if (hi.iItem != -1 && PtrIsValid(pItem) && !(hContact && (pItem->wFlags & CTRLF_HASPROTO))) { @@ -1301,18 +1294,18 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR mii.fType = MFT_SEPARATOR; InsertMenuItem(hMenu, 3, TRUE, &mii); // insert "Delete" Menuitem - mii.fMask = MIIM_ID|MIIM_STRING; + mii.fMask = MIIM_ID | MIIM_STRING; mii.wID = BTN_EDIT_CAT; - mii.dwTypeData = TranslateT("Edit Category"); + mii.dwTypeData = TranslateT("Edit category"); InsertMenuItem(hMenu, 4, TRUE, &mii); mii.wID = BTN_EDIT_VAL; - mii.dwTypeData = TranslateT("Edit Value"); + mii.dwTypeData = TranslateT("Edit value"); InsertMenuItem(hMenu, 5, TRUE, &mii); mii.fMask = MIIM_FTYPE; mii.fType = MFT_SEPARATOR; InsertMenuItem(hMenu, 6, TRUE, &mii); // insert "Delete" Menuitem - mii.fMask = MIIM_ID|MIIM_STRING; + mii.fMask = MIIM_ID | MIIM_STRING; mii.wID = BTN_DEL; mii.dwTypeData = TranslateT("Delete"); InsertMenuItem(hMenu, 7, TRUE, &mii); @@ -1349,7 +1342,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_3DSHADOW)); ProfileList_GetItemText(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, 0, szText, MAX_PATH); rc.left += 6; - DrawText(cd->nmcd.hdc, TranslateTS(szText), -1, &rc, DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + DrawText(cd->nmcd.hdc, TranslateTS(szText), -1, &rc, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); rc.bottom -= 2; rc.top = rc.bottom - 1; @@ -1367,18 +1360,18 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR } // draw background of unselected item else { - SetTextColor(cd->nmcd.hdc, - (pItem->wFlags & CTRLF_CHANGED) + SetTextColor(cd->nmcd.hdc, + (pItem->wFlags & CTRLF_CHANGED) ? clrChanged : (pItem->wFlags & CTRLF_HASMETA) ? clrMeta : ((pItem->wFlags & (CTRLF_HASCUSTOM)) && (pItem->wFlags & CTRLF_HASPROTO)) ? clrBoth : (pItem->wFlags & CTRLF_HASCUSTOM) - ? clrCustom : clrNormal); + ? clrCustom : clrNormal); FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW)); } - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NEWFONT|CDRF_NOTIFYSUBITEMDRAW); + SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NEWFONT | CDRF_NOTIFYSUBITEMDRAW); return TRUE; - case CDDS_SUBITEM|CDDS_ITEMPREPAINT: + case CDDS_SUBITEM | CDDS_ITEMPREPAINT: { HFONT hoFont = (HFONT)SelectObject(cd->nmcd.hdc, pList->hFont); @@ -1390,12 +1383,12 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR } rc.left += 3; DrawText(cd->nmcd.hdc, - pItem->pszText[cd->iSubItem] - ? pItem->pszText[cd->iSubItem] - : (cd->iSubItem == 0 && pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) + pItem->pszText[cd->iSubItem] + ? pItem->pszText[cd->iSubItem] + : (cd->iSubItem == 0 && pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount) ? pItem->idstrList[pItem->iListItem].ptszTranslated : TranslateT(""), - -1, &rc, DT_END_ELLIPSIS|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + -1, &rc, DT_END_ELLIPSIS | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT); return TRUE; } @@ -1422,12 +1415,13 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR ProfileList_BeginLabelEdit(hList, ListView_GetSelectionMark(hList), 1); break; case BTN_DEL: - if (IDYES == MsgBox(hDlg, MB_YESNO|MB_ICON_QUESTION, LPGENT("Question"), LPGENT("Delete an entry"), LPGENT("Do you really want to delete this entry?"))) { + if (IDYES == MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION, LPGENT("Question"), LPGENT("Delete an entry"), LPGENT("Do you really want to delete this entry?"))) { int iItem = ListView_GetSelectionMark(hList); pList = (LPLISTCTRL)GetUserData(hList); ProfileList_DeleteItem(hList, iItem); - if (PtrIsValid(pList)) pList->wFlags |= CTRLF_CHANGED; + if (PtrIsValid(pList)) + pList->wFlags |= CTRLF_CHANGED; SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL); // check if to delete any devider if (!ProfileList_GetItemData(hList, iItem--) && !ProfileList_GetItemData(hList, iItem)) diff --git a/plugins/UserInfoEx/src/resource.h b/plugins/UserInfoEx/src/resource.h index fcc0666960..78c166e3e8 100644 --- a/plugins/UserInfoEx/src/resource.h +++ b/plugins/UserInfoEx/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by resource.rc +// Used by ..\res\resource.rc // #define IDSKIP 20 #define IDALL 21 diff --git a/plugins/UserInfoEx/src/svc_constants.h b/plugins/UserInfoEx/src/svc_constants.h index 1dc73429a8..09f65ef1ba 100644 --- a/plugins/UserInfoEx/src/svc_constants.h +++ b/plugins/UserInfoEx/src/svc_constants.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _SVC_CONSTANTS_INCLUDED_ #define _SVC_CONSTANTS_INCLUDED_ -#define MODULELONGNAME "Extended UserInfo" +#define MODULELONGNAME "Extended user info" #define USERINFO "UserInfo" #define MODNAME "UserInfoEx" #define MODNAMEFLAGS "Flags" -- cgit v1.2.3