Ejemplo n.º 1
0
static int
MacintoshInit()
{
    MaxApplZone();
    MoreMasters();
    MoreMasters();
    MoreMasters();
    MoreMasters();

    tcl_macQdPtr = &qd;

     if (TkMacHaveAppearance()) {
         RegisterAppearanceClient();
     }

    InitGraf(&tcl_macQdPtr->thePort);
    InitFonts();

    if (TkMacHaveAppearance() >= 0x110) {
	InitFloatingWindows();
    } else {
	InitWindows();
    }

    InitMenus();
    InitDialogs((long) NULL);		
    InitCursor();

    FlushEvents(everyEvent, 0);
    SetEventMask(everyEvent);
    Tcl_MacSetEventProc(TkMacConvertEvent);

    return TCL_OK;
}
Ejemplo n.º 2
0
static int
MacintoshInit()
{
    int i;
    long result, mask = 0x0700; 		/* mask = system 7.x */

#if GENERATING68K && !GENERATINGCFM
    SetApplLimit(GetApplLimit() - (TK_MAC_68K_STACK_GROWTH));
#endif
    MaxApplZone();
    for (i = 0; i < 4; i++) {
	(void) MoreMasters();
    }

    /*
     * Tk needs us to set the qd pointer it uses.  This is needed
     * so Tk doesn't have to assume the availablity of the qd global
     * variable.  Which in turn allows Tk to be used in code resources.
     */
    tcl_macQdPtr = &qd;

    /*
     * If appearance is present, then register Tk as an Appearance client
     * This means that the mapping from non-Appearance to Appearance cdefs
     * will be done for Tk regardless of the setting in the Appearance
     * control panel.  
     */
     
     if (TkMacHaveAppearance()) {
         RegisterAppearanceClient();
     }

    InitGraf(&tcl_macQdPtr->thePort);
    InitFonts();
    if (TkMacHaveAppearance() >= 0x110) {
        InitFloatingWindows();
    } else {
    InitWindows();
    }
    InitMenus();
    InitDialogs((long) NULL);		
    InitCursor();

    /*
     * Make sure we are running on system 7 or higher
     */
     
    if ((NGetTrapAddress(_Gestalt, ToolTrap) == 
    	    NGetTrapAddress(_Unimplemented, ToolTrap))
    	    || (((Gestalt(gestaltSystemVersion, &result) != noErr)
	    || (result < mask)))) {
	panic("Tcl/Tk requires System 7 or higher.");
    }

    /*
     * Make sure we have color quick draw 
     * (this means we can't run on 68000 macs)
     */
     
    if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr)
	    || (result < gestalt32BitQD13))) {
	panic("Tk requires Color QuickDraw.");
    }

    
    FlushEvents(everyEvent, 0);
    SetEventMask(everyEvent);


    Tcl_MacSetEventProc(TkMacConvertEvent);
    return TCL_OK;
}
Ejemplo n.º 3
0
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);

}