ChangeLogTag:Tue Nov 09 11:56:05 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
Tue Nov 09 11:56:05 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
|
||||
|
||||
* include/hbsetup.h:
|
||||
* source/rtl/gt/gtsln.c:
|
||||
* source/rtl/gtxxx.c:
|
||||
* source/rtl/mousexxx.c:
|
||||
Added an initial implementation of GT over S-lang.
|
||||
|
||||
* source/rtl/inkey.c:
|
||||
Changed the order in which the #ifdef/#endif checks are done, to
|
||||
make sure the curses and S-lang implementations are picked up
|
||||
correctly.
|
||||
|
||||
* config/linux/gcc.cf:
|
||||
* config/w32/gcc.cf:
|
||||
* config/w32/mingw32.cf:
|
||||
Added initial support for easily switching between curses and
|
||||
slang. This could be vastly improved.
|
||||
|
||||
* tests/testbrw.prg:
|
||||
Added a piece of code bound to K_TAB, just for the fun of it...
|
||||
|
||||
19991109-01:58 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
* samples/Makefile
|
||||
samples/cccppc/*.*
|
||||
|
||||
@@ -33,7 +33,16 @@ LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$
|
||||
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
|
||||
endif
|
||||
|
||||
LINKLIBS += -lncurses -lm -Wl,--end-group
|
||||
# HB_SCREEN_LIB: empty, or one of ncurses, slang
|
||||
HB_SCREEN_LIB=ncurses
|
||||
# HB_SCREEN_LIB=slang
|
||||
|
||||
ifneq ($(HB_SCREEN_LIB),)
|
||||
LINKLIBS += -l$(HB_SCREEN_LIB)
|
||||
endif
|
||||
|
||||
LINKLIBS += -lm -Wl,--end-group
|
||||
|
||||
LDFLAGS = $(LINKPATHS)
|
||||
|
||||
AR = ar
|
||||
|
||||
@@ -38,6 +38,14 @@ LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$
|
||||
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
|
||||
endif
|
||||
|
||||
# HB_SCREEN_LIB: empty, or one of ncurses, slang
|
||||
# HB_SCREEN_LIB=ncurses
|
||||
# HB_SCREEN_LIB=slang
|
||||
|
||||
ifneq ($(HB_SCREEN_LIB),)
|
||||
LINKLIBS += -l$(HB_SCREEN_LIB)
|
||||
endif
|
||||
|
||||
# The -) option could be appropriate to link against libraries with
|
||||
# cyclic dependencies, but I think it is not really necessary if the
|
||||
# libraries are kept in proper order.
|
||||
|
||||
@@ -41,6 +41,14 @@ LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$
|
||||
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
|
||||
endif
|
||||
|
||||
# HB_SCREEN_LIB: empty, or one of ncurses, slang
|
||||
# HB_SCREEN_LIB=ncurses
|
||||
# HB_SCREEN_LIB=slang
|
||||
|
||||
ifneq ($(HB_SCREEN_LIB),)
|
||||
LINKLIBS += -l$(HB_SCREEN_LIB)
|
||||
endif
|
||||
|
||||
# The -) option could be appropriate to link against libraries with
|
||||
# cyclic dependencies, but I think it is not really necessary if the
|
||||
# libraries are kept in proper order.
|
||||
|
||||
@@ -157,13 +157,15 @@
|
||||
/*#define HARBOUR_USE_OS2_GTAPI*/
|
||||
/*#define HARBOUR_USE_WIN_GTAPI*/
|
||||
/*#define HARBOUR_USE_CRS_GTAPI*/
|
||||
/*#define HARBOUR_USE_SLN_GTAPI*/
|
||||
|
||||
/* Indicate that one of the GTAPIs is defined */
|
||||
#if defined(HARBOUR_USE_STD_GTAPI) || \
|
||||
defined(HARBOUR_USE_DOS_GTAPI) || \
|
||||
defined(HARBOUR_USE_OS2_GTAPI) || \
|
||||
defined(HARBOUR_USE_WIN_GTAPI) || \
|
||||
defined(HARBOUR_USE_CRS_GTAPI)
|
||||
defined(HARBOUR_USE_CRS_GTAPI) || \
|
||||
defined(HARBOUR_USE_SLN_GTAPI)
|
||||
#define HARBOUR_USE_GTAPI
|
||||
#endif
|
||||
|
||||
|
||||
287
harbour/source/rtl/gt/gtsln.c
Normal file
287
harbour/source/rtl/gt/gtsln.c
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Video subsystem based on ncurses.
|
||||
*
|
||||
* Copyright 1999 Gonzalo Diethelm <gonzalo.diethelm@iname.com>
|
||||
*
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: User programs should never call this layer directly! */
|
||||
|
||||
#include <slang.h>
|
||||
|
||||
#include "gtapi.h"
|
||||
|
||||
void hb_gt_Init( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()"));
|
||||
|
||||
SLtt_get_terminfo();
|
||||
SLkp_init();
|
||||
SLang_init_tty(34, /* Ctrl-G */
|
||||
0, /* no flow-control */
|
||||
0); /* no output processing */
|
||||
SLang_set_abort_signal(NULL);
|
||||
SLsmg_init_smg ();
|
||||
}
|
||||
|
||||
void hb_gt_Done( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Done()"));
|
||||
|
||||
SLsmg_refresh();
|
||||
SLsmg_reset_smg ();
|
||||
SLang_reset_tty();
|
||||
}
|
||||
|
||||
BOOL hb_gt_IsColor( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_IsColor()"));
|
||||
|
||||
/* TODO: How to detect this? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
USHORT hb_gt_GetScreenWidth( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetScreenWidth()"));
|
||||
|
||||
return SLtt_Screen_Cols;
|
||||
}
|
||||
|
||||
USHORT hb_gt_GetScreenHeight( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetScreenHeight()"));
|
||||
|
||||
return SLtt_Screen_Rows;
|
||||
}
|
||||
|
||||
void hb_gt_SetPos( USHORT uiRow, USHORT uiCol )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hu, %hu)", uiRow, uiCol));
|
||||
|
||||
SLsmg_gotorc(uiRow, uiCol);
|
||||
}
|
||||
|
||||
USHORT hb_gt_Col( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Col()"));
|
||||
|
||||
return SLsmg_get_column();
|
||||
}
|
||||
|
||||
USHORT hb_gt_Row( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Row()"));
|
||||
|
||||
return SLsmg_get_row();
|
||||
}
|
||||
|
||||
USHORT hb_gt_GetCursorStyle( void )
|
||||
{
|
||||
/* TODO: What shape is the cursor? */
|
||||
USHORT uiStyle = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetCursorStyle()"));
|
||||
|
||||
/* example from the dos driver */
|
||||
/*
|
||||
hb_gt_GetCursorSize( &start, &end )
|
||||
|
||||
if( start == 32 && end == 32 )
|
||||
uiStyle = SC_NONE;
|
||||
|
||||
else if( start == 6 && end == 7 )
|
||||
uiStyle = SC_NORMAL;
|
||||
|
||||
else if( start == 4 && end == 7 )
|
||||
uiStyle = SC_INSERT;
|
||||
|
||||
else if( start == 0 && end == 7 )
|
||||
uiStyle = SC_SPECIAL1;
|
||||
|
||||
else if( start == 0 && end == 3 )
|
||||
uiStyle = SC_SPECIAL2;
|
||||
}
|
||||
*/
|
||||
return uiStyle;
|
||||
}
|
||||
|
||||
void hb_gt_SetCursorStyle( USHORT uiStyle )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetCursorStyle(%hu)", uiStyle));
|
||||
|
||||
/* TODO: How to set the shape of the cursor? */
|
||||
/* see ..\..\..\tests\working\cursrtst.prg for an explanation */
|
||||
switch( uiStyle )
|
||||
{
|
||||
case SC_NONE:
|
||||
/* TODO: turn it off */
|
||||
break;
|
||||
|
||||
case SC_NORMAL:
|
||||
break;
|
||||
|
||||
case SC_INSERT:
|
||||
break;
|
||||
|
||||
case SC_SPECIAL1:
|
||||
break;
|
||||
|
||||
case SC_SPECIAL2:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Puts(%hu, %hu, %d, %p, %lu)", uiRow, uiCol, (int) byAttr, pbyStr, ulLen));
|
||||
|
||||
SLsmg_gotorc(uiRow, uiCol);
|
||||
SLsmg_write_nchars(pbyStr, ulLen);
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
HB_SYMBOL_UNUSED( uiTop );
|
||||
HB_SYMBOL_UNUSED( uiLeft );
|
||||
HB_SYMBOL_UNUSED( uiBottom );
|
||||
HB_SYMBOL_UNUSED( uiRight );
|
||||
HB_SYMBOL_UNUSED( pbyDst );
|
||||
}
|
||||
|
||||
void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_PutText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbySrc));
|
||||
|
||||
HB_SYMBOL_UNUSED( uiTop );
|
||||
HB_SYMBOL_UNUSED( uiLeft );
|
||||
HB_SYMBOL_UNUSED( uiBottom );
|
||||
HB_SYMBOL_UNUSED( uiRight );
|
||||
HB_SYMBOL_UNUSED( pbySrc );
|
||||
}
|
||||
|
||||
void hb_gt_SetAttribute( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetAttribute(%hu, %hu, %hu, %hu, %d)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr));
|
||||
|
||||
/* TODO: we want to take a screen that is say bright white on blue,
|
||||
and change the attributes only for a section of the screen
|
||||
to white on black.
|
||||
*/
|
||||
|
||||
HB_SYMBOL_UNUSED( uiTop );
|
||||
HB_SYMBOL_UNUSED( uiLeft );
|
||||
HB_SYMBOL_UNUSED( uiBottom );
|
||||
HB_SYMBOL_UNUSED( uiRight );
|
||||
HB_SYMBOL_UNUSED( byAttr );
|
||||
}
|
||||
|
||||
void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr, SHORT iRows, SHORT iCols )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Scroll(%hu, %hu, %hu, %hu, %d, %hd, %hd)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr, iRows, iCols));
|
||||
|
||||
HB_SYMBOL_UNUSED( uiTop );
|
||||
HB_SYMBOL_UNUSED( uiLeft );
|
||||
HB_SYMBOL_UNUSED( uiBottom );
|
||||
HB_SYMBOL_UNUSED( uiRight );
|
||||
HB_SYMBOL_UNUSED( iRows );
|
||||
HB_SYMBOL_UNUSED( iCols );
|
||||
}
|
||||
|
||||
void hb_gt_DispBegin( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_DispBegin()"));
|
||||
|
||||
/* TODO: Is there a way to change screen buffers?
|
||||
ie: can we write somewhere without it going to the screen
|
||||
and then update the screen from this buffer at a later time?
|
||||
We will initially want to copy the current screen to this buffer.
|
||||
*/
|
||||
}
|
||||
|
||||
void hb_gt_DispEnd()
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_DispEnd()"));
|
||||
|
||||
/* TODO: here we flush the buffer, and restore normal screen writes */
|
||||
}
|
||||
|
||||
BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetMode(%hu, %hu)", uiRows, uiCols));
|
||||
|
||||
HB_SYMBOL_UNUSED( uiRows );
|
||||
HB_SYMBOL_UNUSED( uiCols );
|
||||
|
||||
/* TODO: How to change the size of the screen? */
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
void hb_gt_Replicate( BYTE byChar, ULONG ulLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Replicate(%d, %lu)", (int) byChar, ulLen));
|
||||
|
||||
/* TODO: this will write character c nlength times to the screen.
|
||||
Note that it is not used yet
|
||||
If there is no native function that supports this, it is
|
||||
already handled in a generic way by higher level functions.
|
||||
*/
|
||||
|
||||
HB_SYMBOL_UNUSED( byChar );
|
||||
HB_SYMBOL_UNUSED( ulLen );
|
||||
}
|
||||
|
||||
BOOL hb_gt_GetBlink()
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetBlink()"));
|
||||
|
||||
/* TODO: under dos, the background 'intensity' bit can be switched
|
||||
from intensity to 'blinking'
|
||||
does this work under your platform?
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void hb_gt_SetBlink( BOOL bBlink )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetBlink(%d)", (int) bBlink));
|
||||
|
||||
/* TODO: set the bit if it's supported */
|
||||
|
||||
HB_SYMBOL_UNUSED( bBlink );
|
||||
}
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "gt/gtwin.c"
|
||||
#elif defined(HARBOUR_USE_CRS_GTAPI)
|
||||
#include "gt/gtcrs.c"
|
||||
#elif defined(HARBOUR_USE_SLN_GTAPI)
|
||||
#include "gt/gtsln.c"
|
||||
#else
|
||||
#include "gt/gtstd.c"
|
||||
#endif
|
||||
|
||||
@@ -316,7 +316,15 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
|
||||
if( hb_set.HB_SET_TYPEAHEAD || s_inkeyPoll )
|
||||
{
|
||||
int ch = 0;
|
||||
#if defined(_Windows) || defined(WINNT)
|
||||
#if defined(HARBOUR_USE_CRS_GTAPI) || defined(HARBOUR_USE_SLN_GTAPI)
|
||||
#if 1
|
||||
ch = hb_gtReadKey();
|
||||
#else
|
||||
/* TODO: */
|
||||
if( ! read( STDIN_FILENO, &ch, 1 ) )
|
||||
ch = 0;
|
||||
#endif
|
||||
#elif defined(_Windows) || defined(WINNT)
|
||||
/* First check for Ctrl+Break, which is handled by gt/gtwin.c */
|
||||
if( hb_gtBreak )
|
||||
{
|
||||
@@ -817,14 +825,6 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
|
||||
case 396: /* Alt + F12 */
|
||||
ch = 349 - ch;
|
||||
}
|
||||
#elif defined(HARBOUR_USE_CRS_GTAPI)
|
||||
#if 1
|
||||
ch = hb_gtReadKey();
|
||||
#else
|
||||
/* TODO: */
|
||||
if( ! read( STDIN_FILENO, &ch, 1 ) )
|
||||
ch = 0;
|
||||
#endif
|
||||
#else
|
||||
/* TODO: Support for other platforms, such as Mac */
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
#include "mouse/mouseos2.c"
|
||||
#elif defined(HARBOUR_USE_WIN_GTAPI)
|
||||
#include "mouse/mousewin.c"
|
||||
/*
|
||||
#elif defined(HARBOUR_USE_CRS_GTAPI)
|
||||
#include "mouse/mousecrs.c"
|
||||
#elif defined(HARBOUR_USE_SLN_GTAPI)
|
||||
#include "mouse/mousesln.c"
|
||||
*/
|
||||
#else
|
||||
#include "mouse/mousestd.c"
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@ function Main()
|
||||
local nCursor
|
||||
local cColor
|
||||
local nRow, nCol
|
||||
local nTmpRow, nTmpCol
|
||||
|
||||
oBrowse:colorSpec = "W+/B, N/BG"
|
||||
oBrowse:ColSep = "³"
|
||||
@@ -101,6 +102,12 @@ function Main()
|
||||
case nKey = K_CTRL_END
|
||||
oBrowse:panEnd()
|
||||
|
||||
case nKey = K_TAB
|
||||
nTmpRow := ROW()
|
||||
nTmpCol := COL()
|
||||
@ 0, 0 SAY TIME()
|
||||
DevPos( nTmpRow, nTmpCol )
|
||||
|
||||
endcase
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user