示例#1
0
// Quickdraw Accessor Glue
// --------------------------------------------------------------------------------------
pascal Pattern * GetQDGlobalsWhite(Pattern *white)
{
	if (white != NULL)
	{
			/* We could try to come up with some clever way to get qd and actually use 
			   its white Pattern but that's a lot more trouble than it's worth.  We 
			   could also manually generate a Pattern with all 0's but the easiest thing 
			   to do is get the white pattern out of the system file. */
		GetIndPattern(white, 0, 20);	// 0 is the ID of the 'PAT#' resource in the system 
	}									// file, 20 is the index of the all-white pattern
	
	return white;
}
示例#2
0
pascal void SafeGetIndPattern(Pattern *thePat, short patternListID, short index)
{
	StAcroResourceContext resContext;
	
	GetIndPattern(thePat, patternListID, index);
}
示例#3
0
/* アイコンプレビューのアップデート */
void DrawIPIconPreview(const IPIconRec *ipIcon)
{
	PicHandle	previewPict;
	Rect		r;
	Pattern		pat;
	Boolean		drawLarge=false,drawSmall=false,drawThumbnail=false;
	Handle		h;
	OSErr		err;
	IconSuiteRef	iconSuite=NULL;
	IconRef		iconRef;
    Rect        picRect;
	
	/* プレビューの大きさ */
	GetWindowPortBounds(gPreviewWindow,&r);
	
	/* まず背景 */
	switch (gListBackground)
	{
		case iBackWhite:
			EraseRect(&r);
			break;
		
		case iBackGray:
			GetIndPattern(&pat,0,4);
			FillRect(&r,&pat);
			break;
		
		case iBackBlack:
			PaintRect(&r);
			break;

		case iBackDesktop:
			#if !TARGET_API_MAC_CARBON
			{
				PixPatHandle	ppat;
				
				UseResFile(0);
	//			ppat=GetPixPat(16);
				ppat=LMGetDeskCPat();
				if (ppat==nil)
				{
					LMGetDeskPattern(&pat);
					FillRect(&r,&pat);
				}
				else
				{
					FillCRect(&r,ppat);
			//		DisposePixPat(ppat);
				}
				UseResFile(gApplRefNum);
			}
			#else
			EraseRect(&r);
			#endif
			break;

        default:
			EraseRect(&r);
			break;
}
	
	if (ipIcon!=NULL)
	{
		err=GetDataFromIPIcon(&h,ipIcon,kL1Data);
		drawLarge=(h!=nil);
		err=GetDataFromIPIcon(&h,ipIcon,kS1Data);
		drawSmall=(h!=nil);
		err=GetDataFromIPIcon(&h,ipIcon,kT32Data);
		drawThumbnail=(h!=nil);
	}
	
	if (drawThumbnail)
		previewPict = GetPicture(142);
	else
		previewPict = GetPicture(141);
    QDGetPictureBounds(previewPict, &picRect);
	DrawPicture(previewPict,&picRect);
	
	if (ipIcon==NULL) return;
	
	if (!isThumbnailIconsAvailable || !drawThumbnail)
	{
		iconSuite = ipIcon->iconSuite;
	}
	else
	{
		IconFamilyHandle	iconFamily;
		
		err=IPIconToIconFamily(ipIcon,&iconFamily);
		err=RegisterIconRefFromIconFamily(kIconPartyCreator,'TEMP',iconFamily,&iconRef);
	//	DisposeHandle((Handle)iconFamily);
	}
	
	if (isThumbnailIconsAvailable && drawThumbnail)
	{
		err=PlotIconRef(&iconPreviewRect[12],kAlignNone,kTransformNone,kIconServicesNormalUsageFlag,
					iconRef);
		err=ReleaseIconRef(iconRef);
	}
	else
	{
		if (iconSuite != NULL)
		{
			PlotIconSuite(&iconPreviewRect[0],kAlignNone,kTransformNone,iconSuite);
			PlotIconSuite(&iconPreviewRect[1],kAlignNone,kTransformSelected,iconSuite);
			
			if (drawLarge)
			{
				PlotIconSuite(&iconPreviewRect[4],kAlignNone,kTransformOpen,iconSuite);
				PlotIconSuite(&iconPreviewRect[5],kAlignNone,kTransformSelectedOpen,iconSuite);
				
				PlotIconSuite(&iconPreviewRect[8],kAlignNone,kTransformOffline,iconSuite);
				PlotIconSuite(&iconPreviewRect[9],kAlignNone,kTransformSelectedOffline,iconSuite);
			}
			PlotIconSuite(&iconPreviewRect[2],kAlignNone,kTransformNone,iconSuite);
			PlotIconSuite(&iconPreviewRect[3],kAlignNone,kTransformSelected,iconSuite);
			
			if (drawSmall)
			{
				PlotIconSuite(&iconPreviewRect[6],kAlignNone,kTransformOpen,iconSuite);
				PlotIconSuite(&iconPreviewRect[7],kAlignNone,kTransformSelectedOpen,iconSuite);
				
				PlotIconSuite(&iconPreviewRect[10],kAlignNone,kTransformOffline,iconSuite);
				PlotIconSuite(&iconPreviewRect[11],kAlignNone,kTransformSelectedOffline,iconSuite);
			}
		}
	}
}
示例#4
0
文件: lcd.c 项目: CNMAT/CNMAT-Externs
void main(fptr *f)
{
	CInfoRec ct;
	
	long oldA4;
	oldA4 = SetCurrentA4();
	RememberA4();
	FNS = f;

	setup(&lcd_class, (void *)LCD_new, (method) LCD_free, (short)sizeof(Lcd),
		(method)LCD_menu, A_GIMME, 0);
	
	addmess((method)LCD_ascii,"ascii",A_GIMME,0);
	addmess((method)LCD_update,"clear",0);
	addmess((method)LCD_click,"click",A_CANT,0);
	addmess((method)LCD_color,"color",A_LONG,0);
	addmess((method)LCD_debug,"debug",0);
	addmess((method)LCD_font,"font",A_DEFLONG,A_DEFLONG,0);
	addmess((method)LCD_frameOval,"frameOval",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_frameRect,"frameRect",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_Line,"Line",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_LineTo,"LineTo",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_Move,"Move",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_MoveTo,"MoveTo",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_linesegment,"LineSegment",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0);
	addmess((method)LCD_paintOval,"PaintOval",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_paintRect,"PaintRect",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_penMode,"penMode",A_LONG,0L,0);
	addmess((method)LCD_pos,"pos",A_LONG,A_LONG,0);
	addmess((method)LCD_save,"psave",A_CANT,0);
	addmess((method)LCD_reson,"reson",A_GIMME,0);
	addmess((method)LCD_resonSampleRate,"resonfreqmax",A_FLOAT,0L,0);
	addmess((method)LCD_resonSpect,"resonSpect",A_FLOAT,0L,0);
	addmess((method)LCD_resonTrim,"resonTrim",A_FLOAT,0L,0);
	addmess((method)LCD_update,"update",A_CANT, 0);
	addmess((method)LCD_write,"write",A_GIMME,0);
	addmess((method)LCD_assist,"assist",A_CANT, 0);
	
	addmess((method)LCD_local,"local",A_LONG,0);
	addmess((method)LCD_readpict,"readpict",A_GIMME,0);
	addmess((method)LCD_drawpict,"drawpict",0);
	addmess((method)LCD_picthandle,"picthandle",A_LONG,0);

	GetIndPattern(&blk,sysPatListID,1);
	GetIndPattern(&wht,sysPatListID,20);
	colorinfo(&ct);
	hasColorQD = ct.c_hasColorQD;
	numPaletteColors = ct.c_depth>=8? 256 : (ct.c_depth==4? 16 : 2);
	
	if (numPaletteColors<=16)
		hasColorQD=0; // sde 4-bit mode is screwey, ignore it.
		
#ifdef debug	
	post("hasColor %d",hasColorQD);
	post("numColors %d",numPaletteColors);
#endif	
	post("LCD Object by Michael Lee, Steve Ellison, David Zicarelli");
	post("copyright © 1991-97 Regents of the University of California. All Rights Reserved.");
	
	LCD_makepalette();		/* DDZ made palette in main(), avoids rescopy */
	rescopy('STR#',myRes);	/* DDZ added assistance */

	ps_picthandle=gensym("picthandle");
	ps_pictname=gensym("pictname");

	RestoreA4(oldA4);
}