Implements navigation bar featuring:
- back/forward buttons
- go up button
- address crumbs
- hides crumbs when there's not enough space to display all of them
- always shows at least 2 crumbs
- truncating them if needed
- first crumb is at least 56px
- aligns label to the left if truncated
- right clicking on the crumb, or free space, opens a menu with `Copy address as text` and `Edit address` options
- reuses existing crumbs to avoid some flickering
- overflow menu
- first crumb is always moved here
- removes the split, if there are no items in the menu
- hidden crumbs are moved here
- left or right click on the button starts address editing
- address edit
- accepts an existing path
- expands environment variables, e.g. `%APPDATA%\Microsoft` -> `C:\users\%USERNAME%\AppData\Roaming\Microsoft`
- errors with a `MessageBox` on nonexistent paths
- refresh button
- changes into go to button when editing address
- DPI scaling
Screenshots:






Remaining issues:
- crumbs not lighting up when hovered sometimes
- can be observed in current file dialog, hovering over dropdown arrow of a file type fixes it for a moment
- crumbs flickering on address change sometimes
- mostly when there's not enough space to display all of them
- `DeferWindowPos` doesn't seem to be atomic in Wine, presumably is in native Windows?
- unexpected address conversion for some PIDLs
- e.g. `Desktop` -> `C:\users\%USERNAME%\Desktop`, which is an entirely different location
- or `My Computer` into an empty string
- known folders are not handled by address edit, e.g. `Desktop`, `My Computer`
- icons are not DPI scaled
- while writing this:
```
0024:fixme:bitmap:NtGdiCreateBitmap planes = 0
0024:err:system:user_check_not_lock BUG: holding USER lock
wine/dlls/win32u/sysparams.c:396: user_check_not_lock: Assertion `0' failed.
wine: Assertion failed at address F7FF8549 (thread 0024), starting debugger...
```
- can't reproduce, happened when clicking on an item in overflow menu
- race condition? cosmic ray?
Addresses following bugs:
- https://bugs.winehq.org/show_bug.cgi?id=29912
- https://bugs.winehq.org/show_bug.cgi?id=50338
- https://bugs.winehq.org/show_bug.cgi?id=51855 (partially? no search box)
--
v5: comdlg32: Add refresh/go to button to IFileDialog navigation bar.
comdlg32: Add address edit to IFileDialog navigation bar.
comdlg32: Add breadcrumb overflow menu to IFileDialog navigation bar.
comdlg32: Add address breadcrumbs to IFileDialog navigation bar.
comdlg32: Add go up button to IFileDialog navigation bar.
comdlg32: Add IFileDialog navigation bar.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857
On Wed Dec 28 23:08:08 2022 +0000, Vladislav Timonin wrote:
> Just some padding so that the icon isn't so close to the text. Probably
> could use a comment.
> `dis->rcItem.left, dis->rcItem.top` on the left.
> `dis->rcItem.left - (icon_width / 2), dis->rcItem.top` on the right.
> 
Was pointed out that I shouldn't draw outside `rcItem` and can add padding in `WM_MEASUREITEM` instead. Should've read docs thoroughly enough ,_,

--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20183
On Wed Dec 28 19:30:29 2022 +0000, Esme Povirk wrote:
> Drawing outside of rcItem doesn't seem right. Why is this necessary?
Just some padding so that the icon isn't so close to the text. Probably could use a comment.
`dis->rcItem.left, dis->rcItem.top` on the left.
`dis->rcItem.left - (icon_width / 2), dis->rcItem.top` on the right.

--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20182
On Wed Dec 28 19:30:28 2022 +0000, Esme Povirk wrote:
> I think you could remove the need for this by drawing the left border
> outside the window.
If you mean extending it to be painted under crumbs, it originally was, static control with `SS_GRAYFRAME` taking up full width. But that had issues with frame being painted over crumbs on initial dialog show. And right border trailing on resize that I was ignoring thinking it was caused by [54137](https://bugs.winehq.org/show_bug.cgi?id=54137).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20181
On Wed Dec 28 19:30:30 2022 +0000, Esme Povirk wrote:
> I think removing items from the list like this is confusing. It also
> results in the need for a special case "preserving" the first crumb in
> the layout code.
This is similar to what Windows does, but it indeed does complicate things a little, I'll remove it.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20180
Esme Povirk (@madewokherd) commented about dlls/comdlg32/navbar.c:
> hwnd, 0, COMDLG32_hInstance, NULL);
> SetWindowSubclass(info->background_hwnd, NAVBAR_BACKGROUND_SubclassProc, 0, (DWORD_PTR)info);
>
> + info->overflow_hwnd = CreateWindowExW(0, WC_BUTTONW, NULL,
For accessibility it'd be good to give this button a title.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20177
Esme Povirk (@madewokherd) commented about dlls/comdlg32/navbar.c:
> while (ILRemoveLastID(pidl));
> ILFree(pidl);
>
> + NAVBAR_OVERFLOW_Clear(info);
> +
> + /* move the first crumb to overflow menu, if there are at least 2 crumbs */
> + crumb1 = LIST_ENTRY(list_head(&new_crumbs), struct crumb, entry);
> + if (crumb1 && crumb1->entry.next != &new_crumbs)
> + {
> + NAVBAR_OVERFLOW_Insert(info, crumb1->pidl, crumb1->display_name);
> + DestroyWindow(crumb1->hwnd);
> +
> + list_remove(&crumb1->entry);
I think removing items from the list like this is confusing. It also results in the need for a special case "preserving" the first crumb in the layout code.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1857#note_20178