| 697 | } |
| 698 | |
| 699 | void Explorerplusplus::UpdateTreeViewSelection() |
| 700 | { |
| 701 | HTREEITEM hItem; |
| 702 | TCHAR szDirectory[MAX_PATH]; |
| 703 | TCHAR szRoot[MAX_PATH]; |
| 704 | UINT uDriveType; |
| 705 | BOOL bNetworkPath = FALSE; |
| 706 | |
| 707 | if (!m_InitializationFinished.get() || !m_config->synchronizeTreeview || !m_config->showFolders) |
| 708 | { |
| 709 | return; |
| 710 | } |
| 711 | |
| 712 | auto pidlDirectory = m_pActiveShellBrowser->GetDirectoryIdl(); |
| 713 | |
| 714 | GetDisplayName(pidlDirectory.get(),szDirectory,SIZEOF_ARRAY(szDirectory),SHGDN_FORPARSING); |
| 715 | |
| 716 | if(PathIsUNC(szDirectory)) |
| 717 | { |
| 718 | bNetworkPath = TRUE; |
| 719 | } |
| 720 | else |
| 721 | { |
| 722 | StringCchCopy(szRoot,SIZEOF_ARRAY(szRoot),szDirectory); |
| 723 | PathStripToRoot(szRoot); |
| 724 | uDriveType = GetDriveType(szRoot); |
| 725 | |
| 726 | bNetworkPath = (uDriveType == DRIVE_REMOTE); |
| 727 | } |
| 728 | |
| 729 | /* To improve performance, do not automatically sync the |
| 730 | treeview with network or UNC paths. */ |
| 731 | if(!bNetworkPath) |
| 732 | { |
| 733 | hItem = m_shellTreeView->LocateItem(pidlDirectory.get()); |
| 734 | |
| 735 | if(hItem != nullptr) |
| 736 | { |
| 737 | /* TVN_SELCHANGED is NOT sent when the new selected |
| 738 | item is the same as the old selected item. It is only |
| 739 | sent when the two are different. |
| 740 | Therefore, the only case to handle is when the treeview |
| 741 | selection is changed by browsing using the listview. */ |
| 742 | if (TreeView_GetSelection(m_hTreeView) != hItem) |
| 743 | { |
| 744 | m_bSelectingTreeViewDirectory = TRUE; |
| 745 | } |
| 746 | |
| 747 | SendMessage(m_hTreeView,TVM_SELECTITEM,(WPARAM)TVGN_CARET,(LPARAM)hItem); |
| 748 | } |
| 749 | } |
| 750 | } |
nothing calls this directly
no test coverage detected