TTY: created tty_fill_region() function.

src/tty/tty.h:
src/tty/tty-slang.c:
src/tty/tty-ncurses.c: new tty_fill_region() function.

src/dialog.c (widget_erase, dlg_erase): tty_fill_region() function
is applied to erase area of widget and dialog.
This commit is contained in:
Andrew Borodin 2009-05-26 18:56:42 +04:00
parent f1d526d84d
commit e68c67554b
4 changed files with 28 additions and 19 deletions

View File

@ -34,7 +34,7 @@
#include "../src/tty/tty.h"
#include "../src/tty/color.h"
#include "../src/tty/mouse.h"
#include "../src/tty/key.h" /* mi_getch() */
#include "../src/tty/key.h"
#include "help.h" /* interactive_display() */
#include "dialog.h"
@ -90,28 +90,17 @@ draw_double_box (Dlg_head *h, int y, int x, int ys, int xs)
#endif /* HAVE_SLANG */
}
void widget_erase (Widget *w)
void
widget_erase (Widget *w)
{
int x, y;
for (y = 0; y < w->lines; y++){
widget_move (w, y, 0);
for (x = 0; x < w->cols; x++)
addch (' ');
}
tty_fill_region (w->y, w->x, w->lines, w->cols, ' ');
}
void dlg_erase (Dlg_head *h)
void
dlg_erase (Dlg_head *h)
{
int x, y;
if (h == NULL)
return;
for (y = 0; y < h->lines; y++){
tty_gotoyx (y + h->y, h->x); /* FIXME: should test if ERR */
for (x = 0; x < h->cols; x++){
addch (' ');
}
}
if (h != NULL)
tty_fill_region (h->y, h->x, h->lines, h->cols, ' ');
}
void

View File

@ -136,6 +136,19 @@ tty_draw_box (int y, int x, int rows, int cols)
#undef waddc
}
void
tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
{
int i;
for (i = 0; i < rows; i++) {
move (y + i, x);
hline (ch, cols);
}
move (y, x);
}
void
tty_print_char (int c)
{

View File

@ -426,6 +426,12 @@ tty_draw_box (int y, int x, int rows, int cols)
SLsmg_draw_box (y, x, rows, cols);
}
void
tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
{
SLsmg_fill_region (y, x, rows, cols, ch);
}
void
tty_print_char (int c)
{

View File

@ -52,6 +52,7 @@ 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_fill_region (int y, int x, int rows, int cols, unsigned char ch);
extern char *tty_tgetstr (const char *name);