From e5c6bbad43b0343cbdfe189fd7596371aaf040a0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 22 Jun 2012 14:15:47 +0000 Subject: minor TTB options fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@530 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TopToolBar/toolbar.cpp | 4 +--- plugins/TopToolBar/ttbopt.cpp | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'plugins/TopToolBar') diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 52bcb09c97..3daa11df5f 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -20,14 +20,12 @@ int backgroundBmpUse; static CRITICAL_SECTION csButtonsHook; static int hFrameTopWindow = -1; -/* int sortfunc(const TopButtonInt* a, const TopButtonInt* b) { return a->arrangedpos - b->arrangedpos; } -*/ -LIST Buttons(8); +LIST Buttons(8, sortfunc); void lockbut() { diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index 02e834ffd6..882e628c08 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -51,7 +51,7 @@ int BuildTree(HWND hwndDlg) tvis.item.pszText = TranslateTS(tmp); } - tvis.item.lParam = (LPARAM)&b; + tvis.item.lParam = (LPARAM)b; HTREEITEM hti = TreeView_InsertItem(hTree, &tvis); if (!(b->dwFlags & TTBBF_ISSEPARATOR)) @@ -82,7 +82,7 @@ int SaveTree(HWND hwndDlg) int count = 0; lockbut(); -// Buttons.destroy(); + Buttons.destroy(); while(tvi.hItem != NULL) { tvi.stateMask = TVIS_STATEIMAGEMASK; @@ -97,7 +97,7 @@ int SaveTree(HWND hwndDlg) btn->dwFlags &= ~TTBBF_VISIBLE; btn->arrangedpos = count; -// Buttons.insert(btn); + Buttons.insert(btn); tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem); count++; } @@ -208,10 +208,18 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR btn = (TopButtonInt*)tvi.lParam; // if button enabled for separator and launch only, no need condition // except possible service button introducing - if (btn->dwFlags & (TTBBF_ISSEPARATOR | TTBBF_ISLBUTTON)) - TTBRemoveButton(btn->lParamDown, 0); - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + if (btn->dwFlags & (TTBBF_ISSEPARATOR | TTBBF_ISLBUTTON)) { + int idx = Buttons.indexOf(btn); + if (idx != -1) { + Buttons.remove(idx); + delete btn; + + ArrangeButtons(); + ulockbut(); + OptionsPageRebuild(); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } break; } } -- cgit v1.2.3