// querycom.sr

// Last modified October 25, 1979  6:54 PM by Taft


get "BRAVO1.DF"
get "MSG.DF"
get "DISPLAY.DF"
get "ALTOFILESYS.D"
get "FONT.DF"
get "VM.DF"
get "DOC.DF"


// Incoming Procedures

external	[
	array
	mapcp
	SbPar
	SbLooks
	deleted
	insertc
	stsize
	ClearBuf
	BufToRi
	SetRegionB
	MakeCurrentBuf
	errhlta
	invalidatewindow
	]


// Incoming Statics

external	[
	mpWwWwd
	vmapstatus
	parsacred
	ttblsacred
	vlb
	vpw
	vlook1
	vlook2
	parstd
	rgmaccp
	vrldsys
	vfDiablomode
	mpfunfd
	mpfnof
	look1std
	look2std
	]


// Outgoing Procedures

external	[
	FMagnifyWw
	Query
	]


// Outgoing Statics

external
	[
	vfcpFDisplSys
	]


// Local Statics

static
	[
	vfcpFDisplSys = false
	]


// Local Structures

// structure


// Local Manifests

manifest	[
	bufConst = 6
	]


// F   M A G N I F Y   W W

let FMagnifyWw(ww, fHd, xUd) = valof
[
if fHd & vfDiablomode then
	[
	let fd = mpfunfd ! funDiablo
	if fd eq fdnil then
		resultis false
//	let fdh = (lv fd>>FD.rvrgfdd)+(fd>>FD.maxmagi)
//	unless fdh>>FDH.rvmpfargcc ne 0 % fillinfonth(funDiablo, 0) then
//		resultis false
	]
let wwd = mpWwWwd ! ww
// wwd>>WWD.mag = fHd ? vmagLook, 100
// wwd>>WWD.xdUd = fHd ? RoundRatio(xUd, vmagLook, 3200), xUd rshift 5
wwd>>WWD.fHd = fHd
if fHd then
	[
//	setmag(ww)
// 	for fun = 0 to maxfun-1 do
// 		if (mpfunmagi ! fun ne -1) &
// 		(mpfunfddfaulted ! fun ne -1) then
// 			getfontc(fun);
	if mpfnof ! fnfontw eq -1 then errhlta(206);
	]
invalidatewindow(ww)
resultis true
] // end FMagnifyWw


// Q U E R Y

and Query(doc, cp, fPar) = valof
[
let sb = array(150)
vmapstatus = statusblind
mapcp(doc, cp, fPar)
test fPar ifso
	SbPar(sb, parsacred, ttblsacred)
ifnot
	SbLooks(sb, (vlb ? vpw>>lh, vpw>>rh), vlook1, vlook2)
deleted(doctx3)
insertc(doctx3, 0, sb)
let sbTrailer = "*032*c"
// let tpar = vec parovhd
// move(parstd, tpar, parovhd)
// tpar>>PAR.control = true
insertc(doctx3, stsize(sb), sbTrailer, look1std % trailerbits, look2std, parstd, 0)
ClearBuf(3)
SetRegionB(vrldsys, BufToRi(3), doctx3, 0, rgmaccp ! doctx3)
// InsertBuf(3, doctx3, 0, rgmaccp ! doctx3)
MakeCurrentBuf(3)
vfcpFDisplSys = true
] // end Query