diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-23 11:56:59 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-23 11:56:59 +0000 |
commit | 177c84716db384c8be095219c58d0a68f87101fe (patch) | |
tree | 84449f27f215b253da99729ddb0aaf6df40bef0c /plugins/NotesAndReminders/src/hotkeys.cpp | |
parent | cbb10e8c9089dfc99946ddc784afdb126e2128a8 (diff) |
NotesAndReminders, Nudge, OpenFolder, PackUpdater: changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1116 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NotesAndReminders/src/hotkeys.cpp')
-rw-r--r-- | plugins/NotesAndReminders/src/hotkeys.cpp | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/plugins/NotesAndReminders/src/hotkeys.cpp b/plugins/NotesAndReminders/src/hotkeys.cpp new file mode 100644 index 0000000000..a8bd8d3c53 --- /dev/null +++ b/plugins/NotesAndReminders/src/hotkeys.cpp @@ -0,0 +1,137 @@ +#include "globals.h"
+
+#define MSG_WND_CLASS "MIM_SNMsgWindow"
+
+
+HWND HKHwnd;
+
+
+enum KB_ACTIONS {KB_NEW_NOTE = 1, KB_TOGGLE_NOTES, KB_NEW_REMINDER};
+
+
+void RegisterKeyBindings()
+{
+ HOTKEYDESC desc;
+
+ ZeroMemory(&desc, sizeof(desc));
+ desc.cbSize = sizeof(desc);
+ desc.pszSection = SECTIONNAME;
+
+ desc.pszName = MODULENAME"/NewNote";
+ desc.pszDescription = "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.pszDescription = "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.pszDescription = "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.pszDescription = "New Reminder";
+ desc.lParam = KB_NEW_REMINDER;
+ desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_SUBTRACT);
+ desc.pszService = MODULENAME"/MenuCommandNewReminder";
+ Hotkey_Register(&desc);
+}
+
+
+/*int HandleNRShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ STICKYNOTE* PSN;
+
+ BOOL isShift = GetKeyState(VK_SHIFT) & 0x8000;
+ BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
+ BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt;
+
+ int action;
+ MSG amsg;
+ amsg.hwnd = hwnd;
+ amsg.message = msg;
+ amsg.wParam = wParam;
+ amsg.lParam = lParam;
+
+ switch ( (action = CallService(MS_HOTKEY_CHECK, (WPARAM)&amsg, (LPARAM)SECTIONNAME)) )
+ {
+ case KB_NEW_NOTE:
+ PSN = NewNote(0,0,0,0,NULL,NULL,TRUE,TRUE,0);
+ SetFocus(PSN->REHwnd);
+ return FALSE;
+ case KB_TOGGLE_NOTES:
+ ShowHideNotes();
+ return FALSE;
+ case KB_NEW_REMINDER:
+ NewReminder();
+ return FALSE;
+ }
+
+ return -1;
+}*/
+
+
+int CALLBACK NotifyHotKeyWndProc(HWND AHwnd,UINT Message,WPARAM wParam,LPARAM lParam)
+{
+ BOOL b;
+
+ switch (Message)
+ {
+ case WM_TIMER:
+ {
+ KillTimer(HKHwnd,1026);
+ b = CheckRemindersAndStart();
+ SetTimer(HKHwnd,1026,b ? REMINDER_UPDATE_INTERVAL_SHORT : REMINDER_UPDATE_INTERVAL,0);
+
+ return FALSE;
+ }
+ }
+
+ return DefWindowProc(AHwnd,Message,wParam,lParam);
+}
+
+void CreateMsgWindow(void)
+{
+ HWND hParent = NULL;
+ WNDCLASSEX TWC = {0};
+
+ if (!GetClassInfoEx(hmiranda,MSG_WND_CLASS,&TWC))
+ {
+ TWC.style = 0;
+ TWC.cbClsExtra = 0;
+ TWC.cbWndExtra = 0;
+ TWC.hInstance = hmiranda;
+ TWC.hIcon = 0;
+ TWC.hCursor = 0;
+ TWC.hbrBackground = 0;
+ TWC.lpszMenuName = NULL;
+ TWC.lpszClassName = MSG_WND_CLASS;
+ TWC.cbSize = sizeof(TWC);
+ TWC.lpfnWndProc = (WNDPROC)NotifyHotKeyWndProc;
+ RegisterClassEx(&TWC);
+ }
+
+ if ( IsWinVer2000Plus() )
+ {
+ // win2k+ has special message-only windows support
+ hParent = HWND_MESSAGE;
+ }
+
+ HKHwnd = CreateWindowEx(WS_EX_TOOLWINDOW,MSG_WND_CLASS,_T("StickyNotes"),0,0,0,0,0,hParent,NULL,hmiranda,NULL);
+ SetTimer(HKHwnd,1026,REMINDER_UPDATE_INTERVAL,0);
+}
+
+void DestroyMsgWindow(void)
+{
+ KillTimer(HKHwnd,1026);
+ DestroyWindow(HKHwnd);
+}
|