mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
ncplane_*_box_cells() -> cells_*_box() #97
This commit is contained in:
parent
ccbdfcd499
commit
e21594b4e9
@ -598,8 +598,8 @@ API const char* cell_extended_gcluster(const struct ncplane* n, const cell* c);
|
||||
// have loaded before the error are cell_release()d. There must be at least
|
||||
// six EGCs in gcluster.
|
||||
static inline int
|
||||
ncplane_box_cells(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
cell* lr, cell* hl, cell* vl, const char* gclusters){
|
||||
cells_load_box(struct ncplane* n, cell* ul, cell* ur, cell* ll, cell* lr,
|
||||
cell* hl, cell* vl, const char* gclusters){
|
||||
int ulen;
|
||||
if((ulen = cell_load(n, ul, gclusters)) > 0){
|
||||
if((ulen = cell_load(n, ur, gclusters += ulen)) > 0){
|
||||
@ -623,15 +623,15 @@ ncplane_box_cells(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box_cells(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
cells_rounded_box(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
cell* lr, cell* hl, cell* vl){
|
||||
return ncplane_box_cells(n, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
return cells_load_box(n, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_double_box_cells(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
cells_double_box(struct ncplane* n, cell* ul, cell* ur, cell* ll,
|
||||
cell* lr, cell* hl, cell* vl){
|
||||
return ncplane_box_cells(n, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
return cells_load_box(n, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
}
|
||||
|
||||
// multimedia functionality
|
||||
|
@ -16,7 +16,7 @@ int box_demo(struct notcurses* nc){
|
||||
cell_init(&lr);
|
||||
cell_init(&hl);
|
||||
cell_init(&vl);
|
||||
if(ncplane_rounded_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_double_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
int y = 0, x = 0;
|
||||
|
@ -142,7 +142,7 @@ intro(struct notcurses* nc){
|
||||
cell lr = CELL_TRIVIAL_INITIALIZER;
|
||||
cell vl = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER;
|
||||
if(ncplane_rounded_box_cells(ncp, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(ncp, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
cell_set_fg(&ul, 90, 0, 90);
|
||||
|
@ -39,7 +39,7 @@ int maxcolor_demo(struct notcurses* nc){
|
||||
cell ur = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER;
|
||||
cell vl = CELL_TRIVIAL_INITIALIZER;
|
||||
if(ncplane_rounded_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
cell_set_fg(&ul, 0, 128, 128);
|
||||
|
@ -91,7 +91,7 @@ fill_chunk(struct ncplane* n, int idx){
|
||||
cell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
cell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
||||
if(ncplane_double_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_double_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
int r = random() % 256, g = random() % 256, b = random() % 256;
|
||||
@ -133,7 +133,7 @@ draw_bounding_box(struct ncplane* n, int yoff, int xoff, int chunky, int chunkx)
|
||||
cell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
cell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
||||
if(ncplane_rounded_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
cell_set_fg(&ul, 180, 80, 180);
|
||||
|
@ -100,7 +100,7 @@ int unicodeblocks_demo(struct notcurses* nc){
|
||||
cell lr = CELL_TRIVIAL_INITIALIZER;
|
||||
cell vl = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER;
|
||||
if(ncplane_rounded_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
uint32_t blockstart = blocks[sindex].start;
|
||||
|
@ -15,7 +15,7 @@ message(struct ncplane* n, int maxy, int maxx, int num, int total){
|
||||
cell_init(&lr);
|
||||
cell_init(&hl);
|
||||
cell_init(&vl);
|
||||
if(ncplane_rounded_box_cells(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(n, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
ncplane_cursor_move_yx(n, 3, 1);
|
||||
|
@ -72,7 +72,7 @@ draw_borders(ncplane* w, unsigned nobordermask, const cell* attr,
|
||||
cell ul, ur, ll, lr, hl, vl;
|
||||
cell_init(&ul); cell_init(&ur); cell_init(&hl);
|
||||
cell_init(&ll); cell_init(&lr); cell_init(&vl);
|
||||
if(ncplane_rounded_box_cells(w, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
if(cells_rounded_box(w, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||
return -1;
|
||||
}
|
||||
/*fprintf(stderr, "drawing borders %p %d/%d->%d/%d, mask: %04x, clipping: %c%c\n",
|
||||
|
@ -175,7 +175,7 @@ TEST_F(NcplaneTest, BadlyPlacedBoxen) {
|
||||
ASSERT_LT(2, y);
|
||||
ASSERT_LT(2, x);
|
||||
cell ul{}, ll{}, lr{}, ur{}, hl{}, vl{};
|
||||
ASSERT_EQ(0, ncplane_rounded_box_cells(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
ASSERT_EQ(0, cells_rounded_box(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y + 1, x + 1));
|
||||
EXPECT_EQ(0, ncplane_cursor_move_yx(n_, 1, 0));
|
||||
EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x));
|
||||
@ -196,7 +196,7 @@ TEST_F(NcplaneTest, PerimeterBox) {
|
||||
ASSERT_LT(2, y);
|
||||
ASSERT_LT(2, x);
|
||||
cell ul{}, ll{}, lr{}, ur{}, hl{}, vl{};
|
||||
ASSERT_EQ(0, ncplane_rounded_box_cells(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
ASSERT_EQ(0, cells_rounded_box(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
EXPECT_EQ(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y - 1, x - 1));
|
||||
cell_release(n_, &vl);
|
||||
cell_release(n_, &hl);
|
||||
@ -213,7 +213,7 @@ TEST_F(NcplaneTest, PerimeterBoxSized) {
|
||||
ASSERT_LT(2, y);
|
||||
ASSERT_LT(2, x);
|
||||
cell ul{}, ll{}, lr{}, ur{}, hl{}, vl{};
|
||||
ASSERT_EQ(0, ncplane_rounded_box_cells(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
ASSERT_EQ(0, cells_rounded_box(n_, &ul, &ur, &ll, &lr, &hl, &vl));
|
||||
EXPECT_EQ(0, ncplane_box_sized(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x));
|
||||
cell_release(n_, &vl);
|
||||
cell_release(n_, &hl);
|
||||
|
Loading…
Reference in New Issue
Block a user