The tty_draw_box() function has been created and used.
Этот коммит содержится в:
родитель
ebbf6fbcdc
Коммит
62cdac4d1f
36
src/dialog.c
36
src/dialog.c
@ -43,8 +43,6 @@
|
||||
#include "strutil.h"
|
||||
#include "setup.h" /* mouse_close_dialog */
|
||||
|
||||
#define waddc(w, y1, x1, c) tty_gotoyx (w->y + y1, w->x + x1); addch (c)
|
||||
|
||||
/* Primitive way to check if the the current dialog is our dialog */
|
||||
/* This is needed by async routines like load_prompt */
|
||||
Dlg_head *current_dlg = 0;
|
||||
@ -58,7 +56,8 @@ int mouse_close_dialog = 0;
|
||||
static void dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t message,
|
||||
int reverse, int flags);
|
||||
|
||||
static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
static void
|
||||
slow_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
{
|
||||
tty_gotoyx (h->y + y, h->x + x);
|
||||
hline (' ', xs);
|
||||
@ -70,38 +69,23 @@ static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
}
|
||||
|
||||
/* draw box in window */
|
||||
void draw_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
void
|
||||
draw_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
{
|
||||
if (slow_terminal){
|
||||
if (slow_terminal)
|
||||
slow_box (h, y, x, ys, xs);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SLANG
|
||||
waddc (h, y, x, ACS_ULCORNER);
|
||||
hline (ACS_HLINE, xs - 2);
|
||||
waddc (h, y + ys - 1, x, ACS_LLCORNER);
|
||||
hline (ACS_HLINE, xs - 2);
|
||||
|
||||
waddc (h, y, x + xs - 1, ACS_URCORNER);
|
||||
waddc (h, y + ys - 1, x + xs - 1, ACS_LRCORNER);
|
||||
|
||||
tty_gotoyx (h->y + y + 1, h->x + x);
|
||||
vline (ACS_VLINE, ys - 2);
|
||||
tty_gotoyx (h->y + y + 1, h->x + x + xs - 1);
|
||||
vline (ACS_VLINE, ys - 2);
|
||||
#else
|
||||
SLsmg_draw_box (h->y + y, h->x + x, ys, xs);
|
||||
#endif /* HAVE_SLANG */
|
||||
else
|
||||
tty_draw_box (h->y + y, h->x + x, ys, xs);
|
||||
}
|
||||
|
||||
/* draw box in window */
|
||||
void draw_double_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
void
|
||||
draw_double_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
{
|
||||
#ifndef HAVE_SLANG
|
||||
draw_box (h, y, x, ys, xs);
|
||||
#else
|
||||
SLsmg_draw_double_box (h->y+y, h->x+x, ys, xs);
|
||||
SLsmg_draw_double_box (h->y + y, h->x + x, ys, xs);
|
||||
#endif /* HAVE_SLANG */
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,26 @@ tty_getyx (int *py, int *px)
|
||||
getyx (stdscr, *py, *px);
|
||||
}
|
||||
|
||||
void
|
||||
tty_draw_box (int y, int x, int rows, int cols)
|
||||
{
|
||||
#define waddc(_y, _x, c) move (_y, _x); addch (c)
|
||||
waddc (y, x, ACS_ULCORNER);
|
||||
hline (ACS_HLINE, cols - 2);
|
||||
waddc (y + rows - 1, x, ACS_LLCORNER);
|
||||
hline (ACS_HLINE, cols - 2);
|
||||
|
||||
waddc (y, x + cols - 1, ACS_URCORNER);
|
||||
waddc (y + rows - 1, x + cols - 1, ACS_LRCORNER);
|
||||
|
||||
move (y + 1, x);
|
||||
vline (ACS_VLINE, rows - 2);
|
||||
|
||||
move (y + 1, x + cols - 1);
|
||||
vline (ACS_VLINE, rows - 2);
|
||||
#undef waddc
|
||||
}
|
||||
|
||||
void
|
||||
tty_print_char (int c)
|
||||
{
|
||||
|
@ -481,6 +481,12 @@ tty_getyx (int *py, int *px)
|
||||
*px = SLsmg_get_column ();
|
||||
}
|
||||
|
||||
void
|
||||
tty_draw_box (int y, int x, int rows, int cols)
|
||||
{
|
||||
SLsmg_draw_box (y, x, rows, cols);
|
||||
}
|
||||
|
||||
void
|
||||
tty_print_char (int c)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ extern void tty_print_one_vline(void);
|
||||
extern void tty_print_one_hline(void);
|
||||
extern void tty_print_vline(int top, int left, int length);
|
||||
extern void tty_print_hline(int top, int left, int length);
|
||||
extern void tty_draw_box (int y, int x, int rows, int cols);
|
||||
extern void tty_printf(const char *s, ...);
|
||||
|
||||
extern char *tty_tgetstr (const char *name);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user