- Rearrange reactos.dff according to rosapps rearrange.
[reactos.git] / rosapps / mc / src / text.c
1 /*
2 * Text edition support code
3 *
4 *
5 */
6 #include <config.h>
7
8 #ifdef HAVE_X
9 #error This file is for text-mode editions only.
10 #endif
11
12 #include <stdio.h>
13
14 #define WANT_WIDGETS
15 #include "win.h"
16 #include "tty.h"
17 #include "key.h"
18 #include "widget.h"
19 #include "main.h"
20 #include "cons.saver.h"
21
22 char *default_edition_colors =
23 "normal=lightgray,blue:"
24 "selected=black,cyan:"
25 "marked=yellow,blue:"
26 "markselect=yellow,cyan:"
27 "errors=white,red:"
28 "menu=white,cyan:"
29 "reverse=black,lightgray:"
30 "dnormal=black,lightgray:"
31 "dfocus=black,cyan:"
32 "dhotnormal=yellow,lightgray:"
33 "dhotfocus=yellow,cyan:"
34 "viewunderline=brightred,blue:"
35 "menuhot=yellow,cyan:"
36 "menusel=white,black:"
37 "menuhotsel=yellow,black:"
38 "helpnormal=black,lightgray:"
39 "helpitalic=red,lightgray:"
40 "helpbold=blue,lightgray:"
41 "helplink=black,cyan:"
42 "helpslink=yellow,blue:"
43 "gauge=white,black:"
44 "input=black,cyan:"
45 "directory=white,blue:"
46 "execute=brightgreen,blue:"
47 "link=lightgray,blue:"
48 "device=brightmagenta,blue:"
49 "core=red,blue:"
50 "special=black,blue";
51
52 void
53 edition_post_exec (void)
54 {
55 do_enter_ca_mode ();
56
57 /* FIXME: Missing on slang endwin? */
58 reset_prog_mode ();
59 flushinp ();
60
61 keypad (stdscr, TRUE);
62 mc_raw_mode ();
63 channels_up ();
64 if (use_mouse_p)
65 init_mouse ();
66 if (alternate_plus_minus)
67 application_keypad_mode ();
68 }
69
70 void
71 edition_pre_exec (void)
72 {
73 if (clear_before_exec)
74 clr_scr ();
75 else {
76 if (!(console_flag || xterm_flag))
77 printf ("\n\n");
78 }
79
80 channels_down ();
81 if (use_mouse_p)
82 shut_mouse ();
83
84 reset_shell_mode ();
85 keypad (stdscr, FALSE);
86 endwin ();
87
88 numeric_keypad_mode ();
89
90 /* on xterms: maybe endwin did not leave the terminal on the shell
91 * screen page: do it now.
92 *
93 * Do not move this before endwin: in some systems rmcup includes
94 * a call to clear screen, so it will end up clearing the sheel screen.
95 */
96 if (!status_using_ncurses){
97 do_exit_ca_mode ();
98 }
99 }
100
101 void
102 clr_scr (void)
103 {
104 standend ();
105 dlg_erase (midnight_dlg);
106 mc_refresh ();
107 doupdate ();
108 }
109