ÿ@SUBJECT:TSEditor 2.00 Macros (3/3) N
The following set of macros constitute a complete drop-in enhanced
replacement for the ASCII chart that came with the default tse.ui user
interface configuration file. This ASCII chart may be toggled on and
off at will using the same keybinding, which is considerably more
convenient than being forced to use the Escape key to abort the ASCII
chart after popping up the ASCII chart simply to take a quick peek at
the hexadecimal or decimal value for the current character. Also, this
version makes clear the distinction between a blank and the end of the
line. Thanks go to George J. De Bruin (of the SemWare support staff)
for solving the problem of how to make possible such a toggling of the
keybinding.
/* --------------------------88------------------------- */
/****************************************************************
* Return boundary adjusted for maximum available boundary (with *
* additional crimp as requested). *
* *
****************************************************************/
integer proc iBoundaryFilter(integer boundary,
integer boundarymax,
integer crimp)
if not (boundary <= (boundarymax - crimp))
boundary = boundarymax - crimp
endif
return(boundary)
end
keydef kASCIIChartEsc
Escape()
// ^^^^^^^
// must be same as the keybinding below
end
proc hkASCIIChartEscOn()
Enable(kASCIIChartEsc, _DEFAULT_)
end
proc hkASCIIChartEscOff()
Disable(kASCIIChartEsc)
end
constant no = False, negative = -1, zero = 0,
one = 1, two = 2, four = 4, five = 5,
ten = 10, fifteen = 15, sixteen = 16
integer asciichartid = no
proc mASCIIChart() /* popup (ASCII Chart) character selection */
string titlelist[12] = "Dec Hex Char"
integer memorycurrentid = GetBufferId(),
currcharvalue = CurrChar(),
asciichartselection = no,
widthlist, counter
if (asciichartid == no)
asciichartid = CreateTempBuffer()
if not (asciichartid == no)
counter = 255
while (counter >= zero)
and InsertLine(Format(Str(counter, ten): five,
Str(counter, sixteen): four,
Chr(counter): five), asciichartid)
counter = counter - one
endwhile
InsertLine(Format("": fifteen), asciichartid)
endif
endif
if not (GotoBufferId(asciichartid) == no)
BegFile()
widthlist = iBoundaryFilter((CurrLineLen() + one),
Query(ScreenCols), zero)
if (currcharvalue >= zero)
GotoLine(currcharvalue + two)
endif
Hook(_LIST_STARTUP_, hkASCIIChartEscOn)
Hook(_LIST_CLEANUP_, hkASCIIChartEscOff)
asciichartselection = List(titlelist, widthlist)
UnHook(hkASCIIChartEscOn)
UnHook(hkASCIIChartEscOff)
currcharvalue = CurrLine() - two
endif
GotoBufferId(memorycurrentid)
if not (asciichartselection == no)
case currcharvalue
when negative
DelToEOL()
when 0..255
InsertText(Chr(currcharvalue), _DEFAULT_)
endcase
endif
end
mASCIIChart()
/* --------------------------88------------------------- */
I've tried not to make transcription errors in lifting these macros
whole from my own integrated tse.ui user interface file. If you suffer
any problem with any of these macros, drop me a note and I'll fix the
transcription error(s).
--- FidoPCB v1.4 [ff151/a]
---------------
* Origin: SemWare Support BBS * 404-641-8968 * (1:133/314)
|