// --------------------------------------------------------------------------------------
void AddRowsAndDataToIconList(ListHandle iconList, SInt16 iconFamilyBaseID)
{
	short dataLength, rowNumber;
	IconListCellDataRec cellData;
	Cell theCell;
	
	if (!gIconsRegistered)		// if we didn't register our icons already, we need to
	{
		OSErr error;
		FSSpec iconResFile;
		
			/* The first thing we need to do to register an IconRef is to get the FSSpec 
			   for the file containing the icon resources.  This could be the 
			   application file itself or a flattened resource file in a bundle.  Either 
			   way, in this program it's the "current" resource file so we call our 
			   utility function that converts the file reference number returned by 
			   CurResFile to an FSSpec. */
		error = getCurrentResourceFSSpec(&iconResFile);
		
		if (error != noErr)		// if we can't get our icons, this program is kind of useless
			ExitToShell();
		
			// we've got the FSSpec, now get the icons out of it
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			RegisterIconRefFromResource(kAppSignature, 'LIc0' + rowNumber, &iconResFile, 
										iconFamilyBaseID + rowNumber, &cellData.icon);
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
			
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
		
		gIconsRegistered = true;
	}
	else	// the icons are already registered so we just have to get them
	{
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			GetIconRef(kOnSystemDisk, kAppSignature, 'LIc0' + rowNumber, &cellData.icon);
			
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
				
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
	}
}
示例#2
0
Boolean
AddPopulateCompInfo()
{
	int 	i;
	char	*currDesc;
	Point	currCell;
	Boolean bCellSelected = false;
	int		nextRow = 0;
	
	for (i=0; i<gControls->cfg->numComps; i++)
	{
		if (!gControls->cfg->comp[i].invisible && gControls->cfg->comp[i].additional)
		{
			HLock(gControls->cfg->comp[i].shortDesc);
			currDesc = *gControls->cfg->comp[i].shortDesc;
			SetPt(&currCell, 0, nextRow);
			rowToComp[nextRow++] = i;
			LSetCell( currDesc, strlen(currDesc), currCell, gControls->aw->compList);
			HUnlock(gControls->cfg->comp[i].shortDesc);
			if (gControls->cfg->comp[i].selected == true)
			{
				LSetSelect(true, currCell, gControls->aw->compList);
				bCellSelected = true;
			}
		}
	}

	numRows = nextRow;	
	return bCellSelected;
}
示例#3
0
文件: macevlog.c 项目: rdebath/sgt
void logevent(void *frontend, const char *str)
{
    Session *s = frontend;
    ListBounds bounds, visible;
    Cell cell = { 0, 0 };

    if (s->eventlog == NULL)
	mac_createeventlog(s);
    if (s->eventlog == NULL)
	return;

#if TARGET_API_MAC_CARBON
    GetListDataBounds(s->eventlog, &bounds);
    GetListVisibleCells(s->eventlog, &visible);
#else
    bounds = (*s->eventlog)->dataBounds;
    visible = (*s->eventlog)->visible;
#endif

    cell.v = bounds.bottom;
    LAddRow(1, cell.v, s->eventlog);
    LSetCell(str, strlen(str), cell, s->eventlog);
    /* ">=" and "2" because there can be a blank cell below the last one. */
    if (visible.bottom >= bounds.bottom)
	LScroll(0, 2, s->eventlog);
}
示例#4
0
/* -----------------------------------------------------------------------------*/
void FillLists (void)
{
	TDriverInfos drvInfo; TSlotInfos slotInfo; SlotRefNum sref;
	Cell srcCell, dstCell; Boolean visible;
	short ref, i, j, p, n = MidiCountDrivers();
	
	srcCell.h = srcCell.v = dstCell.h = dstCell.v = 0;
	LDelRow(0, 0, theList[SrcL]);
	LDelRow(0, 0, theList[DstL]);
	ResetPortMap ();
	for (i = 1; i <= n; i++) {
		ref = MidiGetIndDriver (i);
		if (MidiGetDriverInfos (ref, &drvInfo)) {
			for (j = 1; j <= drvInfo.slots; j++) {
				sref = MidiGetIndSlot (ref, j);
				if (MidiGetSlotInfos (sref, &slotInfo)) {
					visible = false;
					if (slotInfo.direction & MidiInputSlot) {
						LAddRow(1, srcCell.v, theList[SrcL]);
						LSetCell(&slotInfo.name[1], slotInfo.name[0], srcCell, theList[SrcL]);
						srcCell.v++; visible = true;
					}
					if (slotInfo.direction & MidiOutputSlot) {
						LAddRow(1, dstCell.v, theList[DstL]);
						LSetCell(&slotInfo.name[1], slotInfo.name[0], dstCell, theList[DstL]);
						dstCell.v++; visible = true;
					}
					if (visible) {
						for (p = 0; p < 32; p++) PortsMap[p] |= slotInfo.cnx[p];
					}
				}
			}
			if (i <= 64) {
				InListMap[i-1] = srcCell.v;
				OutListMap[i-1] = dstCell.v;
			}
		}
	}
	InvalPortArea();
	LUpdate(myWindow->visRgn, theList[SrcL]);
	LUpdate(myWindow->visRgn, theList[DstL]);
}
示例#5
0
extern pascal void		LSetCellWhite(const void *dataPtr, SInt16 dataLen, Cell theCell, ListHandle lHandle)
{
	OSStatus err;
	MoreThemeDrawingState state;

	err = MoreGetThemeDrawingState(&state);
	if (err == noErr) {
		err = MoreNormalizeThemeDrawingState();
		assert(err == noErr);
		LSetCell(dataPtr, dataLen, theCell, lHandle);
		err = MoreSetThemeDrawingState(state, true);
	}
	assert(err == noErr);
}
示例#6
0
void change_ListRow( short row, const MidiFile* file)
{
	Point	aCell;
	char	buf[256]="",*p;
	
	if( file && file->mfn && file->mfn->title )
		strcat(buf, file->mfn->title);
	
	p= strrchr(file->filename, PATH_SEP);
	if( p ){
		strcat(buf, "  ("); strcat(buf, p+1); strcat(buf, ")");
	}

	SetPt(&aCell, 0, row);
	LSetCell( buf, strlen(buf), aCell, gPlaylist);
}
示例#7
0
void change_ListRow( short row, const MidiFile* file)
{
	Point	aCell;
	char	buf[256]="",*p;
	
	if( file && file->mfn && file->mfn->title )
	{
		strncpy(buf, file->mfn->title, sizeof(buf) - 1);
		buf[sizeof(buf)-1] = '\0';
	}
	
	p= strrchr(file->filename, PATH_SEP);
	if( p ){
		size_t len = strlen(buf);
		snprintf(&buf[len], sizeof(buf)-len-1, "  (%s)", p+1);
		buf[sizeof(buf)-1] = '\0';
	}

	SetPt(&aCell, 0, row);
	LSetCell( buf, strlen(buf), aCell, gPlaylist);
}