Concordia.c

/*
    File:       Concordia.c
 
    Contains:   the entry point to the concordia MDEF at the function
                called main.  This file also contains two routines, GetTextState and
                SetTextState, that didn't really seem to fit categorically in any other source
                file (they should really have been in ROM, like Get- and SetPenState!).
 
    Written by:     
 
    Copyright:  Copyright © 1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                8/10/1999   Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
 
 
/******************************************************************************\
* Header Files
\******************************************************************************/
 
#include <Menus.h>
#include <Quickdraw.h>
#include <Types.h>
#include "ChooseTkl.h"
#include "Concordia.h"
#include "DrawTkl.h"
#include "PopUpTkl.h"
#include "SizeTkl.h"
 
 
/******************************************************************************\
* Function Prototypes
\******************************************************************************/
 
pascal void main (short, MenuHandle, Rect *, Point, short *);
 
 
#pragma segment Main
/******************************************************************************\
* main - Entry point for the Concordia MDEF
\******************************************************************************/
 
pascal void
main (short Message,MenuHandle TheMenu,Rect* MenuRect,Point HitPt,short* WhichItem)
{
    if (Message == mDrawMsg)
        DoDrawMsg (TheMenu, MenuRect);
    else if (Message == mChooseMsg)
        *WhichItem = DoChooseMsg (TheMenu, MenuRect, HitPt, *WhichItem);
    else if (Message == mSizeMsg)
        DoSizeMsg (TheMenu);
    else if (Message == mPopUpMsg)
        *WhichItem = DoPopUpMsg (TheMenu, MenuRect, HitPt.h, HitPt.v,
                *WhichItem);
    }
 
 
#pragma segment Main
/******************************************************************************\
* GetTextState - Get the current state of text
*
* GetTextState gets the typeface, typestyle, typesize, and drawing mode of the
* current font of the current GrafPort and places this information in the
* TextStateRec specified by TextInfo.
\******************************************************************************/
 
void
GetTextState (TextInfo)
    TextStateRec *TextInfo; //-> Text state info <<
    {
    GrafPtr CurrPort; //-> Current graphics port
 
    GetPort (&CurrPort);
    TextInfo->txFace = CurrPort->txFont;
    TextInfo->txStyle = CurrPort->txFace;
    TextInfo->txMode = CurrPort->txMode;
    TextInfo->txSize = CurrPort->txSize;
    }
 
 
#pragma segment Main
/******************************************************************************\
* SetTextState - Set the current state of text
*
* SetTextState gets the typeface, typestyle, typesize, and drawing mode of the
* current font of the current GrafPort and places this information in the
* TextStateRec specified by TextInfo.
\******************************************************************************/
 
void
SetTextState (TextInfo)
    TextStateRec *TextInfo; //-> Text state info >>
    {
    TextFont (TextInfo->txFace);
    TextFace (TextInfo->txStyle);
    TextMode (TextInfo->txMode);
    TextSize (TextInfo->txSize);
    }