// October 10, 1979  10:05 AM by Taft

get "zpdefs.bcpl"

// outgoing procedures:

external [
	paintSpline
	paintText
	setColorMode
	colorSymbol
	]


// incoming procedures:

external [
	MoveBlock			// SYSTEM

	checkTextID			// ZPTEXT
	textColorSymbol

	checkSplineID			// ZPDRAW
	splineColorSymbol
	giveMeXY

	menuDisplay			// ZPDISP
	]


// incoming statics:

external [
	@color				// ZPINIT
	@Xref0
	@Yref0

	@Xref				// ZPINTER
	@Yref

	cursorTable			// ZPFONT
	]

// local definitions:


//********************************************************************
// 
//********************************************************************



let setColorMode(menuNumber) be [setColorMode
	color=selecton menuNumber into [
		case 6: blue;
		case 7: red;
		case 8: green;
		case 9: black;
		case 23: yellow;
		case 24: cyan;
		case 25: magenta;
		default: black
		]
	// set cursor
	MoveBlock(lvAltoCursor, colorSymbol(color), 16)
	Xref=Xref0 - 8
	Yref= Yref0 - 8
	menuDisplay()
	]setColorMode


and colorSymbol(c) = valof [colorSymbol
	let cTable=table [ 0;
		cyanCursor; magentaCursor; blueCursor;
		yellowCursor; greenCursor; redCursor; blackCursor;
		]
	resultis (cursorTable+cursorTable!(cTable!c))
	]colorSymbol


and paintSpline(id, h; numargs n) be [paintSpline
	let x=h>>HITPOINT.x
	let y=h>>HITPOINT.y
	let splinePointer=checkSplineID(id)
	unless splinePointer return
//	if splinePointer>>SPLINE.color eq color return
	splineColorSymbol(splinePointer)
	splinePointer>>SPLINE.color=color
	if n ne 2 then giveMeXY(splinePointer, lv x, lv y)
	splinePointer>>SPLINE.xColor=x
	splinePointer>>SPLINE.yColor=y
	splineColorSymbol(splinePointer)
	]paintSpline



and paintText(id) be [paintText
	let textPointer=checkTextID(id)
	unless textPointer return
	if textPointer>>TEXT.color eq color return
	textColorSymbol(textPointer)
	textPointer>>TEXT.color=color
	textColorSymbol(textPointer)
	]paintText