diff options
Diffstat (limited to 'src')
71 files changed, 251 insertions, 326 deletions
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);
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 66b9bfc2ae..e377e1c43a 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -60,15 +60,6 @@ MIR_APP_DLL(HINSTANCE) GetInstByAddress(void *codePtr) return result; } -MIR_APP_DLL(CMPluginBase*) GetPluginByLangId(int _hLang) -{ - for (auto &it : g_arPlugins) - if (it->m_hLang == _hLang) - return it; - - return nullptr; -} - MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang) { if (uuid == miid_last) @@ -104,13 +95,6 @@ MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst) return (pPlugin == nullptr) ? g_plugin : *pPlugin; } -MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInst) -{ - HINSTANCE boo[2] = { 0, hInst }; - CMPluginBase *pPlugin = g_arPlugins.find((CMPluginBase*)&boo); - return (pPlugin == nullptr) ? 0 : pPlugin->m_hLang; -} - ///////////////////////////////////////////////////////////////////////////////////////// // stubs for pascal plugins @@ -118,8 +102,6 @@ EXTERN_C MIR_APP_DLL(void) RegisterPlugin(CMPluginBase *pPlugin) { if (pPlugin->getInst() != nullptr) g_arPlugins.insert(pPlugin); - - mir_getLP(&pPlugin->getInfo(), &pPlugin->m_hLang); } EXTERN_C MIR_APP_DLL(void) UnregisterPlugin(CMPluginBase *pPlugin) @@ -129,23 +111,12 @@ EXTERN_C MIR_APP_DLL(void) UnregisterPlugin(CMPluginBase *pPlugin) ///////////////////////////////////////////////////////////////////////////////////////// -int PluginsLoadLangpack(WPARAM, LPARAM) -{ - for (auto &it : g_arPlugins) - mir_getLP(&it->getInfo(), &it->m_hLang); - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// - CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) : m_szModuleName(moduleName), m_pInfo(pInfo) { if (m_hInst != nullptr) g_arPlugins.insert(this); - - mir_getLP(&pInfo, &m_hLang); } CMPluginBase::~CMPluginBase() @@ -181,83 +152,83 @@ void CMPluginBase::tryOpenLog() ///////////////////////////////////////////////////////////////////////////////////////// -int CMPluginBase::addOptions(WPARAM wParam, struct OPTIONSDIALOGPAGE *odp) +int CMPluginBase::addOptions(WPARAM wParam, OPTIONSDIALOGPAGE *odp) { - return ::Options_AddPage(wParam, odp, m_hLang); + return ::Options_AddPage(wParam, odp, this); } void CMPluginBase::openOptions(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab) { - ::Options_Open(pszGroup, pszPage, pszTab, m_hLang); + ::Options_Open(pszGroup, pszPage, pszTab, this); } void CMPluginBase::openOptionsPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab) { - ::Options_OpenPage(pszGroup, pszPage, pszTab, m_hLang); + ::Options_OpenPage(pszGroup, pszPage, pszTab, this); } ///////////////////////////////////////////////////////////////////////////////////////// int CMPluginBase::addFont(FontID *pFont) { - return Font_Register(pFont, m_hLang); + return Font_Register(pFont, this); } int CMPluginBase::addFont(FontIDW *pFont) { - return Font_RegisterW(pFont, m_hLang); + return Font_RegisterW(pFont, this); } int CMPluginBase::addColor(ColourID *pColor) { - return Colour_Register(pColor, m_hLang); + return Colour_Register(pColor, this); } int CMPluginBase::addColor(ColourIDW *pColor) { - return Colour_RegisterW(pColor, m_hLang); + return Colour_RegisterW(pColor, this); } int CMPluginBase::addEffect(EffectID *pEffect) { - return Effect_Register(pEffect, m_hLang); + return Effect_Register(pEffect, this); } int CMPluginBase::addEffect(EffectIDW *pEffect) { - return Effect_RegisterW(pEffect, m_hLang); + return Effect_RegisterW(pEffect, this); } ///////////////////////////////////////////////////////////////////////////////////////// int CMPluginBase::addFrame(const CLISTFrame *F) { - return (int)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)F, m_hLang); + return (int)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)F, (LPARAM)this); } int CMPluginBase::addHotkey(const HOTKEYDESC *hk) { - return Hotkey_Register(hk, m_hLang); + return Hotkey_Register(hk, this); } HANDLE CMPluginBase::addIcon(const SKINICONDESC *sid) { - return IcoLib_AddIcon(sid, m_hLang); + return IcoLib_AddIcon(sid, this); } HGENMENU CMPluginBase::addRootMenu(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib) { - return Menu_CreateRoot(hMenuObject, ptszName, position, hIcoLib, m_hLang); + return Menu_CreateRoot(hMenuObject, ptszName, position, hIcoLib, this); } HANDLE CMPluginBase::addTTB(const struct TTBButton *pButton) { - return (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)pButton, m_hLang); + return (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)pButton, (LPARAM)this); } int CMPluginBase::addUserInfo(WPARAM wParam, OPTIONSDIALOGPAGE *odp) { - odp->langId = m_hLang; + odp->pPlugin = this; return CallService("UserInfo/AddPage", wParam, (LPARAM)odp); } diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index a6b9bf0ad2..9c89f7d287 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -316,7 +316,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wc return nullptr;
}
-static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupName, int _hLang)
+static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupName, HPLUGIN pPlugin)
{
wchar_t itemName[1024];
wchar_t* sectionName;
@@ -335,7 +335,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam if (sectionName = wcschr(sectionName, '/'))
*sectionName = 0;
- pItemName = TranslateW_LP(pItemName, _hLang);
+ pItemName = TranslateW_LP(pItemName, pPlugin);
hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName);
if (!sectionName || !hItem) {
@@ -555,19 +555,19 @@ static void RebuildTree(HWND hwndDlg) for (auto &F : font_id_list_w2) {
// sync settings with database
UpdateFontSettings(F, &F->value);
- sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F->group, F->hLangpack);
+ sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F->group, F->pPlugin);
}
for (auto &C : colour_id_list_w2) {
// sync settings with database
UpdateColourSettings(C, &C->value);
- sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C->group, C->hLangpack);
+ sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C->group, C->pPlugin);
}
for (auto &E : effect_id_list_w2) {
// sync settings with database
UpdateEffectSettings(E, &E->value);
- sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E->group, E->hLangpack);
+ sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E->group, E->pPlugin);
}
}
@@ -1183,9 +1183,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -790000000;
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
odp.szTitle.a = LPGEN("Fonts and colors");
odp.szGroup.a = LPGEN("Customize");
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index 1dd6e6a3e3..333c1a7176 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -245,7 +245,7 @@ void UpdateFontSettings(FontIDW *font_id, FontSettingsW *fontsettings) /////////////////////////////////////////////////////////////////////////////////////////
// RegisterFont service
-static int sttRegisterFontWorker(FontIDW *font_id, int _hLang)
+static int sttRegisterFontWorker(FontIDW *font_id, HPLUGIN pPlugin)
{
if (font_id->cbSize != sizeof(FontIDW))
return -1;
@@ -261,7 +261,7 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang) FontInternal* newItem = new FontInternal;
memset(newItem, 0, sizeof(FontInternal));
memcpy(newItem, font_id, font_id->cbSize);
- newItem->hLangpack = _hLang;
+ newItem->pPlugin = pPlugin;
if (!mir_wstrcmp(newItem->deffontsettings.szFace, L"MS Shell Dlg")) {
LOGFONT lf;
@@ -278,16 +278,16 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang) return 0;
}
-MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, int _hLang)
+MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, HPLUGIN pPlugin)
{
- return sttRegisterFontWorker(pFont, _hLang);
+ return sttRegisterFontWorker(pFont, pPlugin);
}
-MIR_APP_DLL(int) Font_Register(FontID *pFont, int _hLang)
+MIR_APP_DLL(int) Font_Register(FontID *pFont, HPLUGIN pPlugin)
{
FontIDW temp;
if (!ConvertFontID(pFont, &temp)) return -1;
- return sttRegisterFontWorker(&temp, _hLang);
+ return sttRegisterFontWorker(&temp, pPlugin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -333,11 +333,11 @@ static INT_PTR ReloadFonts(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleFonts(int _hLang)
+MIR_APP_DLL(void) KillModuleFonts(HPLUGIN pPlugin)
{
auto T = font_id_list.rev_iter();
for (auto &it : T) {
- if (it->hLangpack == _hLang) {
+ if (it->pPlugin == pPlugin) {
font_id_list.remove(T.indexOf(&it));
notifyOptions();
}
@@ -352,7 +352,7 @@ void UpdateColourSettings(ColourIDW *colour_id, COLORREF *colour) *colour = (COLORREF)db_get_dw(0, colour_id->dbSettingsGroup, colour_id->setting, colour_id->defcolour);
}
-static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang)
+static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, HPLUGIN pPlugin)
{
if (colour_id->cbSize != sizeof(ColourIDW))
return -1;
@@ -364,7 +364,7 @@ static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang) ColourInternal* newItem = new ColourInternal;
memset(newItem, 0, sizeof(ColourInternal));
memcpy(newItem, colour_id, sizeof(ColourIDW));
- newItem->hLangpack = _hLang;
+ newItem->pPlugin = pPlugin;
UpdateColourSettings(colour_id, &newItem->value);
colour_id_list.insert(newItem);
@@ -372,16 +372,16 @@ static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang) return 0;
}
-MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, int _hLang)
+MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, HPLUGIN pPlugin)
{
- return sttRegisterColourWorker(pFont, _hLang);
+ return sttRegisterColourWorker(pFont, pPlugin);
}
-MIR_APP_DLL(int) Colour_Register(ColourID *pFont, int _hLang)
+MIR_APP_DLL(int) Colour_Register(ColourID *pFont, HPLUGIN pPlugin)
{
ColourIDW temp;
if (!ConvertColourID(pFont, &temp)) return -1;
- return sttRegisterColourWorker(&temp, _hLang);
+ return sttRegisterColourWorker(&temp, pPlugin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -414,11 +414,11 @@ static INT_PTR ReloadColours(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleColours(int _hLang)
+MIR_APP_DLL(void) KillModuleColours(HPLUGIN pPlugin)
{
auto T = colour_id_list.rev_iter();
for (auto &it : T) {
- if (it->hLangpack == _hLang) {
+ if (it->pPlugin == pPlugin) {
colour_id_list.remove(T.indexOf(&it));
notifyOptions();
}
@@ -444,7 +444,7 @@ void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT *effectsettings) /////////////////////////////////////////////////////////////////////////////////////////
// RegisterEffect service
-static int sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang)
+static int sttRegisterEffectWorker(EffectIDW *effect_id, HPLUGIN pPlugin)
{
if (effect_id->cbSize != sizeof(EffectIDW))
return -1;
@@ -456,7 +456,7 @@ static int sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) EffectInternal* newItem = new EffectInternal;
memset(newItem, 0, sizeof(EffectInternal));
memcpy(newItem, effect_id, sizeof(EffectIDW));
- newItem->hLangpack = _hLang;
+ newItem->pPlugin = pPlugin;
UpdateEffectSettings(effect_id, &newItem->value);
effect_id_list.insert(newItem);
@@ -464,16 +464,16 @@ static int sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) return 0;
}
-MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pFont, int _hLang)
+MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pFont, HPLUGIN pPlugin)
{
- return sttRegisterEffectWorker(pFont, _hLang);
+ return sttRegisterEffectWorker(pFont, pPlugin);
}
-MIR_APP_DLL(int) Effect_Register(EffectID *pFont, int _hLang)
+MIR_APP_DLL(int) Effect_Register(EffectID *pFont, HPLUGIN pPlugin)
{
EffectIDW temp;
if (!ConvertEffectID(pFont, &temp)) return -1;
- return sttRegisterEffectWorker(&temp, _hLang);
+ return sttRegisterEffectWorker(&temp, pPlugin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -503,11 +503,11 @@ MIR_APP_DLL(int) Effect_Get(const char *szGroup, const char *szName, FONTEFFECT /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleEffects(int _hLang)
+MIR_APP_DLL(void) KillModuleEffects(HPLUGIN pPlugin)
{
auto T = colour_id_list.rev_iter();
for (auto &it : T)
- if (it->hLangpack == _hLang)
+ if (it->pPlugin == pPlugin)
effect_id_list.remove(T.indexOf(&it));
}
diff --git a/src/mir_app/src/FontService.h b/src/mir_app/src/FontService.h index 083c235ffe..a12ed6e665 100644 --- a/src/mir_app/src/FontService.h +++ b/src/mir_app/src/FontService.h @@ -31,9 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct FontInternal : public FontIDW
{
FontSettingsW value;
- int hLangpack;
+ HPLUGIN pPlugin;
- __inline wchar_t* getName() const { return TranslateW_LP(name, hLangpack); }
+ __inline wchar_t* getName() const { return TranslateW_LP(name, pPlugin); }
__inline bool isHeader() const
{
@@ -49,17 +49,17 @@ struct FontInternal : public FontIDW struct ColourInternal : public ColourIDW
{
- __inline wchar_t* getName() const { return TranslateW_LP(name, hLangpack); }
+ __inline wchar_t* getName() const { return TranslateW_LP(name, pPlugin); }
COLORREF value;
- int hLangpack;
+ HPLUGIN pPlugin;
};
struct EffectInternal : public EffectIDW
{
- __inline wchar_t* getName() const { return TranslateW_LP(name, hLangpack); }
+ __inline wchar_t* getName() const { return TranslateW_LP(name, pPlugin); }
- int hLangpack;
+ HPLUGIN pPlugin;
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index cccd788220..37c56a0fd7 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -84,7 +84,7 @@ struct IcolibItem : public MZeroedObject IconSourceFile* default_file;
int default_indx;
int cx, cy;
- int hLangpack;
+ HPLUGIN pPlugin;
IconSourceItem* source_small;
IconSourceItem* source_big;
@@ -95,7 +95,7 @@ struct IcolibItem : public MZeroedObject BOOL temp_reset;
__inline ~IcolibItem() { clear(); }
- __inline wchar_t* getDescr() const { return TranslateW_LP(description, hLangpack); }
+ __inline wchar_t* getDescr() const { return TranslateW_LP(description, pPlugin); }
void clear();
};
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index eb149a96fd..401adb6139 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -38,8 +38,9 @@ class CChatRoomDlg : public CSrmmBaseDialog };
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
+extern HPLUGIN g_pChatPlugin;
extern GlobalLogSettingsBase *g_Settings;
-extern int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
+extern int g_cbSession, g_cbModuleInfo, g_iFontMode;
extern wchar_t *g_szFontGroup;
extern mir_cs csChat;
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index dfff3b975f..f28d82768e 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -1009,7 +1009,7 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pInit) g_cbSession = pInit->cbSession;
g_cbModuleInfo = pInit->cbModuleInfo;
g_iFontMode = pInit->iFontMode;
- g_iChatLang = pInit->iLangId;
+ g_pChatPlugin = pInit->pPlugin;
g_chatApi.SetActiveSession = SetActiveSession;
g_chatApi.GetActiveSession = GetActiveSession;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 8810a39c52..1a6a242a01 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -26,8 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession;
+HPLUGIN g_pChatPlugin;
GlobalLogSettingsBase *g_Settings;
-int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
+int g_cbSession, g_cbModuleInfo, g_iFontMode;
wchar_t *g_szFontGroup;
#define FONTF_BOLD 1
@@ -177,7 +178,7 @@ void RegisterFonts(void) fontid.deffontsettings.colour = FO.defColour;
fontid.deffontsettings.size = FO.defSize;
fontid.deffontsettings.style = FO.defStyle;
- Font_RegisterW(&fontid, g_iChatLang);
+ Font_RegisterW(&fontid, g_pChatPlugin);
}
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index f8918ff67f..db9a72be2d 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -726,7 +726,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x2bb76d5, 0x740d, 0x4fd2, 0x8f, 0xee, 0x7c, 0xa4, 0x5a, 0x74, 0x65, 0xa6);
mi.position = -2000090001;
mi.flags = CMIF_DEFAULT;
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 986e25a4db..9ac61b5ae7 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -695,14 +695,14 @@ MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, int _hLang)
+MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, HPLUGIN pPlugin)
{
if (nItems > 0)
AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);
HMENU hSubMenu = nullptr;
for (int i = 0; i < nItems; i++) {
- wchar_t *ptszText = TranslateW_LP(Item[i].pszDesc, _hLang);
+ wchar_t *ptszText = TranslateW_LP(Item[i].pszDesc, pPlugin);
DWORD dwState = Item[i].bDisabled ? MF_GRAYED : 0;
if (Item[i].uType == MENU_NEWPOPUP) {
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 528bc4492e..568586b417 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -317,7 +317,7 @@ int LoadCLUIModule(void) db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x66aada45, 0x8bcb, 0x49bb, 0x85, 0xb0, 0xae, 0x1, 0xf8, 0xbe, 0x78, 0x7e);
mi.position = 2000070000;
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index ba1df15b2e..0c13ddb594 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -354,7 +354,7 @@ public: static int ContactOptInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -1000000000;
odp.szGroup.a = LPGEN("Contact list");
odp.szTitle.a = LPGEN("Contact names");
diff --git a/src/mir_app/src/ei_baseIcon.cpp b/src/mir_app/src/ei_baseIcon.cpp index 8876e90bc1..9f13b103cb 100644 --- a/src/mir_app/src/ei_baseIcon.cpp +++ b/src/mir_app/src/ei_baseIcon.cpp @@ -45,7 +45,7 @@ void BaseExtraIcon::setOnClick(MIRANDAHOOKPARAM pFunc, LPARAM pParam) const wchar_t* BaseExtraIcon::getDescription() const { - return TranslateW_LP(m_tszDescription, m_hLangpack); + return TranslateW_LP(m_tszDescription, m_pPlugin); } void BaseExtraIcon::setDescription(const wchar_t *desc) diff --git a/src/mir_app/src/ei_options.cpp b/src/mir_app/src/ei_options.cpp index 7f763d87c8..7ee60636b8 100644 --- a/src/mir_app/src/ei_options.cpp +++ b/src/mir_app/src/ei_options.cpp @@ -473,7 +473,7 @@ void eiOptionsRefresh() int InitOptionsCallback(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.szGroup.a = LPGEN("Contact list"); odp.szTitle.a = LPGEN("Extra icons"); odp.szTab.a = LPGEN("General"); diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp index 52017494e7..05e4969b2f 100644 --- a/src/mir_app/src/ei_services.cpp +++ b/src/mir_app/src/ei_services.cpp @@ -193,13 +193,13 @@ static void ResetSlots(BaseExtraIcon *extra, ExtraIconGroup *group) } } -MIR_APP_DLL(void) KillModuleExtraIcons(int _hLang) +MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin) { LIST<ExtraIcon> arIcons(1); auto T = registeredExtraIcons.rev_iter(); for (auto &it : T) - if (it->m_hLangpack == _hLang) { + if (it->m_pPlugin == pPlugin) { arIcons.insert(it); registeredExtraIcons.remove(T.indexOf(&it)); } @@ -375,7 +375,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const ptrW tszDesc(mir_a2u(description)); BaseExtraIcon *extra = new CallbackExtraIcon(name, tszDesc, descIcon == nullptr ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam); - extra->m_hLangpack = GetPluginLangByInstance(GetInstByAddress(RebuildIcons)); + extra->m_pPlugin = &GetPluginByInstance(GetInstByAddress(RebuildIcons)); EI_PostCreate(extra, name, flags); return extra; } @@ -409,7 +409,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch } else { extra = new IcolibExtraIcon(name, tszDesc, descIcon == nullptr ? "" : descIcon, OnClick, onClickParam); - extra->m_hLangpack = GetPluginLangByInstance(GetInstByAddress((void*)name)); + extra->m_pPlugin = &GetPluginByInstance(GetInstByAddress((void*)name)); EI_PostCreate(extra, name, flags); } diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp index b31f2c6d3e..21adb6708d 100644 --- a/src/mir_app/src/encrypt.cpp +++ b/src/mir_app/src/encrypt.cpp @@ -41,9 +41,9 @@ static INT_PTR srvRegister(WPARAM, LPARAM lParam) CRYPTO_PROVIDER *pNew = new CRYPTO_PROVIDER(*p);
pNew->pszName = mir_strdup(p->pszName);
if (pNew->dwFlags & CPF_UNICODE)
- pNew->szDescr.w = mir_wstrdup(TranslateW_LP(p->szDescr.w, p->iLangId));
+ pNew->szDescr.w = mir_wstrdup(TranslateW_LP(p->szDescr.w, p->pPlugin));
else
- pNew->szDescr.w = mir_a2u(TranslateA_LP(p->szDescr.a, p->iLangId));
+ pNew->szDescr.w = mir_a2u(TranslateA_LP(p->szDescr.a, p->pPlugin));
arProviders.insert(pNew);
return 0;
}
diff --git a/src/mir_app/src/extraicons.h b/src/mir_app/src/extraicons.h index 5a0c1560d3..07bf67376f 100644 --- a/src/mir_app/src/extraicons.h +++ b/src/mir_app/src/extraicons.h @@ -73,7 +73,7 @@ public: virtual int ClistSetExtraIcon(MCONTACT hContact, HANDLE hImage) = 0;
- int m_hLangpack = 0;
+ HPLUGIN m_pPlugin = nullptr;
protected:
ptrA m_szName;
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 043c0ea379..4e7f00fa9a 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -1009,7 +1009,7 @@ int LoadFindAddModule(void) HookEvent(ME_PROTO_ACCLISTCHANGED, OnSystemModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, FindAddPreShutdown); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); SET_UID(mi, 0x860556b9, 0x1577, 0x4f6f, 0x8c, 0xb0, 0x93, 0x24, 0xa8, 0x2e, 0x20, 0x92); mi.position = 500020000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); diff --git a/src/mir_app/src/help.cpp b/src/mir_app/src/help.cpp index 8eef92a7cf..89faf55ce6 100644 --- a/src/mir_app/src/help.cpp +++ b/src/mir_app/src/help.cpp @@ -150,7 +150,7 @@ int LoadHelpModule(void) { HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownHelpModule); - CMenuItem mi(g_plugin); + CMenuItem mi(&g_plugin); mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("&Help"), 2000090000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8824ECA5-6942-46D7-9D07-1BA600E0D02E"); diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index c9361e20ff..d5492728d7 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -1022,8 +1022,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int HotkeyOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_plugin.getInst(); + OPTIONSDIALOGPAGE odp = {}; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HOTKEYS); diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index d82754d3b8..63fdd8f8cc 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -117,7 +117,7 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, int _hLangpack)
+MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, HPLUGIN pPlugin)
{
THotkeyItem *p = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem));
if (desc->dwFlags & HKD_UNICODE) {
@@ -129,7 +129,7 @@ MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, int _hLangpack) p->pwszDescription = mir_a2u(desc->szDescription.a);
}
- p->hLangpack = _hLangpack;
+ p->pPlugin = pPlugin;
p->allowSubHotkeys = TRUE;
p->rootHotkey = nullptr;
p->nSubHotkeys = 0;
@@ -186,7 +186,7 @@ MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, int _hLangpack) if (!db_get_w(0, DBMODULENAME, buf, 0))
continue;
- Hotkey_Register(desc, _hLangpack);
+ Hotkey_Register(desc, pPlugin);
}
p->allowSubHotkeys = count < 0;
}
@@ -286,11 +286,11 @@ void RegisterHotkeys() }
}
-MIR_APP_DLL(void) KillModuleHotkeys(int _hLang)
+MIR_APP_DLL(void) KillModuleHotkeys(HPLUGIN pPlugin)
{
auto T = hotkeys.rev_iter();
for (auto &it : T)
- if (it->hLangpack == _hLang) {
+ if (it->pPlugin == pPlugin) {
FreeHotkey(it);
hotkeys.remove(T.indexOf(&it));
}
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 153153a44c..f20a408870 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -461,7 +461,7 @@ void IcolibItem::clear() /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_AddIcon
-MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, int _hLang)
+MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, HPLUGIN pPlugin)
{
mir_cslock lck(csIconList);
@@ -499,7 +499,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, int _hLang) item->cx = sid->cx;
item->cy = sid->cy;
- item->hLangpack = _hLang;
+ item->pPlugin = pPlugin;
if (sid->hDefaultIcon) {
bool big;
@@ -592,7 +592,7 @@ MIR_APP_DLL(void) IcoLib_RemoveIconByHandle(HANDLE hIcoLib) }
}
-MIR_APP_DLL(void) KillModuleIcons(int _hLang)
+MIR_APP_DLL(void) KillModuleIcons(HPLUGIN pPlugin)
{
if (!bModuleInitialized)
return;
@@ -600,7 +600,7 @@ MIR_APP_DLL(void) KillModuleIcons(int _hLang) mir_cslock lck(csIconList);
auto T = iconList.rev_iter();
for (auto &it : T)
- if (it->hLangpack == _hLang) {
+ if (it->pPlugin == pPlugin) {
delete it;
iconList.remove(T.indexOf(&it));
}
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 1d2aa10cf5..e217fa5325 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -326,9 +326,8 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM static int IgnoreOptInitialise(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = 900000000;
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE);
odp.szTitle.a = LPGEN("Ignore");
odp.szGroup.a = LPGEN("Contacts");
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index b3fd2d488a..667808bd01 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -257,7 +257,7 @@ void CLangpackDlg::OnDestroy() int LangpackOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -1300000000;
odp.szTitle.a = LPGEN("Languages");
odp.szGroup.a = LPGEN("Customize");
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index e751cafcbf..269ceab44a 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -425,7 +425,7 @@ static INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (reset || check) {
TMO_IntMenuItem *timiParent = MO_GetIntMenuItem(pimi->mi.root);
if (timiParent) {
- LPTSTR ptszName = TranslateW_LP(pimi->mi.hIcolibItem ? pimi->mi.name.w : LPGENW("Custom status"), pimi->mi.langId);
+ LPTSTR ptszName = TranslateW_LP(pimi->mi.hIcolibItem ? pimi->mi.name.w : LPGENW("Custom status"), pimi->mi.pPlugin);
timiParent = MO_GetIntMenuItem(pimi->mi.root);
@@ -727,7 +727,7 @@ void RebuildMenuOrder(void) int pos = 0;
// adding root
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED;
mi.position = pos++;
mi.hIcon = ic = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
@@ -824,7 +824,7 @@ void RebuildMenuOrder(void) if (!(flags & it.Pf2flag))
continue;
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
if (it.iStatus == ID_STATUS_OFFLINE)
mi.flags |= CMIF_CHECKED;
@@ -1086,7 +1086,7 @@ void InitCustomMenus(void) HookEvent(ME_LANGPACK_CHANGED, sttRebuildHotkeys);
// add exit command to menu
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x707c8962, 0xc33f, 0x4893, 0x8e, 0x36, 0x30, 0xb1, 0x7c, 0xd8, 0x61, 0x40);
mi.position = 0x7fffffff;
mi.pszService = "CloseAction";
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index 065fee01a1..1d0f70523e 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -285,7 +285,7 @@ void InitGroupMenus(void) Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuOnAddService");
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x2f75bc72, 0xd836, 0x4922, 0x9f, 0xe, 0xed, 0x9e, 0xe7, 0x2b, 0x84, 0xf0);
mi.position = 100000;
@@ -346,7 +346,7 @@ void InitGroupMenus(void) Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0xd208f1d2, 0x7220, 0x4d37, 0xb6, 0xe4, 0xd5, 0x4a, 0xe8, 0xa3, 0xf4, 0x53);
mi.position = 1000;
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 011dff0698..a574e704c4 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -527,7 +527,7 @@ public: m_service.SetTextA(szText); } - CMPluginBase *pPlugin = GetPluginByLangId(iod->pimi->mi.langId); + const CMPluginBase *pPlugin = iod->pimi->mi.pPlugin; m_module.SetTextA(pPlugin == nullptr ? "" : pPlugin->getInfo().shortName); m_btnInsMenu.Enable(iod->pimi->mi.root == nullptr); @@ -547,7 +547,7 @@ public: int GenMenuOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = -1000000000; odp.szTitle.a = LPGEN("Menus"); odp.szGroup.a = LPGEN("Customize"); diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp index aa8b245c1d..bbf2d6c757 100644 --- a/src/mir_app/src/menu_tray.cpp +++ b/src/mir_app/src/menu_tray.cpp @@ -116,7 +116,7 @@ void InitTrayMenus(void) Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuOnAddService");
// add exit command to menu
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x6c202553, 0xb4d5, 0x403c, 0xa6, 0x82, 0x2, 0xd8, 0x2b, 0x42, 0xba, 0x9e);
mi.flags = CMIF_DEFAULT;
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 7d27599165..d410c0e79f 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -78,7 +78,7 @@ LPTSTR GetMenuItemText(TMO_IntMenuItem *pimi) if (pimi->mi.flags & CMIF_KEEPUNTRANSLATED)
return pimi->mi.name.w;
- return TranslateW_LP(pimi->mi.name.w, pimi->mi.langId);
+ return TranslateW_LP(pimi->mi.name.w, pimi->mi.pPlugin);
}
///////////////////////////////////////////////////////////////////////////////
@@ -240,7 +240,7 @@ MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis) return p;
// create protocol root in the main menu
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.name.w = pThis->m_tszUserName;
mi.position = 500090000;
mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED;
@@ -609,29 +609,29 @@ MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem) struct KillMenuItemsParam
{
- KillMenuItemsParam(int _hLangpack) :
- langId(_hLangpack),
+ KillMenuItemsParam(HPLUGIN _pPlugin) :
+ pPlugin(_pPlugin),
arItems(10)
{
}
- int langId;
+ HPLUGIN pPlugin;
LIST<TMO_IntMenuItem> arItems;
};
int KillMenuItems(TMO_IntMenuItem *pimi, KillMenuItemsParam* param)
{
- if (pimi->mi.langId == param->langId)
+ if (pimi->mi.pPlugin == param->pPlugin)
param->arItems.insert(pimi);
return FALSE;
}
-MIR_APP_DLL(void) KillModuleMenus(int _hLang)
+MIR_APP_DLL(void) KillModuleMenus(HPLUGIN pPlugin)
{
if (!bIsGenMenuInited)
return;
- KillMenuItemsParam param(_hLang);
+ KillMenuItemsParam param(pPlugin);
mir_cslock lck(csMenuHook);
for (auto &p : g_menus)
@@ -675,7 +675,7 @@ static int FindRoot(TMO_IntMenuItem *pimi, void *param) return FALSE;
}
-MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib, int _hLang)
+MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib, HPLUGIN pPlugin)
{
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
@@ -686,10 +686,10 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos if (oldroot != nullptr)
return oldroot;
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
mi.hIcolibItem = hIcoLib;
- mi.langId = _hLang;
+ mi.pPlugin = pPlugin;
mi.name.w = (wchar_t*)ptszName;
mi.position = position;
return Menu_AddItem(hMenuObject, &mi, nullptr);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index b73cdcc613..46fdc97adc 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -356,7 +356,7 @@ INT_PTR Meta_OnOff(WPARAM, LPARAM) void InitMenus()
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
// main menu item
SET_UID(mi, 0x8999a6ca, 0x9c66, 0x49c1, 0xad, 0xe1, 0x48, 0x17, 0x28, 0xb, 0x94, 0x86);
diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp index 798af79448..91089df0d0 100644 --- a/src/mir_app/src/meta_options.cpp +++ b/src/mir_app/src/meta_options.cpp @@ -120,7 +120,7 @@ public: int Meta_OptInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -790000000;
odp.flags = ODPF_BOLDGROUPS;
odp.szTitle.a = LPGEN("Metacontacts");
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 630502cda4..e6bd05338a 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -652,7 +652,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM) sid.flags = MBF_UNICODE;
sid.tszTooltip = LPGENW("Select metacontact");
sid.hIcon = Skin_LoadProtoIcon(META_PROTO, ID_STATUS_ONLINE);
- Srmm_AddIcon(&sid, g_plugin.m_hLang);
+ Srmm_AddIcon(&sid, &g_plugin);
return 0;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 52a7b20b21..2e182da0aa 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -104,7 +104,6 @@ Skin_GetIconName @24 ?setWString@PROTO_INTERFACE@@QAEXPBDPB_W@Z @107 NONAME
?setWord@PROTO_INTERFACE@@QAEXIPBDG@Z @108 NONAME
?setWord@PROTO_INTERFACE@@QAEXPBDG@Z @109 NONAME
-GetPluginLangByInstance @110
ProtoBroadcastAck @111
ProtoCreateHookableEvent @113
ProtoCreateService @114
@@ -592,7 +591,6 @@ Contact_GetStatus @609 ??0PROTOACCOUNT@@QAE@PBD@Z @621 NONAME
??1PROTOACCOUNT@@QAE@XZ @622 NONAME
?addSound@CMPluginBase@@QAEHPBDPB_W11@Z @623 NONAME
-GetPluginByLangId @624
GetInstByAddress @625
GetPluginByInstance @626
?addUserInfo@CMPluginBase@@QAEHIPAUOPTIONSDIALOGPAGE@@@Z @627 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 360fe8adea..4bfa9b9ce9 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -104,7 +104,6 @@ Skin_GetIconName @24 ?setWString@PROTO_INTERFACE@@QEAAXPEBDPEB_W@Z @107 NONAME
?setWord@PROTO_INTERFACE@@QEAAXIPEBDG@Z @108 NONAME
?setWord@PROTO_INTERFACE@@QEAAXPEBDG@Z @109 NONAME
-GetPluginLangByInstance @110
ProtoBroadcastAck @111
ProtoCreateHookableEvent @113
ProtoCreateService @114
@@ -592,7 +591,6 @@ Contact_GetStatus @609 ??0PROTOACCOUNT@@QEAA@PEBD@Z @621 NONAME
??1PROTOACCOUNT@@QEAA@XZ @622 NONAME
?addSound@CMPluginBase@@QEAAHPEBDPEB_W11@Z @623 NONAME
-GetPluginByLangId @624
GetInstByAddress @625
GetPluginByInstance @626
?addUserInfo@CMPluginBase@@QEAAH_KPEAUOPTIONSDIALOGPAGE@@@Z @627 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index eeee17772d..b37abcea3b 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -83,8 +83,8 @@ void InitPathVar(void); /**** srmm.cpp *************************************************************************/
-void KillModuleSrmmIcons(int hLangpack);
-void KillModuleToolbarIcons(int hLangpack);
+void KillModuleSrmmIcons(HPLUGIN);
+void KillModuleToolbarIcons(HPLUGIN);
/**** utf.cpp **************************************************************************/
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index f00bf63fd7..7e23871cfd 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -66,7 +66,7 @@ static wchar_t* PrepareGroupName(wchar_t* str) static void AddGroupItem(HGENMENU hRoot, wchar_t* name, int pos, WPARAM param, bool checked)
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.root = hRoot;
mi.position = pos;
mi.name.w = PrepareGroupName(name);
@@ -133,7 +133,7 @@ void MTG_OnmodulesLoad() HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenuBuild);
CreateServiceFunction(MTG_MOVE, MTG_DOMOVE);
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5);
mi.position = 100000;
mi.name.a = LPGEN("&Move to group");
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index 4c8db2c1ce..3d2a8320c9 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -507,9 +507,8 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) if (optionsCount == 0)
return 0;
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = 900000000;
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB);
odp.szTitle.a = LPGEN("Network");
odp.pfnDlgProc = DlgProcNetlibOpts;
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index c2fb0e475b..0eee4d52c2 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -274,20 +274,17 @@ bool Plugin_UnloadDyn(pluginEntry *p) KillModuleServices(hInst);
}
- int _hLang = ppb->m_hLang;
- if (_hLang != 0) {
- KillModuleMenus(_hLang);
- KillModuleFonts(_hLang);
- KillModuleColours(_hLang);
- KillModuleEffects(_hLang);
- KillModuleIcons(_hLang);
- KillModuleHotkeys(_hLang);
- KillModuleSounds(_hLang);
- KillModuleExtraIcons(_hLang);
- KillModuleSrmmIcons(_hLang);
- KillModuleToolbarIcons(_hLang);
- KillModuleOptions(_hLang);
- }
+ KillModuleMenus(ppb);
+ KillModuleFonts(ppb);
+ KillModuleColours(ppb);
+ KillModuleEffects(ppb);
+ KillModuleIcons(ppb);
+ KillModuleHotkeys(ppb);
+ KillModuleSounds(ppb);
+ KillModuleExtraIcons(ppb);
+ KillModuleSrmmIcons(ppb);
+ KillModuleToolbarIcons(ppb);
+ KillModuleOptions(ppb);
NotifyFastHook(hevUnloadModule, (WPARAM)&ppb->getInfo(), (LPARAM)ppb->getInst());
@@ -732,7 +729,6 @@ int LoadNewPluginsModule(void) Plugin_Uninit(it);
HookEvent(ME_OPT_INITIALISE, PluginOptionsInit);
- HookEvent(ME_LANGPACK_CHANGED, PluginsLoadLangpack);
return 0;
}
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index ddd93d997f..f6238af1f3 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -199,14 +199,16 @@ struct OptionsPageData : public MZeroedObject {
OptionsPageData(const OPTIONSDIALOGPAGE &src)
{
- if (src.hInstance != nullptr && src.pszTemplate != nullptr)
- pDialog = new COptionPageDialog(::GetPluginByInstance(src.hInstance), (INT_PTR)src.pszTemplate, src.pfnDlgProc, src.dwInitParam);
+ if (src.pszTemplate != nullptr) {
+ CMPluginBase *p = (CMPluginBase*)src.pPlugin;
+ pDialog = new COptionPageDialog(*p, (INT_PTR)src.pszTemplate, src.pfnDlgProc, src.dwInitParam);
+ }
else
pDialog = src.pDialog;
assert(pDialog != nullptr);
flags = src.flags;
- langId = src.langId;
+ pPlugin = src.pPlugin;
if (src.flags & ODPF_UNICODE)
ptszTitle = mir_wstrdup(src.szTitle.w);
@@ -231,7 +233,7 @@ struct OptionsPageData : public MZeroedObject }
CDlgBase *pDialog;
- int langId;
+ HPLUGIN pPlugin;
ptrW ptszTitle, ptszGroup, ptszTab;
HTREEITEM hTreeItem;
bool bChanged, bInsideTab;
@@ -246,7 +248,7 @@ struct OptionsPageData : public MZeroedObject {
if (flags & ODPF_DONTTRANSLATE)
return ptszStr;
- return TranslateW_LP(ptszStr, langId);
+ return TranslateW_LP(ptszStr, pPlugin);
}
HWND CreateOptionWindow(HWND hWndParent) const
@@ -565,9 +567,9 @@ class COptionsDlg : public CDlgBase continue;
opd = m_arOpd[i];
- wchar_t *ptszGroup = TranslateW_LP(opd->ptszGroup, opd->langId);
+ wchar_t *ptszGroup = TranslateW_LP(opd->ptszGroup, opd->pPlugin);
wchar_t *ptszTitle = opd->getString(opd->ptszTitle), *useTitle;
- wchar_t *ptszTab = TranslateW_LP(opd->ptszTab, opd->langId);
+ wchar_t *ptszTab = TranslateW_LP(opd->ptszTab, opd->pPlugin);
tvis.hParent = nullptr;
useTitle = ptszTitle;
@@ -987,7 +989,7 @@ public: if (mir_wstrcmp(opd->ptszTitle, p->ptszTitle) || mir_wstrcmp(opd->ptszGroup, p->ptszGroup))
continue;
- tie.pszText = TranslateW_LP(p->ptszTab, p->langId);
+ tie.pszText = TranslateW_LP(p->ptszTab, p->pPlugin);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
if (!mir_wstrcmp(opd->ptszTab, p->ptszTab))
@@ -1106,18 +1108,18 @@ public: RebuildPageTree();
}
- void Locate(const wchar_t *pszGroup, const wchar_t *pszPage, int _hLang)
+ void Locate(const wchar_t *pszGroup, const wchar_t *pszPage, HPLUGIN pPlugin)
{
ShowWindow(GetHwnd(), SW_RESTORE);
SetForegroundWindow(m_hwnd);
if (pszPage != nullptr) {
HTREEITEM hItem = nullptr;
if (pszGroup != nullptr) {
- hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszGroup, _hLang));
+ hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszGroup, pPlugin));
if (hItem != nullptr)
- hItem = FindNamedTreeItem(hItem, TranslateW_LP(pszPage, _hLang));
+ hItem = FindNamedTreeItem(hItem, TranslateW_LP(pszPage, pPlugin));
}
- else hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszPage, _hLang));
+ else hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszPage, pPlugin));
if (hItem != nullptr)
m_pageTree.SelectItem(hItem);
@@ -1138,10 +1140,10 @@ public: }
}
- void KillModule(int _hLang)
+ void KillModule(HPLUGIN pPlugin)
{
for (auto &opd : m_arOpd) {
- if (opd->langId != _hLang)
+ if (opd->pPlugin != pPlugin)
continue;
if (opd->pDialog != nullptr) {
@@ -1173,7 +1175,7 @@ void OpenAccountOptions(PROTOACCOUNT *pa) pOptionsDlg->Show();
}
-static void OpenOptionsNow(int _hLang, const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, bool bSinglePage)
+static void OpenOptionsNow(HPLUGIN pPlugin, const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, bool bSinglePage)
{
if (pOptionsDlg == nullptr) {
OptionsPageList arPages(1);
@@ -1184,24 +1186,24 @@ static void OpenOptionsNow(int _hLang, const wchar_t *pszGroup, const wchar_t *p pOptionsDlg = new COptionsDlg(TranslateT("Miranda NG options"), pszGroup, pszPage, pszTab, bSinglePage, arPages);
pOptionsDlg->Show();
}
- else pOptionsDlg->Locate(pszGroup, pszPage, _hLang);
+ else pOptionsDlg->Locate(pszGroup, pszPage, pPlugin);
}
-MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int _hLangpack)
+MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, HPLUGIN pPlugin)
{
- OpenOptionsNow(_hLangpack, pszGroup, pszPage, pszTab, false);
+ OpenOptionsNow(pPlugin, pszGroup, pszPage, pszTab, false);
return 0;
}
-MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int _hLangpack)
+MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, HPLUGIN pPlugin)
{
- OpenOptionsNow(_hLangpack, pszGroup, pszPage, pszTab, true);
+ OpenOptionsNow(pPlugin, pszGroup, pszPage, pszTab, true);
return pOptionsDlg->GetHwnd();
}
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int langId)
+MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, HPLUGIN pPlugin)
{
OptionsPageList *pList = (OptionsPageList*)wParam;
if (odp == nullptr)
@@ -1209,7 +1211,7 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int lang OptionsPage *dst = new OptionsPage();
memcpy(dst, odp, sizeof(OPTIONSDIALOGPAGE));
- dst->langId = langId;
+ dst->pPlugin = pPlugin;
if (odp->szTitle.w != nullptr) {
if (odp->flags & ODPF_UNICODE)
@@ -1251,10 +1253,10 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int lang /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleOptions(int _hLang)
+MIR_APP_DLL(void) KillModuleOptions(HPLUGIN pPlugin)
{
if (pOptionsDlg != nullptr)
- pOptionsDlg->KillModule(_hLang);
+ pOptionsDlg->KillModule(pPlugin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1274,7 +1276,7 @@ static int OptDynamicLoadOptions(WPARAM, LPARAM hInstance) static int OptModulesLoaded(WPARAM, LPARAM)
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0xc1284523, 0x548d, 0x4744, 0xb0, 0x9, 0xfb, 0xa0, 0x4, 0x8e, 0xa8, 0x67);
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS);
mi.position = 1900000000;
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 48e29fd535..96b1f8e01d 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -539,7 +539,7 @@ public: m_plugList.GetItemText(hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(m_hwnd, IDC_PLUGININFOFRAME, sel ? buf : L"");
m_author.SetText(sel ? dat->author : L"");
- m_plugInfo.SetText(sel ? TranslateW_LP(dat->description, GetPluginLangByInstance(dat->hInst)) : L"");
+ m_plugInfo.SetText(sel ? TranslateW_LP(dat->description, &GetPluginByInstance(dat->hInst)) : L"");
m_copyright.SetText(sel ? dat->copyright : L"");
szUrl = sel ? _T2A(dat->homepage) : "";
@@ -561,8 +561,7 @@ public: int PluginOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_plugin.getInst();
+ OPTIONSDIALOGPAGE odp = {};
odp.pDialog = new CPluginOptDlg();
odp.position = 1300000000;
odp.szTitle.a = LPGEN("Plugins");
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 26cd0596e6..ff0764fd2f 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -57,7 +57,6 @@ extern LIST<pluginEntry> pluginList, servicePlugins, clistPlugins; extern MUUID miid_last;
int PluginOptionsInit(WPARAM, LPARAM);
-int PluginsLoadLangpack(WPARAM, LPARAM);
void LoadPluginOptions();
void UnloadPluginOptions();
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 85e7aa0947..875ff4882f 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -977,7 +977,7 @@ static INT_PTR OptProtosShow(WPARAM, LPARAM) int OptProtosLoaded(WPARAM, LPARAM)
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0xb1f74008, 0x1fa6, 0x4e98, 0x95, 0x28, 0x5a, 0x7e, 0xab, 0xfe, 0x10, 0x61);
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_ACCMGR);
mi.position = 1900000000;
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index a8f9017f45..462c9eb9e1 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -224,7 +224,7 @@ public: int ProtocolOrderOptInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -10000000;
odp.szTitle.a = LPGEN("Accounts");
odp.szGroup.a = LPGEN("Contact list");
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 8dff65dc03..4bd1b3da0e 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -122,7 +122,7 @@ static int __cdecl ProtoPrebuildContactMenu(WPARAM, LPARAM) void InitProtoMenus(void)
{
// "Request authorization"
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
mi.pszService = "Proto/Menu/ReqAuth";
mi.name.a = LPGEN("Request authorization");
diff --git a/src/mir_app/src/skin.h b/src/mir_app/src/skin.h index d44b75c3e0..6f034e3220 100644 --- a/src/mir_app/src/skin.h +++ b/src/mir_app/src/skin.h @@ -44,7 +44,7 @@ struct THotkeyItem LPARAM lParam;
WORD DefHotkey, Hotkey;
bool Enabled;
- int hLangpack;
+ HPLUGIN pPlugin;
ATOM idHotkey;
THotkeyItem *rootHotkey;
@@ -60,8 +60,8 @@ struct THotkeyItem __inline char* getName() const { return (rootHotkey) ? rootHotkey->pszName : pszName; }
- __inline wchar_t* getSection() const { return TranslateW_LP(pwszSection, hLangpack); }
- __inline wchar_t* getDescr() const { return TranslateW_LP(pwszDescription, hLangpack); }
+ __inline wchar_t* getSection() const { return TranslateW_LP(pwszSection, pPlugin); }
+ __inline wchar_t* getDescr() const { return TranslateW_LP(pwszDescription, pPlugin); }
};
extern LIST<THotkeyItem> hotkeys;
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 6347d5347c..73302ecf22 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -939,7 +939,7 @@ INT_PTR CIconImportDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) int SkinOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.flags = ODPF_BOLDGROUPS;
odp.position = -180000000;
odp.pDialog = new CIcoLibOptsDlg();
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index 88d95c2be1..607f8f1eb7 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -32,10 +32,10 @@ struct SoundItem ptrW pwszSection;
ptrW pwszDescription;
ptrW ptszTempFile;
- int hLangpack;
+ HPLUGIN pPlugin;
- __inline wchar_t* getSection() const { return TranslateW_LP(pwszSection, hLangpack); }
- __inline wchar_t* getDescr() const { return TranslateW_LP(pwszDescription, hLangpack); }
+ __inline wchar_t* getSection() const { return TranslateW_LP(pwszSection, pPlugin); }
+ __inline wchar_t* getDescr() const { return TranslateW_LP(pwszDescription, pPlugin); }
};
static int CompareSounds(const SoundItem* p1, const SoundItem* p2)
@@ -47,11 +47,11 @@ static OBJLIST<SoundItem> arSounds(10, CompareSounds); /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleSounds(int _hLang)
+MIR_APP_DLL(void) KillModuleSounds(HPLUGIN pPlugin)
{
auto T = arSounds.rev_iter();
for (auto &it : T)
- if (it->hLangpack == _hLang)
+ if (it->pPlugin == pPlugin)
arSounds.remove(T.indexOf(&it));
}
@@ -67,7 +67,7 @@ int CMPluginBase::addSound(const char *pszName, const wchar_t *pwszSection, cons SoundItem *item = new SoundItem; // due to OBJLIST
item->name = mir_strdup(pszName);
item->ptszTempFile = nullptr;
- item->hLangpack = m_hLang;
+ item->pPlugin = this;
arSounds.insert(item);
item->pwszDescription = mir_wstrdup(pwszDescription);
@@ -434,9 +434,8 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int SkinOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = -200000000;
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND);
odp.szTitle.a = LPGEN("Sounds");
odp.pfnDlgProc = DlgProcSoundOpts;
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index 72e3a4f936..b3d15efa68 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -67,7 +67,7 @@ struct StatusIconMain : public MZeroedObject StatusIconData sid;
- int hLangpack;
+ HPLUGIN pPlugin;
OBJLIST<StatusIconChild> arChildren;
};
@@ -84,7 +84,7 @@ static OBJLIST<StatusIconMain> arIcons(3, CompareIcons); /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack)
+MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, HPLUGIN pPlugin)
{
if (sid == nullptr)
return 1;
@@ -95,7 +95,7 @@ MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) p = new StatusIconMain;
memcpy(&p->sid, sid, sizeof(p->sid));
- p->hLangpack = _hLangpack;
+ p->pPlugin = pPlugin;
p->sid.szModule = mir_strdup(sid->szModule);
if (sid->flags & MBF_UNICODE)
p->sid.tszTooltip = mir_wstrdup(sid->wszTooltip);
@@ -185,7 +185,7 @@ MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int index) if (pc->tszTooltip) res.tszTooltip = pc->tszTooltip;
res.flags = pc->flags;
}
- res.tszTooltip = TranslateW_LP(res.tszTooltip, it->hLangpack);
+ res.tszTooltip = TranslateW_LP(res.tszTooltip, it->pPlugin);
return &res;
}
nVis++;
@@ -203,11 +203,11 @@ MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusIconClickD /////////////////////////////////////////////////////////////////////////////////////////
-void KillModuleSrmmIcons(int _hLang)
+void KillModuleSrmmIcons(HPLUGIN pPlugin)
{
auto T = arIcons.rev_iter();
for (auto &it : T)
- if (it->hLangpack == _hLang)
+ if (it->pPlugin == pPlugin)
arIcons.remove(T.indexOf(&it));
}
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 9f8f3e3aa1..bb4c076db0 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -65,7 +65,7 @@ static void CB_RegisterSeparators() bbd.bbbFlags = BBBF_ISSEPARATOR | BBBF_ISIMBUTTON; bbd.dwButtonID = i + 1; bbd.dwDefPos = 410 + i; - Srmm_AddButton(&bbd, g_plugin.m_hLang); + Srmm_AddButton(&bbd, &g_plugin); } } @@ -79,7 +79,7 @@ MIR_APP_DLL(int) Srmm_GetButtonCount(void) return arButtonsList.getCount(); } -MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, int _hLang) +MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN _hLang) { if (bbdi == nullptr) return nullptr; @@ -99,7 +99,7 @@ MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, int _hLang) cbd->m_bDisabled = (bbdi->bbbFlags & BBBF_DISABLED) != 0; cbd->m_bPushButton = (bbdi->bbbFlags & BBBF_ISPUSHBUTTON) != 0; - cbd->m_iLangId = _hLang; + cbd->m_pPlugin = _hLang; cbd->m_dwOrigFlags.bit1 = cbd->m_bRSided = (bbdi->bbbFlags & BBBF_ISRSIDEBUTTON) != 0; cbd->m_dwOrigFlags.bit2 = cbd->m_bIMButton = (bbdi->bbbFlags & BBBF_ISIMBUTTON) != 0; @@ -687,7 +687,7 @@ public: bbd.bbbFlags = BBBF_ISSEPARATOR | BBBF_ISIMBUTTON; bbd.dwButtonID = ++dwSepCount; - CustomButtonData *cbd = (CustomButtonData*)Srmm_AddButton(&bbd, g_plugin.m_hLang); + CustomButtonData *cbd = (CustomButtonData*)Srmm_AddButton(&bbd, &g_plugin); TVINSERTSTRUCT tvis; tvis.hParent = nullptr; @@ -772,7 +772,7 @@ public: static int SrmmOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.position = 910000000; odp.szGroup.a = LPGEN("Message sessions"); odp.szTitle.a = LPGEN("Toolbar"); @@ -784,11 +784,11 @@ static int SrmmOptionsInit(WPARAM wParam, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// -void KillModuleToolbarIcons(int _hLang) +void KillModuleToolbarIcons(HPLUGIN pPlugin) { auto T = arButtonsList.rev_iter(); for (auto &cbd : T) - if (cbd->m_iLangId == _hLang) { + if (cbd->m_pPlugin == pPlugin) { delete cbd; arButtonsList.remove(T.indexOf(&cbd)); } diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp index fee552ce8e..e3d673e7ad 100644 --- a/src/mir_app/src/visibility.cpp +++ b/src/mir_app/src/visibility.cpp @@ -271,9 +271,8 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP static int VisibilityOptInitialise(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = 850000000;
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY);
odp.szTitle.a = LPGEN("Visibility");
odp.szGroup.a = LPGEN("Contacts");
diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index 6bf0b703b4..bdf7ad78a9 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -203,7 +203,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_INITDIALOG: m_initialized = false; - TranslateDialog_LP(m_hwnd, GetPluginLangByInstance(m_pPlugin.getInst())); + TranslateDialog_LP(m_hwnd, &m_pPlugin); ::EnumChildWindows(m_hwnd, &GlobalFieldEnum, LPARAM(this)); diff --git a/src/mir_core/src/icons.cpp b/src/mir_core/src/icons.cpp index df3f14af9b..be3fa97ae1 100644 --- a/src/mir_core/src/icons.cpp +++ b/src/mir_core/src/icons.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconItem *pIcons, size_t iCount, const char *prefix, int _hLang)
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconItem *pIcons, size_t iCount, const char *prefix, HPLUGIN pPlugin)
{
wchar_t szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, MAX_PATH);
@@ -44,11 +44,11 @@ MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconIte sid.cx = sid.cy = pIcons[i].size;
sid.description.a = pIcons[i].szDescr;
sid.iDefaultIndex = -pIcons[i].defIconID;
- pIcons[i].hIcolib = IcoLib_AddIcon(&sid, _hLang);
+ pIcons[i].hIcolib = IcoLib_AddIcon(&sid, pPlugin);
}
}
-MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t *szSection, IconItemT *pIcons, size_t iCount, const char *prefix, int _hLang)
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t *szSection, IconItemT *pIcons, size_t iCount, const char *prefix, HPLUGIN pPlugin)
{
wchar_t szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, MAX_PATH);
@@ -69,6 +69,6 @@ MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t *szSection, Ico sid.cx = sid.cy = pIcons[i].size;
sid.description.w = pIcons[i].tszDescr;
sid.iDefaultIndex = -pIcons[i].defIconID;
- pIcons[i].hIcolib = IcoLib_AddIcon(&sid, _hLang);
+ pIcons[i].hIcolib = IcoLib_AddIcon(&sid, pPlugin);
}
}
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp index 22c19a8552..1d139b67dd 100644 --- a/src/mir_core/src/langpack.cpp +++ b/src/mir_core/src/langpack.cpp @@ -142,6 +142,14 @@ static unsigned int __fastcall hashstrW(const char *key) return mir_hash(buf, len);
}
+static const MUUID* GetMuid(HPLUGIN pPlugin)
+{
+ if (!pPlugin)
+ return nullptr;
+
+ return &pPlugin->getInfo().uuid;
+}
+
static int SortLangPackHashesProc(LangPackEntry *arg1, LangPackEntry *arg2)
{
if (arg1->englishHash < arg2->englishHash) return -1;
@@ -455,7 +463,7 @@ static int SortLangPackHashesProc2(LangPackEntry *arg1, LangPackEntry *arg2) return 0;
}
-char* LangPackTranslateString(MUUID *pUuid, const char *szEnglish, const int W)
+char* LangPackTranslateString(const MUUID *pUuid, const char *szEnglish, const int W)
{
if (g_entryCount == 0 || szEnglish == nullptr)
return (char*)szEnglish;
@@ -508,19 +516,19 @@ MIR_CORE_DLL(wchar_t*) Langpack_PcharToTchar(const char *pszStr) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(char*) TranslateA_LP(const char *str, int _hLangpack)
+MIR_CORE_DLL(char*) TranslateA_LP(const char *str, HPLUGIN pPlugin)
{
- return (char*)LangPackTranslateString(Langpack_LookupUuid(_hLangpack), str, FALSE);
+ return (char*)LangPackTranslateString(GetMuid(pPlugin), str, FALSE);
}
-MIR_CORE_DLL(WCHAR*) TranslateW_LP(const WCHAR *str, int _hLangpack)
+MIR_CORE_DLL(WCHAR*) TranslateW_LP(const WCHAR *str, HPLUGIN pPlugin)
{
- return (WCHAR*)LangPackTranslateString(Langpack_LookupUuid(_hLangpack), (LPCSTR)str, TRUE);
+ return (WCHAR*)LangPackTranslateString(GetMuid(pPlugin), (LPCSTR)str, TRUE);
}
-MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int _hLangpack)
+MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, HPLUGIN pPlugin)
{
- MUUID *uuid = Langpack_LookupUuid(_hLangpack);
+ const MUUID *uuid = &pPlugin->getInfo().uuid;
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -542,11 +550,11 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int _hLangpack) }
if (mii.hSubMenu != nullptr)
- TranslateMenu_LP(mii.hSubMenu, _hLangpack);
+ TranslateMenu_LP(mii.hSubMenu, pPlugin);
}
}
-static void TranslateWindow(MUUID *pUuid, HWND hwnd)
+static void TranslateWindow(const MUUID *pUuid, HWND hwnd)
{
wchar_t title[2048];
GetWindowText(hwnd, title, _countof(title));
@@ -558,8 +566,8 @@ static void TranslateWindow(MUUID *pUuid, HWND hwnd) static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
{
- int _hLangpack = (int)lParam;
- MUUID *uuid = Langpack_LookupUuid(_hLangpack);
+ HPLUGIN pPlugin = (HPLUGIN)lParam;
+ const MUUID *uuid = GetMuid(pPlugin);
wchar_t szClass[32];
GetClassName(hwnd, szClass, _countof(szClass));
@@ -572,29 +580,14 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) return TRUE;
}
-MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int _hLangpack)
+MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, HPLUGIN pPlugin)
{
- TranslateWindow(Langpack_LookupUuid(_hLangpack), hDlg);
- EnumChildWindows(hDlg, TranslateDialogEnumProc, _hLangpack);
+ TranslateWindow(GetMuid(pPlugin), hDlg);
+ EnumChildWindows(hDlg, TranslateDialogEnumProc, (LPARAM)pPlugin);
}
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(MUUID*) Langpack_LookupUuid(WPARAM wParam)
-{
- int idx = (wParam >> 16) & 0xFFFF;
- return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[idx - 1] : nullptr;
-}
-
-MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(const MUUID &uuid)
-{
- int idx = lMuuids.getIndex((MUUID*)&uuid);
- if (idx == -1)
- return 0;
-
- return (idx + 1) << 16;
-}
-
MIR_CORE_DLL(void) Langpack_SortDuplicates(void)
{
if (g_entryCount == 0)
@@ -683,14 +676,6 @@ void GetDefaultLang() /////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(void) mir_getLP(const PLUGININFOEX *pInfo, int *_hLang)
-{
- if (_hLang && pInfo)
- *(int*)_hLang = GetPluginLangId(pInfo->uuid, Langpack_MarkPluginLoaded(pInfo->uuid));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
MIR_CORE_DLL(void) ReloadLangpack(wchar_t *pszStr)
{
if (pszStr == nullptr)
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 3c0afec46b..5fafb02730 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1,8 +1,6 @@ LIBRARY mir_core.mir
EXPORTS
-Langpack_LookupUuid @3
-Langpack_MarkPluginLoaded @4
CallFunctionAsync @5
CallPluginEventHook @7
CallService @8
@@ -923,7 +921,6 @@ WindowList_Remove @1108 Utils_AssertInsideScreen @1110
Utils_RestoreWindowPosition @1111
Utils_SaveWindowPosition @1112
-mir_getLP @1113
TimeZone_CreateByContact @1114
TimeZone_CreateByName @1115
TimeZone_GetDescription @1116
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 05064e9e3b..8b92b73dec 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1,8 +1,6 @@ LIBRARY mir_core.mir
EXPORTS
-Langpack_LookupUuid @3
-Langpack_MarkPluginLoaded @4
CallFunctionAsync @5
CallPluginEventHook @7
CallService @8
@@ -923,7 +921,6 @@ WindowList_Remove @1108 Utils_AssertInsideScreen @1110
Utils_RestoreWindowPosition @1111
Utils_SaveWindowPosition @1112
-mir_getLP @1113
TimeZone_CreateByContact @1114
TimeZone_CreateByName @1115
TimeZone_GetDescription @1116
diff --git a/src/mir_core/src/miranda.h b/src/mir_core/src/miranda.h index ceaa486314..ed4e37015b 100644 --- a/src/mir_core/src/miranda.h +++ b/src/mir_core/src/miranda.h @@ -24,12 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once
-extern "C"
-{
- MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(const MUUID &uuid);
- MIR_CORE_DLL(MUUID*) Langpack_LookupUuid(WPARAM wParam);
-};
-
void UnloadLangPackModule(void);
int InitialiseModularEngine(void);
@@ -86,7 +80,7 @@ extern LIST<CMPluginBase> pluginListAddr; /////////////////////////////////////////////////////////////////////////////////////////
// langpack.cpp
-char* LangPackTranslateString(MUUID *pUuid, const char *szEnglish, const int W);
+char* LangPackTranslateString(const MUUID *pUuid, const char *szEnglish, const int W);
/////////////////////////////////////////////////////////////////////////////////////////
// threads.cpp
|