summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/delphi/m_helpers.inc3
-rw-r--r--include/delphi/m_langpack.inc88
-rw-r--r--include/m_core.h37
-rw-r--r--include/m_langpack.h134
4 files changed, 74 insertions, 188 deletions
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__