add simple_box() and heavy_box() forms

This commit is contained in:
nick black 2021-06-10 17:04:29 -04:00
parent 4731e8269f
commit cb178ac247
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 41 additions and 10 deletions

View File

@ -21,6 +21,9 @@ rearrangements of Notcurses.
* A new binary is installed, `notcurses-info`. It prints information about * A new binary is installed, `notcurses-info`. It prints information about
the terminal environment in which it runs. More information is available the terminal environment in which it runs. More information is available
from its man page, `notcurses-info(1)`. from its man page, `notcurses-info(1)`.
* Added `ncdirect_simple_box()`, `ncdirect_heavy_box()`,
`nccells_simple_box()`, and `nccells_heavy_box()`. Publicized
`nccells_ascii_box()`. All are `static inline`.
* 2.3.2 (2021-06-03) * 2.3.2 (2021-06-03)
* Fixed a bug affecting certain scalings of `ncvisual` objects created from * Fixed a bug affecting certain scalings of `ncvisual` objects created from

View File

@ -271,6 +271,20 @@ API int ncdirect_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
int ylen, int xlen, unsigned ctlword) int ylen, int xlen, unsigned ctlword)
__attribute__ ((nonnull (1))); __attribute__ ((nonnull (1)));
__attribute__ ((nonnull (1))) static inline int
ncdirect_simple_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
uint64_t ll, uint64_t lr,
int ylen, int xlen, unsigned ctlword){
return ncdirect_box(n, ul, ur, ll, lr, L"┌┐└┘─│", ylen, xlen, ctlword);
}
__attribute__ ((nonnull (1))) static inline int
ncdirect_heavy_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
uint64_t ll, uint64_t lr,
int ylen, int xlen, unsigned ctlword){
return ncdirect_box(n, ul, ur, ll, lr, L"┏┓┗┛━┃", ylen, xlen, ctlword);
}
// ncdirect_box() with the rounded box-drawing characters // ncdirect_box() with the rounded box-drawing characters
API int ncdirect_rounded_box(struct ncdirect* n, uint64_t ul, uint64_t ur, API int ncdirect_rounded_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
uint64_t ll, uint64_t lr, uint64_t ll, uint64_t lr,

View File

@ -2313,6 +2313,30 @@ API int nccells_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channel
nccell* ul, nccell* ur, nccell* ll, nccell* ul, nccell* ur, nccell* ll,
nccell* lr, nccell* hl, nccell* vl); nccell* lr, nccell* hl, nccell* vl);
static inline int
nccells_ascii_box(struct ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "/\\\\/-|");
}
static inline int
nccells_simple_box(struct ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
if(notcurses_canutf8(ncplane_notcurses(n))){
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "┌┐└┘─│");
}
return nccells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
}
static inline int
nccells_heavy_box(struct ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
if(notcurses_canutf8(ncplane_notcurses(n))){
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "┏┓┗┛━┃");
}
return nccells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
}
static inline int static inline int
ncplane_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels, ncplane_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels,
int ystop, int xstop, unsigned ctlword){ int ystop, int xstop, unsigned ctlword){

View File

@ -2821,16 +2821,6 @@ char* ncplane_contents(ncplane* nc, int begy, int begx, int leny, int lenx){
return ret; return ret;
} }
int nccells_ascii_box(ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "/\\\\/-|");
}
int cells_ascii_box(ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
return nccells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
}
int nccells_double_box(ncplane* n, uint32_t attr, uint64_t channels, int nccells_double_box(ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){ nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
if(notcurses_canutf8(ncplane_notcurses(n))){ if(notcurses_canutf8(ncplane_notcurses(n))){