diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-04 16:02:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-04 16:02:56 +0300 |
commit | e230d5b323f08f9bf07cfd4822f22a22c22660b7 (patch) | |
tree | ab84396539f13100ba119cbc5b2575b374c8f503 /src/mir_app | |
parent | 8937c49faab219b51b9863847406a21945d3a9cb (diff) |
fix for adding separators into SRMM toolbar
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/srmm_toolbar.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index f87fdf1376..04877338b6 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -79,17 +79,12 @@ MIR_APP_DLL(int) Srmm_GetButtonCount(void) return arButtonsList.getCount(); } -MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) +MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, int _hLang) { if (bbdi == nullptr) - return 1; + return nullptr; CustomButtonData *cbd = new CustomButtonData(); - if (bbdi->bbbFlags & BBBF_ISARROWBUTTON) - cbd->m_iButtonWidth = DPISCALEX_S(34); - else - cbd->m_iButtonWidth = DPISCALEX_S(22); - cbd->m_pszModuleName = mir_strdup(bbdi->pszModuleName); cbd->m_pwszText = mir_wstrdup(bbdi->pwszText); cbd->m_pwszTooltip = mir_wstrdup(bbdi->pwszTooltip); @@ -111,6 +106,13 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) cbd->m_dwOrigFlags.bit3 = cbd->m_bChatButton = (bbdi->bbbFlags & BBBF_ISCHATBUTTON) != 0; cbd->m_dwOrigFlags.bit4 = cbd->m_bCanBeHidden = (bbdi->bbbFlags & BBBF_CANBEHIDDEN) != 0; + if (cbd->m_bSeparator) + cbd->m_iButtonWidth = DPISCALEX_S(10); + else if (bbdi->bbbFlags & BBBF_ISARROWBUTTON) + cbd->m_iButtonWidth = DPISCALEX_S(34); + else + cbd->m_iButtonWidth = DPISCALEX_S(22); + if (bbdi->pszHotkey) { for (auto &p : hotkeys) { if (!mir_strcmp(p->getName(), bbdi->pszHotkey)) { @@ -150,7 +152,7 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) LastCID++; WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, 0); - return 0; + return cbd; } MIR_APP_DLL(int) Srmm_GetButtonState(HWND hwndDlg, BBButton *bbdi) @@ -678,19 +680,17 @@ public: if (!hItem) hItem = TVI_FIRST; - CustomButtonData *cbd = new CustomButtonData(); - cbd->m_bSeparator = cbd->m_bHidden = cbd->m_bIMButton = true; - cbd->m_dwButtonID = ++dwSepCount; - cbd->m_pszModuleName = "Tabsrmm_sep"; - cbd->m_iButtonWidth = 22; - cbd->m_opFlags = BBSF_NTBDESTRUCT; - arButtonsList.insert(cbd); + BBButton bbd = {}; + bbd.pszModuleName = "Tabsrmm_sep"; + bbd.bbbFlags = BBBF_ISSEPARATOR | BBBF_ISIMBUTTON; + bbd.dwButtonID = ++dwSepCount; + + CustomButtonData *cbd = (CustomButtonData*)Srmm_AddButton(&bbd); TVINSERTSTRUCT tvis; tvis.hParent = nullptr; tvis.hInsertAfter = hItem; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - tvis.item.pszText = TranslateT("<Separator>"); tvis.item.iImage = tvis.item.iSelectedImage = -1; tvis.item.lParam = (LPARAM)cbd; |