ReactOS 0.4.15-dev-7924-g5949c20
tconsole.h
Go to the documentation of this file.
1#pragma once
2
3//#include "tnconfig.h"
4
5/* A diagram of the following values:
6 *
7 * (0,0)
8 * +----------------------------------------+
9 * | |
10 * | |
11 * | |
12 * | |
13 * | |
14 * | |
15 * | |
16 * | |
17 * | |
18 * | |
19 * | |
20 * | |
21 * | |
22 * | CON_TOP |
23 * +---------------------------+.....?......| ---
24 * | . | | |
25 * | . | <-- OR --> | |
26 * | . | | |
27 * CON_LEFT | . | CON_RIGHT |
28 * (=0) | . | (=CON_ | CON_LINES
29 * |..............* | WIDTH) |
30 * | (CON_CUR_X, | | |
31 * | CON_CUR_Y) | | |
32 * | | | |
33 * | | | |
34 * | | | |
35 * +---------------------------+------------+ ---
36 * CON_BOTTOM (=CON_TOP + CON_HEIGHT)
37 *
38 * |--------- CON_COLS --------|
39 *
40 * Keep in mind that CON_TOP, CON_BOTTOM, CON_LEFT, and CON_RIGHT are relative
41 * to zero, but CON_CUR_X, CON_CUR_Y, CON_WIDTH, and CON_HEIGHT are relative to
42 * CON_TOP and CON_LEFT
43 */
44
45#define CON_TOP ConsoleInfo.srWindow.Top
46#define CON_BOTTOM ConsoleInfo.srWindow.Bottom
47
48#define CON_LEFT 0
49#define CON_RIGHT (ConsoleInfo.dwSize.X - 1)
50
51#define CON_HEIGHT (CON_BOTTOM - CON_TOP)
52#define CON_WIDTH (CON_RIGHT - CON_LEFT)
53#define CON_LINES (CON_HEIGHT + 1)
54#define CON_COLS (CON_WIDTH + 1)
55
56#define CON_CUR_X (ConsoleInfo.dwCursorPosition.X - CON_LEFT)
57#define CON_CUR_Y (ConsoleInfo.dwCursorPosition.Y - CON_TOP)
58
59
60class TConsole {
61public:
63 ~TConsole();
64 void sync();
65
66 // Cursor movement routines
67 int GetRawCursorX() {return CON_CUR_X;}
68 int GetRawCursorY() {return CON_CUR_Y;}
69 int GetCursorX() {return CON_CUR_X;}
70 int GetCursorY() {
71 if(iScrollStart != -1)
72 return CON_CUR_Y - iScrollStart;
73 return GetRawCursorY();
74 }
75 void SetRawCursorPosition(int x, int y);
76 void SetCursorPosition(int x, int y);
77 void SetCursorSize(int pct);
78 void MoveCursorPosition(int x, int y);
79
80 // Screen mode/size routines
81 int GetWidth() {return CON_COLS;}
82 int GetHeight() {return CON_LINES;}
83 void SetExtendedMode(int iFunction, BOOL bEnable);
84 void SetWindowSize(int width, int height); // Set the size of the window,
85 // but not the buffer
86
87 // Color/attribute routines
88 void SetAttrib(unsigned char wAttr) {wAttributes = wAttr;}
89 unsigned char GetAttrib() {return wAttributes;}
90 void Normal(); // Reset all attributes
91 void HighVideo(); // Aka "bold"
92 void LowVideo();
93 void SetForeground(unsigned char wAttrib); // Set the foreground directly
94 void SetBackground(unsigned char wAttrib);
95 void BlinkOn(); // Blink on/off
96 void BlinkOff();
97 void UnderlineOn(); // Underline on/off
98 void UnderlineOff();
99 void UlBlinkOn(); // Blink+Underline on/off
100 void UlBlinkOff();
101 void ReverseOn(); // Reverse on/off
102 void ReverseOff();
103 void Lightbg(); // High-intensity background
104 void Darkbg(); // Low-intensity background
105 void setDefaultFg(unsigned char u) {defaultfg = u;}
106 void setDefaultBg(unsigned char u) {defaultbg = u;}
107
108 // Text output routines
109 unsigned long WriteText(const char *pszString, unsigned long cbString);
110 unsigned long WriteString(const char* pszString, unsigned long cbString);
111 unsigned long WriteStringFast(const char *pszString, unsigned long cbString);
112 unsigned long WriteCtrlString(const char* pszString, unsigned long cbString);
113 unsigned long WriteCtrlChar(char c);
114 unsigned long NetWriteString(const char* pszString, unsigned long cbString);
115
116 // Clear screen/screen area functions
117 void ClearScreen(char c = ' ');
118 void ClearWindow(int start, int end, char c = ' ');
119 void ClearEOScreen(char c = ' ');
120 void ClearBOScreen(char c = ' ');
121 void ClearLine(char c = ' ');
122 void ClearEOLine(char c = ' ');
123 void ClearBOLine(char c = ' ');
124
125 // Scrolling and text output control functions
126 void SetScroll(int start, int end);
127 void ScrollDown(int iStartRow , int iEndRow, int bUp);
129 void index();
130 void reverse_index();
131 void setLineWrap(bool bEnabled){
133 ini.set_value("Wrap_Line", bEnabled ? "true" : "false");
134 }
135 bool getLineWrap() {return ini.get_wrapline();}
136
137 // Insert/delete characters/lines
138 void InsertLine(int numlines); // Added by Titus von Boxberg 30/3/97
139 void InsertCharacter(int numchar); // "
140 void DeleteCharacter(int numchar); // "
141 void InsertMode(int i) {insert_mode = i;}
142
143 // Miscellaneous functions
144 void Beep();
145
146protected:
148
150
151 unsigned char wAttributes;
152 unsigned char fg, bg;
153 unsigned char defaultfg, defaultbg;
154 unsigned char origfg, origbg;
155
156 bool blink;
159
163};
164
165// Non-member functions for saving state -- used by the scrollback buffer viewer
166void saveScreen(CHAR_INFO* chiBuffer);
167void restoreScreen(CHAR_INFO* chiBuffer);
169void deleteBuffer(CHAR_INFO* chiBuffer);
bool get_lock_linewrap() const
Definition: tnconfig.h:54
bool set_value(const char *var, const char *value)
Definition: tnconfig.cpp:442
bool get_wrapline() const
Definition: tnconfig.h:52
unsigned char defaultbg
Definition: tconsole.h:153
void SetWindowSize(int width, int height)
Definition: tconsole.cpp:93
bool reverse
Definition: tconsole.h:158
void setDefaultFg(unsigned char u)
Definition: tconsole.h:105
void ScrollAll(int bUp)
Definition: tconsole.h:128
int GetWidth()
Definition: tconsole.h:81
int GetRawCursorX()
Definition: tconsole.h:67
void ClearLine(char c=' ')
Definition: tconsole.cpp:732
void Darkbg()
Definition: tconsole.cpp:284
void setLineWrap(bool bEnabled)
Definition: tconsole.h:131
unsigned char bg
Definition: tconsole.h:152
void SetCursorPosition(int x, int y)
Definition: tconsole.cpp:885
unsigned long WriteCtrlChar(char c)
Definition: tconsole.cpp:557
bool getLineWrap()
Definition: tconsole.h:135
void InsertLine(int numlines)
Definition: tconsole.cpp:768
void HighVideo()
Definition: tconsole.cpp:113
void SetExtendedMode(int iFunction, BOOL bEnable)
Definition: tconsole.cpp:911
void InsertCharacter(int numchar)
Definition: tconsole.cpp:800
void index()
Definition: tconsole.cpp:589
void ScrollDown(int iStartRow, int iEndRow, int bUp)
Definition: tconsole.cpp:625
void Normal()
Definition: tconsole.cpp:121
int GetRawCursorY()
Definition: tconsole.h:68
void SetScroll(int start, int end)
Definition: tconsole.cpp:917
unsigned long WriteCtrlString(const char *pszString, unsigned long cbString)
Definition: tconsole.cpp:542
int GetCursorX()
Definition: tconsole.h:69
void LowVideo()
Definition: tconsole.cpp:117
bool blink
Definition: tconsole.h:156
void reverse_index()
Definition: tconsole.cpp:613
unsigned long WriteString(const char *pszString, unsigned long cbString)
Definition: tconsole.cpp:473
~TConsole()
Definition: tconsole.cpp:85
void ClearWindow(int start, int end, char c=' ')
Definition: tconsole.cpp:699
void SetBackground(unsigned char wAttrib)
Definition: tconsole.cpp:147
int GetCursorY()
Definition: tconsole.h:70
unsigned char defaultfg
Definition: tconsole.h:153
void ClearEOScreen(char c=' ')
Definition: tconsole.cpp:709
bool underline
Definition: tconsole.h:157
unsigned char origfg
Definition: tconsole.h:154
int iScrollEnd
Definition: tconsole.h:161
void DeleteCharacter(int numchar)
Definition: tconsole.cpp:832
void ClearBOScreen(char c=' ')
Definition: tconsole.cpp:721
unsigned char fg
Definition: tconsole.h:152
unsigned char origbg
Definition: tconsole.h:154
unsigned long WriteText(const char *pszString, unsigned long cbString)
Definition: tconsole.cpp:335
HANDLE hConsole
Definition: tconsole.h:147
CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: tconsole.h:149
void UnderlineOff()
Definition: tconsole.cpp:214
unsigned long WriteStringFast(const char *pszString, unsigned long cbString)
Definition: tconsole.cpp:350
void UnderlineOn()
Definition: tconsole.cpp:195
unsigned char GetAttrib()
Definition: tconsole.h:89
void sync()
Definition: tconsole.cpp:109
void InsertMode(int i)
Definition: tconsole.h:141
void ClearBOLine(char c=' ')
Definition: tconsole.cpp:754
int GetHeight()
Definition: tconsole.h:82
void UlBlinkOn()
Definition: tconsole.cpp:233
int insert_mode
Definition: tconsole.h:162
void setDefaultBg(unsigned char u)
Definition: tconsole.h:106
void SetCursorSize(int pct)
Definition: tconsole.cpp:929
int iScrollStart
Definition: tconsole.h:160
void SetRawCursorPosition(int x, int y)
Definition: tconsole.cpp:860
void ReverseOn()
Definition: tconsole.cpp:311
void Lightbg()
Definition: tconsole.cpp:258
void Beep()
Definition: tconsole.cpp:922
void MoveCursorPosition(int x, int y)
Definition: tconsole.cpp:907
void SetForeground(unsigned char wAttrib)
Definition: tconsole.cpp:141
void SetAttrib(unsigned char wAttr)
Definition: tconsole.h:88
unsigned char wAttributes
Definition: tconsole.h:151
void BlinkOff()
Definition: tconsole.cpp:176
void ClearScreen(char c=' ')
Definition: tconsole.cpp:689
void ReverseOff()
Definition: tconsole.cpp:328
void UlBlinkOff()
Definition: tconsole.cpp:247
void BlinkOn()
Definition: tconsole.cpp:157
void ClearEOLine(char c=' ')
Definition: tconsole.cpp:743
unsigned long NetWriteString(const char *pszString, unsigned long cbString)
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
const GLubyte * c
Definition: glext.h:8905
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
void saveScreen(CHAR_INFO *chiBuffer)
Definition: tconsole.cpp:934
#define CON_CUR_Y
Definition: tconsole.h:57
#define CON_COLS
Definition: tconsole.h:54
#define CON_LINES
Definition: tconsole.h:53
void restoreScreen(CHAR_INFO *chiBuffer)
Definition: tconsole.cpp:964
#define CON_CUR_X
Definition: tconsole.h:56
void deleteBuffer(CHAR_INFO *chiBuffer)
Definition: tconsole.cpp:1004
CHAR_INFO * newBuffer()
Definition: tconsole.cpp:995
TConfig ini
Definition: tnconfig.cpp:45
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
Definition: wincrypt.h:4505
_In_ BOOL bEnable
Definition: winddi.h:3426