diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-19 16:10:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-19 16:10:58 +0000 |
commit | 394540126b181982d8b61d07a084ceeac8559ed1 (patch) | |
tree | 3950c99abcaeb77888271dd5994d96254f0492c6 | |
parent | fe557276119e48389b9a471d5a4ed5d232a2857d (diff) |
- dynamic hotkey translation
- MS_HOTKEY_REGISTER replaced with Hotkey_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
35 files changed, 335 insertions, 395 deletions
diff --git a/include/m_hotkeys.h b/include/m_hotkeys.h index 6bb568d618..7d6acba08f 100644 --- a/include/m_hotkeys.h +++ b/include/m_hotkeys.h @@ -54,6 +54,8 @@ typedef struct #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');
*/
@@ -65,7 +67,11 @@ Registers new hotkey lParam=(LPARAM)(HOTKEYDESC *)hotkey
Returns 0 on failure or hotkey atom id on success
*/
-#define MS_HOTKEY_REGISTER "CoreHotkeys/Register"
+
+__inline static INT_PTR Hotkey_Register(HOTKEYDESC *hk)
+{
+ return CallService("CoreHotkeys/Register", (WPARAM)hLangpack, (LPARAM)hk);
+}
/* CoreHotkeys/Unregister service
Unregister existing hotkey
diff --git a/plugins/AddContactPlus/main.cpp b/plugins/AddContactPlus/main.cpp index 68a210543a..402b9d5ecb 100644 --- a/plugins/AddContactPlus/main.cpp +++ b/plugins/AddContactPlus/main.cpp @@ -171,7 +171,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) hkd.ptszSection = LPGENT("Main");
hkd.pszService = MS_ADDCONTACTPLUS_SHOW;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C') | HKF_MIRANDA_LOCAL;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
OnAccListChanged(0, 0);
diff --git a/plugins/BasicHistory/Options.cpp b/plugins/BasicHistory/Options.cpp index 5f7b7f4997..29988fdd03 100644 --- a/plugins/BasicHistory/Options.cpp +++ b/plugins/BasicHistory/Options.cpp @@ -281,7 +281,7 @@ void Options::Load() hid.pszService = g_HotkeyOptionsList[i].pszService;
hid.DefHotKey = g_HotkeyOptionsList[i].DefHotKey;
hid.lParam = g_HotkeyOptionsList[i].lParam;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hid);
+ Hotkey_Register(&hid);
}
showContacts = DBGetContactSettingByte(0, MODULE, "showContacts", 0) ? true : false;
diff --git a/plugins/BossKeyPlus/BossKey.cpp b/plugins/BossKeyPlus/BossKey.cpp index 9a89bb372d..deeaa1ffa8 100644 --- a/plugins/BossKeyPlus/BossKey.cpp +++ b/plugins/BossKeyPlus/BossKey.cpp @@ -683,7 +683,7 @@ void RegisterCoreHotKeys (void) hotkey.pszService = MS_BOSSKEY_HIDE;
hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F12);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hotkey);
+ Hotkey_Register(&hotkey);
}
static int ModernToolbarInit(WPARAM, LPARAM) // Modern toolbar support
diff --git a/plugins/CSList/cslist.cpp b/plugins/CSList/cslist.cpp index 98d7c9e31f..4ce3f66d18 100644 --- a/plugins/CSList/cslist.cpp +++ b/plugins/CSList/cslist.cpp @@ -174,19 +174,15 @@ int CSList::postLoading( WPARAM wparam, LPARAM lparam ) void CSList::registerHotkeys(char buf[200], TCHAR* accName, int Number)
{
- // 0.9+ core hotkeys service
- if ( ServiceExists( MS_HOTKEY_REGISTER ) )
- {
- HOTKEYDESC hotkey = { 0 };
- hotkey.cbSize = sizeof(hotkey);
- hotkey.dwFlags = HKD_TCHAR;
- hotkey.pszName = buf;
- hotkey.ptszDescription = accName;
- hotkey.ptszSection = _T("Custom Status List");
- hotkey.pszService = buf;
- hotkey.DefHotKey = HOTKEYCODE( HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0'+Number );
- CallService( MS_HOTKEY_REGISTER, 0, ( LPARAM )&hotkey );
- }
+ HOTKEYDESC hotkey = { 0 };
+ hotkey.cbSize = sizeof(hotkey);
+ hotkey.dwFlags = HKD_TCHAR;
+ hotkey.pszName = buf;
+ hotkey.ptszDescription = accName;
+ hotkey.ptszSection = LPGENT("Custom Status List");
+ hotkey.pszService = buf;
+ hotkey.DefHotKey = HOTKEYCODE( HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0'+Number );
+ Hotkey_Register(&hotkey);
}
int CSList::initOptions( WPARAM wparam, LPARAM lparam )
diff --git a/plugins/Clist_modern/modern_keyboard.cpp b/plugins/Clist_modern/modern_keyboard.cpp index 2bcd0a373f..ad686a1ec1 100644 --- a/plugins/Clist_modern/modern_keyboard.cpp +++ b/plugins/Clist_modern/modern_keyboard.cpp @@ -45,22 +45,19 @@ int InitSkinHotKeys(void) CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus);
HOTKEYDESC shk = {0};
- shk.cbSize=sizeof(shk);
- shk.dwFlags=HKD_TCHAR;
+ shk.cbSize = sizeof(shk);
- shk.ptszDescription=LPGENT("Close Miranda");
- shk.pszName="CloseMiranda";
- shk.ptszSection=LPGENT("Main");
- shk.pszService="CLIST/HK/CloseMiranda";
- shk.DefHotKey=0;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk);
+ shk.pszDescription = LPGEN("Close Miranda");
+ shk.pszName = "CloseMiranda";
+ shk.pszSection = LPGEN("Main");
+ shk.pszService = "CLIST/HK/CloseMiranda";
+ Hotkey_Register(&shk);
- shk.ptszDescription=LPGENT("Restore last status");
- shk.pszName="RestoreLastStatus";
- shk.ptszSection=LPGENT("Status");
- shk.pszService="CLIST/HK/RestoreStatus";
- shk.DefHotKey=0;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk);
+ shk.pszDescription = LPGEN("Restore last status");
+ shk.pszName = "RestoreLastStatus";
+ shk.pszSection = LPGEN("Status");
+ shk.pszService = "CLIST/HK/RestoreStatus";
+ Hotkey_Register(&shk);
return 0;
}
diff --git a/plugins/Clist_mw/keyboard.cpp b/plugins/Clist_mw/keyboard.cpp index 361a4f56f5..d099fab37c 100644 --- a/plugins/Clist_mw/keyboard.cpp +++ b/plugins/Clist_mw/keyboard.cpp @@ -39,26 +39,23 @@ INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) int InitSkinHotKeys(void)
{
- HOTKEYDESC shk = {0};
-
CreateServiceFunction("CLIST/HK/CloseMiranda",hkCloseMiranda);
CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus);
+ HOTKEYDESC shk = {0};
shk.cbSize = sizeof(shk);
- shk.pszDescription = "Close Miranda";
+ shk.pszDescription = LPGEN("Close Miranda");
shk.pszName = "CloseMiranda";
shk.pszSection = "Main";
shk.pszService = "CLIST/HK/CloseMiranda";
- shk.DefHotKey = 0;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk);
+ Hotkey_Register(&shk);
- shk.pszDescription = "Restore last status";
+ shk.pszDescription = LPGEN("Restore last status");
shk.pszName = "RestoreLastStatus";
shk.pszSection = "Status";
shk.pszService = "CLIST/HK/RestoreStatus";
- shk.DefHotKey = 0;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk);
+ Hotkey_Register(&shk);
return 0;
}
diff --git a/plugins/Console/Console.c b/plugins/Console/Console.c index 7f752d36de..360065eb41 100644 --- a/plugins/Console/Console.c +++ b/plugins/Console/Console.c @@ -1259,12 +1259,9 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole);
-
- if (ServiceExists(MS_FONT_REGISTERT))
{
FontIDT fid={0};
-
- fid.cbSize=sizeof(fid);
+ fid.cbSize = sizeof(fid);
_tcscpy(fid.group,_T("Console"));
_tcscpy(fid.name,TranslateT("Text"));
strcpy(fid.dbSettingsGroup,"Console");
@@ -1286,11 +1283,10 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange);
}
- if (ServiceExists(MS_COLOUR_REGISTERT))
- {
- ColourIDT cid = {0};
+ {
+ ColourIDT cid = {0};
- cid.cbSize=sizeof(cid);
+ cid.cbSize=sizeof(cid);
_tcscpy(cid.group,_T("Console"));
_tcscpy(cid.name,_T("Background"));
strcpy(cid.dbSettingsGroup,"Console");
@@ -1301,28 +1297,23 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) CallService(MS_COLOUR_REGISTERT,(WPARAM)&cid,0);
hHooks[i++] = HookEvent(ME_COLOUR_RELOAD, OnColourChange);
- }
-
- if (ServiceExists(MS_HOTKEY_REGISTER))
- {
- HOTKEYDESC hkd = {0};
-
- hkd.cbSize=sizeof(hkd);
+ }
+ {
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
hkd.pszName = "Console_Show_Hide";
- hkd.pszDescription = Translate("Show/Hide Console");
+ hkd.pszDescription = LPGEN("Show/Hide Console");
hkd.pszSection = "Main";
hkd.pszService = MS_CONSOLE_SHOW_HIDE;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C');
+ Hotkey_Register(&hkd);
+ }
- CallService(MS_HOTKEY_REGISTER,(WPARAM)0,(LPARAM)&hkd);
- }
-
- if (ServiceExists(MS_TB_ADDBUTTON))
- {
+ if (ServiceExists(MS_TB_ADDBUTTON)) {
SKINICONDESC sid={0};
- TBButton tbb = {0};
- char szModuleFileName[MAX_PATH]={0};
+ TBButton tbb = {0};
+ char szModuleFileName[MAX_PATH]={0};
GetModuleFileNameA(hInst,szModuleFileName,MAX_PATH);
diff --git a/plugins/FavContacts/resource.h b/plugins/FavContacts/resource.h index 4e3f557cf7..9466fd8859 100644 --- a/plugins/FavContacts/resource.h +++ b/plugins/FavContacts/resource.h @@ -24,7 +24,6 @@ #define IDC_BTN_FONTS 1015
#define IDC_TXT_RADIUS2 1016
#define IDC_TXT_MAXRECENT 1016
-#define IDC_BTN_HOTKEYS 1018
#define IDC_CHK_RIGHTAVATARS 1019
// Next default values for new objects
diff --git a/plugins/FavContacts/resource.rc b/plugins/FavContacts/resource.rc index a96aabaf04..1aa618c55d 100644 --- a/plugins/FavContacts/resource.rc +++ b/plugins/FavContacts/resource.rc @@ -60,7 +60,6 @@ BEGIN CONTROL "Enable groups",IDC_CHK_GROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,17,137,10
CONTROL "Multicolumn menu",IDC_CHK_GROUPCOLUMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,30,122,10
CONTROL "Configure fonts and colors...",IDC_BTN_FONTS,"Hyperlink",WS_TABSTOP,11,229,137,11
- CONTROL "Set up menu hotkey...",IDC_BTN_HOTKEYS,"Hyperlink",WS_TABSTOP,11,218,137,11
CONTROL "Align to the right",IDC_CHK_RIGHTAVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,69,122,10
CONTROL "Dim idle contact icons",IDC_CHK_DIMIDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,121,139,10
RTEXT "Show",IDC_STATIC,12,160,34,10,SS_CENTERIMAGE
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index a48cb4f536..c6dfaa7bb1 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -182,8 +182,7 @@ int ProcessReloadFonts(WPARAM wParam, LPARAM lParam) int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_MSG_ADDICON))
- {
+ if (ServiceExists(MS_MSG_ADDICON)) {
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
sid.szModule = "FavContacts";
@@ -196,81 +195,78 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_MSG_WINDOWEVENT, ProcessSrmmEvent);
}
- if (true /* ServiceExists(MS_FONT_REGISTERT) */)
- {
- //LOGFONT lf;
- //GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
-
- FontIDT fontid = {0};
- fontid.cbSize = sizeof(fontid);
- lstrcpy(fontid.group, _T("Favourite Contacts"));
- lstrcpyA(fontid.dbSettingsGroup, "FavContacts");
- lstrcpy(fontid.backgroundGroup, _T("Favourite Contacts"));
- fontid.flags = FIDF_DEFAULTVALID;
- fontid.deffontsettings.charset = DEFAULT_CHARSET;
- fontid.deffontsettings.size = -11;
- lstrcpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"));
- fontid.deffontsettings.style = 0;
-
- lstrcpy(fontid.backgroundName, _T("Background"));
-
- lstrcpy(fontid.name, _T("Contact name"));
- lstrcpyA(fontid.prefix, "fntName");
- fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT);
- fontid.deffontsettings.style = DBFONTF_BOLD;
- CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
-
- lstrcpy(fontid.name, _T("Second line"));
- lstrcpyA(fontid.prefix, "fntSecond");
- fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU));
- fontid.deffontsettings.style = 0;
- CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
-
- lstrcpy(fontid.backgroundName, _T("Selected background"));
-
- lstrcpy(fontid.name, _T("Selected contact name (color)"));
- lstrcpyA(fontid.prefix, "fntNameSel");
- fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT);
- fontid.deffontsettings.style = DBFONTF_BOLD;
- CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
-
- lstrcpy(fontid.name, _T("Selected second line (color)"));
- lstrcpyA(fontid.prefix, "fntSecondSel");
- fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT));
- fontid.deffontsettings.style = 0;
- CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
-
- ColourIDT colourid = {0};
- colourid.cbSize = sizeof(colourid);
- lstrcpy(colourid.group, _T("Favourite Contacts"));
- lstrcpyA(colourid.dbSettingsGroup, "FavContacts");
-
- lstrcpy(colourid.name, _T("Background"));
- lstrcpyA(colourid.setting, "BackColour");
- colourid.defcolour = GetSysColor(COLOR_MENU);
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0);
-
- lstrcpy(colourid.name, _T("Selected background"));
- lstrcpyA(colourid.setting, "SelectedColour");
- colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0);
-
- HookEvent(ME_FONT_RELOAD, ProcessReloadFonts);
- HookEvent(ME_COLOUR_RELOAD, ProcessReloadFonts);
- ProcessReloadFonts(0, 0);
- }
+ /////////////////////////////////////////////////////////////////////////////////////
- if (ServiceExists(MS_HOTKEY_REGISTER))
- {
- HOTKEYDESC hotkey = {0};
- hotkey.cbSize = sizeof(hotkey);
- hotkey.pszName = "FavContacts/ShowMenu";
- hotkey.pszDescription = "Show favourite contacts";
- hotkey.pszSection = "Contacts";
- hotkey.pszService = MS_FAVCONTACTS_SHOWMENU_CENTERED;
- hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hotkey);
- }
+ FontIDT fontid = {0};
+ fontid.cbSize = sizeof(fontid);
+ lstrcpy(fontid.group, _T("Favourite Contacts"));
+ lstrcpyA(fontid.dbSettingsGroup, "FavContacts");
+ lstrcpy(fontid.backgroundGroup, _T("Favourite Contacts"));
+ fontid.flags = FIDF_DEFAULTVALID;
+ fontid.deffontsettings.charset = DEFAULT_CHARSET;
+ fontid.deffontsettings.size = -11;
+ lstrcpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"));
+ fontid.deffontsettings.style = 0;
+
+ lstrcpy(fontid.backgroundName, _T("Background"));
+
+ lstrcpy(fontid.name, _T("Contact name"));
+ lstrcpyA(fontid.prefix, "fntName");
+ fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT);
+ fontid.deffontsettings.style = DBFONTF_BOLD;
+ CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
+
+ lstrcpy(fontid.name, _T("Second line"));
+ lstrcpyA(fontid.prefix, "fntSecond");
+ fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU));
+ fontid.deffontsettings.style = 0;
+ CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
+
+ lstrcpy(fontid.backgroundName, _T("Selected background"));
+
+ lstrcpy(fontid.name, _T("Selected contact name (color)"));
+ lstrcpyA(fontid.prefix, "fntNameSel");
+ fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT);
+ fontid.deffontsettings.style = DBFONTF_BOLD;
+ CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
+
+ lstrcpy(fontid.name, _T("Selected second line (color)"));
+ lstrcpyA(fontid.prefix, "fntSecondSel");
+ fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT));
+ fontid.deffontsettings.style = 0;
+ CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ ColourIDT colourid = {0};
+ colourid.cbSize = sizeof(colourid);
+ lstrcpy(colourid.group, _T("Favourite Contacts"));
+ lstrcpyA(colourid.dbSettingsGroup, "FavContacts");
+
+ lstrcpy(colourid.name, _T("Background"));
+ lstrcpyA(colourid.setting, "BackColour");
+ colourid.defcolour = GetSysColor(COLOR_MENU);
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0);
+
+ lstrcpy(colourid.name, _T("Selected background"));
+ lstrcpyA(colourid.setting, "SelectedColour");
+ colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0);
+
+ HookEvent(ME_FONT_RELOAD, ProcessReloadFonts);
+ HookEvent(ME_COLOUR_RELOAD, ProcessReloadFonts);
+ ProcessReloadFonts(0, 0);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ HOTKEYDESC hotkey = {0};
+ hotkey.cbSize = sizeof(hotkey);
+ hotkey.pszName = "FavContacts/ShowMenu";
+ hotkey.pszDescription = "Show favourite contacts";
+ hotkey.pszSection = "Contacts";
+ hotkey.pszService = MS_FAVCONTACTS_SHOWMENU_CENTERED;
+ hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT);
+ Hotkey_Register(&hotkey);
if (ServiceExists(MS_AV_GETAVATARBITMAP))
{
@@ -301,6 +297,8 @@ int ProcessOptInitialise(WPARAM wParam, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Load(PLUGINLINK * link)
{
pluginLink = link;
@@ -342,41 +340,40 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) HookEvent(ME_SYSTEM_MODULESLOADED, ProcessModulesLoaded);
hhkProcessTBLoaded = HookEvent(ME_TB_MODULELOADED, ProcessTBLoaded);
- if (true /*ServiceExists(MS_SKIN2_ADDICON)*/)
- {
- TCHAR buf[MAX_PATH];
- GetModuleFileName(g_hInst, buf, SIZEOF(buf));
+ /////////////////////////////////////////////////////////////////////////////////////
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
- sid.ptszSection = _T("Favourites");
- sid.ptszDefaultFile = buf;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_ALL_TCHAR;
-
- sid.pszName = "favcontacts_favourite";
- sid.ptszDescription = _T("Favourite Contact");
- sid.iDefaultIndex = -IDI_FAVOURITE;
- g_icoFavourite = CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
-
- sid.pszName = "favcontacts_regular";
- sid.ptszDescription = _T("Regular Contact");
- sid.iDefaultIndex = -IDI_REGULAR;
- g_icoRegular = CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- }
+ TCHAR buf[MAX_PATH];
+ GetModuleFileName(g_hInst, buf, SIZEOF(buf));
+
+ SKINICONDESC sid = {0};
+ sid.cbSize = sizeof(sid);
+ sid.ptszSection = _T("Favourites");
+ sid.ptszDefaultFile = buf;
+ sid.cx = sid.cy = 16;
+ sid.flags = SIDF_ALL_TCHAR;
+
+ sid.pszName = "favcontacts_favourite";
+ sid.ptszDescription = _T("Favourite Contact");
+ sid.iDefaultIndex = -IDI_FAVOURITE;
+ g_icoFavourite = CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ sid.pszName = "favcontacts_regular";
+ sid.ptszDescription = _T("Regular Contact");
+ sid.iDefaultIndex = -IDI_REGULAR;
+ g_icoRegular = CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
LoadHttpApi();
-#ifdef _DEBUG
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
- mi.position = 1900000000;
- mi.pszName = LPGEN("&Favourite Contacts...");
- mi.pszService = MS_FAVCONTACTS_SHOWMENU;
- Menu_AddMainMenuItem(&mi);
-#endif
+ #ifdef _DEBUG
+ CLISTMENUITEM mi = { 0 };
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIF_ICONFROMICOLIB;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
+ mi.position = 1900000000;
+ mi.pszName = LPGEN("&Favourite Contacts...");
+ mi.pszService = MS_FAVCONTACTS_SHOWMENU;
+ Menu_AddMainMenuItem(&mi);
+ #endif
return 0;
}
@@ -1171,8 +1168,7 @@ static void sttActivateOptionsPage(HWND hwnd, TCHAR *aSection, TCHAR *aPage) TCHAR *section = TranslateTS(aSection);
HWND hwndTree = FindWindowEx(GetParent(hwnd), NULL, WC_TREEVIEW, NULL);
- for (HTREEITEM htiSection = TreeView_GetRoot(hwndTree); htiSection; htiSection = TreeView_GetNextSibling(hwndTree, htiSection))
- {
+ for (HTREEITEM htiSection = TreeView_GetRoot(hwndTree); htiSection; htiSection = TreeView_GetNextSibling(hwndTree, htiSection)) {
TVITEM tvi = {0};
tvi.mask = TVIF_TEXT;
tvi.hItem = htiSection;
@@ -1180,20 +1176,15 @@ static void sttActivateOptionsPage(HWND hwnd, TCHAR *aSection, TCHAR *aPage) tvi.cchTextMax = SIZEOF(buf);
TreeView_GetItem(hwndTree, &tvi);
- if (!lstrcmp(buf, section))
- {
- if (!aPage)
- {
+ if (!lstrcmp(buf, section)) {
+ if (!aPage) {
TreeView_Select(hwndTree, htiSection, TVGN_CARET);
return;
- } else
- {
- TreeView_Expand(hwndTree, htiSection, TVE_EXPAND);
}
+ else TreeView_Expand(hwndTree, htiSection, TVE_EXPAND);
TCHAR *page = TranslateTS(aPage);
- for (HTREEITEM htiPage = TreeView_GetChild(hwndTree, htiSection); htiPage; htiPage = TreeView_GetNextSibling(hwndTree, htiPage))
- {
+ for (HTREEITEM htiPage = TreeView_GetChild(hwndTree, htiSection); htiPage; htiPage = TreeView_GetNextSibling(hwndTree, htiPage)) {
TVITEM tvi = {0};
tvi.mask = TVIF_TEXT;
tvi.hItem = htiPage;
@@ -1201,8 +1192,7 @@ static void sttActivateOptionsPage(HWND hwnd, TCHAR *aSection, TCHAR *aPage) tvi.cchTextMax = SIZEOF(buf);
TreeView_GetItem(hwndTree, &tvi);
- if (!lstrcmp(buf, page))
- {
+ if (!lstrcmp(buf, page)) {
TreeView_Select(hwndTree, htiPage, TVGN_CARET);
return;
}
@@ -1254,9 +1244,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0));
}
- if (!ServiceExists(MS_HOTKEY_REGISTER))
- EnableWindow(GetDlgItem(hwnd, IDC_BTN_HOTKEYS), FALSE);
-
bInitialized = true;
PostMessage(hwnd, WM_APP, 0, 0);
@@ -1340,13 +1327,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA PostMessage(hwnd, WM_APP, 0, 0);
break;
- case IDC_BTN_HOTKEYS:
- if (ServiceExists(MS_HOTKEY_REGISTER))
- {
- sttActivateOptionsPage(hwnd, _T("Customize"), _T("Hotkeys"));
- }
- break;
-
case IDC_BTN_FONTS:
sttActivateOptionsPage(hwnd, _T("Customize"), _T("Fonts"));
break;
diff --git a/plugins/FloatingContacts/main.cpp b/plugins/FloatingContacts/main.cpp index fc098001d3..f05fda305d 100644 --- a/plugins/FloatingContacts/main.cpp +++ b/plugins/FloatingContacts/main.cpp @@ -1086,22 +1086,21 @@ static void LoadMenus() mi.pszService = sModule "/MainHideAllThumbs";
Menu_AddMainMenuItem(&mi);
- if (ServiceExists(MS_HOTKEY_REGISTER)) {
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
- hkd.pszSection = "Floating Contacts";
+ // Register hotkeys
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.pszSection = "Floating Contacts";
- hkd.pszName = sModule "/MainHideAllThumbs";
- hkd.pszDescription = "Show/Hide all thumbs";
- hkd.pszService = sModule "/MainHideAllThumbs";
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
-
- hHideWhenCListShow = CreateServiceFunction( sModule "/HideWhenCListShow", OnHotKey_HideWhenCListShow );
- hkd.pszName = sModule "/HideWhenCListShow";
- hkd.pszDescription = "Hide when contact list is shown";
- hkd.pszService = sModule "/HideWhenCListShow";
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
- }
+ hkd.pszName = sModule "/MainHideAllThumbs";
+ hkd.pszDescription = LPGEN("Show/Hide all thumbs");
+ hkd.pszService = sModule "/MainHideAllThumbs";
+ Hotkey_Register(&hkd);
+
+ hHideWhenCListShow = CreateServiceFunction( sModule "/HideWhenCListShow", OnHotKey_HideWhenCListShow );
+ hkd.pszName = sModule "/HideWhenCListShow";
+ hkd.pszDescription = LPGEN("Hide when contact list is shown");
+ hkd.pszService = sModule "/HideWhenCListShow";
+ Hotkey_Register(&hkd);
}
diff --git a/plugins/ListeningTo/listeningto.cpp b/plugins/ListeningTo/listeningto.cpp index 68df0a7218..486a32b7a2 100644 --- a/plugins/ListeningTo/listeningto.cpp +++ b/plugins/ListeningTo/listeningto.cpp @@ -495,28 +495,26 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) }
// Hotkeys support
- if (ServiceExists(MS_HOTKEY_REGISTER))
- {
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
- hkd.pszSection = Translate("Listening to");
-
- hkd.pszService = MS_LISTENINGTO_HOTKEYS_ENABLE;
- hkd.pszName = "ListeningTo/EnableAll";
- hkd.pszDescription = Translate("Send to all protocols");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
-
- hkd.pszService = MS_LISTENINGTO_HOTKEYS_DISABLE;
- hkd.pszName = "ListeningTo/DisableAll";
- hkd.pszDescription = Translate("Don't send to any protocols");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
-
- hkd.pszService = MS_LISTENINGTO_HOTKEYS_TOGGLE;
- hkd.pszName = "ListeningTo/ToggleAll";
- hkd.pszDescription = Translate("Toggle send to all protocols");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
- }
-
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.pszSection = LPGEN("Listening to");
+
+ hkd.pszService = MS_LISTENINGTO_HOTKEYS_ENABLE;
+ hkd.pszName = "ListeningTo/EnableAll";
+ hkd.pszDescription = 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");
+ Hotkey_Register(&hkd);
+
+ hkd.pszService = MS_LISTENINGTO_HOTKEYS_TOGGLE;
+ hkd.pszName = "ListeningTo/ToggleAll";
+ hkd.pszDescription = LPGEN("Toggle send to all protocols");
+ Hotkey_Register(&hkd);
+
+ //
SetListeningInfos(NULL);
StartTimer();
diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index f0f5ea8d69..eef80fc3f4 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -35,7 +35,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hkd.pszService = MODNAME"/CheckUpdates";
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
hkd.lParam = FALSE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
if (AllowUpdateOnStartup())
DoCheck(UpdateOnStartup, (int)CheckThread);
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 73920652fb..a239965695 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -367,13 +367,13 @@ void LoadHotkey() { hk.ptszDescription = LPGENT("Toggle Popups");
hk.ptszSection = LPGENT(MODULNAME_PLU);
hk.pszService = MENUCOMMAND_SVC;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk);
+ Hotkey_Register( &hk);
// 'Popup History' Hotkey
hk.pszName = "Popup History";
hk.ptszDescription = LPGENT("Popup History");
hk.pszService = MENUCOMMAND_HISTORY;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk);
+ Hotkey_Register( &hk);
}
//menu
diff --git a/plugins/RecentContacts/RecentContacts.cpp b/plugins/RecentContacts/RecentContacts.cpp index 3e43af0daa..8e9f4d8c07 100644 --- a/plugins/RecentContacts/RecentContacts.cpp +++ b/plugins/RecentContacts/RecentContacts.cpp @@ -609,17 +609,15 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) }
*/
- if (ServiceExists(MS_HOTKEY_REGISTER)) {
- // hotkeys
- HOTKEYDESC hotkey = {0};
- hotkey.cbSize = sizeof(hotkey);
- hotkey.pszName = msLastUC_ShowList;
- hotkey.pszDescription = LPGEN("Show Recent Contacts");
- hotkey.pszSection = "Contacts";
- hotkey.pszService = msLastUC_ShowList;
- hotkey.DefHotKey = MAKEWORD('R', HOTKEYF_CONTROL | HOTKEYF_SHIFT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hotkey);
- }
+ // hotkeys
+ HOTKEYDESC hk = {0};
+ hk.cbSize = sizeof(hk);
+ hk.pszName = msLastUC_ShowList;
+ hk.pszDescription = LPGEN("Show Recent Contacts");
+ hk.pszSection = "Contacts";
+ hk.pszService = msLastUC_ShowList;
+ hk.DefHotKey = MAKEWORD('R', HOTKEYF_CONTROL | HOTKEYF_SHIFT);
+ Hotkey_Register(&hk);
return 0;
}
diff --git a/plugins/Scriver/input.c b/plugins/Scriver/input.c index c941479b60..57480d0a3c 100644 --- a/plugins/Scriver/input.c +++ b/plugins/Scriver/input.c @@ -299,21 +299,21 @@ void RegisterKeyBindings() { desc.pszDescription = "Navigate: Previous Tab";
desc.lParam = KB_PREV_TAB;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_TAB);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_PRIOR);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, VK_LEFT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Nav/Next Tab";
desc.pszDescription = "Navigate: Next Tab";
desc.lParam = KB_NEXT_TAB;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_TAB);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_NEXT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, VK_RIGHT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = strName;
desc.pszDescription = strDesc;
for (i = 0; i < 9; i++) {
@@ -321,70 +321,70 @@ void RegisterKeyBindings() { mir_snprintf(strDesc, SIZEOF(strDesc), "Navigate: Tab %d", i + 1);
desc.lParam = KB_TAB1 + i;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '1' + i);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
}
desc.pszName = "Scriver/Wnd/Toggle Statusbar";
desc.pszDescription = "Window: Toggle Statusbar";
desc.lParam = KB_SWITCHSTATUSBAR;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'S');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Toggle Titlebar";
desc.pszDescription = "Window: Toggle Titlebar";
desc.lParam = KB_SWITCHTITLEBAR;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'M');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Toggle Toolbar";
desc.pszDescription = "Window: Toggle Toolbar";
desc.lParam = KB_SWITCHTOOLBAR;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'T');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Toggle Infobar";
desc.pszDescription = "Window: Toggle Infobar";
desc.lParam = KB_SWITCHINFOBAR;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'N');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Clear Log";
desc.pszDescription = "Window: Clear Log";
desc.lParam = KB_CLEAR_LOG;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'L');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Minimize";
desc.pszDescription = "Window: Minimize";
desc.lParam = KB_MINIMIZE;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT, VK_ESCAPE);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Wnd/Close Tab";
desc.pszDescription = "Window: Close Tab";
desc.lParam = KB_CLOSE;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F4);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'W');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Action/Quote";
desc.pszDescription = "Action: Quote";
desc.lParam = KB_QUOTE;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'Q');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Action/Send All";
desc.pszDescription = "Action: Send to All";
desc.lParam = KB_SEND_ALL;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_RETURN);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
desc.pszName = "Scriver/Action/PasteSend";
desc.pszDescription = "Action: Paste & Send";
desc.lParam = KB_PASTESEND;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_INSERT);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &desc);
+ Hotkey_Register( &desc);
}
BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK *lParam) {
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 496b279efd..a002af0f87 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -926,22 +926,22 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hkd.pszName = "OpenSessionsManager";
hkd.ptszDescription = _T("Open Sessions Manager");
hkd.pszService = MS_SESSIONS_OPENMANAGER;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "RestoreLastSession";
hkd.ptszDescription = _T("Restore last Session");
hkd.pszService = MS_SESSIONS_RESTORELASTSESSION;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "SaveSession";
hkd.ptszDescription = _T("Save Session");
hkd.pszService = MS_SESSIONS_SAVEUSERSESSION;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "CloseSession";
hkd.ptszDescription = _T("Close Session");
hkd.pszService = MS_SESSIONS_CLOSESESSION;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hiChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_CHECKED));
hiNotChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_UNCHECKED));
diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index f2d3e16613..ae103b715a 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -1642,7 +1642,7 @@ void RegisterHotkey(void) hkd.ptszSection = _T("Status Message");
hkd.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_OEM_3);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
}
static int OnIconsChanged(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/SpellChecker/spellchecker.cpp b/plugins/SpellChecker/spellchecker.cpp index c121b57cda..348e15a51c 100644 --- a/plugins/SpellChecker/spellchecker.cpp +++ b/plugins/SpellChecker/spellchecker.cpp @@ -373,18 +373,14 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) } } - if (ServiceExists(MS_HOTKEY_REGISTER)) - { - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); - hkd.pszName = "Spell Checker/Toggle"; - hkd.ptszSection = LPGENT("Spell Checker"); - hkd.ptszDescription = LPGENT("Enable/disable spell checker"); - hkd.dwFlags = HKD_TCHAR; -// hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_ALT, 'S'); - hkd.lParam = HOTKEY_ACTION_TOGGLE; - CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hkd); - } + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.pszName = "Spell Checker/Toggle"; + hkd.pszSection = LPGEN("Spell Checker"); + hkd.pszDescription = LPGEN("Enable/disable spell checker"); + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_ALT, 'S'); + hkd.lParam = HOTKEY_ACTION_TOGGLE; + Hotkey_Register( &hkd); loaded = TRUE; diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 919171c7f0..e0935bcdb6 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -359,12 +359,12 @@ static int ModulesLoaded(WPARAM, LPARAM) hk.pszDescription = LPGEN("Copy Version Info to clipboard");
hk.pszName = "CopyVerInfo";
hk.pszService = MS_CRASHDUMPER_STORETOCLIP;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hk);
+ Hotkey_Register(&hk);
hk.pszDescription = LPGEN("Show Version Info");
hk.pszName = "ShowVerInfo";
hk.pszService = MS_CRASHDUMPER_VIEWINFO;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hk);
+ Hotkey_Register(&hk);
if (servicemode) ViewVersionInfo(0, 0);
else
diff --git a/plugins/Svc_dbepp/main.cpp b/plugins/Svc_dbepp/main.cpp index dd6da983e4..7ec81267a3 100644 --- a/plugins/Svc_dbepp/main.cpp +++ b/plugins/Svc_dbepp/main.cpp @@ -323,11 +323,9 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = 1900000001;
- mi.flags = CMIF_TCHAR;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
- mi.ptszName = _T(modFullname);
+ mi.pszName = modFullname;
mi.pszService = "DBEditorpp/MenuCommand";
- mi.pszContactOwner = NULL;
Menu_AddMainMenuItem(&mi);
ZeroMemory(&mi, sizeof(mi));
@@ -335,9 +333,8 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) mi.position = 1900000001;
mi.flags = DBGetContactSettingByte(NULL,modname,"UserMenuItem",0)?0:CMIF_HIDDEN;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER));
- mi.ptszName = LPGENT("Open user tree in DBE++");
+ mi.pszName = LPGEN("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
- mi.pszContactOwner = NULL;
hUserMenu = Menu_AddContactMenuItem(&mi);
sServicemodeLaunch = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
@@ -345,29 +342,22 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) CallService("DBEditorpp/RegisterSingleModule",(WPARAM)modname,0);
// Ensure that the common control DLL is loaded.
- {
- INITCOMMONCONTROLSEX icex;
-
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&icex);
- }
+ INITCOMMONCONTROLSEX icex;
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ icex.dwICC = ICC_LISTVIEW_CLASSES;
+ InitCommonControlsEx(&icex);
ZeroMemory(&WatchListArray, sizeof(WatchListArray));
- if(ServiceExists(MS_HOTKEY_REGISTER))
- {
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
- hkd.dwFlags = HKD_TCHAR;
- hkd.pszName = "hk_dbepp_open";
- hkd.pszService = "DBEditorpp/MenuCommand";
- hkd.ptszDescription = LPGENT("Open Database Editor");
- hkd.ptszSection = _T(modFullname);
- hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'D');
-
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hkd);
- }
+ // Register hotkeys
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.pszName = "hk_dbepp_open";
+ hkd.pszService = "DBEditorpp/MenuCommand";
+ hkd.ptszDescription = LPGEN("Open Database Editor");
+ hkd.ptszSection = modFullname;
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT|HOTKEYF_EXT, 'D');
+ Hotkey_Register(&hkd);
return 0;
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index ef5eeaf3af..65f8da6228 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -167,7 +167,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP for(i = 0; i < safe_sizeof(_hotkeydescs); i++) {
_hotkeydescs[i].cbSize = sizeof(HOTKEYDESC);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&_hotkeydescs[i]);
+ Hotkey_Register(&_hotkeydescs[i]);
}
WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated");
diff --git a/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp index c1828bfc5b..b6f0e43207 100644 --- a/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp @@ -95,14 +95,14 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL;
hkd.lParam = FALSE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "TranslitSwitcher/ConvertLastOrSelected";
hkd.ptszDescription = _T("Convert Last / Selected");
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT+HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL;
hkd.lParam = TRUE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "TranslitSwitcher/TranslitAllOrSelected";
hkd.ptszDescription = _T("Translit All / Selected");
@@ -110,14 +110,14 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL;
hkd.lParam = FALSE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "TranslitSwitcher/TranslitLastOrSelected";
hkd.ptszDescription = _T("Translit Last / Selected");
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT+HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL;
hkd.lParam = TRUE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "TranslitSwitcher/InvertCaseAllOrSelected";
hkd.ptszDescription = _T("Invert Case All / Selected");
@@ -125,14 +125,14 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL;
hkd.lParam = FALSE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hkd.pszName = "TranslitSwitcher/InvertCaseLastOrSelected";
hkd.ptszDescription = _T("Invert Case Last / Selected");
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT+HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL;
hkd.lParam = TRUE;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
if (ServiceExists(MS_BB_ADDBUTTON) && ServiceExists(MS_SKIN2_ADDICON))
diff --git a/plugins/Updater/updater.cpp b/plugins/Updater/updater.cpp index 531689e5d1..8d6d3f9b2a 100644 --- a/plugins/Updater/updater.cpp +++ b/plugins/Updater/updater.cpp @@ -154,31 +154,28 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
}
- if (ServiceExists(MS_HOTKEY_REGISTER))
- {
- HOTKEYDESC shk = {0};
-
- shk.cbSize = sizeof(shk);
- shk.pszSection = LPGEN("Updater");
-
- shk.pszDescription = LPGEN("Check for Updates");
- shk.pszName = "Update";
- shk.pszService = MS_UPDATE_CHECKFORUPDATES;
-// shk.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'U') | HKF_MIRANDA_LOCAL;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
-
- shk.pszDescription = LPGEN("Restart");
- shk.pszName = "Restart";
- shk.pszService = MS_UPDATE_MENURESTART;
-// shk.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'R') | HKF_MIRANDA_LOCAL;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
-
- shk.pszDescription = LPGEN("Update and Exit");
- shk.pszName = "UpdateAndExit";
- shk.pszService = MS_UPDATE_MENUUPDATEANDEXIT;
- shk.DefHotKey = 0;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
- }
+ // register hotkeys
+ HOTKEYDESC shk = {0};
+ shk.cbSize = sizeof(shk);
+ shk.pszSection = LPGEN("Updater");
+
+ shk.pszDescription = LPGEN("Check for Updates");
+ shk.pszName = "Update";
+ shk.pszService = MS_UPDATE_CHECKFORUPDATES;
+ shk.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'U') | HKF_MIRANDA_LOCAL;
+ Hotkey_Register(&shk);
+
+ shk.pszDescription = LPGEN("Restart");
+ shk.pszName = "Restart";
+ shk.pszService = MS_UPDATE_MENURESTART;
+ shk.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'R') | HKF_MIRANDA_LOCAL;
+ Hotkey_Register(&shk);
+
+ shk.pszDescription = LPGEN("Update and Exit");
+ shk.pszName = "UpdateAndExit";
+ shk.pszService = MS_UPDATE_MENUUPDATEANDEXIT;
+ shk.DefHotKey = 0;
+ Hotkey_Register(&shk);
return 0;
}
diff --git a/plugins/UserInfoEx/dlg_anniversarylist.cpp b/plugins/UserInfoEx/dlg_anniversarylist.cpp index a4e24cae9b..60718f5861 100644 --- a/plugins/UserInfoEx/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/dlg_anniversarylist.cpp @@ -1129,15 +1129,13 @@ VOID DlgAnniversaryListOnToolBarLoaded() **/
VOID DlgAnniversaryListLoadModule()
{
- HOTKEYDESC hk;
-
myCreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow);
- ZeroMemory(&hk, sizeof(HOTKEYDESC));
+ HOTKEYDESC hk = { 0 };
hk.cbSize = sizeof(HOTKEYDESC);
hk.pszSection = MODNAME;
hk.pszName = "AnniversaryList";
hk.pszDescription = LPGEN("Popup Anniversary list");
hk.pszService = MS_USERINFO_REMINDER_LIST;
- CallService(MS_HOTKEY_REGISTER, NULL, (LPARAM)&hk);
+ Hotkey_Register(&hk);
}
diff --git a/plugins/UserInfoEx/svc_refreshci.cpp b/plugins/UserInfoEx/svc_refreshci.cpp index fa3b00a584..b5e84d004a 100644 --- a/plugins/UserInfoEx/svc_refreshci.cpp +++ b/plugins/UserInfoEx/svc_refreshci.cpp @@ -932,5 +932,5 @@ VOID SvcRefreshContactInfoLoadModule(VOID) hk.pszName = "RefreshContactDetails";
hk.pszDescription = LPGEN("Refresh Contact Details");
hk.pszService = MS_USERINFO_REFRESH;
- CallService(MS_HOTKEY_REGISTER, NULL, (LPARAM)&hk);
+ Hotkey_Register(&hk);
}
diff --git a/plugins/UserInfoEx/svc_reminder.cpp b/plugins/UserInfoEx/svc_reminder.cpp index 7899ccadc4..5b64720656 100644 --- a/plugins/UserInfoEx/svc_reminder.cpp +++ b/plugins/UserInfoEx/svc_reminder.cpp @@ -1210,13 +1210,14 @@ VOID SvcReminderLoadModule(VOID) myCreateServiceFunction(MS_USERINFO_REMINDER_CHECK, CheckService);
myCreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService);
+ // register hotkey
HOTKEYDESC hk = { 0 };
hk.cbSize = sizeof(HOTKEYDESC);
hk.pszSection = MODNAME;
hk.pszName = "ReminderCheck";
hk.pszDescription = LPGEN("Check anniversaries");
hk.pszService = MS_USERINFO_REMINDER_CHECK;
- CallService(MS_HOTKEY_REGISTER, NULL, (LPARAM)&hk);
+ Hotkey_Register(&hk);
}
/**
diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index bec98e9b4c..3b9d2dadef 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -97,7 +97,6 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraImageApply);
hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
hTopToolBarModuleLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
- //hContactSendMessage = HookEvent(ME_WWI_SENDMESSAGE, OnContactSendMessage);
SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, "WhenWasIt", "Birthday near");
SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, "WhenWasIt", "Birthday today");
@@ -155,22 +154,20 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) cl.pszName = "Add/change user &birthday";
hmAddChangeBirthday = Menu_AddMainMenuItem(&cl);
- if(ServiceExists(MS_HOTKEY_REGISTER)) {
- HOTKEYDESC hotkey = {0};
- hotkey.cbSize = sizeof(hotkey);
- hotkey.dwFlags = HKD_TCHAR;
- hotkey.ptszSection = LPGENT("Birthdays");
+ // Register hotkeys
+ HOTKEYDESC hotkey = {0};
+ hotkey.cbSize = sizeof(hotkey);
+ hotkey.pszSection = LPGEN("Birthdays");
- hotkey.pszName = "wwi_birthday_list";
- hotkey.ptszDescription = LPGENT("Birthday list");
- hotkey.pszService = MS_WWI_LIST_SHOW;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey);
+ hotkey.pszName = "wwi_birthday_list";
+ hotkey.pszDescription = LPGEN("Birthday list");
+ hotkey.pszService = MS_WWI_LIST_SHOW;
+ Hotkey_Register(&hotkey);
- hotkey.pszName = "wwi_check_birthdays";
- hotkey.ptszDescription = LPGENT("Check for birthdays");
- hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
- CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey);
- }
+ hotkey.pszName = "wwi_check_birthdays";
+ hotkey.ptszDescription = LPGENT("Check for birthdays");
+ hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
+ Hotkey_Register(&hotkey);
return 0;
}
diff --git a/protocols/JabberG/jabber_menu.cpp b/protocols/JabberG/jabber_menu.cpp index 827a32011c..e544102dec 100644 --- a/protocols/JabberG/jabber_menu.cpp +++ b/protocols/JabberG/jabber_menu.cpp @@ -942,19 +942,19 @@ void CJabberProto::GlobalMenuInit() strcpy(tDest, "/Groupchat");
hkd.ptszDescription = _T("Join conference");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
strcpy(tDest, "/Bookmarks");
hkd.ptszDescription = _T("Open bookmarks");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
strcpy(tDest, "/PrivacyLists");
hkd.ptszDescription = _T("Privacy lists");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
strcpy(tDest, "/ServiceDiscovery");
hkd.ptszDescription = _T("Service discovery");
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
}
static INT_PTR g_ToolbarHandleJoinGroupchat(WPARAM w, LPARAM l)
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp index f45e64e5d9..ae1567e986 100644 --- a/protocols/Twitter/proto.cpp +++ b/protocols/Twitter/proto.cpp @@ -66,7 +66,7 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username) mir_snprintf(text,SIZEOF(text),"%s/Tweet",m_szModuleName);
hkd.pszDescription = "Send Tweet";
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
signon_lock_ = CreateMutex(0,false,0);
avatar_lock_ = CreateMutex(0,false,0);
diff --git a/protocols/YAMN/main.cpp b/protocols/YAMN/main.cpp index 33a5fc186c..184fe0e3e1 100644 --- a/protocols/YAMN/main.cpp +++ b/protocols/YAMN/main.cpp @@ -513,7 +513,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) hkd.pszSection = YAMN_DBMODULE;
hkd.pszDescription = LPGEN("Check mail");
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11);
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
+ Hotkey_Register(&hkd);
//Create thread that will be executed every second
if (!(SecTimer = SetTimer(NULL, 0, 1000, (TIMERPROC)TimerProc)))
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index c9cc9212a9..f05f9c13ae 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -1362,7 +1362,7 @@ void InitCustomMenus(void) hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0);
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '0'+i) | HKF_MIRANDA_LOCAL;
hkd.pszService = MS_CLIST_HKSTATUS;
- statusHotkeys[i] = CallService(MS_HOTKEY_REGISTER, 0, LPARAM(&hkd));
+ statusHotkeys[i] = Hotkey_Register(&hkd);
}
HookEvent(ME_HOTKEYS_CHANGED, sttRebuildHotkeys);
diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 28fc6d7be4..2942f7137e 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -91,42 +91,42 @@ int InitClistHotKeys(void) shk.ptszSection = _T("Main");
shk.pszService = "CLIST/HK/SHOWHIDE";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'A');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
shk.ptszDescription = _T("Read Message");
shk.pszName = "ReadMessage";
shk.ptszSection = _T("Main");
shk.pszService = "CLIST/HK/Read";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'I');
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
/*
shk.pszDescription="Search in site";
shk.pszName="SearchInWeb";
shk.pszSection="Main";
shk.pszService="CLIST/HK/Search";
shk.DefHotKey=846;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
*/
shk.ptszDescription = _T("Open Options Page");
shk.pszName = "ShowOptions";
shk.ptszSection = _T("Main");
shk.pszService = "CLIST/HK/Opts";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'O') | HKF_MIRANDA_LOCAL;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
shk.ptszDescription = _T("Open Logging Options");
shk.pszName = "ShowLogOptions";
shk.ptszSection = _T("Main");
shk.pszService = "Netlib/Log/Win";
shk.DefHotKey = 0;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
shk.ptszDescription = _T("Open Find User Dialog");
shk.pszName = "FindUsers";
shk.ptszSection = _T("Main");
shk.pszService = "FindAdd/FindAddCommand";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'F') | HKF_MIRANDA_LOCAL;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
/*
shk.pszDescription="Close Miranda";
@@ -134,21 +134,21 @@ int InitClistHotKeys(void) shk.pszSection="Main";
shk.pszService="CLIST/HK/CloseMiranda";
shk.DefHotKey=0;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
shk.pszDescription="Restore last status";
shk.pszName="RestoreLastStatus";
shk.pszSection="Status";
shk.pszService="CLIST/HK/RestoreStatus";
shk.DefHotKey=0;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
shk.pszDescription="Set All Offline";
shk.pszName="AllOffline";
shk.pszSection="Status";
shk.pszService="CLIST/HK/AllOffline";
shk.DefHotKey=0;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk);
+ Hotkey_Register(&shk);
*/
return 0;
}
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 7d01f93a01..d535ad3769 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -28,16 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { HKT_GLOBAL, HKT_LOCAL, HKT_MANUAL, HKT_COUNT } THotkeyType;
-typedef struct _THotkeyItem THotkeyItem;
-struct _THotkeyItem
+struct THotkeyItem
{
THotkeyType type;
char *pszService, *pszName; // pszName is valid _only_ for "root" hotkeys
TCHAR *ptszSection, *ptszDescription;
- TCHAR *ptszSection_tr, *ptszDescription_tr;
LPARAM lParam;
WORD DefHotkey, Hotkey;
bool Enabled;
+ int hLangpack;
ATOM idHotkey;
THotkeyItem *rootHotkey;
@@ -50,14 +49,17 @@ struct _THotkeyItem bool OptEnabled;
bool UnregisterHotkey; // valid only during WM_APP message in options UI, used to remove unregistered hotkeys from options
+
+ __inline TCHAR* getSection() const { return LangPackTranslateStringT(hLangpack, ptszSection); }
+ __inline TCHAR* getDescr() const { return LangPackTranslateStringT(hLangpack, ptszDescription); }
};
static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)
{
int res;
- if (res = lstrcmp(p1->ptszSection_tr, p2->ptszSection_tr))
+ if (res = lstrcmp(p1->ptszSection, p2->ptszSection))
return res;
- if (res = lstrcmp(p1->ptszDescription_tr, p2->ptszDescription_tr))
+ if (res = lstrcmp(p1->ptszDescription, p2->ptszDescription))
return res;
if ( !p1->rootHotkey && p2->rootHotkey)
return -1;
@@ -179,9 +181,8 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->ptszSection = mir_a2u(desc->pszSection);
item->ptszDescription = mir_a2u(desc->pszDescription);
}
-
- item->ptszSection_tr = TranslateTS(item->ptszSection);
- item->ptszDescription_tr = TranslateTS(item->ptszDescription);
+
+ item->hLangpack = (int)wParam;
item->allowSubHotkeys = TRUE;
item->rootHotkey = NULL;
item->nSubHotkeys = 0;
@@ -521,7 +522,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) if ( !item->rootHotkey) {
lvi.mask = LVIF_TEXT|LVIF_IMAGE;
lvi.iSubItem = COL_NAME;
- lvi.pszText = item->ptszDescription_tr;
+ lvi.pszText = item->getDescr();
lvi.iImage = item->OptType;
ListView_SetItem(hwndList, &lvi);
@@ -592,13 +593,13 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP return lstrcmp(title1, title2);
if ( !item1) {
- if (res = lstrcmp(title1, item2->ptszSection_tr))
+ if (res = lstrcmp(title1, item1->getSection()))
return res;
return -1;
}
if ( !item2) {
- if (res = lstrcmp(item1->ptszSection_tr, title2))
+ if (res = lstrcmp(item1->getSection(), title2))
return res;
return 1;
}
@@ -615,8 +616,6 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) newItem->pszService = item->pszService ? mir_strdup(item->pszService) : NULL;
newItem->ptszSection = mir_tstrdup(item->ptszSection);
newItem->ptszDescription = mir_tstrdup(item->ptszDescription);
- newItem->ptszSection_tr = item->ptszSection_tr;
- newItem->ptszDescription_tr = item->ptszDescription_tr;
newItem->lParam = item->lParam;
mir_snprintf(buf, SIZEOF(buf), "mir_hotkey_%d_%d", g_pid, g_hotkeyCount++);
newItem->idHotkey = GlobalAddAtomA(buf);
@@ -702,7 +701,7 @@ static void sttBuildHotkeyList(HWND hwndList, TCHAR *section) lvi.iItem = nItems++;
lvi.iSubItem = 0;
lvi.lParam = 0;
- lvi.pszText = item->ptszSection_tr;
+ lvi.pszText = item->getSection();
ListView_InsertItem(hwndList, &lvi);
ListView_SetCheckState(hwndList, lvi.iItem, TRUE);
@@ -1268,7 +1267,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
if ( !item) continue;
- if ( !lstrcmp(item->ptszSection_tr, buf)) {
+ if ( !lstrcmp( item->getSection(), buf)) {
ListView_DeleteItem(lpnmhdr->hwndFrom, lvi.iItem);
--lvi.iItem;
--count;
@@ -1281,8 +1280,10 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LVITEM lvi = {0};
THotkeyItem *item = hotkeys[i];
- if (item->OptDeleted) continue;
- if (lstrcmp(buf, item->ptszSection_tr)) continue;
+ if (item->OptDeleted)
+ continue;
+ if ( lstrcmp(buf, item->getSection()))
+ continue;
lvi.mask = LVIF_PARAM|LVIF_INDENT;
lvi.iIndent = 1;
@@ -1418,10 +1419,10 @@ 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_REGISTER, svcHotkeyRegister);
- CreateServiceFunction(MS_HOTKEY_UNREGISTER, svcHotkeyUnregister);
CreateServiceFunction(MS_HOTKEY_CHECK, svcHotkeyCheck);
HookEvent(ME_SYSTEM_MODULESLOADED, sttModulesLoaded);
|