summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-08-04 20:42:01 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-08-04 20:42:01 +0300
commit5a8d4daed9badd45ceb3f882aa28df60c0fa7c8e (patch)
tree19e86063ebb96e97a78b353be679b9d212a17843 /plugins/NewStory/src
parent1cbdcde34f1d6fbcdb80317fa16c3dd8131f542f (diff)
NewStory: hotkeys
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history.h1
-rw-r--r--plugins/NewStory/src/history_control.cpp42
-rw-r--r--plugins/NewStory/src/history_dlg.cpp10
-rw-r--r--plugins/NewStory/src/main.cpp1
-rw-r--r--plugins/NewStory/src/stdafx.h50
5 files changed, 78 insertions, 26 deletions
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h
index 4c477b6bab..4fc1bd8220 100644
--- a/plugins/NewStory/src/history.h
+++ b/plugins/NewStory/src/history.h
@@ -30,6 +30,7 @@ enum
extern MWindowList g_hNewstoryWindows, g_hNewstoryLogs;
void InitMenus();
+void InitHotkeys();
INT_PTR svcShowNewstory(WPARAM, LPARAM);
INT_PTR svcGlobalSearch(WPARAM, LPARAM);
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index ecbd6d669e..b380374ee4 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -7,6 +7,30 @@ HANDLE htuLog = 0;
static WNDPROC OldEditWndProc;
static LRESULT CALLBACK HistoryEditWndProc(HWND, UINT, WPARAM, LPARAM);
+void InitHotkeys()
+{
+ HOTKEYDESC hkd = {};
+ hkd.szSection.a = MODULENAME;
+
+ hkd.szDescription.a = LPGEN("Toggle bookmark");
+ hkd.pszName = "ns_bookmark";
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'B') | HKF_MIRANDA_LOCAL;
+ hkd.lParam = HOTKEY_BOOKMARK;
+ g_plugin.addHotkey(&hkd);
+
+ hkd.szDescription.a = LPGEN("Search forward");
+ hkd.pszName = "ns_seek_forward";
+ hkd.DefHotKey = HOTKEYCODE(0, VK_F3) | HKF_MIRANDA_LOCAL;
+ hkd.lParam = HOTKEY_SEEK_FORWARD;
+ g_plugin.addHotkey(&hkd);
+
+ hkd.szDescription.a = LPGEN("Search backward");
+ hkd.pszName = "ns_seek_back";
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT, VK_F3) | HKF_MIRANDA_LOCAL;
+ hkd.lParam = HOTKEY_SEEK_BACK;
+ g_plugin.addHotkey(&hkd);
+}
+
/////////////////////////////////////////////////////////////////////////
// Control utilities, types and constants
@@ -503,6 +527,19 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
POINT pt;
NewstoryListData *data = (NewstoryListData *)GetWindowLongPtr(hwnd, 0);
+ MSG message = { hwnd, msg, wParam, lParam };
+ switch (Hotkey_Check(&message, MODULENAME)) {
+ case HOTKEY_SEEK_FORWARD:
+ PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDOK, BN_CLICKED), 1);
+ break;
+ case HOTKEY_SEEK_BACK:
+ PostMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(IDC_FINDPREV, BN_CLICKED), 1);
+ break;
+ case HOTKEY_BOOKMARK:
+ data->ToggleBookmark();
+ return 0;
+ }
+
switch (msg) {
case WM_CREATE:
data = new NewstoryListData(hwnd);
@@ -763,11 +800,6 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
data->bWasShift = isShift;
switch (wParam) {
- case 'B':
- if (isCtrl)
- data->ToggleBookmark();
- break;
-
case VK_UP:
data->LineUp();
break;
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp
index fb40f3d6a8..0e23196044 100644
--- a/plugins/NewStory/src/history_dlg.cpp
+++ b/plugins/NewStory/src/history_dlg.cpp
@@ -877,6 +877,16 @@ public:
return result;
}
+ MSG message = { m_hwnd, msg, wParam, lParam };
+ switch (Hotkey_Check(&message, MODULENAME)) {
+ case HOTKEY_SEEK_FORWARD:
+ btnFindNext.Click();
+ break;
+ case HOTKEY_SEEK_BACK:
+ btnFindPrev.Click();
+ break;
+ }
+
switch (msg) {
case WM_CHARTOITEM:
if (!((GetKeyState(VK_CONTROL) & 0x80) || (GetKeyState(VK_MENU) & 0x80))) {
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index 082497a41f..9f3bea3aef 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -133,6 +133,7 @@ int CMPlugin::Load()
HookEvent(ME_SYSTEM_PRESHUTDOWN, evtPreShutdown);
InitMenus();
+ InitHotkeys();
InitServices();
return 0;
}
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index f0429246a7..57a34317e4 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -30,30 +30,31 @@ Boston, MA 02111-1307, USA.
#include <malloc.h>
//Miranda headers
-#include "newpluginapi.h"
-#include "m_chat_int.h"
-#include "m_clc.h"
-#include "m_clistint.h"
-#include "m_file.h"
-#include "m_options.h"
-#include "m_skin.h"
-#include "m_langpack.h"
-#include "m_database.h"
-#include "m_protocols.h"
-#include "m_protosvc.h"
-#include "m_utils.h"
-#include "m_history.h"
-#include "m_button.h"
-#include "m_message.h"
-#include "m_userinfo.h"
-#include "m_icolib.h"
-#include "m_fontservice.h"
-#include "m_text.h"
-#include "m_contacts.h"
-#include "m_srmm_int.h"
+#include <newpluginapi.h>
+#include <m_button.h>
+#include <m_chat_int.h>
+#include <m_clc.h>
+#include <m_clistint.h>
+#include <m_contacts.h>
+#include <m_database.h>
+#include <m_file.h>
+#include <m_fontservice.h>
+#include <m_history.h>
+#include <m_hotkeys.h>
#include <m_json.h>
+#include <m_langpack.h>
+#include <m_message.h>
#include <m_metacontacts.h>
+#include <m_icolib.h>
+#include <m_options.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_skin.h>
+#include <m_srmm_int.h>
+#include <m_text.h>
#include <m_timezones.h>
+#include <m_userinfo.h>
+#include <m_utils.h>
#include "m_NewStory.h"
#include "m_smileyadd.h"
@@ -80,6 +81,13 @@ void InitServices();
int OptionsInitialize(WPARAM, LPARAM);
+enum
+{
+ HOTKEY_BOOKMARK = 1,
+ HOTKEY_SEEK_FORWARD = 2,
+ HOTKEY_SEEK_BACK = 3,
+};
+
struct CMPlugin : public PLUGIN<CMPlugin>
{
HANDLE m_log;