5 /* A diagram of the following values:
8 * +----------------------------------------+
23 * +---------------------------+.....?......| ---
25 * | . | <-- OR --> | |
27 * CON_LEFT | . | CON_RIGHT |
28 * (=0) | . | (=CON_ | CON_LINES
29 * |..............* | WIDTH) |
35 * +---------------------------+------------+ ---
36 * CON_BOTTOM (=CON_TOP + CON_HEIGHT)
38 * |--------- CON_COLS --------|
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
45 #define CON_TOP ConsoleInfo.srWindow.Top
46 #define CON_BOTTOM ConsoleInfo.srWindow.Bottom
49 #define CON_RIGHT (ConsoleInfo.dwSize.X - 1)
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)
56 #define CON_CUR_X (ConsoleInfo.dwCursorPosition.X - CON_LEFT)
57 #define CON_CUR_Y (ConsoleInfo.dwCursorPosition.Y - CON_TOP)
62 TConsole(HANDLE hConsole
);
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
;}
71 if(iScrollStart
!= -1)
72 return CON_CUR_Y
- iScrollStart
;
73 return GetRawCursorY();
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
);
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,
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"
93 void SetForeground(unsigned char wAttrib
); // Set the foreground directly
94 void SetBackground(unsigned char wAttrib
);
95 void BlinkOn(); // Blink on/off
97 void UnderlineOn(); // Underline on/off
99 void UlBlinkOn(); // Blink+Underline on/off
101 void ReverseOn(); // Reverse on/off
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
;}
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
);
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
= ' ');
125 // Scrolling and text output control functions
126 void SetScroll(int start
, int end
);
127 void ScrollDown(int iStartRow
, int iEndRow
, int bUp
);
128 void ScrollAll(int bUp
) {ScrollDown(iScrollStart
, iScrollEnd
, bUp
);}
130 void reverse_index();
131 void setLineWrap(bool bEnabled
){
132 if(!ini
.get_lock_linewrap())
133 ini
.set_value("Wrap_Line", bEnabled
? "true" : "false");
135 bool getLineWrap() {return ini
.get_wrapline();}
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
;}
143 // Miscellaneous functions
149 CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
;
151 unsigned char wAttributes
;
152 unsigned char fg
, bg
;
153 unsigned char defaultfg
, defaultbg
;
154 unsigned char origfg
, origbg
;
165 // Non-member functions for saving state -- used by the scrollback buffer viewer
166 void saveScreen(CHAR_INFO
* chiBuffer
);
167 void restoreScreen(CHAR_INFO
* chiBuffer
);
168 CHAR_INFO
* newBuffer();
169 void deleteBuffer(CHAR_INFO
* chiBuffer
);