macro PrintMosaic;
{  Prints a mosaic of all the open data windows.  This macro assumes that all }
{	these windows are 2D and are 128x128 }
var 
	str255 : dataName;
	integer : x,y,plotY,top,left,right,bottom,sizeX,sizeY;
	boolean : done,shiftRight,newPage,ok;
begin
	DisposeUnclose;
	done:=FrontData(dataName,'data');
	if(!done) then
		ShowError('Error','There are no data windows active');
		exit;
	endif;
	ok:=ShowMessage('','All the data window sizes must be equal to or less than 128x128.  Are they?');
	if(!ok)
		exit;
	endif;
	sizeX:=128; { change these to your data's window size }
	sizeY:=128;
	ok:=PrOpen(TRUE);
	if(!ok)
		exit;
	endif;
	TextFont('Helvetica');
	TextSize(9);
	TextFace('');
	PrGetPage(left,top,right,bottom);
	done:=CmpStr(dataName,=,'');
	x:=left;
	y:=top;
	if(!done) then
		repeat
			PrPlotData(dataName,x,y);
			y:=EvalNumber(y,+,sizeY,+,10);
			MoveTo(x,y);
			DrawString(dataName);
			y:=EvalNumber(y,+,10);
			plotY:=EvalNumber(y,+,sizeY,+,10);
			shiftRight:=Cmp(plotY,>,bottom);
			if(shiftRight) then
				y:=top;
				x:=EvalNumber(x,+,sizeX,+,20);
				newPage:=Cmp(x,>,right);
			endif;
			dataName:=NextData(dataName,'data');
			done:=CmpStr(dataName,=,'');
			if(newPage,&,!done)
				PrNewPage;
				newPage:=FALSE;
				x:=left;
				y:=top;
			endif;
		until(done);
	elseif
		ShowInfo('','nothing','','');
	endif;
	PrClose;
end;
