Warn if two .exes conflict with each other and the second does not
[wine/multimedia.git] / console / interface.c
blob0e20550c7ddc06b6bfe4ff7c2d607fe046448408
1 /* interface.c */
3 /* The primary purpose of this function is to provide CONSOLE_*
4 reotines that immediately call the appropiate driver handler.
5 This cleans up code in the individual modules considerably.
6 This could be done using a macro, but additional functionality
7 may be provided here in the future. */
9 #include <stdio.h>
11 #include "windows.h"
12 #include "console.h"
13 #include "config.h"
15 /* I did this without realizing that CONSOLE_* was actually used by
16 the Win32 console driver. I will definately have to rename these
17 functions to avoid the name clash... */
19 void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute)
21 if (driver.write)
23 driver.write(out, fg_color, bg_color, attribute);
24 if (!driver.norefresh)
25 CONSOLE_Refresh();
29 void CONSOLE_Init()
31 /* Suitable defaults... */
32 driver.console_out = stdout;
33 driver.console_in = stdin;
34 /* Eventually, this will be a command-line choice */
35 #ifndef WINE_NCURSES
36 TTY_Start();
37 #else
38 NCURSES_Start();
39 #endif
40 GENERIC_Start();
42 /*XTERM_Start();*/
44 if (driver.init)
45 driver.init();
48 void CONSOLE_Close()
50 if (driver.close)
51 driver.close();
54 void CONSOLE_MoveCursor(char row, char col)
56 if (driver.moveCursor)
58 driver.moveCursor(row, col);
59 if (!driver.norefresh)
60 CONSOLE_Refresh();
64 void CONSOLE_ClearWindow(char row1, char col1, char row2, char col2,
65 int bg_color, int attribute)
67 if (driver.clearWindow)
69 driver.clearWindow(row1, col1, row2, col2, bg_color, attribute);
70 if (!driver.norefresh)
71 CONSOLE_Refresh();
75 void CONSOLE_ScrollUpWindow(char row1, char col1, char row2, char col2,
76 char lines, int bg_color, int attribute)
78 if (driver.scrollUpWindow)
80 driver.scrollUpWindow(row1, col1, row2, col2, lines, bg_color,
81 attribute);
82 if (!driver.norefresh)
83 CONSOLE_Refresh();
87 void CONSOLE_ScrollDownWindow(char row1, char col1, char row2, char col2,
88 char lines, int bg_color, int attribute)
90 if (driver.scrollDownWindow)
92 driver.scrollDownWindow(row1, col1, row2, col2, lines, bg_color,
93 attribute);
94 if (!driver.norefresh)
95 CONSOLE_Refresh();
99 int CONSOLE_CheckForKeystroke(char *scan, char *ascii)
100 /* These functions need to go through a conversion layer. Scancodes
101 should *not* be determined by the driver, rather they should have
102 a conv_* function in int16.c. Yuck. */
104 if (driver.checkForKeystroke)
105 return driver.checkForKeystroke(scan, ascii);
106 else
107 return FALSE;
110 void CONSOLE_GetKeystroke(char *scan, char *ascii)
112 if (driver.getKeystroke)
113 return driver.getKeystroke(scan, ascii);
116 void CONSOLE_GetCursorPosition(char *row, char *col)
118 if (driver.getCursorPosition)
119 return driver.getCursorPosition(row, col);
122 void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a)
124 if (driver.getCharacterAtCursor)
125 return driver.getCharacterAtCursor(ch, fg, bg, a);
128 void CONSOLE_Refresh()
130 if (driver.refresh)
131 return driver.refresh();
134 /* This function is only at the CONSOLE level. */
135 /* Admittably, calling the variable norefresh might be a bit dumb...*/
136 void CONSOLE_SetRefresh(int setting)
138 if (setting)
139 driver.norefresh = FALSE;
140 else
141 driver.norefresh = TRUE;
144 /* This function is only at the CONSOLE level. */
145 int CONSOLE_GetRefresh()
147 if (driver.norefresh)
148 return FALSE;
149 else
150 return TRUE;
153 void CONSOLE_ClearScreen()
155 if (driver.clearScreen)
156 return driver.clearScreen();
159 char CONSOLE_GetCharacter()
161 /* I'm not sure if we need this really. This is a function that can be
162 accelerated that returns the next *non extended* keystroke */
163 if (driver.getCharacter)
164 return driver.getCharacter();
165 else
166 return (char) 0; /* Sure, this will probably break programs... */