From 990f961261d92fccadb16b495171bb619c0183f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 2 Jul 2012 21:10:16 +0000 Subject: compilation fix git-svn-id: http://svn.miranda-ng.org/main/trunk@729 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TopToolBar/ttbopt.cpp | 81 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'plugins/TopToolBar/ttbopt.cpp') diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index 6f9565896b..f2baa430d5 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -2,42 +2,6 @@ static HWND OptionshWnd; -void AddToOptions(TopButtonInt* b) -{ - if (OptionshWnd) { - HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE); - OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); - AddLine(hTree, b, TVI_LAST, dat->himlButtonIcons); - } -} - -void RemoveFromOptions(int id) -{ - if (OptionshWnd) { - HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE); - TVITEM tvi = { 0 }; - tvi.hItem = TreeView_GetRoot(hTree); - tvi.mask = TVIF_PARAM | TVIF_HANDLE; - - TopButtonInt* btn; - while(tvi.hItem != NULL) { - TreeView_GetItem(hTree, &tvi); - btn = (TopButtonInt*)tvi.lParam; - if (btn->id == id) { - // delete if was changed - if (btn->dwFlags & TTBBF_OPTIONAL) - delete btn; - TreeView_DeleteItem(hTree,tvi.hItem); - break; - } - - tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem); - } - } -} - -///////////////////////////////////////////////////////////////////////////////////////// - struct OrderData { int dragging; @@ -45,6 +9,8 @@ struct OrderData HIMAGELIST himlButtonIcons; }; +///////////////////////////////////////////////////////////////////////////////////////// + static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il) { TVINSERTSTRUCT tvis = { 0 }; @@ -85,7 +51,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST static int BuildTree(HWND hwndDlg) { HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE); - OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); + OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); dat->himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2); TreeView_SetImageList(hTree, dat->himlButtonIcons, TVSIL_NORMAL); @@ -171,18 +137,55 @@ static void RecreateWindows() } } +///////////////////////////////////////////////////////////////////////////////////////// +// external functions + +void AddToOptions(TopButtonInt* b) +{ + if (OptionshWnd) { + HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE); + OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); + AddLine(hTree, b, TVI_LAST, dat->himlButtonIcons); + } +} + +void RemoveFromOptions(int id) +{ + if (OptionshWnd) { + HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE); + TVITEM tvi = { 0 }; + tvi.hItem = TreeView_GetRoot(hTree); + tvi.mask = TVIF_PARAM | TVIF_HANDLE; + + TopButtonInt* btn; + while(tvi.hItem != NULL) { + TreeView_GetItem(hTree, &tvi); + btn = (TopButtonInt*)tvi.lParam; + if (btn->id == id) { + // delete if was changed + if (btn->dwFlags & TTBBF_OPTIONAL) + delete btn; + TreeView_DeleteItem(hTree,tvi.hItem); + break; + } + + tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem); + } + } +} + ///////////////////////////////////////////////////////////////////////////////////////// // Options window: main static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE); - struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); + OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - dat = (struct OrderData*)malloc(sizeof(struct OrderData)); + dat = (OrderData*)malloc( sizeof(OrderData)); SetWindowLongPtr(hTree, GWLP_USERDATA, (LONG)dat); dat->dragging = 0; -- cgit v1.2.3