X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc0daf84009784af053fa265d8ad8e9e446388f4..31a06b07cce898a22d0ca3992501e85da9c22f13:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 4e4699db1d..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 @@ -544,7 +581,7 @@ void wxApp::CleanUp() wxClassInfo::CleanUpClasses(); -#ifndef __UNIX__ +#ifndef __DARWIN__ #if __option(profile) ProfilerDump( "\papp.prof" ) ; ProfilerTerm() ;