home *** CD-ROM | disk | FTP | other *** search
- /*
- COPYRIGHT (C) 1984,1985,1986,1988,1989 Apple Computer,Inc.
- All rights reserved
- */
- /* General LDEF proc */
-
- #include <types.h>
- #include <memory.h>
- #include <menus.h>
- #include <resources.h>
- #include <lists.h>
- #include <ToolUtils.h>
- #include <SysEqu.h>
-
- #include "ResEd.h"
-
- #define theHiliteMask 0x7FFFFFFF /* bit 31 */
-
- Handle GnrlFetch(short lDataOffset, short *lDataLen, ListHandle lHandle)
- {
- short id; /* Id is stored in the list - it could be any type. */
- Handle result;
-
- if (*lDataLen > sizeof(id)) {
- *lDataLen = sizeof(id); /* Make sure that the length is ok. */
- }
-
- /* Get the id from the list. */
- id = *(short*)((*((*lHandle)->cells)) + lDataOffset);
- SetResLoad(false); /* Since all we want is the resinfo */
- result = Get1Res((*((PickHandle)((*lHandle)->refCon)))->rType, id);
- SetResLoad(true); /* Always leave this set to true. */
-
- return result;
- }
-
- /************************************************************************************/
-
- void DoHilite (Rect *lRect)
- {
-
- /* Use the proper hilighting for color. */
-
- *(long *)HiliteMode &= theHiliteMask;
- InvertRect(lRect); /* Select the rectangle. */
- }
-
- /************************************************************************************/
-
- pascal void DrawCell(short message, Boolean lSelect, Rect *lRect, Point lCell,
- short lDataOffset, short lDataLen, ListHandle lHandle)
- {
- Handle res;
- ResType theType;
- short id;
- Str255 resName;
- FontInfo fInfo;
-
- #pragma unused (lCell)
-
- switch (message) {
- case lInitMsg:
- /* Set the proper indent distance. */
- GetFontInfo(&fInfo);
- (*lHandle)->indent.h = fInfo.widMax / 3;
- (*lHandle)->indent.v = fInfo.ascent;
- break;
-
- case lDrawMsg:
- if (lDataLen != 0) {
- res = GnrlFetch(lDataOffset, &lDataLen, lHandle); /* Get the resource.*/
- if (res != NULL) {
- /* If we found the resource, build the string for this resource.*/
- GetResInfo(res, &id, &theType, &resName);
- TypeToString(theType, &resName); /* Put the type into a string.*/
- SetETitle(res, &resName); /* Concatenate the id and the name of the resource. */
-
- /* Position the pen. */
- MoveTo(lRect->left + (*lHandle)->indent.h, lRect->top + (*lHandle)->indent.v);
- EraseRect(lRect); /* Erase the cell */
- DrawString(resName); /* and draw the text. */
- if (lSelect) { /* Hilight if necessary. */
- DoHilite (lRect);
- }
- }
- }
- break;
-
- case lHiliteMsg:
- DoHilite (lRect);
- break;
-
- case lCloseMsg: /* nothing needs to be done here. */
- break;
-
- }
- }