summaryrefslogtreecommitdiff
path: root/plugins/mRadio/i_hotkey.inc
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
commit864081102a5f252415f41950b3039a896b4ae9c5 (patch)
treec6b764651e9dd1f8f53b98eab05f16ba4a492a79 /plugins/mRadio/i_hotkey.inc
parentdb5149b48346c417e18add5702a9dfe7f6e28dd0 (diff)
Awkwars's plugins - welcome to our trunk
git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/mRadio/i_hotkey.inc')
-rw-r--r--plugins/mRadio/i_hotkey.inc61
1 files changed, 61 insertions, 0 deletions
diff --git a/plugins/mRadio/i_hotkey.inc b/plugins/mRadio/i_hotkey.inc
new file mode 100644
index 0000000000..04271fe824
--- /dev/null
+++ b/plugins/mRadio/i_hotkey.inc
@@ -0,0 +1,61 @@
+{}
+const
+ hRadioHotkey:THANDLE=0;
+const
+ MS_RADIO_HOTKEY:PAnsiChar = 'mRadio/Hotkey';
+
+ HKN_PLAYPAUSE :PAnsiChar = 'mRadio_PlayPause';
+ HKN_STOP :PAnsiChar = 'mRadio_Stop';
+ HKN_MUTE :PAnsiChar = 'mRadio_Mute';
+
+ DefRadioKeyMute = ((HOTKEYF_EXT or HOTKEYF_SHIFT) shl 8) or ORD('M');
+ DefRadioKeyPlay = ((HOTKEYF_EXT or HOTKEYF_SHIFT) shl 8) or ORD('P');
+ DefRadioKeyStop = ((HOTKEYF_EXT or HOTKEYF_SHIFT) shl 8) or ORD('S');
+
+function mRadio_Hotkey(wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl;
+begin
+ if lParam=MRC_MUTE then
+ result:=Service_RadioMute(0,0)
+ else
+ result:=CallService(MS_RADIO_COMMAND,lParam,0);
+end;
+
+procedure RegisterHotKey;
+var
+ hkrec:HOTKEYDESC;
+begin
+ hRadioHotkey:=CreateServiceFunction(MS_RADIO_HOTKEY,@mRadio_Hotkey);
+
+ FillChar(hkrec,SizeOf(hkrec),0);
+
+ hkrec.cbSize :=HOTKEYDESC_SIZE_V1;
+ hkrec.pszSection.a :=PluginName;
+ hkrec.pszService :=MS_RADIO_HOTKEY;
+
+ hkrec.DefHotKey :=DefRadioKeyPlay;
+ hkrec.pszName :=HKN_PLAYPAUSE;
+ hkrec.pszDescription.a:='Play/Pause';
+ hkrec.lParam :=MRC_PAUSE;
+ CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
+
+ hkrec.DefHotKey :=DefRadioKeyStop;
+ hkrec.pszName :=HKN_STOP;
+ hkrec.pszDescription.a:='Stop';
+ hkrec.lParam :=MRC_STOP;
+ CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
+
+ hkrec.DefHotKey :=DefRadioKeyMute;
+ hkrec.pszName :=HKN_MUTE;
+ hkrec.pszDescription.a:='Mute';
+ hkrec.lParam :=MRC_MUTE;
+ CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
+end;
+
+procedure UnregisterHotKey;
+begin
+ CallService(MS_HOTKEY_UNREGISTER,0,lparam(HKN_PLAYPAUSE));
+ CallService(MS_HOTKEY_UNREGISTER,0,lparam(HKN_STOP));
+ CallService(MS_HOTKEY_UNREGISTER,0,lparam(HKN_MUTE));
+
+ DestroyServiceFunction(hRadioHotkey);
+end;