New functions.

tty_touch_screen() is used instead of touchwin() function or macro.
tty_set_normal_attrs() is used instead of standend() function or macro.
tty_set_alt_charset() is used instead of acs() and noacs()
functions or macros.
tty_baudrate() is used instead of baudrate() function or macro.
This commit is contained in:
Andrew Borodin 2009-06-02 08:55:07 +04:00
parent 22ce788f9b
commit 86f77f3cb2
18 changed files with 70 additions and 31 deletions

View File

@ -133,7 +133,7 @@ void edit_refresh_cmd (WEdit * edit)
int color;
edit_get_syntax_color (edit, -1, &color);
}
touchwin(stdscr);
tty_touch_screen ();
#endif /* !HAVE_SLANG */
tty_refresh ();
doupdate();

View File

@ -846,7 +846,7 @@ history_cmd (void)
void swap_cmd (void)
{
swap_panels ();
touchwin (stdscr);
tty_touch_screen ();
repaint_screen ();
}

View File

@ -367,7 +367,7 @@ void
show_console_contents (int starty, unsigned char begin_line,
unsigned char end_line)
{
standend ();
tty_set_normal_attrs ();
if (look_for_rxvt_extensions ()) {
show_rxvt_contents (starty, begin_line, end_line);

View File

@ -571,7 +571,7 @@ dialog_handle_key (Dlg_head *h, int d_key)
clr_scr ();
do_refresh ();
#else
touchwin (stdscr);
tty_touch_screen ();
#endif /* HAVE_SLANG */
tty_refresh ();
doupdate ();

View File

@ -55,7 +55,7 @@ static struct my_statfs myfs_stats;
static void info_box (Dlg_head *h, struct WInfo *info)
{
standend ();
tty_set_normal_attrs ();
tty_setcolor (NORMAL_COLOR);
widget_erase (&info->widget);
draw_double_box (h, info->widget.y, info->widget.x,

View File

@ -569,7 +569,7 @@ static void check_split (void)
void
clr_scr (void)
{
standend ();
tty_set_normal_attrs ();
dlg_erase (midnight_dlg);
tty_refresh ();
doupdate ();
@ -747,7 +747,7 @@ change_screen_size (void)
/* Now, force the redraw */
do_refresh ();
touchwin (stdscr);
tty_touch_screen ();
#endif /* TIOCGWINSZ */
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
}

View File

@ -1438,9 +1438,8 @@ setup_mc (void)
setup_sigwinch ();
if (baudrate () < 9600 || slow_terminal) {
verbose = 0;
}
verbose = !((tty_baudrate () < 9600) || slow_terminal);
init_mouse ();
}

View File

@ -116,7 +116,7 @@ static void
set_colors (WPanel *panel)
{
(void) panel;
standend ();
tty_set_normal_attrs ();
tty_setcolor (NORMAL_COLOR);
}
@ -682,7 +682,7 @@ paint_dir (WPanel *panel)
}
repaint_file (panel, i+panel->top_file, 1, color, 0);
}
standend ();
tty_set_normal_attrs ();
}
static void
@ -736,7 +736,7 @@ mini_info_separator (WPanel *panel)
{
const int y = llines (panel) + 2;
standend ();
tty_set_normal_attrs (); /* FIXME: unneeded? */
widget_move (&panel->widget, y, 1);
tty_setcolor (NORMAL_COLOR);
#ifdef HAVE_SLANG
@ -845,7 +845,7 @@ show_dir (WPanel *panel)
show_free_space (panel);
if (panel->active)
standend ();
tty_set_normal_attrs ();
}
/* To be used only by long_frame and full_frame to adjust top_file */

View File

