mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
add ncplane_y() and ncplane_x()
This commit is contained in:
parent
34ae5cb5a6
commit
66f80c77f9
4
NEWS.md
4
NEWS.md
@ -1,6 +1,10 @@
|
|||||||
This document attempts to list user-visible changes and any major internal
|
This document attempts to list user-visible changes and any major internal
|
||||||
rearrangements of Notcurses.
|
rearrangements of Notcurses.
|
||||||
|
|
||||||
|
* 1.6.20 (not yet released)
|
||||||
|
* Added convenience functions `ncplane_y()` and `ncplane_x()`, components
|
||||||
|
of longstanding `ncplane_yx()`.
|
||||||
|
|
||||||
* 1.6.19 (2020-08-27)
|
* 1.6.19 (2020-08-27)
|
||||||
* Direct mode now places the terminal into "cbreak mode". This disables
|
* Direct mode now places the terminal into "cbreak mode". This disables
|
||||||
echo and line-buffering of input. If this is undesirable, you can restore
|
echo and line-buffering of input. If this is undesirable, you can restore
|
||||||
|
2
USAGE.md
2
USAGE.md
@ -743,6 +743,8 @@ int ncplane_move_yx(struct ncplane* n, int y, int x);
|
|||||||
// Get the origin of this plane relative to the standard plane, or the plane to
|
// Get the origin of this plane relative to the standard plane, or the plane to
|
||||||
// which it is bound (if it is bound to a plane).
|
// which it is bound (if it is bound to a plane).
|
||||||
void ncplane_yx(const struct ncplane* n, int* restrict y, int* restrict x);
|
void ncplane_yx(const struct ncplane* n, int* restrict y, int* restrict x);
|
||||||
|
int ncplane_y(const struct ncplane* n);
|
||||||
|
int ncplane_x(const struct ncplane* n);
|
||||||
|
|
||||||
// Return the dimensions of this ncplane.
|
// Return the dimensions of this ncplane.
|
||||||
void ncplane_dim_yx(struct ncplane* n, int* restrict rows, int* restrict cols);
|
void ncplane_dim_yx(struct ncplane* n, int* restrict rows, int* restrict cols);
|
||||||
|
@ -36,6 +36,10 @@ notcurses_plane - operations on ncplanes
|
|||||||
|
|
||||||
**void ncplane_yx(const struct ncplane* n, int* restrict y, int* restrict x);**
|
**void ncplane_yx(const struct ncplane* n, int* restrict y, int* restrict x);**
|
||||||
|
|
||||||
|
**int ncplane_y(const struct ncplane* n);**
|
||||||
|
|
||||||
|
**int ncplane_x(const struct ncplane* n);**
|
||||||
|
|
||||||
**struct ncplane* ncplane_parent(struct ncplane* n);**
|
**struct ncplane* ncplane_parent(struct ncplane* n);**
|
||||||
|
|
||||||
**const struct ncplane* ncplane_parent_const(const struct ncplane* n);**
|
**const struct ncplane* ncplane_parent_const(const struct ncplane* n);**
|
||||||
|
@ -1185,6 +1185,8 @@ API int ncplane_move_yx(struct ncplane* n, int y, int x);
|
|||||||
// Get the origin of this plane relative to the standard plane, or the plane to
|
// Get the origin of this plane relative to the standard plane, or the plane to
|
||||||
// which it is bound (if it is bound to a plane).
|
// which it is bound (if it is bound to a plane).
|
||||||
API void ncplane_yx(const struct ncplane* n, int* RESTRICT y, int* RESTRICT x);
|
API void ncplane_yx(const struct ncplane* n, int* RESTRICT y, int* RESTRICT x);
|
||||||
|
API int ncplane_y(const struct ncplane* n);
|
||||||
|
API int ncplane_x(const struct ncplane* n);
|
||||||
|
|
||||||
// Get the plane to which the plane 'n' is bound, if any.
|
// Get the plane to which the plane 'n' is bound, if any.
|
||||||
API struct ncplane* ncplane_parent(struct ncplane* n);
|
API struct ncplane* ncplane_parent(struct ncplane* n);
|
||||||
|
@ -98,6 +98,8 @@ int ncplane_cursor_move_yx(struct ncplane* n, int y, int x);
|
|||||||
void ncplane_cursor_yx(struct ncplane* n, int* y, int* x);
|
void ncplane_cursor_yx(struct ncplane* n, int* y, int* x);
|
||||||
int ncplane_move_yx(struct ncplane* n, int y, int x);
|
int ncplane_move_yx(struct ncplane* n, int y, int x);
|
||||||
void ncplane_yx(struct ncplane* n, int* y, int* x);
|
void ncplane_yx(struct ncplane* n, int* y, int* x);
|
||||||
|
int ncplane_y(const struct ncplane* n);
|
||||||
|
int ncplane_x(const struct ncplane* n);
|
||||||
void ncplane_dim_yx(const struct ncplane* n, int* rows, int* cols);
|
void ncplane_dim_yx(const struct ncplane* n, int* rows, int* cols);
|
||||||
int ncplane_putc_yx(struct ncplane* n, int y, int x, const cell* c);
|
int ncplane_putc_yx(struct ncplane* n, int y, int x, const cell* c);
|
||||||
void ncplane_move_top(struct ncplane* n);
|
void ncplane_move_top(struct ncplane* n);
|
||||||
|
@ -1870,20 +1870,26 @@ int ncplane_move_yx(ncplane* n, int y, int x){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ncplane_y(const ncplane* n){
|
||||||
|
if(n->boundto == NULL){
|
||||||
|
return n->absy - n->nc->stdplane->absy;
|
||||||
|
}
|
||||||
|
return n->absy - n->boundto->absy;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ncplane_x(const ncplane* n){
|
||||||
|
if(n->boundto == NULL){
|
||||||
|
return n->absx - n->nc->stdplane->absx;
|
||||||
|
}
|
||||||
|
return n->absx - n->boundto->absx;
|
||||||
|
}
|
||||||
|
|
||||||
void ncplane_yx(const ncplane* n, int* y, int* x){
|
void ncplane_yx(const ncplane* n, int* y, int* x){
|
||||||
if(y){
|
if(y){
|
||||||
if(n->boundto == NULL){
|
*y = ncplane_y(n);
|
||||||
*y = n->absy - n->nc->stdplane->absy;
|
|
||||||
}else{
|
|
||||||
*y = n->absy - n->boundto->absy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(x){
|
if(x){
|
||||||
if(n->boundto == NULL){
|
*x = ncplane_x(n);
|
||||||
*x = n->absx - n->nc->stdplane->absx;
|
|
||||||
}else{
|
|
||||||
*x = n->absx - n->boundto->absx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user