summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-05-20 20:33:46 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-05-20 20:33:46 +0300
commit451303889fcd3e4a8ca4ec4928c3788641e8e755 (patch)
tree17f538d0a66735d5381d680ac031e0766e01038e
parente3dc4660e3d9bdf69a094830e97cd664eb7d2f40 (diff)
fixes #4429 (NewStory: добавить кнопку для удаления выбранных сообщений)
-rw-r--r--plugins/NewStory/res/resource.rc2
-rw-r--r--plugins/NewStory/src/fonts.cpp2
-rw-r--r--plugins/NewStory/src/history.h26
-rw-r--r--plugins/NewStory/src/history_control.cpp6
-rw-r--r--plugins/NewStory/src/history_dlg.cpp22
-rw-r--r--plugins/NewStory/src/main.cpp6
-rw-r--r--plugins/NewStory/src/resource.h1
7 files changed, 36 insertions, 29 deletions
diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc
index 5e7865b697..e204790c5f 100644
--- a/plugins/NewStory/res/resource.rc
+++ b/plugins/NewStory/res/resource.rc
@@ -260,6 +260,8 @@ BEGIN
BEGIN
MENUITEM "Options", ID_LOGOPTIONS_OPTIONS
MENUITEM "Templates", ID_LOGOPTIONS_TEMPLATES
+ MENUITEM SEPARATOR
+ MENUITEM "Empty history", ID_LOGOPTIONS_EMPTYHISTORY
END
END
diff --git a/plugins/NewStory/src/fonts.cpp b/plugins/NewStory/src/fonts.cpp
index 77ae93a87d..72bf329028 100644
--- a/plugins/NewStory/src/fonts.cpp
+++ b/plugins/NewStory/src/fonts.cpp
@@ -76,7 +76,7 @@ int evtFontsChanged(WPARAM, LPARAM)
it.hfnt = CreateFontIndirectA(&it.lf);
}
- WindowList_Broadcast(g_hNewstoryLogs, UM_REDRAWLISTH, 0, 0);
+ WindowList_Broadcast(g_hNewstoryLogs, UM_REDRAW_LIST, 0, 0);
return 0;
}
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h
index 0d5b1c74a1..1a60805f59 100644
--- a/plugins/NewStory/src/history.h
+++ b/plugins/NewStory/src/history.h
@@ -7,24 +7,24 @@
enum
{
- UM_LOADCONTACT = WM_USER + 1,
+ UM_LOAD_CONTACT = WM_USER + 1,
- UM_REBUILDLIST,
- UM_FILTERLIST,
- UM_REDRAWLISTH,
+ UM_REBUILD_LIST,
+ UM_FILTER_LIST,
+ UM_REDRAW_LIST,
- UM_ADDEVENT,
- UM_ADDEVENTFILTER,
- UM_REMOVEEVENT,
- UM_EDITEVENT,
+ UM_ADD_EVENT,
+ UM_ADD_EVENT_FILTER,
+ UM_REMOVE_EVENT,
+ UM_EDIT_EVENT,
UM_SELECTED,
- UM_GETEVENTCOUNT,
- UM_GETEVENT,
- UM_GETEVENTTEXT,
- UM_GETEVENTCONTACT,
- UM_GETEVENTHANDLE,
+ UM_GET_EVENT,
+ UM_GET_EVENT_TEXT,
+ UM_GET_EVENT_COUNT,
+ UM_GET_EVENT_HANDLE,
+ UM_GET_EVENT_CONTACT,
UM_BOOKMARKS = WM_USER + 0x601,
};
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 5129c3f6c8..537a74fb61 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -1212,12 +1212,12 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
InvalidateRect(hwnd, 0, FALSE);
break;
- case UM_ADDEVENT:
+ case UM_ADD_EVENT:
if (data->pMsgDlg == nullptr)
data->AddEvent(wParam, lParam, 1);
break;
- case UM_EDITEVENT:
+ case UM_EDIT_EVENT:
idx = data->items.find(lParam);
if (idx != -1) {
auto *p = data->GetItem(idx);
@@ -1227,7 +1227,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
break;
- case UM_REMOVEEVENT:
+ case UM_REMOVE_EVENT:
idx = data->items.find(lParam);
if (idx != -1) {
data->items.remove(idx);
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp
index b38fd3efde..93633345ab 100644
--- a/plugins/NewStory/src/history_dlg.cpp
+++ b/plugins/NewStory/src/history_dlg.cpp
@@ -785,14 +785,9 @@ public:
void onClick_Delete(CCtrlButton *)
{
- if (!CallService(MS_HISTORY_EMPTY, m_hContact, 0)) {
- m_histCtrl->Clear();
-
- UpdateTitle();
- BuildTimeTree();
- }
+ m_histCtrl->DeleteItems();
}
-
+
void onClick_TimeTree(CCtrlButton *)
{
if (m_dwOptions & WND_OPT_TIMETREE)
@@ -950,6 +945,15 @@ public:
case ID_LOGOPTIONS_TEMPLATES:
g_plugin.openOptions(L"History", L"NewStory", L"Templates");
break;
+
+ case ID_LOGOPTIONS_EMPTYHISTORY:
+ if (!CallService(MS_HISTORY_EMPTY, m_hContact, 0)) {
+ m_histCtrl->Clear();
+
+ UpdateTitle();
+ BuildTimeTree();
+ }
+ break;
}
PostMessage(m_hwnd, WM_SIZE, 0, 0);
}
@@ -986,7 +990,7 @@ public:
if (m_bInitialized)
if (showFlags & HIST_AUTO_FILTER)
- PostMessage(m_hwnd, UM_REBUILDLIST, 0, 0);
+ PostMessage(m_hwnd, UM_REBUILD_LIST, 0, 0);
}
void onChange_Splitter(CSplitter *)
@@ -1099,7 +1103,7 @@ public:
}
}
if (doFilter)
- PostMessage(m_hwnd, UM_REBUILDLIST, 0, 0);
+ PostMessage(m_hwnd, UM_REBUILD_LIST, 0, 0);
break;*/
case UM_BOOKMARKS:
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index 705dcccdb5..5e8a4c1bb5 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -115,17 +115,17 @@ static int SmartSendEvent(int iEvent, MCONTACT hContact, LPARAM lParam)
static int evtEventAdded(WPARAM hContact, LPARAM lParam)
{
- return SmartSendEvent(UM_ADDEVENT, hContact, lParam);
+ return SmartSendEvent(UM_ADD_EVENT, hContact, lParam);
}
static int evtEventDeleted(WPARAM hContact, LPARAM lParam)
{
- return (g_plugin.bDisableDelete) ? 0 : SmartSendEvent(UM_REMOVEEVENT, hContact, lParam);
+ return (g_plugin.bDisableDelete) ? 0 : SmartSendEvent(UM_REMOVE_EVENT, hContact, lParam);
}
static int evtEventEdited(WPARAM hContact, LPARAM lParam)
{
- return SmartSendEvent(UM_EDITEVENT, hContact, lParam);
+ return SmartSendEvent(UM_EDIT_EVENT, hContact, lParam);
}
static int evtTopToolbar(WPARAM, LPARAM)
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index 9bad09fd13..2684ee58d0 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -119,6 +119,7 @@
#define ID_FILTER_AUTO 40012
#define ID_LOGOPTIONS_OPTIONS 40013
#define ID_LOGOPTIONS_TEMPLATES 40014
+#define ID_LOGOPTIONS_EMPTYHISTORY 40015
// Next default values for new objects
//