diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-22 14:15:47 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-22 14:15:47 +0000 |
commit | e5c6bbad43b0343cbdfe189fd7596371aaf040a0 (patch) | |
tree | 78672fab5f8aa3b58582f943547e83a1beff650b /plugins/TopToolBar | |
parent | 1689562f568f248c2ce74dd8eee06e1a8f26d04f (diff) |
minor TTB options fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@530 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 4 | ||||
-rw-r--r-- | plugins/TopToolBar/ttbopt.cpp | 22 |
2 files changed, 16 insertions, 10 deletions
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<TopButtonInt> Buttons(8);
+LIST<TopButtonInt> 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;
}
}
|