diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ExternalAPI/m_NewStory.h | 10 | ||||
-rw-r--r-- | plugins/NewStory/src/history_svc.cpp | 14 |
2 files changed, 24 insertions, 0 deletions
diff --git a/plugins/ExternalAPI/m_NewStory.h b/plugins/ExternalAPI/m_NewStory.h index 309ac45d60..ad6c7583a9 100644 --- a/plugins/ExternalAPI/m_NewStory.h +++ b/plugins/ExternalAPI/m_NewStory.h @@ -3,6 +3,16 @@ #include <vector> ///////////////////////////////////////////////////////////////////////////////////////// +// NS get current event + +#define MS_NEWSTORY_GETCURRENT "NewStory/GetCurrent" + +__forceinline MEVENT NS_GetCurrent(HANDLE hwnd) +{ + return (MEVENT)CallService(MS_NEWSTORY_GETCURRENT, WPARAM(hwnd), 0); +} + +///////////////////////////////////////////////////////////////////////////////////////// // NS get selection #define MS_NEWSTORY_GETSELECTION "NewStory/GetSelection" diff --git a/plugins/NewStory/src/history_svc.cpp b/plugins/NewStory/src/history_svc.cpp index ad59635956..6ddaae2add 100644 --- a/plugins/NewStory/src/history_svc.cpp +++ b/plugins/NewStory/src/history_svc.cpp @@ -17,6 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" +static INT_PTR SvcGetCurrent(WPARAM wParam, LPARAM) +{ + if (auto *pData = (NewstoryListData *)wParam) + if (auto *p = pData->GetItem(pData->caret)) + return p->hEvent; + + return 0; +} + static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam) { auto *pData = (NewstoryListData *)wParam; @@ -27,6 +36,10 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam) if (p->m_bSelected) pRet->push_back(p->hEvent); } + + if (pRet->empty() && pData->caret != -1) + if (auto *p = pData->GetItem(pData->caret)) + pRet->push_back(p->hEvent); } return 0; @@ -37,5 +50,6 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam) void InitServices() { + CreateServiceFunction(MS_NEWSTORY_GETCURRENT, &SvcGetCurrent); CreateServiceFunction(MS_NEWSTORY_GETSELECTION, &SvcGetSelection); } |