From 73c319ccde644e64c23bf7cb5aaac946b39f956a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Aug 2014 15:32:16 +0000 Subject: [PATCH] Disable deprecation warnings for NS{Open,Save}Panel methods. They will need to be replaced with the newer equivalents, but for now getting dozens of warnings for each wxOSX build is just annoying, so get rid of them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/dirdlg.mm | 8 ++++++++ src/osx/cocoa/filedlg.mm | 21 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index ef8886ac69..7f002567ad 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -76,6 +76,12 @@ WX_NSOpenPanel wxDirDialog::OSXCreatePanel() const return oPanel; } +// We use several deprecated methods of NSOpenPanel in the code below, we +// should replace them with newer equivalents now that we don't support OS X +// versions which didn't have them (pre 10.6), but until then, get rid of +// the warning. +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + void wxDirDialog::ShowWindowModal() { wxNonOwnedWindow* parentWindow = NULL; @@ -133,4 +139,6 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode) SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); } +wxGCC_WARNING_RESTORE(deprecated-declarations) + #endif // wxUSE_DIRDLG diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 002cda4136..8af141a1f1 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -112,13 +112,18 @@ bool HasAppKit_10_6() - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { BOOL showObject = YES; - + + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + NSString* resolvedLink = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath:filename]; if ( resolvedLink != nil ) filename = resolvedLink; - + NSDictionary* fileAttribs = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES]; + + wxGCC_WARNING_RESTORE(deprecated-declarations) + if (fileAttribs) { // check for packages @@ -335,6 +340,8 @@ void wxFileDialog::ShowWindowModal() wxASSERT_MSG(parentWindow, "Window modal display requires parent."); + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + NSArray* types = GetTypesFromFilter( m_wildCard, m_filterNames, m_filterExtensions ) ; if ( HasFlag(wxFD_SAVE) ) { @@ -378,6 +385,8 @@ void wxFileDialog::ShowWindowModal() didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; } + + wxGCC_WARNING_RESTORE(deprecated-declarations) } // Create a panel with the file type drop down list @@ -582,6 +591,8 @@ int wxFileDialog::ShowModal() } } + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + if ( HasFlag(wxFD_SAVE) ) { NSSavePanel* sPanel = [NSSavePanel savePanel]; @@ -650,11 +661,15 @@ int wxFileDialog::ShowModal() ModalFinishedCallback(oPanel, returnCode); } + wxGCC_WARNING_RESTORE(deprecated-declarations) + return GetReturnCode(); } void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) { + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + int result = wxID_CANCEL; if (HasFlag(wxFD_SAVE)) { @@ -709,6 +724,8 @@ void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) if ( m_isNativeWindowWrapper ) UnsubclassWin(); [(NSSavePanel*) panel setAccessoryView:nil]; + + wxGCC_WARNING_RESTORE(deprecated-declarations) } #endif // wxUSE_FILEDLG