X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90b959aee428b26304ee0056864af48775051496..b9b7804a435e969fcb48ae8634ecc41f49858d65:/src/mac/carbon/app.cpp?ds=sidebyside diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index d03b4244fd..095156baa1 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -31,6 +31,7 @@ #include "wx/module.h" #include "wx/memory.h" #include "wx/tooltip.h" +#include "wx/textctrl.h" #include "wx/menu.h" #if wxUSE_WX_RESOURCES #include "wx/resource.h" @@ -40,7 +41,7 @@ // mac -#ifndef __UNIX__ +#ifndef __DARWIN__ #if __option(profile) #include #endif @@ -52,7 +53,7 @@ #include "wx/mac/macnotfy.h" #if wxUSE_SOCKETS - #ifdef __APPLE__ + #ifdef __DARWIN__ #include #else #include @@ -88,8 +89,6 @@ wxWindow* wxApp::s_captureWindow = NULL ; int wxApp::s_lastMouseDown = 0 ; long wxApp::sm_lastMessageTime = 0; -#ifdef __WXMAC__ - bool wxApp::s_macDefaultEncodingIsPC = true ; bool wxApp::s_macSupportPCMenuShortcuts = true ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; @@ -137,6 +136,7 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigne OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply) { + SysBeep(40) ; ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; @@ -341,7 +341,44 @@ wxString wxMacMakePCStringFromMac( const char * p ) return result ; } -#endif +wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding ) +{ + if (mac2pcEncoding) + { + return wxMacMakePCStringFromMac( from ) ; + } + else + { + return wxString( from ) ; + } +} + +wxString wxMacMakeStringFromPascal( StringPtr from , bool mac2pcEncoding ) +{ + // this is safe since a pascal string can never be larger than 256 bytes + char s[256] ; + CopyPascalStringToC( from , s ) ; + if (mac2pcEncoding) + { + return wxMacMakePCStringFromMac( s ) ; + } + else + { + return wxString( s ) ; + } +} + +void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding ) +{ + if (pc2macEncoding) + { + CopyCStringToPascal( wxMacMakeMacStringFromPC( from ) , to ) ; + } + else + { + CopyCStringToPascal( from , to ) ; + } +} bool wxApp::Initialize() { @@ -374,7 +411,7 @@ bool wxApp::Initialize() #endif -#ifndef __UNIX__ +#ifndef __DARWIN__ // test the minimal configuration necessary #if !TARGET_CARBON @@ -427,7 +464,7 @@ bool wxApp::Initialize() return FALSE ; } -#ifndef __UNIX__ +#ifndef __DARWIN__ #if __option(profile) ProfilerInit( collectDetailed, bestTimeBase , 20000 , 40 ) ; #endif @@ -435,7 +472,7 @@ bool wxApp::Initialize() // now avoid exceptions thrown for new (bad_alloc) -#ifndef __UNIX__ +#ifndef __DARWIN__ std::__throws_bad_alloc = FALSE ; #endif @@ -459,6 +496,7 @@ bool wxApp::Initialize() wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase->Initialize(); +#ifdef __WXDEBUG__ #if wxUSE_LOG // flush the logged messages if any and install a 'safer' log target: the // default one (wxLogGui) can't be used after the resources are freed just @@ -469,6 +507,7 @@ bool wxApp::Initialize() // this will flush the old messages if any delete wxLog::SetActiveTarget(new wxLogStderr); #endif // wxUSE_LOG +#endif wxInitializeStockLists(); wxInitializeStockObjects(); @@ -542,7 +581,7 @@ void wxApp::CleanUp() wxClassInfo::CleanUpClasses(); -#ifndef __UNIX__ +#ifndef __DARWIN__ #if __option(profile) ProfilerDump( "\papp.prof" ) ; ProfilerTerm() ;