Commit Graph

131 Commits (c6c137d68891c356477a2a6519af0943af72abea)

Author SHA1 Message Date
Marek Habersack d32bef358d [C++] API sync
After a long delay, apologies :)

Added:
  * NotCurses: `can_sextant` (`notcurses_cansextant`)
  * Notcurses: `linesigs_enable` (`notcurses_linesigs_enable`)
  * Notcurses: `linesigs_disable` (`notcurses_linesigs_disable`)
  * Pile: `top_with` (`ncpile_top`)
  * Pile: `bottom_with` (`ncpile_bottom`)
  * Plane: `resize_maximize` (`ncplane_resize_maximize`)
  * Plane: `get_abs_x` (`ncplane_abs_x`)
  * Plane: `get_abs_y` (`ncplane_abs_y`)
  * Plane: `get_abs_yx` (`ncplane_abs_yx`)
  * Plane: `load_egc32` (`cell_load_egc32`)
  * Plane: `is_descendant_of` (`ncplane_descendant_p`)
  * Progbar: new class, wraps `ncprogbar_*`

Changed:
  * Plane (ABI break): `at_cursor` overloads now return `int` where
    before they returned `bool` because the underlying Notcurses API
    only signalled the operation status with the return value while now
    it returns actual information.
3 years ago
nick black 54b44513c4
Wide EGC tweaks
Don't bias the nccell width by 1, or 0-length EGCs become
255 columns. We weren't actually using the width to drive
much anything until now, so this wasn't a problem, but it
is exposed as an error once we got rid of CELL_WIDE_ASIAN
and start looping through the actual egc column width.
Closes #1278, closes #1277
4 years ago
nick black 7e20a25482
ncdirect_*_palindex -> ncdirect_set_*_palindex #1261 4 years ago
nick black f1253560ad
ncdirect: set_ on rgb functions #1261 4 years ago
nick black 76d8e2dfce
ncdirect_{fg, bg}_default() -> ncdirect_set_{fg, bg}_default() #1261 4 years ago
nick black 638dde7657
remove unnecessary args from ncdirect_raster_frame() #1248 4 years ago
nick black 1d8fcbb5e4
ncdirect: styles{set, on, off} -> _styles #1247 4 years ago
nick black 4d8efcab82
Progress towards NCBLIT_3x2 by default
Add a new member 'sextants' to the terminfo cache (both
notcurses and ncvisual contain one of these, and both
initialize it the same way -- interrogate_terminfo()).
Add a new function, 'notcurses_media_defblitter()', and
deprecate 'ncvisual_default_blitter()' (the latter didn't
receive enough information to return NCBLIT_3x2). Update
all callers. Add new *internal* function rgba_default_blitter(),
so this logic can be freely changed in the future. If
sextants are available, and we're scaling, return NCBLIT_3x2.
Once we detect sextant availability, we'll have sexblitter
as a default -- stay tuned! #1114
4 years ago
nick black 5cd3cdaf70
direct: s/ncplane/ncdirectv/g 4 years ago
Nick Black 730e9f69ec
Multithreaded ncls (#1232)
Thread out ncls to perform the media decode in different threads, in parallel. Only the display needs be locked. On a directory of 200 files on my 39070X, this speeds ncls from ~5s to ~1s. On 75 files, we go from ~.5s to ~.2s. On a single file, we lose about 5%. To facilitate this, ncdirect_render_image() has been split into two helpers, ncdirect_render_frame() and ncdirect_raster_frame().
4 years ago
nick black fd2acde1b1 rename cell->nccell, keep alias #1200 4 years ago
Marek Habersack c5c9432ac0 [Misc] A hodgepodge of tiny changes
CMake:
  Simplify cmake target+version config generation and make it actually
  work.  With the changes it is now possible to detect and use
  `Notcurses` in the following way:

     find_package(Notcurses REQUIRED)
     ...
     target_link_libraries(myapp PRIVATE notcurses::notcurses)

  Also, added the same CMake configuration for `Notcurses++`, to be used
  in the following way:

     find_package(Notcurses REQUIRED
     find_package(Notcurses++ REQUIRED)
     ...
     target_link_libraries(myapp PRIVATE notcurses++::notcurses++)

Docs:
  `notcurses_cell(3)`: `cell_styles_{on,off} -> cell_{on,off}_styles`
  and `cell_load_simple` -> `cell_load_char`

C++ API:
  * Plane: added constructors taking `ncplane_options const&` instead of
    the multitude of individual parameters
  * Plane: drop `struct` when `ncplane_options` is used.
  * Plane: added `strdup` (`cell_strdup`)
  * Plane: added `extract` (`cell_extract`)
4 years ago
Marek Habersack c063ce4e36 [C++] API sync
Added:

  * Pile: new class derived from Plane, which implements all the
    `ncpile_*` calls
  * Plane: `get_parent` (`ncplane_parent`)
  * Plane: protected constructor for use by `Pile` (or other derived
    classes which cannot provide a valid `ncplane*` when invoking parent
    constructor.
  * Plane: `set_plane` for use by the derived classes above.

Changed:

  * Plane: `to_ncplane` is a `const` method now.
4 years ago
nick black ebc80915a3 c++/rust struck #1138 4 years ago
nick black fd97aa844c implement ncpile_{render, rasterize}() 🦀🦀 #1135 4 years ago
nick black 8f7fa9da44 move postpaint() out of render step #1135 4 years ago
nick black b6e5b60374 ncpile_create() not NCPLANE_OPTION_NEWPILE #1078 4 years ago
nick black 3ad9a40426 hook up piles #1078 4 years ago
nick black ee83b63107 c++: add Plane::reparent_family() #1078 4 years ago
Marek Habersack c8eb3875ff [C++] API sync
Added:
 * NotCurses: `stats_alloc` (`notcurses_stats_alloc`)
 * Plane: `set_resizecb` (`ncplane_set_resizecb`)
4 years ago
nick black eef6df8c0a death to horiz #1115 4 years ago
nick black 886835a8b4 c++: deprecate ncplane_new() #1115 4 years ago
nick black 1609b00b77 C++ decode_loop() #1066 4 years ago
nick black 6623fc92a0
ncmenu_item_set_status: man page, NEWS, python, c++ #1057 4 years ago
nick black be0136874f rename Plane::putwc -> Plane::putwch to not conflict with stdlib macro #1046 4 years ago
nick black fa92e0ffe8
purge stray #undef #1046 4 years ago
nick black 0a3f697bc7
c++ ncplane: braces around initializer 4 years ago
nick black f9e2c7863b
add notcurses_stats_alloc #1043 4 years ago
nick black 270b1b20ee implement notcurses_render_to_buffer() #214 4 years ago
Marek Habersack a29bfe9c42 [C++] Deal with widgets grabbing full ownership of Panel
Fixes: https://github.com/dankamongmen/notcurses/issues/1009

Whenever a widget is created with its `*_create` function it currently
claims full ownership of the passed panel, including its destruction.
However, the C++ wrapper around the panel is not aware of this and will
attempt to destroy the native panel in the destructor, leading to
segfaults.

Fix this by introduction of a `Widget` class which contains the logic to
properly modify the `Panel` instance to not double-destroy the native
panel.  The solution is a bit fragile since the `Panel` instance is left
intact (we can't free it for the user) in a state that's safe for the
C++ wrapper, but calling any C function via the wrapper **will** pass a
`NULL` pointer in the panel argument - therefore the C functions MUST be
proofed against this.  The proofing belongs in the C backend code since
this protects also C and other language binding users from such abuse.

The Widget class will first verify that the passed `Plane` instance
hasn't already been "disowned" and will throw an exception to the effect
if it was.  Next, it will proceed to take over ownership of the native
panel instance and mark the passed `Panel` as "invalid" (i.e. not owning
any native panel instance anymore)

The above changes require modification of `Panel` instances and so all
the widget constructors taking `const*` or `const&` have been removed
from widget classes.
4 years ago
nick black 683217ef07 normalize style setters #1034 4 years ago
Marek Habersack 943e23535f [C++] API sync
Fixes: https://github.com/dankamongmen/notcurses/issues/1025

Added:
  * Direct: flush (`ncdirect_flush`)
  * Direct: getc (`ncdirect_getc_blocking` and `ncdirect_getc_nblock`)
  * Direct: getc (`ncdirect_getc`)
  * Direct: get_inputready_fd (`ncdirect_inputready_fd`)
  * NotCurses: align (`notcurses_align`)
  * NotCurses: ucs32_to_utf8 (`notcurses_ucs32_to_utf8`)
  * NotCurses: get_bottom (`notcurses_bottom`)
  * Plane: resize_realign (`ncplane_resize_realign`)
  * Plane: get_x (`ncplane_x`)
  * Plane: get_y (`ncplane_y`)
  * Plane: mergedown (`ncplane_mergedown`)
  * Plane: putwc_stained (`ncplane_putwc_stained`)
  * Plane: putstr_stained (`ncplane_putstr_stained`)
  * Plane: set_fchannel (`ncplane_set_fchannel`)
  * Plane: set_bchannel (`ncplane_set_bchannel`)
  * Plane: get_styles (`ncplane_styles`)
  * Plane: get_above (`ncplane_above`)
  * Reader: move_left (`ncreader_move_left`)
  * Reader: move_right (`ncreader_move_right`)
  * Reader: move_up (`ncreader_move_up`)
  * Reader: move_down (`ncreader_move_down`)
  * Reader: write_egc (`ncreader_write_egc`)
  * Visual: get_default_blitter (`ncvisual_default_blitter`)

Fixed:
  * NotCurses: `cursor_{enable,disable}` must use `NOEXCEPT_MAYBE`
  * Plane: renamed `putcw` to `putwc`
4 years ago
nick black 7b51bab79a add resizecb to ncplane_options struct #869 4 years ago
nick black 73f9973a2c Plane.hh: fix up indentation #1020 4 years ago
nick black 36aed3c521 add ncplane_create() + ncplane_options #1020 4 years ago
nick black 607c03edc4
rename _rgb_clipped functions rgb8_clipped 4 years ago
nick black a4367fcfb5 rip out ncplane_ creation functions #985 4 years ago
nick black e42dbdfd60 _stainable() -> _stained() #985 4 years ago
nick black b7a57eaab7 convert all channel rgb calls #985 4 years ago
nick black c3e5e47a2a
ncreader: conform to the New Way #627 4 years ago
nick black 306948507f ncmultiselect: normalize per new widget API #627 #1006 4 years ago
nick black 8839d44454 selector: transfer ownership of ncplane #1006 #627 4 years ago
nick black 2f28420034 rename ncplane_putsimple() -> ncplane_putchar() #912 4 years ago
nick black 4c7a1d0427 ncdirect_init: add flags parameter #976 4 years ago
nick black 7cbb2e9110 zoo demo: show cursor in reader box #835 4 years ago
nick black cab19cf790 Cursor work (placement, drop RETAIN_CURSOR) #953
notcurses_enable_cursor() now accepts placement arguments.
both it and notcurses_disable_cursor() now return int rather
than void. add notcurses_cursor_move_yx().
4 years ago
nick black df33f381e5 c++ wrappers: cursor_{en,dis}able, iprefix() #952 4 years ago
nick black 4dd1d6a4c8 Annihilate nc_err_e and all infrastructure #948 4 years ago
Nick Black 359ad1d36d
Generalized mergedown #779 (#932)
* Rename ncplane_mergedown -> ncplane_mergedown_simple()
* New ncplane_mergedown(), fully general projection of src to dst
4 years ago
nick black 05da44b06b
hide blending functions #917 4 years ago