Commit Graph

397 Commits (478ebadd640864d0e55314f57e56665b7d6a6dac)

Author SHA1 Message Date
Marek Habersack b5d8549bb3 [C++] Allow multiple instances of `NotCurses`
This is to make it possible, in the future, to create multiple instances
of `NotCurses` for multiple terminals.  The first instance of
`NotCurses` becomes the default one, so that any instances of other
classes that aren't explicitly created with a pointer to another
`NotCurses` instance still work as expected.

Note that currently trying to call `notcurses_init` twice results in the
following error for me:

    0x55555559bfc0 is already registered for signals
    Couldn't drop signals: 0x55555559bfc0 != 0x5555555b6720
    terminate called after throwing an instance of 'ncpp::init_error*'

    Program received signal SIGABRT, Aborted.

The error is signalled by `setup_signals` and the pointer shown in the
message points to the first `struct notcurses` instance created.
4 years ago
nick black dbc20bd5c0
add man page for ncmetric(3) #631 4 years ago
Marek Habersack e0462ed53a
[C++] Sync API changes (#633)
Added:

  * NotCurses: can_utf8 (`notcurses_canutf8`)
  * NotCurses: debug (`notcurses_debug`)
  * Plane: center_abs (`ncplane_center_abs`)
  * Plane: set_channels (`ncplane_set_channels`)
  * Plane: set_attr (`ncplane_set_attr`)
  * Reader: clear (`ncreader_clear`)

Changed:

  * USAGE.md: clarfied when C++ throws exceptions
4 years ago
nick black 8971bda0c2 ncpp: stop() resets _instance, add unit test #538 4 years ago
Marek Habersack 9ca8d9c9c6 Correctly cast `ncpp::Plane` to `ncplane*`
Fixes: https://github.com/dankamongmen/notcurses/issues/616

SIGSEGV was caused by an invalid cast.

Short explanation: PEBKAC

Long explanation: `Selector.hh`, `Plot.hh` and `MultiSelector.hh` did
not include `Plane.hh`, they merely declared `class Plane;` because
inclusion of `Plane.hh` would cause circular dependencies to appear and
the compiler would be unhappy.  On top of that, yours truly wrenched the
compiler's hands and caused it to believe that a pointer to `Plane` is
really a pointer to `ncplane*` which was quite a silly thing to do as
the compiler, not having included `Plane.hh` and thus not knowing full
definition of the type, wasn't able to look up the type cast operator in
`Plane`.

Don't abuse `reinterpret_cast`, kids!
4 years ago
nick black 24dae2cf15
ncmetric: tighten up PREFIXFWIDTH macros 4 years ago
nick black cce9384ab8
ncmetric: adapt PREFIXFMT to multibyte #630 4 years ago
nick black 2b5546fc4c
plot: make 8x1 the default glyph geometry 4 years ago
nick black 7215bf92ad
throw somed attributes on a few functions 4 years ago
nick black 37a4114f42
O(1) z-axis moves #623
Replace the singly-linked z-axis with a doubly-linked list,
and reimplement all z-axis moves as O(1) functions.
Eliminate ncplane_move_{above/below}_unsafe(), as there are no
longer unsafe moves.
4 years ago
nick black 0d696be0cc
ncpp: normalize Notcurses capitalization 4 years ago
nick black 99bd3fd597
recenter post-rotation in normal demo #617 4 years ago
nick black e80ac4ddb9
normal demo: work with odd number of columns :/ 4 years ago
nick black eb72a4612d
qprefix/bprefix: use uintmax_t for decimal 4 years ago
nick black 168ec1e71d
Update USAGE for streaming API changes #604 4 years ago
nick black 289b018612 view-demo: cleanup, opaque 4 years ago
nick black 78e30831dd move timespec 4 years ago
nick black 1c2f92b3bc
ncmetric: replace u with µ, define *COLUMNS #540 4 years ago
nick black 9a80750316
notcurses_canopen: split into images/videos #598 4 years ago
nick black 0f5333f103
subtle ncplane bugfixes
ncplane_dup(): properly set target plane attributes/channels
ncplane_move_below_unsafe(): speedup, at most one traversal
ncplane_rgba(): accept null glyph
ncvisual_from_plane(): dup the plane, own it in ncvisual
normal: spin the visual
4 years ago
nick black 7dae248a41 box demo: work in ASCII encoding #325 4 years ago
nick black 25baa10f72 special-case double/rounded boxes in ASCII #325 4 years ago
nick black 9f16034d02 add notcurses_debug() #594 4 years ago
nick black a440382fb5 demo: use NCPLOT_OPTIONS_EXPOENTIALD #470 4 years ago
nick black fbed12cd80
ncreel_options: add flag field #590 4 years ago
nick black 66bafd59b3
subproc, fdplane, plot, selector, mselector: flag words #590 4 years ago
nick black eaaa36f0c8
ncreader: ncplane as first arg #590 4 years ago
nick black 9446840b97
ncmenu: move to flag field #590 4 years ago
nick black fec423264f
selector: undo switch to notcurses from ncplane 4 years ago
nick black d89d8c52e9
notcurses_options: add flags field 4 years ago
nick black 95ba340fba
ncplane_erase: fix bug in basecell preservation 4 years ago
nick black d2c968b948
notcurses_init(): interpret NULL as /dev/tty #571 4 years ago
nick black 5b0d773fb5 modernize some PoC c++ according to clang-tidy 4 years ago
nick black a859a3d652 notcurses_multiselector(3): fix up _selected 4 years ago
nick black 989ca7ff9a selector->ncselector, multiselector -> ncmultiselector #580 4 years ago
nick black 26db8a66b7 ncplane_set_attr()/ncplane_set_channels() 4 years ago
nick black f0357ef6cb ncplane_contents(): declarations #582 4 years ago
nick black 48de25821c ncreader man page #403 4 years ago
nick black 312e42add2 ncreader: C++ wrapper 4 years ago
nick black d174431187 ncreader_create: accept const options #403 4 years ago
nick black 7683973ee4 ncreader_options, bad options tests #403 4 years ago
nick black 4819c0e1c3 selector/multiselect: accept notcurses 4 years ago
nick black 064da8acb9 ncreader_destroy() / ncreader_plane() 4 years ago
nick black 5e1d8ccf75 ncreader introduced 4 years ago
nick black 7337280e17
ncplane_at_yx(): const ncplane argument 4 years ago
nick black 5bdfc0183f
ncvisual_from_plane() #559 4 years ago
nick black 94fcada67c
ncvisual_rotate: unify _cw/_ccw, take radians 4 years ago
nick black f63325db60 Lots of ncvisual work
Unify ffmpeg/oiio/null implementations, where possible. This effectively
required placing all three in the same file, which meant they're all now
C++. Update FFmpeg implemenation to be C++-usable. Implement
ncvisual_rotate_cw() and ncvisual_rotate_ccw() #515. Move most of tetris
over to Visual from Plane #558. Add bgra_to_rgba(), necessary for
creating ncvisual from BGRA memory. Implement ncvisual_from_rgba()
and ncvisual_from_bgra() #557. Add unit tests on ncvisual rotation.
4 years ago
nick black 39548acc3a rename ncvisual_open_plane->ncvisual_from_file() #560 4 years ago
nick black 0135a6b54d rotation: ncvisual, not ncplane #515 4 years ago