OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [mac/] [tkMacMDEF.c] - Diff between revs 579 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 579 Rev 1765
/*
/*
 * TkMacMDEF.c --
 * TkMacMDEF.c --
 *
 *
 *      This module is implements the MDEF for tkMenus. The address of the
 *      This module is implements the MDEF for tkMenus. The address of the
 *      real entry proc will be blasted into the MDEF.
 *      real entry proc will be blasted into the MDEF.
 *
 *
 * Copyright (c) 1996 by Sun Microsystems, Inc.
 * Copyright (c) 1996 by Sun Microsystems, Inc.
 *
 *
 * See the file "license.terms" for information on usage and redistribution
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 *
 * RCS: @(#) $Id: tkMacMDEF.c,v 1.1.1.1 2002-01-16 10:25:55 markom Exp $
 * RCS: @(#) $Id: tkMacMDEF.c,v 1.1.1.1 2002-01-16 10:25:55 markom Exp $
 */
 */
 
 
#define MAC_TCL
#define MAC_TCL
#define NeedFunctionPrototypes 1
#define NeedFunctionPrototypes 1
#define NeedWidePrototypes 0
#define NeedWidePrototypes 0
 
 
#include <Menus.h>
#include <Menus.h>
#include <LowMem.h>
#include <LowMem.h>
#include "tkMacInt.h"
#include "tkMacInt.h"
 
 
 
 
/*
/*
 * The following structure is built from assembly equates in MPW 3.0
 * The following structure is built from assembly equates in MPW 3.0
 * AIncludes file: "Private.a." We're forced to update several locations not
 * AIncludes file: "Private.a." We're forced to update several locations not
 * documented in "Inside Mac" to make our MDEF behave properly with hierarchical
 * documented in "Inside Mac" to make our MDEF behave properly with hierarchical
 * menus.
 * menus.
 */
 */
 
 
#if STRUCTALIGNMENTSUPPORTED
#if STRUCTALIGNMENTSUPPORTED
#pragma options align=mac68k
#pragma options align=mac68k
#endif
#endif
typedef struct mbPrivate {
typedef struct mbPrivate {
    Byte unknown[6];
    Byte unknown[6];
    Rect mbItemRect;            /* rect of currently chosen menu item */
    Rect mbItemRect;            /* rect of currently chosen menu item */
} mbPrivate;
} mbPrivate;
#if STRUCTALIGNMENTSUPPORTED
#if STRUCTALIGNMENTSUPPORTED
#pragma options align=reset
#pragma options align=reset
#endif
#endif
 
 
/*
/*
 * We are forced to update a low-memory global to get cascades to work. This
 * We are forced to update a low-memory global to get cascades to work. This
 * global does not have a LMEquate associated with it.
 * global does not have a LMEquate associated with it.
 */
 */
 
 
#define SELECTRECT (*(Rect *)0x09fa)    /* Menu select seems to need this */
#define SELECTRECT (*(Rect *)0x09fa)    /* Menu select seems to need this */
#define MBSAVELOC (*(short *)0x0B5C)    /* address of handle to mbarproc private data redefined below */
#define MBSAVELOC (*(short *)0x0B5C)    /* address of handle to mbarproc private data redefined below */
 
 
pascal void             main _ANSI_ARGS_((short message,
pascal void             main _ANSI_ARGS_((short message,
                            MenuHandle menu, Rect *menuRect,
                            MenuHandle menu, Rect *menuRect,
                            Point hitPt, short *whichItem));
                            Point hitPt, short *whichItem));
 
 


