6433: add show directory button in filedialog closes #6422 r=Robyt3 a=Marmare314

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
This commit is contained in:
bors[bot] 2023-03-17 11:30:35 +00:00 committed by GitHub
commit 5e2e1e25e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4899,6 +4899,7 @@ void CEditor::RenderFileDialog()
static int s_RefreshButton = 0;
static int s_NewFolderButton = 0;
static int s_MapInfoButton = 0;
static int s_ShowDirectoryButton = 0;
CUIRect Button;
ButtonBar.VSplitRight(50.0f, &ButtonBar, &Button);
@ -4977,6 +4978,16 @@ void CEditor::RenderFileDialog()
if(DoButton_Editor(&s_RefreshButton, "Refresh", 0, &Button, 0, nullptr) || (s_ListBoxUsed && (Input()->KeyIsPressed(KEY_F5) || (Input()->ModifierIsPressed() && Input()->KeyIsPressed(KEY_R)))))
FilelistPopulate(m_FileDialogLastPopulatedStorageType, true);
ButtonBar.VSplitRight(40.0f, &ButtonBar, nullptr);
ButtonBar.VSplitRight(90.0f, &ButtonBar, &Button);
if(DoButton_Editor(&s_ShowDirectoryButton, "Show directory", 0, &Button, 0, "Open the current directory in the file browser"))
{
if(!open_file(aPath))
{
dbg_msg("editor", "couldn't open file '%s'", aPath);
}
}
if(m_FileDialogStorageType == IStorage::TYPE_SAVE)
{
ButtonBar.VSplitLeft(40.0f, nullptr, &ButtonBar);