wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard, long style, const wxPoint& pos) :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos) { wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; }
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, const wxString& defaultPath, long style, const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), const wxString& WXUNUSED(name)) { wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; m_message = message; m_parent = parent; m_path = defaultPath; }
void UMACleanupToolbox() { if (sUMAHasInittedAppearance) { UnregisterAppearanceClient() ; } if ( NavServicesAvailable() ) { NavUnload() ; } if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress ) TXNTerminateTextension( ) ; }
static OSErr ChooseObject( FSRef *objectRef, Boolean getDir) { NavDialogOptions options; NavReplyRecord reply; OSErr osErr; if( objectRef == NULL ) return paramErr; osErr = (! NavServicesAvailable()) ? -1 : noErr; if( osErr == noErr ) osErr = NavGetDefaultDialogOptions(&options); else printf( "Navigation Services is required\n" ); if (osErr == noErr) { /* only select one object at a time */ options.dialogOptionFlags &= ~kNavAllowMultipleFiles; /* if an alias or symfile is selected, return the symfile/alias itself */ /* also support packages */ options.dialogOptionFlags |= kNavDontResolveAliases | kNavSupportPackages; if( getDir ) /* caller wants a directory */ osErr = NavChooseFolder(NULL, &reply, &options, NULL, NULL, NULL); else /* caller wants an object */ osErr = NavChooseObject(NULL, &reply, &options, NULL, NULL, NULL); } if (osErr == noErr) { osErr = ExtractSingleItem(&reply, objectRef); (void) NavDisposeReply(&reply); } return osErr; }
static void mac_startup(void) { Handle menuBar; TECInfoHandle ti; #if !TARGET_API_MAC_CARBON /* Init Memory Manager */ MaxApplZone(); /* Init QuickDraw */ InitGraf(&qd.thePort); /* Init Font Manager */ InitFonts(); /* Init Window Manager */ InitWindows(); /* Init Menu Manager */ InitMenus(); /* Init TextEdit */ TEInit(); /* Init Dialog Manager */ InitDialogs(NULL); #endif /* Get base system version (only used if there's no better selector) */ if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr || (mac_gestalts.sysvers &= 0xffff) < 0x700) fatalbox("PuTTYgen requires System 7 or newer"); /* Find out if we've got Color Quickdraw */ if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr) mac_gestalts.qdvers = gestaltOriginalQD; /* ... and the Appearance Manager? */ if (Gestalt(gestaltAppearanceVersion, &mac_gestalts.apprvers) != noErr) if (Gestalt(gestaltAppearanceAttr, NULL) == noErr) mac_gestalts.apprvers = 0x0100; else mac_gestalts.apprvers = 0; #if TARGET_RT_MAC_CFM /* Paranoia: Did we manage to pull in AppearanceLib? */ if (&RegisterAppearanceClient == kUnresolvedCFragSymbolAddress) mac_gestalts.apprvers = 0; #endif #if TARGET_CPU_68K mac_gestalts.cntlattr = 0; mac_gestalts.windattr = 0; #else /* Mac OS 8.5 Control Manager (proportional scrollbars)? */ if (Gestalt(gestaltControlMgrAttr, &mac_gestalts.cntlattr) != noErr || &SetControlViewSize == kUnresolvedCFragSymbolAddress) mac_gestalts.cntlattr = 0; /* Mac OS 8.5 Window Manager? */ if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr || &SetWindowContentColor == kUnresolvedCFragSymbolAddress) mac_gestalts.windattr = 0; #endif /* Text Encoding Conversion Manager? */ if ( #if TARGET_RT_MAC_CFM &TECGetInfo == kUnresolvedCFragSymbolAddress || #else InitializeUnicodeConverter(NULL) != noErr || #endif TECGetInfo(&ti) != noErr) mac_gestalts.encvvers = 0; else { mac_gestalts.encvvers = (*ti)->tecVersion; mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures; DisposeHandle((Handle)ti); } /* Navigation Services? */ if (NavServicesAvailable()) mac_gestalts.navsvers = NavLibraryVersion(); else mac_gestalts.navsvers = 0; /* We've been tested with the Appearance Manager */ if (mac_gestalts.apprvers != 0) RegisterAppearanceClient(); menuBar = GetNewMBar(128); if (menuBar == NULL) fatalbox("Unable to create menu bar."); SetMenuBar(menuBar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); mac_adjustmenus(); DrawMenuBar(); InitCursor(); windows.about = NULL; windows.licence = NULL; flags = FLAG_INTERACTIVE; /* Install Apple Event handlers. */ #if 0 AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(&mac_aevt_oapp), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(&mac_aevt_odoc), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerUPP(&mac_aevt_pdoc), 0, FALSE); #endif AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(&mac_aevt_quit), 0, FALSE); }
boolean initmacintosh (void) { /* the magic stuff that every Macintosh application needs to do before doing anything else. 4/24/91 dmb: added memory config resource stuff 3.0.4 dmb: use LMGetCurStackBase, not CurStackBase global 3.0.4 dmb: pass 0L to InitDialogs */ register short i; register hdlmemoryconfig h; register long ctbytes; //Code change by Timothy Paustian Thursday, June 8, 2000 3:45:13 PM // #if TARGET_API_MAC_CARBON == 0 long ctstack; #endif long ctheap, ctcode; short ctmasters; h = (hdlmemoryconfig) Get1Resource ('MCFG', 1); if (h == nil) clearbytes (&macmemoryconfig, sizeof (macmemoryconfig)); else macmemoryconfig = **h; //Code change by Timothy Paustian Saturday, June 3, 2000 10:13:20 PM //Changed to Opaque call for Carbon //we don't need this in carbon. #if TARGET_API_MAC_CARBON == 0 if (h != nil) { /*first check stack size*/ ctbytes = (**h).minstacksize; ctstack = LMGetCurStackBase () - GetApplLimit (); /*current stack size*/ if (ctbytes > ctstack) SetApplLimit (LMGetCurStackBase () - ctbytes); } MaxApplZone (); #endif if (h != nil) { /*check heap size and master pointers*/ ctbytes = (**h).minheapsize; //Code change by Timothy Paustian Thursday, June 8, 2000 3:04:31 PM //Changed to Opaque call for Carbon //This is meaningless for OS X since it has unlimited memory. #if TARGET_API_MAC_CARBON == 1 //we need to do somethings else. FreeMem is going to return some large value //of all the available system memory //This whole thing is pointless. We can get as much memory as we need. #pragma unused (ctmasters) #pragma unused (ctcode) #pragma unused (ctheap) #else ctheap = FreeMem (); if (ctbytes > ctheap) { return (false); } ctbytes = (**h).avghandlesize; ctcode = (**h).reserveforcode; if ((ctbytes > 0) && (ctheap > ctcode)) { ctmasters = ((ctheap - ctcode) / ctbytes) / kNumberOfMasters; ctmasters = min (ctmasters, 1024); /*7.1b37 PBS: You'd think 1024 calls would be enough. With large memory alottments on Mac Classic, we're calling MoreMasters in excess of 20,000 times. That makes the app take a minute or so to start up! So instead I've chosen an arbitrary limit.*/ for (i = 1; i < ctmasters; i++) MoreMasters (); } #endif ReleaseResource ((Handle) h); /*we're done with it*/ } //Code change by Timothy Paustian Thursday, June 8, 2000 3:21:06 PM //Changed to Opaque call for Carbon //we don't need this initialization in carbon #if TARGET_API_MAC_CARBON == 0 InitGraf (&qd.thePort); InitFonts (); FlushEvents (everyEvent, 0); InitWindows (); InitMenus (); TEInit (); InitDialogs (0L); #endif InitCursor (); //Code change by Timothy Paustian Thursday, June 8, 2000 3:22:57 PM //Changed to Opaque call for Carbon //this is obsolete, we should be using gestalt for this. { long quickDrawFeatures; OSErr theErr = Gestalt(gestaltSystemVersion, &gSystemVersion); if(oserror(theErr)) ExitToShell(); theErr = Gestalt(gestaltQuickdrawFeatures, &quickDrawFeatures); if(oserror(theErr)) ExitToShell(); gHasColorQD = (quickDrawFeatures & (1 << gestaltHasColor)); //Nav services has to be present and we want the 1.1 or greater version. gCanUseNavServ = (NavServicesAvailable() && (NavLibraryVersion() >= 0x01108000)); } //SysEnvirons (1, &macworld); //gee I bet this isn't required anymore either. for (i = 1; i <= 5; i++) { /*register with Multifinder*/ EventRecord ev; EventAvail (everyEvent, &ev); /*see TN180 -- splash screen*/ } /*for*/ #if TARGET_API_MAC_CARBON == 1 RegisterAppearanceClient (); #endif return (true); } /*initmacintosh*/
void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded ) { #if !TARGET_CARBON ::MaxApplZone(); for (long i = 1; i <= inMoreMastersCalls; i++) ::MoreMasters(); if (!isEmbedded) { ::InitGraf(&qd.thePort); ::InitFonts(); ::InitMenus(); ::TEInit(); ::InitDialogs(0L); ::FlushEvents(everyEvent, 0); } long total,contig; PurgeSpace(&total, &contig); #endif ::InitCursor(); if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr) sUMASystemVersion = 0x0000 ; long theAppearance ; if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr ) { sUMAHasAppearance = true ; OSStatus status = RegisterAppearanceClient(); // If status equals appearanceProcessRegisteredErr it means the // appearance client already was registered (For example if we run // embedded, the host might have registered it). In such a case // we don't unregister it later on. if (status != appearanceProcessRegisteredErr) { // Appearance client wasn't registered yet. sUMAHasInittedAppearance = true; } if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr ) { sUMAAppearanceVersion = theAppearance ; } else { sUMAAppearanceVersion = 0x0100 ; } } if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr ) { sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ; } #if TARGET_CARBON // Call currently implicitely done : InitFloatingWindows() ; #else if (!isEmbedded) { if ( sUMAHasWindowManager ) InitFloatingWindows() ; else InitWindows(); } #endif if ( NavServicesAvailable() ) { NavLoad() ; } long menuMgrAttr ; Gestalt( gestaltMenuMgrAttr , &menuMgrAttr ) ; if ( menuMgrAttr & gestaltMenuMgrAquaLayoutMask ) sUMAHasAquaLayout = true ; if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress ) { FontFamilyID fontId ; Str255 fontName ; SInt16 fontSize ; Style fontStyle ; GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; GetFNum( fontName, &fontId ); TXNMacOSPreferredFontDescription fontDescriptions[] = { { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } } ; int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ; // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke #if 0 // leads to unexpected content for clients, TODO configurable OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ; #else OptionBits options = 0 ; #endif #if TARGET_CARBON if ( !UMAHasAquaLayout() ) #endif { options |= kTXNAlwaysUseQuickDrawTextMask ; } TXNInitTextension(fontDescriptions, noOfFontDescriptions, options ); } UMASetSystemIsInitialized(true); }