Commit Graph

343 Commits

Author SHA1 Message Date
nick black
84107c547d
view: support -m argument for margins #551 2020-04-29 03:24:11 -04:00
nick black
0b4ada19b1 Remove AVFrame from API #532 2020-04-24 04:17:56 -04:00
nick black
21822f98e7 fix up averr->ncerr #532 2020-04-24 04:17:56 -04:00
nick black
6ffbef3d74 cmake: openimageio discovery #453 2020-04-24 04:17:56 -04:00
nick black
ad0685aa1b switch to nc_err_e #532 2020-04-24 04:17:56 -04:00
Nick Black
0e73b9d3d5
Floating-point ncplot, genericize ncplot (#531)
* compile ncplot as c++ generic #446
* add floating-point plots #446
2020-04-23 03:52:07 -04:00
Nick Black
fe8034b5e0
ncfdplane, fileroller PoC, ncfdplane unit tests, qrcodes #24 #514 (#524)
* first draft of ncsubproc spec
* qrcode first draft #24
* demo: add qrcode demo skeleton, entries #24
* qrcode demo #24
* fedora python build changes from @dcantrell
* ncplane_qrcode() works #24
* add some flash to the qrcode demo #24
* drone: use newest builders
* fix up rgb PoC
* drop jungle demo to 100Hz target
* add fd.c
* ncfd skeletons
* more ncfdplane #514
* ncfdp i/o loop
* ncfp: improve uinit test, write core
* firm up ncfdplane #514
* fileroller PoC #514
* ncplane: allow '\n' in stream when scrolling #523
2020-04-20 23:26:41 -04:00
Marek Habersack
3ea7bbba18 [C++] Restore NotCurses::render semantics
Go back to returning `bool`, it was an oversight in 64eeb95f
2020-04-18 15:21:24 -04:00
nick black
dba42f9eef
ncplane_at_yx_cell(): plug memory leak on success path 2020-04-18 08:15:24 -04:00
Nick Black
1c7796a2b0
ncdirect_cursor_yx, ncdirect_cursor_pop, ncdirect_cursor_push #401 (#492)
* ncdirect_cursor_{push, pop, yx} declarations #401
* direct PoC: invoke ncdirect_cursor_yx() #401
* direct PoC: move to top of screen #401
* OTHERS.md: mention blessings
* ncdirect_cursor_yx working #401
* CHANGELOG: mention ncdirect_cursor_*() #401
2020-04-18 07:11:33 -04:00
Nick Black
c6a9997554
Normalize ncplane_at_* / ncplane_set_base() (#479)
* ncplane_at_* and ncplane_at_cursor_*

We had notcurses_at_yx() expanding into three distinct parts of
the cell structure, and ncplane_at_yx() / ncplane_at_cursor()
writing directly to a cell. It was annoying to remember which
was which. The latter two now have a signature matching
notcurses_at_yx(), while the old functionality has been moved
to ncplane_at_yx_cell() and ncplane_at_cursor_yx(). #476
2020-04-18 00:09:14 -04:00
nick black
d274af34b9 ncplot: define 2x2 and 4x2 sets #461 2020-04-16 11:41:20 -04:00
nick black
43c8b9fdb6 ncpp: drop USE_FFMPEG guards #488 2020-04-15 22:20:34 -04:00
nick black
a0669974ff
ncplane_putstr_yx(): don't map 0 to -1 #485 2020-04-15 12:32:27 -04:00
Marek Habersack
64eeb95f1e [C++] Optionally enable throwing exceptions on errors
Nick prefers error handling based on exceptions in all cases, while I
prefer to save exception handling for truly exceptional situations -
function parameter validation and class constructor. However, there's no
need to not support both approaches, to be chosen at the discretion of
the developer.

NCPP follows RAII and all classes throw exceptions from their
constructors in case they cannot initialize properly. Likewise,
functions taking pointers that are required validate them and throw
exceptions whenever the requirement isn't met.

This commit goes one step further in that it enables optional validation
of notcurses function return values and throwing an
exception (`ncpp::call_error`) should the function signal an error. This
is disabled by default but it can be enabled by defining the
`NCPP_EXCEPTIONS_PLEASE` macro (preferably on the command line or
before *each* inclusion of any NCPP headers).

Out of necessity, this breaks the ABI (plus I found a handful of minor
issues in the code), but I think it's worth having this support in
place.
2020-04-15 12:10:14 -04:00
Marek Habersack
28976dfef2 [C++] Sync API changes
Been a while, but here goes, sync to the latest API changes.

Added:

  * Direct:   cursor_{up,left,right,down} (`ncdirect_cursor_{up,left,right,down}`)
  * Plane: constructors to use `ncplane_bound`
  * Plane: reparent (`ncplane_reparent`)
  * Plot: definition of `default_options`

Changed:

  * Plane (breaking): the `*gradient*` functions now return `int`
  * Plane (breaking): `polyfill` returns `int`
  * Plane (breaking): `stain` returns `int`
  * Plane (breaking): `blit_bgrx` takes `const void*` for `data`
  * Plane (breaking): `blit_rgba` takes `const void*` for `data`
  * Plot: `plot_optons` -> `ncplot_options`
  * Plot (breaking): `{add,set}_sample` now return `bool`
2020-04-11 20:44:25 -04:00
nick black
b04a37c433
plots: always start from the right #457 2020-04-08 21:26:15 -04:00
nick black
2c2da61c72
ncdirect: add relative move functions #419 2020-04-08 09:07:49 -04:00
Nick Black
c2a645e9af
Rust wrapper work (#454)
* packaging: s/libtinfo/Terminfo/g
* rust: add stddim_yx()
* rust: check for valid init in unit tests
* rust: serialize up tests
* constify notcurses_term_dim_yx()
* rust: add dim wrappers
* remove notcurses_resize() from public API #367
* call notcurses_resize() from notcurses_refresh() #367
2020-04-08 05:39:41 -04:00
nick black
eccb24a391 c++ plot shouldn't allow negative samples #447 2020-04-07 23:43:12 -04:00
nick black
9dc81f0b64 c++ wrappers for ncplot #441 2020-04-07 23:43:12 -04:00
nick black
77dd998b05
ncplot uses exclusively non-negative samples #447 2020-04-06 02:39:56 -04:00
nick black
5c44416426
export ncplane_putstr_yx() as static inline 2020-04-06 01:15:20 -04:00
nick black
4a6ab358ba inline ncplane_putsimple_yx() 2020-04-05 23:54:38 -04:00
nick black
fcd7e19e4c Add ncplane_set_scrolling() #323 2020-04-05 23:54:38 -04:00
nick black
4917603478
ncplot: swap NCPLOT_2x1 and NCPLOT_1x1x4 2020-04-04 13:00:27 -04:00
nick black
2a7ccffec6 ncplot: add labelaxisd, use it in keyplot #438 2020-04-04 12:32:19 -04:00
nick black
c0f8d9b444
eliminate detectdomain, infer it from maxy==miny #439 2020-04-04 08:56:31 -04:00
nick black
68b4ba1706 plots: implement remaining vertical grid types #136 2020-04-03 08:27:08 -04:00
nick black
5f3eb3dc24 keyplot: add third plot, this one with half blocks #433 2020-04-03 08:27:08 -04:00
nick black
a3f7dd486b plot: AugmentSample5 test case 2020-04-03 05:51:02 -04:00
nick black
5bccf6b446 ncplot: implement x windowing #430 2020-04-03 05:51:02 -04:00
nick black
4926186b5a ncplot: check input parameters for validity #430 2020-04-03 05:51:02 -04:00
nick black
b3e874a179 ncplot: fold minx, maxx into rangex 2020-04-03 05:51:02 -04:00
nick black
09d8912d4e notcurses-keyplot #430 2020-04-03 05:51:02 -04:00
nick black
5e27499194 add notcurses-keyplot #430 2020-04-03 05:51:02 -04:00
nick black
d541cda306 independent variable 2020-04-03 05:51:02 -04:00
nick black
4afda7a625 float some geometry concepts 2020-04-03 05:51:02 -04:00
nick black
5aedb3491d ncplot_plane(), ncplot_destroy() 2020-04-03 05:51:02 -04:00
nick black
f29a5a7bd9 declare ncplot_create() 2020-04-03 05:51:02 -04:00
nick black
a45d888601
All fill-type functions return cells changed
Fill-type functions used to return 0 for success, and -1
on failure. They now return the number of cells written
on success, similarly to ncvisual_render(). Resolves #427.
2020-03-29 05:26:56 -04:00
nick black
8651486ad7
Don't say DirectColor when TrueColor is meant 2020-03-27 12:58:30 -04:00
nick black
a77774f4dc
notcurses_at_yx(): value-result u32+u64, not cell
Resolves #410. notcurses_at_yx() accepted a cell*, but the
gcluster of this cell was always set to 0. The EGC is instead
a heap-allocated copy, returned as the primary return value.
This is due to the absence of an egcpool to bind against.
Existing callers can be converted thus:

* instead of passing cell 'c', pass &(c)->attrword, &(c)->channels
* either initialize 'c' with CELL_TRIVIAL_INITIALIZER, or set its
   gcluster field to 0 following the call

I've updated all calls from tests/demos, updated the docs, and
updated the C++ and Python wrappers.
2020-03-27 03:49:13 -04:00
nick black
73b61f6a69 Add bound planes (#71) plus docs/tests
Add ncplane_bound(3). This allows a new plane N to be created in the
*bound* state relative to another ncplane B. If B moves, N moves the
same amount. If N is moved, the coordinates are taken relative to B
as opposed to the standard plane. If B is destroyed, N is destroyed.
Each plane can have many planes bound to it, but can only be bound to
a single plane. Add ncplane_reparent(3). This allows a plane to be
detached from any plane to which it is bound, and optionally rebound
to a new plane. The standard plane cannot be reparented.
Documentation and unit tests have been added for both.
2020-03-27 03:13:30 -04:00
nick black
91f907a184
gradient_sized (C++): fix parameter name 2020-03-26 18:19:01 -04:00
Nick Black
f9c54761f5
Basic mandelbrot for normal demo #145 (#424)
normal: working mandelbrot, very basic #145
2020-03-25 07:19:56 -04:00
Nick Black
de9158bd7b
More tetris work for book #421 (#423)
* tetris: use NES gravities
* tetris: use NES grav multiplier of 50ms
* tetris: implement move down #421
* README: mention notcurses-tetris #421
* tetris: use double box for boundary #421
* tetris: extract background.h
* tetris: break up into chunks suitable for book
* tetris: do the rotations
2020-03-25 04:06:38 -04:00
nick black
ae1421db15
ncvisual_render() API change/documentation #422
ncvisual_render() now returns the number of cells emitted
rather than just 0/-1. -1 is still returned on failure.
Rather than 0 for length meaning "all possible length", it
now means 0, and -1 means "all possible length". All demos,
tests, and PoCs have been updated. #422
2020-03-24 18:43:10 -04:00
Marek Habersack
73b13e0fd5 [C++] There can be only one stdplane
Fixes: https://github.com/dankamongmen/notcurses/issues/409

Standard planes can be duplicated but the copy must not be treated as a
standard plane. There can be only one :)

Make it so.
2020-03-24 16:33:58 -04:00
nick black
8113ce72c1 fix dumb error in ncplane_below() description 2020-03-23 12:46:35 -04:00