From 4c4735a232c680e60a85d0f85e2cb392e012c6e0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 17:49:56 +0300 Subject: Toaster, TooltipNotify, TrafficCounter, UInfoEx, UserGuide, Variables -> CMPlugin --- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 8 +- plugins/UserInfoEx/src/classPsTree.cpp | 4 +- plugins/UserInfoEx/src/classPsTreeItem.cpp | 2 +- plugins/UserInfoEx/src/commonheaders.cpp | 4 +- plugins/UserInfoEx/src/ctrl_button.cpp | 2 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 6 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 2 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 4 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 6 +- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 2 +- .../UserInfoEx/src/ex_import/dlg_ExImProgress.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 2 +- plugins/UserInfoEx/src/init.cpp | 44 +--- plugins/UserInfoEx/src/mir_icolib.cpp | 2 +- plugins/UserInfoEx/src/psp_anniversary.cpp | 4 +- plugins/UserInfoEx/src/psp_options.cpp | 2 +- plugins/UserInfoEx/src/psp_profile.cpp | 12 +- plugins/UserInfoEx/src/stdafx.h | 22 +- plugins/UserInfoEx/src/svc_constants.h | 270 +++++++++++---------- plugins/UserInfoEx/src/svc_refreshci.cpp | 2 +- 20 files changed, 193 insertions(+), 209 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 347c7c95e3..751d6f8d19 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -194,9 +194,9 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) { FIBITMAP *dib = nullptr; if (lpType) { - HRSRC hResInfo = FindResource(ghInst,MAKEINTRESOURCE(ID),lpType); - DWORD ResSize = SizeofResource(ghInst,hResInfo); - HGLOBAL hRes = LoadResource(ghInst,hResInfo); + HRSRC hResInfo = FindResource(g_plugin.getInst(),MAKEINTRESOURCE(ID),lpType); + DWORD ResSize = SizeofResource(g_plugin.getInst(),hResInfo); + HGLOBAL hRes = LoadResource(g_plugin.getInst(),hResInfo); BYTE* buffer = (BYTE*)LockResource(hRes); if (buffer) { @@ -214,7 +214,7 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) FreeResource(hRes); } else { - HBITMAP hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED); + HBITMAP hScrBM = (HBITMAP)LoadImage(g_plugin.getInst(),MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED); if (hScrBM == nullptr) return dib; dib = FreeImage_CreateDIBFromHBITMAP(hScrBM); diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index 30fef64b68..c2eeb3d210 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -128,7 +128,7 @@ int CPsTree::AddDummyItem(LPCSTR pszGroup) psh._numPages = _numItems; OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = ghInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_UNICODE; odp.szTitle.w = mir_utf8decodeW(pszGroup); @@ -649,7 +649,7 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem) rcTree.right - rc.left, rc.bottom - rc.top, _hWndTree, nullptr, - ghInst, + g_plugin.getInst(), nullptr ); if (_hLabelEdit) { diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 36f8abde3c..c37c7b31a4 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -322,7 +322,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn // the item to insert brings along an icon? if (odp->flags & ODPF_ICON) { // is it uinfoex item? - if (odp->hInstance == ghInst) { + if (odp->hInstance == g_plugin.getInst()) { // the pszGroup holds the iconfile for items added by uinfoex sid.defaultFile.w = odp->szGroup.w; diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 1cfa8ca83b..21c680affe 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -22,10 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" // global: -HINSTANCE ghInst = nullptr; -CLIST_INTERFACE *pcli = nullptr; -MGLOBAL myGlobals; +MGLOBAL myGlobals; pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; /** diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index 9531c0d7f6..6f88bd700b 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -619,7 +619,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L void CtrlButtonUnloadModule() { - UnregisterClass(UINFOBUTTONCLASS, ghInst); + UnregisterClass(UINFOBUTTONCLASS, g_plugin.getInst()); } void CtrlButtonLoadModule() diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 125b7575d3..d252e46ac7 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -693,7 +693,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbi.wFlags = 0; cbi.dwID = 0; - if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { + if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { MCONTACT hContact = NULL; SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); @@ -751,7 +751,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return 1; } - if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { + if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { MCONTACT hContact; SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); @@ -1236,7 +1236,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L **/ int CtrlContactUnLoadModule() { - UnregisterClass(UINFOCOMBOEXCLASS, ghInst); + UnregisterClass(UINFOCOMBOEXCLASS, g_plugin.getInst()); return 0; } diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index b5f9e95614..78b01514a9 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -850,7 +850,7 @@ public: _rcWin.left = _rcWin.right = _rcWin.top = _rcWin.bottom = 0; LoadFilter(); - _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this); + _hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this); if (_hDlg) _mHookExit = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, _hDlg, WM_CLOSE); else { diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index b97ad0f0e7..137fe5bd7a 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -646,9 +646,9 @@ INT_PTR MsgBoxService(WPARAM, LPARAM lParam) && 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(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam); - return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam); + return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam); } return -1; } diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 0ad616897e..b0500db926 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -329,7 +329,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) qsort(psh._pPages, psh._numPages, sizeof(CPsTreeItem*), (int(*)(const void*, const void*))SortProc); // create the dialog itself - if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh)) + if (!CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh)) MsgErr(nullptr, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError()); return 0; } @@ -506,7 +506,7 @@ static int InitDetails(WPARAM wParam, LPARAM lParam) BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE); if (lParam || bChangeDetailsEnabled) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = ghInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_ICON | ODPF_UNICODE; odp.szGroup.w = IcoLib_GetDefaultIconFileName(); @@ -1426,7 +1426,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } else { TreeView_SetInsertMark(pPs->pTree->Window(), NULL, 0); - SetCursor(LoadCursor(ghInst, MAKEINTRESOURCE(CURSOR_ADDGROUP))); + SetCursor(LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(CURSOR_ADDGROUP))); } } } diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 56c501d28c..fe7bedb5c7 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -432,6 +432,6 @@ int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList* dat.ExImContact = ExImContact; dat.pModules = pModules; - return (IDOK != DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat)); + return (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat)); } diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index 6e121bc8b9..4b68a0de12 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar CProgress::CProgress() { _dwStartTime = GetTickCount(); - _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); + _hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); } /** diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 0349babe2b..a3c8f29591 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -90,7 +90,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) { DB::CEnumList Modules; - DWORD result = (DWORD) DialogBox(ghInst, + DWORD result = (DWORD) DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY), nullptr, DlgProc_DataHistory); if (LOWORD(result) != IDOK) diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 4fa242d8ed..a2191e14d2 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -21,7 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static PLUGININFOEX pluginInfo = { +CLIST_INTERFACE *pcli; +CMPlugin g_plugin; +int hLangpack; +HMODULE hDwmApi; + +///////////////////////////////////////////////////////////////////////////////////////// + +static PLUGININFOEX pluginInfo = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -34,9 +42,6 @@ static PLUGININFOEX pluginInfo = { {0x9c23a24b, 0xe6aa, 0x43c6, {0xb0, 0xb8, 0xd6, 0xc3, 0x6d, 0x2f, 0x7b, 0x57}} }; -int hLangpack; -HMODULE hDwmApi; - /* ============================================================================================ event hooks @@ -110,22 +115,10 @@ static int OnShutdown(WPARAM, LPARAM) return 0; } -/* -============================================================================================ - plugin interface & DllEntrypoint -============================================================================================ -*/ +//============================================================================================ +// plugin interface +//============================================================================================ -/** - * This function is called by Miranda to get some information about this plugin. - * - * @return pointer to pluginInfo struct - **/ -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - myGlobals.mirandaVersion = mirandaVersion; - return &pluginInfo; -} /** * This function returns the provided interfaces. @@ -205,16 +198,3 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; } - -/** - * Windows needs it for loading. - * - * @return TRUE - **/ -BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - ghInst = hinst; - - return TRUE; -} diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index 3c3ed95943..1c3aafa8a8 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -323,7 +323,7 @@ static IconItem common[] = void IcoLib_LoadModule() { - Icon_Register(ghInst, SECT_COMMON, common, 2); + Icon_Register(g_plugin.getInst(), SECT_COMMON, common, 2); LPTSTR szDefaultFile = IcoLib_GetDefaultIconFileName(); IcoLib_CheckIconPackVersion(szDefaultFile); diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index f4f3b89427..7b9eb45537 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -199,7 +199,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case BTN_ADD: if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) { MAnnivDate Date; - if (IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date)) { + if (IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date)) { SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL); if (!pDateCtrl->AddDate(Date)) pDateCtrl->SetCurSel(pDateCtrl->NumDates() - 1); @@ -217,7 +217,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (!pDate) MsgErr(hDlg, LPGENW("No valid date selected for editing!")); else if ( - IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate) && + IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate) && (pDate->Flags() & (MAnnivDate::MADF_CHANGED | MAnnivDate::MADF_REMINDER_CHANGED))) { SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL); diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 8c98ef6c57..5c4355f36a 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -1030,7 +1030,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 95400; - odp.hInstance = ghInst; + odp.hInstance = g_plugin.getInst(); odp.szTitle.a = MODULELONGNAME; odp.szGroup.a = LPGEN("Contacts"); diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index 07e2043a1f..85e34efec7 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -318,7 +318,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem 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, nullptr, ghInst, nullptr); + pList->hList, nullptr, g_plugin.getInst(), nullptr); if (pList->labelEdit.hBtn) { SetWindowLongPtr(pList->labelEdit.hBtn, GWLP_ID, BTN_EDIT); pList->labelEdit.rcCombo.right -= pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top; @@ -341,7 +341,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.top, pList->labelEdit.rcCombo.right - pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, - pList->hList, nullptr, ghInst, nullptr); + pList->hList, nullptr, g_plugin.getInst(), nullptr); if (!pList->labelEdit.hEdit) return nullptr; SendMessage(pList->labelEdit.hEdit, WM_SETFONT, (WPARAM)(pList->hFont), 0); @@ -832,7 +832,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) { ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT; - ti.hinst = ghInst; + ti.hinst = g_plugin.getInst(); ti.hwnd = hwnd; ti.uId = (UINT_PTR)hwnd; ti.lpszText = pItem->pszText[hi.iSubItem]; @@ -933,7 +933,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", nullptr, WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_COMBOBOX | LBS_HASSTRINGS, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, - hwnd, nullptr, ghInst, nullptr); + hwnd, nullptr, g_plugin.getInst(), nullptr); if (!pList->labelEdit.dropDown.hDrop) return FALSE; SetUserData(pList->labelEdit.dropDown.hDrop, pList); @@ -1071,7 +1071,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // initiate the tooltips pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, ghInst, nullptr); + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, g_plugin.getInst(), nullptr); if (pList->hTip) { SetWindowPos(pList->hTip, HWND_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -1079,7 +1079,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR memset(&ti, 0, sizeof(TOOLINFO)); ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT; - ti.hinst = ghInst; + ti.hinst = g_plugin.getInst(); ti.hwnd = hList; ti.uId = (UINT_PTR)hList; SendMessage(pList->hTip, TTM_ADDTOOL, NULL, (LPARAM)&ti); diff --git a/plugins/UserInfoEx/src/stdafx.h b/plugins/UserInfoEx/src/stdafx.h index c34ad85bde..ce7655e304 100644 --- a/plugins/UserInfoEx/src/stdafx.h +++ b/plugins/UserInfoEx/src/stdafx.h @@ -48,7 +48,6 @@ using namespace std; * Miranda NG SDK includes and macros ***********************************************************************************************************/ -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -159,18 +158,23 @@ unsigned int hashSettingW_M2(const char * key); //new Murma2 hash * UserInfoEx global variables ***********************************************************************************************************/ +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODNAME) + {} +}; + typedef struct _MGLOBAL { - DWORD mirandaVersion; // mirandaVersion - BYTE CanChangeDetails : 1; // is service to upload own contact information for icq present? - BYTE TzIndexExist : 1; // Win Reg has Timzone Index Info - BYTE PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist - BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value - BYTE WantAeroAdaption : 1; // reserved for later use + BYTE CanChangeDetails : 1; // is service to upload own contact information for icq present? + BYTE TzIndexExist : 1; // Win Reg has Timzone Index Info + BYTE PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist + BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value + BYTE WantAeroAdaption : 1; // reserved for later use } MGLOBAL, *LPMGLOBAL; -extern HINSTANCE ghInst; -extern MGLOBAL myGlobals; +extern MGLOBAL myGlobals; extern int nCountriesCount; extern struct CountryListEntry *countries; diff --git a/plugins/UserInfoEx/src/svc_constants.h b/plugins/UserInfoEx/src/svc_constants.h index 453693380b..60dbc10f7f 100644 --- a/plugins/UserInfoEx/src/svc_constants.h +++ b/plugins/UserInfoEx/src/svc_constants.h @@ -22,151 +22,153 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _SVC_CONSTANTS_INCLUDED_ #define _SVC_CONSTANTS_INCLUDED_ -#define MODULELONGNAME LPGEN("Extended user info") -#define USERINFO "UserInfo" -#define MODNAME "UserInfoEx" -#define MODNAMEFLAGS "Flags" - -#define MODULELONGNAMET _T(MODULELONGNAME) -#define MODNAMET _T(MODNAME) - -#define MAXDATASIZE 1024 // maximum character count of most static, temporary, ...., strings -#define MAXCATLEN 64 // maximum character count for a category string (phone, email, interest, ...) -#define MAXSETTING 255 // maximum character count for a setting string -#define MAXNAME 260 // maximum character count for a username -#define MAXUID 260 // maximum character count for a uin +#define MODNAME "UserInfoEx" +#define MODNAMET _T(MODNAME) +#define USERINFO "UserInfo" +#define MODNAMEFLAGS "Flags" +#define MODULELONGNAME LPGEN("Extended user info") +#define MODULELONGNAMET _T(MODULELONGNAME) + +#define MAXDATASIZE 1024 // maximum character count of most static, temporary, ...., strings +#define MAXCATLEN 64 // maximum character count for a category string (phone, email, interest, ...) +#define MAXSETTING 255 // maximum character count for a setting string +#define MAXNAME 260 // maximum character count for a username +#define MAXUID 260 // maximum character count for a uin // most important modules -#define MOD_MBIRTHDAY "mBirthday" -#define MOD_CLIST "CList" +#define MOD_MBIRTHDAY "mBirthday" +#define MOD_CLIST "CList" // database settings (propertysheet) -#define SET_PROPSHEET_PCBIREADONLY "PBCIReadOnly" -#define SET_PROPSHEET_READONLYLABEL "TILReadonly" -#define SET_PROPSHEET_AEROADAPTION "AeroAdaption" -#define SET_PROPSHEET_SHOWCOLOURS "ShowColours" -#define SET_PROPSHEET_CLRNORMAL "colourNormal" -#define SET_PROPSHEET_CLRCUSTOM "colourUser" -#define SET_PROPSHEET_CLRBOTH "colourBoth" -#define SET_PROPSHEET_CLRCHANGED "colourChanged" -#define SET_PROPSHEET_CLRMETA "colourMeta" -#define SET_PROPSHEET_SAVEVCARD "vCardOnExit" -#define SET_PROPSHEET_GROUPS "TreeGroups" -#define SET_PROPSHEET_SORTITEMS "TreeSortItems" -#define SET_PROPSHEET_CHANGEMYDETAILS "ChangeMyDetails" -#define SET_ABOUT_ACTIVEWINDOW "AboutActiveWin" -#define SET_MI_MAIN "miMenu" -#define SET_MI_CONTACT "miContact" -#define SET_MI_GROUP "miGroup" -#define SET_MI_SUBGROUP "miSubGroup" -#define SET_MI_STATUS "miStatus" -#define SET_MI_ACCOUNT "miAccount" - -#define SET_EXTENDED_EMAILSERVICE "emailEx" -#define SET_CLIST_EXTRAICON_GENDER "GenderColumn" -#define SET_CLIST_EXTRAICON_GENDER2 "cliGender" -#define SET_CLIST_EXTRAICON_COUNTRY "CountryColumn" -#define SET_CLIST_EXTRAICON_HOMEPAGE "cliHomepage" -#define SET_CLIST_EXTRAICON_EMAIL "cliEmail" -#define SET_CLIST_EXTRAICON_PHONE "cliPhone" -#define SET_OPT_AUTOTIMEZONE "AutoTimezone" -#define SET_ZODIAC_AVATARS "ZodicAvatars" -#define SET_META_SCAN "MetaScan" -// database settings (general psp) -#define SET_ME_PASSWORD "Password" -#define SET_CONTACT_TITLE "Title" -#define SET_CONTACT_FIRSTNAME "FirstName" -#define SET_CONTACT_SECONDNAME "SecondName" -#define SET_CONTACT_LASTNAME "LastName" -#define SET_CONTACT_FIRSTLASTNAME "FullName" -#define SET_CONTACT_PREFIX "Prefix" -#define SET_CONTACT_NICK "Nick" -#define SET_CONTACT_MYHANDLE "MyHandle" -#define SET_CONTACT_STREET "Street" -#define SET_CONTACT_ZIP "Zip" -#define SET_CONTACT_CITY "City" -#define SET_CONTACT_STATE "State" -#define SET_CONTACT_COUNTRY "Country" -#define SET_CONTACT_GENDER "Gender" +#define SET_PROPSHEET_PCBIREADONLY "PBCIReadOnly" +#define SET_PROPSHEET_READONLYLABEL "TILReadonly" +#define SET_PROPSHEET_AEROADAPTION "AeroAdaption" +#define SET_PROPSHEET_SHOWCOLOURS "ShowColours" +#define SET_PROPSHEET_CLRNORMAL "colourNormal" +#define SET_PROPSHEET_CLRCUSTOM "colourUser" +#define SET_PROPSHEET_CLRBOTH "colourBoth" +#define SET_PROPSHEET_CLRCHANGED "colourChanged" +#define SET_PROPSHEET_CLRMETA "colourMeta" +#define SET_PROPSHEET_SAVEVCARD "vCardOnExit" +#define SET_PROPSHEET_GROUPS "TreeGroups" +#define SET_PROPSHEET_SORTITEMS "TreeSortItems" +#define SET_PROPSHEET_CHANGEMYDETAILS "ChangeMyDetails" +#define SET_ABOUT_ACTIVEWINDOW "AboutActiveWin" +#define SET_MI_MAIN "miMenu" +#define SET_MI_CONTACT "miContact" +#define SET_MI_GROUP "miGroup" +#define SET_MI_SUBGROUP "miSubGroup" +#define SET_MI_STATUS "miStatus" +#define SET_MI_ACCOUNT "miAccount" + +#define SET_EXTENDED_EMAILSERVICE "emailEx" +#define SET_CLIST_EXTRAICON_GENDER "GenderColumn" +#define SET_CLIST_EXTRAICON_GENDER2 "cliGender" +#define SET_CLIST_EXTRAICON_COUNTRY "CountryColumn" +#define SET_CLIST_EXTRAICON_HOMEPAGE "cliHomepage" +#define SET_CLIST_EXTRAICON_EMAIL "cliEmail" +#define SET_CLIST_EXTRAICON_PHONE "cliPhone" +#define SET_OPT_AUTOTIMEZONE "AutoTimezone" +#define SET_ZODIAC_AVATARS "ZodicAvatars" +#define SET_META_SCAN "MetaScan" + +// database settings (general psp) +#define SET_ME_PASSWORD "Password" +#define SET_CONTACT_TITLE "Title" +#define SET_CONTACT_FIRSTNAME "FirstName" +#define SET_CONTACT_SECONDNAME "SecondName" +#define SET_CONTACT_LASTNAME "LastName" +#define SET_CONTACT_FIRSTLASTNAME "FullName" +#define SET_CONTACT_PREFIX "Prefix" +#define SET_CONTACT_NICK "Nick" +#define SET_CONTACT_MYHANDLE "MyHandle" +#define SET_CONTACT_STREET "Street" +#define SET_CONTACT_ZIP "Zip" +#define SET_CONTACT_CITY "City" +#define SET_CONTACT_STATE "State" +#define SET_CONTACT_COUNTRY "Country" +#define SET_CONTACT_GENDER "Gender" // database settings (advanced psp) -#define SET_CONTACT_ORIGIN_STREET "OriginStreet" -#define SET_CONTACT_ORIGIN_ZIP "OriginZip" -#define SET_CONTACT_ORIGIN_CITY "OriginCity" -#define SET_CONTACT_ORIGIN_STATE "OriginState" -#define SET_CONTACT_ORIGIN_COUNTRY "OriginCountry" -#define SET_CONTACT_LANG1 "Language1" -#define SET_CONTACT_LANG2 "Language2" -#define SET_CONTACT_LANG3 "Language3" -#define SET_CONTACT_MARITAL "MaritalStatus" -#define SET_CONTACT_PARTNER "Partner" -#define SET_CONTACT_ANNIVERSARY "Anniv" -#define SET_CONTACT_AGE "Age" -#define SET_CONTACT_TIMEZONE "Timezone" -#define SET_CONTACT_TIMEZONENAME "TzName" -#define SET_CONTACT_TIMEZONEINDEX "TzIndex" -#define SET_CONTACT_BIRTH "Birth" -#define SET_CONTACT_BIRTHDAY "BirthDay" -#define SET_CONTACT_BIRTHMONTH "BirthMonth" -#define SET_CONTACT_BIRTHYEAR "BirthYear" -#define SET_CONTACT_DOBD "DOBd" -#define SET_CONTACT_DOBM "DOBm" -#define SET_CONTACT_DOBY "DOBy" +#define SET_CONTACT_ORIGIN_STREET "OriginStreet" +#define SET_CONTACT_ORIGIN_ZIP "OriginZip" +#define SET_CONTACT_ORIGIN_CITY "OriginCity" +#define SET_CONTACT_ORIGIN_STATE "OriginState" +#define SET_CONTACT_ORIGIN_COUNTRY "OriginCountry" +#define SET_CONTACT_LANG1 "Language1" +#define SET_CONTACT_LANG2 "Language2" +#define SET_CONTACT_LANG3 "Language3" +#define SET_CONTACT_MARITAL "MaritalStatus" +#define SET_CONTACT_PARTNER "Partner" +#define SET_CONTACT_ANNIVERSARY "Anniv" +#define SET_CONTACT_AGE "Age" +#define SET_CONTACT_TIMEZONE "Timezone" +#define SET_CONTACT_TIMEZONENAME "TzName" +#define SET_CONTACT_TIMEZONEINDEX "TzIndex" +#define SET_CONTACT_BIRTH "Birth" +#define SET_CONTACT_BIRTHDAY "BirthDay" +#define SET_CONTACT_BIRTHMONTH "BirthMonth" +#define SET_CONTACT_BIRTHYEAR "BirthYear" +#define SET_CONTACT_DOBD "DOBd" +#define SET_CONTACT_DOBM "DOBm" +#define SET_CONTACT_DOBY "DOBy" + // database settings (company psp) -#define SET_CONTACT_COMPANY_POSITION "CompanyPosition" -#define SET_CONTACT_COMPANY_OCCUPATION "CompanyOccupation" -#define SET_CONTACT_COMPANY_SUPERIOR "CompanySuperior" -#define SET_CONTACT_COMPANY_ASSISTENT "CompanyAssistent" -#define SET_CONTACT_COMPANY "Company" -#define SET_CONTACT_COMPANY_DEPARTMENT "CompanyDepartment" -#define SET_CONTACT_COMPANY_OFFICE "CompanyOffice" -#define SET_CONTACT_COMPANY_STREET "CompanyStreet" -#define SET_CONTACT_COMPANY_ZIP "CompanyZip" -#define SET_CONTACT_COMPANY_CITY "CompanyCity" -#define SET_CONTACT_COMPANY_STATE "CompanyState" -#define SET_CONTACT_COMPANY_COUNTRY "CompanyCountry" -#define SET_CONTACT_COMPANY_HOMEPAGE "CompanyHomepage" -// database settings (about psp) -#define SET_CONTACT_ABOUT "About" -#define SET_CONTACT_MYNOTES "MyNotes" -// database settings (... psp) -#define SET_CONTACT_PHONE "Phone" -#define SET_CONTACT_FAX "Fax" -#define SET_CONTACT_CELLULAR "Cellular" -#define SET_CONTACT_EMAIL "e-mail" -#define SET_CONTACT_EMAIL0 "e-mail0" -#define SET_CONTACT_EMAIL1 "e-mail1" -#define SET_CONTACT_HOMEPAGE "Homepage" -#define SET_CONTACT_COMPANY_PHONE "CompanyPhone" -#define SET_CONTACT_COMPANY_FAX "CompanyFax" -#define SET_CONTACT_COMPANY_CELLULAR "CompanyCellular" -#define SET_CONTACT_COMPANY_EMAIL "Companye-mail" -#define SET_CONTACT_COMPANY_EMAIL0 "Companye-mail0" -#define SET_CONTACT_COMPANY_EMAIL1 "Companye-mail1" - -#define SET_CONTACT_MYPHONE_VAL "MyPhone%d" -#define SET_CONTACT_MYPHONE_CAT "MyPhone%dCat" -#define SET_CONTACT_COMPANY_MYPHONE_VAL "MyCompanyPhone%d" -#define SET_CONTACT_COMPANY_MYPHONE_CAT "MyCompanyPhone%dCat" -#define SET_CONTACT_MYEMAIL_VAL "Mye-mail%d" -#define SET_CONTACT_MYEMAIL_CAT "Mye-mail%dCat" -#define SET_CONTACT_COMPANY_MYEMAIL_VAL "MyCompanye-mail%d" -#define SET_CONTACT_COMPANY_MYEMAIL_CAT "MyCompanye-mail%dCat" - -#define SET_CONTACT_ADDEDTIME "ContactAddTime" +#define SET_CONTACT_COMPANY_POSITION "CompanyPosition" +#define SET_CONTACT_COMPANY_OCCUPATION "CompanyOccupation" +#define SET_CONTACT_COMPANY_SUPERIOR "CompanySuperior" +#define SET_CONTACT_COMPANY_ASSISTENT "CompanyAssistent" +#define SET_CONTACT_COMPANY "Company" +#define SET_CONTACT_COMPANY_DEPARTMENT "CompanyDepartment" +#define SET_CONTACT_COMPANY_OFFICE "CompanyOffice" +#define SET_CONTACT_COMPANY_STREET "CompanyStreet" +#define SET_CONTACT_COMPANY_ZIP "CompanyZip" +#define SET_CONTACT_COMPANY_CITY "CompanyCity" +#define SET_CONTACT_COMPANY_STATE "CompanyState" +#define SET_CONTACT_COMPANY_COUNTRY "CompanyCountry" +#define SET_CONTACT_COMPANY_HOMEPAGE "CompanyHomepage" +// database settings (about psp) +#define SET_CONTACT_ABOUT "About" +#define SET_CONTACT_MYNOTES "MyNotes" +// database settings (... psp) +#define SET_CONTACT_PHONE "Phone" +#define SET_CONTACT_FAX "Fax" +#define SET_CONTACT_CELLULAR "Cellular" +#define SET_CONTACT_EMAIL "e-mail" +#define SET_CONTACT_EMAIL0 "e-mail0" +#define SET_CONTACT_EMAIL1 "e-mail1" +#define SET_CONTACT_HOMEPAGE "Homepage" +#define SET_CONTACT_COMPANY_PHONE "CompanyPhone" +#define SET_CONTACT_COMPANY_FAX "CompanyFax" +#define SET_CONTACT_COMPANY_CELLULAR "CompanyCellular" +#define SET_CONTACT_COMPANY_EMAIL "Companye-mail" +#define SET_CONTACT_COMPANY_EMAIL0 "Companye-mail0" +#define SET_CONTACT_COMPANY_EMAIL1 "Companye-mail1" + +#define SET_CONTACT_MYPHONE_VAL "MyPhone%d" +#define SET_CONTACT_MYPHONE_CAT "MyPhone%dCat" +#define SET_CONTACT_COMPANY_MYPHONE_VAL "MyCompanyPhone%d" +#define SET_CONTACT_COMPANY_MYPHONE_CAT "MyCompanyPhone%dCat" +#define SET_CONTACT_MYEMAIL_VAL "Mye-mail%d" +#define SET_CONTACT_MYEMAIL_CAT "Mye-mail%dCat" +#define SET_CONTACT_COMPANY_MYEMAIL_VAL "MyCompanye-mail%d" +#define SET_CONTACT_COMPANY_MYEMAIL_CAT "MyCompanye-mail%dCat" + +#define SET_CONTACT_ADDEDTIME "ContactAddTime" + // default values for some of the options -#define DEFVAL_GETCONTACTINFO_ENABLED 1 +#define DEFVAL_GETCONTACTINFO_ENABLED 1 -#define DEFVAL_CLIST_EXTRAICON_GENDER 2 -#define DEFVAL_CLIST_EXTRAICON_COUNTRY 3 +#define DEFVAL_CLIST_EXTRAICON_GENDER 2 +#define DEFVAL_CLIST_EXTRAICON_COUNTRY 3 #define DEFVAL_CLIST_EXTRAICON_HOMEPAGE 1 -#define DEFVAL_CLIST_EXTRAICON_EMAIL 1 -#define DEFVAL_CLIST_EXTRAICON_PHONE 1 +#define DEFVAL_CLIST_EXTRAICON_EMAIL 1 +#define DEFVAL_CLIST_EXTRAICON_PHONE 1 typedef struct CIDList { - int nID; - LPCSTR pszText; - LPTSTR ptszTranslated; + int nID; + LPCSTR pszText; + LPTSTR ptszTranslated; } IDSTRLIST, *LPIDSTRLIST; @@ -182,4 +184,4 @@ INT_PTR GetNamePrefixList(LPUINT pListSize, LPIDSTRLIST *pList); void SvcConstantsLoadModule(void); void SvcConstantsUnloadModule(void); -#endif /* _SVC_CONSTANTS_INCLUDED_ */ \ No newline at end of file +#endif /* _SVC_CONSTANTS_INCLUDED_ */ diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index c1a9ac3bf7..986e2bfa52 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -281,7 +281,7 @@ public: virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack) { _pFnCallBack = pFnCallBack; - _hWnd = CreateDialogParam(ghInst, + _hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_REFRESHDETAILS), nullptr, CDlgUpdProgress::WndProc, -- cgit v1.2.3