From 9665f9b67c359c3f7c71b0738eb308c05579019e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Aug 2023 14:40:02 +0300 Subject: NewStory: dynamic toolbar (less arrays, less checks) --- plugins/NewStory/src/history_dlg.cpp | 110 +++++++++++++++++------------------ 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp index 2c2696690a..4396078895 100644 --- a/plugins/NewStory/src/history_dlg.cpp +++ b/plugins/NewStory/src/history_dlg.cpp @@ -32,20 +32,8 @@ enum { WND_SPACING = 4, TBTN_SIZE = 25, - TBTN_SPACER = 10 }; -enum -{ - TBTN_USERINFO, TBTN_USERMENU, TBTN_MESSAGE, - TBTN_TIMEREE, TBTN_SEARCH, TBTN_FILTER, TBTN_DATEPOPUP, - TBTN_COPY, TBTN_DELETE, TBTN_EXPORT, - TBTN_LOGOPTIONS, - TBTN_COUNT -}; - -int tbtnSpacing[TBTN_COUNT] = { 0, 0, TBTN_SPACER, 0, 0, 0, TBTN_SPACER, 0, 0, -1, 0 }; - struct InfoBarEvents { HWND hwndIco, hwndIcoIn, hwndIcoOut; @@ -100,7 +88,19 @@ class CHistoryDlg : public CDlgBase uint32_t m_dwOptions = 0; // toolbar buttons - HWND m_hwndBtnToolbar[TBTN_COUNT]; + struct Button + { + enum { RIGHT = 1, SPACED = 2 }; + + Button(CCtrlMButton &_1, int _2 = 0) : + hwnd(_1), + options(_2) + {} + + CCtrlMButton &hwnd; + int options; + }; + std::vector