diff options
author | George Hazan <ghazan@miranda.im> | 2018-07-11 21:32:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-07-11 21:33:11 +0300 |
commit | f719c8b921c7a46b76453476204224d40c682914 (patch) | |
tree | c6d92dc450893e7f5abe60c2046ec9c2d1e3db36 /src/mir_core | |
parent | 16ad355c8bdc438c3107ee3ba3ad0bf0b8c395fa (diff) |
int hLangpack/m_hLang removed and replaced with HPLUGIN
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/src/CDlgBase.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/src/icons.cpp | 8 | ||||
-rw-r--r-- | src/mir_core/src/langpack.cpp | 59 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 3 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 3 | ||||
-rw-r--r-- | src/mir_core/src/miranda.h | 8 |
6 files changed, 28 insertions, 55 deletions
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
|