diff options
54 files changed, 174 insertions, 421 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex 8553e12bfe..14bb292e64 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 30296cc791..ec941dda4b 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 3f98f167cf..da108db614 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex a3b5568e11..4234167f2d 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex 8553e12bfe..14bb292e64 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 30296cc791..ec941dda4b 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib Binary files differindex 3f98f167cf..da108db614 100644 --- a/bin12/lib/mir_core.lib +++ b/bin12/lib/mir_core.lib diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib Binary files differindex a3b5568e11..4234167f2d 100644 --- a/bin12/lib/mir_core64.lib +++ b/bin12/lib/mir_core64.lib diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index f21a2c3f08..a005f5c9ec 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -11,7 +11,6 @@ function CLCDEFAULT_SELBKCOLOUR:dword; function CLCDEFAULT_SELTEXTCOLOUR:dword;
function CLCDEFAULT_HOTTEXTCOLOUR:dword;
-
function CreateVersionString(version:dword;buf:PAnsiChar):PAnsiChar;
function CreateVersionStringPlugin(pluginInfo:PPluginInfoEx;buf:PAnsiChar):PAnsiChar;
function PLUGIN_MAKE_VERSION(a,b,c,d: Cardinal): int;
@@ -325,7 +324,7 @@ end; function Langpack_Register:int_ptr;
begin
- CallService(MS_LANGPACK_REGISTER,WPARAM(@hLangpack),LPARAM(@PluginInfo));
+ mir_getLP(PluginInfo, hLangpack);
result:=hLangpack;
end;
diff --git a/include/delphi/m_langpack.inc b/include/delphi/m_langpack.inc index 79a828a088..3091b574b3 100644 --- a/include/delphi/m_langpack.inc +++ b/include/delphi/m_langpack.inc @@ -26,85 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. const
{
- translates a single string into the user's local language v0.1.1.0+
- wParam=LANG_* flags
- lParam=(LPARAM)(const AnsiChar*)szEnglish
- returns a pointer to the localised string. If there is no known translation
- it will return szEnglish. The return value does not need to be freed in any way
- Note that the Translate() macro as defined below will crash plugins that are
- loaded into Miranda 0.1.0.1 and earlier. If anyone's actually using one of
- these versions, I pity them.
-}
- MS_LANGPACK_TRANSLATESTRING:PAnsiChar = 'LangPack/TranslateString';
-(*
-{
- translates a dialog into the user's local language v0.1.1.0+
- wParam=0
- lParam=(LPARAM)(LANGPACKTRANSLATEDIALOG* )&lptd
- returns 0 on success, nonzero on failure
- This service only knows about the following controls:
- Window titles, STATIC, EDIT, Hyperlink, BUTTON
-}
-type
- IntArray = array [0..1000] of integer;
- PLANGPACKTRANSLATEDIALOG = ^TLANGPACKTRANSLATEDIALOG;
- TLANGPACKTRANSLATEDIALOG = record
- cbSize :int;
- flags :dword;
- hwndDlg :HWND;
- ignoreControls:^IntArray; // zero-terminated list of control IDs *not* to translate
- end;
-
-const
- LPTDF_NOIGNOREEDIT = 1; // translate all edit controls. By default
- // non-read-only edit controls are not translated
- LPTDF_NOTITLE = 2; //do not translate the title of the dialog
-
-const
- MS_LANGPACK_TRANSLATEDIALOG:PAnsiChar = 'LangPack/TranslateDialog';
-*)
-{
- translates a menu into the user's local language v0.1.1.0+
- wParam=(WPARAM)(HMENU)hMenu
- lParam=0
- returns 0 on success, nonzero on failure
-}
- MS_LANGPACK_TRANSLATEMENU:PAnsiChar = 'LangPack/TranslateMenu';
-
-{
- returns the codepage used in the language pack v0.4.3.0+
- wParam=0
- lParam=0
- returns the codepage stated in the langpack, or CP_ACP if no langpack is present
-}
- MS_LANGPACK_GETCODEPAGE:PAnsiChar = 'LangPack/GetCodePage';
-
-{
- returns the locale id associated with the language pack v0.4.3.0+
- wParam=0
- lParam=0
- returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
-}
- MS_LANGPACK_GETLOCALE:PAnsiChar = 'LangPack/GetLocale';
-
-{
- returns the strdup/wcsdup of lparam according to the langpack v0.4.3.0+
- wParam=0
- lParam=(LPARAM)(AnsiChar*)source string
- returns a string converted from AnsiChar* to TCHAR* using the langpack codepage.
- This string should be freed using mir_free() then
-}
- MS_LANGPACK_PCHARTOTCHAR:PAnsiChar = 'LangPack/PcharToTchar';
-
-{
- initializes the plugin-specific translation context v0.10.0+
- wParam=pointer to the langpack handle
- lParam=PLUGININFOEX* of the caller plugin
- always returns 0
-}
- MS_LANGPACK_REGISTER:PAnsiChar = 'LangPack/Register';
-
-{
reloads langpack
wParam=0 (ignored)
lParam=(LPARAM)(TCHAR*)langpack file name or NULL to reload the current one
@@ -114,12 +35,7 @@ const ME_LANGPACK_CHANGE:PAnsiChar = 'LangPack/Changed';
-{
- retrieves the hLangpack of a plugin by its HINSTANCE
- wParam = 0 (ignored)
- lParam = (LPARAM)(HINSTANCE)plugin's base address
- returns hLangpack if found, or 0 if error occurred
-}
- MS_LANGPACK_LOOKUPHANDLE:PAnsiChar = 'LangPack/LookupHandle';
+procedure mir_getLP(var pInfo:TPLUGININFOEX; var hLang:int); stdcall;
+ external CoreDLL name 'mir_getLP';
{$ENDIF}
diff --git a/include/m_core.h b/include/m_core.h index 52bef5ddd8..8ee979e305 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -171,37 +171,6 @@ MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR* szSection, IconI ///////////////////////////////////////////////////////////////////////////////
// language packs support
-#define LANG_UNICODE 0x1000
-
-MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
-MIR_CORE_DLL(int) Langpack_GetDefaultCodePage( void );
-MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
-MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
-
-MIR_CORE_DLL(int) LoadLangPackModule(void);
-MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
-MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr);
-
-MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLang);
-MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t* str, int hLang);
-MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int hLang);
-MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang);
-
-#define Translate(s) TranslateA_LP(s, hLangpack)
-#define TranslateW(s) TranslateW_LP(s, hLangpack)
-#define TranslateMenu(h) TranslateMenu_LP(h,hLangpack)
-#define TranslateDialogDefault(h) TranslateDialog_LP(h,hLangpack)
-
-#ifdef _UNICODE
- #define TranslateT(s) TranslateW_LP(_T(s),hLangpack)
- #define TranslateTS(s) TranslateW_LP(s,hLangpack)
- #define TranslateTH(l,s) TranslateW_LP(s,l)
-#else
- #define TranslateT(s) TranslateA_LP(s,hLangpack)
- #define TranslateTS(s) TranslateA_LP(s,hLangpack)
- #define TranslateTH(l,s) TranslateA_LP(s,l)
-#endif
-
MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len);
#pragma optimize("gt", on)
@@ -670,7 +639,11 @@ MIR_CORE_DLL(BOOL) IsFullScreen(); MIR_CORE_DLL(BOOL) IsWorkstationLocked();
MIR_CORE_DLL(BOOL) IsScreenSaverRunning();
-MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance);
+/////////////////////////////////////////////////////////////////////////////////////////
+// retrieves the hLangpack of a plugin by its HINSTANCE
+// returns hLangpack if found, or 0 if error occurred
+
+MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE);
///////////////////////////////////////////////////////////////////////////////
diff --git a/include/m_langpack.h b/include/m_langpack.h index 87c1557c9e..581405ce8a 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -29,25 +29,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_core.h>
#endif
-#if !defined(_STATIC)
- #define MIRANDA_CUSTOM_LP
-#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// translates a single string into the user's local language
+// returns a pointer to the localised string. If there is no known translation
+// it will return szEnglish. The return value does not need to be freed in any way
+// Note that the Translate() macro as defined below will crash plugins that are
+// loaded into Miranda 0.1.0.1 and earlier. If anyone's actually using one of
+// these versions, I pity them.
+
+#define LANG_UNICODE 0x1000
+
+EXTERN_C MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
+
+EXTERN_C MIR_CORE_DLL(int) LoadLangPackModule(void);
+EXTERN_C MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
+EXTERN_C MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr);
+
+EXTERN_C MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLang);
+EXTERN_C MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t* str, int hLang);
+EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang);
-//translates a single string into the user's local language v0.1.1.0+
-//wParam = 0
-//lParam = (LPARAM)(const char*)szEnglish
-//returns a pointer to the localised string. If there is no known translation
-//it will return szEnglish. The return value does not need to be freed in any
-//way
-//Note that the Translate() macro as defined below will crash plugins that are
-//loaded into Miranda 0.1.0.1 and earlier. If anyone's actually using one of
-//these versions, I pity them.
-#define MS_LANGPACK_TRANSLATESTRING "LangPack/TranslateString"
+#define Translate(s) TranslateA_LP(s, hLangpack)
+#define TranslateW(s) TranslateW_LP(s, hLangpack)
+#define TranslateDialogDefault(h) TranslateDialog_LP(h,hLangpack)
+
+#ifdef _UNICODE
+ #define TranslateT(s) TranslateW_LP(_T(s),hLangpack)
+ #define TranslateTS(s) TranslateW_LP(s,hLangpack)
+ #define TranslateTH(l,s) TranslateW_LP(s,l)
+#else
+ #define TranslateT(s) TranslateA_LP(s,hLangpack)
+ #define TranslateTS(s) TranslateA_LP(s,hLangpack)
+ #define TranslateTH(l,s) TranslateA_LP(s,l)
+#endif
// If you're storing some string for calling later-on Translate or using it
// with an API call that does translation automatically marked with
// [TRANSLATED-BY-CORE] please wrap it with one of LPGEN macros in order to
// generate proper language pack.
+
#define LPGEN(s) s
#define LPGENW(s) L ## s
#ifdef _UNICODE
@@ -57,69 +77,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif
//Those macros do NOTHING. They are just markers for lpgen.pl.
-//translates a menu into the user's local language v0.1.1.0+
-//wParam = (WPARAM)(HMENU)hMenu
-//lParam = langpack handle (v.0.10.0+)
-//returns 0 on success, nonzero on failure
-#define MS_LANGPACK_TRANSLATEMENU "LangPack/TranslateMenu"
-
-//returns the codepage used in the language pack v0.4.3.0+
-//wParam = 0
-//lParam = 0
-//returns the codepage stated in the langpack, or CP_ACP if no langpack is present
-#define MS_LANGPACK_GETCODEPAGE "LangPack/GetCodePage"
-
-//returns the locale id associated with the language pack v0.4.3.0+
-//wParam = 0
-//lParam = 0
-//returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
-#define MS_LANGPACK_GETLOCALE "LangPack/GetLocale"
-
-//returns the strdup/wcsdup of lparam according to the langpack v0.4.3.0+
-//wParam = langpack handle (v.0.10.0+)
-//lParam = (LPARAM)(char*)source string
-//returns a string converted from char* to TCHAR* using the langpack codepage.
-//This string should be freed using mir_free() then
-#define MS_LANGPACK_PCHARTOTCHAR "LangPack/PcharToTchar"
-
-#if defined(MIRANDA_CUSTOM_LP)
-
-__forceinline INT_PTR Langpack_PCharToTChar(const char* str)
-{ return CallService(MS_LANGPACK_PCHARTOTCHAR, hLangpack, (LPARAM)str);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// translates a menu into the user's local language
+// returns 0 on success, nonzero on failure
-#else
+EXTERN_C MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int = hLangpack);
-__forceinline INT_PTR Langpack_PCharToTChar(const char* str)
-{ return CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)str);
-}
+#define TranslateMenu(h) TranslateMenu_LP(h,hLangpack)
-#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns the codepage used in the language pack
+// returns the codepage stated in the langpack, or CP_ACP if no langpack is present
-//initializes the plugin-specific translation context v0.10.0+
-//wParam = pointer to the langpack handle
-//lParam = PLUGININFOEX* of the caller plugin
-//always returns 0
-#define MS_LANGPACK_REGISTER "LangPack/Register"
+EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultCodePage(void);
-#if defined(MIRANDA_CUSTOM_LP)
-__forceinline void mir_getLP(const PLUGININFOEX* pInfo)
-{ CallService(MS_LANGPACK_REGISTER, (WPARAM)&hLangpack, (LPARAM)pInfo);
-}
-#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns the locale id associated with the language pack
+// returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
+
+EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns the strdup/wcsdup of lparam according to the langpack
+// returns a string converted from char* to TCHAR* using the langpack codepage.
+// This string should be freed using mir_free() then
+
+EXTERN_C MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// initializes the plugin-specific translation context v0.10.0+
+// always returns 0
+
+EXTERN_C MIR_CORE_DLL(void) mir_getLP(const PLUGININFOEX *pInfo, int *_hLang = &hLangpack);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// reloads langpack
+// wParam = 0 (ignored)
+// lParam = (LPARAM)(TCHAR*)langpack file name or NULL to reload the current one
+// always returns 0
-//reloads langpack
-//wParam = 0 (ignored)
-//lParam = (LPARAM)(TCHAR*)langpack file name or NULL to reload the current one
-//always returns 0
#define MS_LANGPACK_RELOAD "LangPack/Reload"
#define ME_LANGPACK_CHANGED "LangPack/Changed"
-//retrieves the hLangpack of a plugin by its HINSTANCE
-//wParam = 0 (ignored)
-//lParam = (LPARAM)(HINSTANCE)plugin's base address
-//returns hLangpack if found, or 0 if error occurred
-#define MS_LANGPACK_LOOKUPHANDLE "LangPack/LookupHandle"
-
#endif // M_LANGPACK_H__
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 2e7dcffe9c..a86a3542c1 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -696,7 +696,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara }
}
/* sort items (before moving to groups) */
- ListView_SortItems(hwndList, ListViewSortDesc, (LPARAM)CallService(MS_LANGPACK_GETLOCALE, 0, 0));
+ ListView_SortItems(hwndList, ListViewSortDesc, Langpack_GetDefaultLocale());
/* groups */
if(ListView_EnableGroupView(hwndList, TRUE) == 1) { /* returns 0 on pre WinXP or if commctls6 are disabled */
LVGROUP lvg;
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 8b3593e89d..11f10513fe 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -803,16 +803,6 @@ int JabberLinksUninit() // -----------------------------------------
-/*
-static HANDLE hServiceTest;
-static int TestingService(WPARAM wParam, LPARAM lParam)
-{
- UNREFERENCED_PARAMETER(wParam);
- MessageBoxEx(NULL, (TCHAR*)lParam, TranslateT("Testing Service"), MB_OK | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL, LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0)));
- return 0;
-}
-*/
-
void InitTest(void)
{
#ifdef AIM_SUPPORT_TEST
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 993f0bbaa9..0c76880e29 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -30,7 +30,7 @@ WCHAR* a2u(const char *pszAnsi,BOOL fMirCp) WCHAR *psz;
if(pszAnsi==NULL) return NULL;
- codepage=fMirCp?CallService(MS_LANGPACK_GETCODEPAGE,0,0):CP_ACP;
+ codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP;
cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,NULL,0);
if (!cch) return NULL;
@@ -50,7 +50,7 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp) DWORD flags;
if(pszUnicode==NULL) return NULL;
- codepage=fMirCp?CallService(MS_LANGPACK_GETCODEPAGE,0,0):CP_ACP;
+ codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP;
/* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */
cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,NULL,0,NULL,NULL);
if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL);
@@ -158,13 +158,15 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) return; /* success */
}
- mbp=(MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
- if(mbp==NULL) return;
- mbp->cbSize=sizeof(*mbp);
- mbp->lpszCaption=mir_strdup(pszTitle);
- mbp->lpszText=mir_strdup(szText);
- mbp->dwStyle=MB_OK|MB_SETFOREGROUND|MB_TASKMODAL;
- mbp->dwLanguageId=LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0));
+ mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
+ if(mbp == NULL)
+ return;
+
+ mbp->cbSize = sizeof(*mbp);
+ mbp->lpszCaption = mir_strdup(pszTitle);
+ mbp->lpszText = mir_strdup(szText);
+ mbp->dwStyle = MB_OK | MB_SETFOREGROUND | MB_TASKMODAL;
+ mbp->dwLanguageId = LANGIDFROMLCID(Langpack_GetDefaultLocale());
switch(flags&NIIF_ICON_MASK) {
case NIIF_INFO: mbp->dwStyle|=MB_ICONINFORMATION; break;
case NIIF_WARNING: mbp->dwStyle|=MB_ICONWARNING; break;
@@ -177,8 +179,8 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) char* GetWinErrorDescription(DWORD dwLastError)
{
char *buf=NULL;
- DWORD flags=FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM;
- if (!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0)),(char*)&buf,0,NULL))
+ DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
+ if (!FormatMessageA(flags,NULL,dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,NULL))
if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL);
return buf;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index bb221fbaa6..4b0ada0354 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -72,7 +72,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR LCID locale;
hwndSettingsDlg=hwndDlg;
TranslateDialogDefault(hwndDlg);
- locale=CallService(MS_LANGPACK_GETLOCALE,0,0);
+ locale = Langpack_GetDefaultLocale();
SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)IcoLib_GetIcon("AutoShutdown_Header"));
{
HFONT hBoldFont;
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 0eaed524a2..489605c69e 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -31,7 +31,7 @@ char* u2a(const WCHAR *pszUnicode) DWORD flags;
if (pszUnicode==NULL) return NULL;
- codepage=CallService(MS_LANGPACK_GETCODEPAGE,0,0);
+ codepage = Langpack_GetDefaultCodePage();
/* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */
cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,NULL,0,NULL,NULL);
if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL);
@@ -97,11 +97,11 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) mbp=(MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp));
if (mbp==NULL) return;
- mbp->cbSize=sizeof(*mbp);
- mbp->lpszCaption=mir_strdup(pszTitle);
- mbp->lpszText=mir_strdup(szText);
- mbp->dwStyle=MB_OK|MB_SETFOREGROUND|MB_TASKMODAL;
- mbp->dwLanguageId=LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0));
+ mbp->cbSize = sizeof(*mbp);
+ mbp->lpszCaption = mir_strdup(pszTitle);
+ mbp->lpszText = mir_strdup(szText);
+ mbp->dwStyle = MB_OK|MB_SETFOREGROUND|MB_TASKMODAL;
+ mbp->dwLanguageId = LANGIDFROMLCID(Langpack_GetDefaultLocale());
switch(flags&NIIF_ICON_MASK) {
case NIIF_INFO: mbp->dwStyle|=MB_ICONINFORMATION; break;
case NIIF_WARNING: mbp->dwStyle|=MB_ICONWARNING; break;
@@ -115,7 +115,7 @@ char* GetWinErrorDescription(DWORD dwLastError) {
char *buf=NULL;
DWORD flags=FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM;
- if (!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0)),(char*)&buf,0,NULL))
+ if (!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,NULL))
if (GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL);
return buf;
@@ -170,7 +170,7 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown) if (pfnGetDurationFormat != NULL) {
SYSTEMTIME st;
LCID locale;
- locale=(LCID)CallService(MS_LANGPACK_GETLOCALE,0,0);
+ locale=Langpack_GetDefaultLocale();
if (TimeStampToSystemTime(countdown,&st))
if (pfnGetDurationFormat(locale,0,&st,0,NULL,pszOut,nSize))
return TRUE;
@@ -185,7 +185,7 @@ BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDate {
SYSTEMTIME st,stNow;
LCID locale;
- locale=(LCID)CallService(MS_LANGPACK_GETLOCALE,0,0);
+ locale=Langpack_GetDefaultLocale();
GetLocalTime(&stNow);
TimeStampToSystemTime(timestamp,&st);
/* today: no need to show the date */
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 383500629d..8cd7237eb1 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -130,7 +130,7 @@ int CompareContacts2(const ClcContact *contact1, const ClcContact *contact2, int if (by == SORTBY_NAME_LOCALE) {
//name
static int LocaleId = -1;
- if (LocaleId == -1) LocaleId = CallService(MS_LANGPACK_GETLOCALE, 0, 0);
+ if (LocaleId == -1) LocaleId = Langpack_GetDefaultLocale();
return (CompareString(LocaleId, NORM_IGNORECASE, SAFETSTRING(namea), -1, SAFETSTRING(nameb), -1)) - 2;
}
if (by == SORTBY_LASTMSG) {
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index aedaa410f6..4545f578bb 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -170,7 +170,7 @@ extern "C" int __declspec(dllexport) CListInitialise() cfg::dat.bShowXStatusOnSbar = cfg::getByte("CLUI", "xstatus_sbar", 0);
cfg::dat.bLayeredHack = cfg::getByte("CLUI", "layeredhack", 1);
cfg::dat.bFirstRun = cfg::getByte("CLUI", "firstrun", 1);
- cfg::dat.langPackCP = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ cfg::dat.langPackCP = Langpack_GetDefaultCodePage();
cfg::dat.realTimeSaving = cfg::getByte("CLUI", "save_pos_always", 0);
DWORD sortOrder = cfg::getDword("CList", "SortOrder", SORTBY_NAME);
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index db90cd1db1..ee14dd7a17 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -61,7 +61,7 @@ CDb3Mmap::CDb3Mmap(const TCHAR *tszFileName, int iMode) : GetSystemInfo(&sinf);
m_ChunkSize = sinf.dwAllocationGranularity;
- m_codePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ m_codePage = Langpack_GetDefaultCodePage();
m_hModHeap = HeapCreate(0, 0, 0);
}
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 32c13cf652..79e8ca314f 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -940,7 +940,7 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) int OnModulesLoaded(WPARAM, LPARAM) { - g_LPCodePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); + g_LPCodePage = Langpack_GetDefaultCodePage(); //Hook necessary events HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); diff --git a/plugins/Folders/src/commonheaders.h b/plugins/Folders/src/commonheaders.h index c7117b2a97..ef29b5545c 100644 --- a/plugins/Folders/src/commonheaders.h +++ b/plugins/Folders/src/commonheaders.h @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_system_cpp.h>
#include <m_options.h>
#include <m_string.h>
+#include <m_langpack.h>
#include <m_variables.h>
#include <m_folders.h>
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 131d7b65b9..82ebf9e18a 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -87,6 +87,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" int __declspec(dllexport) Load()
{
+ mir_getLP(&pluginInfoEx);
+
SkinAddNewSoundEx("Gmail", LPGEN("Other"), LPGEN("Gmail: New thread(s)"));
HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser);
diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr index d9aa22378e..ca12e3596a 100644 --- a/plugins/HistoryPlusPlus/historypp.dpr +++ b/plugins/HistoryPlusPlus/historypp.dpr @@ -162,7 +162,7 @@ begin Langpack_Register();
// Getting langpack codepage for ansi translation
- hppCodepage := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ hppCodepage := Langpack_GetDefaultCodePage;
if hppCodepage = CP_ACP then
hppCodepage := GetACP();
// Checking the version of richedit is available, need 2.0+
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 39be7c8bd0..4587d81ff8 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -159,29 +159,6 @@ namespace mu }
/*
- * langpack
- */
-
- namespace langpack
- {
- const TCHAR* translateString(const TCHAR* szEnglish)
- {
- return reinterpret_cast<const TCHAR*>(CallService(MS_LANGPACK_TRANSLATESTRING, LANG_UNICODE, reinterpret_cast<LPARAM>(szEnglish)));
- }
-
- UINT getCodePage()
- {
- static UINT CodePage = -1;
-
- if (CodePage == -1) {
- CodePage = ServiceExists(MS_LANGPACK_GETCODEPAGE) ? CallService(MS_LANGPACK_GETCODEPAGE, 0, 0) : CP_ACP;
- }
-
- return CodePage;
- }
- }
-
- /*
* opt
*/
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 99ace4861e..87dc659185 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -119,15 +119,13 @@ void LoadSettings(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_RESETCONTENT, 0, 0);
for (i = 0; i < SIZEOF(time_stamp_strings); i++) {
- TCHAR* ptszTimeStr = (TCHAR*)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)time_stamp_strings[i]);
+ ptrT ptszTimeStr(Langpack_PcharToTchar(time_stamp_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
- mir_free(ptszTimeStr);
}
for (i = 0; i < SIZEOF(keep_strings); i++) {
- TCHAR* ptszTimeStr = (TCHAR*)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)keep_strings[i]);
+ ptrT ptszTimeStr(Langpack_PcharToTchar(keep_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
- mir_free(ptszTimeStr);
}
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
diff --git a/plugins/ImportTXT/importtxt.dpr b/plugins/ImportTXT/importtxt.dpr index 31b8af8238..869953b556 100644 --- a/plugins/ImportTXT/importtxt.dpr +++ b/plugins/ImportTXT/importtxt.dpr @@ -116,7 +116,7 @@ function Load(): int; cdecl; var
mi: TCListMenuItem;
begin
- cp := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ cp := Langpack_GetDefaultCodePage;
SrvITxt := CreateServiceFunction(IMPORT_TXT_SERVICE, @ContactMenuCommand);
SrvIWiz := CreateServiceFunction(IMPORT_WIZ_SERVICE, @MainMenuCommand);
FillChar(mi, sizeof(mi), 0);
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index a0d5f2af53..160d36df35 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -1008,7 +1008,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar ClientToScreen(hMapUser, &pt);
}
- CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hMenu, 0);
+ TranslateMenu(hMenu);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMainMenu);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 5b9500ced6..e3cfb87c52 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1031,10 +1031,9 @@ static BOOL DoContextMenu(HWND AhWnd,WPARAM wParam,LPARAM lParam) InsertMenu(hFg, i, MF_BYPOSITION|MF_OWNERDRAW, IDM_COLORPRESET_FG+i, TranslateTS(clrPresets[i].szName)); } - CallService(MS_LANGPACK_TRANSLATEMENU,(DWORD)FhMenu,0); + TranslateMenu(FhMenu); TrackPopupMenu(FhMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,LOWORD(lParam),HIWORD(lParam),0,AhWnd,0); DestroyMenu(hMenuLoad); - return TRUE; } @@ -1864,10 +1863,9 @@ static BOOL DoListContextMenu(HWND AhWnd,WPARAM wParam,LPARAM lParam,STICKYNOTE CheckMenuItem(FhMenu, IDM_TOGGLEONTOP, MF_CHECKED|MF_BYCOMMAND); } - CallService(MS_LANGPACK_TRANSLATEMENU,(DWORD)FhMenu,0); + TranslateMenu(FhMenu); TrackPopupMenu(FhMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,LOWORD(lParam),HIWORD(lParam),0,AhWnd,0); DestroyMenu(hMenuLoad); - return TRUE; } diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 28ca688fe7..be97aea7cb 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -2354,7 +2354,7 @@ static BOOL DoListContextMenu(HWND AhWnd,WPARAM wParam,LPARAM lParam,REMINDERDAT if (!pReminder)
EnableMenuItem(FhMenu, IDM_DELETEREMINDER, MF_GRAYED|MF_BYCOMMAND);
- CallService(MS_LANGPACK_TRANSLATEMENU,(DWORD)FhMenu,0);
+ TranslateMenu(FhMenu);
TrackPopupMenu(FhMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,LOWORD(lParam),HIWORD(lParam),0,AhWnd,0);
DestroyMenu(hMenuLoad);
return TRUE;
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 27ec537e27..9bbd4adc5c 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -792,7 +792,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) char buff1[128]; CallService(MS_SS_GETPROFILENAME, iStatus - 40083, (LPARAM)buff1); - MultiByteToWideChar(CallService(MS_LANGPACK_GETCODEPAGE, 0, 0), 0, buff1, -1, buff, 128); + MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, buff1, -1, buff, 128); mir_sntprintf(szTitle, TranslateT("%s message (%s)"), (TCHAR *)buff, szProtoName); } diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index f0e6b79e0d..4af2b720d4 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -236,10 +236,7 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE;
- unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
- if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP;
-
-
+ unsigned lpcp = Langpack_GetDefaultCodePage();
CMString nmd(A2W_SM(smre->dispname, lpcp));
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 67b39b5945..63b79d169b 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -977,9 +977,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) const CMString& defaultFile = GetSmileyCategory(tname)->GetFilename();
-
- unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
- if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP;
+ unsigned lpcp = Langpack_GetDefaultCodePage();
PROTOCOLDESCRIPTOR **proto;
int protoCount = 0;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index ea7cd59b22..d20513e72f 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -186,7 +186,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_bIdleDetect = M.GetBool("dimIconsForIdleContacts", true);
m_smcxicon = m_smcyicon = 16;
m_PasteAndSend = M.GetByte("pasteandsend", 1);
- m_LangPackCP = ServiceExists(MS_LANGPACK_GETCODEPAGE) ? CallService(MS_LANGPACK_GETCODEPAGE, 0, 0) : CP_ACP;
+ m_LangPackCP = Langpack_GetDefaultCodePage();
m_visualMessageSizeIndicator = M.GetByte("msgsizebar", 0);
m_autoSplit = M.GetByte("autosplit", 0);
m_FlashOnMTN = M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH);
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 4c832427aa..a8c6e68194 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -301,8 +301,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getCLI();
mir_getTMI(&tmi);
- if (ServiceExists(MS_LANGPACK_GETCODEPAGE))
- iCodePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ iCodePage = Langpack_GetDefaultCodePage();
InitTranslations();
InitMessagePump();
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index d93abb0494..d9b21dad72 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -564,7 +564,7 @@ int OnPluginLoad(WPARAM, LPARAM lParam) int OnPluginUnload(WPARAM, LPARAM lParam)
{
- int hLangpack = CallService(MS_LANGPACK_LOOKUPHANDLE, 0, lParam);
+ int hLangpack = GetPluginLangByInstance((HINSTANCE)lParam);
if (hLangpack) {
bool bNeedUpdate = false;
mir_cslock lck(csButtonsHook);
diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp index 3f76ed0d40..12cd47c49d 100644 --- a/plugins/UserInfoEx/src/svc_constants.cpp +++ b/plugins/UserInfoEx/src/svc_constants.cpp @@ -270,15 +270,13 @@ static int __cdecl ListSortProc(const LPIDSTRLIST p1, const LPIDSTRLIST p2) static void SvcConstantsTranslateList(LPIDSTRLIST pList, UINT nListCount/*, SortedList *pSorted*/)
{
- if (!pList[0].ptszTranslated)
- {
+ if (!pList[0].ptszTranslated) {
for (UINT i = 0; i < nListCount; i++)
- {
- pList[i].ptszTranslated = (LPTSTR)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)pList[i].pszText);
- }
+ pList[i].ptszTranslated = Langpack_PcharToTchar(pList[i].pszText);
+
// Ignore last item, if it is a "Other" item.
if (!mir_strcmp(pList[nListCount-1].pszText, LPGEN("Other"))) nListCount--;
-
+
// Sort list according translated text and ignore first item.
qsort(pList+1, nListCount-1, sizeof(pList[0]),
(int (*)(const void*, const void*))ListSortProc);
@@ -309,7 +307,7 @@ INT_PTR GetCountryList(LPUINT pnListSize, LPIDSTRLIST *pList) for (UINT i = 0; i < MyCountriesCount; i++) {
MyCountries[i].nID = country[i].id;
MyCountries[i].pszText = country[i].szName;
- MyCountries[i].ptszTranslated = (LPTSTR)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)country[i].szName);
+ MyCountries[i].ptszTranslated = Langpack_PcharToTchar(country[i].szName);
}
// Sort list according translated text and ignore first item.
qsort(MyCountries+1, MyCountriesCount-1, sizeof(MyCountries[0]),
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index a0b971e008..78c68501ee 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -124,7 +124,7 @@ begin AnsiToWide(GetContactID(hContact, Proto), Result);
if (Result = nil) or (Result^ = #0) then
- AnsiToWide(Translate(Proto), Result, CallService(MS_LANGPACK_GETCODEPAGE, 0, 0));
+ AnsiToWide(Translate(Proto), Result, Langpack_GetDefaultCodePage);
end;
end;
end;
@@ -155,7 +155,7 @@ begin DBVT_ASCIIZ: StrDup(Result, dbv.szVal.a);
DBVT_UTF8,
DBVT_WCHAR: begin
- cp := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ cp := Langpack_GetDefaultCodePage;
if dbv._type = DBVT_UTF8 then
UTF8ToAnsi(dbv.szVal.a, Result, cp)
else // dbv._type = DBVT_WCHAR then
@@ -174,7 +174,7 @@ begin if Proto = nil then
Proto := GetContactProto(hContact);
if Proto = nil then
- Result := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0)
+ Result := Langpack_GetDefaultCodePage
else
begin
Result := DBReadWord(hContact, Proto, 'AnsiCodePage', $FFFF);
@@ -622,7 +622,7 @@ begin DBVT_WORD : p:=IntToStr(buf1,ldbv.wVal);
DBVT_DWORD : p:=IntToStr(buf1,ldbv.dVal);
DBVT_UTF8 : UTF8ToWide(ldbv.szVal.A,p);
- DBVT_ASCIIZ : AnsiToWide(ldbv.szVal.A,p,CallService(MS_LANGPACK_GETCODEPAGE,0,0));
+ DBVT_ASCIIZ : AnsiToWide(ldbv.szVal.A,p,Langpack_GetDefaultCodePage);
DBVT_WCHAR : p:=ldbv.szVal.W;
DBVT_BLOB : p:='blob';
end;
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index ab7a275a48..16d92a3cec 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -132,7 +132,7 @@ const function MirandaCP:integer;
begin
if MirCP<0 then
- MirCP:=CallService(MS_LANGPACK_GETCODEPAGE,0,0);
+ MirCP:=Langpack_GetDefaultCodePage;
result:=MirCP;
end;
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 8513616923..590dc5a25b 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1134,7 +1134,7 @@ ULONGLONG MimeDateToFileTime(char *datein) void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateout) { - int localeID = CallService(MS_LANGPACK_GETLOCALE, 0, 0); + int localeID = Langpack_GetDefaultLocale(); //int localeID = MAKELCID(LANG_URDU, SORT_DEFAULT); if (localeID == CALLSERVICE_NOTFOUND) localeID = LOCALE_USER_DEFAULT; if (filetime > MAXFILETIME) filetime = MAXFILETIME; diff --git a/plugins/YahooGroups/src/YahooGroups.cpp b/plugins/YahooGroups/src/YahooGroups.cpp index f867404140..00177c628a 100644 --- a/plugins/YahooGroups/src/YahooGroups.cpp +++ b/plugins/YahooGroups/src/YahooGroups.cpp @@ -50,7 +50,7 @@ extern "C" int __declspec(dllexport) Load() mir_getLP(&pluginInfo);
LogInit();
- currentCodePage = (UINT) CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ currentCodePage = Langpack_GetDefaultCodePage();
InitServices();
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 5b3d7e560a..1325126aa3 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -2202,7 +2202,7 @@ void ICQ::addUrl(ICQUser *u, char *m, unsigned short theCmd, unsigned short theS CCSDATA ccs;
PROTORECVEVENT pre;
- messageLen = mir_tstrlen(m);
+ messageLen = (int)mir_tstrlen(m);
for (i=0; i<messageLen; i++) if (m[i] == (char)0xFE) m[i] = 0;
url = new char[messageLen + 1];
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
|