From 451303889fcd3e4a8ca4ec4928c3788641e8e755 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 20 May 2024 20:33:46 +0300 Subject: =?UTF-8?q?fixes=20#4429=20(NewStory:=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D1=83?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B2=D1=8B=D0=B1=D1=80=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/res/resource.rc | 2 ++ plugins/NewStory/src/fonts.cpp | 2 +- plugins/NewStory/src/history.h | 26 +++++++++++++------------- plugins/NewStory/src/history_control.cpp | 6 +++--- plugins/NewStory/src/history_dlg.cpp | 22 +++++++++++++--------- plugins/NewStory/src/main.cpp | 6 +++--- plugins/NewStory/src/resource.h | 1 + 7 files changed, 36 insertions(+), 29 deletions(-) (limited to 'plugins') 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 // -- cgit v1.2.3