From 6fad3235de6bec045fec19a7265e19e880ac84e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Jul 2017 17:30:39 +0300 Subject: Hotkeys: code cleaning --- include/delphi/m_helpers.inc | 2 +- include/delphi/m_hotkeys.inc | 57 ++------- include/m_hotkeys.h | 107 +++++++--------- libs/win32/mir_app.lib | Bin 118018 -> 119122 bytes libs/win64/mir_app.lib | Bin 113476 -> 114482 bytes plugins/Actman/ua/i_uaplaces.inc | 3 +- plugins/AddContactPlus/src/main.cpp | 6 +- plugins/AutoShutdown/src/utils.cpp | 8 +- plugins/BasicHistory/src/HistoryWindow.cpp | 2 +- plugins/BasicHistory/src/Options.cpp | 9 +- plugins/BossKeyPlus/src/BossKey.cpp | 5 +- plugins/CSList/src/cslist.cpp | 6 +- plugins/Clist_modern/src/modern_keyboard.cpp | 15 ++- plugins/Console/src/Console.cpp | 7 +- plugins/CrashDumper/src/crshdmp.cpp | 9 +- plugins/DbEditorPP/src/main.cpp | 6 +- plugins/FTPFileYM/src/ftpfile.cpp | 7 +- plugins/FavContacts/src/services.cpp | 6 +- plugins/FloatingContacts/src/main.cpp | 8 +- plugins/ListeningTo/src/listeningto.cpp | 143 +++++++++++----------- plugins/MirLua/src/m_hotkeys.cpp | 10 +- plugins/NewsAggregator/Src/NewsAggregator.cpp | 6 +- plugins/NotesAndReminders/src/hotkeys.cpp | 11 +- plugins/OpenFolder/src/openFolder.cpp | 7 +- plugins/PackUpdater/Src/Events.cpp | 9 +- plugins/PluginUpdater/src/PluginUpdater.cpp | 6 +- plugins/Popup/src/main.cpp | 8 +- plugins/QuickContacts/src/quickcontacts.cpp | 21 ++-- plugins/QuickSearch/sr_global.pas | 3 +- plugins/RecentContacts/src/RecentContacts.cpp | 6 +- plugins/Scriver/src/input.cpp | 38 +++--- plugins/SendScreenshotPlus/src/Main.cpp | 8 +- plugins/Sessions/Src/Main.cpp | 12 +- plugins/SimpleStatusMsg/src/main.cpp | 8 +- plugins/SmileyAdd/src/main.cpp | 6 +- plugins/SpellChecker/src/spellchecker.cpp | 6 +- plugins/SpellChecker/src/utils.cpp | 9 +- plugins/TabSRMM/src/chat_window.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 58 +++++---- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 7 +- plugins/TranslitSwitcher/src/TranslitSwitcher.cpp | 16 +-- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 7 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 7 +- plugins/UserInfoEx/src/svc_reminder.cpp | 7 +- plugins/Watrack/popup/popups.pas | 3 +- plugins/Watrack/status/status.pas | 3 +- plugins/Watrack/templates/i_expkey.inc | 4 +- plugins/WhenWasIt/src/WhenWasIt.cpp | 8 +- plugins/YAMN/src/main.cpp | 7 +- plugins/mRadio/i_hotkey.inc | 9 +- protocols/FacebookRM/src/proto.cpp | 10 +- protocols/JabberG/src/jabber_menu.cpp | 14 +-- protocols/Twitter/src/proto.cpp | 6 +- src/mir_app/src/hotkey_opts.cpp | 6 +- src/mir_app/src/hotkeys.cpp | 71 ++++------- src/mir_app/src/keyboard.cpp | 22 ++-- src/mir_app/src/menu_clist.cpp | 6 +- src/mir_app/src/mir_app.def | 5 + src/mir_app/src/mir_app64.def | 5 + src/mir_app/src/skin.h | 3 - 62 files changed, 374 insertions(+), 496 deletions(-) diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index dd81e8e534..d5160da04c 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -333,7 +333,7 @@ end; function Hotkey_Register(hk:PHOTKEYDESC):int_ptr; begin - result:=CallService(MS_HOTKEY_REGISTER, hLangpack, LPARAM(hk)); + result:=_Hotkey_Register(hk, hLangpack); end; function Skin_AddIcon(si:PSKINICONDESC):THANDLE; diff --git a/include/delphi/m_hotkeys.inc b/include/delphi/m_hotkeys.inc index c1042bfabd..ba3450f33c 100644 --- a/include/delphi/m_hotkeys.inc +++ b/include/delphi/m_hotkeys.inc @@ -25,10 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. const HKD_UNICODE = $0001; + HKF_MIRANDA_LOCAL = $8000; + type PHOTKEYDESC = ^THOTKEYDESC; THOTKEYDESC = record - cbSize :int; pszName :PAnsiChar; // name to refer to hotkey when playing and in db pszDescription:TChar; // description for options dialog pszSection :TChar; // section name used to group sounds (NULL is acceptable) @@ -38,60 +39,16 @@ type dwFlags :dword; // Miranda ver >=9.0 end; -const - HKF_MIRANDA_LOCAL = $8000; -{ use this macro to defile hotkey codes like this: - hkd.DefHotkey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'A'); -} -// HOTKEYCODE(mod,vk) (MAKEWORD((vk),(mod))) - -{ CoreHotkeys/Register service -Registers new hotkey - wParam=(WPARAM)0 - lParam=(LPARAM)(HOTKEYDESC *)hotkey -Returns 0 on failure or hotkey atom id on success -} - MS_HOTKEY_REGISTER:PAnsiChar = 'CoreHotkeys/Register'; - -{ CoreHotkeys/Unregister service -Unregister existing hotkey - wParam=(WPARAM)0 - lParam=(LPARAM)(AnsiChar *)pszName -Returns 0 on success or nonzero otherwise -} - MS_HOTKEY_UNREGISTER:PAnsiChar = 'CoreHotkeys/Unregister'; - -{ CoreHotkeys/Check service -Checks if "manual" hotkey was activated and returns its id. - wParam=(WPARAM)(MSG *)message - lParam=(LPARAM)(AnsiChar *)pszSection -Returns lParam associated with activated hotkey -} - MS_HOTKEY_CHECK:PAnsiChar = 'CoreHotkeys/Check'; - -{ Subclass/unsubclass edit box to act as hotkey control - wParam=(WPARAM)(HWND)hwndEdit - lParam=(LPARAM)0 -Returns zero on success - -You will get notification with LOWORD(wParam) == 0 when users sets hotkey. - -Subclassed control processes HKM_SETHOTKEY and HKM_GETHOTKEY similarly to -windows' hotkey, in all other it acts just like normal editbox (beware of -standart notifications that occur on text updates!) - -Subclass procedure uses GWL_USERDATA to store internal information. Do not -use it for own purposes. -} - MS_HOTKEY_SUBCLASS :PAnsiChar = 'CoreHotkeys/Subclass'; - MS_HOTKEY_UNSUBCLASS:PAnsiChar = 'CoreHotkeys/Unsubclass'; +function _Hotkey_Register(hk:PHOTKEYDESC; _hLang:int): int; stdcall; external AppDll name 'Hotkey_Register'; +function Hotkey_Unregister(hk:PAnsiChar): int; stdcall; external AppDll; { - This event is fired when hotkeys were changed (Mirver 9.0+ ?) - wParam = lParam = 0 + This event is fired when hotkeys were changed (Mirver 9.0+ ?) + wParam = lParam = 0 } +const ME_HOTKEYS_CHANGED:PAnsiChar = 'CoreHotkeys/Changed'; {$ENDIF} diff --git a/include/m_hotkeys.h b/include/m_hotkeys.h index ce237cd877..6dabe8dfac 100644 --- a/include/m_hotkeys.h +++ b/include/m_hotkeys.h @@ -27,86 +27,67 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#define HKD_UNICODE 0x0001 +#define HKD_UNICODE 0x0001 +#define HKF_MIRANDA_LOCAL 0x8000 -typedef struct +struct HOTKEYDESC { - int cbSize; - const char *pszName; /* name to refer to hotkey when playing and in db */ - union { - const char *pszDescription; /* description for options dialog */ - const wchar_t *pwszDescription; - }; - union { - const char *pszSection; /* section name used to group sounds (NULL is acceptable) */ - const wchar_t *pwszSection; - }; - const char *pszService; /* Service to call when HotKey Pressed */ - WORD DefHotKey; /* default hot key for action */ - LPARAM lParam; /* lParam to pass to service */ + const char *pszName; // name to refer to hotkey when playing and in db + MAllStrings szDescription; // description for options dialog + MAllStrings szSection; // section name used to group sounds (NULL is acceptable) + const char *pszService; // Service to call when HotKey Pressed + WORD DefHotKey; // default hot key for action + LPARAM lParam; // lParam to pass to service DWORD dwFlags; -} HOTKEYDESC; - -#define HKF_MIRANDA_LOCAL 0x8000 +}; extern int hLangpack; -/* use this macro to defile hotkey codes like this: - hkd.DefHotkey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'A'); -*/ -#define HOTKEYCODE(mod, vk) (MAKEWORD((vk), (mod))) +///////////////////////////////////////////////////////////////////////////////////////// +// use this macro to defile hotkey codes like this: +// hkd.DefHotkey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'A'); -/* CoreHotkeys/Register service -Registers new hotkey - wParam = 0 - lParam = (LPARAM)(HOTKEYDESC *)hotkey -Returns 0 on failure or hotkey atom id on success -*/ +#define HOTKEYCODE(mod, vk) (MAKEWORD((vk), (mod))) -__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk) -{ - return CallService("CoreHotkeys/Register", (WPARAM)hLangpack, (LPARAM)hk); -} - -/* CoreHotkeys/Unregister service -Unregister existing hotkey - wParam = 0 - lParam = (LPARAM)(char *)pszName -Returns 0 on success or nonzero otherwise -*/ -#define MS_HOTKEY_UNREGISTER "CoreHotkeys/Unregister" +///////////////////////////////////////////////////////////////////////////////////////// +// Registers new hotkey +// Returns 0 on failure or hotkey atom id on success -/* CoreHotkeys/Check service -Checks if "manual" hotkey was activated and returns its id. - wParam = (WPARAM)(MSG *)message - lParam = (LPARAM)(char *)pszSection -Returns lParam associated with activated hotkey -*/ -#define MS_HOTKEY_CHECK "CoreHotkeys/Check" +EXTERN_C MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *hk, int = hLangpack); -/* Subclass/unsubclass edit box to act as hotkey control - wParam = (WPARAM)(HWND)hwndEdit - lParam = 0 -Returns zero on success +///////////////////////////////////////////////////////////////////////////////////////// +// Unregister existing hotkey -You will get notification with LOWORD(wParam) == 0 when users sets hotkey. +EXTERN_C MIR_APP_DLL(int) Hotkey_Unregister(const char *pszName); -Subclassed control processes HKM_SETHOTKEY and HKM_GETHOTKEY similarly to -windows' hotkey, in all other it acts just like normal editbox (beware of -standart notifications that occur on text updates!) +///////////////////////////////////////////////////////////////////////////////////////// +// Checks if "manual" hotkey was activated and returns its id. +// Returns lParam associated with activated hotkey -Subclass procedure uses GWLP_USERDATA to store internal information. Do not -use it for own purposes. -*/ -#define MS_HOTKEY_SUBCLASS "CoreHotkeys/Subclass" -#define MS_HOTKEY_UNSUBCLASS "CoreHotkeys/Unsubclass" +EXTERN_C MIR_APP_DLL(int) Hotkey_Check(MSG *pEvent, const char *pszSection); -/* This event is fired when hotkeys were changed - wParam = lParam = 0 -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Subclasss/unsubclass edit box to act as hotkey control +// You will get notification with LOWORD(wParam) == 0 when users sets hotkey. +// +// Subclassed control processes HKM_SETHOTKEY and HKM_GETHOTKEY similarly to +// windows' hotkey, in all other it acts just like normal editbox (beware of +// standart notifications that occur on text updates!) +// +// Subclass procedure uses GWLP_USERDATA to store internal information. Do not +// use it for own purposes. + +EXTERN_C MIR_APP_DLL(void) Hotkey_Subclass(HWND hwndEdit); +EXTERN_C MIR_APP_DLL(void) Hotkey_Unsubclass(HWND hwndEdit); + +///////////////////////////////////////////////////////////////////////////////////////// +// This event is fired when hotkeys were changed +// wParam = lParam = 0 #define ME_HOTKEYS_CHANGED "CoreHotkeys/Changed" +///////////////////////////////////////////////////////////////////////////////////////// + EXTERN_C MIR_APP_DLL(void) KillModuleHotkeys(int hLangpack); #endif // M_HOTKEYS_H__ diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 620cbdc1a1..f35f73fe35 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 35f4a93ea1..19fd4a95e6 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Actman/ua/i_uaplaces.inc b/plugins/Actman/ua/i_uaplaces.inc index 974fef9ea5..e885088f8d 100644 --- a/plugins/Actman/ua/i_uaplaces.inc +++ b/plugins/Actman/ua/i_uaplaces.inc @@ -213,7 +213,6 @@ begin if (ActionItem.flags and UAF_HKREGGED)=0 then begin FillChar(hkd,SizeOf(hkd),0); - hkd.cbSize := SizeOf(hkd); // HOTKEYDESC_SIZE_V1 for pre-0.9 hkd.dwFlags := HKD_UNICODE; // since 0.9 only hkd.pszName := ActionItem.szNameID; hkd.pszDescription.w:= ActionItem.szActDescr; @@ -232,7 +231,7 @@ procedure DeleteCoreHotkey(var ActionItem:tMyActionItem); begin if ((ActionItem.flags and UAF_HKREGGED)<>0) then begin - CallService(MS_HOTKEY_UNREGISTER,0,LParam(ActionItem.szNameID)); + Hotkey_Unregister(ActionItem.szNameID); ActionItem.flags:=ActionItem.flags and not UAF_HKREGGED; end; end; diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 937be49216..1326ab1206 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -126,11 +126,11 @@ static int CreateButton(WPARAM, LPARAM) static int OnModulesLoaded(WPARAM, LPARAM) { - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "AddContactPlus_OpenDialog"; - hkd.pwszDescription = LPGENW("Open add contact dialog"); - hkd.pwszSection = LPGENW("Main"); + hkd.szDescription.w = LPGENW("Open add contact dialog"); + hkd.szSection.w = LPGENW("Main"); hkd.pszService = MS_ADDCONTACTPLUS_SHOW; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index c854534161..32272d33fe 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -199,14 +199,12 @@ BOOL GetFormatedDateTime(wchar_t *pszOut, int nSize, time_t timestamp, BOOL fSho void AddHotkey() { - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "AutoShutdown_Toggle"; - hkd.pwszDescription = LPGENW("Toggle automatic shutdown"); - hkd.pwszSection = LPGENW("Main"); + hkd.szDescription.w = LPGENW("Toggle automatic shutdown"); + hkd.szSection.w = LPGENW("Main"); hkd.pszService = "AutoShutdown/MenuCommand"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T') | HKF_MIRANDA_LOCAL; - hkd.lParam = FALSE; Hotkey_Register(&hkd); } diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 14de1f2307..b12eafe799 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1529,7 +1529,7 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window) message.message = msg; message.lParam = lParam; message.wParam = wParam; - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)("History")); + LRESULT mim_hotkey_check = Hotkey_Check(&message, "History"); switch (mim_hotkey_check) { case HISTORY_HK_FIND: SetFocus(findWindow); diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 6b33158851..a5817a06dc 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -178,8 +178,8 @@ struct ColorOptionsList struct HotkeyOptionsList { const char *pszName; - const wchar_t *pwszDescription; - const wchar_t *pwszSection; + wchar_t *pwszDescription; + wchar_t *pwszSection; const char *pszService; WORD DefHotKey; LPARAM lParam; @@ -240,7 +240,6 @@ void Options::Load(void) HOTKEYDESC hid = { 0 }; fid.cbSize = sizeof(FontIDW); cid.cbSize = sizeof(ColourIDW); - hid.cbSize = sizeof(HOTKEYDESC); strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); wcsncpy_s(fid.backgroundGroup, L"History", _TRUNCATE); wcsncpy_s(fid.group, LPGENW("History"), _TRUNCATE); @@ -271,8 +270,8 @@ void Options::Load(void) hid.dwFlags = HKD_UNICODE; for (int i = 0; i < g_hotkeysSize; ++i) { hid.pszName = g_HotkeyOptionsList[i].pszName; - hid.pwszDescription = g_HotkeyOptionsList[i].pwszDescription; - hid.pwszSection = g_HotkeyOptionsList[i].pwszSection; + hid.szDescription.w = g_HotkeyOptionsList[i].pwszDescription; + hid.szSection.w = g_HotkeyOptionsList[i].pwszSection; hid.pszService = g_HotkeyOptionsList[i].pszService; hid.DefHotKey = g_HotkeyOptionsList[i].DefHotKey; hid.lParam = g_HotkeyOptionsList[i].lParam; diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 0c2766fa25..f9e01c480e 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -551,10 +551,9 @@ void BossKeyMenuItemUnInit(void) // Remove menu item void RegisterCoreHotKeys(void) { HOTKEYDESC hotkey = { 0 }; - hotkey.cbSize = sizeof(HOTKEYDESC); hotkey.pszName = "Hide/Show Miranda"; - hotkey.pszDescription = LPGEN("Hide/Show Miranda"); - hotkey.pszSection = "BossKey"; + hotkey.szDescription.a = LPGEN("Hide/Show Miranda"); + hotkey.szSection.a = "BossKey"; hotkey.pszService = MS_BOSSKEY_HIDE; hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F12); diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 7fc7af2ca4..24621383e2 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -163,11 +163,11 @@ extern "C" __declspec(dllexport) int Unload() void RegisterHotkeys(char buf[200], wchar_t* accName, int Number) { - HOTKEYDESC hotkey = { sizeof(hotkey) }; + HOTKEYDESC hotkey = {}; hotkey.dwFlags = HKD_UNICODE; hotkey.pszName = buf; - hotkey.pwszDescription = accName; - hotkey.pwszSection = LPGENW("Custom Status List"); + hotkey.szDescription.w = accName; + hotkey.szSection.w = LPGENW("Custom Status List"); hotkey.pszService = buf; hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0' + Number); Hotkey_Register(&hotkey); diff --git a/plugins/Clist_modern/src/modern_keyboard.cpp b/plugins/Clist_modern/src/modern_keyboard.cpp index 76d5451df9..b1a05f50df 100644 --- a/plugins/Clist_modern/src/modern_keyboard.cpp +++ b/plugins/Clist_modern/src/modern_keyboard.cpp @@ -45,25 +45,24 @@ int InitSkinHotKeys(void) CreateServiceFunction("CLIST/HK/CloseMiranda", hkCloseMiranda); CreateServiceFunction("CLIST/HK/RestoreStatus", hkRestoreStatus); - HOTKEYDESC shk = { 0 }; - shk.cbSize = sizeof(shk); + HOTKEYDESC shk = {}; shk.dwFlags = HKD_UNICODE; - shk.pwszDescription = LPGENW("Close Miranda"); + shk.szSection.w = LPGENW("Main"); + shk.szDescription.w = LPGENW("Close Miranda"); shk.pszName = "CloseMiranda"; - shk.pwszSection = LPGENW("Main"); shk.pszService = "CLIST/HK/CloseMiranda"; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Restore last status"); + shk.szSection.w = LPGENW("Status"); + shk.szDescription.w = LPGENW("Restore last status"); shk.pszName = "RestoreLastStatus"; - shk.pwszSection = LPGENW("Status"); shk.pszService = "CLIST/HK/RestoreStatus"; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Show/Hide offline users"); + shk.szSection.w = LPGENW("Main"); + shk.szDescription.w = LPGENW("Show/Hide offline users"); shk.pszName = "ShowHideOfflineUsers"; - shk.pwszSection = LPGENW("Main"); shk.pszService = MS_CLIST_TOGGLEHIDEOFFLINE; Hotkey_Register(&shk); return 0; diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index b9925b4166..2a330aa36e 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -1132,11 +1132,10 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) HookEvent(ME_COLOUR_RELOAD, OnColourChange); - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.pszName = "Console_Show_Hide"; - hkd.pszDescription = LPGEN("Show/Hide Console"); - hkd.pszSection = "Main"; + hkd.szSection.a = "Main"; + hkd.szDescription.a = LPGEN("Show/Hide Console"); hkd.pszService = MS_CONSOLE_SHOW_HIDE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); Hotkey_Register(&hkd); diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index eebd830f2b..68fb2a48e1 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -317,16 +317,15 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.pszService = MS_CRASHDUMPER_URL; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(hk); - hk.pszSection = PluginName; + HOTKEYDESC hk = {}; + hk.szSection.a = PluginName; - hk.pszDescription = LPGEN("Copy Version Info to clipboard"); + hk.szDescription.a = LPGEN("Copy Version Info to clipboard"); hk.pszName = "CopyVerInfo"; hk.pszService = MS_CRASHDUMPER_STORETOCLIP; Hotkey_Register(&hk); - hk.pszDescription = LPGEN("Show Version Info"); + hk.szDescription.a = LPGEN("Show Version Info"); hk.pszName = "ShowVerInfo"; hk.pszService = MS_CRASHDUMPER_VIEWINFO; Hotkey_Register(&hk); diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 045834f1ab..0ec3a08be8 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -131,12 +131,12 @@ int ModulesLoaded(WPARAM, LPARAM) // Register hotkeys _A2T text(modFullname); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; - hkd.pwszDescription = LPGENW("Open Database Editor"); - hkd.pwszSection = text; + hkd.szDescription.w = LPGENW("Open Database Editor"); + hkd.szSection.w = text; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 90dc4e12eb..91de6e0066 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -170,11 +170,10 @@ void InitMenuItems() void InitHotkeys() { - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(hk); - hk.pszDescription = LPGEN("Show FTPFile manager"); + HOTKEYDESC hk = {}; + hk.szSection.a = MODULE; + hk.szDescription.a = LPGEN("Show FTPFile manager"); hk.pszName = "FTP_ShowManager"; - hk.pszSection = MODULE; hk.pszService = MS_FTPFILE_SHOWMANAGER; Hotkey_Register(&hk); } diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index e61459db72..d562f5e187 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -218,10 +218,10 @@ int ProcessModulesLoaded(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////// - HOTKEYDESC hotkey = { sizeof(hotkey) }; + HOTKEYDESC hotkey = {}; hotkey.pszName = "FavContacts/ShowMenu"; - hotkey.pszDescription = LPGEN("Show favorite contacts"); - hotkey.pszSection = "Contacts"; + hotkey.szDescription.a = LPGEN("Show favorite contacts"); + hotkey.szSection.a = "Contacts"; hotkey.pszService = MS_FAVCONTACTS_SHOWMENU_CENTERED; hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT); Hotkey_Register(&hotkey); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 50d66b6e0f..9ac311a663 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -739,17 +739,17 @@ static void LoadMenus() hMainMenuItemHideAll = Menu_AddMainMenuItem(&mi); // Register hotkeys - HOTKEYDESC hkd = { sizeof(hkd) }; - hkd.pszSection = "Floating Contacts"; + HOTKEYDESC hkd = {}; + hkd.szSection.a = "Floating Contacts"; hkd.pszName = MODULE "/MainHideAllThumbs"; - hkd.pszDescription = LPGEN("Show/Hide all thumbs"); + hkd.szDescription.a = LPGEN("Show/Hide all thumbs"); hkd.pszService = MODULE "/MainHideAllThumbs"; Hotkey_Register(&hkd); CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow); hkd.pszName = MODULE "/HideWhenCListShow"; - hkd.pszDescription = LPGEN("Hide when contact list is shown"); + hkd.szDescription.a = LPGEN("Hide when contact list is shown"); hkd.pszService = MODULE "/HideWhenCListShow"; Hotkey_Register(&hkd); } diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index ebda2b1ef2..b8daa9b2f1 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -293,23 +293,22 @@ int ModulesLoaded(WPARAM, LPARAM) } // Hotkeys support - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); - hkd.pszSection = LPGEN("Listening to"); + HOTKEYDESC hkd = {}; + hkd.szSection.a = LPGEN("Listening to"); hkd.pszService = MS_LISTENINGTO_HOTKEYS_ENABLE; hkd.pszName = "ListeningTo/EnableAll"; - hkd.pszDescription = LPGEN("Send to all protocols"); + hkd.szDescription.a = LPGEN("Send to all protocols"); Hotkey_Register(&hkd); hkd.pszService = MS_LISTENINGTO_HOTKEYS_DISABLE; hkd.pszName = "ListeningTo/DisableAll"; - hkd.pszDescription = LPGEN("Don't send to any protocols"); + hkd.szDescription.a = LPGEN("Don't send to any protocols"); Hotkey_Register(&hkd); hkd.pszService = MS_LISTENINGTO_HOTKEYS_TOGGLE; hkd.pszName = "ListeningTo/ToggleAll"; - hkd.pszDescription = LPGEN("Toggle send to all protocols"); + hkd.szDescription.a = LPGEN("Toggle send to all protocols"); Hotkey_Register(&hkd); // @@ -412,72 +411,72 @@ ProtocolInfo* GetProtoInfo(char *proto) return NULL; } -static void ReplaceVars(Buffer *buffer, MCONTACT hContact, wchar_t **variables, int numVariables) -{ - if (buffer->len < 3) - return; - - if (numVariables < 0) - return; - - for (size_t i = buffer->len - 1; i > 0; i--) { - if (buffer->str[i] == '%') { - // Find previous - size_t j; - for (j = i - 1; j > 0 && ((buffer->str[j] >= 'a' && buffer->str[j] <= 'z') - || (buffer->str[j] >= 'A' && buffer->str[j] <= 'Z') - || buffer->str[j] == '-' - || buffer->str[j] == '_'); j--); - - if (buffer->str[j] == '%') { - size_t foundLen = i - j + 1; - if (foundLen == 9 && wcsncmp(&buffer->str[j], L"%contact%", 9) == 0) { - buffer->replace(j, i + 1, pcli->pfnGetContactDisplayName(hContact, 0)); - } - else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) { - wchar_t tmp[128]; - TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp)); - buffer->replace(j, i + 1, tmp); - } - else { - for (int k = 0; k < numVariables; k += 2) { - size_t len = mir_wstrlen(variables[k]); - if (foundLen == len + 2 && wcsncmp(&buffer->str[j] + 1, variables[k], len) == 0) { - buffer->replace(j, i + 1, variables[k + 1]); - break; - } - } - } - } - - i = j; - if (i == 0) - break; - } - else if (buffer->str[i] == '\\' && i + 1 <= buffer->len - 1 && buffer->str[i + 1] == 'n') { - buffer->str[i] = '\r'; - buffer->str[i + 1] = '\n'; - } - } -} - -void ReplaceTemplate(Buffer *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars) -{ - - if (ServiceExists(MS_VARS_FORMATSTRING)) { - wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars); - if (tmp != NULL) { - out->append(tmp); - mir_free(tmp); - out->pack(); - return; - } - } - - out->append(templ); - ReplaceVars(out, hContact, vars, numVars); - out->pack(); -} +static void ReplaceVars(Buffer *buffer, MCONTACT hContact, wchar_t **variables, int numVariables) +{ + if (buffer->len < 3) + return; + + if (numVariables < 0) + return; + + for (size_t i = buffer->len - 1; i > 0; i--) { + if (buffer->str[i] == '%') { + // Find previous + size_t j; + for (j = i - 1; j > 0 && ((buffer->str[j] >= 'a' && buffer->str[j] <= 'z') + || (buffer->str[j] >= 'A' && buffer->str[j] <= 'Z') + || buffer->str[j] == '-' + || buffer->str[j] == '_'); j--); + + if (buffer->str[j] == '%') { + size_t foundLen = i - j + 1; + if (foundLen == 9 && wcsncmp(&buffer->str[j], L"%contact%", 9) == 0) { + buffer->replace(j, i + 1, pcli->pfnGetContactDisplayName(hContact, 0)); + } + else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) { + wchar_t tmp[128]; + TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp)); + buffer->replace(j, i + 1, tmp); + } + else { + for (int k = 0; k < numVariables; k += 2) { + size_t len = mir_wstrlen(variables[k]); + if (foundLen == len + 2 && wcsncmp(&buffer->str[j] + 1, variables[k], len) == 0) { + buffer->replace(j, i + 1, variables[k + 1]); + break; + } + } + } + } + + i = j; + if (i == 0) + break; + } + else if (buffer->str[i] == '\\' && i + 1 <= buffer->len - 1 && buffer->str[i + 1] == 'n') { + buffer->str[i] = '\r'; + buffer->str[i + 1] = '\n'; + } + } +} + +void ReplaceTemplate(Buffer *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars) +{ + + if (ServiceExists(MS_VARS_FORMATSTRING)) { + wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars); + if (tmp != NULL) { + out->append(tmp); + mir_free(tmp); + out->pack(); + return; + } + } + + out->append(templ); + ReplaceVars(out, hContact, vars, numVars); + out->pack(); +} void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) { diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index e3c71cf38c..63358fd31c 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -2,8 +2,6 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) { - hk.cbSize = sizeof(HOTKEYDESC); - lua_getfield(L, -1, "Flags"); hk.dwFlags = lua_tointeger(L, -1); lua_pop(L, 1); @@ -16,11 +14,11 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) lua_pop(L, 1); lua_getfield(L, -1, "Description"); - hk.pwszDescription = mir_utf8decodeW(lua_tostring(L, -1)); + hk.szDescription.w = mir_utf8decodeW(lua_tostring(L, -1)); lua_pop(L, 1); lua_getfield(L, -1, "Section"); - hk.pwszSection = mir_utf8decodeW(luaL_optstring(L, -1, MODULE)); + hk.szSection.w = mir_utf8decodeW(luaL_optstring(L, -1, MODULE)); lua_pop(L, 1); lua_getfield(L, -1, "Hotkey"); @@ -58,9 +56,7 @@ static int hotkeys_Register(lua_State *L) static int hotkeys_Unregister(lua_State *L) { const char *name = luaL_checkstring(L, 1); - - CallService(MS_HOTKEY_UNREGISTER, 0, (LPARAM)name); - + Hotkey_Unregister(name); return 0; } diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 329b921a95..44c9e4d035 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -89,11 +89,11 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_NEWSAGGREGATOR_CHANGEFEED, ChangeFeed); CreateServiceFunction(MS_NEWSAGGREGATOR_ENABLED, EnableDisable); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "NewsAggregator/CheckAllFeeds"; - hkd.pwszDescription = LPGENW("Check All Feeds"); - hkd.pwszSection = LPGENW("News Aggregator"); + hkd.szDescription.w = LPGENW("Check All Feeds"); + hkd.szSection.w = LPGENW("News Aggregator"); hkd.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'O') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); diff --git a/plugins/NotesAndReminders/src/hotkeys.cpp b/plugins/NotesAndReminders/src/hotkeys.cpp index 566129094d..89e5133846 100644 --- a/plugins/NotesAndReminders/src/hotkeys.cpp +++ b/plugins/NotesAndReminders/src/hotkeys.cpp @@ -9,33 +9,32 @@ enum KB_ACTIONS {KB_NEW_NOTE = 1, KB_TOGGLE_NOTES, KB_NEW_REMINDER}; void RegisterKeyBindings() { HOTKEYDESC desc = {}; - desc.cbSize = sizeof(desc); - desc.pwszSection = _A2W(SECTIONNAME); + desc.szSection.w = _A2W(SECTIONNAME); desc.dwFlags = HKD_UNICODE; desc.pszName = MODULENAME"/NewNote"; - desc.pwszDescription = LPGENW("New Note"); + desc.szDescription.w = LPGENW("New Note"); desc.lParam = KB_NEW_NOTE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_INSERT); desc.pszService = MODULENAME"/MenuCommandAddNew"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/ToggleNotesVis"; - desc.pwszDescription = LPGENW("Toggle Notes Visibility"); + desc.szDescription.w = LPGENW("Toggle Notes Visibility"); desc.lParam = KB_TOGGLE_NOTES; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_ADD); desc.pszService = MODULENAME"/MenuCommandShowHide"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/BringNotesFront"; - desc.pwszDescription = LPGENW("Bring All Notes to Front"); + desc.szDescription.w = LPGENW("Bring All Notes to Front"); desc.lParam = KB_TOGGLE_NOTES; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_HOME); desc.pszService = MODULENAME"/MenuCommandBringAllFront"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/NewReminder"; - desc.pwszDescription = LPGENW("New Reminder"); + desc.szDescription.w = LPGENW("New Reminder"); desc.lParam = KB_NEW_REMINDER; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_SUBTRACT); desc.pszService = MODULENAME"/MenuCommandNewReminder"; diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 5c5e1c7328..9765e517a6 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -87,12 +87,11 @@ extern "C" int __declspec(dllexport) Load() Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME); // hotkeys service (0.8+) - HOTKEYDESC hotkey = { 0 }; - hotkey.cbSize = sizeof(hotkey); + HOTKEYDESC hotkey = {}; hotkey.dwFlags = HKD_UNICODE; hotkey.pszName = "Open Folder"; - hotkey.pwszDescription = LPGENW("Open Folder"); - hotkey.pwszSection = LPGENW("Main"); + hotkey.szDescription.w = LPGENW("Open Folder"); + hotkey.szSection.w = LPGENW("Main"); hotkey.pszService = MS_OPENFOLDER_OPEN; hotkey.DefHotKey = MAKEWORD( 'O', HOTKEYF_SHIFT | HOTKEYF_ALT ); Hotkey_Register(&hotkey); diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index 92d12fc948..be0be7c32d 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -25,15 +25,14 @@ BOOL Silent; int ModulesLoaded(WPARAM, LPARAM) { Silent = true; - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "Check for pack updates"; - hkd.pwszDescription = LPGENW("Check for pack updates"); - hkd.pwszSection = LPGENW("Pack Updater"); + hkd.szDescription.w = LPGENW("Check for pack updates"); + hkd.szSection.w = LPGENW("Pack Updater"); hkd.pszService = MODNAME"/CheckUpdates"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; - hkd.lParam = FALSE; Hotkey_Register(&hkd); if (AllowUpdateOnStartup()) diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 204f167cbf..9c09f5a6f9 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -114,10 +114,10 @@ extern "C" __declspec(dllexport) int Load(void) #endif // Add hotkey - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Check for updates"; - hkd.pszDescription = "Check for updates"; - hkd.pszSection = "Plugin Updater"; + hkd.szDescription.a = "Check for updates"; + hkd.szSection.a = "Plugin Updater"; hkd.pszService = MS_PU_CHECKUPDATES; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = FALSE; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 429df0e8f2..9fdd80632a 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -209,17 +209,17 @@ INT_PTR GetStatus(WPARAM, LPARAM) // register Hotkey void LoadHotkey() { - HOTKEYDESC hk = { sizeof(hk) }; + HOTKEYDESC hk = {}; hk.dwFlags = HKD_UNICODE; hk.pszName = "Toggle Popups"; - hk.pwszDescription = LPGENW("Toggle Popups"); - hk.pwszSection = MODULNAME_PLUW; + hk.szDescription.w = LPGENW("Toggle Popups"); + hk.szSection.w = MODULNAME_PLUW; hk.pszService = MENUCOMMAND_SVC; Hotkey_Register(&hk); // 'Popup History' Hotkey hk.pszName = "Popup History"; - hk.pwszDescription = LPGENW("Popup History"); + hk.szDescription.w = LPGENW("Popup History"); hk.pszService = MENUCOMMAND_HISTORY; Hotkey_Register(&hk); } diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 499005b6ae..d6b05ccb77 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -122,12 +122,11 @@ int ModulesLoaded(WPARAM, LPARAM) hasNewHotkeyModule = TRUE; - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "Quick Contacts/Open dialog"; - hkd.pwszDescription = LPGENW("Open dialog"); - hkd.pwszSection = LPGENW("Quick Contacts"); + hkd.szDescription.w = LPGENW("Open dialog"); + hkd.szSection.w = LPGENW("Quick Contacts"); hkd.pszService = MS_QC_SHOW_DIALOG; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_ALT, 'Q'); Hotkey_Register(&hkd); @@ -137,37 +136,37 @@ int ModulesLoaded(WPARAM, LPARAM) hkd.lParam = HOTKEY_FILE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'F'); hkd.pszName = "Quick Contacts/File"; - hkd.pwszDescription = LPGENW("Send file"); + hkd.szDescription.w = LPGENW("Send file"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_URL; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'U'); hkd.pszName = "Quick Contacts/URL"; - hkd.pwszDescription = LPGENW("Send URL"); + hkd.szDescription.w = LPGENW("Send URL"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_INFO; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'I'); hkd.pszName = "Quick Contacts/Info"; - hkd.pwszDescription = LPGENW("Open user info"); + hkd.szDescription.w = LPGENW("Open user info"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_HISTORY; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'H'); hkd.pszName = "Quick Contacts/History"; - hkd.pwszDescription = LPGENW("Open history"); + hkd.szDescription.w = LPGENW("Open history"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_MENU; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'M'); hkd.pszName = "Quick Contacts/Menu"; - hkd.pwszDescription = LPGENW("Open contact menu"); + hkd.szDescription.w = LPGENW("Open contact menu"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_ALL_CONTACTS; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'A'); hkd.pszName = "Quick Contacts/All Contacts"; - hkd.pwszDescription = LPGENW("Show all contacts"); + hkd.szDescription.w = LPGENW("Show all contacts"); Hotkey_Register(&hkd); if (ServiceExists(MS_SKIN_ADDHOTKEY)) @@ -641,7 +640,7 @@ LRESULT CALLBACK HookProc(int code, WPARAM, LPARAM lparam) MSG *msg = (MSG*)lparam; if (hasNewHotkeyModule) { - int action = CallService(MS_HOTKEY_CHECK, (WPARAM) msg, (LPARAM) "Quick Contacts"); + int action = Hotkey_Check(msg, "Quick Contacts"); if (action != 0) { SendMessage(hwndMain, WM_COMMAND, action, 0); diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas index 8299edc8fc..5e5eb5dc4b 100644 --- a/plugins/QuickSearch/sr_global.pas +++ b/plugins/QuickSearch/sr_global.pas @@ -187,14 +187,13 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_GLOBAL; pszDescription.a:='QuickSearch window hotkey'; pszSection.a :=qs_name; pszService :=QS_SHOWSERVICE; DefHotKey :=(HOTKEYF_ALT shl 8) or VK_F3; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; procedure removetoolbar; diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index c707f81ed1..c88932e102 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -532,10 +532,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) LoadDBSettings(); // hotkeys - HOTKEYDESC hk = { sizeof(hk) }; + HOTKEYDESC hk = {}; hk.pszName = msLastUC_ShowList; - hk.pszDescription = LPGEN("Show Recent Contacts"); - hk.pszSection = "Contacts"; + hk.szSection.a = "Contacts"; + hk.szDescription.a = LPGEN("Show Recent Contacts"); hk.pszService = msLastUC_ShowList; hk.DefHotKey = MAKEWORD('R', HOTKEYF_CONTROL | HOTKEYF_SHIFT); Hotkey_Register(&hk); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index f9d96235c6..c5034ea3eb 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -118,12 +118,8 @@ int CScriverWindow::InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARA BOOL isAlt = GetKeyState(VK_MENU) & 0x8000; BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt; - MSG amsg; - amsg.hwnd = hwnd; - amsg.message = msg; - amsg.wParam = wParam; - amsg.lParam = lParam; - int action = CallService(MS_HOTKEY_CHECK, (WPARAM)&amsg, (LPARAM)"Messaging"); + MSG amsg = { hwnd, msg, wParam, lParam }; + int action = Hotkey_Check(&amsg, "Messaging"); switch (action) { case KB_PREV_TAB: @@ -265,10 +261,10 @@ int CScriverWindow::InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARA void RegisterKeyBindings() { char strDesc[64], strName[64]; - HOTKEYDESC desc = { sizeof(desc) }; - desc.pszSection = LPGEN("Messaging"); + HOTKEYDESC desc = {}; + desc.szSection.a = LPGEN("Messaging"); desc.pszName = "Scriver/Nav/Previous Tab"; - desc.pszDescription = LPGEN("Navigate: Previous tab"); + desc.szDescription.a = LPGEN("Navigate: Previous tab"); desc.lParam = KB_PREV_TAB; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_TAB); Hotkey_Register(&desc); @@ -278,7 +274,7 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = "Scriver/Nav/Next Tab"; - desc.pszDescription = LPGEN("Navigate: Next tab"); + desc.szDescription.a = LPGEN("Navigate: Next tab"); desc.lParam = KB_NEXT_TAB; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_TAB); Hotkey_Register(&desc); @@ -288,7 +284,7 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = strName; - desc.pszDescription = strDesc; + desc.szDescription.a = strDesc; for (int i = 0; i < 9; i++) { mir_snprintf(strName, "Scriver/Nav/Tab %d", i + 1); mir_snprintf(strDesc, Translate("Navigate: Tab %d"), i + 1); @@ -298,43 +294,43 @@ void RegisterKeyBindings() } desc.pszName = "Scriver/Wnd/Toggle Statusbar"; - desc.pszDescription = LPGEN("Window: Toggle status bar"); + desc.szDescription.a = LPGEN("Window: Toggle status bar"); desc.lParam = KB_SWITCHSTATUSBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Titlebar"; - desc.pszDescription = LPGEN("Window: Toggle title bar"); + desc.szDescription.a = LPGEN("Window: Toggle title bar"); desc.lParam = KB_SWITCHTITLEBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'M'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Toolbar"; - desc.pszDescription = LPGEN("Window: Toggle toolbar"); + desc.szDescription.a = LPGEN("Window: Toggle toolbar"); desc.lParam = KB_SWITCHTOOLBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Infobar"; - desc.pszDescription = LPGEN("Window: Toggle info bar"); + desc.szDescription.a = LPGEN("Window: Toggle info bar"); desc.lParam = KB_SWITCHINFOBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'N'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Clear Log"; - desc.pszDescription = LPGEN("Window: Clear log"); + desc.szDescription.a = LPGEN("Window: Clear log"); desc.lParam = KB_CLEAR_LOG; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'L'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Minimize"; - desc.pszDescription = LPGEN("Window: Minimize"); + desc.szDescription.a = LPGEN("Window: Minimize"); desc.lParam = KB_MINIMIZE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT, VK_ESCAPE); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Close Tab"; - desc.pszDescription = LPGEN("Window: Close tab"); + desc.szDescription.a = LPGEN("Window: Close tab"); desc.lParam = KB_CLOSE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F4); Hotkey_Register(&desc); @@ -342,19 +338,19 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = "Scriver/Action/Quote"; - desc.pszDescription = LPGEN("Action: Quote"); + desc.szDescription.a = LPGEN("Action: Quote"); desc.lParam = KB_QUOTE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'Q'); Hotkey_Register(&desc); desc.pszName = "Scriver/Action/Send All"; - desc.pszDescription = LPGEN("Action: Send to all"); + desc.szDescription.a = LPGEN("Action: Send to all"); desc.lParam = KB_SEND_ALL; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_RETURN); Hotkey_Register(&desc); desc.pszName = "Scriver/Action/PasteSend"; - desc.pszDescription = LPGEN("Action: Paste and send"); + desc.szDescription.a = LPGEN("Action: Paste and send"); desc.lParam = KB_PASTESEND; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_INSERT); Hotkey_Register(&desc); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 1e10b5b0e5..abca9d118b 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -317,15 +317,15 @@ DLL_EXPORT int Load(void) Menu_AddContactMenuItem(&mi); /// hotkey's - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Open SendSS+"; - hkd.pwszDescription = LPGENW("Open SendSS+"); - hkd.pwszSection = L"SendSS+"; + hkd.szDescription.w = LPGENW("Open SendSS+"); + hkd.szSection.w = L"SendSS+"; hkd.pszService = MS_SENDSS_OPENDIALOG; - //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = 0xFFFF; hkd.dwFlags = HKD_UNICODE; Hotkey_Register(&hkd); + /// register highlighter window class HBRUSH brush = CreateSolidBrush(0x0000FF00);//owned by class WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, NULL, NULL, brush, NULL, L"SendSSHighlighter" }; diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 5c4b8a3294..0d0baffe91 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -744,25 +744,25 @@ static int PluginInit(WPARAM, LPARAM) HookEvent(ME_TTB_MODULELOADED, CreateButtons); // Hotkeys - HOTKEYDESC hkd = { sizeof(hkd) }; - hkd.pszSection = LPGEN("Sessions"); + HOTKEYDESC hkd = {}; hkd.pszName = "OpenSessionsManager"; - hkd.pszDescription = LPGEN("Open Sessions Manager"); + hkd.szSection.a = LPGEN("Sessions"); + hkd.szDescription.a = LPGEN("Open Sessions Manager"); hkd.pszService = MS_SESSIONS_OPENMANAGER; Hotkey_Register(&hkd); hkd.pszName = "RestoreLastSession"; - hkd.pszDescription = LPGEN("Restore last Session"); + hkd.szDescription.a = LPGEN("Restore last Session"); hkd.pszService = MS_SESSIONS_RESTORELASTSESSION; Hotkey_Register(&hkd); hkd.pszName = "SaveSession"; - hkd.pszDescription = LPGEN("Save Session"); + hkd.szDescription.a = LPGEN("Save Session"); hkd.pszService = MS_SESSIONS_SAVEUSERSESSION; Hotkey_Register(&hkd); hkd.pszName = "CloseSession"; - hkd.pszDescription = LPGEN("Close Session"); + hkd.szDescription.a = LPGEN("Close Session"); hkd.pszService = MS_SESSIONS_CLOSESESSION; Hotkey_Register(&hkd); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 4b942d6ef9..a6bcbb866f 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1343,13 +1343,11 @@ static int AddTopToolbarButton(WPARAM, LPARAM) void RegisterHotkey(void) { - HOTKEYDESC hkd = {0}; - - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "SimpleStatusMsg_OpenDialog"; - hkd.pwszDescription = LPGENW("Open status message dialog"); - hkd.pwszSection = LPGENW("Status message"); + hkd.szDescription.w = LPGENW("Open status message dialog"); + hkd.szSection.w = LPGENW("Status message"); hkd.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_OEM_3); Hotkey_Register(&hkd); diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index a1a49e3a47..fb8ed6a51d 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -67,10 +67,10 @@ static int ModulesLoaded(WPARAM, LPARAM) g_SmileyCategories.AddAllProtocolsAsCategory(); g_SmileyCategories.ClearAndLoadAll(); - HOTKEYDESC desc = { sizeof(desc) }; + HOTKEYDESC desc = {}; desc.pszName = "smileyadd"; - desc.pszSection = MODULENAME; - desc.pszDescription = LPGEN("Smiley selector"); + desc.szSection.a = MODULENAME; + desc.szDescription.a = LPGEN("Smiley selector"); desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'E'); Hotkey_Register(&desc); diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 63d7ab3304..4726369e2b 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -211,10 +211,10 @@ static int ModulesLoaded(WPARAM, LPARAM) Srmm_AddIcon(&sid); } - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Spell Checker/Toggle"; - hkd.pszSection = LPGEN("Spell Checker"); - hkd.pszDescription = LPGEN("Enable/disable spell checker"); + hkd.szSection.a = LPGEN("Spell Checker"); + hkd.szDescription.a = LPGEN("Enable/disable spell checker"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_ALT, 'S'); hkd.lParam = HOTKEY_ACTION_TOGGLE; Hotkey_Register(&hkd); diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 6c1e6dd82c..0c62b9e307 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -552,13 +552,8 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return -1; // Hotkey support - MSG msgData = { 0 }; - msgData.hwnd = hwnd; - msgData.message = msg; - msgData.wParam = wParam; - msgData.lParam = lParam; - - int action = CallService(MS_HOTKEY_CHECK, (WPARAM)&msgData, (LPARAM)"Spell Checker"); + MSG msgData = { hwnd, msg, wParam, lParam }; + int action = Hotkey_Check(&msgData, "Spell Checker"); if (action == HOTKEY_ACTION_TOGGLE) { ToggleEnabled(dlg); return 1; diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index c13e94dc84..2b2080af00 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1993,7 +1993,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return _dlgReturn(m_hwnd, 1); } - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC)); + LRESULT mim_hotkey_check = Hotkey_Check(&message, TABSRMM_HK_SECTION_GC); if (mim_hotkey_check) m_bkeyProcessed = true; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 96c17b3607..e65ac89e63 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -118,7 +118,7 @@ void CTabBaseDlg::DM_InitTip() bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) { - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)message, (LPARAM)TABSRMM_HK_SECTION_GENERIC); + LRESULT mim_hotkey_check = Hotkey_Check(message, TABSRMM_HK_SECTION_GENERIC); switch (mim_hotkey_check) { case TABSRMM_HK_PASTEANDSEND: diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index af951250db..914b0d89c7 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -40,33 +40,33 @@ static UINT WM_TASKBARCREATED; static HANDLE hSvcHotkeyProcessor = 0; static HOTKEYDESC _hotkeydescs[] = { - { 0, "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD }, - { 0, "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND }, - { 0, "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS }, - { 0, "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS }, - { 0, "tabsrmm_nudge", LPGEN("Send nudge"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), TABSRMM_HK_NUDGE }, - { 0, "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE }, - { 0, "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG }, - { 0, "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER }, - - { 0, "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND }, - { 0, "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY }, - { 0, "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU }, - { 0, "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU }, - { 0, "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU }, - { 0, "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS }, - { 0, "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR }, - { 0, "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL }, - { 0, "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL }, - { 0, "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND }, - { 0, "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG }, - { 0, "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES }, - { 0, "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR }, - { 0, "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR }, - { 0, "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE }, - { 0, "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE }, - { 0, "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER }, - { 0, "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER }, + { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD }, + { "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND }, + { "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS }, + { "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS }, + { "tabsrmm_nudge", LPGEN("Send nudge"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), TABSRMM_HK_NUDGE }, + { "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE }, + { "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG }, + { "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER }, + + { "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND }, + { "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY }, + { "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU }, + { "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU }, + { "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU }, + { "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS }, + { "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR }, + { "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL }, + { "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL }, + { "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND }, + { "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG }, + { "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES }, + { "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR }, + { "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR }, + { "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE }, + { "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE }, + { "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER }, + { "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER }, }; LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, WPARAM wParam, LPARAM lParam) @@ -133,10 +133,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_CREATE: - for (int i = 0; i < _countof(_hotkeydescs); i++) { - _hotkeydescs[i].cbSize = sizeof(HOTKEYDESC); + for (int i = 0; i < _countof(_hotkeydescs); i++) Hotkey_Register(&_hotkeydescs[i]); - } WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated"); ShowWindow(hwndDlg, SW_HIDE); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 3af970f9d9..29b8826dd0 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1550,7 +1550,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) } if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) { - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)TABSRMM_HK_SECTION_IM); + LRESULT mim_hotkey_check = Hotkey_Check(&message, TABSRMM_HK_SECTION_IM); if (mim_hotkey_check) m_bkeyProcessed = true; diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 0694b3da0b..f4d9c3c188 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -275,11 +275,10 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide); // Регистрируем горячую клавишу для показа/скрытия фрейма { - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T'); - hkd.pszSection = "Traffic Counter"; - hkd.pszDescription = LPGEN("Show/Hide frame"); + hkd.szSection.a = "Traffic Counter"; + hkd.szDescription.a = LPGEN("Show/Hide frame"); hkd.pszName = "TC_Show_Hide"; hkd.pszService = "TrafficCounter/ShowHide"; Hotkey_Register(&hkd); diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 21bdd2b69e..5f529e3837 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -120,43 +120,43 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "TranslitSwitcher/ConvertAllOrSelected"; - hkd.pwszDescription = LPGENW("Convert All / Selected"); - hkd.pwszSection = L"TranslitSwitcher"; + hkd.szDescription.w = LPGENW("Convert All / Selected"); + hkd.szSection.w = L"TranslitSwitcher"; hkd.pszService = MS_TS_SWITCHLAYOUT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/ConvertLastOrSelected"; - hkd.pwszDescription = LPGENW("Convert Last / Selected"); + hkd.szDescription.w = LPGENW("Convert Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/TranslitAllOrSelected"; - hkd.pwszDescription = LPGENW("Translit All / Selected"); + hkd.szDescription.w = LPGENW("Translit All / Selected"); hkd.pszService = MS_TS_TRANSLITLAYOUT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL; hkd.lParam = false; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/TranslitLastOrSelected"; - hkd.pwszDescription = LPGENW("Translit Last / Selected"); + hkd.szDescription.w = LPGENW("Translit Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/InvertCaseAllOrSelected"; - hkd.pwszDescription = LPGENW("Invert Case All / Selected"); + hkd.szDescription.w = LPGENW("Invert Case All / Selected"); hkd.pszService = MS_TS_INVERTCASE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL; hkd.lParam = false; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/InvertCaseLastOrSelected"; - hkd.pwszDescription = LPGENW("Invert Case Last / Selected"); + hkd.szDescription.w = LPGENW("Invert Case Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index c1e2392f04..f999611d19 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -977,11 +977,10 @@ void DlgAnniversaryListLoadModule() { CreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "AnniversaryList"; - hk.pszDescription = LPGEN("Popup anniversary list"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Popup anniversary list"); hk.pszService = MS_USERINFO_REMINDER_LIST; Hotkey_Register(&hk); } diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index f9b4da5021..4b26516ad1 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -875,11 +875,10 @@ void SvcRefreshContactInfoLoadModule(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); HookEvent(ME_DB_CONTACT_ADDED, OnContactAdded); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "RefreshContactDetails"; - hk.pszDescription = LPGEN("Refresh contact details"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Refresh contact details"); hk.pszService = MS_USERINFO_REFRESH; Hotkey_Register(&hk); } diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 83f3c91491..ffaa8b8a0b 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -917,11 +917,10 @@ void SvcReminderLoadModule(void) CreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService); // register hotkey - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "ReminderCheck"; - hk.pszDescription = LPGEN("Check anniversaries"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Check anniversaries"); hk.pszService = MS_USERINFO_REMINDER_CHECK; Hotkey_Register(&hk); diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index 026f03e82b..8e7782de69 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -297,14 +297,13 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_POPUP; pszDescription.a:='WATrack popup hotkey'; pszSection.a :=PluginName; pszService :=MS_WAT_SHOWMUSICINFO; DefHotKey:=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F7 or HKF_MIRANDA_LOCAL; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; {$include pop_dlg.inc} diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas index 81c1f20d9a..101c2dcf8b 100644 --- a/plugins/Watrack/status/status.pas +++ b/plugins/Watrack/status/status.pas @@ -24,7 +24,6 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_INSERT; pszDescription.a:='Global WATrack hotkey'; pszSection.a :=PluginName; @@ -32,7 +31,7 @@ begin DefHotKey :=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F5; // lParam :=0; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; {$include i_st_vars.inc} diff --git a/plugins/Watrack/templates/i_expkey.inc b/plugins/Watrack/templates/i_expkey.inc index fd990cda31..c8e589609f 100644 --- a/plugins/Watrack/templates/i_expkey.inc +++ b/plugins/Watrack/templates/i_expkey.inc @@ -22,13 +22,11 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_EXPORT; pszDescription.a:='WATrack data insert hotkey'; pszSection.a :=PluginName; pszService :=MS_WAT_EXPORT; DefHotKey :=((HOTKEYF_ALT or HOTKEYF_SHIFT) shl 8) or VK_F7; -// lParam :=0; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index b97c5dda1f..f6fd93f05f 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -118,16 +118,16 @@ extern "C" int __declspec(dllexport) Load(void) Menu_AddContactMenuItem(&mi); // Register hotkeys - HOTKEYDESC hotkey = { sizeof(hotkey) }; - hotkey.pszSection = LPGEN("Birthdays"); + HOTKEYDESC hotkey = {}; + hotkey.szSection.a = LPGEN("Birthdays"); hotkey.pszName = "wwi_birthday_list"; - hotkey.pszDescription = LPGEN("Birthday list"); + hotkey.szDescription.a = LPGEN("Birthday list"); hotkey.pszService = MS_WWI_LIST_SHOW; Hotkey_Register(&hotkey); hotkey.pszName = "wwi_check_birthdays"; - hotkey.pszDescription = LPGEN("Check for birthdays"); + hotkey.szDescription.a = LPGEN("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; Hotkey_Register(&hotkey); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 33498fe920..d13f61a6ba 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -332,12 +332,11 @@ extern "C" int __declspec(dllexport) Load(void) LoadIcons(); LoadPlugins(); - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.pszName = "YAMN_hotkey"; hkd.pszService = MS_YAMN_FORCECHECK; - hkd.pszSection = YAMN_DBMODULE; - hkd.pszDescription = LPGEN("Check mail"); + hkd.szSection.a = YAMN_DBMODULE; + hkd.szDescription.a = LPGEN("Check mail"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11); Hotkey_Register(&hkd); diff --git a/plugins/mRadio/i_hotkey.inc b/plugins/mRadio/i_hotkey.inc index 9797b61f1c..d3f739d844 100644 --- a/plugins/mRadio/i_hotkey.inc +++ b/plugins/mRadio/i_hotkey.inc @@ -30,7 +30,6 @@ begin FillChar(hkrec,SizeOf(hkrec),0); - hkrec.cbSize := SizeOf(hkrec); hkrec.pszSection.a := PluginName; hkrec.pszService := MS_RADIO_HOTKEY; @@ -38,25 +37,25 @@ begin hkrec.pszName := HKN_PLAYPAUSE; hkrec.pszDescription.a:= 'Play/Pause'; hkrec.lParam := MRC_PAUSE; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyStop; hkrec.pszName := HKN_STOP; hkrec.pszDescription.a:= 'Stop'; hkrec.lParam := MRC_STOP; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyMute; hkrec.pszName := HKN_MUTE; hkrec.pszDescription.a:= 'Mute'; hkrec.lParam := MRC_MUTE; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyRecord; hkrec.pszName := HKN_RECORD; hkrec.pszDescription.a:= 'Start/Stop Record'; hkrec.lParam := MRC_RECORD; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; procedure UnregisterHotKey; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index fe95fb1ee0..c43f9c8d4c 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -1095,22 +1095,22 @@ void FacebookProto::InitHotkeys() mir_strncpy(text, m_szModuleName, 100); char *tDest = text + mir_strlen(text); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = text; hkd.pszService = text; - hkd.pwszSection = m_tszUserName; + hkd.szSection.w = m_tszUserName; hkd.dwFlags = HKD_UNICODE; mir_strcpy(tDest, "/VisitProfile"); - hkd.pwszDescription = LPGENW("Visit profile"); + hkd.szDescription.w = LPGENW("Visit profile"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/VisitNotifications"); - hkd.pwszDescription = LPGENW("Visit notifications"); + hkd.szDescription.w = LPGENW("Visit notifications"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Mind"); - hkd.pwszDescription = LPGENW("Show 'Share status' window"); + hkd.szDescription.w = LPGENW("Show 'Share status' window"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_EXT, 'F'); Hotkey_Register(&hkd); } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 5af6eaa2b9..e08731dded 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -795,29 +795,29 @@ void CJabberProto::GlobalMenuInit() // Hotkeys char text[200]; - strncpy(text, m_szModuleName, sizeof(text) - 1); + strncpy_s(text, m_szModuleName, _TRUNCATE); char* tDest = text + mir_strlen(text); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = text; hkd.pszService = text; - hkd.pwszSection = m_tszUserName; + hkd.szSection.w = m_tszUserName; hkd.dwFlags = HKD_UNICODE; mir_strcpy(tDest, "/Groupchat"); - hkd.pwszDescription = LPGENW("Join conference"); + hkd.szDescription.w = LPGENW("Join conference"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Bookmarks"); - hkd.pwszDescription = LPGENW("Open bookmarks"); + hkd.szDescription.w = LPGENW("Open bookmarks"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/PrivacyLists"); - hkd.pwszDescription = LPGENW("Privacy lists"); + hkd.szDescription.w = LPGENW("Privacy lists"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/ServiceDiscovery"); - hkd.pwszDescription = LPGENW("Service discovery"); + hkd.szDescription.w = LPGENW("Service discovery"); Hotkey_Register(&hkd); } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 19bc5452e7..4153006ee9 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -46,11 +46,11 @@ TwitterProto::TwitterProto(const char *proto_name, const wchar_t *username) : char text[512]; mir_snprintf(text, "%s/Tweet", m_szModuleName); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = text; hkd.pszService = text; - hkd.pszSection = m_szModuleName; // Section title; TODO: use username? - hkd.pszDescription = "Send Tweet"; + hkd.szSection.a = m_szModuleName; // Section title; TODO: use username? + hkd.szDescription.a = "Send Tweet"; Hotkey_Register(&hkd); // set Tokens and stuff diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index 07fa9512cf..e4bc8f5565 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -185,14 +185,14 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP return mir_callNextSubclass(hwnd, sttHotkeyEditProc, msg, wParam, lParam); } -void HotkeyEditCreate(HWND hwnd) +MIR_APP_DLL(void) Hotkey_Subclass(HWND hwnd) { THotkeyBoxData *data = (THotkeyBoxData *)mir_alloc(sizeof(THotkeyBoxData)); SetWindowLongPtr(hwnd, GWLP_USERDATA, (ULONG_PTR)data); mir_subclassWindow(hwnd, sttHotkeyEditProc); } -void HotkeyEditDestroy(HWND hwnd) +MIR_APP_DLL(void) Hotkey_Unsubclass(HWND hwnd) { THotkeyBoxData *data = (THotkeyBoxData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); @@ -470,7 +470,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg); - HotkeyEditCreate(GetDlgItem(hwndDlg, IDC_HOTKEY)); + Hotkey_Subclass(GetDlgItem(hwndDlg, IDC_HOTKEY)); { HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 3, 1); ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_WINDOWS); diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index d621a4565d..b2b0247ab7 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -117,36 +117,21 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) return CallNextHookEx(hhkKeyboard, code, wParam, lParam); } -static INT_PTR svcHotkeySubclass(WPARAM wParam, LPARAM) -{ - HotkeyEditCreate((HWND)wParam); - return 0; -} +///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR svcHotkeyUnsubclass(WPARAM wParam, LPARAM) +MIR_APP_DLL(int) Hotkey_Register(const HOTKEYDESC *desc, int _hLangpack) { - HotkeyEditDestroy((HWND)wParam); - return 0; -} - -static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) -{ - HOTKEYDESC *desc = (HOTKEYDESC *)lParam; - if (desc->cbSize != sizeof(HOTKEYDESC)) - return 0; - THotkeyItem *p = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem)); - DWORD dwFlags = (desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0; - if (dwFlags & HKD_UNICODE) { - p->pwszSection = mir_wstrdup(desc->pwszSection); - p->pwszDescription = mir_wstrdup(desc->pwszDescription); + if (desc->dwFlags & HKD_UNICODE) { + p->pwszSection = mir_wstrdup(desc->szSection.w); + p->pwszDescription = mir_wstrdup(desc->szDescription.w); } else { - p->pwszSection = mir_a2u(desc->pszSection); - p->pwszDescription = mir_a2u(desc->pszDescription); + p->pwszSection = mir_a2u(desc->szSection.a); + p->pwszDescription = mir_a2u(desc->szDescription.a); } - p->hLangpack = (int)wParam; + p->hLangpack = _hLangpack; p->allowSubHotkeys = TRUE; p->rootHotkey = nullptr; p->nSubHotkeys = 0; @@ -187,7 +172,8 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) if (p->Enabled) { BYTE mod, vk; sttWordToModAndVk(p->Hotkey, &mod, &vk); - if (vk) RegisterHotKey(g_hwndHotkeyHost, p->idHotkey, mod, vk); + if (vk) + RegisterHotKey(g_hwndHotkeyHost, p->idHotkey, mod, vk); } } @@ -195,15 +181,14 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) if (!p->rootHotkey) { /* try to load alternatives from db */ - int count, i; mir_snprintf(buf, "%s$count", p->pszName); - count = (int)db_get_dw(0, DBMODULENAME, buf, -1); - for (i = 0; i < count; i++) { + int count = (int)db_get_dw(0, DBMODULENAME, buf, -1); + for (int i = 0; i < count; i++) { mir_snprintf(buf, "%s$%d", p->pszName, i); if (!db_get_w(0, DBMODULENAME, buf, 0)) continue; - svcHotkeyRegister(wParam, lParam); + Hotkey_Register(desc, _hLangpack); } p->allowSubHotkeys = count < 0; } @@ -215,9 +200,10 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) return p->idHotkey; } -static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) +///////////////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(int) Hotkey_Unregister(const char *pszName) { - char *pszName = (char *)lParam; char pszNamePrefix[MAXMODULELABELLENGTH]; size_t cbNamePrefix; mir_snprintf(pszNamePrefix, "%s$", pszName); @@ -247,22 +233,20 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) return 0; } -static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) -{ - MSG *msg = (MSG *)wParam; - wchar_t *pszSection = mir_a2u((char *)lParam); +///////////////////////////////////////////////////////////////////////////////////////// - if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) { - int i; +MIR_APP_DLL(int) Hotkey_Check(MSG *msg, const char *szSection) +{ + if (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN) { BYTE mod = 0, vk = msg->wParam; - if (vk) { if (GetAsyncKeyState(VK_CONTROL)) mod |= MOD_CONTROL; if (GetAsyncKeyState(VK_MENU)) mod |= MOD_ALT; if (GetAsyncKeyState(VK_SHIFT)) mod |= MOD_SHIFT; if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) mod |= MOD_WIN; - for (i = 0; i < hotkeys.getCount(); i++) { + ptrW pszSection(mir_a2u(szSection)); + for (int i = 0; i < hotkeys.getCount(); i++) { THotkeyItem *p = hotkeys[i]; if ((p->type != HKT_MANUAL) || mir_wstrcmp(pszSection, p->pwszSection)) continue; @@ -271,15 +255,12 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) sttWordToModAndVk(p->Hotkey, &hkMod, &hkVk); if (!hkVk) continue; if (!p->Enabled) continue; - if ((vk == hkVk) && (mod == hkMod)) { - mir_free(pszSection); + if (vk == hkVk && mod == hkMod) return p->lParam; - } } } } - mir_free(pszSection); return 0; } @@ -370,12 +351,6 @@ int LoadSkinHotkeys(void) hEvChanged = CreateHookableEvent(ME_HOTKEYS_CHANGED); - CreateServiceFunction("CoreHotkeys/Register", svcHotkeyRegister); - CreateServiceFunction(MS_HOTKEY_UNREGISTER, svcHotkeyUnregister); - CreateServiceFunction(MS_HOTKEY_SUBCLASS, svcHotkeySubclass); - CreateServiceFunction(MS_HOTKEY_UNSUBCLASS, svcHotkeyUnsubclass); - CreateServiceFunction(MS_HOTKEY_CHECK, svcHotkeyCheck); - HookEvent(ME_SYSTEM_MODULESLOADED, sttModulesLoaded); for (int i = 0; i < _countof(oldSettings); i++) { diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp index 79d81620ec..f9ee746c40 100644 --- a/src/mir_app/src/keyboard.cpp +++ b/src/mir_app/src/keyboard.cpp @@ -52,39 +52,39 @@ int InitClistHotKeys(void) CreateServiceFunction("CLIST/HK/Opts", hkOpts); CreateServiceFunction("CLIST/HK/Read", hkRead); - HOTKEYDESC shk = { sizeof(shk) }; + HOTKEYDESC shk = {}; shk.dwFlags = HKD_UNICODE; - shk.pwszDescription = LPGENW("Show/Hide contact list"); + shk.szDescription.w = LPGENW("Show/Hide contact list"); shk.pszName = "ShowHide"; - shk.pwszSection = L"Main"; + shk.szSection.w = L"Main"; shk.pszService = "CLIST/HK/SHOWHIDE"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'A'); Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Read message"); + shk.szDescription.w = LPGENW("Read message"); shk.pszName = "ReadMessage"; - shk.pwszSection = L"Main"; + shk.szSection.w = L"Main"; shk.pszService = "CLIST/HK/Read"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'I'); Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Open Options page"); + shk.szDescription.w = LPGENW("Open Options page"); shk.pszName = "ShowOptions"; - shk.pwszSection = L"Main"; + shk.szSection.w = L"Main"; shk.pszService = "CLIST/HK/Opts"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'O') | HKF_MIRANDA_LOCAL; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Open logging options"); + shk.szDescription.w = LPGENW("Open logging options"); shk.pszName = "ShowLogOptions"; - shk.pwszSection = L"Main"; + shk.szSection.w = L"Main"; shk.pszService = "Netlib/Log/Win"; shk.DefHotKey = 0; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Open 'Find user' dialog"); + shk.szDescription.w = LPGENW("Open 'Find user' dialog"); shk.pszName = "FindUsers"; - shk.pwszSection = L"Main"; + shk.szSection.w = L"Main"; shk.pszService = "FindAdd/FindAddCommand"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'F') | HKF_MIRANDA_LOCAL; Hotkey_Register(&shk); diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 6146eacd2b..16700e7878 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -1141,15 +1141,15 @@ void InitCustomMenus(void) // initialize hotkeys CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus); - HOTKEYDESC hkd = { sizeof(hkd) }; - hkd.pwszSection = L"Status"; + HOTKEYDESC hkd = {}; + hkd.szSection.w = L"Status"; hkd.dwFlags = HKD_UNICODE; for (int i = 0; i < _countof(statusHotkeys); i++) { char szName[30]; mir_snprintf(szName, "StatusHotKey_%d", i); hkd.pszName = szName; hkd.lParam = statusModeList[i]; - hkd.pwszDescription = fnGetStatusModeDescription(hkd.lParam, 0); + hkd.szDescription.w = fnGetStatusModeDescription(hkd.lParam, 0); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '0' + i) | HKF_MIRANDA_LOCAL; hkd.pszService = MS_CLIST_HKSTATUS; statusHotkeys[i] = Hotkey_Register(&hkd); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 21ee8846f5..890a9eec7f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -446,3 +446,8 @@ Chat_GetTextPixelSize @449 NONAME Srmm_GetWindowData @451 Srmm_FindWindow @452 Srmm_Broadcast @453 +Hotkey_Register @454 +Hotkey_Subclass @455 +Hotkey_Unregister @456 +Hotkey_Unsubclass @457 +Hotkey_Check @458 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 1db051a51d..f5e2debc70 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -446,3 +446,8 @@ Chat_GetTextPixelSize @449 NONAME Srmm_GetWindowData @451 Srmm_FindWindow @452 Srmm_Broadcast @453 +Hotkey_Register @454 +Hotkey_Subclass @455 +Hotkey_Unregister @456 +Hotkey_Unsubclass @457 +Hotkey_Check @458 diff --git a/src/mir_app/src/skin.h b/src/mir_app/src/skin.h index e580ecbc04..d83a63cc69 100644 --- a/src/mir_app/src/skin.h +++ b/src/mir_app/src/skin.h @@ -70,6 +70,3 @@ int HotkeyOptionsInit(WPARAM, LPARAM); void FreeHotkey(THotkeyItem *item); void RegisterHotkeys(); void UnregisterHotkeys(); - -void HotkeyEditCreate(HWND hwnd); -void HotkeyEditDestroy(HWND hwnd); -- cgit v1.2.3