* @brief Expand subfolder * @param [in] sel Folder item index in listview. */
| 1360 | * @param [in] sel Folder item index in listview. |
| 1361 | */ |
| 1362 | void CDirView::ExpandSubdir(int sel, bool bRecursive) |
| 1363 | { |
| 1364 | DIFFITEM& dip = GetDiffItem(sel); |
| 1365 | if (!m_bTreeMode || (dip.customFlags & ViewCustomFlags::EXPANDED) || !dip.HasChildren()) |
| 1366 | return; |
| 1367 | |
| 1368 | m_pList->SetRedraw(FALSE); // Turn off updating (better performance) |
| 1369 | |
| 1370 | size_t oldItemCount = m_listViewItems.size(); |
| 1371 | |
| 1372 | CDiffContext &ctxt = GetDiffContext(); |
| 1373 | dip.customFlags |= ViewCustomFlags::EXPANDED; |
| 1374 | if (bRecursive) |
| 1375 | ExpandSubdirs(ctxt, dip); |
| 1376 | |
| 1377 | DIFFITEM *diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel)); |
| 1378 | UINT indext = sel + 1; |
| 1379 | int alldiffs; |
| 1380 | RedisplayChildren(diffpos, dip.GetDepth() + 1, indext, alldiffs); |
| 1381 | |
| 1382 | SortColumnsAppropriately(); |
| 1383 | |
| 1384 | if (m_pList->GetNextItem(sel, LVNI_SELECTED) != -1) |
| 1385 | { |
| 1386 | LVITEM lvi {0, sel + 1}; |
| 1387 | for (size_t i = 0; i < m_listViewItems.size() - oldItemCount; i++) |
| 1388 | m_pList->InsertItem(&lvi); |
| 1389 | } |
| 1390 | else |
| 1391 | { |
| 1392 | m_pList->SetItemCountEx(static_cast<int>(m_listViewItems.size()), LVSICF_NOSCROLL); |
| 1393 | } |
| 1394 | |
| 1395 | m_pList->SetRedraw(TRUE); // Turn updating back on |
| 1396 | m_pList->Invalidate(); |
| 1397 | } |
| 1398 | |
| 1399 | /** |
| 1400 | * @brief Open parent folder if possible. |
nothing calls this directly
no test coverage detected