|
|
3 weeks ago | |
|---|---|---|
| .. | ||
| examples | 3 weeks ago | |
| API.md | 3 weeks ago | |
| Makefile | 3 weeks ago | |
| README.md | 3 weeks ago | |
| SUMMARY.md | 3 weeks ago | |
| TUTORIAL.md | 3 weeks ago | |
| demo | 3 weeks ago | |
| demo.mod | 3 weeks ago | |
| ttysize.mod | 3 weeks ago | |
| tv.def | 3 weeks ago | |
| tv.mod | 3 weeks ago | |
| tv.o | 3 weeks ago | |
| tvfont.def | 3 weeks ago | |
| tvfont.mod | 3 weeks ago | |
| tvfont.o | 3 weeks ago | |
| tvg.def | 3 weeks ago | |
| tvg.mod | 3 weeks ago | |
| tvg.o | 3 weeks ago | |
| tvtty.def | 3 weeks ago | |
A character-cell UI toolkit written in ISO GNU Modula-2 (gm2 -fiso) that
runs in a terminal (xterm and friends). It is a small, self-contained
Turbo-Vision-like library: a retained view tree with clipping and z-order,
a diffed ANSI cell screen, keyboard and mouse decoding (xterm SGR mouse
reports), widgets, and modal dialogs.
Everything is Modula-2 except tvtty.def, the tiny libc binding used to put
the terminal in raw mode and to query its size (termios, ioctl, read,
write). There is no C source and no graphics dependency.
| file | role |
|---|---|
tvtty.def |
libc binding (raw mode, winsize, read/write) |
tv.def / tv.mod |
the toolkit: screen, view tree, widgets, events |
tvg.def / tvg.mod |
tigr graphics backend (renders the view tree in a window) |
tvfont.def / tvfont.mod |
bundled 8x16 monospaced bitmap font for the backend |
demo.mod |
demo application |
ttysize.mod |
diagnostic: checks the tty binding |
gm2 -fiso -c tvtty.def
gm2 -fiso -I. -c tv.mod
gm2 -fiso -I. tv.o demo.mod -o demo
./demo
make -C examples
or simply make. The graphics example needs the tigr object from the
sibling project:
make tvg.o tvfont.o
make -C examples gfx
./examples/gfx Run it from a real terminal; `Esc` exits. See
TUTORIAL.md to write your own and API.md for the full reference.
X close box, draggable by the title
bar with the mouse and resizable by the bottom-right ■ handle
(WindowResize; children flagged vfExpand grow with the window).VEditor): insert/overwrite, arrows/Home/End/
PgUp/PgDn, Enter/Backspace/Delete, Tab indent, mouse positioning, wheel
scroll, its own Ln/Col/Insert/Modified status row, plus load/save to a
file (EditorLoad/EditorSave).(* *)/{ }/// comments) and automatic keyword up-casing for
Modula-2 and Oberon (begin -> BEGIN), plus auto-indentation (indent
after BEGIN/THEN/DO/..., dedent on END/UNTIL/ELSE).Tab/Shift-Tab and up/down cycle widgets; the focused
input gets the hardware cursor.Dialog/DlgInput/DlgCheck/DlgRadio/
DlgButton/DlgRun/DlgTextAt/DlgValue) and MessageBox (OK /
OK-Cancel / Yes-No), plus the Message shorthand.Resized), no polling required.tvg): the same views, widgets, menus
and dialogs render inside a tigr window (colours, box drawing and text via
a bundled 8x16 monospaced VGA font, box drawing as line segments); tigr
keyboard/mouse are turned into the same events.
Terminal programs stay free of any graphics dependency.F10), navigate
with Left/Right/Up/Down, select with Enter/Space or a mouse click;
item separators (MenuSep) are supported. The selected item's tag is
returned by HandleEvent.SIGWINCH-driven relayout (today the app polls the size).()
(PROCEDURE Cols() : INTEGER;), otherwise the .def fails to parse when
compiled through the .mod.^ (v^.rect); there is no implicit dereference.BEGIN ... END block is not a statement, so it cannot appear
directly in a CASE alternative - use a helper procedure.INTEGER index compared with HIGH(array) (a CARDINAL) must be
converted: i <= VAL(INTEGER, HIGH(a)).struct termios/struct winsize are accessed through an opaque
byte buffer with fixed Linux offsets (see tv.mod).