From f719c8b921c7a46b76453476204224d40c682914 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Jul 2018 21:32:58 +0300 Subject: int hLangpack/m_hLang removed and replaced with HPLUGIN --- src/core/stdautoaway/src/options.cpp | 2 +- src/core/stdaway/src/awaymsg.cpp | 2 +- src/core/stdaway/src/sendmsg.cpp | 3 +-- src/core/stdclist/src/clcopts.cpp | 3 +-- src/core/stdclist/src/clistopts.cpp | 3 +-- src/core/stdclist/src/cluiopts.cpp | 3 +-- src/core/stdcrypt/src/encrypt.cpp | 2 +- src/core/stdemail/src/email.cpp | 2 +- src/core/stdfile/src/file.cpp | 4 ++-- src/core/stdfile/src/fileopts.cpp | 3 +-- src/core/stdmsg/src/chat_manager.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 26 +++++++++++++------------- src/core/stduihist/src/history.cpp | 2 +- src/core/stduserinfo/src/stdinfo.cpp | 4 +--- src/core/stduserinfo/src/userinfo.cpp | 24 ++++++++++++------------ 15 files changed, 39 insertions(+), 46 deletions(-) (limited to 'src/core') diff --git a/src/core/stdautoaway/src/options.cpp b/src/core/stdautoaway/src/options.cpp index 79f6795174..aeaa9c66fb 100644 --- a/src/core/stdautoaway/src/options.cpp +++ b/src/core/stdautoaway/src/options.cpp @@ -124,7 +124,7 @@ public: int IdleOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = 100000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IDLE); odp.szGroup.a = LPGEN("Status"); diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index d7e8ae2b48..ef9c3a2799 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -166,7 +166,7 @@ int LoadAwayMsgModule(void) hWindowList = WindowList_Create(); CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0xd3282acc, 0x9ff1, 0x4ede, 0x8a, 0x1e, 0x36, 0x72, 0x3f, 0x44, 0x4f, 0x84); mi.position = -2000005000; mi.flags = CMIF_NOTOFFLINE; diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index cc416c4ef6..377f9e5200 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -515,9 +515,8 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) if (protoModeMsgFlags == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = 870000000; - odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG); odp.szTitle.a = LPGEN("Status messages"); odp.szGroup.a = LPGEN("Status"); diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 311e3a959d..e88a137266 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -423,8 +423,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int ClcOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_plugin.getInst(); + OPTIONSDIALOGPAGE odp = {}; odp.szGroup.a = LPGEN("Contact list"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); odp.szTitle.a = LPGEN("List"); diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 10892215ac..31c98f78ca 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -192,9 +192,8 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int CListOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = -1000000000; - odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); odp.szTitle.a = LPGEN("Contact list"); odp.pfnDlgProc = DlgProcGenOpts; diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 2584384cad..82ed81a612 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -310,8 +310,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int CluiOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_plugin.getInst(); + OPTIONSDIALOGPAGE odp = {}; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); odp.szTitle.a = LPGEN("Window"); odp.szGroup.a = LPGEN("Contact list"); diff --git a/src/core/stdcrypt/src/encrypt.cpp b/src/core/stdcrypt/src/encrypt.cpp index 1fe6cd083b..5341a9927d 100644 --- a/src/core/stdcrypt/src/encrypt.cpp +++ b/src/core/stdcrypt/src/encrypt.cpp @@ -211,7 +211,7 @@ int LoadEncryptionModule(void) cp.pszName = "AES (Rjindale)"; cp.szDescr.a = LPGEN("Standard crypto provider"); cp.pFactory = builder; - cp.iLangId = g_plugin.m_hLang; + cp.pPlugin = &g_plugin; CallService(MS_CRYPTO_REGISTER_ENGINE, 0, LPARAM(&cp)); return 0; } diff --git a/src/core/stdemail/src/email.cpp b/src/core/stdemail/src/email.cpp index ab7cde149d..1ad9e70c2b 100644 --- a/src/core/stdemail/src/email.cpp +++ b/src/core/stdemail/src/email.cpp @@ -66,7 +66,7 @@ static int EMailPreBuildMenu(WPARAM hContact, LPARAM) int LoadSendRecvEMailModule(void) { - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x61d8e25a, 0x92e, 0x4470, 0x84, 0x57, 0x5e, 0x52, 0x17, 0x7f, 0xfa, 0x3); mi.position = -2000010000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SENDEMAIL); diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 977536464d..c9f15ef1d5 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -315,7 +315,7 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam) static int SRFileModulesLoaded(WPARAM, LPARAM) { - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x7f8dcf77, 0xe448, 0x4505, 0xb0, 0x56, 0xb, 0xb1, 0xab, 0xac, 0x64, 0x9d); mi.position = -2000020000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); @@ -414,7 +414,7 @@ int LoadSendRecvFileModule(void) { CreateServiceFunction("FtMgr/Show", FtMgrShowCommand); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x75794ab5, 0x2573, 0x48f4, 0xb4, 0xa0, 0x93, 0xd6, 0xf5, 0xe0, 0xf3, 0x32); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.position = 1900000000; diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 88a320883d..6e98fb682c 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -224,9 +224,8 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int FileOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = 900000000; - odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER); odp.szTitle.a = LPGEN("File transfers"); odp.szGroup.a = LPGEN("Events"); diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index ed1badbeb4..84afc895b4 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -228,7 +228,7 @@ void Load_ChatModule() AddIcons(); RegisterFonts(); - CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message sessions") L"/" LPGENW("Chat module"), FONTMODE_USE, g_plugin.m_hLang }; + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message sessions") L"/" LPGENW("Chat module"), FONTMODE_USE, &g_plugin }; Chat_CustomizeApi(&data); g_chatApi.OnCreateModule = OnCreateModule; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index ea33f6e3d7..1c0da02179 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -358,21 +358,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_ADDCONTACT); bbd.pwszText = LPGENW("&Add"); bbd.pwszTooltip = LPGENW("Add contact permanently to list"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_USERMENU; bbd.dwDefPos = 20; bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW); bbd.pwszText = LPGENW("&User menu"); bbd.pwszTooltip = LPGENW("User menu"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_DETAILS; bbd.dwDefPos = 30; bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); bbd.pwszText = LPGENW("User &details"); bbd.pwszTooltip = LPGENW("View user's details"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON; bbd.dwButtonID = IDC_SRMM_HISTORY; @@ -380,7 +380,7 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); bbd.pwszText = LPGENW("&History"); bbd.pwszTooltip = LPGENW("View user's history (CTRL+H)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); // chat buttons bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID; @@ -389,35 +389,35 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.hIcon = GetIconHandle("bold"); bbd.pwszText = LPGENW("&Bold"); bbd.pwszTooltip = LPGENW("Make the text bold (CTRL+B)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_ITALICS; bbd.dwDefPos = 15; bbd.hIcon = GetIconHandle("italics"); bbd.pwszText = LPGENW("&Italic"); bbd.pwszTooltip = LPGENW("Make the text italicized (CTRL+I)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_UNDERLINE; bbd.dwDefPos = 20; bbd.hIcon = GetIconHandle("underline"); bbd.pwszText = LPGENW("&Underline"); bbd.pwszTooltip = LPGENW("Make the text underlined (CTRL+U)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_COLOR; bbd.dwDefPos = 25; bbd.hIcon = GetIconHandle("fgcol"); bbd.pwszText = LPGENW("&Color"); bbd.pwszTooltip = LPGENW("Select a foreground color for the text (CTRL+K)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_BKGCOLOR; bbd.dwDefPos = 30; bbd.hIcon = GetIconHandle("bkgcol"); bbd.pwszText = LPGENW("&Background color"); bbd.pwszTooltip = LPGENW("Select a background color for the text (CTRL+L)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; bbd.dwButtonID = IDC_SRMM_CHANMGR; @@ -425,21 +425,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.hIcon = GetIconHandle("settings"); bbd.pwszText = LPGENW("&Room settings"); bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST; bbd.dwDefPos = 20; bbd.hIcon = GetIconHandle("nicklist"); bbd.pwszText = LPGENW("&Show/hide nick list"); bbd.pwszTooltip = LPGENW("Show/hide the nick list (CTRL+N)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_FILTER; bbd.dwDefPos = 10; bbd.hIcon = GetIconHandle("filter"); bbd.pwszText = LPGENW("&Filter"); bbd.pwszTooltip = LPGENW("Enable/disable the event filter (CTRL+F)"); - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); return 0; } @@ -493,7 +493,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) LoadMsgLogIcons(); OnCheckPlugins(0, 0); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x58d8dc1, 0x1c25, 0x49c0, 0xb8, 0x7c, 0xa3, 0x22, 0x2b, 0x3d, 0xf1, 0xd8); mi.position = -2000090000; mi.flags = CMIF_DEFAULT; diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index c5e6850b58..c3de5fbee5 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -399,7 +399,7 @@ static int PreShutdownHistoryModule(WPARAM, LPARAM) int LoadHistoryModule(void) { - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x28848d7a, 0x6995, 0x4799, 0x82, 0xd7, 0x18, 0x40, 0x3d, 0xe3, 0x71, 0xc4); mi.position = 1000090000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 1cf54246b4..22f17335fe 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -607,9 +607,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if (GetContactProto(lParam) == nullptr) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_plugin.getInst(); - + OPTIONSDIALOGPAGE odp = {}; odp.pfnDlgProc = SummaryDlgProc; odp.position = -2100000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SUMMARY); diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 33206334ef..5f43ae35a7 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -45,7 +45,8 @@ struct DetailsPageData LPARAM dlgParam; HWND hwnd; HTREEITEM hItem; - int changed, hLangpack; + HPLUGIN pPlugin; + int changed; wchar_t *ptszTitle, *ptszTab; }; @@ -66,12 +67,12 @@ struct DetailsData wchar_t* getTitle(OPTIONSDIALOGPAGE *p) { - return (p->flags & ODPF_DONTTRANSLATE) ? p->szTitle.w : TranslateW_LP(p->szTitle.w, p->langId); + return (p->flags & ODPF_DONTTRANSLATE) ? p->szTitle.w : TranslateW_LP(p->szTitle.w, p->pPlugin); } wchar_t* getTab(OPTIONSDIALOGPAGE *p) { - return (p->flags & ODPF_DONTTRANSLATE) ? p->szTab.w : TranslateW_LP(p->szTab.w, p->langId); + return (p->flags & ODPF_DONTTRANSLATE) ? p->szTab.w : TranslateW_LP(p->szTab.w, p->pPlugin); } static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2) @@ -141,7 +142,7 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount + 1)); OPTIONSDIALOGPAGE *dst = opi->odp + opi->pageCount; memset(dst, 0, sizeof(OPTIONSDIALOGPAGE)); - dst->hInstance = odp->hInstance; + dst->pPlugin = odp->pPlugin; dst->pfnDlgProc = odp->pfnDlgProc; dst->position = odp->position; dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate; @@ -155,7 +156,6 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : nullptr; } - dst->langId = odp->langId; dst->flags = odp->flags; dst->dwInitParam = odp->dwInitParam; opi->pageCount++; @@ -180,7 +180,7 @@ static void CreateDetailsTabs(HWND hwndDlg, DetailsData *dat, DetailsPageData *p if (!odp.ptszTab || mir_wstrcmp(odp.ptszTitle, ppg->ptszTitle)) continue; - tie.pszText = TranslateW_LP(odp.ptszTab, odp.hLangpack); + tie.pszText = TranslateW_LP(odp.ptszTab, odp.pPlugin); tie.lParam = i; TabCtrl_InsertItem(hwndTab, pages, &tie); if (!mir_wstrcmp(odp.ptszTab, ppg->ptszTab)) @@ -280,15 +280,15 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND hwndTree = GetDlgItem(hwndDlg, IDC_PAGETREE); for (i = 0; i < dat->pageCount; i++) { DetailsPageData &p = dat->opd[i]; - p.pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance, - FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5)))); + HINSTANCE hInst = odp[i].pPlugin->getInst(); + p.pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(hInst, FindResourceA(hInst, odp[i].pszTemplate, MAKEINTRESOURCEA(5)))); p.dlgProc = odp[i].pfnDlgProc; p.dlgParam = odp[i].dwInitParam; - p.hInst = odp[i].hInstance; + p.hInst = hInst; p.ptszTitle = odp[i].szTitle.w; p.ptszTab = odp[i].szTab.w; - p.hLangpack = odp[i].langId; + p.pPlugin = odp[i].pPlugin; if (i && p.ptszTab && !mir_wstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) { p.hItem = dat->opd[i - 1].hItem; @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (odp[i].flags & ODPF_DONTTRANSLATE) tvis.item.pszText = p.ptszTitle; else - tvis.item.pszText = TranslateW_LP(p.ptszTitle, p.hLangpack); + tvis.item.pszText = TranslateW_LP(p.ptszTitle, p.pPlugin); if (ptszLastTab && !mir_wstrcmp(tvis.item.pszText, ptszLastTab)) dat->currentPage = i; p.hItem = TreeView_InsertItem(hwndTree, &tvis); @@ -638,7 +638,7 @@ int LoadUserInfoModule(void) HookEvent(ME_DB_CONTACT_DELETED, UserInfoContactDelete); HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownUserInfo); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0xe8731d53, 0x95af, 0x42cf, 0xae, 0x27, 0xc7, 0xa7, 0xa, 0xbf, 0x14, 0x1c); mi.position = 1000050000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); -- cgit v1.2.3