mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-04 03:40:07 +00:00
win32 FileChooser fix.
This commit is contained in:
parent
08339c92e2
commit
01571e2b0f
2 changed files with 32 additions and 22 deletions
|
|
@ -244136,7 +244136,7 @@ namespace FileChooserHelpers
|
|||
if (ofn->hdr.code == CDN_SELCHANGE)
|
||||
{
|
||||
FileChooserCallbackInfo* info = (FileChooserCallbackInfo*) ofn->lpOFN->lCustData;
|
||||
FilePreviewComponent* comp = static_cast<FilePreviewComponent*> (info->customComponent->getChildComponent(0));
|
||||
FilePreviewComponent* comp = dynamic_cast<FilePreviewComponent*> (info->customComponent->getChildComponent(0));
|
||||
|
||||
if (comp != 0)
|
||||
{
|
||||
|
|
@ -244170,8 +244170,9 @@ namespace FileChooserHelpers
|
|||
|
||||
void resized()
|
||||
{
|
||||
if (getNumChildComponents() > 0)
|
||||
getChildComponent(0)->setBounds (getLocalBounds());
|
||||
Component* const c = getChildComponent(0);
|
||||
if (c != 0)
|
||||
c->setBounds (getLocalBounds());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -244179,13 +244180,14 @@ namespace FileChooserHelpers
|
|||
};
|
||||
}
|
||||
|
||||
void FileChooser::showPlatformDialog (Array<File>& results, const String& title, const File& currentFileOrDirectory,
|
||||
void FileChooser::showPlatformDialog (Array<File>& results, const String& title_, const File& currentFileOrDirectory,
|
||||
const String& filter, bool selectsDirectory, bool /*selectsFiles*/,
|
||||
bool isSaveDialogue, bool warnAboutOverwritingExistingFiles,
|
||||
bool selectMultipleFiles, FilePreviewComponent* extraInfoComponent)
|
||||
{
|
||||
using namespace FileChooserHelpers;
|
||||
|
||||
const String title (title_);
|
||||
HeapBlock<WCHAR> files;
|
||||
const int charsAvailableForResult = 32768;
|
||||
files.calloc (charsAvailableForResult + 1);
|
||||
|
|
@ -244269,26 +244271,29 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title,
|
|||
info.customComponent->enterModalState();
|
||||
}
|
||||
|
||||
const int filterSpace = 2048;
|
||||
HeapBlock<char> filters;
|
||||
filters.calloc (filterSpace * 2);
|
||||
const int bytesWritten = filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters.getData()), filterSpace);
|
||||
filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters + bytesWritten), filterSpace);
|
||||
const int filterSpaceNumChars = 2048;
|
||||
HeapBlock<WCHAR> filters;
|
||||
filters.calloc (filterSpaceNumChars);
|
||||
const int bytesWritten = filter.copyToUTF16 (filters.getData(), filterSpaceNumChars * sizeof (WCHAR));
|
||||
filter.copyToUTF16 (filters + (bytesWritten / sizeof (WCHAR)) + 1,
|
||||
(filterSpaceNumChars - 1) * sizeof (WCHAR) - bytesWritten);
|
||||
|
||||
OPENFILENAMEW of;
|
||||
zerostruct (of);
|
||||
|
||||
String localPath (info.initialPath);
|
||||
|
||||
#ifdef OPENFILENAME_SIZE_VERSION_400W
|
||||
of.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
|
||||
#else
|
||||
of.lStructSize = sizeof (of);
|
||||
#endif
|
||||
of.hwndOwner = (HWND) parentWindow.getWindowHandle();
|
||||
of.lpstrFilter = reinterpret_cast <WCHAR*> (filters.getData());
|
||||
of.lpstrFilter = filters.getData();
|
||||
of.nFilterIndex = 1;
|
||||
of.lpstrFile = files;
|
||||
of.nMaxFile = charsAvailableForResult;
|
||||
of.lpstrInitialDir = info.initialPath.toUTF16();
|
||||
of.lpstrInitialDir = localPath.toUTF16();
|
||||
of.lpstrTitle = title.toUTF16();
|
||||
of.Flags = flags;
|
||||
of.lCustData = (LPARAM) &info;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace FileChooserHelpers
|
|||
if (ofn->hdr.code == CDN_SELCHANGE)
|
||||
{
|
||||
FileChooserCallbackInfo* info = (FileChooserCallbackInfo*) ofn->lpOFN->lCustData;
|
||||
FilePreviewComponent* comp = static_cast<FilePreviewComponent*> (info->customComponent->getChildComponent(0));
|
||||
FilePreviewComponent* comp = dynamic_cast<FilePreviewComponent*> (info->customComponent->getChildComponent(0));
|
||||
|
||||
if (comp != 0)
|
||||
{
|
||||
|
|
@ -130,8 +130,9 @@ namespace FileChooserHelpers
|
|||
|
||||
void resized()
|
||||
{
|
||||
if (getNumChildComponents() > 0)
|
||||
getChildComponent(0)->setBounds (getLocalBounds());
|
||||
Component* const c = getChildComponent(0);
|
||||
if (c != 0)
|
||||
c->setBounds (getLocalBounds());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -140,13 +141,14 @@ namespace FileChooserHelpers
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
void FileChooser::showPlatformDialog (Array<File>& results, const String& title, const File& currentFileOrDirectory,
|
||||
void FileChooser::showPlatformDialog (Array<File>& results, const String& title_, const File& currentFileOrDirectory,
|
||||
const String& filter, bool selectsDirectory, bool /*selectsFiles*/,
|
||||
bool isSaveDialogue, bool warnAboutOverwritingExistingFiles,
|
||||
bool selectMultipleFiles, FilePreviewComponent* extraInfoComponent)
|
||||
{
|
||||
using namespace FileChooserHelpers;
|
||||
|
||||
const String title (title_);
|
||||
HeapBlock<WCHAR> files;
|
||||
const int charsAvailableForResult = 32768;
|
||||
files.calloc (charsAvailableForResult + 1);
|
||||
|
|
@ -230,26 +232,29 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title,
|
|||
info.customComponent->enterModalState();
|
||||
}
|
||||
|
||||
const int filterSpace = 2048;
|
||||
HeapBlock<char> filters;
|
||||
filters.calloc (filterSpace * 2);
|
||||
const int bytesWritten = filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters.getData()), filterSpace);
|
||||
filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters + bytesWritten), filterSpace);
|
||||
const int filterSpaceNumChars = 2048;
|
||||
HeapBlock<WCHAR> filters;
|
||||
filters.calloc (filterSpaceNumChars);
|
||||
const int bytesWritten = filter.copyToUTF16 (filters.getData(), filterSpaceNumChars * sizeof (WCHAR));
|
||||
filter.copyToUTF16 (filters + (bytesWritten / sizeof (WCHAR)) + 1,
|
||||
(filterSpaceNumChars - 1) * sizeof (WCHAR) - bytesWritten);
|
||||
|
||||
OPENFILENAMEW of;
|
||||
zerostruct (of);
|
||||
|
||||
String localPath (info.initialPath);
|
||||
|
||||
#ifdef OPENFILENAME_SIZE_VERSION_400W
|
||||
of.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
|
||||
#else
|
||||
of.lStructSize = sizeof (of);
|
||||
#endif
|
||||
of.hwndOwner = (HWND) parentWindow.getWindowHandle();
|
||||
of.lpstrFilter = reinterpret_cast <WCHAR*> (filters.getData());
|
||||
of.lpstrFilter = filters.getData();
|
||||
of.nFilterIndex = 1;
|
||||
of.lpstrFile = files;
|
||||
of.nMaxFile = charsAvailableForResult;
|
||||
of.lpstrInitialDir = info.initialPath.toUTF16();
|
||||
of.lpstrInitialDir = localPath.toUTF16();
|
||||
of.lpstrTitle = title.toUTF16();
|
||||
of.Flags = flags;
|
||||
of.lCustData = (LPARAM) &info;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue