From 547d4bbf3075c59079923c385de7bf060b5d4e23 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Aug 2018 14:54:32 +0300 Subject: UInfoEx: code cleaning --- plugins/UserInfoEx/src/ctrl_base.h | 39 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 808 ++++++++++++------------------- 2 files changed, 334 insertions(+), 513 deletions(-) diff --git a/plugins/UserInfoEx/src/ctrl_base.h b/plugins/UserInfoEx/src/ctrl_base.h index 1e4965f5bc..4d5fbe6139 100644 --- a/plugins/UserInfoEx/src/ctrl_base.h +++ b/plugins/UserInfoEx/src/ctrl_base.h @@ -27,20 +27,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ***********************************************************************************************************/ // control flags -#define CTRLF_CHANGED 1 -#define CTRLF_HASPROTO 2 -#define CTRLF_HASCUSTOM 4 -#define CTRLF_HASMETA 8 - -#define CTRLF_FIRST 16 // first free flag for derived controls +#define CTRLF_CHANGED 1 +#define CTRLF_HASPROTO 2 +#define CTRLF_HASCUSTOM 4 +#define CTRLF_HASMETA 8 +#define CTRLF_FIRST 16 // first free flag for derived controls // control types -#define CTRL_ERROR 0 -#define CTRL_EDIT 1 -#define CTRL_COMBOBOX_STAT 2 -#define CTRL_DATEPICKER 3 -#define CTRL_LIST_PROFILE 4 -#define CTRL_LIST_ITEM 7 +#define CTRL_ERROR 0 +#define CTRL_EDIT 1 +#define CTRL_COMBOBOX_STAT 2 +#define CTRL_DATEPICKER 3 +#define CTRL_LIST_PROFILE 4 +#define CTRL_LIST_ITEM 7 typedef struct TCtrlInfo { BYTE nType; @@ -48,8 +47,8 @@ typedef struct TCtrlInfo { } CTRL, *LPCTRL; // for compatibility with old styled controls -void Ctrl_InitTextColours(); -INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags); +void Ctrl_InitTextColours(); +INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags); /*********************************************************************************************************** * CBaseCtrl declaration @@ -64,18 +63,6 @@ union CCtrlFlags bool hasProto : 1; bool hasCustom : 1; bool hasMeta : 1; - bool bit_04 : 1; - bool bit_05 : 1; - bool bit_06 : 1; - bool bit_07 : 1; - bool bit_08 : 1; - bool bit_09 : 1; - bool bit_10 : 1; - bool bit_11 : 1; - bool bit_12 : 1; - bool bit_13 : 1; - bool bit_14 : 1; - bool bit_15 : 1; } B; }; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 397b781284..33f10b6009 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -19,17 +19,15 @@ 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: -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// System & local includes: + #include "stdafx.h" #include "dlg_propsheet.h" #include "psp_base.h" #include "ex_import/svc_ExImport.h" #include "svc_reminder.h" -#define OPTIONPAGE_OLD_SIZE (offsetof(OPTIONSDIALOGPAGE, hLangpack)) - #define UPDATEANIMFRAMES 20 // internal dialog message handler @@ -41,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TIMERID_UPDATING 1 #ifndef TIMERID_RENAME - #define TIMERID_RENAME 2 +#define TIMERID_RENAME 2 #endif // flags for the PS structure @@ -54,9 +52,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INIT_ICONS_CONTACT 2 #define INIT_ICONS_ALL (INIT_ICONS_OWNER | INIT_ICONS_CONTACT) -/*********************************************************************************************************** -* internal variables -***********************************************************************************************************/ +///////////////////////////////////////////////////////////////////////////////////////// +// internal variables static BYTE bInitIcons = INIT_ICONS_NONE; static MWindowList g_hWindowList = nullptr; @@ -92,13 +89,14 @@ void CPsHdr::Free_pPages() MIR_FREE(_pPages); } -/*********************************************************************************************************** -* class CPsUpload -***********************************************************************************************************/ +///////////////////////////////////////////////////////////////////////////////////////// +// class CPsUpload -class CPsUpload { +class CPsUpload +{ public: - enum EPsUpReturn { + enum EPsUpReturn + { UPLOAD_CONTINUE = 0, UPLOAD_FINISH = 1, UPLOAD_FINISH_CLOSE = 2 @@ -110,15 +108,13 @@ private: BYTE _bExitAfterUploading; HANDLE _hUploading; LPPS _pPs; - - /** - * @class Upload - * @class CPsUpload - * @desc start upload process for the current protocol - * @param none - * @return 0 on success - * @return 1 otherwise - **/ + + //////////////////////////////////////////////////////////////////////////////////////// + // @name Upload + // @class CPsUpload + // @desc start upload process for the current protocol + // @return 0 on success or 1 otherwise + int Upload() { // check if icq is online @@ -147,14 +143,13 @@ private: } public: - /** - * @name CPsUpload - * @class CPsUpload - * @desc retrieves the list of installed protocols and initializes the class - * @param pPs - the owning propertysheet - * @param bExitAfter - whether the dialog is to close after upload or not - * @return nothing - **/ + //////////////////////////////////////////////////////////////////////////////////////// + // @name CPsUpload + // @class CPsUpload + // @desc retrieves the list of installed protocols and initializes the class + // @param pPs - the owning propertysheet + // @param bExitAfter - whether the dialog is to close after upload or not + CPsUpload(LPPS pPs, BYTE bExitAfter) { _pPs = pPs; @@ -171,34 +166,32 @@ public: return UploadNext(); } - /** - * @name ~CPsUpload - * @class CPsUpload - * @desc clear pointer to the upload object - * @param none - * @return nothing - **/ + //////////////////////////////////////////////////////////////////////////////////////// + // @name ~CPsUpload + // @class CPsUpload + ~CPsUpload() - { _pPs->pUpload = nullptr; } - - /** - * @name Handle - * @class CPsUpload - * @desc returns the handle of the current upload process - * @param none - * @return handle of the current upload process - **/ + { + _pPs->pUpload = nullptr; + } + + //////////////////////////////////////////////////////////////////////////////////////// + // @name Handle + // @class CPsUpload + // @desc returns the handle of the current upload process + // @return handle of the current upload process + __inline HANDLE Handle() const - { return _hUploading; }; - - /** - * @name UploadNext - * @class CPsUpload - * @desc Search the next protocol which supports uploading contact information - * and start uploading. Delete the object if ready - * @param none - * @return nothing - **/ + { + return _hUploading; + }; + + //////////////////////////////////////////////////////////////////////////////////////// + // @name UploadNext + // @class CPsUpload + // @desc Search the next protocol which supports uploading contact information + // and start uploading. Delete the object if ready + int UploadNext() { while (_pPd && *_pPd && _numProto-- > 0) { @@ -212,16 +205,13 @@ public: } }; -/*********************************************************************************************************** -* propertysheet -***********************************************************************************************************/ +///////////////////////////////////////////////////////////////////////////////////////// +// propertysheet + +// @name SortProc() +// @desc used for sorting the tab pages +// @return -1 or 0 or 1 -/** -* @name SortProc() -* @desc used for sorting the tab pages -* -* @return -1 or 0 or 1 -**/ static int SortProc(CPsTreeItem **item1, CPsTreeItem **item2) { if (*item1 && *item2) { @@ -233,14 +223,12 @@ static int SortProc(CPsTreeItem **item1, CPsTreeItem **item2) return 0; } -/** -* This service routine creates the DetailsDialog -* @param wParam - handle to contact -* @param lParam - not used -* -* @retval 0 on success -* @retval 1 on failure -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// This service routine creates the DetailsDialog +// @param wParam - handle to contact +// @param lParam - not used +// @retval 0 on success or 1 on failure + static INT_PTR ShowDialog(WPARAM wParam, LPARAM) { // update some cached settings @@ -334,14 +322,12 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) return 0; } -/** -* @name AddPage() -* @desc this adds a new pages -* @param wParam - The List of pages we want to add the new one to -* @param lParam - it's the page to add -* -* @return 0 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name AddPage() +// @desc this adds a new pages +// @param wParam - The List of pages we want to add the new one to +// @param lParam - it's the page to add + static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) { CPsHdr *pPsh = (CPsHdr *)wParam; @@ -391,12 +377,10 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) return 1; } -/** -* @name OnDeleteContact() -* @desc a user was deleted, so need to close its details dialog, if one open -* -* @return 0 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name OnDeleteContact() +// @desc a user was deleted, so need to close its details dialog, if one open + static int OnDeleteContact(WPARAM wParam, LPARAM) { HWND hWnd = WindowList_Find(g_hWindowList, wParam); @@ -405,34 +389,29 @@ static int OnDeleteContact(WPARAM wParam, LPARAM) return 0; } -/** -* @name OnShutdown() -* @desc we need to emptify the windowlist -* -* @return 0 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name OnShutdown() +// @desc we need to emptify the windowlist + static int OnShutdown(WPARAM, LPARAM) { WindowList_BroadcastAsync(g_hWindowList, WM_DESTROY, 0, 0); return 0; } -/** -* @name AddProtocolPages() -* @desc is called by Miranda if user selects to display the userinfo dialog -* @param odp - optiondialogpage structure to use -* @param wParam - the propertysheet init structure to pass -* @param pszProto - the protocol name to prepend as item name (can be NULL) -* -* @return 0 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name AddProtocolPages() +// @desc is called by Miranda if user selects to display the userinfo dialog +// @param odp - optiondialogpage structure to use +// @param wParam - the propertysheet init structure to pass +// @param pszProto - the protocol name to prepend as item name (can be NULL) + static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = nullptr) { wchar_t szTitle[MAX_PATH]; const BYTE ofs = (pszProto) ? mir_snwprintf(szTitle, L"%S\\", pszProto) : 0; odp.szTitle.w = szTitle; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_GENERAL); odp.position = 0x8000000; odp.pfnDlgProc = PSPProcGeneral; @@ -453,12 +432,12 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.dwInitParam = ICONINDEX(IDI_TREE_ADVANCED); mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Origin"), _countof(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY); odp.position = 0x8000003; odp.pfnDlgProc = PSPProcAnniversary; odp.dwInitParam = ICONINDEX(IDI_BIRTHDAY); - mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Anniversaries"), _countof(szTitle) - ofs); + mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Anniversaries"), _countof(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY); @@ -474,7 +453,7 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.dwInitParam = ICONINDEX(IDI_TREE_ADDRESS); mir_wstrncpy(szTitle + ofs, LPGENW("Work") L"\\" LPGENW("Contact (work)"), _countof(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); odp.position = 0x8000006; odp.pfnDlgProc = PSPProcAbout; @@ -491,14 +470,12 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt return 0; } -/** -* @name InitDetails -* @desc is called by Miranda if user selects to display the userinfo dialog -* @param wParam - the propertysheet init structure to pass -* @param lParam - handle to contact whose information are read -* -* @return 0 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name InitDetails +// @desc is called by Miranda if user selects to display the userinfo dialog +// @param wParam - the propertysheet init structure to pass +// @param lParam - handle to contact whose information are read + static int InitDetails(WPARAM wParam, LPARAM lParam) { CPsHdr *pPsh = (CPsHdr *)wParam; @@ -508,6 +485,7 @@ static int InitDetails(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = {}; odp.flags = ODPF_ICON | ODPF_UNICODE; odp.szGroup.w = IcoLib_GetDefaultIconFileName(); + odp.pPlugin = &g_plugin; if (lParam) { // ignore common pages for weather contacts @@ -529,19 +507,16 @@ static int InitDetails(WPARAM wParam, LPARAM lParam) return 0; } -/** -* @name InitTreeIcons() -* @desc initalize all treeview icons -* @param none -* -* @return nothing -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name InitTreeIcons() +// @desc initalize all treeview icons + void DlgContactInfoInitTreeIcons() { // make sure this is run only once if (!(bInitIcons & INIT_ICONS_ALL)) { CPsHdr psh; - POINT metrics = {0}; + POINT metrics = { 0 }; psh._dwFlags = PSTVF_INITICONS; @@ -559,7 +534,7 @@ void DlgContactInfoInitTreeIcons() // avoid pages from loading doubled if (!(bInitIcons & INIT_ICONS_CONTACT)) { psh._dwFlags |= PSF_PROTOPAGESONLY_INIT; - + // enumerate all protocols for (auto &pa : Accounts()) { // enumerate all contacts @@ -593,9 +568,8 @@ void DlgContactInfoInitTreeIcons() } } -/*============================================================================================ - PropertySheet's Dialog Procedures - ============================================================================================*/ +///////////////////////////////////////////////////////////////////////////////////////// +// PropertySheet's Dialog Procedures static void ResetUpdateInfo(LPPS pPs) { @@ -606,37 +580,25 @@ static void ResetUpdateInfo(LPPS pPs) pPs->nSubContacts = 0; } -/** -* @name DlgProc() -* @desc dialog procedure for the main propertysheet dialog box -* -* @return 0 or 1 -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name DlgProc() +// @desc dialog procedure for the main propertysheet dialog box static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { LPPS pPs = (LPPS)GetUserData(hDlg); - + // do not process any message if pPs is no longer existent if (!PtrIsValid(pPs) && uMsg != WM_INITDIALOG) return FALSE; switch (uMsg) { - /** - * @class WM_INITDIALOG - * @desc initiates all dialog controls - * @param wParam - not used - * lParam - pointer to a PSHDR structure, which contains all information to create the dialog - * - * @return TRUE if everything is ok, FALSE if dialog creation should fail - **/ - case WM_INITDIALOG: { CPsHdr* pPsh = (CPsHdr *)lParam; WORD needWidth = 0; RECT rc; - + if (!pPsh || pPsh->_dwSize != sizeof(CPsHdr)) return FALSE; @@ -674,7 +636,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // set the windowtitle DlgProc(hDlg, HM_SETWINDOWTITLE, NULL, NULL); - + // translate Userinfo buttons SendDlgItemMessage(hDlg, BTN_UPDATE, BUTTONTRANSLATE, NULL, NULL); SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL); @@ -696,7 +658,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar GetObject(hNormalFont, sizeof(lf), &lf); lf.lfWeight = FW_BOLD; pPs->hBoldFont = CreateFontIndirect(&lf); - + // initialize the optionpages and tree control if (!pPs->pTree->InitTreeItems((LPWORD)&needWidth)) return FALSE; @@ -738,7 +700,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar OffsetRect(&pPs->rcDisplay, -pt.x, -pt.y); pPs->rcDisplay.bottom = rcTree.bottom; pPs->rcDisplay.left = rcTree.right + 2; - pPs->rcDisplay.top = rcTree.top+rc.bottom; + pPs->rcDisplay.top = rcTree.top + rc.bottom; pPs->rcDisplay.right -= 2; // move and resize the rest of the controls @@ -783,8 +745,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (pPs->hContact && *pPs->pszProto) { GetDlgItemTextA(hDlg, TXT_UPDATING, pPs->szUpdating, _countof(pPs->szUpdating)); ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); - - if (DlgProc(hDlg, M_CHECKONLINE, NULL, NULL)) + + if (DlgProc(hDlg, M_CHECKONLINE, NULL, NULL)) DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(BTN_UPDATE, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, BTN_UPDATE)); } @@ -797,15 +759,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } return TRUE; - /** - * @class WM_TIMER - * @desc is called to display the "updating" text in the status area - * @param wParam - not used - * lParam - not used - * - * @return always FALSE - **/ - case WM_TIMER: + case WM_TIMER: // is called to display the "updating" text in the status area switch (wParam) { case TIMERID_UPDATING: SetDlgItemTextA(hDlg, TXT_UPDATING, CMStringA().Format("%.*s%s%.*s", pPs->updateAnimFrame % 10, ".........", pPs->szUpdating, pPs->updateAnimFrame % 10, ".........")); @@ -815,20 +769,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } break; - case 0x031E: /*WM_DWMCOMPOSITIONCHANGED:*/ + case WM_DWMCOMPOSITIONCHANGED: ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG), IsAeroMode()); InvalidateRect(hDlg, nullptr, TRUE); break; - /** - * @class WM_CTLCOLORSTATIC - * @desc sets the colour of some of the dialog's static controls - * @param wParam - HWND of the contrls - * lParam - HDC for drawing - * - * @return StockObject - **/ - case WM_CTLCOLORSTATIC: + case WM_CTLCOLORSTATIC: // sets the colour of some of the dialog's static controls switch (GetWindowLongPtr((HWND)lParam, GWLP_ID)) { case TXT_UPDATING: { @@ -856,15 +802,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetBkMode((HDC)wParam, TRANSPARENT); return (INT_PTR)GetStockObject(NULL_BRUSH); - /** - * @class PSM_CHANGED - * @desc indicates the propertysheet and the current selected page as changed - * @param wParam - not used - * lParam - not used - * - * @return TRUE if successful FALSE if the dialog is locked at the moment - **/ - case PSM_CHANGED: + case PSM_CHANGED: // indicates the propertysheet and the current selected page as changed if (!(pPs->dwFlags & PSF_LOCKED)) { pPs->dwFlags |= PSF_CHANGED; pPs->pTree->CurrentItem()->AddFlags(PSPF_CHANGED); @@ -873,15 +811,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } break; - /** - * @class PSM_GETBOLDFONT - * @desc returns the bold font - * @param wParam - not used - * lParam - pointer to a HFONT, which takes the boldfont - * - * @return TRUE if successful, FALSE otherwise - **/ - case PSM_GETBOLDFONT: + case PSM_GETBOLDFONT: // returns the bold font if (pPs->hBoldFont && lParam) { *(HFONT *)lParam = pPs->hBoldFont; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hBoldFont); @@ -891,19 +821,10 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; - /** - * @class PSM_GETCONTACT - * @desc returns the handle to the contact, associated with this propertysheet - * @param wParam - index or -1 for current item - * lParam - pointer to a HANDLE, which takes the contact handle - * - * @return TRUE if successful, FALSE otherwise - **/ - case PSM_GETCONTACT: + case PSM_GETCONTACT: // returns the handle to the contact, associated with this propertysheet if (lParam) { - CPsTreeItem *pti = ((int)wParam != -1) ? pPs->pTree->TreeItem((int)wParam) : pPs->pTree->CurrentItem(); - // prefer to return the contact accociated with the current page + CPsTreeItem *pti = ((int)wParam != -1) ? pPs->pTree->TreeItem((int)wParam) : pPs->pTree->CurrentItem(); if (pti && pti->hContact() != INVALID_CONTACT_ID) { *(MCONTACT *)lParam = pti->hContact(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->hContact()); @@ -921,18 +842,9 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } break; - /** - * @class PSM_GETBASEPROTO - * @desc returns the basic protocol module for the associated contact - * @param wParam - index or -1 for current item - * lParam - pointer to a LPCSTR which takes the protocol string pointer - * - * @return TRUE if successful, FALSE otherwise - **/ - case PSM_GETBASEPROTO: + case PSM_GETBASEPROTO: // returns the basic protocol module for the associated contact if (lParam) { 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(); @@ -951,30 +863,14 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; - /** - * @class PSM_ISLOCKED - * @desc returns the lock state of the propertysheetpage - * @param wParam - not used - * lParam - not used - * - * @return TRUE if propertysheet is locked, FALSE if not - **/ - case PSM_ISLOCKED: + case PSM_ISLOCKED: // returns the lock state of the propertysheetpage { BYTE bLocked = (pPs->dwFlags & PSF_LOCKED) == PSF_LOCKED; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bLocked); return bLocked; } - /** - * @class PSM_FORCECHANGED - * @desc force all propertysheetpages to update their controls with new values from the database - * @param wParam - whether to replace changed settings too or not - * lParam - not used - * - * @return always FALSE - **/ - case PSM_FORCECHANGED: + case PSM_FORCECHANGED: // force all propertysheetpages to update their controls with new values from the database if (!(pPs->dwFlags & PSF_LOCKED)) { BYTE bChanged; @@ -988,19 +884,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } break; - /** - * @class PSM_DLGMESSAGE - * @desc Sends a message to a specified propertysheetpage - * @param wParam - not used - * lParam - LPDLGCOMMAND structure, which contains information about the message to forward - * - * @return E_FAIL if the page was not found - **/ - case PSM_DLGMESSAGE: + case PSM_DLGMESSAGE: // Sends a message to a specified propertysheetpage { LPDLGCOMMAND pCmd = (LPDLGCOMMAND)lParam; CPsTreeItem *pti; - + 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); @@ -1010,15 +898,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } return E_FAIL; - /** - * @class PSM_GETPAGEHWND - * @desc get the window handle for a specified propertysheetpage - * @param wParam - recource id of the dialog recource - * lParam - hinstance of the plugin, which created the dialog box - * - * @return TRUE if handle was found and dialog was created before, false otherwise - **/ - case PSM_GETPAGEHWND: + case PSM_GETPAGEHWND: // get the window handle for a specified propertysheetpage if (CPsTreeItem *pti = pPs->pTree->FindItemByResource((HINSTANCE)lParam, wParam)) { SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->Wnd()); return (pti->Wnd() != nullptr); @@ -1033,242 +913,203 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar return (INT_PTR)bIsAeroMode; } - /** - * @class HM_SETWINDOWTITLE - * @desc set the window title and text of the infobar - * @param wParam - not used - * lParam - DBCONTACTWRITESETTING structure if called by HM_SETTING_CHANGED message handler - * - * @return FALSE - **/ - case HM_SETWINDOWTITLE: - { - DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING *)lParam; - - LPCTSTR pszName; - if (!pPs->hContact) - pszName = TranslateT("Owner"); - else if (pdbcws && pdbcws->value.type == DBVT_WCHAR) - pszName = pdbcws->value.pwszVal; - else - pszName = Clist_GetContactDisplayName(pPs->hContact); - - HWND hName = GetDlgItem(hDlg, TXT_NAME); - SetWindowText(hName, pszName); - SetWindowText(hDlg, CMStringW(FORMAT, L"%s - %s", pszName, TranslateT("edit contact information"))); - SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("View personal user details and more")); - - // redraw the name control - POINT pt = { 0, 0 }; - ScreenToClient(hDlg, &pt); - RECT rc; - GetWindowRect(hName, &rc); - OffsetRect(&rc, pt.x, pt.y); - InvalidateRect(hDlg, &rc, TRUE); - break; - } + case HM_SETWINDOWTITLE: // set the window title and text of the infobar + { + DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING *)lParam; - /** - * @class HM_RELOADICONS - * @desc handles the changed icon event from the icolib plugin and reloads all icons - * @param wParam - not used - * lParam - not used - * - * @return FALSE - **/ - case HM_RELOADICONS: - { - HWND hCtrl; - HICON hIcon; - static const ICONCTRL idIcon[] = { - { ICO_DLG_DETAILS, STM_SETIMAGE, ICO_DLGLOGO }, - { ICO_BTN_UPDATE, BM_SETIMAGE, BTN_UPDATE }, - { ICO_BTN_OK, BM_SETIMAGE, IDOK }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }, - { ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY } - }; - - const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1; - - IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); - - if (hCtrl = GetDlgItem(hDlg, BTN_IMPORT)) { - hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - SetWindowText(hCtrl, hIcon ? L"" : L"I"); - } - if (hCtrl = GetDlgItem(hDlg, BTN_EXPORT)) { - hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - SetWindowText(hCtrl, hIcon ? L"" : L"E"); + LPCTSTR pszName; + if (!pPs->hContact) + pszName = TranslateT("Owner"); + else if (pdbcws && pdbcws->value.type == DBVT_WCHAR) + pszName = pdbcws->value.pwszVal; + else + pszName = Clist_GetContactDisplayName(pPs->hContact); + + HWND hName = GetDlgItem(hDlg, TXT_NAME); + SetWindowText(hName, pszName); + SetWindowText(hDlg, CMStringW(FORMAT, L"%s - %s", pszName, TranslateT("edit contact information"))); + SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("View personal user details and more")); + + // redraw the name control + POINT pt = { 0, 0 }; + ScreenToClient(hDlg, &pt); + RECT rc; + GetWindowRect(hName, &rc); + OffsetRect(&rc, pt.x, pt.y); + InvalidateRect(hDlg, &rc, TRUE); + break; } - // update page icons - if (PtrIsValid(pPs) && (pPs->dwFlags & PSF_INITIALIZED)) - pPs->pTree->OnIconsChanged(); - break; - } - /** - * @class M_CHECKONLINE - * @desc determines whether miranda is online or not - * @param wParam - not used - * lParam - not used - * - * @return TRUE if online, FALSE if offline - **/ - case M_CHECKONLINE: - { - if (IsProtoOnline(pPs->pszProto)) + case HM_RELOADICONS: // handles the changed icon event from the icolib plugin and reloads all icons { - EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), !IsWindowVisible(GetDlgItem(hDlg, TXT_UPDATING))); - return TRUE; + HWND hCtrl; + HICON hIcon; + static const ICONCTRL idIcon[] = { + { ICO_DLG_DETAILS, STM_SETIMAGE, ICO_DLGLOGO }, + { ICO_BTN_UPDATE, BM_SETIMAGE, BTN_UPDATE }, + { ICO_BTN_OK, BM_SETIMAGE, IDOK }, + { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }, + { ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY } + }; + + const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1; + + IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); + + if (hCtrl = GetDlgItem(hDlg, BTN_IMPORT)) { + hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SetWindowText(hCtrl, hIcon ? L"" : L"I"); + } + if (hCtrl = GetDlgItem(hDlg, BTN_EXPORT)) { + hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SetWindowText(hCtrl, hIcon ? L"" : L"E"); + } + // update page icons + if (PtrIsValid(pPs) && (pPs->dwFlags & PSF_INITIALIZED)) + pPs->pTree->OnIconsChanged(); + break; } - EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); - EnableWindow(GetDlgItem(hDlg, TXT_UPDATING), FALSE); - break; - } - - /** - * @class HM_PROTOACK - * @desc handles all acks from the protocol plugin - * @param wParam - not used - * lParam - pointer to a ACKDATA structure - * - * @return FALSE - **/ - case HM_PROTOACK: - { - ACKDATA *ack = (ACKDATA *)lParam; - int i, iSubContact = 0; - - if (!ack->hContact && ack->type == ACKTYPE_STATUS) - return DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); - - switch (ack->type) { - case ACKTYPE_SETINFO: - if (ack->hContact != pPs->hContact || !pPs->pUpload || pPs->pUpload->Handle() != ack->hProcess) - break; - if (ack->result == ACKRESULT_SUCCESS) { - ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); - KillTimer(hDlg, TIMERID_UPDATING); - // upload next protocols contact information - switch (pPs->pUpload->UploadNext()) { - case CPsUpload::UPLOAD_FINISH_CLOSE: - MIR_DELETE(pPs->pUpload); - DestroyWindow(hDlg); - case CPsUpload::UPLOAD_CONTINUE: - return FALSE; - case CPsUpload::UPLOAD_FINISH: - MIR_DELETE(pPs->pUpload); - break; - } - DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); - EnableWindow(pPs->pTree->Window(), TRUE); - if (CPsTreeItem *pti = pPs->pTree->CurrentItem()) - EnableWindow(pti->Wnd(), TRUE); - EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); - pPs->dwFlags &= ~PSF_LOCKED; + case M_CHECKONLINE: // determines whether miranda is online or not + { + if (IsProtoOnline(pPs->pszProto)) { + EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), !IsWindowVisible(GetDlgItem(hDlg, TXT_UPDATING))); + return TRUE; } - else if (ack->result == ACKRESULT_FAILED) { - MsgBox(hDlg, MB_ICON_WARNING, - LPGENW("Upload ICQ details"), - LPGENW("Upload failed"), - LPGENW("Your details were not uploaded successfully.\nThey were written to database only.")); - KillTimer(hDlg, TIMERID_UPDATING); - ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); - DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); - - // upload next protocols contact information - switch (pPs->pUpload->UploadNext()) { - case CPsUpload::UPLOAD_FINISH_CLOSE: - MIR_DELETE(pPs->pUpload); - DestroyWindow(hDlg); - case CPsUpload::UPLOAD_CONTINUE: - return 0; - case CPsUpload::UPLOAD_FINISH: - MIR_DELETE(pPs->pUpload); - break; - } - if (CPsTreeItem *pti = pPs->pTree->CurrentItem()) - EnableWindow(pti->Wnd(), TRUE); - // activate all controls again - EnableWindow(pPs->pTree->Window(), TRUE); - EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); - pPs->dwFlags &= ~PSF_LOCKED; - } + EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); + EnableWindow(GetDlgItem(hDlg, TXT_UPDATING), FALSE); break; + } - case ACKTYPE_GETINFO: - // is contact the owner of the dialog or any metasubcontact of the owner? skip handling otherwise! - if (ack->hContact != pPs->hContact) { - if (!db_get_b(NULL, MODULENAME, SET_META_SCAN, TRUE)) - break; + case HM_PROTOACK: // handles all acks from the protocol plugin + { + ACKDATA *ack = (ACKDATA *)lParam; + int i, iSubContact = 0; - for (i = 0; i < pPs->nSubContacts; i++) { - if (pPs->infosUpdated[i].hContact == ack->hContact) { - iSubContact = i; + if (!ack->hContact && ack->type == ACKTYPE_STATUS) + return DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + + switch (ack->type) { + case ACKTYPE_SETINFO: + if (ack->hContact != pPs->hContact || !pPs->pUpload || pPs->pUpload->Handle() != ack->hProcess) + break; + if (ack->result == ACKRESULT_SUCCESS) { + ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); + KillTimer(hDlg, TIMERID_UPDATING); + // upload next protocols contact information + switch (pPs->pUpload->UploadNext()) { + case CPsUpload::UPLOAD_FINISH_CLOSE: + MIR_DELETE(pPs->pUpload); + DestroyWindow(hDlg); + case CPsUpload::UPLOAD_CONTINUE: + return FALSE; + case CPsUpload::UPLOAD_FINISH: + MIR_DELETE(pPs->pUpload); break; } + DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + EnableWindow(pPs->pTree->Window(), TRUE); + if (CPsTreeItem *pti = pPs->pTree->CurrentItem()) + EnableWindow(pti->Wnd(), TRUE); + EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); + pPs->dwFlags &= ~PSF_LOCKED; } - if (i == pPs->nSubContacts) - break; - } - 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)) { - ResetUpdateInfo(pPs); + else if (ack->result == ACKRESULT_FAILED) { + MsgBox(hDlg, MB_ICON_WARNING, + LPGENW("Upload ICQ details"), + LPGENW("Upload failed"), + LPGENW("Your details were not uploaded successfully.\nThey were written to database only.")); + KillTimer(hDlg, TIMERID_UPDATING); + ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); + DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + + // upload next protocols contact information + switch (pPs->pUpload->UploadNext()) { + case CPsUpload::UPLOAD_FINISH_CLOSE: + MIR_DELETE(pPs->pUpload); + DestroyWindow(hDlg); + case CPsUpload::UPLOAD_CONTINUE: + return 0; + case CPsUpload::UPLOAD_FINISH: + MIR_DELETE(pPs->pUpload); + break; + } + if (CPsTreeItem *pti = pPs->pTree->CurrentItem()) + EnableWindow(pti->Wnd(), TRUE); - ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); - KillTimer(hDlg, TIMERID_UPDATING); - DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + // activate all controls again + EnableWindow(pPs->pTree->Window(), TRUE); + EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); + pPs->dwFlags &= ~PSF_LOCKED; + } break; - } - if (iSubContact < pPs->nSubContacts) { - // init the acks structure for a sub contact - if (pPs->infosUpdated[iSubContact].acks == nullptr) { - pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int) * (int)(INT_PTR)ack->hProcess); - pPs->infosUpdated[iSubContact].count = (int)(INT_PTR)ack->hProcess; + case ACKTYPE_GETINFO: + // is contact the owner of the dialog or any metasubcontact of the owner? skip handling otherwise! + if (ack->hContact != pPs->hContact) { + if (!db_get_b(NULL, MODULENAME, SET_META_SCAN, TRUE)) + break; + + for (i = 0; i < pPs->nSubContacts; i++) { + if (pPs->infosUpdated[i].hContact == ack->hContact) { + iSubContact = i; + break; + } + } + if (i == pPs->nSubContacts) + break; } + else + iSubContact = 0; - if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) - pPs->infosUpdated[iSubContact].acks[ack->lParam] = 1; + // 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)) { + ResetUpdateInfo(pPs); - // check for pending tasks - for (iSubContact = 0; iSubContact < pPs->nSubContacts; iSubContact++) { - for (i = 0; i < pPs->infosUpdated[iSubContact].count; i++) - if (pPs->infosUpdated[iSubContact].acks[i] == 0) - break; + ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); + KillTimer(hDlg, TIMERID_UPDATING); + DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + break; + } - if (i < pPs->infosUpdated[iSubContact].count) - break; + if (iSubContact < pPs->nSubContacts) { + // init the acks structure for a sub contact + if (pPs->infosUpdated[iSubContact].acks == nullptr) { + pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int) * (int)(INT_PTR)ack->hProcess); + pPs->infosUpdated[iSubContact].count = (int)(INT_PTR)ack->hProcess; + } + + if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) + pPs->infosUpdated[iSubContact].acks[ack->lParam] = 1; + + // check for pending tasks + for (iSubContact = 0; iSubContact < pPs->nSubContacts; iSubContact++) { + for (i = 0; i < pPs->infosUpdated[iSubContact].count; i++) + if (pPs->infosUpdated[iSubContact].acks[i] == 0) + break; + + if (i < pPs->infosUpdated[iSubContact].count) + break; + } } - } - // all acks are done, finish updating - if (iSubContact >= pPs->nSubContacts) { - ResetUpdateInfo(pPs); - ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); - KillTimer(hDlg, TIMERID_UPDATING); - DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + // all acks are done, finish updating + if (iSubContact >= pPs->nSubContacts) { + ResetUpdateInfo(pPs); + ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE); + KillTimer(hDlg, TIMERID_UPDATING); + DlgProc(hDlg, M_CHECKONLINE, NULL, NULL); + } } + break; } - break; - } - /** - * @class HM_SETTING_CHANGED - * @desc This message is called by the ME_DB_CONTACT_SETTINGCHANGED event and forces all - * unedited settings in the propertysheetpages to be updated - * @param wParam - handle to the contact whose settings are to be changed - * lParam - DBCONTACTWRITESETTING structure that identifies the changed setting - * @return FALSE - **/ case HM_SETTING_CHANGED: + // This message is called by the ME_DB_CONTACT_SETTINGCHANGED event and forces all + // unedited settings in the propertysheetpages to be updated if (!(pPs->dwFlags & PSF_LOCKED)) { MCONTACT hContact = wParam; DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING *)lParam; @@ -1280,13 +1121,13 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; } - if ( !strcmp(pdbcws->szSetting, SET_CONTACT_MYHANDLE) || !strcmp(pdbcws->szSetting, SET_CONTACT_NICK)) { + if (!strcmp(pdbcws->szSetting, SET_CONTACT_MYHANDLE) || !strcmp(pdbcws->szSetting, SET_CONTACT_NICK)) { // force the update of all propertysheetpages DlgProc(hDlg, PSM_FORCECHANGED, NULL, NULL); // update the windowtitle DlgProc(hDlg, HM_SETWINDOWTITLE, NULL, lParam); } - else if ( !strcmp(pdbcws->szModule, USERINFO) || !strcmp(pdbcws->szModule, pPs->pszProto) || !strcmp(pdbcws->szModule, MOD_MBIRTHDAY)) { + else if (!strcmp(pdbcws->szModule, USERINFO) || !strcmp(pdbcws->szModule, pPs->pszProto) || !strcmp(pdbcws->szModule, MOD_MBIRTHDAY)) { // force the update of all propertysheetpages DlgProc(hDlg, PSM_FORCECHANGED, NULL, NULL); } @@ -1294,9 +1135,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; case WM_NOTIFY: - switch (wParam) { - // Notification Messages sent by the TreeView - case STATIC_TREE: + switch (wParam) { + case STATIC_TREE: // Notification Messages sent by the TreeView switch (((LPNMHDR)lParam)->code) { case TVN_SELCHANGING: pPs->dwFlags |= PSF_LOCKED; @@ -1343,14 +1183,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar 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, nullptr); - } + 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, nullptr); break; case NM_RCLICK: @@ -1360,7 +1198,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; } break; - + case WM_MOUSEMOVE: if (pPs->pTree->IsDragging()) { TVHITTESTINFO hti; @@ -1397,7 +1235,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } } break; - + case WM_LBUTTONUP: // drop item if (pPs->pTree->IsDragging()) { @@ -1407,7 +1245,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TreeView_SetInsertMark(pPs->pTree->Window(), NULL, 0); ReleaseCapture(); SetCursor(LoadCursor(nullptr, IDC_ARROW)); - + TVHITTESTINFO hti; hti.pt.x = (SHORT)LOWORD(lParam); hti.pt.y = (SHORT)HIWORD(lParam); @@ -1443,12 +1281,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } else if (hti.pt.y + (height / 3) <= rc.bottom) bAsChild = true; - } + } pPs->pTree->MoveItem(pPs->pTree->DragItem(), hti.hItem, bAsChild); pPs->pTree->EndDrag(); } - break; - + break; + case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: @@ -1456,10 +1294,6 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar DestroyWindow(hDlg); break; - /** - * name: IDOK / IDAPPLY - * desc: user clicked on apply or ok button in order to save changes - **/ case IDOK: case IDAPPLY: if (pPs->dwFlags & PSF_CHANGED) { @@ -1518,8 +1352,8 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // call the services for (int i = 0; i < pPs->nSubContacts; i++) - if (!ProtoChainSend(pPs->infosUpdated[pPs->nSubContacts].hContact, PSS_GETINFO, NULL, NULL)) - bDo = TRUE; + if (!ProtoChainSend(pPs->infosUpdated[pPs->nSubContacts].hContact, PSS_GETINFO, NULL, NULL)) + bDo = TRUE; if (bDo) { EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); @@ -1573,7 +1407,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar UnhookEvent(pPs->hProtoAckEvent); UnhookEvent(pPs->hSettingChanged); UnhookEvent(pPs->hIconsChanged); - + // save my window position Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "DetailsDlg"); @@ -1592,10 +1426,10 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar return FALSE; } -/** -* @name LoadModule() -* @desc load the UserInfo Module -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name LoadModule() +// @desc load the UserInfo Module + void DlgContactInfoLoadModule() { g_hDetailsInitEvent = CreateHookableEvent(ME_USERINFO_INITIALISE); @@ -1617,10 +1451,10 @@ void DlgContactInfoLoadModule() break; } -/** -* @name UnLoadModule() -* @desc unload the UserInfo Module -**/ +///////////////////////////////////////////////////////////////////////////////////////// +// @name UnLoadModule() +// @desc unload the UserInfo Module + void DlgContactInfoUnLoadModule() { WindowList_Destroy(g_hWindowList); -- cgit v1.2.3