mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 21:56:30 +01:00
[Summary] Delete renamed files
[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 462590]
This commit is contained in:
parent
00ca0a0dd9
commit
c31aaf8e3a
4 changed files with 0 additions and 337 deletions
|
|
@ -1,113 +0,0 @@
|
||||||
#include "OpenFileDialogProxy.h"
|
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <commdlg.h>
|
|
||||||
#include <ShlObj.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "glibmm/miscutils.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
namespace ARDOUR
|
|
||||||
{
|
|
||||||
bool SaveFileDialog(std::string& fileName, std::string path, 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;
|
|
||||||
|
|
||||||
// Check on valid path
|
|
||||||
WIN32_FIND_DATA FindFileData;
|
|
||||||
HANDLE handle = FindFirstFile(path.c_str(), &FindFileData) ;
|
|
||||||
int found = (handle != INVALID_HANDLE_VALUE);
|
|
||||||
|
|
||||||
// if path is valid
|
|
||||||
if( found )
|
|
||||||
ofn.lpstrInitialDir = path.c_str();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
path = Glib::get_home_dir();
|
|
||||||
ofn.lpstrInitialDir = path.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run dialog
|
|
||||||
if(GetSaveFileName(&ofn))
|
|
||||||
{
|
|
||||||
fileName = ofn.lpstrFile;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OpenFileDialog(std::string& fileName, std::string path, 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;
|
|
||||||
|
|
||||||
// Check on valid path
|
|
||||||
WIN32_FIND_DATA FindFileData;
|
|
||||||
HANDLE handle = FindFirstFile(path.c_str(), &FindFileData) ;
|
|
||||||
int found = (handle != INVALID_HANDLE_VALUE);
|
|
||||||
|
|
||||||
// if path is valid
|
|
||||||
if( found )
|
|
||||||
ofn.lpstrInitialDir = path.c_str();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
path = Glib::get_home_dir();
|
|
||||||
ofn.lpstrInitialDir = path.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GetOpenFileName(&ofn) )
|
|
||||||
{
|
|
||||||
fileName = ofn.lpstrFile;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChooseFolderDialog(std::string& selectedPath, std::string path, std::string title)
|
|
||||||
{
|
|
||||||
BROWSEINFO bi;
|
|
||||||
memset(&bi, 0, sizeof(bi));
|
|
||||||
|
|
||||||
bi.lpszTitle = title.c_str();
|
|
||||||
bi.ulFlags = BIF_NEWDIALOGSTYLE;
|
|
||||||
|
|
||||||
OleInitialize(NULL);
|
|
||||||
|
|
||||||
LPITEMIDLIST pIDL = SHBrowseForFolder(&bi);
|
|
||||||
|
|
||||||
if (pIDL == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TCHAR *buffer = new TCHAR[MAX_PATH];
|
|
||||||
if(!SHGetPathFromIDList(pIDL, buffer) != 0)
|
|
||||||
{
|
|
||||||
CoTaskMemFree(pIDL);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
selectedPath = buffer;
|
|
||||||
|
|
||||||
CoTaskMemFree(pIDL);
|
|
||||||
OleUninitialize();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ARDOUR
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
//
|
|
||||||
// OpenFileDialog.h
|
|
||||||
// Tracks
|
|
||||||
//
|
|
||||||
// Created by User on 5/8/14.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "OpenFileDialogProxy.h"
|
|
||||||
|
|
||||||
// An Objective-C class that needs to be accessed from C++
|
|
||||||
@interface FileDialog : NSObject
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Objective-C member function you want to call from C++
|
|
||||||
+ (NSString*) ClassSaveFileDialog:(NSString *) title withArg2:(NSString *)path;
|
|
||||||
+ (NSString*) ClassOpenFileDialog:(NSString *) title withArg2:(NSString *)path;
|
|
||||||
+ (NSString*) ClassChooseFolderDialog:(NSString *) title withArg2:(NSString *)path;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,168 +0,0 @@
|
||||||
//
|
|
||||||
// OpenFileDialog.m
|
|
||||||
// Tracks
|
|
||||||
//
|
|
||||||
// Created by User on 5/8/14.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OpenFileDialog.h"
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
@implementation FileDialog
|
|
||||||
|
|
||||||
namespace ARDOUR
|
|
||||||
{
|
|
||||||
// ====== C "trampoline" functions to invoke Objective-C method ====== //
|
|
||||||
string OpenFileDialog(std::string path, string title)
|
|
||||||
{
|
|
||||||
NSString *nsTitle = [NSString stringWithUTF8String:title.c_str()];
|
|
||||||
|
|
||||||
//NP: we should find some gentle way to do this
|
|
||||||
NSString *nsDefaultPath = [NSString stringWithUTF8String:path.c_str()];
|
|
||||||
// Call the Objective-C method using Objective-C syntax
|
|
||||||
NSString *nsPath = [FileDialog ClassOpenFileDialog:nsTitle withArg2:nsDefaultPath];
|
|
||||||
string stdPath = [nsPath UTF8String];
|
|
||||||
|
|
||||||
return stdPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
string SaveFileDialog(std::string path, string title)
|
|
||||||
{
|
|
||||||
NSString *nsTitle = [NSString stringWithUTF8String:title.c_str()];
|
|
||||||
|
|
||||||
//NP: we should find some gentle way to do this
|
|
||||||
NSString *nsDefaultPath = [NSString stringWithUTF8String:path.c_str()];
|
|
||||||
// Call the Objective-C method using Objective-C syntax
|
|
||||||
NSString *nsPath = [FileDialog ClassSaveFileDialog:nsTitle withArg2:nsDefaultPath];
|
|
||||||
string stdPath = [nsPath UTF8String];
|
|
||||||
|
|
||||||
return stdPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
string ChooseFolderDialog(std::string path, string title)
|
|
||||||
{
|
|
||||||
NSString *nsTitle = [NSString stringWithUTF8String:title.c_str()];
|
|
||||||
|
|
||||||
//NP: we should find some gentle way to do this
|
|
||||||
NSString *nsDefaultPath = [NSString stringWithUTF8String:path.c_str()];
|
|
||||||
// Call the Objective-C method using Objective-C syntax
|
|
||||||
NSString *nsPath = [FileDialog ClassChooseFolderDialog:nsTitle withArg2:nsDefaultPath];
|
|
||||||
|
|
||||||
string stdPath = [nsPath UTF8String];
|
|
||||||
|
|
||||||
return stdPath;
|
|
||||||
}
|
|
||||||
}// namespace ARDOUR
|
|
||||||
|
|
||||||
// ====== Objective-C functions called from C++ functions ====== //
|
|
||||||
|
|
||||||
// On open saved session
|
|
||||||
+ (NSString*) ClassOpenFileDialog:(NSString *)title withArg2:(NSString *)path
|
|
||||||
{
|
|
||||||
// Create a File Open Dialog class.
|
|
||||||
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
|
|
||||||
|
|
||||||
// Set array of file types
|
|
||||||
NSArray *fileTypesArray;
|
|
||||||
fileTypesArray = [NSArray arrayWithObjects:@"ardour", nil];
|
|
||||||
|
|
||||||
[openDlg setCanChooseFiles:YES];
|
|
||||||
[openDlg setAllowedFileTypes:fileTypesArray];
|
|
||||||
[openDlg setAllowsMultipleSelection:FALSE];
|
|
||||||
[openDlg setTitle:title];
|
|
||||||
|
|
||||||
NSFileManager *fm = [[NSFileManager alloc] init];
|
|
||||||
BOOL isDir;
|
|
||||||
BOOL exists = [fm fileExistsAtPath:path isDirectory:&isDir];
|
|
||||||
|
|
||||||
if(!exists)
|
|
||||||
path = NSHomeDirectory();
|
|
||||||
|
|
||||||
[openDlg setDirectoryURL : [NSURL fileURLWithPath:path]];
|
|
||||||
|
|
||||||
// Display the dialog box. If the OK pressed,
|
|
||||||
// process the files.
|
|
||||||
if ( [openDlg runModal] == NSOKButton )
|
|
||||||
{
|
|
||||||
// Gets first selected file
|
|
||||||
NSArray *files = [openDlg URLs];
|
|
||||||
NSURL *saveURL = [files objectAtIndex:0];
|
|
||||||
NSString *filePath = [saveURL path];
|
|
||||||
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return @"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// On create new session
|
|
||||||
+ (NSString*) ClassSaveFileDialog:(NSString *)title withArg2:(NSString *)path
|
|
||||||
{
|
|
||||||
// Create a File Open Dialog class.
|
|
||||||
NSSavePanel* saveDlg = [NSSavePanel savePanel];
|
|
||||||
[saveDlg setTitle:title];
|
|
||||||
|
|
||||||
NSFileManager *fm = [[NSFileManager alloc] init];
|
|
||||||
BOOL isDir;
|
|
||||||
BOOL exists = [fm fileExistsAtPath:path isDirectory:&isDir];
|
|
||||||
|
|
||||||
if(!exists)
|
|
||||||
path = NSHomeDirectory();
|
|
||||||
|
|
||||||
[saveDlg setDirectoryURL : [NSURL fileURLWithPath:path]];
|
|
||||||
|
|
||||||
// Display the dialog box. If the OK pressed,
|
|
||||||
// process the files.
|
|
||||||
if ( [saveDlg runModal] == NSOKButton )
|
|
||||||
{
|
|
||||||
// Gets list of all files selected
|
|
||||||
NSURL *saveURL = [saveDlg URL];
|
|
||||||
NSString *filePath = [saveURL path];
|
|
||||||
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return @"";
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSString*) ClassChooseFolderDialog:(NSString *)title withArg2:(NSString *)path
|
|
||||||
{
|
|
||||||
// Create a File Open Dialog class.
|
|
||||||
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
|
|
||||||
|
|
||||||
[openDlg setCanChooseDirectories:YES];
|
|
||||||
[openDlg setAllowsMultipleSelection:FALSE];
|
|
||||||
[openDlg setTitle:title];
|
|
||||||
|
|
||||||
NSFileManager *fm = [[NSFileManager alloc] init];
|
|
||||||
BOOL isDir;
|
|
||||||
BOOL exists = [fm fileExistsAtPath:path isDirectory:&isDir];
|
|
||||||
|
|
||||||
if(!exists)
|
|
||||||
path = NSHomeDirectory();
|
|
||||||
|
|
||||||
[openDlg setDirectoryURL : [NSURL fileURLWithPath:path]];
|
|
||||||
|
|
||||||
// Display the dialog box. If the OK pressed,
|
|
||||||
// process the files.
|
|
||||||
if ( [openDlg runModal] == NSOKButton )
|
|
||||||
{
|
|
||||||
// Gets first selected file
|
|
||||||
NSArray *files = [openDlg URLs];
|
|
||||||
NSURL *saveURL = [files objectAtIndex:0];
|
|
||||||
NSString *filePath = [saveURL path];
|
|
||||||
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return @"";
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
//
|
|
||||||
// OpenFileDialogProxy.h
|
|
||||||
// Tracks
|
|
||||||
//
|
|
||||||
// Created by User on 5/12/14.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef Tracks_OpenFileDialogProxy_h
|
|
||||||
#define Tracks_OpenFileDialogProxy_h
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace ARDOUR
|
|
||||||
{
|
|
||||||
// This is the C "trampoline" function that will be used
|
|
||||||
// to invoke a specific Objective-C method FROM C++
|
|
||||||
#ifdef __APPLE__
|
|
||||||
std::string SaveFileDialog(std::string path = "", std::string title = "Save");
|
|
||||||
std::string OpenFileDialog(std::string path = "", std::string title = "Open");
|
|
||||||
std::string ChooseFolderDialog(std::string path = "", std::string title = "Choose Folder");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// OS Windows specific functions
|
|
||||||
#ifdef _WIN32
|
|
||||||
bool SaveFileDialog(std::string& fileName, std::string path = "", std::string title = "Save");
|
|
||||||
bool OpenFileDialog(std::string& fileName, std::string path = "", std::string title = "Open");
|
|
||||||
bool ChooseFolderDialog(std::string& selectedPath, std::string path = "", std::string title = "Choose Folder");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue