From 8bd2fdfd585609a9237e6a5e813cc51ed9185ab2 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 23 Aug 2004 17:48:18 +0000 Subject: [PATCH] resource fork not used anymore git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/app.cpp | 149 -------------------------------------- src/mac/carbon/cursor.cpp | 1 - src/mac/carbon/menu.cpp | 2 - 3 files changed, 152 deletions(-) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index f610756a2a..5e2dd1cae9 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -726,153 +726,6 @@ void wxApp::CleanUp() // misc initialization stuff //---------------------------------------------------------------------- -// extern variable for shared library resource id -// need to be able to find it with NSLookupAndBindSymbol -short gSharedLibraryResource = kResFileNotOpened ; - -#if defined(WXMAKINGDLL_CORE) && defined(__DARWIN__) -CFBundleRef gSharedLibraryBundle = NULL; -#endif /* WXMAKINGDLL_CORE && __DARWIN__ */ - -wxStAppResource::wxStAppResource() -{ - m_currentRefNum = CurResFile() ; - if ( gSharedLibraryResource != kResFileNotOpened ) - { - UseResFile( gSharedLibraryResource ) ; - } -} - -wxStAppResource::~wxStAppResource() -{ - if ( m_currentRefNum != kResFileNotOpened ) - { - UseResFile( m_currentRefNum ) ; - } -} - -void wxStAppResource::OpenSharedLibraryResource(const void *initBlock) -{ - gSharedLibraryResource = kResFileNotOpened; - -#ifdef WXMAKINGDLL_CORE - if ( initBlock != NULL ) { - const CFragInitBlock *theInitBlock = (const CFragInitBlock *)initBlock; - FSSpec *fileSpec = NULL; - - if (theInitBlock->fragLocator.where == kDataForkCFragLocator) { - fileSpec = theInitBlock->fragLocator.u.onDisk.fileSpec; - } - else if (theInitBlock->fragLocator.where == kResourceCFragLocator) { - fileSpec = theInitBlock->fragLocator.u.inSegs.fileSpec; - } - - if (fileSpec != NULL) { - gSharedLibraryResource = FSpOpenResFile(fileSpec, fsRdPerm); - } - } - else { -#ifdef __DARWIN__ - // Open the shared library resource file if it is not yet open - NSSymbol theSymbol; - NSModule theModule; - const char *theLibPath; - - gSharedLibraryBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.wxwindows.wxWidgets")); - if (gSharedLibraryBundle != NULL) { - // wxWidgets has been bundled into a framework - // load the framework resources - - gSharedLibraryResource = CFBundleOpenBundleResourceMap(gSharedLibraryBundle); - } - else { - // wxWidgets is a simple dynamic shared library - // load the resources from the data fork of a separate resource file - wxString theResPath; - wxString theName; - FSRef theResRef; - OSErr theErr = noErr; - - // get the library path - theSymbol = NSLookupAndBindSymbol("_gSharedLibraryResource"); - theModule = NSModuleForSymbol(theSymbol); - theLibPath = NSLibraryNameForModule(theModule); - - // if we call wxLogDebug from here then, as wxTheApp hasn't been - // created yet when we're called from wxApp::Initialize(), wxLog - // is going to create a default stderr-based log target instead of - // the expected normal GUI one -- don't do it, if we really want - // to see this message just use fprintf() here -#if 0 - wxLogDebug( wxT("wxMac library installation name is '%s'"), - theLibPath ); -#endif - - // allocate copy to replace .dylib.* extension with .rsrc - if (theLibPath != NULL) { -#if wxUSE_UNICODE - theResPath = wxString(theLibPath, wxConvLocal); -#else - theResPath = wxString(theLibPath); -#endif - // replace '_core' with '' in case of multi-lib build - theResPath.Replace(wxT("_core"), wxEmptyString); - // replace ".dylib" shared library extension with ".rsrc" - theResPath.Replace(wxT(".dylib"), wxT(".rsrc")); - // Find the begining of the filename - theName = theResPath.AfterLast('/'); - -#if 0 - wxLogDebug( wxT("wxMac resources file name is '%s'"), - theResPath.mb_str() ); -#endif - - theErr = FSPathMakeRef((UInt8 *) theResPath.mb_str(), &theResRef, false); - if (theErr != noErr) { - // try in current directory (using name only) - theErr = FSPathMakeRef((UInt8 *) theName.mb_str(), &theResRef, false); - } - - // open the resource file - if (theErr == noErr) { - theErr = FSOpenResourceFile( &theResRef, 0, NULL, fsRdPerm, - &gSharedLibraryResource); - } - if (theErr != noErr) { -#ifdef __WXDEBUG__ - wxLogDebug( wxT("unable to open wxMac resource file '%s'\n"), - theResPath.mb_str() ); -#endif // __WXDEBUG__ - } - - } - } -#endif /* __DARWIN__ */ - } -#endif /* WXMAKINGDLL_CORE */ -} - -void wxStAppResource::CloseSharedLibraryResource() -{ -#ifdef WXMAKINGDLL_CORE - // Close the shared library resource file - if (gSharedLibraryResource != kResFileNotOpened) { -#ifdef __DARWIN__ - if (gSharedLibraryBundle != NULL) { - CFBundleCloseBundleResourceMap(gSharedLibraryBundle, - gSharedLibraryResource); - gSharedLibraryBundle = NULL; - } - else -#endif /* __DARWIN__ */ - { - CloseResFile(gSharedLibraryResource); - } - gSharedLibraryResource = kResFileNotOpened; - } -#endif /* WXMAKINGDLL_CORE */ -} - #if defined(WXMAKINGDLL_CORE) && !defined(__DARWIN__) // for shared libraries we have to manually get the correct resource @@ -887,13 +740,11 @@ extern "C" { pascal OSErr __wxinitialize(const CFragInitBlock *theInitBlock) { - wxStAppResource::OpenSharedLibraryResource( theInitBlock ) ; return __initialize( theInitBlock ) ; } pascal void __wxterminate(void) { - wxStAppResource::CloseSharedLibraryResource() ; __terminate() ; } diff --git a/src/mac/carbon/cursor.cpp b/src/mac/carbon/cursor.cpp index 741025af8b..2a6eb5f4ea 100644 --- a/src/mac/carbon/cursor.cpp +++ b/src/mac/carbon/cursor.cpp @@ -376,7 +376,6 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho Str255 theName ; wxMacStringToPascal( cursor_file , theName ) ; - wxStAppResource resload ; Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ; if ( resHandle ) { diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index adb3fb2e95..1aab98b958 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -536,8 +536,6 @@ void wxMenuBar::MacInstallMenuBar() if ( s_macInstalledMenuBar == this ) return ; - wxStAppResource resload ; - MenuBarHandle menubar = NULL ; #if TARGET_API_MAC_OSX menubar = NewHandleClear( 6 /* sizeof( MenuBarHeader ) */ ) ; -- 2.45.2