ardour/gtk2_ardour/OpenFileDialog.cc
Nikolay Polyanovskii d60ef5bdb1 Refactoring of new dialog windows on Windows OS
[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 460092]
2014-05-13 08:53:17 -05:00

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;
}
}