void CCList::SelectGroups(HTREEITEM hCurItem, bool bSelected) { // select/deselect all child items HTREEITEM hItem = TreeView_GetChild(hTreeView, hCurItem); HTREEITEM hLimitItem = GetNextItem(MCLGN_NEXT | MCLGN_ANY | MCLGN_NOTCHILD, hCurItem); while (hItem && hItem != hLimitItem) { TreeView_SetItemState(hTreeView, hItem, bSelected ? TVIS_SELECTED : 0, TVIS_SELECTED); Array_SetItemState(hItem, bSelected); hItem = GetNextItem(MCLGN_NEXT | MCLGN_ANY | MCLGN_MULTILEVEL, hItem); } // select/deselect all parent groups hCurItem = TreeView_GetParent(hTreeView, hCurItem); if (bSelected) { while (hCurItem) { // select until we'll find an unselected item or until we'll reach the root hItem = TreeView_GetChild(hTreeView, hCurItem); while (hItem) { // walk through all siblings if (!(TreeView_GetItemState(hTreeView, hItem, TVIS_SELECTED) & TVIS_SELECTED)) break; hItem = TreeView_GetNextSibling(hTreeView, hItem); } if (hItem) // means there was at least one unselected item break; TreeView_SetItemState(hTreeView, hCurItem, TVIS_SELECTED, TVIS_SELECTED); Array_SetItemState(hCurItem, true); hCurItem = TreeView_GetParent(hTreeView, hCurItem); } } while (hCurItem) { // and deselect all remaining parent groups TreeView_SetItemState(hTreeView, hCurItem, 0, TVIS_SELECTED); Array_SetItemState(hCurItem, false); hCurItem = TreeView_GetParent(hTreeView, hCurItem); } }
/** * name: OnSelChanging * class: CPsTree * desc: the displayed page is up to change * param: none * return: nothing **/ BYTE CPsTree::OnSelChanging() { CPsTreeItem *pti = CurrentItem(); if (pti != NULL) { TreeView_SetItemState(_hWndTree, pti->Hti(), 0, TVIS_SELECTED); if (pti->Wnd() != NULL) { PSHNOTIFY pshn; pshn.hdr.code = PSN_KILLACTIVE; pshn.hdr.hwndFrom = pti->Wnd(); pshn.hdr.idFrom = 0; pshn.lParam = (LPARAM)pti->hContact(); if (SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn)) { SetWindowLongPtr(_pPs->hDlg, DWLP_MSGRESULT, TRUE); return TRUE; } } } return FALSE; }
INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_AUDIO_CONFIGURE: configureAudioDriver(hDlg); break; case IDC_AUDIO_TEST: if(!PlaySound(MAKEINTRESOURCE(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_SYNC)) MessageBox(NULL, "Audio test failed!", "Error", MB_OK | MB_ICONERROR); break; case IDC_AUDIO_CONTROL_PANEL: MessageBox(NULL, "Launching audio control panel not implemented yet!", "Fixme", MB_OK | MB_ICONERROR); break; case IDC_DSOUND_HW_ACCEL: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_accel; int i, j = 0; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_accel = SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_GETCURSEL, 0, 0); for (i = 0; DSound_HW_Accels[i].settingStr; ++i) { if (DSound_HW_Accels[i].visible) { if (j == selected_dsound_accel) { set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", DSound_HW_Accels[i].settingStr); break; } j++; } } } break; case IDC_DSOUND_RATES: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_rate; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_rate = SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_GETCURSEL, 0, 0); set_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", DSound_Rates[selected_dsound_rate]); } break; case IDC_DSOUND_BITS: if (HIWORD(wParam) == CBN_SELCHANGE) { int selected_dsound_bits; SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); selected_dsound_bits = SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_GETCURSEL, 0, 0); set_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", DSound_Bits[selected_dsound_bits]); } break; } break; case WM_SHOWWINDOW: set_window_title(hDlg); break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->code) { case PSN_KILLACTIVE: SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); break; case PSN_APPLY: set_reg_key(config_key, "Drivers", "Audio", curAudioDriver); apply(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; case PSN_SETACTIVE: break; case NM_CLICK: if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE) { TVHITTESTINFO ht; DWORD dwPos = GetMessagePos(); HWND tree = ((LPNMHDR)lParam)->hwndFrom; ZeroMemory(&ht, sizeof(ht)); ht.pt.x = (short)LOWORD(dwPos); ht.pt.y = (short)HIWORD(dwPos); MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1); SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht ); if (TVHT_ONITEMSTATEICON & ht.flags) { TVITEM tvItem; int index; ZeroMemory(&tvItem, sizeof(tvItem)); tvItem.hItem = ht.hItem; SendMessageW( tree, TVM_GETITEMW, 0, (LPARAM) &tvItem ); index = TreeView_GetItemState(tree, ht.hItem, TVIS_STATEIMAGEMASK); if (index == INDEXTOSTATEIMAGEMASK(1)) { TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(2), TVIS_STATEIMAGEMASK); addDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver); SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */ } else if (index == INDEXTOSTATEIMAGEMASK(2)) { TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK); removeDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver); SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */ } } } break; case NM_RCLICK: if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE) { TVHITTESTINFO ht; DWORD dwPos = GetMessagePos(); HWND tree = ((LPNMHDR)lParam)->hwndFrom; POINT pt; ZeroMemory(&ht, sizeof(ht)); pt.x = (short)LOWORD(dwPos); pt.y = (short)HIWORD(dwPos); ht.pt = pt; MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1); SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht ); if (TVHT_ONITEMLABEL & ht.flags) { TVITEM tvItem; ZeroMemory(&tvItem, sizeof(tvItem)); tvItem.hItem = ht.hItem; tvItem.mask = TVIF_PARAM; tvItem.lParam = -1; if (TreeView_GetItem(tree, &tvItem)) { if (tvItem.lParam & DRIVER_MASK) { if (hPopupMenus) { TrackPopupMenu(GetSubMenu(hPopupMenus, 0), TPM_RIGHTBUTTON, pt.x, pt.y, 0, tree, NULL); toConfigure = tvItem.lParam & ~DRIVER_MASK; } } else if (tvItem.lParam & DEVICE_MASK) { /* FIXME TBD */ } } } } } break; case WM_INITDIALOG: initAudioDlg(hDlg); break; } return FALSE; }
LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { CCList *dat = CWndUserData(hWnd).GetCList(); switch (Msg) { case WM_NOTIFY: { LPNMHDR pnmh = (LPNMHDR)lParam; if (pnmh->hwndFrom == dat->hTreeView) { switch (pnmh->code) { case TVN_ITEMEXPANDED: // just set an appropriate group image { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam; TVITEM tvItem; tvItem.hItem = pnmtv->itemNew.hItem; tvItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvItem.iImage = tvItem.iSelectedImage = (pnmtv->itemNew.state & TVIS_EXPANDED) ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT; TreeView_SetItem(dat->hTreeView, &tvItem); } break; case TVN_SELCHANGED: { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam; TREEITEMARRAY OldSelection = dat->SelectedItems; for (int i = 0; i < dat->SelectedItems.GetSize(); i++) { if (dat->SelectedItems[i] != pnmtv->itemNew.hItem) { TreeView_SetItemState(dat->hTreeView, dat->SelectedItems[i], 0, TVIS_SELECTED); } } dat->SelectedItems.RemoveAll(); if (pnmtv->itemNew.hItem) { dat->SelectedItems.AddElem(pnmtv->itemNew.hItem); dat->SelectGroups(pnmtv->itemNew.hItem, true); } NMCLIST nm; nm.hdr.code = MCLN_SELCHANGED; nm.hdr.hwndFrom = dat->hTreeView; nm.hdr.idFrom = GetDlgCtrlID(dat->hTreeView); nm.OldSelection = &OldSelection; nm.NewSelection = &dat->SelectedItems; SendMessage(hWnd, WM_NOTIFY, 0, (LPARAM)&nm); } break; case TVN_DELETEITEM: if (dat->Items.GetSize()) { // if Items size = 0, then this TVN_DELETEITEM came after WM_DESTROY, so there is no need to do anything LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam; TREEITEMARRAY OldSelection = dat->SelectedItems; int Index = dat->SelectedItems.Find(pnmtv->itemOld.hItem); if (Index != -1) dat->SelectedItems.RemoveElem(Index); // find an item to pass to SelectGroups() HTREEITEM hItem = TreeView_GetNextSibling(dat->hTreeView, pnmtv->itemOld.hItem); if (!hItem) { hItem = TreeView_GetPrevSibling(dat->hTreeView, pnmtv->itemOld.hItem); if (!hItem) hItem = TreeView_GetParent(dat->hTreeView, pnmtv->itemOld.hItem); } if (hItem) // if it wasn't one of the root items dat->SelectGroups(hItem, dat->SelectedItems.Find(hItem) != -1); NMCLIST nm; nm.hdr.code = MCLN_SELCHANGED; nm.hdr.hwndFrom = dat->hTreeView; nm.hdr.idFrom = GetDlgCtrlID(dat->hTreeView); nm.OldSelection = &OldSelection; nm.NewSelection = &dat->SelectedItems; SendMessage(hWnd, WM_NOTIFY, 0, (LPARAM)&nm); dat->Items[pnmtv->itemOld.lParam].hContact = INVALID_CONTACT_ID; } break; case NM_CUSTOMDRAW: LPNMTVCUSTOMDRAW lpNMCD = (LPNMTVCUSTOMDRAW)lParam; switch (lpNMCD->nmcd.dwDrawStage) { case CDDS_PREPAINT: // the control is about to start painting return CDRF_NOTIFYITEMDRAW; // instruct the control to return information when it draws items case CDDS_ITEMPREPAINT: return CDRF_NOTIFYPOSTPAINT; case CDDS_ITEMPOSTPAINT: RECT rc; if (TreeView_GetItemRect(dat->hTreeView, (HTREEITEM)lpNMCD->nmcd.dwItemSpec, &rc, false)) { for (int i = 0; i < MAXEXTRAICONS; i++) { BYTE nIndex = dat->Items[lpNMCD->nmcd.lItemlParam].ExtraIcons[i]; if (nIndex != CLC_EXTRAICON_EMPTY) { ImageList_DrawEx(dat->ExtraImageList, nIndex, lpNMCD->nmcd.hdc, rc.right - EXTRAICON_XSTEP * (i + 1), rc.top, 0, 0, /*GetSysColor(COLOR_WINDOW)*/CLR_NONE, CLR_NONE, ILD_NORMAL); } } } break; } } break; } } } return CallWindowProc(dat->OrigParentProc, hWnd, Msg, wParam, lParam); }
LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { TVITEM tvi; CCList *dat = CWndUserData(GetParent(hWnd)).GetCList(); switch (Msg) { case INTM_CONTACTDELETED: // wParam = (HANDLE)hContact { HTREEITEM hItem = dat->FindContact(wParam); if (hItem) TreeView_DeleteItem(hWnd, hItem); } break; case INTM_ICONCHANGED: // wParam = (HANDLE)hContact, lParam = IconID tvi.hItem = dat->FindContact(wParam); if (tvi.hItem) { tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.iImage = tvi.iSelectedImage = lParam; TreeView_SetItem(hWnd, &tvi); dat->SortContacts(); InvalidateRect(hWnd, nullptr, false); } break; case INTM_INVALIDATE: InvalidateRect(hWnd, nullptr, true); break; case WM_RBUTTONDOWN: SetFocus(hWnd); { TVHITTESTINFO hitTest; hitTest.pt.x = (short)LOWORD(lParam); hitTest.pt.y = (short)HIWORD(lParam); TreeView_HitTest(hWnd, &hitTest); if (hitTest.hItem && hitTest.flags & TVHT_ONITEM) TreeView_SelectItem(hWnd, hitTest.hItem); } return DefWindowProc(hWnd, Msg, wParam, lParam); case WM_LBUTTONDOWN: { POINT pt = { (short)LOWORD(lParam), (short)HIWORD(lParam) }; DWORD hitFlags; HTREEITEM hItem = dat->HitTest(&pt, &hitFlags); if (!hItem) break; if (hitFlags & MCLCHT_ONITEMICON) { if (TreeView_GetChild(hWnd, hItem)) { // if it's a group, then toggle its state NMTREEVIEW nmtv; nmtv.hdr.hwndFrom = hWnd; nmtv.hdr.idFrom = GetDlgCtrlID(hWnd); nmtv.hdr.code = TVN_ITEMEXPANDING; nmtv.action = TVE_TOGGLE; nmtv.itemNew.hItem = hItem; nmtv.itemNew.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; TreeView_GetItem(hWnd, &nmtv.itemNew); nmtv.ptDrag = pt; if (SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nmtv)) return 0; HTREEITEM hOldSelItem = TreeView_GetSelection(hWnd); TreeView_Expand(hWnd, hItem, TVE_TOGGLE); HTREEITEM hNewSelItem = TreeView_GetSelection(hWnd); if (hNewSelItem != hOldSelItem) { TreeView_SetItemState(hWnd, hOldSelItem, (dat->SelectedItems.Find(hOldSelItem) == -1) ? 0 : TVIS_SELECTED, TVIS_SELECTED); TreeView_SetItemState(hWnd, hNewSelItem, (dat->SelectedItems.Find(hNewSelItem) == -1) ? 0 : TVIS_SELECTED, TVIS_SELECTED); } nmtv.hdr.code = TVN_ITEMEXPANDED; TreeView_GetItem(hWnd, &nmtv.itemNew); SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nmtv); return 0; } } if (hitFlags & MCLCHT_ONITEM) { if (wParam & MK_CONTROL) { SetFocus(hWnd); TREEITEMARRAY OldSelection = dat->SelectedItems; int nIndex = dat->SelectedItems.Find(hItem); if (nIndex == -1) { TreeView_SetItemState(hWnd, hItem, TVIS_SELECTED, TVIS_SELECTED); dat->SelectedItems.AddElem(hItem); } else { TreeView_SetItemState(hWnd, hItem, 0, TVIS_SELECTED); dat->SelectedItems.RemoveElem(nIndex); } dat->SelectGroups(hItem, nIndex == -1); NMCLIST nm; nm.hdr.code = MCLN_SELCHANGED; nm.hdr.hwndFrom = hWnd; nm.hdr.idFrom = GetDlgCtrlID(hWnd); nm.OldSelection = &OldSelection; nm.NewSelection = &dat->SelectedItems; SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm); return 0; } // if it was a click on the selected item and there's need to do something in this case, then send SELCHANGED notification by ourselves, as the tree control doesn't do anything if (hItem == TreeView_GetSelection(hWnd) && (dat->SelectedItems.GetSize() != 1 || (dat->SelectedItems.GetSize() == 1 && dat->SelectedItems[0] != hItem))) { TreeView_SetItemState(hWnd, hItem, TVIS_SELECTED, TVIS_SELECTED); NMTREEVIEW nm = {}; nm.hdr.code = TVN_SELCHANGED; nm.hdr.hwndFrom = hWnd; nm.hdr.idFrom = GetDlgCtrlID(hWnd); nm.itemOld.hItem = TreeView_GetSelection(hWnd); nm.itemOld.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; TreeView_GetItem(hWnd, &nm.itemOld); nm.itemNew = nm.itemOld; SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm); } } } break; case WM_SETFOCUS: case WM_KILLFOCUS: for (int i = 0; i < dat->SelectedItems.GetSize(); i++) { RECT rc; if (TreeView_GetItemRect(hWnd, dat->SelectedItems[i], &rc, false)) InvalidateRect(hWnd, &rc, false); } break; case WM_SIZE: case WM_HSCROLL: InvalidateRect(hWnd, nullptr, false); break; case WM_MEASUREITEM: if (!wParam) // if the message was sent by a menu return Menu_MeasureItem(lParam); break; case WM_DRAWITEM: if (!wParam) // if the message was sent by a menu return Menu_DrawItem(lParam); break; case WM_CONTEXTMENU: { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; HTREEITEM hItem = nullptr; if (pt.x == -1 && pt.y == -1) { if (dat->SelectedItems.GetSize() == 1) { hItem = dat->SelectedItems[0]; TreeView_EnsureVisible(hWnd, hItem); RECT rc; TreeView_GetItemRect(hWnd, hItem, &rc, true); pt.x = rc.left; pt.y = rc.bottom; } } else { DWORD hitFlags; ScreenToClient(hWnd, &pt); hItem = dat->HitTest(&pt, &hitFlags); if (!(hitFlags & MCLCHT_ONITEM)) hItem = nullptr; } if (hItem) { MCONTACT hContact = dat->GetItemData(hItem).hContact; if (IsHContactContact(hContact)) { HMENU hMenu = Menu_BuildContactMenu(hContact); if (hMenu) { ClientToScreen(hWnd, &pt); Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr), MPCF_CONTACTMENU, hContact); DestroyMenu(hMenu); return 0; } } } } break; case WM_DESTROY: if (dat->ExtraImageList) ImageList_Destroy(dat->ExtraImageList); dat->SelectedItems.RemoveAll(); dat->Items.RemoveAll(); break; } return CallWindowProc(dat->OrigTreeViewProc, hWnd, Msg, wParam, lParam); }
VOID FilterCheckChildren( IN HWND hWnd, IN PFILTER_CONTEXT Context, IN PFILTER_NODE Node, IN HWND hWndTree, IN HTREEITEM Parent, IN BOOLEAN Check ) { HTREEITEM Handle; TVITEMEX Item = {0}; TVITEMEX ParentItem = {0}; ULONG Unchecked, Checked; WCHAR Buffer[MAX_PATH]; Handle = TreeView_GetChild(hWndTree, Parent); Checked = INDEXTOSTATEIMAGEMASK(CHECKED); Unchecked = INDEXTOSTATEIMAGEMASK(UNCHECKED); while (Handle != NULL) { Item.mask = TVIF_STATE | TVIF_TEXT; Item.stateMask = TVIS_STATEIMAGEMASK ; Item.hItem = Handle; Item.pszText = Buffer; Item.cchTextMax = MAX_PATH; TreeView_GetItem(hWndTree, &Item); if (Check) { if (Item.state & Unchecked) { Item.state = Checked; TreeView_SetItemState(hWndTree, Handle, Item.state, TVIS_STATEIMAGEMASK); // // N.B. TreeView_SetItemState will incur a TVN_ITEMCHANGED notification // for VISTA and above systems, however, we need explicitly insert item // here for Windows XP/ SERVER 2003. // if (!BspIsVistaAbove()) { // // Insert item // FilterInsertListItem(hWnd, hWndTree, Node, Handle, Buffer, TRUE); Node->NumberOfSelected += 1; Context->NumberOfSelected += 1; StringCchPrintf(Buffer, MAX_PATH, FILTER_SELECT_STRING, Context->NumberOfSelected); SetWindowText(GetDlgItem(hWnd, IDC_STATIC), Buffer); } } } else { if (Item.state & Checked) { Item.state = Unchecked; TreeView_SetItemState(hWndTree, Handle, Item.state, TVIS_STATEIMAGEMASK); if (!BspIsVistaAbove()) { // // Delete item // FilterInsertListItem(hWnd, hWndTree, Node, Handle, Buffer, FALSE); Node->NumberOfSelected -= 1; Context->NumberOfSelected -= 1; StringCchPrintf(Buffer, MAX_PATH, FILTER_SELECT_STRING, Context->NumberOfSelected); SetWindowText(GetDlgItem(hWnd, IDC_STATIC), Buffer); } } } Handle = TreeView_GetNextSibling(hWndTree, Handle); } return; }
void TreeNode::SetState(int state, bool set) { TreeView_SetItemState(mTreeView->GetHandle(), mHandle, set ? state : 0, state); }
void MorphByBone::BuildTreeList() { //get our handle suspendUI = TRUE; HWND treeHWND = GetDlgItem(rollupHWND,IDC_TREE1); int tempBone, tempMorph; tempBone = currentBone; tempMorph = currentMorph; COLORREF clrBk = ColorMan()->GetColor(kWindow); TreeView_SetBkColor( treeHWND, clrBk); // TVITEM tvi; BitArray expanded; expanded.SetSize(boneData.Count()); expanded.ClearAll(); for (int i = 0; i < boneData.Count(); i++) { //if !null INode *node = GetNode(i); if (node != NULL) { //add to parent TSTR name = node->GetName(); //add the node as a root entry BOOL expand = TreeView_GetItemState(treeHWND,boneData[i]->treeHWND,TVIS_EXPANDED); if (expand) { expanded.Set(i); } } } TreeView_DeleteAllItems(treeHWND); currentBone = tempBone; currentMorph = tempMorph; //DebugPrint(_T("Morph name creatiuon\n")); //loop through our nodes for (int i = 0; i < boneData.Count(); i++) { //if !null INode *node = GetNode(i); if (node != NULL) { //add to parent TSTR name = node->GetName(); //add the node as a root entry boneData[i]->tvi.state = 0; HTREEITEM parent = AddItemToTree(treeHWND, boneData[i]->tvi, name,i,TVI_ROOT); boneData[i]->treeHWND = parent; if (expanded[i]) { boneData[i]->tvi.state = TVIS_EXPANDED; TreeView_SetItemState(treeHWND,boneData[i]->treeHWND,TVIS_EXPANDED,TVIS_EXPANDED); } if ((currentMorph == -1) && (i==currentBone)) { if (i==currentBone) { TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,TVIS_SELECTED,TVIS_SELECTED); TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,TVIS_BOLD,TVIS_BOLD); } else { TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,0,TVIS_SELECTED); TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,0,TVIS_BOLD); } } //loop through targets and add those as children for (int j = 0 ; j < boneData[i]->morphTargets.Count(); j++) { if (!boneData[i]->morphTargets[j]->IsDead()) { //add morph target to list TSTR morphName; if (boneData[i]->morphTargets[j]->IsDisabled()) morphName.printf(_T("%s(%s)"),boneData[i]->morphTargets[j]->name,GetString(IDS_DISABLED)); else morphName.printf(_T("%s(%0.1f)"),boneData[i]->morphTargets[j]->name,boneData[i]->morphTargets[j]->weight*100.f); // boneData[i]->morphTargets[j]->tvi.state = TVIS_BOLD ; // boneData[i]->morphTargets[j]->tvi.stateMask |= TVIS_BOLD ; //DebugPrint(_T("Morph name %s\n"),morphName); boneData[i]->morphTargets[j]->tvi.state = 0; boneData[i]->morphTargets[j]->treeHWND = AddItemToTree(treeHWND ,boneData[i]->morphTargets[j]->tvi, morphName, (i+1)*1000+j,parent); if ((i== currentBone) && (j == currentMorph)) { TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,TVIS_SELECTED ,TVIS_SELECTED ); TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,TVIS_BOLD ,TVIS_BOLD ); } else { TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,0 ,TVIS_SELECTED ); TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,0 ,TVIS_BOLD ); } } } } } suspendUI = FALSE; }