3 * - By John Hodge (thePowersGang)
6 * - Virtual Terminal - Common
12 #include <api_drv_video.h> // tVT_Char
13 #include <api_drv_terminal.h>
18 #define MAX_INPUT_CHARS32 64
19 #define MAX_INPUT_CHARS8 (MAX_INPUT_CHARS32*4)
20 #define DEFAULT_COLOUR (VT_COL_BLACK|(0xAAA<<16))
25 #define VT_FLAG_HIDECSR 0x01 //!< Hide the cursor
26 #define VT_FLAG_ALTBUF 0x02 //!< Alternate screen buffer
27 #define VT_FLAG_RAWIN 0x04 //!< Don't handle ^Z/^C/^V
28 #define VT_FLAG_HASFB 0x10 //!< Set if the VTerm has requested the Framebuffer
29 #define VT_FLAG_SHOWCSR 0x20 //!< Always show the text cursor
35 VT_INMODE_TEXT8, // UTF-8 Text Mode (VT100/xterm Emulation)
36 VT_INMODE_TEXT32, // UTF-32 Text Mode (Acess Native)
42 typedef struct sVTerm tVTerm;
47 int Mode; //!< Current Mode (see ::eTplTerminal_Modes)
48 int Flags; //!< Flags (see VT_FLAG_*)
50 short Width; //!< Virtual Width
51 short Height; //!< Virtual Height
52 short TextWidth; //!< Text Virtual Width
53 short TextHeight; //!< Text Virtual Height
55 Uint32 CurColour; //!< Current Text Colour
57 int ViewPos; //!< View Buffer Offset (Text Only)
58 int WritePos; //!< Write Buffer Offset (Text Only)
61 tVT_Char *AltBuf; //!< Alternate Screen Buffer
62 int AltWritePos; //!< Alternate write position
63 short ScrollTop; //!< Top of scrolling region (smallest)
64 short ScrollHeight; //!< Length of scrolling region
66 char EscapeCodeCache[16];
72 Uint32 RawScancode; //!< last raw scancode recieved
76 // TODO: Do I need to keep this about?
77 // When should it be deallocated? on move to text mode, or some other time
78 // Call set again, it's freed, and if NULL it doesn't get reallocated.
79 tVideo_IOCtl_Bitmap *VideoCursor;
85 extern tVTerm *gpVT_CurTerm;
86 extern int giVT_Scrollback;
87 extern short giVT_RealWidth; //!< Screen Width
88 extern short giVT_RealHeight; //!< Screen Width
89 extern char *gsVT_OutputDevice;
90 extern char *gsVT_InputDevice;
91 extern int giVT_OutputDevHandle;
92 extern int giVT_InputDevHandle;
95 extern void VT_SetResolution(int Width, int Height);
96 extern void VT_SetTerminal(int ID);
98 extern void VT_InitOutput(void);
99 extern void VT_SetMode(int Mode);
100 extern void VT_int_ScrollFramebuffer( tVTerm *Term, int Count );
101 extern void VT_int_UpdateCursor( tVTerm *Term, int bShow );
102 extern void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll );
104 extern void VT_InitInput(void);
105 extern void VT_KBCallBack(Uint32 Codepoint);
106 // --- VT100 Emulation ---
107 extern void VT_int_ParseEscape_StandardLarge(tVTerm *Term, char CmdChar, int argc, int *args);
108 extern int VT_int_ParseEscape(tVTerm *Term, const char *Buffer, size_t Bytes);
109 // --- Terminal Buffer ---
110 extern void VT_int_PutString(tVTerm *Term, const Uint8 *Buffer, Uint Count);
111 extern void VT_int_PutChar(tVTerm *Term, Uint32 Ch);
112 extern void VT_int_ScrollText(tVTerm *Term, int Count);
113 extern void VT_int_ClearLine(tVTerm *Term, int Num);
114 extern void VT_int_Resize(tVTerm *Term, int NewWidth, int NewHeight);
115 extern void VT_int_ToggleAltBuffer(tVTerm *Term, int Enabled);