Go to the source code of this file.
|
void | nctabbed_redraw (nctabbed *nt) |
|
void | nctabbed_ensure_selected_header_visible (nctabbed *nt) |
|
nctab * | nctabbed_selected (nctabbed *nt) |
|
nctab * | nctabbed_leftmost (nctabbed *nt) |
|
int | nctabbed_tabcount (nctabbed *nt) |
|
ncplane * | nctabbed_plane (nctabbed *nt) |
|
ncplane * | nctabbed_content_plane (nctabbed *nt) |
|
tabcb | nctab_cb (nctab *t) |
|
const char * | nctab_name (nctab *t) |
|
int | nctab_name_width (nctab *t) |
|
void * | nctab_userptr (nctab *t) |
|
nctab * | nctab_next (nctab *t) |
|
nctab * | nctab_prev (nctab *t) |
|
nctabbed * | nctabbed_create (ncplane *n, const nctabbed_options *topts) |
|
nctab * | nctabbed_add (nctabbed *nt, nctab *after, nctab *before, tabcb cb, const char *name, void *opaque) |
|
int | nctabbed_del (nctabbed *nt, nctab *t) |
|
int | nctab_move (nctabbed *nt __attribute__((unused)), nctab *t, nctab *after, nctab *before) |
|
void | nctab_move_right (nctabbed *nt, nctab *t) |
|
void | nctab_move_left (nctabbed *nt, nctab *t) |
|
void | nctabbed_rotate (nctabbed *nt, int amt) |
|
nctab * | nctabbed_next (nctabbed *nt) |
|
nctab * | nctabbed_prev (nctabbed *nt) |
|
nctab * | nctabbed_select (nctabbed *nt, nctab *t) |
|
void | nctabbed_channels (nctabbed *nt, uint64_t *RESTRICT hdrchan, uint64_t *RESTRICT selchan, uint64_t *RESTRICT sepchan) |
|
const char * | nctabbed_separator (nctabbed *nt) |
|
int | nctabbed_separator_width (nctabbed *nt) |
|
void | nctabbed_destroy (nctabbed *nt) |
|
void | nctabbed_set_hdrchan (nctabbed *nt, uint64_t chan) |
|
void | nctabbed_set_selchan (nctabbed *nt, uint64_t chan) |
|
void | nctabbed_set_sepchan (nctabbed *nt, uint64_t chan) |
|
tabcb | nctab_set_cb (nctab *t, tabcb newcb) |
|
int | nctab_set_name (nctab *t, const char *newname) |
|
void * | nctab_set_userptr (nctab *t, void *newopaque) |
|
int | nctabbed_set_separator (nctabbed *nt, const char *separator) |
|
◆ nctabbed
◆ nctabbed_opsint
◆ nctab_cb()
◆ nctab_move()
Definition at line 303 of file tabbed.c.
303 {
304 if(after && before){
305 if(after->
prev != before || before->
next != after){
306 logerror(
"bad before (%p) / after (%p) spec", before, after);
307 return -1;
308 }
309 }else if(!after && !before){
310 logerror(
"bad before (%p) / after (%p) spec", before, after);
311 return -1;
312 }
313
314 if(t == after || t == before){
315 logerror(
"Cannot move a tab before or after itself.");
316 return -1;
317 }
320 if(after){
325 }else{
330 }
331 return 0;
332}
#define logerror(fmt,...)
◆ nctab_move_left()
Definition at line 345 of file tabbed.c.
345 {
349 return;
352 }
354}
int nctab_move(nctabbed *nt __attribute__((unused)), nctab *t, nctab *after, nctab *before)
◆ nctab_move_right()
Definition at line 334 of file tabbed.c.
334 {
338 return;
341 }
343}
◆ nctab_name()
const char * nctab_name |
( |
nctab * |
t | ) |
|
◆ nctab_name_width()
int nctab_name_width |
( |
nctab * |
t | ) |
|
◆ nctab_next()
◆ nctab_prev()
◆ nctab_set_cb()
Definition at line 448 of file tabbed.c.
448 {
451 return prevcb;
452}
void(* tabcb)(struct nctab *t, struct ncplane *ncp, void *curry)
◆ nctab_set_name()
int nctab_set_name |
( |
nctab * |
t, |
|
|
const char * |
newname |
|
) |
| |
Definition at line 454 of file tabbed.c.
454 {
455 int newnamecols;
456 char* prevname = t->
name;
458 logerror(
"New tab name contains illegal characters");
459 return -1;
460 }
461 if((t->
name = strdup(newname)) ==
NULL){
462 logerror(
"Couldn't allocate new tab name");
464 return -1;
465 }
466 free(prevname);
468 return 0;
469}
int ncstrwidth(const char *egcs, int *validbytes, int *validwidth)
◆ nctab_set_userptr()
void * nctab_set_userptr |
( |
nctab * |
t, |
|
|
void * |
newopaque |
|
) |
| |
Definition at line 471 of file tabbed.c.
471 {
472 void* prevcurry = t->
curry;
473 t->
curry = newopaque;
474 return prevcurry;
475}
◆ nctab_userptr()
void * nctab_userptr |
( |
nctab * |
t | ) |
|
◆ nctabbed_add()
Definition at line 231 of file tabbed.c.
232 {
234 if(after && before){
235 if(after->
next != before || before->
prev != after){
236 logerror(
"bad before (%p) / after (%p) spec", before, after);
238 }
239 }else if(!after && !before){
240
242 }
243 if((t = malloc(
sizeof(*t))) ==
NULL){
246 }
247 if((t->name = strdup(name)) ==
NULL){
248 logerror(
"Couldn't allocate the tab name");
249 free(t);
251 }
253 logerror(
"Tab name contains illegal characters")
254 free(t->name);
255 free(t);
257 }
259 t->next = after->next;
260 t->prev = after;
261 after->next = t;
262 t->next->prev = t;
263 }else if(before){
268 }else{
269
272 }
277 return t;
278}
if((size_t) r >=f->size - f->used)
◆ nctabbed_channels()
Definition at line 390 of file tabbed.c.
391 {
392 if(hdrchan){
393 memcpy(hdrchan, &nt->
opts.
hdrchan,
sizeof(*hdrchan));
394 }
395 if(selchan){
396 memcpy(selchan, &nt->
opts.
selchan,
sizeof(*selchan));
397 }
398 if(sepchan){
399 memcpy(sepchan, &nt->
opts.
sepchan,
sizeof(*sepchan));
400 }
401}
◆ nctabbed_content_plane()
◆ nctabbed_create()
Definition at line 148 of file tabbed.c.
148 {
151 unsigned nrows, ncols;
153 if(!topts){
154 topts = &zeroed;
155 }
156 if(!nctabbed_validate_opts(topts)){
157 goto err;
158 }
159 if((nt = malloc(
sizeof(*nt))) ==
NULL){
160 logerror(
"Couldn't allocate nctabbed");
161 goto err;
162 }
174 logerror(
"Separator string contains illegal characters");
175 goto err;
176 }
178 logerror(
"Couldn't allocate nctabbed separator");
179 goto err;
180 }
181 }
184 nopts.
y = nopts.
x = 0;
186 nopts.
rows = nrows - 1;
188 logerror(
"Couldn't create the tab content plane");
189 goto err;
190 }
194 logerror(
"Couldn't create the tab headers plane");
196 goto err;
197 }
198 }else{
199 nopts.
y = nopts.
x = 0;
203 logerror(
"Couldn't create the tab headers plane");
204 goto err;
205 }
207 nopts.
rows = nrows - 1;
209 logerror(
"Couldn't create the tab content plane");
211 goto err;
212 }
213 }
217 goto err;
218 }
220 return nt;
221
222err:
224 if(nt){
226 free(nt);
227 }
229}
int ncplane_destroy(ncplane *ncp)
ncplane * ncplane_create(ncplane *n, const ncplane_options *nopts)
int ncplane_family_destroy(ncplane *ncp)
void ncplane_dim_yx(const ncplane *n, unsigned *rows, unsigned *cols)
#define NCTABBED_OPTION_BOTTOM
void nctabbed_destroy(nctabbed *nt)
void nctabbed_redraw(nctabbed *nt)
◆ nctabbed_del()
Definition at line 280 of file tabbed.c.
280 {
281 if(!t){
283 return -1;
284 }
287 }else{
290 }
293 }
296 }
298 free(t);
300 return 0;
301}
◆ nctabbed_destroy()
Definition at line 411 of file tabbed.c.
411 {
412 if(!nt){
413 return;
414 }
418 if(t){
422 }
423 }
424 while(t){
427 free(t);
428 t = tmp;
429 }
432 free(nt);
433 }
434}
◆ nctabbed_ensure_selected_header_visible()
void nctabbed_ensure_selected_header_visible |
( |
nctabbed * |
nt | ) |
|
Definition at line 69 of file tabbed.c.
69 {
71 int cols = ncplane_dim_x(nt->
hp);
72 int takencols = 0;
73 if(!t){
74 return;
75 }
76
77 do{
79 break;
80 }
82 if(takencols >= cols){
83
86 }
88
90
91}
void nctabbed_rotate(nctabbed *nt, int amt)
◆ nctabbed_leftmost()
◆ nctabbed_next()
◆ nctabbed_plane()
◆ nctabbed_prev()
◆ nctabbed_redraw()
Definition at line 23 of file tabbed.c.
23 {
25 unsigned drawn_cols = 0;
26 unsigned rows, cols;
28
30 return;
31 }
32
35 ncplane_resize_simple(nt->
hp, -1, cols);
36 ncplane_resize_simple(nt->
p, rows - 1, cols);
38 }else{
39 ncplane_resize_simple(nt->
hp, -1, cols);
40 ncplane_resize_simple(nt->
p, rows - 1, cols);
41 }
42
45 }
46
50 do{
53 drawn_cols += ncplane_putstr(nt->
hp, t->
name);
55 }else{
56 drawn_cols += ncplane_putstr(nt->
hp, t->
name);
57 }
58
59
64 }
66 }
while(t != nt->
leftmost && drawn_cols < cols);
67}
void ncplane_set_channels(ncplane *n, uint64_t channels)
int ncplane_move_yx(ncplane *n, int y, int x)
void ncplane_erase(ncplane *n)
◆ nctabbed_rotate()
void nctabbed_rotate |
( |
nctabbed * |
nt, |
|
|
int |
amt |
|
) |
| |
Definition at line 356 of file tabbed.c.
356 {
357 if(amt > 0){
358 for(int i = 0 ; i < amt ; ++i){
360 }
361 }else{
362 for(int i = 0 ; i < -amt ; ++i){
364 }
365 }
366}
◆ nctabbed_select()
Definition at line 384 of file tabbed.c.
384 {
387 return prevsel;
388}
◆ nctabbed_selected()
◆ nctabbed_separator()
const char * nctabbed_separator |
( |
nctabbed * |
nt | ) |
|
◆ nctabbed_separator_width()
int nctabbed_separator_width |
( |
nctabbed * |
nt | ) |
|
◆ nctabbed_set_hdrchan()
void nctabbed_set_hdrchan |
( |
nctabbed * |
nt, |
|
|
uint64_t |
chan |
|
) |
| |
◆ nctabbed_set_selchan()
void nctabbed_set_selchan |
( |
nctabbed * |
nt, |
|
|
uint64_t |
chan |
|
) |
| |
◆ nctabbed_set_separator()
int nctabbed_set_separator |
( |
nctabbed * |
nt, |
|
|
const char * |
separator |
|
) |
| |
Definition at line 477 of file tabbed.c.
477 {
478 int newsepcols;
481 logerror(
"New tab separator contains illegal characters");
482 return -1;
483 }
485 logerror(
"Couldn't allocate new tab separator");
487 return -1;
488 }
489 free(prevsep);
491 return 0;
492}
◆ nctabbed_set_sepchan()
void nctabbed_set_sepchan |
( |
nctabbed * |
nt, |
|
|
uint64_t |
chan |
|
) |
| |
◆ nctabbed_tabcount()