/*
/*
 *----------------------------------------------------------------------
 *----------------------------------------------------------------------
 *
 *
 * TkMacStdMenu --
 * TkMacStdMenu --
 *
 *
 *      The dispatch routine called by the system to handle menu drawing,
 *      The dispatch routine called by the system to handle menu drawing,
 *      scrolling, etc. This is a stub; the address of the real routine
 *      scrolling, etc. This is a stub; the address of the real routine
 *      is blasted in. The real routine will be a UniversalProcPtr,
 *      is blasted in. The real routine will be a UniversalProcPtr,
 *      which will give the real dispatch routine in Tk globals
 *      which will give the real dispatch routine in Tk globals
 *      and the like.
 *      and the like.
 *
 *
 * Results:
 * Results:
 *      None.
 *      None.
 *
 *
 * Side effects:
 * Side effects:
 *      This routine causes menus to be drawn and will certainly allocate
 *      This routine causes menus to be drawn and will certainly allocate
 *      memory as a result. Also, the menu can scroll up and down, and
 *      memory as a result. Also, the menu can scroll up and down, and
 *      various other interface actions can take place
 *      various other interface actions can take place
 *
 *
 *----------------------------------------------------------------------
 *----------------------------------------------------------------------
 */
 */
 
 
pascal void
pascal void
main(
main(
    short message,              /* What action are we taking? */
    short message,              /* What action are we taking? */
    MenuHandle menu,            /* The menu we are working with */
    MenuHandle menu,            /* The menu we are working with */
    Rect *menuRect,             /* A pointer to the rect we are working with */
    Rect *menuRect,             /* A pointer to the rect we are working with */
    Point hitPt,                /* Where the mouse was hit for appropriate
    Point hitPt,                /* Where the mouse was hit for appropriate
                                 * messages. */
                                 * messages. */
    short *whichItemPtr)        /* Output result. Which item was hit by
    short *whichItemPtr)        /* Output result. Which item was hit by
                                 * the user? */
                                 * the user? */
{
{
    /*
    /*
     * The constant 'MDEF' is what will be punched during menu intialization.
     * The constant 'MDEF' is what will be punched during menu intialization.
     */
     */
 
 
    TkMenuDefProcPtr procPtr = (TkMenuDefProcPtr) 'MDEF';
    TkMenuDefProcPtr procPtr = (TkMenuDefProcPtr) 'MDEF';
    TkMenuLowMemGlobals globals;
    TkMenuLowMemGlobals globals;
    short oldItem;
    short oldItem;
 
 
    globals.menuDisable = LMGetMenuDisable();
    globals.menuDisable = LMGetMenuDisable();
    globals.menuTop = LMGetTopMenuItem();
    globals.menuTop = LMGetTopMenuItem();
    globals.menuBottom = LMGetAtMenuBottom();
    globals.menuBottom = LMGetAtMenuBottom();
    if (MBSAVELOC == -1) {
    if (MBSAVELOC == -1) {
        globals.itemRect = (**(mbPrivate***)&MBSAVELOC)->mbItemRect;
        globals.itemRect = (**(mbPrivate***)&MBSAVELOC)->mbItemRect;
    }
    }
    if (message == mChooseMsg) {
    if (message == mChooseMsg) {
        oldItem = *whichItemPtr;
        oldItem = *whichItemPtr;
    }
    }
 
 
    TkCallMenuDefProc(procPtr, message, menu, menuRect, hitPt, whichItemPtr,
    TkCallMenuDefProc(procPtr, message, menu, menuRect, hitPt, whichItemPtr,
            &globals);
            &globals);
 
 
    LMSetMenuDisable(globals.menuDisable);
    LMSetMenuDisable(globals.menuDisable);
    LMSetTopMenuItem(globals.menuTop);
    LMSetTopMenuItem(globals.menuTop);
    LMSetAtMenuBottom(globals.menuBottom);
    LMSetAtMenuBottom(globals.menuBottom);
    if ((message == mChooseMsg) && (oldItem != *whichItemPtr)
    if ((message == mChooseMsg) && (oldItem != *whichItemPtr)
            && (MBSAVELOC != -1)) {
            && (MBSAVELOC != -1)) {
        (**(mbPrivate***)&MBSAVELOC)->mbItemRect = globals.itemRect;
        (**(mbPrivate***)&MBSAVELOC)->mbItemRect = globals.itemRect;
        SELECTRECT = globals.itemRect;
        SELECTRECT = globals.itemRect;
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.