2009-02-05 21:28:18 +03:00
|
|
|
|
|
|
|
/** \file tty.h
|
2009-02-06 17:46:15 +03:00
|
|
|
* \brief Header: %interface to the terminal controlling library
|
|
|
|
*
|
|
|
|
* This file is the %interface to the terminal controlling library:
|
2009-05-10 19:01:15 +04:00
|
|
|
* slang or ncurses. It provides an additional layer of abstraction
|
|
|
|
* above the "real" libraries to keep the number of ifdefs in the other
|
|
|
|
* files small.
|
2009-02-05 21:28:18 +03:00
|
|
|
*/
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#ifndef MC__TTY_H
|
|
|
|
#define MC__TTY_H
|
2001-09-03 07:07:46 +04:00
|
|
|
|
2010-04-06 11:16:11 +04:00
|
|
|
#include "lib/global.h" /* include <glib.h> */
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_SLANG
|
2010-11-08 13:21:45 +03:00
|
|
|
#include "tty-slang.h"
|
2009-05-10 19:01:15 +04:00
|
|
|
#else
|
2010-11-08 13:21:45 +03:00
|
|
|
#include "tty-ncurses.h"
|
2008-12-29 03:01:53 +03:00
|
|
|
#endif
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
|
|
|
#define KEY_KP_ADD 4001
|
|
|
|
#define KEY_KP_SUBTRACT 4002
|
|
|
|
#define KEY_KP_MULTIPLY 4003
|
|
|
|
|
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* single lines */
|
|
|
|
MC_TTY_FRM_VERT,
|
|
|
|
MC_TTY_FRM_HORIZ,
|
|
|
|
MC_TTY_FRM_LEFTTOP,
|
|
|
|
MC_TTY_FRM_RIGHTTOP,
|
|
|
|
MC_TTY_FRM_LEFTBOTTOM,
|
|
|
|
MC_TTY_FRM_RIGHTBOTTOM,
|
|
|
|
MC_TTY_FRM_TOPMIDDLE,
|
|
|
|
MC_TTY_FRM_BOTTOMMIDDLE,
|
|
|
|
MC_TTY_FRM_LEFTMIDDLE,
|
|
|
|
MC_TTY_FRM_RIGHTMIDDLE,
|
|
|
|
MC_TTY_FRM_CROSS,
|
|
|
|
|
|
|
|
/* double lines */
|
|
|
|
MC_TTY_FRM_DVERT,
|
|
|
|
MC_TTY_FRM_DHORIZ,
|
|
|
|
MC_TTY_FRM_DLEFTTOP,
|
|
|
|
MC_TTY_FRM_DRIGHTTOP,
|
|
|
|
MC_TTY_FRM_DLEFTBOTTOM,
|
|
|
|
MC_TTY_FRM_DRIGHTBOTTOM,
|
|
|
|
MC_TTY_FRM_DTOPMIDDLE,
|
|
|
|
MC_TTY_FRM_DBOTTOMMIDDLE,
|
|
|
|
MC_TTY_FRM_DLEFTMIDDLE,
|
|
|
|
MC_TTY_FRM_DRIGHTMIDDLE,
|
|
|
|
|
|
|
|
MC_TTY_FRM_MAX
|
|
|
|
} mc_tty_frm_t;
|
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
|
|
|
extern int mc_tty_frm[];
|
|
|
|
|
|
|
|
extern char *tty_tgetstr (const char *name);
|
|
|
|
|
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
2011-01-11 17:10:27 +03:00
|
|
|
extern void tty_beep (void);
|
2010-11-08 13:21:45 +03:00
|
|
|
|
2005-09-01 21:06:38 +04:00
|
|
|
/* {{{ Input }}} */
|
|
|
|
|
2011-09-01 11:09:55 +04:00
|
|
|
extern gboolean tty_check_term (gboolean force_xterm);
|
2011-09-06 19:24:18 +04:00
|
|
|
extern void tty_init (gboolean mouse_enable, gboolean is_xterm);
|
2009-06-08 15:59:04 +04:00
|
|
|
extern void tty_shutdown (void);
|
|
|
|
|
2009-09-17 02:07:04 +04:00
|
|
|
extern void tty_start_interrupt_key (void);
|
|
|
|
extern void tty_enable_interrupt_key (void);
|
|
|
|
extern void tty_disable_interrupt_key (void);
|
|
|
|
extern gboolean tty_got_interrupt (void);
|
2005-08-29 12:45:28 +04:00
|
|
|
|
2019-08-17 17:55:50 +03:00
|
|
|
extern gboolean tty_got_winch (void);
|
2019-09-21 20:44:51 +03:00
|
|
|
extern void tty_flush_winch (void);
|
2019-08-17 17:55:50 +03:00
|
|
|
|
2009-05-31 16:23:10 +04:00
|
|
|
extern void tty_reset_prog_mode (void);
|
|
|
|
extern void tty_reset_shell_mode (void);
|
|
|
|
|
2009-05-19 20:12:29 +04:00
|
|
|
extern void tty_raw_mode (void);
|
|
|
|
extern void tty_noraw_mode (void);
|
2009-05-13 17:05:55 +04:00
|
|
|
|
2009-06-02 21:40:37 +04:00
|
|
|
extern void tty_noecho (void);
|
|
|
|
extern int tty_flush_input (void);
|
|
|
|
|
2009-05-31 16:23:10 +04:00
|
|
|
extern void tty_keypad (gboolean set);
|
|
|
|
extern void tty_nodelay (gboolean set);
|
2009-06-02 08:55:07 +04:00
|
|
|
extern int tty_baudrate (void);
|
2009-05-31 16:23:10 +04:00
|
|
|
|
2005-09-01 21:06:38 +04:00
|
|
|
/* {{{ Output }}} */
|
2005-09-01 21:04:05 +04:00
|
|
|
|
|
|
|
/*
|
2010-04-06 11:16:11 +04:00
|
|
|
The output functions do not check themselves for screen overflows,
|
|
|
|
so make sure that you never write more than what fits on the screen.
|
|
|
|
While SLang provides such a feature, ncurses does not.
|
2005-09-01 21:04:05 +04:00
|
|
|
*/
|
|
|
|
|
2009-06-02 21:40:37 +04:00
|
|
|
extern int tty_reset_screen (void);
|
2009-06-02 08:55:07 +04:00
|
|
|
extern void tty_touch_screen (void);
|
|
|
|
|
2009-09-17 02:07:04 +04:00
|
|
|
extern void tty_gotoyx (int y, int x);
|
|
|
|
extern void tty_getyx (int *py, int *px);
|
2006-02-03 06:55:37 +03:00
|
|
|
|
2009-06-02 08:55:07 +04:00
|
|
|
extern void tty_set_alt_charset (gboolean alt_charset);
|
|
|
|
|
2009-06-08 13:49:46 +04:00
|
|
|
extern void tty_display_8bit (gboolean what);
|
2009-09-17 02:07:04 +04:00
|
|
|
extern void tty_print_char (int c);
|
2010-03-17 22:19:03 +03:00
|
|
|
extern void tty_print_alt_char (int c, gboolean single);
|
2009-09-17 02:07:04 +04:00
|
|
|
extern void tty_print_anychar (int c);
|
|
|
|
extern void tty_print_string (const char *s);
|
2015-08-25 15:28:01 +03:00
|
|
|
/* *INDENT-OFF* */
|
|
|
|
extern void tty_printf (const char *s, ...) G_GNUC_PRINTF (1, 2);
|
|
|
|
/* *INDENT-ON* */
|
2009-05-13 17:05:55 +04:00
|
|
|
|
2010-03-21 11:58:45 +03:00
|
|
|
extern void tty_print_one_vline (gboolean single);
|
|
|
|
extern void tty_print_one_hline (gboolean single);
|
2009-06-03 23:07:06 +04:00
|
|
|
extern void tty_draw_hline (int y, int x, int ch, int len);
|
|
|
|
extern void tty_draw_vline (int y, int x, int ch, int len);
|
2010-03-22 21:55:10 +03:00
|
|
|
extern void tty_draw_box (int y, int x, int rows, int cols, gboolean single);
|
2020-07-19 19:47:15 +03:00
|
|
|
extern void tty_draw_box_shadow (int y, int x, int rows, int cols, int shadow_color);
|
2009-05-26 18:56:42 +04:00
|
|
|
extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
|
2009-05-13 17:05:55 +04:00
|
|
|
|
2011-02-18 14:30:15 +03:00
|
|
|
extern int tty_resize (int fd);
|
2009-08-06 13:17:01 +04:00
|
|
|
extern void tty_refresh (void);
|
2011-09-01 11:21:47 +04:00
|
|
|
extern void tty_change_screen_size (void);
|
2001-06-15 04:24:14 +04:00
|
|
|
|
2020-10-31 14:26:10 +03:00
|
|
|
/* Clear screen */
|
|
|
|
extern void tty_clear_screen (void);
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
extern int mc_tty_normalize_lines_char (const char *str);
|
2009-09-14 17:43:03 +04:00
|
|
|
|
2016-05-03 13:08:01 +03:00
|
|
|
extern void tty_enter_ca_mode (void);
|
|
|
|
extern void tty_exit_ca_mode (void);
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** inline functions ****************************************************************************/
|
2021-05-16 13:56:44 +03:00
|
|
|
|
|
|
|
#endif /* MC__TTY_H */
|