// QLOOK.SR
get "BRAVO.DF"
get "CHAR.DF"
get "GINN.DF"
// Incoming Procedures
external [
marks
updatedisplay
invalidatewindow
invalidatedoc
setmessage
movec
codechange
cpparabounds
invalidateband
invalidatesel
changeformata
hidemark
ckhp
ckspecs
insert
cpc
pollkeyboard
];
// Incoming Statics
external [
xleftmargstd
xrightmargstd
comt
rgprogram
rgview
vwwcurrent
vww
rgdoc
selaux
sdoc
selection
fdebug
hdebug
rgfcode
vwindowstripe // %%
];
// Outgoing Procedures
external [
lookey
];
// Outgoing Statics
// Local
let lookeyformatted(doc) = valof
[
rgprogram ! doc = false
setmessage(" No longer a program")
resultis 0
]
and lookinvisible(lookmask, turnon) = valof
[
let doc = rgdoc ! vwwcurrent ;
let visflag = turnon? lookmask, 0;
let old = rgview ! doc
if (old & lookmask) eq visflag then resultis 0
rgview ! doc = old xor lookmask
invalidatedoc(doc) ;
resultis 0
]
and lookey(char) = valof
[
let doc = rgdoc ! vwwcurrent
switchon char-#200 into
[
case chcr: resultis lookinvisible(lookcrmask, true)
case chsp: resultis lookinvisible(lookspmask, true)
case chtab: resultis lookinvisible(looktabmask, true)
case $h:resultis lookinvisible(looktrailermask, true)
case $\: resultis lookinvisible(lookmarkermask, true) ;
case $=: invalidatesel(selection)
invalidatesel(selaux)
resultis lookinvisible(lookremarkmask, true) ;
case shcr: resultis lookinvisible(lookcrmask, false)
case shsp: resultis lookinvisible(lookspmask, false)
case shtab: resultis lookinvisible(looktabmask, false)
case $H: resultis lookinvisible(looktrailermask, false)
case $|: resultis lookinvisible(lookmarkermask, false) ;
case $+: invalidatesel(selection)
invalidatesel(selaux)
resultis lookinvisible(lookremarkmask, false) ;
case $f: resultis lookeyformatted(doc)
case $W: vwindowstripe = false ; resultis 0
case $w: vwindowstripe = true ; resultis 0
default: endcase
]
doc = selection >> SEL.doc
if rgprogram ! doc then resultis 0
let kind = (rgfcode ! (char-#200)) << FCODE.kind // %%
let fontchange = kind eq klook % kind eq knormal // %%
if (cpc(selection>>SEL.cplast, selection>>SEL.cpfirst) ls 0) &
fontchange then
[
let ans = insert(char)
if hdebug then ckhp()
if fdebug then ckspecs()
resultis ans
]
let change = vec changel
movec(change, change+changel-1, 0)
codechange(change, char-#200)
let tcpfirst, tcplast, dum = nil, nil, nil
test cpc(selection>>SEL.cplast, selection>>SEL.cpfirst) ls 0
ifso [
doc = selection >> SEL.doc
cpparabounds(doc, selection >> SEL.cpfirst,
lv tcpfirst, lv dum, lv tcplast)
// some day change bugshape too
]
ifnot [
tcpfirst = selection >> SEL.cpfirst
tcplast = selection >> SEL.cplast
unless fontchange do
[
cpparabounds(doc,tcpfirst, lv tcpfirst, lv dum, lv dum)
cpparabounds(doc, tcplast, lv dum, lv dum, lv tcplast)
]
]
invalidateband(doc, tcpfirst, tcplast)
invalidatesel(selection)
invalidatesel(selaux)
changeformata(change, doc, tcpfirst, tcplast)
hidemark()
if hdebug then ckhp()
if fdebug then ckspecs()
resultis 0
]