mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 21:56:30 +01:00
51 lines
No EOL
1,012 B
C++
51 lines
No EOL
1,012 B
C++
#include "OpenFileDialogProxy.h"
|
|
|
|
#include <string>
|
|
|
|
#ifdef _WIN32
|
|
#include <Windows.h>
|
|
#include <commdlg.h>
|
|
#endif
|
|
|
|
using namespace std;
|
|
namespace ARDOUR
|
|
{
|
|
bool SaveFileDialog(std::string& fileName, std::string title)
|
|
{
|
|
TCHAR szFilePathName[_MAX_PATH] = "";
|
|
OPENFILENAME ofn = {0};
|
|
ofn.lStructSize = sizeof(OPENFILENAME);
|
|
ofn.lpstrFile = szFilePathName; // This will hold the file name
|
|
ofn.nMaxFile = _MAX_PATH;
|
|
ofn.lpstrTitle = title.c_str();
|
|
ofn.Flags = OFN_OVERWRITEPROMPT;
|
|
|
|
if(GetSaveFileName(&ofn))
|
|
{
|
|
fileName = ofn.lpstrFile;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool OpenFileDialog(std::string& fileName, std::string title)
|
|
{
|
|
TCHAR szFilePathName[_MAX_PATH] = "";
|
|
OPENFILENAME ofn = {0};
|
|
ofn.lStructSize = sizeof(OPENFILENAME);
|
|
ofn.lpstrFile = szFilePathName; // This will hold the file name
|
|
ofn.nMaxFile = _MAX_PATH;
|
|
ofn.lpstrTitle = title.c_str();
|
|
ofn.Flags = OFN_PATHMUSTEXIST;
|
|
|
|
if( GetOpenFileName(&ofn) )
|
|
{
|
|
fileName = ofn.lpstrFile;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} |