@ -282,7 +282,7 @@ static void show_tree (WTree *tree)
} else{
/* Sub level directory */
acs ();
tty_set_alt_charset (TRUE);
/* Output branch parts */
for (j = 0; j < current->sublevel - topsublevel - 1; j++){
if (tree_cols - 8 - 3 * j < 9)
@ -300,7 +300,7 @@ static void show_tree (WTree *tree)
else
tty_print_char (ACS_LTEE);
tty_print_char (ACS_HLINE);
noacs ();
tty_set_alt_charset (FALSE);
if (tree->active && current == tree->selected_ptr) {
/* Selected directory -> change color */

View File

@ -140,3 +140,9 @@ tty_lowlevel_setcolor (int color)
{
attrset (MY_COLOR_PAIR (color));
}
void
tty_set_normal_attrs (void)
{
standend ();
}

View File

@ -188,3 +188,9 @@ tty_lowlevel_setcolor (int color)
{
SLsmg_set_color (color & 0x7F);
}
void
tty_set_normal_attrs (void)
{
SLsmg_normal_video ();
}

View File

@ -86,5 +86,6 @@ void tty_disable_colors (gboolean disable, gboolean force);
int tty_try_alloc_color_pair (const char *fg, const char *bg);
void tty_setcolor (int color);
void tty_lowlevel_setcolor (int color);
void tty_set_normal_attrs (void);
#endif /* MC_COLOR_H */

View File

@ -1411,7 +1411,7 @@ get_event (struct Gpm_Event *event, int redo_event, int block)
#ifndef HAVE_SLANG
if (flag)
touchwin (stdscr);
tty_touch_screen ();
#endif /* !HAVE_SLANG */
if (c == MCKEY_MOUSE

View File

@ -128,6 +128,18 @@ tty_nodelay (gboolean set)
nodelay (stdscr, (bool) set);
}
int
tty_baudrate (void)
{
return baudrate();
}
void
tty_touch_screen (void)
{
touchwin (stdscr);
}
void
tty_gotoyx (int y, int x)
{
@ -173,6 +185,12 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
move (y, x);
}
void
tty_set_alt_charset (gboolean alt_charset)
{
(void) alt_charset;
}
void
tty_print_char (int c)
{

View File

@ -20,7 +20,4 @@
void init_curses (void);
#define acs()
#define noacs()
#endif /* MC_TTY_NCURSES_H */

View File

@ -314,6 +314,12 @@ tty_nodelay (gboolean set)
no_slang_delay = set;
}
int
tty_baudrate (void)
{
return SLang_TT_Baud_Rate;
}
void
slang_shutdown (void)
{
@ -406,6 +412,12 @@ getch (void)
return c;
}
void
tty_touch_screen (void)
{
SLsmg_touch_lines (0, LINES);
}
void
tty_gotoyx (int y, int x)
{
@ -431,6 +443,12 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
SLsmg_fill_region (y, x, rows, cols, ch);
}
void
tty_set_alt_charset (gboolean alt_charset)
{
SLsmg_set_char_set ((int) alt_charset);
}
void
tty_print_char (int c)
{

View File

@ -26,20 +26,10 @@ enum {
#define ACS_URCORNER SLSMG_URCORN_CHAR
#define ACS_LRCORNER SLSMG_LRCORN_CHAR
#define acs() SLsmg_set_char_set (1)
#define noacs() SLsmg_set_char_set (0)
#define baudrate() SLang_TT_Baud_Rate
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif
#define doupdate()
#define noecho()
#define ungetch(x) SLang_ungetkey (x)
#define touchwin(x) SLsmg_touch_lines (0, LINES)
#define flushinp()
void init_slang (void);
@ -52,7 +42,6 @@ void slang_shutdown (void);
#define printw SLsmg_printf
#define COLS SLtt_Screen_Cols
#define LINES SLtt_Screen_Rows
#define standend() SLsmg_normal_video ()
#define endwin() SLsmg_reset_smg ()
#define SLsmg_draw_double_box(r, c, dr, dc) SLsmg_draw_box ((r), (c), (dr), (dc))

View File

@ -34,6 +34,7 @@ extern void tty_noraw_mode (void);
extern void tty_keypad (gboolean set);
extern void tty_nodelay (gboolean set);
extern int tty_baudrate (void);
/* {{{ Output }}} */
@ -43,9 +44,13 @@ extern void tty_nodelay (gboolean set);
While SLang provides such a feature, ncurses does not.
*/
extern void tty_touch_screen (void);
extern void tty_gotoyx(int y, int x);
extern void tty_getyx(int *py, int *px);
extern void tty_set_alt_charset (gboolean alt_charset);
extern void tty_print_char(int c);
extern void tty_print_alt_char(int c);
extern void tty_print_string(const char *s);