summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-04 14:14:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-04 14:14:58 +0000
commitf5baf2606966349e067d423a596722b66c401651 (patch)
treed501fa4b011c2c074b12e48284f5f2b824d971b0 /plugins
parentfc477d493da24a91dd9d095fbcf74a9b09c15fa8 (diff)
- internal langpack preparation for hLangpack-dependent resource cleaning
- langpack functions' names normalization (2Awk: safe for plugins written in Delphi) git-svn-id: http://svn.miranda-ng.org/main/trunk@758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Mir_core/langpack.cpp36
-rw-r--r--plugins/Mir_core/memory.cpp4
-rw-r--r--plugins/Mir_core/mir_core.def14
-rw-r--r--plugins/Mir_core/miranda.h8
-rw-r--r--plugins/Mir_core/utf.cpp4
5 files changed, 40 insertions, 26 deletions
diff --git a/plugins/Mir_core/langpack.cpp b/plugins/Mir_core/langpack.cpp
index eb3b4619b5..9aa2f6694c 100644
--- a/plugins/Mir_core/langpack.cpp
+++ b/plugins/Mir_core/langpack.cpp
@@ -423,24 +423,24 @@ static char *LangPackTranslateString(LangPackMuuid* pUuid, const char *szEnglish
return W ? (char *)entry->wlocal : entry->local;
}
-MIR_CORE_DLL(int) LangPackGetDefaultCodePage()
+MIR_CORE_DLL(int) Langpack_GetDefaultCodePage()
{
return langPack.defaultANSICp;
}
-MIR_CORE_DLL(int) LangPackGetDefaultLocale()
+MIR_CORE_DLL(int) Langpack_GetDefaultLocale()
{
return (langPack.localeID == 0) ? LOCALE_USER_DEFAULT : langPack.localeID;
}
-MIR_CORE_DLL(TCHAR*) LangPackPcharToTchar(const char* pszStr)
+MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr)
{
if (pszStr == NULL)
return NULL;
{ int len = (int)strlen(pszStr);
TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
- MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
+ MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len);
result[len] = 0;
return mir_wstrdup(TranslateW(result));
}
@@ -450,17 +450,17 @@ MIR_CORE_DLL(TCHAR*) LangPackPcharToTchar(const char* pszStr)
MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLangpack)
{
- return (char*)LangPackTranslateString(LangPackLookupUuid(hLangpack), str, FALSE);
+ return (char*)LangPackTranslateString(Langpack_LookupUuid(hLangpack), str, FALSE);
}
MIR_CORE_DLL(WCHAR*) TranslateW_LP(const WCHAR* str, int hLangpack)
{
- return (WCHAR*)LangPackTranslateString(LangPackLookupUuid(hLangpack), (LPCSTR)str, TRUE);
+ return (WCHAR*)LangPackTranslateString(Langpack_LookupUuid(hLangpack), (LPCSTR)str, TRUE);
}
MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
{
- LangPackMuuid* uuid = LangPackLookupUuid(hLangpack);
+ LangPackMuuid* uuid = Langpack_LookupUuid(hLangpack);
MENUITEMINFO mii;
mii.cbSize = MENUITEMINFO_V4_SIZE;
@@ -505,7 +505,7 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
TCHAR szClass[32];
int id = GetDlgCtrlID(hwnd);
- LangPackMuuid* uuid = LangPackLookupUuid(hLangpack);
+ LangPackMuuid* uuid = Langpack_LookupUuid(hLangpack);
GetClassName(hwnd, szClass, SIZEOF(szClass));
if ( !lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl")))
@@ -519,19 +519,29 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLangpack)
{
- TranslateWindow(LangPackLookupUuid(hLangpack), hDlg);
+ TranslateWindow( Langpack_LookupUuid(hLangpack), hDlg);
EnumChildWindows(hDlg, TranslateDialogEnumProc, hLangpack);
}
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(LangPackMuuid*) LangPackLookupUuid(WPARAM wParam)
+MIR_CORE_DLL(LangPackMuuid*) Langpack_LookupUuid(WPARAM wParam)
{
int idx = (wParam >> 16) & 0xFFFF;
return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[ idx-1 ] : NULL;
}
-MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo)
+MIR_CORE_DLL(int) Langpack_GetPluginHandle(PLUGININFOEX* pInfo)
+{
+ LangPackMuuid tmp; tmp.muuid = pInfo->uuid;
+ int idx = lMuuids.getIndex(&tmp);
+ if (idx == -1)
+ return 0;
+
+ return (idx+1) << 16;
+}
+
+MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo)
{
LangPackMuuid tmp; tmp.muuid = pInfo->uuid;
int idx = lMuuids.getIndex(&tmp);
@@ -542,7 +552,7 @@ MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo)
return (idx+1) << 16;
}
-MIR_CORE_DLL(void) LangPackDropUnusedItems(void)
+MIR_CORE_DLL(void) Langpack_SortDuplicates(void)
{
if (langPack.entryCount == 0)
return;
@@ -636,5 +646,5 @@ MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr)
UnloadLangPackModule();
LoadLangPack(pszStr);
- LangPackDropUnusedItems();
+ Langpack_SortDuplicates();
}
diff --git a/plugins/Mir_core/memory.cpp b/plugins/Mir_core/memory.cpp
index a14d9fd3ad..0ecddc6717 100644
--- a/plugins/Mir_core/memory.cpp
+++ b/plugins/Mir_core/memory.cpp
@@ -252,7 +252,7 @@ MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage)
MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src)
{
- return mir_a2u_cp(src, LangPackGetDefaultCodePage());
+ return mir_a2u_cp(src, Langpack_GetDefaultCodePage());
}
/******************************************************************************/
@@ -276,5 +276,5 @@ MIR_CORE_DLL(char*) mir_u2a_cp(const wchar_t* src, int codepage)
MIR_CORE_DLL(char*) mir_u2a(const wchar_t* src)
{
- return mir_u2a_cp(src, LangPackGetDefaultCodePage());
+ return mir_u2a_cp(src, Langpack_GetDefaultCodePage());
}
diff --git a/plugins/Mir_core/mir_core.def b/plugins/Mir_core/mir_core.def
index 6411108a72..b985fa7efb 100644
--- a/plugins/Mir_core/mir_core.def
+++ b/plugins/Mir_core/mir_core.def
@@ -3,8 +3,8 @@ LIBRARY mir_core
EXPORTS
CallContactService @1
CallProtoService @2
-LangPackLookupUuid @3 NONAME
-LangPackMarkPluginLoaded @4 NONAME
+Langpack_LookupUuid @3
+Langpack_MarkPluginLoaded @4
CallFunctionAsync @5
CallPluginEventHook @7
CallService @8
@@ -32,10 +32,10 @@ KillModuleServices @29
KillObjectEventHooks @30
KillObjectServices @31
KillObjectThreads @32
-LangPackDropUnusedItems @33
-LangPackGetDefaultCodePage @34
-LangPackGetDefaultLocale @35
-LangPackPcharToTchar @36
+Langpack_SortDuplicates @33
+Langpack_GetDefaultCodePage @34
+Langpack_GetDefaultLocale @35
+Langpack_PcharToTchar @36
List_Copy @37
List_Create @38
List_Destroy @39
@@ -124,4 +124,4 @@ db_set_w @121
db_set_ws @122
UnloadCoreModule @123
Thread_SetName @124
-
+Langpack_GetPluginHandle @125
diff --git a/plugins/Mir_core/miranda.h b/plugins/Mir_core/miranda.h
index 71c0804fd1..ed3f4a5b75 100644
--- a/plugins/Mir_core/miranda.h
+++ b/plugins/Mir_core/miranda.h
@@ -30,9 +30,13 @@ struct LangPackMuuid
PLUGININFOEX* pInfo;
};
-MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
+extern "C"
+{
+ MIR_CORE_DLL(int) Langpack_GetPluginHandle(PLUGININFOEX* pInfo);
+ MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
+};
-MIR_CORE_DLL(LangPackMuuid*) LangPackLookupUuid(WPARAM wParam);
+MIR_CORE_DLL(LangPackMuuid*) Langpack_LookupUuid(WPARAM wParam);
void UnloadLangPackModule(void);
diff --git a/plugins/Mir_core/utf.cpp b/plugins/Mir_core/utf.cpp
index 5ec6042758..ddf2d1ca9f 100644
--- a/plugins/Mir_core/utf.cpp
+++ b/plugins/Mir_core/utf.cpp
@@ -305,7 +305,7 @@ MIR_CORE_DLL(char*) Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2)
MIR_CORE_DLL(char*) Utf8Decode(char* str, wchar_t** ucs2)
{
- return Utf8DecodeCP(str, LangPackGetDefaultCodePage(), ucs2);
+ return Utf8DecodeCP(str, Langpack_GetDefaultCodePage(), ucs2);
}
MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char* str)
@@ -379,7 +379,7 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)
MIR_CORE_DLL(char*) Utf8Encode(const char* src)
{
- return Utf8EncodeCP(src, LangPackGetDefaultCodePage());
+ return Utf8EncodeCP(src, Langpack_GetDefaultCodePage());
}
/////////////////////////////////////////////////////////////////////////////////////////