summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-11 21:32:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-11 21:33:11 +0300
commitf719c8b921c7a46b76453476204224d40c682914 (patch)
treec6d92dc450893e7f5abe60c2046ec9c2d1e3db36 /include
parent16ad355c8bdc438c3107ee3ba3ad0bf0b8c395fa (diff)
int hLangpack/m_hLang removed and replaced with HPLUGIN
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_api.pas1
-rw-r--r--include/delphi/m_core.inc12
-rw-r--r--include/delphi/m_fontservice.inc51
-rw-r--r--include/delphi/m_genmenu.inc2
-rw-r--r--include/delphi/m_helpers.inc76
-rw-r--r--include/delphi/m_hotkeys.inc2
-rw-r--r--include/delphi/m_icolib.inc2
-rw-r--r--include/delphi/m_options.inc9
-rw-r--r--include/m_chat.h2
-rw-r--r--include/m_chat_int.h2
-rw-r--r--include/m_cluiframes.h2
-rw-r--r--include/m_core.h23
-rw-r--r--include/m_crypto.h2
-rw-r--r--include/m_extraicons.h2
-rw-r--r--include/m_fontservice.h18
-rw-r--r--include/m_genmenu.h10
-rw-r--r--include/m_hotkeys.h4
-rw-r--r--include/m_icolib.h4
-rw-r--r--include/m_langpack.h24
-rw-r--r--include/m_message.h4
-rw-r--r--include/m_options.h11
-rw-r--r--include/m_skin.h2
-rw-r--r--include/m_srmm_int.h32
-rw-r--r--include/newpluginapi.h13
24 files changed, 112 insertions, 198 deletions
diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas
index 2b41c77520..dc8c8ecced 100644
--- a/include/delphi/m_api.pas
+++ b/include/delphi/m_api.pas
@@ -258,7 +258,6 @@ initialization
g_plugin.m_hInst := hInstance;
g_plugin.m_pInfo := @PluginInfo;
RegisterPlugin(g_plugin);
- hLangpack := g_plugin.m_hLang;
finalization
UnregisterPlugin(g_plugin);
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index 7e913e2d7a..28653f3bd1 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -198,10 +198,10 @@ type
tagIconItemW = tIconItemW;
procedure mir_Icon_Register(hInst:HINST; const szSection:PAnsiChar; pIcons:pIconItem;
- iCount:size_t; prefix:PAnsiChar; hLangpack:int=0); stdcall;
+ iCount:size_t; prefix:PAnsiChar; pPlugin:Pointer); stdcall;
external CoreDLL name 'Icon_Register';
procedure mir_Icon_RegisterW(hInst:HINST; const szSection:PWideChar; pIcons:pIconItemW;
- iCount:size_t; prefix:PAnsiChar; hLangpack:int=0); stdcall;
+ iCount:size_t; prefix:PAnsiChar; pPlugin:Pointer); stdcall;
external CoreDLL name 'Icon_RegisterT';
///////////////////////////////////////////////////////////////////////////////
@@ -226,13 +226,13 @@ function LoadLangPack(const szLangPack:PWideChar):int; stdcall;
procedure ReloadLangpack(pszStr:PWideChar); stdcall;
external CoreDLL name 'ReloadLangpack';
-function TranslateA_LP(const str:PAnsiChar; hLang:int):PAnsiChar; stdcall;
+function TranslateA_LP(const str:PAnsiChar; pPlugin:Pointer):PAnsiChar; stdcall;
external CoreDLL name 'TranslateA_LP';
-function TranslateW_LP(const str:PWideChar; hLang:int):PWideChar; stdcall;
+function TranslateW_LP(const str:PWideChar; pPlugin:Pointer):PWideChar; stdcall;
external CoreDLL name 'TranslateW_LP';
-procedure TranslateMenu_LP(hMenu:HMENU; hLang:int); stdcall;
+procedure TranslateMenu_LP(hMenu:HMENU; pPlugin:Pointer); stdcall;
external CoreDLL name 'TranslateMenu_LP';
-procedure TranslateDialog_LP(hDlg:HWND; hLang:int); stdcall;
+procedure TranslateDialog_LP(hDlg:HWND; pPlugin:Pointer); stdcall;
external CoreDLL name 'TranslateDialog_LP';
function mir_hash(const key:pointer; len:uint):uint; stdcall;
diff --git a/include/delphi/m_fontservice.inc b/include/delphi/m_fontservice.inc
index c6dacc42e1..4c6f5c09f4 100644
--- a/include/delphi/m_fontservice.inc
+++ b/include/delphi/m_fontservice.inc
@@ -115,7 +115,7 @@ const
{ fired when a user modifies font settings, so reget your fonts }
ME_FONT_RELOAD:PAnsiChar = 'Font/Reload';
-function Font_Register(pFont:pFontID; hLang:int) : int; stdcall; external AppDll;
+function Font_Register(pFont:pFontID; pPlugin:Pointer) : int; stdcall; external AppDll;
function Font_Get(pGroup,pName:pAnsiChar; pFont:pLogFontA) : longint; stdcall; external AppDll;
type
@@ -151,54 +151,7 @@ const
{ fired when a user modifies font settings, so reget your fonts and colours }
ME_COLOUR_RELOAD:PAnsiChar = 'Colour/Reload';
-function Colour_Register(pColour:pColourID; hLang:int) : int; stdcall; external AppDll;
+function Colour_Register(pColour:pColourID; pPlugin:Pointer) : int; stdcall; external AppDll;
function Colour_Get(pGroup,pName:pAnsiChar) : longint; stdcall; external AppDll;
-//////////////////////////////////////////////////////////////////////////
-//
-// EFFECTS
-//
-type
- FONTEFFECT_tag = record
- effectIndex :byte;
- baseColour :dword; // ARGB
- secondaryColour:dword; // ARGB
- end;
- TFONTEFFECT = FONTEFFECT_tag;
-
-type
- EffectID_tag = record
- cbSize :int;
- group :array [0..63] of AnsiChar;
- name :array [0..63] of AnsiChar;
- dbSettingsGroup:array [0..31] of AnsiChar;
- setting :array [0..31] of AnsiChar;
- flags :dword;
- defeffect :TFONTEFFECT;
- order :int;
- value :TFONTEFFECT;
- end;
- PEffectID = ^TEffectID;
- TEffectID = EffectID_tag;
-
-type
- EffectIDW_tag = record
- cbSize :int;
- group :array [0..63] of WideChar;
- name :array [0..63] of WideChar;
- dbSettingsGroup:array [0..31] of AnsiChar;
- setting :array [0..31] of AnsiChar;
- flags :dword;
- defeffect :TFONTEFFECT;
- order :int;
- value :TFONTEFFECT;
- end;
- PEffectIDW = ^TEffectIDW;
- TEffectIDW = EffectIDW_tag;
-
-const
-// fired when a user modifies font settings, so reget your fonts and colours
-// wparam = lparam = 0
- ME_EFFECT_RELOAD:PAnsiChar = 'Effect/Reload';
-
{$ENDIF}
diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc
index 15ee72abeb..5374a42731 100644
--- a/include/delphi/m_genmenu.inc
+++ b/include/delphi/m_genmenu.inc
@@ -156,7 +156,7 @@ type
szName :TCHAR;
flags :integer;
hIcon :HICON; // or hIcolibItem:THANDLE;
- hLangpack :int;
+ pPlugin :Pointer;
uid :MUUID;
end;
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index bea8231de3..cedf8998d5 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -29,7 +29,7 @@ function TranslateWideString(const sz:WideString):WideString;
function TranslateUnicodeString(sz: UnicodeString): UnicodeString;
procedure TranslateDialogDefault(hwndDlg: THANDLE);
procedure TranslateMenu(hMenu: HMENU);
-function Langpack_Register:int_ptr;
+function Langpack_Register:Pointer;
function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr;
@@ -61,16 +61,9 @@ function Options_Open(group,page,tab:PWideChar):int_ptr;
procedure MIcoTab_AddItem (hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
procedure MIcoTab_AddItemW(hwnd:HWND; lptzName:PWideChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
-function Crypto_RegisterEngine(pProvider:PCRYPTO_PROVIDER):THANDLE;
-procedure Crypto_EnumProviders(var numProvs:int; var pResult:array of PCRYPTO_PROVIDER);
-function Crypto_GetProvider(pszName:PAnsiChar):PCRYPTO_PROVIDER;
-
{$ELSE}
-var
- hLangpack:int = 0;
-
-function _Srmm_AddButton(bbdi:pBBButton;_hLang:int) : integer; stdcall;
+function _Srmm_AddButton(bbdi:pBBButton; pPlugin:Pointer) : integer; stdcall;
external AppDll name 'Srmm_AddButton';
function _AddMainMenuItem(mi:PMO_MenuItem) : HGENMENU; stdcall;
@@ -219,43 +212,43 @@ end;
function TranslateW(sz: PWideChar): PWideChar;
begin
- result:=TranslateW_LP(sz, hLangpack);
+ result:=TranslateW_LP(sz, @g_plugin);
end;
function Translate(sz: PAnsiChar): PAnsiChar;
begin
- result:=TranslateA_LP(sz, hLangpack);
+ result:=TranslateA_LP(sz, @g_plugin);
end;
function TranslateString(const sz:AnsiString):AnsiString;
begin
- Result:=AnsiString(TranslateA_LP(PAnsiChar(sz),hLangpack));
+ Result:=AnsiString(TranslateA_LP(PAnsiChar(sz),@g_plugin));
end;
function TranslateWideString(const sz:WideString):WideString;
begin
- Result:=WideString(TranslateW_LP(PWideChar(sz),hLangpack));
+ Result:=WideString(TranslateW_LP(PWideChar(sz),@g_plugin));
end;
function TranslateUnicodeString(sz: UnicodeString): UnicodeString;
begin
- Result:=UnicodeString(TranslateW_LP(PWideChar(sz),hLangpack));
+ Result:=UnicodeString(TranslateW_LP(PWideChar(sz),@g_plugin));
end;
procedure TranslateDialogDefault(hwndDlg: THANDLE);
begin
- TranslateDialog_LP(hwndDlg,hLangpack);
+ TranslateDialog_LP(hwndDlg,@g_plugin);
end;
procedure TranslateMenu(hMenu: HMENU);
begin
- TranslateMenu_LP(hMenu,hLangpack);
+ TranslateMenu_LP(hMenu,@g_plugin);
end;
-function Langpack_Register:int_ptr;
+function Langpack_Register:Pointer;
begin
cli := Clist_GetInterface();
- result := hLangpack;
+ result := @g_plugin;
end;
@@ -276,83 +269,83 @@ end;
function Menu_AddContextFrameMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=CallService(MS_CLIST_ADDCONTEXTFRAMEMENUITEM, 0,LPARAM(mi));
end;
function Menu_AddMainMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=_AddMainMenuItem(mi);
end;
function Menu_AddContactMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=_AddContactMenuItem(mi, nil);
end;
function Menu_AddStatusMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=_AddStatusMenuItem(mi, nil);
end;
function Menu_AddProtoMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=_AddProtoMenuItem(mi, nil);
end;
function Menu_AddTrayMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
- mi^.hLangpack:=hLangpack;
+ mi^.pPlugin:=@g_plugin;
result:=_AddTrayMenuItem(mi);
end;
function Hotkey_Register(hk:PHOTKEYDESC):int_ptr;
begin
- result:=_Hotkey_Register(hk, hLangpack);
+ result:=_Hotkey_Register(hk, @g_plugin);
end;
function Skin_AddIcon(si:PSKINICONDESC):THANDLE;
begin
- result:=IcoLib_AddIcon(si, hLangpack);
+ result:=IcoLib_AddIcon(si, @g_plugin);
end;
procedure Icon_Register(hInst:HINST; const szSection:PAnsiChar; pIcons:pIconItem; iCount:size_t; prefix:PAnsiChar);
begin
- mir_Icon_Register(hInst, szSection, pIcons, iCount, prefix, hLangpack);
+ mir_Icon_Register(hInst, szSection, pIcons, iCount, prefix, @g_plugin);
end;
procedure Icon_RegisterW(hInst:HINST; const szSection:PWideChar; pIcons:pIconItemW; iCount:size_t; prefix:PAnsiChar);
begin
- mir_Icon_RegisterW(hInst, szSection, pIcons, iCount, prefix, hLangpack);
+ mir_Icon_RegisterW(hInst, szSection, pIcons, iCount, prefix, @g_plugin);
end;
procedure FontRegister(pFontID:pFontID);
begin
- Font_Register(pFontID, hLangpack);
+ Font_Register(pFontID, @g_plugin);
end;
procedure ColourRegister(pColorID:pColourID);
begin
- Colour_Register(pColorID, hLangpack);
+ Colour_Register(pColorID, @g_plugin);
end;
function TopToolbar_AddButton(pButton:PTTBButton):THANDLE;
begin
- result:=CallService(MS_TTB_ADDBUTTON, WPARAM(pButton), hLangpack);
+ result:=CallService(MS_TTB_ADDBUTTON, WPARAM(pButton), LPARAM(@g_plugin));
end;
function Options_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr;
begin
- result:=_Options_AddPage(wParam, odp, hLangpack);
+ result:=_Options_AddPage(wParam, odp, @g_plugin);
end;
function Options_Open(group,page,tab:PWideChar):int_ptr;
begin
- result:=_Options_Open(group,page,tab,hLangpack);
+ result:=_Options_Open(group,page,tab,@g_plugin);
end;
procedure MIcoTab_AddItem(hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
@@ -385,22 +378,7 @@ end;
procedure Srmm_AddButton(bbdi:pBBButton);
begin
- _Srmm_AddButton(bbdi,hLangpack);
-end;
-
-function Crypto_RegisterEngine(pProvider:PCRYPTO_PROVIDER):THANDLE;
-begin
- result:=THANDLE(CallService(MS_CRYPTO_REGISTER_ENGINE, hLangpack, LPARAM(pProvider)));
-end;
-
-procedure Crypto_EnumProviders(var numProvs:int; var pResult:array of PCRYPTO_PROVIDER);
-begin
- CallService(MS_CRYPTO_ENUM_PROVIDERS, WPARAM(numProvs), LPARAM(@pResult));
-end;
-
-function Crypto_GetProvider(pszName:PAnsiChar):PCRYPTO_PROVIDER;
-begin
- result:=PCRYPTO_PROVIDER(CallService(MS_CRYPTO_GET_PROVIDER, 0, LPARAM(pszName)));
+ _Srmm_AddButton(bbdi,@g_plugin);
end;
function UuidFromStringA(StringUuid:PAnsiChar; var Uuid:TGUID) : integer; stdcall; external 'Rpcrt4.dll';
diff --git a/include/delphi/m_hotkeys.inc b/include/delphi/m_hotkeys.inc
index ba3450f33c..4fb0cfc659 100644
--- a/include/delphi/m_hotkeys.inc
+++ b/include/delphi/m_hotkeys.inc
@@ -40,7 +40,7 @@ type
end;
-function _Hotkey_Register(hk:PHOTKEYDESC; _hLang:int): int; stdcall; external AppDll name 'Hotkey_Register';
+function _Hotkey_Register(hk:PHOTKEYDESC; pPlugin:Pointer): int; stdcall; external AppDll name 'Hotkey_Register';
function Hotkey_Unregister(hk:PAnsiChar): int; stdcall; external AppDll;
{
diff --git a/include/delphi/m_icolib.inc b/include/delphi/m_icolib.inc
index 89b1701b21..57e68e57ef 100644
--- a/include/delphi/m_icolib.inc
+++ b/include/delphi/m_icolib.inc
@@ -33,7 +33,7 @@ const
returns a handle to the newly added item
}
-function IcoLib_AddIcon(pIcon:PSKINICONDESC; iLang:int):THANDLE; stdcall;
+function IcoLib_AddIcon(pIcon:PSKINICONDESC; pPlugin:Pointer):THANDLE; stdcall;
external AppDLL name 'IcoLib_AddIcon';
{
diff --git a/include/delphi/m_options.inc b/include/delphi/m_options.inc
index 55d2411654..e3663cd8e9 100644
--- a/include/delphi/m_options.inc
+++ b/include/delphi/m_options.inc
@@ -58,8 +58,7 @@ type
szTab :TChar; // [TRANSLATED-BY-CORE]
pfnDlgProc :pointer;
pszTemplate :PAnsiChar;
- hInstance :THANDLE;
- hLangpack :int;
+ pPlugin :Pointer;
flags :dword; //
dwInitParam :LPARAM; // a value to pass to lParam of WM_INITDIALOG message
end;
@@ -73,9 +72,9 @@ const
const
PSM_GETBOLDFONT = WM_USER+102; //returns HFONT used for group box titles
-function _Options_AddPage(param:WPARAM; opts:POPTIONSDIALOGPAGE; lang:int) : int; stdcall; external AppDll name 'Options_AddPage';
+function _Options_AddPage(param:WPARAM; opts:POPTIONSDIALOGPAGE; lang:Pointer) : int; stdcall; external AppDll name 'Options_AddPage';
-function _Options_Open(group,page,tab:PWideChar; lang:int):int_ptr; stdcall; external AppDll name 'Options_Open';
-function _Options_OpenPage(group,page,tab:PWideChar; lang:int):HWND; stdcall; external AppDll name 'Options_OpenPage';
+function _Options_Open(group,page,tab:PWideChar; lang:Pointer):int_ptr; stdcall; external AppDll name 'Options_Open';
+function _Options_OpenPage(group,page,tab:PWideChar; lang:Pointer):HWND; stdcall; external AppDll name 'Options_OpenPage';
{$ENDIF}
diff --git a/include/m_chat.h b/include/m_chat.h
index 906b7c616a..978e1e1860 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -534,7 +534,7 @@ typedef struct {
#define ME_GC_BUILDMENU "GChat/BuildMenu"
-EXTERN_C MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, int langId);
+EXTERN_C MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, HPLUGIN pPlugin);
//////////////////////////////////////////////////////////////////////////
// Get Chat ToolTip Text for buddy
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 033d5d36da..4e69c9f4e4 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -247,7 +247,7 @@ struct CHAT_MANAGER_INITDATA
int cbModuleInfo, cbSession;
wchar_t *szFontGroup;
int iFontMode;
- int iLangId;
+ HPLUGIN pPlugin;
};
typedef BOOL (*pfnDoTrayIcon)(SESSION_INFO *si, GCEVENT *gce);
diff --git a/include/m_cluiframes.h b/include/m_cluiframes.h
index cc200c4791..e1e5a3640c 100644
--- a/include/m_cluiframes.h
+++ b/include/m_cluiframes.h
@@ -100,7 +100,7 @@ struct CLISTFrame
//////////////////////////////////////////////////////////////////////////
// adds a frame window
// wParam=(CLISTFrame*)
-// lParam=0
+// lParam=(HPLUGIN)&g_plugin
// returns an integer, the frame id.
#define MS_CLIST_FRAMES_ADDFRAME "CListFrames/AddFrame"
diff --git a/include/m_core.h b/include/m_core.h
index ffd97951df..ab7b00e0a4 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -55,6 +55,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct TMO_IntMenuItem* HGENMENU;
+class CMPluginBase;
+typedef const CMPluginBase* HPLUGIN;
+
#define MIR_APP_DLL(T) MIR_APP_EXPORT T __stdcall
#pragma warning(disable:4201 4127 4312 4706)
@@ -155,33 +158,31 @@ MIR_CORE_DLL(char*) mir_urlEncode(const char *szUrl);
///////////////////////////////////////////////////////////////////////////////
// icons support
-typedef struct tagIconItem
+struct IconItem
{
char *szDescr, *szName;
int defIconID, size;
HANDLE hIcolib;
-}
- IconItem;
+};
-typedef struct tagIconItemT
+struct IconItemT
{
wchar_t *tszDescr;
char *szName;
int defIconID, size;
HANDLE hIcolib;
-}
- IconItemT;
+};
-MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, const char *prefix, int langId);
-MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t* szSection, IconItemT* pIcons, size_t iCount, const char *prefix, int langId);
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconItem *pIcons, size_t iCount, const char *prefix, HPLUGIN pPlugin);
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t *szSection, IconItemT *pIcons, size_t iCount, const char *prefix, HPLUGIN pPlugin);
///////////////////////////////////////////////////////////////////////////////
// language packs support
-MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len);
+MIR_CORE_DLL(unsigned int) mir_hash(const void *key, unsigned int len);
#pragma optimize("gt", on)
-__forceinline unsigned int mir_hashstr(const char * key)
+__forceinline unsigned int mir_hashstr(const char *key)
{
if (key == nullptr) return 0;
else {
@@ -189,7 +190,7 @@ __forceinline unsigned int mir_hashstr(const char * key)
return mir_hash(key, len);
} }
-__forceinline unsigned int mir_hashstrW(const wchar_t * key)
+__forceinline unsigned int mir_hashstrW(const wchar_t *key)
{
if (key == nullptr) return 0;
else {
diff --git a/include/m_crypto.h b/include/m_crypto.h
index 31007715a4..7a6a105e79 100644
--- a/include/m_crypto.h
+++ b/include/m_crypto.h
@@ -69,7 +69,7 @@ struct CRYPTO_PROVIDER
{
DWORD dwSize;
DWORD dwFlags; // one of CPF_* constants
- int iLangId;
+ HPLUGIN pPlugin;
char *pszName; // unique id
MAllStrings szDescr; // description
diff --git a/include/m_extraicons.h b/include/m_extraicons.h
index 3bb9da0000..172358404a 100644
--- a/include/m_extraicons.h
+++ b/include/m_extraicons.h
@@ -101,7 +101,7 @@ struct EXTRAICON_INFO
LPARAM onClickParam;
};
-EXTERN_C MIR_APP_DLL(void) KillModuleExtraIcons(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin);
#pragma warning(disable:4505)
diff --git a/include/m_fontservice.h b/include/m_fontservice.h
index 7910be2ba7..ffb8cbfea2 100644
--- a/include/m_fontservice.h
+++ b/include/m_fontservice.h
@@ -97,8 +97,8 @@ struct FontIDW
};
// register a font
-EXTERN_C MIR_APP_DLL(int) Font_Register(FontID *pFont, int langId);
-EXTERN_C MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, int langId);
+EXTERN_C MIR_APP_DLL(int) Font_Register(FontID *pFont, HPLUGIN);
+EXTERN_C MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, HPLUGIN);
// get a font
// will fill the logfont structure passed in with the user's choices, or the default if it was set and the user has not chosen a font yet,
@@ -161,8 +161,8 @@ struct ColourIDW
// [note - a colour with name 'Background' [translated!] has special meaning and will be used as the background colour of
// the font list box in the options, for the given group]
-EXTERN_C MIR_APP_DLL(int) Colour_Register(ColourID *pFont, int langId);
-EXTERN_C MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, int langId);
+EXTERN_C MIR_APP_DLL(int) Colour_Register(ColourID *pFont, HPLUGIN);
+EXTERN_C MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, HPLUGIN);
// get a colour
EXTERN_C MIR_APP_DLL(COLORREF) Colour_Get(const char *szGroup, const char *szName);
@@ -221,8 +221,8 @@ struct EffectIDW
// wparam = (EffectID *)&effect_id
// lparam = 0
-EXTERN_C MIR_APP_DLL(int) Effect_Register(EffectID *pEffect, int langId);
-EXTERN_C MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pEffect, int langId);
+EXTERN_C MIR_APP_DLL(int) Effect_Register(EffectID *pEffect, HPLUGIN);
+EXTERN_C MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pEffect, HPLUGIN);
// get a effect
// wparam = (EffectID *)&effect_id (only name and group matter)
@@ -236,8 +236,8 @@ EXTERN_C MIR_APP_DLL(int) Effect_GetW(const wchar_t *wszGroup, const wchar_t *sz
// wparam = lparam = 0
#define ME_EFFECT_RELOAD "Effect/Reload"
-EXTERN_C MIR_APP_DLL(void) KillModuleFonts(int langId);
-EXTERN_C MIR_APP_DLL(void) KillModuleColours(int langId);
-EXTERN_C MIR_APP_DLL(void) KillModuleEffects(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleFonts(HPLUGIN);
+EXTERN_C MIR_APP_DLL(void) KillModuleColours(HPLUGIN);
+EXTERN_C MIR_APP_DLL(void) KillModuleEffects(HPLUGIN);
#endif // _FONT_SERVICE_API_INC
diff --git a/include/m_genmenu.h b/include/m_genmenu.h
index 64c599121b..db2c362e2d 100644
--- a/include/m_genmenu.h
+++ b/include/m_genmenu.h
@@ -40,7 +40,7 @@ struct TMO_MenuItem
HICON hIcon;
HANDLE hIcolibItem;
};
- int langId;
+ const CMPluginBase *pPlugin;
MUUID uid;
};
@@ -50,10 +50,10 @@ struct TMO_MenuItem
#ifdef __cplusplus
struct CMenuItem : public TMO_MenuItem
{
- CMenuItem(const CMPluginBase &pPlugin)
+ CMenuItem(HPLUGIN _p)
{
memset(this, 0, sizeof(CMenuItem));
- this->langId = pPlugin.m_hLang;
+ this->pPlugin = _p;
}
};
#endif
@@ -107,7 +107,7 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pItem
// Adds new submenu
// Returns HGENMENU on success, or NULL on failure
-EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib, int langId);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib, HPLUGIN pPlugin);
/////////////////////////////////////////////////////////////////////////////////////////
// process a WM_DRAWITEM message for user context menus v0.1.1.0+
@@ -254,7 +254,7 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis);
/////////////////////////////////////////////////////////////////////////////////////////
// kills all menu items & submenus that belong to the language id given
-EXTERN_C MIR_APP_DLL(void) KillModuleMenus(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleMenus(HPLUGIN pPlugin);
#endif // M_GENMENU_H__
diff --git a/include/m_hotkeys.h b/include/m_hotkeys.h
index 3964415921..72e8d6b359 100644
--- a/include/m_hotkeys.h
+++ b/include/m_hotkeys.h
@@ -53,7 +53,7 @@ struct HOTKEYDESC
// Registers new hotkey
// Returns 0 on failure or hotkey atom id on success
-EXTERN_C MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *hk, int langId);
+EXTERN_C MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *hk, HPLUGIN pPlugin);
/////////////////////////////////////////////////////////////////////////////////////////
// Unregister existing hotkey
@@ -88,6 +88,6 @@ EXTERN_C MIR_APP_DLL(void) Hotkey_Unsubclass(HWND hwndEdit);
/////////////////////////////////////////////////////////////////////////////////////////
-EXTERN_C MIR_APP_DLL(void) KillModuleHotkeys(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleHotkeys(HPLUGIN pPlugin);
#endif // M_HOTKEYS_H__
diff --git a/include/m_icolib.h b/include/m_icolib.h
index 465ccf36b2..c229069cb8 100644
--- a/include/m_icolib.h
+++ b/include/m_icolib.h
@@ -60,7 +60,7 @@ extern "C"
// Adds an icon into the icon library
// returns a handle to the newly added item
-MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, int langId);
+MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, HPLUGIN pPlugin);
///////////////////////////////////////////////////////////////////////////////
// Removes an icon from icon library by icon's name or handle
@@ -117,7 +117,7 @@ MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
///////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) KillModuleIcons(int langId);
+MIR_APP_DLL(void) KillModuleIcons(HPLUGIN pPlugin);
#if defined(__cplusplus)
}
diff --git a/include/m_langpack.h b/include/m_langpack.h
index b097053515..2f4dbfa404 100644
--- a/include/m_langpack.h
+++ b/include/m_langpack.h
@@ -45,14 +45,14 @@ EXTERN_C MIR_CORE_DLL(int) LoadLangPackModule(void);
EXTERN_C MIR_CORE_DLL(int) LoadLangPack(const wchar_t *szLangPack);
EXTERN_C MIR_CORE_DLL(void) ReloadLangpack(wchar_t *pszStr);
-EXTERN_C MIR_CORE_DLL(char*) TranslateA_LP(const char *str, int hLang = 0);
-EXTERN_C MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t *str, int hLang = 0);
-EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang = 0);
+EXTERN_C MIR_CORE_DLL(char*) TranslateA_LP(const char *str, HPLUGIN = nullptr);
+EXTERN_C MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t *str, HPLUGIN = nullptr);
+EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, HPLUGIN = nullptr);
-#define Translate(s) TranslateA_LP(s, g_plugin.m_hLang)
-#define TranslateW(s) TranslateW_LP(s, g_plugin.m_hLang)
-#define TranslateT(s) TranslateW_LP(_A2W(s), g_plugin.m_hLang)
-#define TranslateDialogDefault(h) TranslateDialog_LP(h, g_plugin.m_hLang)
+#define Translate(s) TranslateA_LP(s, &g_plugin)
+#define TranslateW(s) TranslateW_LP(s, &g_plugin)
+#define TranslateT(s) TranslateW_LP(_A2W(s), &g_plugin)
+#define TranslateDialogDefault(h) TranslateDialog_LP(h, &g_plugin)
// If you're storing some string for calling later-on Translate or using it
// with an API call that does translation automatically marked with
@@ -68,9 +68,9 @@ EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang = 0);
// translates a menu into the user's local language
// returns 0 on success, nonzero on failure
-EXTERN_C MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int langId);
+EXTERN_C MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, HPLUGIN = nullptr);
-#define TranslateMenu(h) TranslateMenu_LP(h, g_plugin.m_hLang)
+#define TranslateMenu(h) TranslateMenu_LP(h, &g_plugin)
/////////////////////////////////////////////////////////////////////////////////////////
// returns the codepage used in the language pack
@@ -92,12 +92,6 @@ EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
EXTERN_C MIR_CORE_DLL(wchar_t*) Langpack_PcharToTchar(const char *pszStr);
/////////////////////////////////////////////////////////////////////////////////////////
-// retrieves the language id of a plugin by its HINSTANCE
-// returns id if found, or 0 if error occurred
-
-EXTERN_C MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE);
-
-/////////////////////////////////////////////////////////////////////////////////////////
// reloads langpack
// wParam = 0 (ignored)
// lParam = (LPARAM)(wchar_t*)langpack file name or NULL to reload the current one
diff --git a/include/m_message.h b/include/m_message.h
index 2af205867b..36cab96453 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -163,7 +163,7 @@ struct StatusIconData
#define MBCF_RIGHTBUTTON 0x01 // if this flag is specified, the click was a right button - otherwize it was a left click
// adds an icon
-EXTERN_C MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int langId);
+EXTERN_C MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, HPLUGIN pPlugin);
// removes an icon
EXTERN_C MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId);
@@ -244,7 +244,7 @@ struct BBButton
// adds a new toolbar button
// returns button's handle on success or NULL otherwise
-EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, int langId);
+EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN);
// modifies the existing toolbar button
// returns 0 on success and nonzero value otherwise
diff --git a/include/m_options.h b/include/m_options.h
index b8e0404425..dcf038a64c 100644
--- a/include/m_options.h
+++ b/include/m_options.h
@@ -65,8 +65,7 @@ struct OPTIONSDIALOGPAGE
MAllStrings szTitle, szGroup, szTab; // [TRANSLATED-BY-CORE]
DLGPROC pfnDlgProc;
char *pszTemplate;
- HINSTANCE hInstance;
- int langId;
+ HPLUGIN pPlugin;
DWORD flags;
union {
@@ -82,9 +81,9 @@ struct OPTIONSDIALOGPAGE
#define PSM_GETBOLDFONT (WM_USER+102) //returns HFONT used for group box titles
-EXTERN_C MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int langId);
+EXTERN_C MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, HPLUGIN);
-EXTERN_C MIR_APP_DLL(void) KillModuleOptions(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleOptions(HPLUGIN);
// The behaviour if the options dialog is already open is that it will just be
// activated, the page won't be changed. This may change in the future.
@@ -95,9 +94,9 @@ EXTERN_C MIR_APP_DLL(void) KillModuleOptions(int langId);
// Opens the options dialog, optionally at the specified page
// Returns 0 on success, nonzero on failure
-EXTERN_C MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int langId);
+EXTERN_C MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, HPLUGIN);
// Opens the options dialog, with only specified page
-EXTERN_C MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int langId);
+EXTERN_C MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, HPLUGIN);
#endif //M_OPTIONS_H__
diff --git a/include/m_skin.h b/include/m_skin.h
index 8a62a295e6..36bf3eafe5 100644
--- a/include/m_skin.h
+++ b/include/m_skin.h
@@ -134,7 +134,7 @@ EXTERN_C MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName);
/////////////////////////////////////////////////////////////////////////////////////////
-EXTERN_C MIR_APP_DLL(void) KillModuleSounds(int langId);
+EXTERN_C MIR_APP_DLL(void) KillModuleSounds(HPLUGIN);
/////////////////////////////////////////////////////////////////////////////////////////
// sent when the icons DLL has been changed in the options dialog, and everyone
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index 7681480c1b..78361891a7 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -44,27 +44,27 @@ struct CustomButtonData : public MZeroedObject
~CustomButtonData()
{}
- int m_dwPosition; // default order pos of button, counted from window edge (left or right)
+ int m_dwPosition; // default order pos of button, counted from window edge (left or right)
- int m_dwButtonID; // id of button used while button creation and to store button info in DB
- ptrA m_pszModuleName; // module name without spaces and underline symbols (e.g. "tabsrmm")
+ int m_dwButtonID; // id of button used while button creation and to store button info in DB
+ ptrA m_pszModuleName; // module name without spaces and underline symbols (e.g. "tabsrmm")
- int m_dwButtonCID; // button's control id
- int m_dwArrowCID; // only use with BBBF_ISARROWBUTTON flag
+ int m_dwButtonCID; // button's control id
+ int m_dwArrowCID; // only use with BBBF_ISARROWBUTTON flag
- ptrW m_pwszText; // button's text
- ptrW m_pwszTooltip; // button's tooltip
+ ptrW m_pwszText; // button's text
+ ptrW m_pwszTooltip; // button's tooltip
- int m_iButtonWidth; // must be 22 for regular button and 33 for button with arrow
- HANDLE m_hIcon; // Handle to icolib registred icon
+ int m_iButtonWidth; // must be 22 for regular button and 33 for button with arrow
+ HANDLE m_hIcon; // Handle to icolib registred icon
- bool m_bIMButton, m_bChatButton;
- bool m_bCanBeHidden, m_bCantBeHidden, m_bHidden, m_bAutoHidden, m_bSeparator, m_bDisabled, m_bPushButton;
- bool m_bRSided;
- BYTE m_opFlags;
- int m_iLangId;
- DWORD m_dwOrigPosition;
- struct THotkeyItem *m_hotkey;
+ bool m_bIMButton, m_bChatButton;
+ bool m_bCanBeHidden, m_bCantBeHidden, m_bHidden, m_bAutoHidden, m_bSeparator, m_bDisabled, m_bPushButton;
+ bool m_bRSided;
+ BYTE m_opFlags;
+ HPLUGIN m_pPlugin;
+ DWORD m_dwOrigPosition;
+ struct THotkeyItem *m_hotkey;
struct {
bool bit1 : 1, bit2 : 1, bit3 : 1, bit4 : 1;
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index 4837b5f28e..d1209ca99b 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -139,12 +139,6 @@ struct PLUGININFOEX
#define ME_SYSTEM_MODULEUNLOAD "Miranda/System/UnloadModule"
/////////////////////////////////////////////////////////////////////////////////////////
-// 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);
-
-/////////////////////////////////////////////////////////////////////////////////////////
// plugin's class
// initializes an empty account
@@ -174,8 +168,6 @@ protected:
void SetUniqueId(const char *pszUniqueId);
public:
- int m_hLang;
-
void debugLogA(LPCSTR szFormat, ...);
void debugLogW(LPCWSTR wszFormat, ...);
@@ -194,13 +186,13 @@ public:
template <size_t _Size>
__forceinline void registerIcon(const char *szSection, IconItem(&pIcons)[_Size], const char *prefix = nullptr)
{
- Icon_Register(m_hInst, szSection, pIcons, _Size, prefix, m_hLang);
+ Icon_Register(m_hInst, szSection, pIcons, _Size, prefix, this);
}
template <size_t _Size>
__forceinline void registerIconW(const wchar_t *szSection, IconItemT(&pIcons)[_Size], const char *prefix = nullptr)
{
- Icon_RegisterT(m_hInst, szSection, pIcons, _Size, prefix, m_hLang);
+ Icon_RegisterT(m_hInst, szSection, pIcons, _Size, prefix, this);
}
int addOptions(WPARAM wParam, struct OPTIONSDIALOGPAGE *odp);
@@ -477,7 +469,6 @@ OBJLIST<P> ACCPROTOPLUGIN<P>::g_arInstances(1, PtrKeySortT);
#endif
EXTERN_C MIR_APP_DLL(HINSTANCE) GetInstByAddress(void* codePtr);
-EXTERN_C MIR_APP_DLL(CMPluginBase*) GetPluginByLangId(int langId);
EXTERN_C MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst);
#endif // M_NEWPLUGINAPI_H__