Remove wxOSX/Carbon support.
Cocoa has been the default toolkit in wxWidgets for a long time. There is really no good reason to use Carbon in 2016 and this removes a lot of unused and unmaintained code.
This commit is contained in:
@@ -1227,8 +1227,6 @@ wxString wxFileName::GetTempDir()
|
||||
{
|
||||
wxLogLastError(wxT("GetTempPath"));
|
||||
}
|
||||
#elif defined(__WXMAC__) && wxOSX_USE_CARBON
|
||||
dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder);
|
||||
#endif // systems with native way
|
||||
}
|
||||
|
||||
@@ -2777,142 +2775,3 @@ wxString wxFileName::GetHumanReadableSize(const wxString& failmsg,
|
||||
|
||||
#endif // wxUSE_LONGLONG
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Mac-specific functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class MacDefaultExtensionRecord
|
||||
{
|
||||
public:
|
||||
MacDefaultExtensionRecord()
|
||||
{
|
||||
m_type =
|
||||
m_creator = 0 ;
|
||||
}
|
||||
|
||||
// default copy ctor, assignment operator and dtor are ok
|
||||
|
||||
MacDefaultExtensionRecord(const wxString& ext, OSType type, OSType creator)
|
||||
: m_ext(ext)
|
||||
{
|
||||
m_type = type;
|
||||
m_creator = creator;
|
||||
}
|
||||
|
||||
wxString m_ext;
|
||||
OSType m_type;
|
||||
OSType m_creator;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray);
|
||||
|
||||
bool gMacDefaultExtensionsInited = false;
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_EXPORTED_OBJARRAY(MacDefaultExtensionArray);
|
||||
|
||||
MacDefaultExtensionArray gMacDefaultExtensions;
|
||||
|
||||
// load the default extensions
|
||||
const MacDefaultExtensionRecord gDefaults[] =
|
||||
{
|
||||
MacDefaultExtensionRecord( "txt", 'TEXT', 'ttxt' ),
|
||||
MacDefaultExtensionRecord( "tif", 'TIFF', '****' ),
|
||||
MacDefaultExtensionRecord( "jpg", 'JPEG', '****' ),
|
||||
};
|
||||
|
||||
void MacEnsureDefaultExtensionsLoaded()
|
||||
{
|
||||
if ( !gMacDefaultExtensionsInited )
|
||||
{
|
||||
// we could load the pc exchange prefs here too
|
||||
for ( size_t i = 0 ; i < WXSIZEOF( gDefaults ) ; ++i )
|
||||
{
|
||||
gMacDefaultExtensions.Add( gDefaults[i] ) ;
|
||||
}
|
||||
gMacDefaultExtensionsInited = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator )
|
||||
{
|
||||
FSRef fsRef ;
|
||||
FSCatalogInfo catInfo;
|
||||
FileInfo *finfo ;
|
||||
|
||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||
{
|
||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||
{
|
||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||
finfo->fileType = type ;
|
||||
finfo->fileCreator = creator ;
|
||||
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const
|
||||
{
|
||||
FSRef fsRef ;
|
||||
FSCatalogInfo catInfo;
|
||||
FileInfo *finfo ;
|
||||
|
||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||
{
|
||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||
{
|
||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||
*type = finfo->fileType ;
|
||||
*creator = finfo->fileCreator ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool wxFileName::MacSetDefaultTypeAndCreator()
|
||||
{
|
||||
wxUint32 type , creator ;
|
||||
if ( wxFileName::MacFindDefaultTypeAndCreator(GetExt() , &type ,
|
||||
&creator ) )
|
||||
{
|
||||
return MacSetTypeAndCreator( type , creator ) ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator )
|
||||
{
|
||||
MacEnsureDefaultExtensionsLoaded() ;
|
||||
wxString extl = ext.Lower() ;
|
||||
for( int i = gMacDefaultExtensions.Count() - 1 ; i >= 0 ; --i )
|
||||
{
|
||||
if ( gMacDefaultExtensions.Item(i).m_ext == extl )
|
||||
{
|
||||
*type = gMacDefaultExtensions.Item(i).m_type ;
|
||||
*creator = gMacDefaultExtensions.Item(i).m_creator ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator )
|
||||
{
|
||||
MacEnsureDefaultExtensionsLoaded();
|
||||
MacDefaultExtensionRecord rec(ext.Lower(), type, creator);
|
||||
gMacDefaultExtensions.Add( rec );
|
||||
}
|
||||
|
||||
#endif // defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
|
||||
|
||||
Reference in New Issue
Block a user