2007-08-03 22:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/libct/screen1.c
    * removed unnecessary casting

  + harbour/contrib/libct/screen3.prg
    + added CLEAREOL(), CLEOL(), CLWIN()

  * harbour/contrib/libct/screen2.c
  + harbour/contrib/libct/showtime.prg
    + added SHOWTIME()

  * harbour/contrib/libct/Makefile
  * harbour/contrib/libct/makefile.bc
  * harbour/contrib/libct/makefile.vc
    * updated for new files
This commit is contained in:
Przemyslaw Czerpak
2007-08-03 20:45:20 +00:00
parent 6ed7c1f6b2
commit f229fdefdd
8 changed files with 222 additions and 1 deletions

View File

@@ -8,6 +8,22 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-08-03 22:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/screen1.c
* removed unnecessary casting
+ harbour/contrib/libct/screen3.prg
+ added CLEAREOL(), CLEOL(), CLWIN()
* harbour/contrib/libct/screen2.c
+ harbour/contrib/libct/showtime.prg
+ added SHOWTIME()
* harbour/contrib/libct/Makefile
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libct/makefile.vc
* updated for new files
2007-08-03 13:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/ctwin.c
* added protection against overwriting right and bottom WBOX border

View File

@@ -84,6 +84,8 @@ PRG_SOURCES= \
ctmisc.prg \
cttime.prg \
numconv.prg \
screen3.prg \
showtime.prg \
LIBNAME=ct

View File

@@ -166,6 +166,8 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\ctmisc.obj \
$(OBJ_DIR)\cttime.obj \
$(OBJ_DIR)\numconv.obj \
$(OBJ_DIR)\screen3.obj \
$(OBJ_DIR)\showtime.obj \
#
# Our default target
@@ -495,3 +497,17 @@ $(OBJ_DIR)\numconv.c : $(TOOLS_DIR)\numconv.prg
$(OBJ_DIR)\numconv.obj : $(OBJ_DIR)\numconv.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\screen3.c : $(TOOLS_DIR)\screen3.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\screen3.obj : $(OBJ_DIR)\screen3.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\showtime.c : $(TOOLS_DIR)\showtime.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\showtime.obj : $(OBJ_DIR)\showtime.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,

View File

@@ -184,6 +184,8 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\ct.obj \
$(OBJ_DIR)\ctmisc.obj \
$(OBJ_DIR)\numconv.obj \
$(OBJ_DIR)\screen3.obj \
$(OBJ_DIR)\showtime.obj \
#
# Our default target

View File

@@ -315,7 +315,7 @@ static int hb_ctGetClearColor( int iParam )
if( ISNUM( iParam ) )
iColor = hb_parni( iParam );
else if( ISCHAR( iParam ) )
iColor = ( UCHAR ) hb_gtColorToN( hb_parc( iParam ) );
iColor = hb_gtColorToN( hb_parc( iParam ) );
else
iColor = hb_gt_GetClearColor();

View File

@@ -55,6 +55,7 @@
#include "hbapigt.h"
#include "hbgtcore.h"
#include "hbdate.h"
HB_FUNC( SAYDOWN )
{
@@ -312,3 +313,49 @@ HB_FUNC( STRSCREEN )
hb_retc( NULL );
}
/*
* _HB_CTDSPTIME() is helper functions for SHOWTIME()
*/
HB_FUNC( _HB_CTDSPTIME )
{
SHORT sRow, sCol;
int iColor, iLen, i;
char szTime[ 10 ];
sRow = ( SHORT ) hb_parni( 1 );
sCol = ( SHORT ) hb_parni( 2 );
if( ISNUM( 4 ) )
iColor = hb_parni( 4 );
else if( ISCHAR( 4 ) )
iColor = hb_gtColorToN( hb_parc( 4 ) );
else
iColor = hb_gt_GetClearColor();
hb_dateTimeStr( szTime );
iLen = 8;
if( ISLOG( 3 ) && hb_parl( 3 ) )
iLen -= 3;
if( ISLOG( 5 ) && hb_parl( 5 ) )
{
int iHour = ( szTime[0] - '0' ) * 10 + ( szTime[1] - '0' );
if( ISLOG( 6 ) && hb_parl( 6 ) )
szTime[iLen++] = iHour >= 12 ? 'p' : 'a';
if( iHour > 12 )
iHour -= 12;
else if( iHour == 0 )
iHour = 12;
szTime[0] = ( iHour / 10 ) + '0';
szTime[1] = ( iHour % 10 ) + '0';
}
if( szTime[0] == '0' )
szTime[0] = ' ';
for( i = 0; i < iLen; ++sCol, ++i )
hb_gt_PutScrChar( sRow, sCol, iColor, 0, szTime[i] );
hb_gt_Flush();
}

View File

@@ -0,0 +1,71 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* CT3 video functions:
*
* CLEAREOL(), CLEOL(), CLWIN()
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
* 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, or (at your option)
* any later version.
*
* 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
FUNCTION CLEAREOL( nRow, nCol, xAttr, xChar )
IF !ISNUMERIC( nRow )
nRow := ROW()
ENDIF
RETURN CLEARWIN( nRow, nCol, nRow, /*MAXCOL()*/, xAttr, xChar )
FUNCTION CLEOL( nRow, nCol )
IF !ISNUMERIC( nRow )
nRow := ROW()
ENDIF
RETURN CLEARWIN( nRow, nCol, nRow, /*MAXCOL()*/, 7 /*"W/N"*/, " " )
FUNCTION CLWIN( nRow, nCol )
RETURN CLEARWIN( nRow, nCol, /*MAXROW()*/, /*MAXCOL()*/, 7 /*"W/N"*/, " " )

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* CT3 time function: SHOWTIME()
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
* 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, or (at your option)
* any later version.
*
* 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
FUNCTION SHOWTIME( nRow, nCol, lNoSec, cColor, l12, lAmPm )
STATIC s_hTimer := NIL
IF VALTYPE( nRow ) == "N" .AND. nRow >= 0 .AND. nRow <= MAXROW( .T. )
IF s_hTimer != NIL
HB_IDLEDEL( s_hTimer )
ENDIF
s_hTimer := HB_IDLEADD( {|| _HB_CTDSPTIME( nRow, nCol, lNoSec, cColor, ;
l12, lAmPm ) } )
ELSEIF s_hTimer != NIL
HB_IDLEDEL( s_hTimer )
s_hTimer := NIL
ENDIF
RETURN ""