FileBrowser :: createNewFolder

It would be very cool if you could add a “New folder here” button in the File browser that appears when you browse for saving (directory or file).
Ideally with a folder icon + * like on most OS.
It’s a very short change to the dialog box, and 2 lines to add in the button listener callback.

What do you think ?

Why don’t you change it yourself and post a .patch ?

  1. Because my code base is not like the official one. So my patch won’t apply on the GIT version.
  2. Because I ask for comment before doing a work on my side that’d be of low value if it’s not desired.
  3. When I add feature to Juce that doesn’t need any comment, I usually send a mail to Jules directly.

That said, I already have this change in my codebase, and I’m slowly merging with the Git version, so I’m trying to get this integrated in a way that fit Jules’s idea.

It’s a good suggestion - how did you arrange the layout of the buttons?

Currently, I’ve modified the code to read

void FileBrowserComponent::resized()
{
    getLookAndFeel()
        .layoutFileBrowserComponent (*this, fileListComponent,
                                     previewComp, currentPathBox,
                                     filenameBox, goUpButton);
    newFolder->setBounds(goUpButton->getRight() - 16, goUpButton->getY(), 16, 16);
    currentPathBox->setBounds (goUpButton->getX() - currentPathBox->getWidth(), currentPathBox->getY(), currentPathBox->getWidth() - 16, currentPathBox->getHeight());
    goUpButton->setBounds(goUpButton->getLeft() - 16, goUpButton->getY(), goUpButton->getWidth(), goUpButton()->getHeight());
}

The path box is 16px less wide. This gives space to the new folder button (mine is a text button showing “*”, but if you move to the look and feel, you can reuse the default folder icon).

It’s not nice, ideally, I should have modified the look and feel method. Adding a last default parameter “Button * newFolder = 0” shouldn’t have any impact on current user code.