From e7ef2e600bf5b6dcdfa8db9c16e219210513cbea Mon Sep 17 00:00:00 2001 From: Anatolii Hrynchuk Date: Thu, 26 Nov 2026 21:18:21 +0200 Subject: [PATCH] Use compact breadcrumbs above Files panels in Lavender Refs #201 --- FILES-UI.md | 3 + src/files_lavender.inl | 17 ++- src/files_main.cpp | 25 ++-- src/files_path_bar.inl | 217 ++++++++++++++++++++++++++++++++++ src/files_path_navigation.inl | 127 +------------------- tests/files_lavender.ps1 | 37 +++++- 6 files changed, 281 insertions(+), 145 deletions(-) create mode 100644 src/files_path_bar.inl diff --git a/FILES-UI.md b/FILES-UI.md index 3b9a76c..8d46061 100644 --- a/FILES-UI.md +++ b/FILES-UI.md @@ -732,6 +732,9 @@ Warning і початковий фокус на No. попередньої гілки. Клік по поточній папці або кнопці редагування та Ctrl+L відкривають поле шляху. Tab доповнює назву папки, Enter відкриває шлях, а Esc повертає до тих самих панелей і курсора. +- Над обома панелями працює спільний компонент рядка шляху. У Lavender кнопки + навігації стоять ліворуч, а сегменти за шириною підпису розділяються знаком `›`. + Назва поточної папки виділена напівжирним шрифтом і заокругленим фоном. - У заголовку FTP- чи SFTP-папки клік по назві профілю відкриває збережені підключення. У LAN-папці клік по назві ПК відкриває спарені комп’ютери diff --git a/src/files_lavender.inl b/src/files_lavender.inl index 852f740..80b3cab 100644 --- a/src/files_lavender.inl +++ b/src/files_lavender.inl @@ -6,13 +6,19 @@ constexpr COLORREF activeEdge=RGB(151,151,244), selection=RGB(231,227,253), idle constexpr COLORREF folder=RGB(124,133,227), key=RGB(231,230,252), path=RGB(247,247,253); constexpr COLORREF marked=RGB(105,52,170), markedSelection=RGB(219,209,250); -HFONT font{}; +HFONT font{}, emphasis{}; void setFont(UINT dpi) { if(font) DeleteObject(font); - font=CreateFontW(-MulDiv(14,dpi,96),0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET, - OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,CLEARTYPE_QUALITY,DEFAULT_PITCH,L"Segoe UI"); + if(emphasis) DeleteObject(emphasis); + const auto create=[&](int weight) + { + return CreateFontW(-MulDiv(14,dpi,96),0,0,0,weight,FALSE,FALSE,FALSE,DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,CLEARTYPE_QUALITY,DEFAULT_PITCH,L"Segoe UI"); + }; + font=create(FW_NORMAL); + emphasis=create(FW_SEMIBOLD); } void fill(HDC dc,const RECT &rect,COLORREF color) @@ -34,10 +40,11 @@ void rounded(HDC dc,RECT rect,int radius,COLORREF color,COLORREF border) } void text(HDC dc,RECT rect,const wchar_t *label,COLORREF color,UINT alignment=DT_LEFT, - UINT ellipsis=DT_END_ELLIPSIS) + UINT ellipsis=DT_END_ELLIPSIS,HFONT textFont=nullptr) { if(rect.right<=rect.left) return; - const auto previous=SelectObject(dc,font?font:GetStockObject(DEFAULT_GUI_FONT)); + if(!textFont) textFont=font; + const auto previous=SelectObject(dc,textFont?textFont:GetStockObject(DEFAULT_GUI_FONT)); const auto background=SetBkMode(dc,TRANSPARENT); const auto inkColor=SetTextColor(dc,color); DrawTextW(dc,label,-1,&rect,DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX|alignment|ellipsis); diff --git a/src/files_main.cpp b/src/files_main.cpp index 474f2d4..ed1ee03 100644 --- a/src/files_main.cpp +++ b/src/files_main.cpp @@ -8847,6 +8847,7 @@ void handleFilesReturn(bool shift) } #include "files_smb.inl" +#include "files_path_bar.inl" #include "files_path_navigation.inl" LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp) @@ -9260,22 +9261,11 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp) { auto bounds=item.rcItem; const auto &panel=panels[item.CtlID-142]; - const auto path=panelCaption(panel); + const bool highlighted=static_cast(item.CtlID)-142==active; + const bool navigable=pathNavigationAvailable(panel); if(lavenderFiles()) { - const LavenderMetrics metrics(window); - const bool highlighted=static_cast(item.CtlID)-142==active; - lavender::fill(item.hDC,bounds,lavender::surface); - lavender::rounded(item.hDC,bounds,metrics.px(7),lavender::path, - highlighted?lavender::activeEdge:lavender::line); - if(pathNavigationAvailable(panel)) paintPanelPath(item.hDC,bounds,panel,highlighted); - else - { - paintLavenderFileIcon(item.hDC,bounds,metrics,true); - bounds.left+=metrics.px(30); - bounds.right-=metrics.px(9); - lavender::text(item.hDC,bounds,path.c_str(),lavender::ink,DT_LEFT,DT_PATH_ELLIPSIS); - } + paintLavenderPanelPath(item,panel,navigable,highlighted); return TRUE; } FillRect(item.hDC,&bounds,blue); @@ -9298,12 +9288,12 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp) FillRect(item.hDC,&column,lineBrush); } } - const bool highlighted=static_cast(item.CtlID)-142==active; - if(pathNavigationAvailable(panel)) + if(navigable) { - paintPanelPath(item.hDC,bounds,panel,highlighted); + paintPanelPath(item.hDC,item.hwndItem,bounds,panel,highlighted); return TRUE; } + const auto path=panelCaption(panel); if(path.empty()) return TRUE; const int saved=SaveDC(item.hDC); SelectObject(item.hDC,mono); @@ -10251,6 +10241,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show) } for(auto font:fileStyleFonts) if(font) DeleteObject(font); if(lavender::font) DeleteObject(lavender::font); + if(lavender::emphasis) DeleteObject(lavender::emphasis); DeleteObject(mono); DeleteObject(terminalFont); DeleteObject(blue); diff --git a/src/files_path_bar.inl b/src/files_path_bar.inl new file mode 100644 index 0000000..473fd10 --- /dev/null +++ b/src/files_path_bar.inl @@ -0,0 +1,217 @@ +enum class PathAction { back, forward, up, edit, source, ancestors, previous, folder }; + +struct PathPart +{ + PathAction action{}; + std::wstring label; + fs::path target; + std::vector hidden; + RECT rect{}; + RECT separator{}; + bool current{}, dim{}, enabled=true; +}; + +std::wstring pathSegmentLabel(const fs::path &path,FolderProvider provider,bool compact) +{ + if(isTransferFolder(provider) && path==ftpRoot) return L"/"; + if(compact && provider==FolderProvider::local && !path.has_relative_path()) + { + auto drive=path.root_name().native(); + if(drive.size()==2 && drive.back()==L':') return drive; + } + return panelParentPath(path,provider==FolderProvider::local).empty()?path.native():path.filename().native(); +} + +struct PathBarMetrics +{ + bool compact; + LavenderMetrics dpi; + LONG button, padding, separator; + + PathBarMetrics(HWND window,RECT bounds): compact(lavenderFiles()),dpi(window), + button(std::max(1L,std::min(compact?static_cast(dpi.px(21)):2L*cellWidth, + (bounds.right-bounds.left)/7))), + padding(compact?dpi.px(7):0),separator(compact?dpi.px(9):0) {} + + RECT breadcrumbBounds(RECT bounds) const + { + bounds.left=std::min(bounds.right,bounds.left+4*button+dpi.px(2)); + return bounds; + } +}; + +std::vector panelPathParts(HDC dc,const Panel &panel,RECT bounds,const PathBarMetrics &metrics) +{ + if(bounds.right<=bounds.left) return {}; + const LONG width=metrics.button; + const auto breadcrumb=metrics.breadcrumbBounds(bounds); + const auto font=metrics.compact && dc?SelectObject(dc,lavender::font?lavender::font:GetStockObject(DEFAULT_GUI_FONT)):nullptr; + const auto measure=[&](const std::wstring &label,bool current=false) + { + SIZE size{}; + if(font) + { + const auto regular=current && lavender::emphasis?SelectObject(dc,lavender::emphasis):nullptr; + const auto measured=GetTextExtentPoint32W(dc,label.c_str(),static_cast(label.size()),&size); + if(regular) SelectObject(dc,regular); + if(measured) return size.cx+2*metrics.padding; + } + return static_cast(label.size()+2)*cellWidth; + }; + std::vector parts; + bool hasCrumb=false; + const auto add=[&](PathPart part,LONG length,bool crumb=false) + { + if(length<=0 || bounds.left>=bounds.right) return; + if(crumb && hasCrumb && metrics.separator) + { + const auto end=std::min(bounds.right-1,bounds.left+metrics.separator); + part.separator={bounds.left,bounds.top,end,bounds.bottom}; + bounds.left=end; + } + part.rect={bounds.left,bounds.top,std::min(bounds.right,bounds.left+length),bounds.bottom}; + bounds.left=part.rect.right; + parts.push_back(std::move(part)); + hasCrumb|=crumb; + }; + const auto location=folderLocation(panel,panel.directory); + const auto provider=location.provider; + const auto local=provider==FolderProvider::local; + const auto parent=panelParentPath(panel.directory,local); + add({.action=PathAction::back,.label=L"←",.enabled=panel.navigation.neighbor(-1).has_value()},width); + add({.action=PathAction::forward,.label=L"→",.enabled=panel.navigation.neighbor(1).has_value()},width); + add({.action=PathAction::up,.label=L"↑",.target=parent,.enabled=!parent.empty()},width); + add({.action=PathAction::edit,.label=L"✎"},width); + + if(metrics.compact) + { + bounds.left=std::min(bounds.right,breadcrumb.left+metrics.dpi.px(1)); + bounds.right=std::max(bounds.left,bounds.right-metrics.dpi.px(1)); + } + if(!local && (!metrics.compact || !location.label.empty())) + { + const auto available=std::max(1L,(bounds.right-bounds.left)/2); + add({.action=PathAction::source,.label=location.label},std::min(available,measure(location.label)),true); + } + + std::vector ancestors, previous; + for(auto path=parent;!path.empty();path=panelParentPath(path,local)) ancestors.push_back(path); + std::reverse(ancestors.begin(),ancestors.end()); + if(inFolderBranch(panel.directory,panel.navigation.previousBranch,provider)) + { + for(auto path=panel.navigation.previousBranch;!sameFolderPath(path,panel.directory,provider); + path=panelParentPath(path,local)) + previous.push_back(path); + std::reverse(previous.begin(),previous.end()); + } + + const LONG room=bounds.right-bounds.left; + const auto label=[&](const fs::path &path) { return pathSegmentLabel(path,provider,metrics.compact); }; + const auto segmentWidth=[&](const fs::path &path) { return measure(label(path))+metrics.separator; }; + const LONG overflowWidth=width+metrics.separator; + LONG currentWidth=measure(label(panel.directory),true); + LONG required=currentWidth+metrics.separator; + for(const auto &path:ancestors) required+=segmentWidth(path); + for(const auto &path:previous) required+=segmentWidth(path); + if(!hasCrumb) required-=metrics.separator; + size_t firstAncestor=0,visiblePrevious=previous.size(); + if(required>room) + { + const LONG reserved=(!ancestors.empty()?overflowWidth:0)+(!previous.empty()?overflowWidth:0)+ + (hasCrumb?metrics.separator:0); + currentWidth=std::min(currentWidth,std::max(1L,room-reserved)); + LONG remaining=room-currentWidth-reserved; + firstAncestor=ancestors.size(); + while(firstAncestor && remaining>=segmentWidth(ancestors[firstAncestor-1])) + remaining-=segmentWidth(ancestors[--firstAncestor]); + visiblePrevious=0; + while(visiblePrevious=segmentWidth(previous[visiblePrevious])) + remaining-=segmentWidth(previous[visiblePrevious++]); + } + + if(firstAncestor) + add({.action=PathAction::ancestors,.label=L"…", + .hidden={ancestors.begin(),ancestors.begin()+firstAncestor}},width,true); + for(size_t i=firstAncestor;i2*radius) + { + const LONG x=(gap.left+gap.right)/2, y=(gap.top+gap.bottom)/2; + const auto pen=SelectObject(dc,separatorPen?separatorPen:GetStockObject(DC_PEN)); + if(!separatorPen) SetDCPenColor(dc,lavender::muted); + MoveToEx(dc,x-1,y-radius,nullptr); + LineTo(dc,x+radius-1,y); + LineTo(dc,x-1,y+radius+1); + SelectObject(dc,pen); + } + if(part.current) + { + auto chip=part.rect; + InflateRect(&chip,0,-metrics.dpi.px(3)); + lavender::rounded(dc,chip,metrics.dpi.px(5),lavender::key,lavender::key); + InflateRect(&label,-metrics.dpi.px(4),0); + } + lavender::text(dc,label,part.label.c_str(),!part.enabled || part.dim?lavender::muted:lavender::ink, + DT_CENTER,DT_END_ELLIPSIS,part.current?lavender::emphasis:nullptr); + continue; + } + FillRect(dc,&part.rect,current?teal:blue); + SetTextColor(dc,!part.enabled || part.dim?RGB(160,170,190):colors[current?Text:Frame]); + auto text=part.rect; + DrawTextW(dc,part.label.c_str(),static_cast(part.label.size()),&text, + DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX); + } + if(separatorPen) DeleteObject(separatorPen); + if(saved) RestoreDC(dc,saved); +} + +void paintLavenderPanelPath(const DRAWITEMSTRUCT &item,const Panel &panel,bool navigable,bool activePanel) +{ + auto bounds=item.rcItem; + lavender::fill(item.hDC,bounds,lavender::surface); + if(navigable) + { + paintPanelPath(item.hDC,item.hwndItem,bounds,panel,activePanel); + return; + } + const LavenderMetrics metrics(item.hwndItem); + lavender::rounded(item.hDC,bounds,metrics.px(7),lavender::path, + activePanel?lavender::activeEdge:lavender::line); + paintLavenderFileIcon(item.hDC,bounds,metrics,true); + bounds.left+=metrics.px(30); + bounds.right-=metrics.px(9); + const auto caption=panelCaption(panel); + lavender::text(item.hDC,bounds,caption.c_str(),lavender::ink,DT_LEFT,DT_PATH_ELLIPSIS); +} diff --git a/src/files_path_navigation.inl b/src/files_path_navigation.inl index 348d406..e0a9a7b 100644 --- a/src/files_path_navigation.inl +++ b/src/files_path_navigation.inl @@ -4,8 +4,6 @@ bool pathNavigationAvailable(const Panel &panel) return !transferProfileList(panel) && !panel.findOrigin && !panel.archive && !panel.directory.empty(); } -enum class PathAction { back, forward, up, edit, source, ancestors, previous, folder }; - void navigatePanelPath(Panel &panel,const fs::path &path) { if(path.empty()) return; @@ -25,125 +23,6 @@ void navigatePanelHistory(Panel &panel,int direction) } } -struct PathPart -{ - PathAction action{}; - std::wstring label; - fs::path target; - std::vector hidden; - RECT rect{}; - bool current{}, dim{}, enabled=true; -}; - -std::wstring pathSegmentLabel(const fs::path &path,FolderProvider provider) -{ - if(isTransferFolder(provider) && path==ftpRoot) return L"/"; - return panelParentPath(path,provider==FolderProvider::local).empty()?path.native():path.filename().native(); -} - -LONG segmentWidth(const fs::path &path,FolderProvider provider) -{ - return static_cast(pathSegmentLabel(path,provider).size()+2)*cellWidth; -} - -std::vector panelPathParts(const Panel &panel,RECT bounds) -{ - const LONG total=bounds.right-bounds.left; - if(total<=0) return {}; - const LONG width=std::max(1L,std::min(2L*cellWidth,total/7)); - std::vector parts; - const auto add=[&](PathPart part,LONG length) - { - if(length<=0 || bounds.left>=bounds.right) return; - part.rect={bounds.left,bounds.top,std::min(bounds.right,bounds.left+length),bounds.bottom}; - bounds.left=part.rect.right; - parts.push_back(std::move(part)); - }; - const auto location=folderLocation(panel,panel.directory); - const auto provider=location.provider; - const auto local=provider==FolderProvider::local; - const auto parent=panelParentPath(panel.directory,local); - add({.action=PathAction::back,.label=L"←",.enabled=panel.navigation.neighbor(-1).has_value()},width); - add({.action=PathAction::forward,.label=L"→",.enabled=panel.navigation.neighbor(1).has_value()},width); - add({.action=PathAction::up,.label=L"↑",.target=parent,.enabled=!parent.empty()},width); - add({.action=PathAction::edit,.label=L"✎"},width); - - if(!local) - { - const auto available=std::max(1L,(bounds.right-bounds.left)/2); - const auto sourceWidth=std::min(available,static_cast(location.label.size()+2)*cellWidth); - add({.action=PathAction::source,.label=location.label},sourceWidth); - } - - std::vector ancestors, previous; - for(auto path=parent;!path.empty();path=panelParentPath(path,local)) ancestors.push_back(path); - std::reverse(ancestors.begin(),ancestors.end()); - if(inFolderBranch(panel.directory,panel.navigation.previousBranch,provider)) - { - for(auto path=panel.navigation.previousBranch;!sameFolderPath(path,panel.directory,provider); - path=panelParentPath(path,local)) - previous.push_back(path); - std::reverse(previous.begin(),previous.end()); - } - - const LONG room=bounds.right-bounds.left; - LONG required=segmentWidth(panel.directory,provider); - for(const auto &path:ancestors) required+=segmentWidth(path,provider); - for(const auto &path:previous) required+=segmentWidth(path,provider); - size_t firstAncestor=0,visiblePrevious=previous.size(); - LONG currentWidth=segmentWidth(panel.directory,provider); - if(required>room) - { - const LONG reserved=(!ancestors.empty()?width:0)+(!previous.empty()?width:0); - currentWidth=std::min(currentWidth,std::max(1L,room-reserved)); - LONG remaining=room-currentWidth-reserved; - firstAncestor=ancestors.size(); - while(firstAncestor && remaining>=segmentWidth(ancestors[firstAncestor-1],provider)) - remaining-=segmentWidth(ancestors[--firstAncestor],provider); - visiblePrevious=0; - while(visiblePrevious=segmentWidth(previous[visiblePrevious],provider)) - remaining-=segmentWidth(previous[visiblePrevious++],provider); - } - - if(firstAncestor) - add({.action=PathAction::ancestors,.label=L"…", - .hidden={ancestors.begin(),ancestors.begin()+firstAncestor}},width); - for(size_t i=firstAncestor;i(part.label.size()),&text, - DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX); - } - if(saved) RestoreDC(dc,saved); -} - constexpr int addressField=485,addressLabel=486,addressFooter=487; struct PathPrompt @@ -439,7 +318,11 @@ LRESULT CALLBACK pathBarInput(HWND window,UINT message,WPARAM wp,LPARAM lp,UINT_ RECT bounds{}; GetClientRect(window,&bounds); const POINT mouse{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)}; - const auto parts=panelPathParts(panel,bounds); + const PathBarMetrics metrics(window,bounds); + const auto dc=metrics.compact?GetDC(window):nullptr; + if(metrics.compact && !dc) return 0; + const auto parts=panelPathParts(dc,panel,bounds,metrics); + if(dc) ReleaseDC(window,dc); for(const auto &part:parts) { if(!part.enabled || !PtInRect(&part.rect,mouse)) continue; diff --git a/tests/files_lavender.ps1 b/tests/files_lavender.ps1 index fe60f6e..2e83d81 100644 --- a/tests/files_lavender.ps1 +++ b/tests/files_lavender.ps1 @@ -67,6 +67,29 @@ function Test-Pixel($Image, $Bounds, $X, $Y, $Expected, $Description) { } } +function Test-PathBar($Image, $Bounds, $Path, [double]$Scale, [string]$Name) { + $chip = [Drawing.ColorTranslator]::FromHtml('#E7E6FC').ToArgb() + $separator = [Drawing.ColorTranslator]::FromHtml('#5B6185').ToArgb() + $chipColumns = [Collections.Generic.List[int]]::new() + $chevrons = 0 + $chipY = $Path.Top - $Bounds.Top + [int](5 * $Scale) + $centerY = [int][Math]::Floor(($Path.Top + $Path.Bottom) / 2) - $Bounds.Top + for ($x = $Path.Left - $Bounds.Left + [int](85 * $Scale); $x -lt $Path.Right - $Bounds.Left; $x++) { + if ($Image.GetPixel($x, $chipY).ToArgb() -eq $chip) { $chipColumns.Add($x) } + if ($Image.GetPixel($x, $centerY).ToArgb() -eq $separator) { $chevrons++ } + } + if ($chevrons -eq 0) { throw "$Name does not render a breadcrumb chevron." } + if ($chipColumns.Count -lt [int](35 * $Scale) -or $chipColumns.Count -gt [int](93 * $Scale)) { + throw "$Name does not fit the current-folder chip to its label ($($chipColumns.Count) pixels)." + } + $edgeY = $Path.Top - $Bounds.Top + [int][Math]::Floor($Scale) + $chipCenter = $chipColumns[[int][Math]::Floor($chipColumns.Count / 2)] + if ($Image.GetPixel($chipCenter, $edgeY).ToArgb() -eq $chip) { + throw "$Name current-folder chip touches the top edge of the bar." + } + $chipCenter + $Bounds.Left - $Path.Left +} + function Open-LavenderOptions($Window) { $keyboard.SendKeys('{F9}') Wait-Until { [LavenderWindow]::IsWindowVisible([LavenderWindow]::GetDlgItem($Window, 133)) } @@ -197,12 +220,15 @@ try { if ($leftIndex -lt 0 -or $rightIndex -lt 0) { throw 'Missing current row for the appearance check.' } $command = Get-Bounds ([LavenderWindow]::GetDlgItem($window, 113)) $leftPath = Get-Bounds ([LavenderWindow]::GetDlgItem($window, 142)) - $rightPath = Get-Bounds ([LavenderWindow]::GetDlgItem($window, 143)) + $rightPathWindow = [LavenderWindow]::GetDlgItem($window, 143) + $rightPath = Get-Bounds $rightPathWindow $pad = [int](8 * $scale) $image = Read-Window $bounds try { Test-Pixel $image $bounds ($leftPath.Left - $pad) ($leftPath.Top - $pad) '#EEF0FA' 'Rounded panel corner' Test-Pixel $image $bounds ($rightPath.Left + 30) ($rightPath.Top - $pad) '#9797F4' 'Active panel outline' + [void](Test-PathBar $image $bounds $leftPath $scale 'Inactive panel path') + $currentFolderX = Test-PathBar $image $bounds $rightPath $scale 'Active panel path' Test-Pixel $image $bounds ([int](($leftBounds.Left + $leftBounds.Right) / 2)) ($leftBounds.Top + $leftIndex * $rowHeight + 5) '#F0F1F9' 'Inactive row' Test-Pixel $image $bounds ([int](($rightBounds.Left + $rightBounds.Right) / 2)) ($rightBounds.Top + $rightIndex * $rowHeight + 5) '#E7E3FD' 'Active row after Tab' Test-Pixel $image $bounds ($command.Right - 9) ($command.Top + 5) '#F7F7FD' 'Command button surface' @@ -217,6 +243,15 @@ try { } } finally { $image.Dispose() } + $middleY = [int](($rightPath.Bottom - $rightPath.Top) / 2) + $click = [IntPtr](($middleY -shl 16) + $currentFolderX) + [void][LavenderWindow]::Post($rightPathWindow, 0x201, [IntPtr]1, $click) + [void][LavenderWindow]::Post($rightPathWindow, 0x202, [IntPtr]::Zero, $click) + Wait-Until { [LavenderWindow]::GetDlgItem([LavenderWindow]::GetLastActivePopup($window), 485) -ne [IntPtr]::Zero } + $address = [LavenderWindow]::GetLastActivePopup($window) + [void][LavenderWindow]::Post($address, 0x111, [IntPtr]2, [IntPtr]::Zero) + Wait-Until { ![LavenderWindow]::IsWindow($address) -and [LavenderWindow]::Activate($window) } + if ($DialogScreenshotDirectory) { [void][IO.Directory]::CreateDirectory($DialogScreenshotDirectory) } Test-LavenderDialog $window '{F5}' 211 'Copy' Test-LavenderDialog $window '{F6}' 211 'Rename/Move'