mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Bug 1184 - Mac: Custom FFmpeg Export and (external program): unwanted "NoOverwritePrompt" dialog and file
This commit is contained in:
parent
df32c044ee
commit
b1226ccac2
@ -99,7 +99,6 @@ protected:
|
|||||||
wxArrayString m_currentExtensions;
|
wxArrayString m_currentExtensions;
|
||||||
WX_NSObject m_delegate;
|
WX_NSObject m_delegate;
|
||||||
WX_NSObject m_sheetDelegate;
|
WX_NSObject m_sheetDelegate;
|
||||||
wxString m_noOverwritePromptFilename;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -64,7 +64,6 @@
|
|||||||
|
|
||||||
- (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
- (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||||
- (void)panelSelectionDidChange:(id)sender AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
- (void)panelSelectionDidChange:(id)sender AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
||||||
- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag;
|
|
||||||
|
|
||||||
- (void)viewResized:(NSNotification *)notification;
|
- (void)viewResized:(NSNotification *)notification;
|
||||||
|
|
||||||
@ -104,20 +103,6 @@
|
|||||||
{
|
{
|
||||||
_dialog->DoSendSelectionChangedEvent(sender);
|
_dialog->DoSendSelectionChangedEvent(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag;
|
|
||||||
{
|
|
||||||
if (okFlag == YES)
|
|
||||||
{
|
|
||||||
wxString name = wxCFStringRef::AsStringWithNormalizationFormC( filename );
|
|
||||||
|
|
||||||
wxCFStringRef cfname( _dialog->DoCaptureFilename( sender, name ) );
|
|
||||||
|
|
||||||
return [[NSString alloc] initWithString:cfname.AsNSString()];
|
|
||||||
}
|
|
||||||
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
IMPLEMENT_CLASS(FileDialog, FileDialogBase)
|
IMPLEMENT_CLASS(FileDialog, FileDialogBase)
|
||||||
@ -284,7 +269,6 @@ void FileDialog::ShowWindowModal()
|
|||||||
wxCFStringRef dir( m_dir );
|
wxCFStringRef dir( m_dir );
|
||||||
wxCFStringRef file( m_fileName );
|
wxCFStringRef file( m_fileName );
|
||||||
|
|
||||||
m_noOverwritePromptFilename = wxEmptyString;
|
|
||||||
m_path = wxEmptyString;
|
m_path = wxEmptyString;
|
||||||
m_fileNames.Clear();
|
m_fileNames.Clear();
|
||||||
m_paths.Clear();
|
m_paths.Clear();
|
||||||
@ -425,32 +409,6 @@ void FileDialog::DoSendSelectionChangedEvent(void* panel)
|
|||||||
GetEventHandler()->ProcessEvent( event );
|
GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString FileDialog::DoCaptureFilename(void* panel, const wxString & name)
|
|
||||||
{
|
|
||||||
if ( HasFlag( wxFD_SAVE ) )
|
|
||||||
{
|
|
||||||
if ( !HasFlag(wxFD_OVERWRITE_PROMPT) )
|
|
||||||
{
|
|
||||||
NSSavePanel* sPanel = (NSSavePanel*) panel;
|
|
||||||
NSString* dir = [[sPanel directoryURL] path];
|
|
||||||
|
|
||||||
wxFileName fn;
|
|
||||||
fn.SetPath(wxCFStringRef::AsStringWithNormalizationFormC( dir ));
|
|
||||||
fn.SetFullName(name);
|
|
||||||
|
|
||||||
m_currentlySelectedFilename = fn.GetFullPath();
|
|
||||||
|
|
||||||
fn.SetName(wxT("NoOverwritePrompt"));
|
|
||||||
fn.AssignTempFileName(fn.GetFullPath());
|
|
||||||
m_noOverwritePromptFilename = fn.GetFullPath();
|
|
||||||
|
|
||||||
return fn.GetFullName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileDialog::SetupExtraControls(WXWindow nativeWindow)
|
void FileDialog::SetupExtraControls(WXWindow nativeWindow)
|
||||||
{
|
{
|
||||||
NSSavePanel* panel = (NSSavePanel*) nativeWindow;
|
NSSavePanel* panel = (NSSavePanel*) nativeWindow;
|
||||||
@ -544,7 +502,6 @@ int FileDialog::ShowModal()
|
|||||||
wxCFStringRef dir( m_dir );
|
wxCFStringRef dir( m_dir );
|
||||||
wxCFStringRef file( m_fileName );
|
wxCFStringRef file( m_fileName );
|
||||||
|
|
||||||
m_noOverwritePromptFilename = wxEmptyString;
|
|
||||||
m_path = wxEmptyString;
|
m_path = wxEmptyString;
|
||||||
m_fileNames.Clear();
|
m_fileNames.Clear();
|
||||||
m_paths.Clear();
|
m_paths.Clear();
|
||||||
@ -733,15 +690,6 @@ void FileDialog::ModalFinishedCallback(void* panel, int returnCode)
|
|||||||
result = wxID_OK;
|
result = wxID_OK;
|
||||||
|
|
||||||
m_path = wxCFStringRef::AsStringWithNormalizationFormC([sPanel filename]);
|
m_path = wxCFStringRef::AsStringWithNormalizationFormC([sPanel filename]);
|
||||||
if (!HasFlag(wxFD_OVERWRITE_PROMPT))
|
|
||||||
{
|
|
||||||
wxASSERT(!m_noOverwritePromptFilename.IsEmpty());
|
|
||||||
if (!m_noOverwritePromptFilename.IsEmpty())
|
|
||||||
{
|
|
||||||
wxRemoveFile(m_noOverwritePromptFilename);
|
|
||||||
m_path = m_currentlySelectedFilename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_fileName = wxFileNameFromPath(m_path);
|
m_fileName = wxFileNameFromPath(m_path);
|
||||||
m_dir = wxPathOnly( m_path );
|
m_dir = wxPathOnly( m_path );
|
||||||
if (m_filterChoice)
|
if (m_filterChoice)
|
||||||
|
@ -770,6 +770,8 @@ If you still wish to export, please choose a different filename or folder."));
|
|||||||
if (overwritingMissingAliasFiles)
|
if (overwritingMissingAliasFiles)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// For Mac, it's handled by the FileDialog
|
||||||
|
#if !defined(__WXMAC__)
|
||||||
if (mFilename.FileExists()) {
|
if (mFilename.FileExists()) {
|
||||||
auto prompt = XO("A file named \"%s\" already exists. Replace?")
|
auto prompt = XO("A file named \"%s\" already exists. Replace?")
|
||||||
.Format( mFilename.GetFullPath() );
|
.Format( mFilename.GetFullPath() );
|
||||||
@ -782,6 +784,7 @@ If you still wish to export, please choose a different filename or folder."));
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user