diff --git a/src/lib/fill.c b/src/lib/fill.c index a3dabed95..86bcc22f3 100644 --- a/src/lib/fill.c +++ b/src/lib/fill.c @@ -487,7 +487,15 @@ rotate_plane(ncplane* n){ } const int newy = dimx / 2; const int newx = dimy * 2; - ncplane* newp = ncplane_new(n, newy, newx, absy, absx, n->userptr, "copy"); + struct ncplane_options nopts = { + .y = absy, + .horiz.x = absx, + .rows = newy, + .cols = newx, + .userptr = n->userptr, + .name = "copy", + }; + ncplane* newp = ncplane_create(n, &nopts); return newp; } diff --git a/src/lib/menu.c b/src/lib/menu.c index e2b98c326..e74b5502b 100644 --- a/src/lib/menu.c +++ b/src/lib/menu.c @@ -321,8 +321,14 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){ if(totalwidth < dimx){ totalwidth = dimx; } - int ypos = ret->bottom ? dimy - totalheight : 0; - ret->ncp = ncplane_new(n, totalheight, totalwidth, ypos, 0, NULL, "menu"); + struct ncplane_options nopts = { + .y = ret->bottom ? dimy - totalheight : 0, + .horiz.x = 0, + .rows = totalheight, + .cols = totalwidth, + .name = "menu", + }; + ret->ncp = ncplane_create(n, &nopts); if(ret->ncp){ ret->unrolledsection = -1; ret->headerchannels = opts->headerchannels; diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 4a89b0817..ed630b22a 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -457,8 +457,15 @@ ncplane* ncplane_dup(const ncplane* n, void* opaque){ const struct notcurses* nc = ncplane_notcurses_const(n); const int placey = n->absy - nc->margin_t; const int placex = n->absx - nc->margin_l; - ncplane* newn = ncplane_new(n->boundto, dimy, dimx, - placey, placex, opaque, n->name); + struct ncplane_options nopts = { + .y = placey, + .horiz.x = placex, + .rows = dimy, + .cols = dimx, + .userptr = opaque, + .name = n->name, + }; + ncplane* newn = ncplane_create(n->boundto, &nopts); if(newn){ if(egcpool_dup(&newn->pool, &n->pool)){ ncplane_destroy(newn); diff --git a/src/lib/reader.c b/src/lib/reader.c index 8c51000e4..6d7129b42 100644 --- a/src/lib/reader.c +++ b/src/lib/reader.c @@ -16,9 +16,14 @@ ncreader* ncreader_create(ncplane* n, const ncreader_options* opts){ nr->ncp = n; // do *not* bind it to the visible plane; we always want it offscreen, // to the upper left of the true origin - if((nr->textarea = ncplane_new(notcurses_stdplane(ncplane_notcurses(n)), - ncplane_dim_y(n), ncplane_dim_x(n), - -ncplane_dim_y(n), -ncplane_dim_x(n), NULL, "text")) == NULL){ + struct ncplane_options nopts = { + .y = -ncplane_dim_y(n), + .horiz.x = -ncplane_dim_x(n), + .rows = ncplane_dim_y(n), + .cols = ncplane_dim_x(n), + .name = "text", + }; + if((nr->textarea = ncplane_create(notcurses_stdplane(ncplane_notcurses(n)), &nopts)) == NULL){ ncplane_destroy(nr->ncp); free(nr); return NULL; diff --git a/src/lib/reel.c b/src/lib/reel.c index 387fc7c11..b172f33dd 100644 --- a/src/lib/reel.c +++ b/src/lib/reel.c @@ -258,7 +258,14 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop, return -1; } //fprintf(stderr, "p tplacement: %p base %d/%d len %d/%d frontiery %d %d dir %d\n", t, begy, begx, leny, lenx, frontiertop, frontierbottom, direction); - ncplane* fp = ncplane_new(nr->p, leny, lenx, begy, begx, NULL, "tab"); + struct ncplane_options nopts = { + .y = begy, + .horiz.x = begx, + .rows = leny, + .cols = lenx, + .name = "tab", + }; + ncplane* fp = ncplane_create(nr->p, &nopts); if((t->p = fp) == NULL){ //fprintf(stderr, "failure creating border plane %d %d %d %d\n", leny, lenx, begy, begx); return -1; @@ -278,7 +285,14 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop, } if(cbleny - cby + 1 > 0){ //fprintf(stderr, "cbp placement %dx%d @ %dx%d\n", cbleny, cblenx, cby, cbx); - t->cbp = ncplane_new(t->p, cbleny, cblenx, cby, cbx, NULL, "tdat"); + struct ncplane_options dnopts = { + .y = cby, + .horiz.x = cbx, + .rows = cbleny, + .cols = cblenx, + .name = "tdat", + }; + t->cbp = ncplane_create(t->p, &dnopts); if(t->cbp == NULL){ //fprintf(stderr, "failure creating data plane %d %d %d %d\n", cbleny, cblenx, cby, cbx); ncplane_destroy(t->p); diff --git a/src/lib/visual.cpp b/src/lib/visual.cpp index e5bc6fcf8..327c28000 100644 --- a/src/lib/visual.cpp +++ b/src/lib/visual.cpp @@ -418,9 +418,16 @@ auto ncvisual_render(notcurses* nc, ncvisual* ncv, } } //fprintf(stderr, "PLACING NEW PLANE: %d/%d @ %d/%d\n", disprows, dispcols, placey, placex); - n = ncplane_new(notcurses_stdplane(nc), disprows / encoding_y_scale(bset), - dispcols / encoding_x_scale(bset), placey, placex, nullptr, "vis"); - if(n == nullptr){ + struct ncplane_options nopts = { + .y = placey, + .horiz = { + .x = placex, + }, + .rows = disprows / encoding_y_scale(bset), + .cols = dispcols / encoding_x_scale(bset), + .name = "vis", + }; + if((n = ncplane_create(notcurses_stdplane(nc), &nopts)) == nullptr){ return nullptr; } placey = 0;