Check out my first novel, midnight's simulacra!

Outcurses

From dankwiki
Revision as of 20:50, 17 October 2019 by Dank (talk | contribs)

During the development of Growlight and Omphalos, I found myself implementing significant UI code atop ncurses. It's my goal to extract most of this, unify it, and make it available as liboutcurses. Code lives on github.

Why is it called 'outcurses'? Because there's more cursing, duh.

Panelreels

The Ncurses panels extension (originating in AT&T System V) facilitates management of a deck of possibly-overlapping window objects sharing a screen (there's little point in using panels if windows are strictly tiled among the screen, but not much reason not to, either). The various panels of a screen have a z-ordering, and higher panels obscure panels underneath. Using the panels extension requires linking in the extra library libpanel (or libpanelw for wide character support).

The panelreel is a UI abstraction supported by outcurses in which dynamically-created and -destroyed toplevel entities (referred to as tablets) are arranged in a torus (circular loop), allowing for infinite scrolling. This works naturally with keyboard navigation, mouse scrolling wheels, and touchpads (including the capacitive touchscreens of modern cell phones). The "panel" comes from the underlying ncurses objects (each entity corresponds to a single panel) and the "reel" from slot machines. A panelreel initially has no tablets; at any given time thereafter, it has zero or more tablets, and if there is at least one tablet, one tablet is focused (and on-screen). If the last tablet is removed, no tablet is focused.

The controlling application can, at any time,

  • Insert a new tablet somewhere in the reel (possibly off-screen)
  • Delete a (possibly off-screen) tablet from the reel
  • Change focus to the next or previous tablet, bringing it on-screen if it is off
  • Change focus to some arbitrary other tablet, bringing it on-screen if it is off
  • Expand or collapse the information depth of a tablet
  • Change the content of a tablet, updating it if it is on-screen
  • Navigate within the focused tablet

See also

  • My Xcurses project, which went exactly nowhere