- Start rosapps rearrange and cleanup process.
[reactos.git] / rosapps / applications / mc / src / myslang.h
1 #ifndef __MYSLANG_H
2 #define __MYSLANG_H
3
4 #ifdef SLANG_H_INSIDE_SLANG_DIR
5 # include <slang/slang.h>
6 #else
7 # include "slang.h"
8 #endif
9
10 enum {
11 KEY_BACKSPACE = 400,
12 KEY_END, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT,
13 KEY_HOME, KEY_A1, KEY_C1, KEY_NPAGE, KEY_PPAGE, KEY_IC,
14 KEY_ENTER, KEY_DC, KEY_SCANCEL, KEY_BTAB
15 };
16
17 #define KEY_F(x) 1000+x
18
19 #define ACS_VLINE SLSMG_VLINE_CHAR
20 #define ACS_HLINE SLSMG_HLINE_CHAR
21 #define ACS_ULCORNER SLSMG_ULCORN_CHAR
22 #define ACS_LLCORNER SLSMG_LLCORN_CHAR
23 #define ACS_URCORNER SLSMG_URCORN_CHAR
24 #define ACS_LRCORNER SLSMG_LRCORN_CHAR
25
26 #ifdef OS2_NT
27 # define ACS_LTEE 0xC3
28 # define acs() ;
29 # define noacs() ;
30 # define baudrate() 19200
31 #else
32 # define ACS_LTEE 't'
33 # define acs() SLsmg_set_char_set(1)
34 # define noacs() SLsmg_set_char_set (0)
35 # define baudrate() SLang_TT_Baud_Rate
36 #endif
37
38 enum {
39 COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE,
40 COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
41 };
42
43 /* When using Slang with color, we have all the indexes free but
44 * those defined here (A_BOLD, A_UNDERLINE, A_REVERSE, A_BOLD_REVERSE)
45 */
46 #define A_BOLD 0x40
47 #define A_UNDERLINE 0x40
48 #define A_REVERSE 0x20
49 #define A_BOLD_REVERSE 0x21
50
51 #ifndef A_NORMAL
52 # define A_NORMAL 0x00
53 #endif
54
55 #define COLOR_PAIR(x) x
56 #define ERR -1
57 #define TRUE 1
58 #define FALSE 0
59
60 void slang_set_raw_mode (void);
61
62 #define doupdate()
63 #define raw() slang_set_raw_mode()
64 #define noraw()
65 #define nodelay(x,val) set_slang_delay(val)
66 #define noecho()
67 #define beep() SLtt_beep ()
68 #define keypad(scr,value) slang_keypad (value)
69
70 #define ungetch(x) SLang_ungetkey(x)
71 #define start_color()
72 #define touchwin(x) SLsmg_touch_lines(0, LINES)
73 #define reset_shell_mode slang_shell_mode
74 #define reset_prog_mode slang_prog_mode
75 #define flushinp()
76
77 void slint_goto (int y, int x);
78 void attrset (int color);
79 void set_slang_delay (int);
80 void slang_init (void);
81 void slang_done_screen (void);
82 void slang_prog_mode (void);
83 void hline (int ch, int len);
84 void vline (int ch, int len);
85 int getch (void);
86 void slang_keypad (int set);
87 void slang_shell_mode (void);
88 void slang_shutdown (void);
89 int has_colors (void);
90 /* Internal function prototypes */
91 void load_terminfo_keys ();
92
93 /* FIXME Clean up this; gnome has nothing to do here */
94 #ifndef HAVE_GNOME
95 void init_pair (int, char *, char *);
96 #endif
97
98 /* copied from slcurses.h (MC version 4.0.7) */
99 #define move SLsmg_gotorc
100 #define clreol SLsmg_erase_eol
101 #define printw SLsmg_printf
102 #define mvprintw(x, y, z) SLsmg_gotorc(x, y); SLsmg_printf(z)
103 #define COLS SLtt_Screen_Cols
104 #define LINES SLtt_Screen_Rows
105 #define clrtobot SLsmg_erase_eos
106 #define clrtoeol SLsmg_erase_eol
107 #define standout SLsmg_reverse_video
108 #define standend SLsmg_normal_video
109 #define addch SLsmg_write_char
110 #define addstr SLsmg_write_string
111 #define initscr() do { extern int force_ugly_line_drawing; \
112 extern int SLtt_Has_Alt_Charset; \
113 SLtt_get_terminfo (); \
114 if (force_ugly_line_drawing) \
115 SLtt_Has_Alt_Charset = 0; \
116 SLsmg_init_smg (); \
117 } while(0)
118 #define refresh SLsmg_refresh
119 #define clear SLsmg_cls
120 #define erase SLsmg_cls
121 #define mvaddstr(y, x, s) SLsmg_gotorc(y, x); SLsmg_write_string(s)
122 #define touchline SLsmg_touch_lines
123 #define inch SLsmg_char_at
124 #define endwin SLsmg_reset_smg
125
126 #define SLsmg_draw_double_box(r,c,dr,dc) SLsmg_draw_box ((r), (c), (dr), (dc))
127
128 #ifdef OS2_NT
129 # define one_vline() addch(ACS_VLINE)
130 # define one_hline() addch(ACS_HLINE)
131 /* This is fast, but unusefull if ! pc_system - doesn't use
132 Alt_Char_Pairs [] :( */
133 #else
134 /* This is slow, but works well :| */
135 # define one_vline() SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), slow_terminal ? ' ' : ACS_VLINE)
136 # define one_hline() SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), slow_terminal ? ' ' : ACS_HLINE)
137 #endif
138
139 void enable_interrupt_key ();
140 void disable_interrupt_key ();
141 #endif