version 1.201, 2021/10/14 13:19:01 |
version 1.202, 2021/10/20 09:50:40 |
|
|
memcpy(&default_gc, &grid_default_cell, sizeof default_gc); |
memcpy(&default_gc, &grid_default_cell, sizeof default_gc); |
|
|
screen_write_box(ctx, menu->width + 4, menu->count + 2, |
screen_write_box(ctx, menu->width + 4, menu->count + 2, |
BOX_LINES_DEFAULT, NULL); |
BOX_LINES_DEFAULT, &default_gc, menu->title); |
screen_write_cursormove(ctx, cx + 2, cy, 0); |
|
format_draw(ctx, &default_gc, menu->width, menu->title, NULL); |
|
|
|
for (i = 0; i < menu->count; i++) { |
for (i = 0; i < menu->count; i++) { |
name = menu->items[i].name; |
name = menu->items[i].name; |
|
|
/* Draw a box on screen. */ |
/* Draw a box on screen. */ |
void |
void |
screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny, |
screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny, |
enum box_lines l, const struct grid_cell *gcp) |
enum box_lines lines, const struct grid_cell *gcp, const char *title) |
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
struct grid_cell gc; |
struct grid_cell gc; |
|
|
memcpy(&gc, gcp, sizeof gc); |
memcpy(&gc, gcp, sizeof gc); |
else |
else |
memcpy(&gc, &grid_default_cell, sizeof gc); |
memcpy(&gc, &grid_default_cell, sizeof gc); |
|
|
gc.attr |= GRID_ATTR_CHARSET; |
gc.attr |= GRID_ATTR_CHARSET; |
gc.flags |= GRID_FLAG_NOPALETTE; |
gc.flags |= GRID_FLAG_NOPALETTE; |
|
|
/* Draw top border */ |
/* Draw top border */ |
screen_write_box_border_set(l, CELL_TOPLEFT, &gc); |
screen_write_box_border_set(lines, CELL_TOPLEFT, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_box_border_set(l, CELL_LEFTRIGHT, &gc); |
screen_write_box_border_set(lines, CELL_LEFTRIGHT, &gc); |
for (i = 1; i < nx - 1; i++) |
for (i = 1; i < nx - 1; i++) |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_box_border_set(l, CELL_TOPRIGHT, &gc); |
screen_write_box_border_set(lines, CELL_TOPRIGHT, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
|
|
/* Draw bottom border */ |
/* Draw bottom border */ |
screen_write_set_cursor(ctx, cx, cy + ny - 1); |
screen_write_set_cursor(ctx, cx, cy + ny - 1); |
screen_write_box_border_set(l, CELL_BOTTOMLEFT, &gc); |
screen_write_box_border_set(lines, CELL_BOTTOMLEFT, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_box_border_set(l, CELL_LEFTRIGHT, &gc); |
screen_write_box_border_set(lines, CELL_LEFTRIGHT, &gc); |
for (i = 1; i < nx - 1; i++) |
for (i = 1; i < nx - 1; i++) |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_box_border_set(l, CELL_BOTTOMRIGHT, &gc); |
screen_write_box_border_set(lines, CELL_BOTTOMRIGHT, &gc); |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
|
|
/* Draw sides */ |
/* Draw sides */ |
screen_write_box_border_set(l, CELL_TOPBOTTOM, &gc); |
screen_write_box_border_set(lines, CELL_TOPBOTTOM, &gc); |
for (i = 1; i < ny - 1; i++) { |
for (i = 1; i < ny - 1; i++) { |
/* left side */ |
/* left side */ |
screen_write_set_cursor(ctx, cx, cy + i); |
screen_write_set_cursor(ctx, cx, cy + i); |
|
|
/* right side */ |
/* right side */ |
screen_write_set_cursor(ctx, cx + nx - 1, cy + i); |
screen_write_set_cursor(ctx, cx + nx - 1, cy + i); |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
|
} |
|
|
|
if (title != NULL) { |
|
gc.attr &= ~GRID_ATTR_CHARSET; |
|
screen_write_cursormove(ctx, cx + 2, cy, 0); |
|
format_draw(ctx, &gc, nx - 4, title, NULL); |
} |
} |
|
|
screen_write_set_cursor(ctx, cx, cy); |
screen_write_set_cursor(ctx, cx, cy); |