From 350b8f5ebf2a3f3ea1eb7ceed2f6faa9b5299ca0 Mon Sep 17 00:00:00 2001 From: Paul Tucker Date: Wed, 4 Aug 1999 16:55:09 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 6 ++ harbour/source/rtl/gt/gtwin.c | 159 ++++++++++++++++++---------------- harbour/source/rtl/gtapi.c | 4 +- 3 files changed, 92 insertions(+), 77 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 024f94ed59..2592c7e14f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +19990804-00:40 EDT Paul Tucker + * source/rtl/gtwin.c + * reduced the internal buffering to 1 level to improve speed. + * source/rtl/gtapi.c + * commented out dispbegin calls in gtbox (for now!) + Wed Aug 04 12:25:12 1999 Gonzalo A. Diethelm * source/rdd/dbcmd.c: diff --git a/harbour/source/rtl/gt/gtwin.c b/harbour/source/rtl/gt/gtwin.c index 41c6bb841e..8eced11f22 100644 --- a/harbour/source/rtl/gt/gtwin.c +++ b/harbour/source/rtl/gt/gtwin.c @@ -105,42 +105,6 @@ void hb_gt_SetPos(char cRow, char cCol) LOG(".. Called SetConsoleCursorPosition()"); } -void hb_gt_SetCursorStyle(int style) -{ - CONSOLE_CURSOR_INFO cci; - - LOG("SetCursorStyle"); - GetConsoleCursorInfo(HCursor, &cci); - cci.bVisible = 1; /* always visible unless explicitly request off */ - switch (style) - { - case SC_NONE: - cci.bVisible = 0; - break; - - case SC_INSERT: - cci.dwSize = 50; - break; - - case SC_SPECIAL1: - cci.dwSize = 99; - break; - - case SC_SPECIAL2: - cci.dwSize = 66; - /* In their infinite wisdom, MS doesn't support cursors that - don't start at the bottom of the cell */ - break; - case SC_NORMAL: - default: /* traps for invalid values */ - cci.dwSize = 25; /* this was 12, but when used in full screen dos window - cursor state is erratic - doesn't turn off, etc. */ - break; - - } - SetConsoleCursorInfo(HCursor, &cci); -} - int hb_gt_GetCursorStyle(void) { CONSOLE_CURSOR_INFO cci; @@ -180,6 +144,43 @@ int hb_gt_GetCursorStyle(void) return(rc); } +void hb_gt_SetCursorStyle(int style) +{ + CONSOLE_CURSOR_INFO cci; + + LOG("SetCursorStyle"); + GetConsoleCursorInfo(HCursor, &cci); + cci.bVisible = 1; /* always visible unless explicitly request off */ + switch (style) + { + case SC_NONE: + cci.bVisible = 0; + break; + + case SC_INSERT: + cci.dwSize = 50; + break; + + case SC_SPECIAL1: + cci.dwSize = 99; + break; + + case SC_SPECIAL2: + cci.dwSize = 66; + /* In their infinite wisdom, MS doesn't support cursors that + don't start at the bottom of the cell */ + break; + case SC_NORMAL: + default: /* traps for invalid values */ + cci.dwSize = 25; /* this was 12, but when used in full screen dos window + cursor state is erratic - doesn't turn off, etc. */ + break; + + } + SetConsoleCursorInfo(HCursor, &cci); + +} + void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len) { DWORD dwlen; @@ -365,39 +366,43 @@ void hb_gt_DispBegin(void) COORD coBuf; /* the size of the buffer to read into */ CHAR_INFO *pCharInfo; /* buffer to store info from ReadConsoleOutput */ SMALL_RECT srWin; /* source rectangle to read from */ + USHORT uiCount; - srWin.Top = srWin.Left = 0; - srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1; - srWin.Bottom = (coBuf.Y = hb_gt_GetScreenHeight()) -1; + if( ( uiCount = hb_gtDispCount() ) == 1) + { + srWin.Top = srWin.Left = 0; + srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1; + srWin.Bottom = (coBuf.Y = hb_gt_GetScreenHeight()) -1; - /* allocate a buffer for the screen rectangle */ - pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.X * coBuf.Y * sizeof(CHAR_INFO)); + /* allocate a buffer for the screen rectangle */ + pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.X * coBuf.Y * sizeof(CHAR_INFO)); - hb_gt_ScreenBuffer( (ULONG)HOutput ); /* store current handle */ + hb_gt_ScreenBuffer( (ULONG)HOutput ); /* store current handle */ - /* read the screen rectangle into the buffer */ - ReadConsoleOutput(HOutput, /* current screen handle */ - pCharInfo, /* transfer area */ - coBuf, /* size of destination buffer */ - coDest, /* upper-left cell to write data to */ - &srWin); /* screen buffer rectangle to read from */ + /* read the screen rectangle into the buffer */ + ReadConsoleOutput(HOutput, /* current screen handle */ + pCharInfo, /* transfer area */ + coBuf, /* size of destination buffer */ + coDest, /* upper-left cell to write data to */ + &srWin); /* screen buffer rectangle to read from */ - HOutput = CreateConsoleScreenBuffer( + HOutput = CreateConsoleScreenBuffer( GENERIC_READ | GENERIC_WRITE, /* Access flag */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */ NULL, /* Security attribute ptr */ CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ NULL); /* reserved */ - SetConsoleScreenBufferSize(HOutput, coBuf); + SetConsoleScreenBufferSize(HOutput, coBuf); - WriteConsoleOutput(HOutput, /* output handle */ - pCharInfo, /* data to write */ - coBuf, /* col/row size of source buffer */ - coDest, /* upper-left cell to write data from in src */ - &srWin); /* screen buffer rect to write data to */ + WriteConsoleOutput(HOutput, /* output handle */ + pCharInfo, /* data to write */ + coBuf, /* col/row size of source buffer */ + coDest, /* upper-left cell to write data from in src */ + &srWin); /* screen buffer rect to write data to */ - hb_xfree(pCharInfo); + hb_xfree(pCharInfo); + } } void hb_gt_DispEnd(void) @@ -407,32 +412,36 @@ void hb_gt_DispEnd(void) COORD coBuf; /* the size of the buffer to read into */ CHAR_INFO *pCharInfo; /* buffer to store info from ReadConsoleOutput */ SMALL_RECT srWin; /* source rectangle to read from */ + USHORT uiCount; - srWin.Top = srWin.Left = 0; - srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1; - srWin.Bottom = (coBuf.Y = hb_gt_GetScreenHeight()) -1; + if( ( uiCount = hb_gtDispCount() ) == 1 ) + { + srWin.Top = srWin.Left = 0; + srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1; + srWin.Bottom = (coBuf.Y = hb_gt_GetScreenHeight()) -1; - /* allocate a buffer for the screen rectangle */ - pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.X * coBuf.Y * sizeof(CHAR_INFO)); + /* allocate a buffer for the screen rectangle */ + pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.X * coBuf.Y * sizeof(CHAR_INFO)); - /* read the screen rectangle into the buffer */ - ReadConsoleOutput(HOutput, /* current screen buffer */ - pCharInfo, /* transfer area */ - coBuf, /* col/row size of destination buffer */ - coDest, /* upper-left cell to write data to in dest */ - &srWin); /* screen buffer rectangle to read from */ + /* read the screen rectangle into the buffer */ + ReadConsoleOutput(HOutput, /* current screen buffer */ + pCharInfo, /* transfer area */ + coBuf, /* col/row size of destination buffer */ + coDest, /* upper-left cell to write data to in dest */ + &srWin); /* screen buffer rectangle to read from */ - CloseHandle( HOutput ); + CloseHandle( HOutput ); - HOutput = (HANDLE)hb_gt_ScreenBuffer( 0 ); /* get previous handle */ + HOutput = (HANDLE)hb_gt_ScreenBuffer( 0 ); /* get previous handle */ - WriteConsoleOutput(HOutput, /* output buffer */ - pCharInfo, /* buffer with data to write */ - coBuf, /* col/row size of source buffer */ - coDest, /* upper-left cell to write data from in src */ - &srWin); /* screen buffer rect to write data to */ + WriteConsoleOutput(HOutput, /* output buffer */ + pCharInfo, /* buffer with data to write */ + coBuf, /* col/row size of source buffer */ + coDest, /* upper-left cell to write data from in src */ + &srWin); /* screen buffer rect to write data to */ - hb_xfree(pCharInfo); + hb_xfree(pCharInfo); + } } void hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 8094bb9c7d..571608a91b 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -173,7 +173,7 @@ int hb_gtBox (USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char /* Draw the box or line as specified */ height = uiBottom - uiTop + 1; width = uiRight - uiLeft + 1; - hb_gtDispBegin(); +// hb_gtDispBegin(); if( height > 1 && width > 1 ) { @@ -213,7 +213,7 @@ int hb_gtBox (USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char } /* speed issue for now */ - hb_gtDispEnd(); +// hb_gtDispEnd(); hb_gtSetPos(uiTopBak + 1, uiLeftBak + 1);