summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ExternalAPI/m_NewStory.h21
-rw-r--r--plugins/NewStory/NewStory.vcxproj1
-rw-r--r--plugins/NewStory/NewStory.vcxproj.filters3
-rw-r--r--plugins/NewStory/src/history.cpp6
-rw-r--r--plugins/NewStory/src/history_svc.cpp41
-rw-r--r--plugins/NewStory/src/main.cpp1
-rw-r--r--plugins/NewStory/src/stdafx.h2
7 files changed, 68 insertions, 7 deletions
diff --git a/plugins/ExternalAPI/m_NewStory.h b/plugins/ExternalAPI/m_NewStory.h
index 8f8baff12c..309ac45d60 100644
--- a/plugins/ExternalAPI/m_NewStory.h
+++ b/plugins/ExternalAPI/m_NewStory.h
@@ -1,5 +1,22 @@
#pragma once
+#include <vector>
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// NS get selection
+
+#define MS_NEWSTORY_GETSELECTION "NewStory/GetSelection"
+
+__forceinline std::vector<MEVENT> NS_GetSelection(HANDLE hwnd)
+{
+ std::vector<MEVENT> ret;
+ CallService(MS_NEWSTORY_GETSELECTION, WPARAM(hwnd), LPARAM(&ret));
+ return ret;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// NS menu item
+
struct NSMenuExecParam
{
char *szServiceName;
@@ -11,7 +28,9 @@ __forceinline HGENMENU Menu_AddNewStoryMenuItem(TMO_MenuItem *pmi, int param)
return (HGENMENU)CallService("NSMenu/AddService", (WPARAM)pmi, param);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// event for changing NewStory menu items
// wparam = (MCONTACT)hContact - contact id
// lparam = (DB::EventInfo*)dbei - event
-#define ME_NS_PREBUILDMENU "NewStory/PreBuildMenu"
+
+#define ME_NS_PREBUILDMENU "NewStory/PreBuildMenu"
diff --git a/plugins/NewStory/NewStory.vcxproj b/plugins/NewStory/NewStory.vcxproj
index d7c64a5402..4e626a5301 100644
--- a/plugins/NewStory/NewStory.vcxproj
+++ b/plugins/NewStory/NewStory.vcxproj
@@ -38,6 +38,7 @@
<ClCompile Include="src\history_control.cpp" />
<ClCompile Include="src\history_log.cpp" />
<ClCompile Include="src\history_menus.cpp" />
+ <ClCompile Include="src\history_svc.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\stdafx.cxx">
diff --git a/plugins/NewStory/NewStory.vcxproj.filters b/plugins/NewStory/NewStory.vcxproj.filters
index 45b40c8e4b..3dd5b85af9 100644
--- a/plugins/NewStory/NewStory.vcxproj.filters
+++ b/plugins/NewStory/NewStory.vcxproj.filters
@@ -38,6 +38,9 @@
<ClCompile Include="src\history_menus.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\history_svc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\calendartool.h">
diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index 54fd1092e7..8ad2386fc7 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -1013,12 +1013,6 @@ public:
PostMessage(m_hwnd, WM_USER + 0x600, mktime(&tm_sel), 0);
}
}
-
- // case UM_REBUILDLIST:
- // if (showFlags & HIST_TIMETREE)
- // ShowWindow(GetDlgItem(m_hwnd, IDC_TIMETREE), SW_SHOW);
- // ShowWindow(GetDlgItem(m_hwnd, IDC_HISTORYCONTROL), SW_SHOW);
- // ShowWindow(GetDlgItem(m_hwnd, IDC_SEARCHICON), SW_SHOW);
};
INT_PTR svcShowNewstory(WPARAM hContact, LPARAM)
diff --git a/plugins/NewStory/src/history_svc.cpp b/plugins/NewStory/src/history_svc.cpp
new file mode 100644
index 0000000000..ae3d2ddd4b
--- /dev/null
+++ b/plugins/NewStory/src/history_svc.cpp
@@ -0,0 +1,41 @@
+/*
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "stdafx.h"
+
+static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
+{
+ auto *pData = (NewstoryListData *)wParam;
+ auto *pRet = (std::vector<MEVENT>*)lParam;
+ if (pData && pRet) {
+ for (int i = pData->items.getCount(); i >= 0; i--) {
+ auto *p = pData->items.get(i);
+ if (p->bSelected)
+ pRet->push_back(p->hEvent);
+ }
+ }
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Module entry point
+
+void InitServices()
+{
+ CreateServiceFunction(MS_NEWSTORY_GETSELECTION, &SvcGetSelection);
+}
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index a1db102c88..5c69a9efb0 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -102,6 +102,7 @@ int CMPlugin::Load()
HookEvent(ME_SYSTEM_PRESHUTDOWN, evtPreShutdown);
InitMenus();
+ InitServices();
return 0;
}
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index 151d95e5a3..39f00c47af 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -76,6 +76,8 @@ Boston, MA 02111-1307, USA.
#include "history_control.h"
#include "templates.h"
+void InitServices();
+
int OptionsInitialize(WPARAM, LPARAM);
struct CMPlugin : public PLUGIN<CMPlugin>