ReactOS  0.4.12-dev-43-g63b00d8
tconsole.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TConsole
 

Macros

#define CON_TOP   ConsoleInfo.srWindow.Top
 
#define CON_BOTTOM   ConsoleInfo.srWindow.Bottom
 
#define CON_LEFT   0
 
#define CON_RIGHT   (ConsoleInfo.dwSize.X - 1)
 
#define CON_HEIGHT   (CON_BOTTOM - CON_TOP)
 
#define CON_WIDTH   (CON_RIGHT - CON_LEFT)
 
#define CON_LINES   (CON_HEIGHT + 1)
 
#define CON_COLS   (CON_WIDTH + 1)
 
#define CON_CUR_X   (ConsoleInfo.dwCursorPosition.X - CON_LEFT)
 
#define CON_CUR_Y   (ConsoleInfo.dwCursorPosition.Y - CON_TOP)
 

Functions

void saveScreen (CHAR_INFO *chiBuffer)
 
void restoreScreen (CHAR_INFO *chiBuffer)
 
CHAR_INFOnewBuffer ()
 
void deleteBuffer (CHAR_INFO *chiBuffer)
 

Macro Definition Documentation

◆ CON_BOTTOM

◆ CON_COLS

◆ CON_CUR_X

◆ CON_CUR_Y

◆ CON_HEIGHT

◆ CON_LEFT

◆ CON_LINES

◆ CON_RIGHT

◆ CON_TOP

◆ CON_WIDTH

Function Documentation

◆ deleteBuffer()

void deleteBuffer ( CHAR_INFO chiBuffer)

Definition at line 1004 of file tconsole.cpp.

1004  {
1005  delete[] chiBuffer;
1006 }

◆ newBuffer()

CHAR_INFO* newBuffer ( )

Definition at line 995 of file tconsole.cpp.

Referenced by _mesa_realloc(), TMouse::doMouse_init(), ATL::CComEnumImpl< Base, piid, T, Copy >::Init(), TScroller::ScrollBack(), and ATL::CRegObject::strbuf_write().

995  {
998  GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo);
999  CHAR_INFO * chiBuffer;
1000  chiBuffer = new CHAR_INFO[(CON_BOTTOM-CON_TOP+1)*(CON_RIGHT-CON_LEFT+1)];
1001  return chiBuffer;
1002 }
#define CON_LEFT
Definition: tconsole.h:48
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
#define CON_TOP
Definition: tconsole.h:45
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:544
#define CON_BOTTOM
Definition: tconsole.h:46
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
HANDLE hStdout
Definition: ctm.c:56
#define CON_RIGHT
Definition: tconsole.h:49

◆ restoreScreen()

void restoreScreen ( CHAR_INFO chiBuffer)

Definition at line 964 of file tconsole.cpp.

Referenced by TMouse::doMouse_cleanup(), and TScroller::ScrollBack().

964  {
965  HANDLE hStdout;
967  SMALL_RECT srctReadRect;
968  COORD coordBufSize;
969  COORD coordBufCoord;
970 
971  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
972  GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo);
973 
974  // restore screen
975  srctReadRect.Top = CON_TOP; /* top left: row 0, col 0 */
976  srctReadRect.Left = CON_LEFT;
977  srctReadRect.Bottom = CON_BOTTOM; /* bot. right: row 1, col 79 */
978  srctReadRect.Right = CON_RIGHT;
979 
980  coordBufSize.Y = CON_BOTTOM-CON_TOP+1;
981  coordBufSize.X = CON_RIGHT-CON_LEFT+1;
982 
983  coordBufCoord.X = CON_TOP;
984  coordBufCoord.Y = CON_LEFT;
986  hStdout, /* screen buffer to write to */
987  chiBuffer, /* buffer to copy from */
988  coordBufSize, /* col-row size of chiBuffer */
989  coordBufCoord, /* top left src cell in chiBuffer */
990  &srctReadRect); /* dest. screen buffer rectangle */
991  // end restore screen
992 
993 }
#define CON_LEFT
Definition: tconsole.h:48
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
#define CON_TOP
Definition: tconsole.h:45
#define WriteConsoleOutput
Definition: wincon.h:775
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:544
SHORT Left
Definition: blue.h:25
ULONG X
Definition: bl.h:1340
SHORT Bottom
Definition: blue.h:28
#define CON_BOTTOM
Definition: tconsole.h:46
SHORT Top
Definition: blue.h:26
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
Definition: bl.h:1338
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
HANDLE hStdout
Definition: ctm.c:56
#define CON_RIGHT
Definition: tconsole.h:49
SHORT Right
Definition: blue.h:27
ULONG Y
Definition: bl.h:1341

◆ saveScreen()

void saveScreen ( CHAR_INFO chiBuffer)

Definition at line 934 of file tconsole.cpp.

Referenced by TMouse::doMouse_init(), and TScroller::ScrollBack().

934  {
935  HANDLE hStdout;
937  SMALL_RECT srctReadRect;
938  COORD coordBufSize;
939  COORD coordBufCoord;
940 
941  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
942  GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo);
943 
944  srctReadRect.Top = CON_TOP; /* top left: row 0, col 0 */
945  srctReadRect.Left = CON_LEFT;
946  srctReadRect.Bottom = CON_BOTTOM; /* bot. right: row 1, col 79 */
947  srctReadRect.Right = CON_RIGHT;
948 
949  coordBufSize.Y = CON_BOTTOM-CON_TOP+1;
950  coordBufSize.X = CON_RIGHT-CON_LEFT+1;
951 
952  coordBufCoord.X = CON_TOP;
953  coordBufCoord.Y = CON_LEFT;
954 
956  hStdout, /* screen buffer to read from */
957  chiBuffer, /* buffer to copy into */
958  coordBufSize, /* col-row size of chiBuffer */
959 
960  coordBufCoord, /* top left dest. cell in chiBuffer */
961  &srctReadRect); /* screen buffer source rectangle */
962 }
#define CON_LEFT
Definition: tconsole.h:48
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
#define CON_TOP
Definition: tconsole.h:45
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:544
SHORT Left
Definition: blue.h:25
ULONG X
Definition: bl.h:1340
SHORT Bottom
Definition: blue.h:28
#define CON_BOTTOM
Definition: tconsole.h:46
SHORT Top
Definition: blue.h:26
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
Definition: bl.h:1338
#define ReadConsoleOutput
Definition: wincon.h:768
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
HANDLE hStdout
Definition: ctm.c:56
#define CON_RIGHT
Definition: tconsole.h:49
SHORT Right
Definition: blue.h:27
ULONG Y
Definition: bl.h:1341