summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-18 21:20:39 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-18 21:20:39 +0000
commitec0e34b4f88ebe03ff12f559e40dda52c51549b7 (patch)
tree42e8a56fe17d9736527fe79a6345e857842fbf40 /src
parentca702593c60aa89c06633777feb7cf79ad8e751f (diff)
langpack services module destroyed from mir_app
the only survived service moved to mir_core git-svn-id: http://svn.miranda-ng.org/main/trunk@14250 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdchat/src/options.cpp2
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp3
-rw-r--r--src/mir_app/src/lpopts.cpp2
-rw-r--r--src/mir_app/src/lpservices.cpp113
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/miranda.h1
-rw-r--r--src/mir_app/src/modules.cpp3
-rw-r--r--src/mir_app/src/newplugins.cpp2
-rw-r--r--src/mir_core/src/langpack.cpp47
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
12 files changed, 42 insertions, 135 deletions
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp
index b66c74f2b0..eccfa9ac3f 100644
--- a/src/core/stdchat/src/options.cpp
+++ b/src/core/stdchat/src/options.cpp
@@ -141,7 +141,7 @@ static HTREEITEM InsertBranch(HWND hwndTree, char* pszDescr, BOOL bExpanded)
TVINSERTSTRUCT tvis = { 0 };
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_STATE;
- tvis.item.pszText = (TCHAR*)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)pszDescr);
+ tvis.item.pszText = Langpack_PcharToTchar(pszDescr);
tvis.item.stateMask = bExpanded ? TVIS_STATEIMAGEMASK | TVIS_EXPANDED : TVIS_STATEIMAGEMASK;
tvis.item.state = bExpanded ? INDEXTOSTATEIMAGEMASK(1) | TVIS_EXPANDED : INDEXTOSTATEIMAGEMASK(1);
HTREEITEM res = TreeView_InsertItem(hwndTree, &tvis);
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index fd3f76e324..c2c175bc2a 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -47,9 +47,8 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (!param->szMsg || !param->szMsg[0])
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateT("An unknown error has occurred."));
else {
- TCHAR* ptszError = (TCHAR*)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)param->szMsg);
+ ptrT ptszError(Langpack_PcharToTchar(param->szMsg));
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ptszError);
- mir_free(ptszError);
}
SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrT(mir_utf8decodeT(item->szMsg)));
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp
index fac4b383e2..a0f8812d41 100644
--- a/src/mir_app/src/lpopts.cpp
+++ b/src/mir_app/src/lpopts.cpp
@@ -60,7 +60,7 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
SYSTEMTIME stFileDate;
TCHAR szDate[128]; szDate[0] = 0;
if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate))
- GetDateFormat((LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0), DATE_SHORTDATE, &stFileDate, NULL, szDate, SIZEOF(szDate));
+ GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, NULL, szDate, SIZEOF(szDate));
SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate);
/* general */
diff --git a/src/mir_app/src/lpservices.cpp b/src/mir_app/src/lpservices.cpp
deleted file mode 100644
index ce01393140..0000000000
--- a/src/mir_app/src/lpservices.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvTranslateString(WPARAM wParam, LPARAM lParam)
-{
- if (wParam & LANG_UNICODE)
- return (INT_PTR)TranslateW_LP((const WCHAR*)lParam, wParam);
- return (INT_PTR)TranslateA_LP((const char *)lParam, wParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvTranslateMenu(WPARAM wParam, LPARAM lParam)
-{
- TranslateMenu_LP((HMENU)wParam, lParam);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvRegisterLP(WPARAM wParam, LPARAM lParam)
-{
- PLUGININFOEX* ppi = (PLUGININFOEX*)lParam;
- if (wParam && ppi)
- *(int*)wParam = GetPluginFakeId(ppi->uuid, Langpack_MarkPluginLoaded(ppi));
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvGetDefaultCodePage(WPARAM, LPARAM)
-{
- return Langpack_GetDefaultCodePage();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvGetDefaultLocale(WPARAM, LPARAM)
-{
- return Langpack_GetDefaultLocale();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvPcharToTchar(WPARAM wParam, LPARAM lParam)
-{
- char *pszStr = (char*)lParam;
- if (pszStr == NULL)
- return NULL;
-
- int len = (int)mir_strlen(pszStr);
- TCHAR *result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
- MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len);
- result[len] = 0;
- return (INT_PTR)mir_wstrdup(TranslateW_LP(result, wParam));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvReloadLangpack(WPARAM, LPARAM lParam)
-{
- ReloadLangpack((TCHAR*)lParam);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR srvGetPluginLangpack(WPARAM, LPARAM lParam)
-{
- return GetPluginLangByInstance((HINSTANCE)lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int LoadLangpackModule(void)
-{
- LoadLangPackModule();
-
- CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING, srvTranslateString);
- CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU, srvTranslateMenu);
- CreateServiceFunction(MS_LANGPACK_GETCODEPAGE, srvGetDefaultCodePage);
- CreateServiceFunction(MS_LANGPACK_GETLOCALE, srvGetDefaultLocale);
- CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR, srvPcharToTchar);
- CreateServiceFunction(MS_LANGPACK_REGISTER, srvRegisterLP);
- CreateServiceFunction(MS_LANGPACK_RELOAD, srvReloadLangpack);
- CreateServiceFunction(MS_LANGPACK_LOOKUPHANDLE, srvGetPluginLangpack);
- return 0;
-}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index fbbeedf608..6eb3303181 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -128,3 +128,4 @@ ProtoLogW @125
ProtoWindowAdd @126
ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
+GetPluginFakeId @129
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index d0ef1f280d..4bd307a4ff 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -128,3 +128,4 @@ ProtoLogW @125
ProtoWindowAdd @126
ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
+GetPluginFakeId @129
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index ecd60c2211..a1fad48c77 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -77,7 +77,6 @@ extern TCHAR mirandabootini[MAX_PATH];
/**** newplugins.cpp *******************************************************************/
char* GetPluginNameByInstance(HINSTANCE hInstance);
-int GetPluginFakeId(const MUUID &uuid, int hLangpack);
int LoadStdPlugins(void);
/**** path.cpp *************************************************************************/
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp
index 0c7e748552..e277f09260 100644
--- a/src/mir_app/src/modules.cpp
+++ b/src/mir_app/src/modules.cpp
@@ -34,7 +34,6 @@ int LoadNewPluginsModuleInfos(void); // core: preloading plugins
int LoadNewPluginsModule(void); // core: N.O. plugins
int LoadNetlibModule(void); // core: network
int LoadSslModule(void);
-int LoadLangpackModule(void); // core: translation
int LoadProtocolsModule(void); // core: protocol manager
int LoadAccountsModule(void); // core: account manager
int LoadIgnoreModule(void); // protocol filter: ignore
@@ -90,7 +89,7 @@ int LoadDefaultModules(void)
{
// load order is very important for these
if (LoadSystemModule()) return 1;
- if (LoadLangpackModule()) return 1; // langpack will be a system module in the new order so this is moved here
+ if (LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
if (CheckRestart()) return 1;
if (LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
if (LoadIcoTabsModule()) return 1;
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index f6ae881f7a..45117ff4ff 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -188,7 +188,7 @@ MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance)
return NULL;
}
-int GetPluginFakeId(const MUUID &uuid, int hLangpack)
+EXTERN_C MIR_APP_DLL(int) GetPluginFakeId(const MUUID &uuid, int hLangpack)
{
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp
index 1f9ada0823..a153098be7 100644
--- a/src/mir_core/src/langpack.cpp
+++ b/src/mir_core/src/langpack.cpp
@@ -685,10 +685,43 @@ void GetDefaultLang()
db_set_ts(NULL, "Langpack", "Current", _T("default"));
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+EXTERN_C MIR_APP_DLL(int) GetPluginFakeId(const MUUID &uuid, int hLangpack);
+
+MIR_CORE_DLL(void) mir_getLP(const PLUGININFOEX *pInfo, int *_hLang)
+{
+ if (_hLang && pInfo)
+ *(int*)_hLang = GetPluginFakeId(pInfo->uuid, Langpack_MarkPluginLoaded((PLUGININFOEX*)pInfo));
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr)
+{
+ if (pszStr == NULL)
+ pszStr = NEWTSTR_ALLOCA(langPack.tszFileName);
+
+ UnloadLangPackModule();
+ LoadLangPack(pszStr);
+ Langpack_SortDuplicates();
+
+ NotifyEventHooks(hevChanged, 0, 0);
+}
+
+static INT_PTR srvReloadLangpack(WPARAM, LPARAM lParam)
+{
+ ReloadLangpack((TCHAR*)lParam);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_CORE_DLL(int) LoadLangPackModule(void)
{
bModuleInitialized = TRUE;
hevChanged = CreateHookableEvent(ME_LANGPACK_CHANGED);
+ CreateServiceFunction(MS_LANGPACK_RELOAD, srvReloadLangpack);
GetDefaultLang();
return 0;
}
@@ -725,17 +758,3 @@ void UnloadLangPackModule()
langPack.tszFileName[0] = langPack.tszFullPath[0] = 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr)
-{
- if (pszStr == NULL)
- pszStr = NEWTSTR_ALLOCA(langPack.tszFileName);
-
- UnloadLangPackModule();
- LoadLangPack(pszStr);
- Langpack_SortDuplicates();
-
- NotifyEventHooks(hevChanged, 0, 0);
-}
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 44fd75942f..f693d41233 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -952,3 +952,4 @@ WindowList_Remove @1108
Utils_AssertInsideScreen @1110
Utils_RestoreWindowPosition @1111
Utils_SaveWindowPosition @1112
+mir_getLP @1113
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 101c8bc390..eadbef2572 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -952,3 +952,4 @@ WindowList_Remove @1108
Utils_AssertInsideScreen @1110
Utils_RestoreWindowPosition @1111
Utils_SaveWindowPosition @1112
+mir_getLP @1113