From c5ccfa9978a13af52e63b794a99b3d4f613f7e47 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 1 Mar 2006 13:49:07 +0000 Subject: [PATCH] 2006-03-01 14:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/htmllib/default.ch * fixed few wrong definitions - Ryszard, the definitions where wrong but Clipper PP seems to parse them. * harbour/contrib/rdd_ads/ads1.c * call AdsFlushFileBuffers() only when _SET_HARDCOMMIT is set (default) * harbour/include/Makefile + harbour/include/hbgfx.ch + harbour/include/hbgfxdef.ch + added hbgfx.ch, hbgfxdef.ch and missing tbrowse.ch * harbour/include/hbapigt.h * harbour/include/hbgtcore.h * harbour/source/rtl/gtapi.c * harbour/source/rtl/hbgtcore.c + added hb_gtGfxPrimitive(), hb_gtGfxText() - it's a work in progress now this functions works like in xHarbour allow to draw graphic objects in GTs which can do that (GTALLEG, GTXWC) but I plan to introduce some modifications in them. + harbour/tests/gfx.prg + added test program by Mauricio Abre (borrowed from xHarbour) which illustrates GFX usage * harbour/include/hbdefs.h * harbour/source/compiler/genc.c * harbour/source/compiler/harbour.c * harbour/source/vm/hvm.c * minor modification in some harbour func name and symbol scope definitions - I'd like to keep them in one place for easier manipulations in the future * harbour/source/compiler/harbour.y * harbour/source/pp/ppcore.c * harbour/source/pp/pplib.c * harbour/utils/hbpp/hbpp.c * clean a little bit recent modification it should resolve the problem with GPFs reported by users and some possible memory leaks when preprocessing/compilation process is interrupted. Ryszard I decided to always store copy of file name in open files structure - it can be used by compiler, preprocessor, PPLIB and HBPP and IMHO in all cases it should have valid and always initialized in the same way members for easier manipulation. In the future I'd like to clean the whole PP usage. I will need to keep all compiler and PP static variables in one structure pointed by pointer in thread local data or passed to called functions for MT support. * harbour/source/rtl/cdpapi.c * set 0 at the end of destination string in hb_cdpStrnToUTF8() * harbour/source/rtl/dateshb.c ! fixed possible GPF in CTOD when badly formated date is given * harbour/source/rtl/gtxwc/gtxwc.c * harbour/source/rtl/gtxwc/gtxwc.h * changed the selection code - now both PRIMARY and CLIPBOARD selections are set by Harbour. It should work with any programs which uses any of them but I'd like to remove one of this selections or give user a way to chose the preferred one. I can also add support for automatic setting/clearing/pasting PRIMARY selection by GTXWC with mouse and shift key. I'm waiting for opinions. + added basic support for GFX operations + harbour/source/rtl/gtalleg/Makefile + harbour/source/rtl/gtalleg/fixedth.sfc + harbour/source/rtl/gtalleg/gtalleg.c + harbour/source/rtl/gtalleg/ssf.c + harbour/source/rtl/gtalleg/ssf.h + added new GT by Mauricio Abre based on Allegro cross platform graphic libraries. Code borrowed from xHarbour and modified by my for new Harbour GT API. --- harbour/ChangeLog | 76 ++ harbour/contrib/htmllib/default.ch | 16 +- harbour/contrib/rdd_ads/ads1.c | 18 +- harbour/include/Makefile | 6 +- harbour/include/hbapigt.h | 2 + harbour/include/hbdefs.h | 20 +- harbour/include/hbgfx.ch | 95 ++ harbour/include/hbgfxdef.ch | 107 ++ harbour/include/hbgtcore.h | 12 +- harbour/source/compiler/genc.c | 8 +- harbour/source/compiler/harbour.c | 7 +- harbour/source/compiler/harbour.y | 2 +- harbour/source/pp/ppcore.c | 11 +- harbour/source/pp/pplib.c | 5 + harbour/source/rtl/cdpapi.c | 2 + harbour/source/rtl/dateshb.c | 5 +- harbour/source/rtl/gtalleg/Makefile | 13 + harbour/source/rtl/gtalleg/fixedth.sfc | 1371 ++++++++++++++++++++++++ harbour/source/rtl/gtalleg/gtalleg.c | 1227 +++++++++++++++++++++ harbour/source/rtl/gtalleg/ssf.c | 210 ++++ harbour/source/rtl/gtalleg/ssf.h | 242 +++++ harbour/source/rtl/gtapi.c | 18 + harbour/source/rtl/gtfunc.c | 29 + harbour/source/rtl/gtxwc/gtxwc.c | 472 ++++++-- harbour/source/rtl/gtxwc/gtxwc.h | 2 +- harbour/source/rtl/hbgtcore.c | 36 + harbour/source/vm/hvm.c | 8 +- harbour/tests/gfx.prg | 101 ++ harbour/utils/hbpp/hbpp.c | 5 + 29 files changed, 3977 insertions(+), 149 deletions(-) create mode 100644 harbour/include/hbgfx.ch create mode 100644 harbour/include/hbgfxdef.ch create mode 100644 harbour/source/rtl/gtalleg/Makefile create mode 100644 harbour/source/rtl/gtalleg/fixedth.sfc create mode 100644 harbour/source/rtl/gtalleg/gtalleg.c create mode 100644 harbour/source/rtl/gtalleg/ssf.c create mode 100644 harbour/source/rtl/gtalleg/ssf.h create mode 100644 harbour/tests/gfx.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2e81a16e2f..57ae5988e6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,82 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ * harbour/makefile.vc + * added optional BOOL parameter to functions which translate to UTF8 + to not translate control code characters + + * harbour/source/rtl/gtsln/gtsln.c + * harbour/source/rtl/gtxwc/gtxwc.c + * update for new parameter in UTF8 functions + +2006-03-01 16:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/cdpapi.c + * harbour/source/rtl/gtxwc/gtxwc.c + ! fixed UTF8 trnalsations + +2006-03-01 14:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/htmllib/default.ch + * fixed few wrong definitions - Ryszard, the definitions where wrong + but Clipper PP seems to parse them. + + * harbour/contrib/rdd_ads/ads1.c + * call AdsFlushFileBuffers() only when _SET_HARDCOMMIT is set (default) + + * harbour/include/Makefile + + harbour/include/hbgfx.ch + + harbour/include/hbgfxdef.ch + + added hbgfx.ch, hbgfxdef.ch and missing tbrowse.ch + + * harbour/include/hbapigt.h + * harbour/include/hbgtcore.h + * harbour/source/rtl/gtapi.c + * harbour/source/rtl/hbgtcore.c + + added hb_gtGfxPrimitive(), hb_gtGfxText() - it's a work in progress + now this functions works like in xHarbour allow to draw graphic + objects in GTs which can do that (GTALLEG, GTXWC) but I plan to + introduce some modifications in them. + + + harbour/tests/gfx.prg + + added test program by Mauricio Abre (borrowed from xHarbour) which + illustrates GFX usage + + * harbour/include/hbdefs.h + * harbour/source/compiler/genc.c + * harbour/source/compiler/harbour.c + * harbour/source/vm/hvm.c + * minor modification in some harbour func name and symbol scope + definitions - I'd like to keep them in one place for easier + manipulations in the future + + * harbour/source/compiler/harbour.y + * harbour/source/pp/ppcore.c + * harbour/source/pp/pplib.c + * harbour/utils/hbpp/hbpp.c + * clean a little bit recent modification it should resolve the + problem with GPFs reported by users and some possible memory + leaks when preprocessing/compilation process is interrupted. + Ryszard I decided to always store copy of file name in open + files structure - it can be used by compiler, preprocessor, + PPLIB and HBPP and IMHO in all cases it should have valid + and always initialized in the same way members for easier + manipulation. In the future I'd like to clean the whole PP + usage. I will need to keep all compiler and PP static variables + in one structure pointed by pointer in thread local data or + passed to called functions for MT support. + + * harbour/source/rtl/cdpapi.c + * set 0 at the end of destination string in hb_cdpStrnToUTF8() + + * harbour/source/rtl/dateshb.c + ! fixed possible GPF in CTOD when badly formated date is given + + * harbour/source/rtl/gtxwc/gtxwc.c + * harbour/source/rtl/gtxwc/gtxwc.h + * changed the selection code - now both PRIMARY and CLIPBOARD + selections are set by Harbour. It should work with any programs + which uses any of them but I'd like to remove one of this selections + or give user a way to chose the preferred one. I can also add support + for automatic setting/clearing/pasting PRIMARY selection by GTXWC + with mouse and shift key. I'm waiting for opinions. + added basic support for GFX operations + harbour/source/rtl/gtalleg/Makefile diff --git a/harbour/contrib/htmllib/default.ch b/harbour/contrib/htmllib/default.ch index 437f79938c..ea5544abeb 100644 --- a/harbour/contrib/htmllib/default.ch +++ b/harbour/contrib/htmllib/default.ch @@ -86,10 +86,10 @@ #xtranslate RestState() => DispBegin() ;; - RestScreen(,,,,\[\5]) ;; - SetColor(\[\3] ) ;; - SetCursor(\[\4]) ;; - SetPos(\[\1], \[\2] ) ;; + RestScreen(,,,,\[5\]) ;; + SetColor(\[3\] ) ;; + SetCursor(\[4\]) ;; + SetPos(\[1\], \[2\] ) ;; DispEnd() @@ -103,10 +103,10 @@ NIL ) #xTranslate DbRestState( ) => IIF( != NIL, ; - ( Select( \[\1] ), ; - OrdListAdd(\[\3] ), ; - OrdSetFocus(\[\4] ), ; - DbGoto(\[\2] )),) + ( Select( \[1\] ), ; + OrdListAdd(\[3\] ), ; + OrdSetFocus(\[4\] ),; + DbGoto(\[2\] )),) // --> Display a Message at MAXROW() with optional colour... diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index 870edd2909..96ac9d0a22 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -1647,16 +1647,22 @@ static ERRCODE adsFlush( ADSAREAP pArea ) HB_TRACE(HB_TR_DEBUG, ("adsFlush(%p)", pArea )); /* This function should flush current record buffer if hot and - send to OS request to flush its file buffers to disk, so instead - of AdsWriteRecord(), AdsFlushFileBuffers() should be used */ - /* AdsWriteRecord( pArea->hTable ); */ + send to OS request to flush its file buffers to disk, so as well as + of AdsWriteRecord(), AdsFlushFileBuffers() should be used FOR LOCAL + TABLES (it's ignored by Remote Server). + AdsWriteRecord() "flushes to the Advantage server", + AdsFlushFileBuffers() tells the local server to flush to disk. + Without it, we are dependent on the adslocal.cfg Flush Frequency setting. + */ if( !pArea->fReadonly ) { -#if ADS_REQUIRE_VERSION >= 6 - AdsFlushFileBuffers( pArea->hTable ); -#else AdsWriteRecord( pArea->hTable ); +#if ADS_REQUIRE_VERSION >= 6 + if( hb_set.HB_SET_HARDCOMMIT ) + { + AdsFlushFileBuffers( pArea->hTable ); + } #endif } diff --git a/harbour/include/Makefile b/harbour/include/Makefile index 1a4b680ccf..e8c2e848c4 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -70,11 +70,13 @@ PRG_HEADERS=\ hbdebug.ch \ hbextern.ch \ hbgetcmt.ch \ + hbgfx.ch \ + hbgfxdef.ch \ hbgtinfo.ch \ hbinkey.ch \ hblang.ch \ hbmacro.ch \ - hbmath.ch \ + hbmath.ch \ hbmemory.ch \ hbmemvar.ch \ hboo.ch \ @@ -89,6 +91,7 @@ PRG_HEADERS=\ setcurs.ch \ simpleio.ch \ std.ch \ + tbrowse.ch \ API_HEADERS=\ error.api \ @@ -102,4 +105,3 @@ API_HEADERS=\ vm.api \ include $(TOP)$(ROOT)config/header.cf - diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index bb1c174223..a5ab0a4a04 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -193,6 +193,8 @@ extern HB_EXPORT ERRCODE hb_gtOutErr( BYTE * pbyStr, ULONG ulLen ); extern HB_EXPORT ERRCODE hb_gtSetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox ); extern HB_EXPORT ERRCODE hb_gtSetKeyCP( char * pszTermCDP, char * pszHostCDP ); extern HB_EXPORT ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo ); +extern HB_EXPORT int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ); +extern HB_EXPORT ERRCODE hb_gtGfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ); extern HB_EXPORT BOOL hb_mouseIsPresent( void ); extern HB_EXPORT BOOL hb_mouseGetCursor( void ); diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 9ca80ed471..a5a8a842e9 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -1091,22 +1091,26 @@ typedef PHB_FUNC HB_FUNC_PTR; Note that "HB_" is not enough, since the Harbour internals are also prefixed with HB_. [vszakats] */ -#define HB_FUNCNAME( funcname ) HB_FUN_##funcname -#define HB_INIT_FUNCNAME( funcname ) HB_FUN_init_##funcname -#define HB_EXIT_FUNCNAME( funcname ) HB_FUN_exit_##funcname +#define HB_FUNCNAME( funcname ) HB_FUN_##funcname +#define HB_INIT_FUNCNAME( funcname ) HB_FUN_init_##funcname +#define HB_EXIT_FUNCNAME( funcname ) HB_FUN_exit_##funcname +#define HB_INITSTATICS_FUNCNAME() hb_INITSTATICS -#if ( defined( _MSC_VER ) || defined( __WATCOMC__ ) ) && defined( HB_FUNC_NO_DECORATION ) +#if defined( __cplusplus ) && defined( HB_FUNC_NO_DECORATION ) #define HB_EXTERN_C_ extern "C" + #define HB_EXTERN_ #else #define HB_EXTERN_C_ + #define HB_EXTERN_ extern #endif #define HB_FUNC_EXEC( funcname ) HB_FUN_##funcname(); #define HB_FUNC( funcname ) HB_EXTERN_C_ HB_EXPORT HARBOUR HB_FUN_##funcname ( void ) -#define HB_FUNC_STATIC( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void ) -#define HB_FUNC_EXTERN( funcname ) HB_EXTERN_C_ extern HARBOUR HB_FUN_##funcname ( void ) -#define HB_FUNC_INIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_init_##funcname ( void ) -#define HB_FUNC_EXIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_exit_##funcname ( void ) +#define HB_FUNC_EXTERN( funcname ) HB_EXTERN_C_ HB_EXTERN_ HARBOUR HB_EXPORT HB_FUN_##funcname ( void ) +#define HB_FUNC_STATIC( funcname ) static HARBOUR HB_FUN_##funcname ( void ) +#define HB_FUNC_INIT( funcname ) static HARBOUR HB_FUN_init_##funcname ( void ) +#define HB_FUNC_EXIT( funcname ) static HARBOUR HB_FUN_exit_##funcname ( void ) +#define HB_FUNC_INITSTATICS( ) static HARBOUR hb_INITSTATICS( void ) typedef ULONG HB_HANDLE; /* handle to memvar value */ typedef SHORT HB_SYMBOLSCOPE; /* stores symbol's scope */ diff --git a/harbour/include/hbgfx.ch b/harbour/include/hbgfx.ch new file mode 100644 index 0000000000..0e4e967d37 --- /dev/null +++ b/harbour/include/hbgfx.ch @@ -0,0 +1,95 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * GT Graphics functions + * + * Copyright 2004 Mauricio Abre + * www - http://www.xharbour.org + * 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. + * + */ + +/* + * WARNING: this file is also included in C code, so don't add xHarbour specific stuff, + * or protect it under #ifdef __XHARBOUR__ + * + */ + +#ifndef _HBGFX_CH_ +#define _HBGFX_CH_ + +#include "hbgfxdef.ch" + +/* + * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does + * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. + * + * However, a GT must properly manage its gfx output if the user didn't requested to acquire the + * screen, so this is under user choice. + * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then + * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen + * 100 times, which will slow down things a lot-) + * + * Mauricio + * + */ +#xtranslate HB_GFXACQUIRESCREEN() => hb_gfxPrimitive(GFX_ACQUIRESCREEN) +#xtranslate HB_GFXRELEASESCREEN() => hb_gfxPrimitive(GFX_RELEASESCREEN) +#xtranslate HB_GFXMAKECOLOR(, , [, ]) => hb_gfxPrimitive(GFX_MAKECOLOR, , , [, ]) +#xtranslate HB_GFXGETCLIP(, , , ) => := hb_gfxPrimitive(GFX_CLIPTOP); := hb_gfxPrimitive(GFX_CLIPLEFT); := hb_gfxPrimitive(GFX_CLIPBOTTOM); := hb_gfxPrimitive(GFX_CLIPRIGHT) +#xtranslate HB_GFXSETCLIP(, , , ) => hb_gfxPrimitive(GFX_SETCLIP, , , , ) +#xtranslate HB_GFXDRAWINGMODE([]) => hb_gfxPrimitive(GFX_DRAWINGMODE[, ]) +#xtranslate HB_GFXGETPIXEL(, ) => hb_gfxPrimitive(GFX_GETPIXEL, , ) +#xtranslate HB_GFXPUTPIXEL(, , ) => hb_gfxPrimitive(GFX_PUTPIXEL, , , ) +#xtranslate HB_GFXLINE(, , , , ) => hb_gfxPrimitive(GFX_LINE, , , , , ) +#xtranslate HB_GFXRECT(, , , , ) => hb_gfxPrimitive(GFX_RECT, , , , , ) +#xtranslate HB_GFXFILLEDRECT(, , , , ) => hb_gfxPrimitive(GFX_FILLEDRECT, , , , , ) +#xtranslate HB_GFXCIRCLE(, , , ) => hb_gfxPrimitive(GFX_CIRCLE, , , , ) +#xtranslate HB_GFXFILLEDCIRCLE(, , , ) => hb_gfxPrimitive(GFX_FILLEDCIRCLE, , , , ) +#xtranslate HB_GFXELLIPSE(, , , , ) => hb_gfxPrimitive(GFX_ELLIPSE, , , , , ) +#xtranslate HB_GFXFILLEDELLIPSE(, , , , ) => hb_gfxPrimitive(GFX_FILLEDELLIPSE, , , , , ) +#xtranslate HB_GFXFLOODFILL(, , ) => hb_gfxPrimitive(GFX_FLOODFILL, , , ) + +#endif /* _HBGFX_CH_ */ diff --git a/harbour/include/hbgfxdef.ch b/harbour/include/hbgfxdef.ch new file mode 100644 index 0000000000..6198fa1764 --- /dev/null +++ b/harbour/include/hbgfxdef.ch @@ -0,0 +1,107 @@ +/* + * $Id$ + */ + +/* + * xHarbour Project source code: + * GT Graphics definitions (GFX_*) + * + * Copyright 2004 Mauricio Abre + * www - http://www.xharbour.org + * 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. + * + */ + +/* + * WARNING: this file is also included in C code, so don't add xHarbour specific stuff, + * or protect it under #ifdef __XHARBOUR__ + * + */ + +#ifndef _HBGFXDEF_CH_ +#define _HBGFXDEF_CH_ + +/* + * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does + * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. + * + * However, a GT must properly manage its gfx output if the user didn't requested to acquire the + * screen, so this is under user choice. + * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then + * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen + * 100 times, which will slow down things a lot-) + * + * Mauricio + * + */ + +/* Misc, internals */ +#define GFX_ACQUIRESCREEN 1 /* Some GTs may require that you 'acquire' the screen before doing gfx things */ +#define GFX_RELEASESCREEN 2 /* Release a previously 'acquired' screen */ +#define GFX_MAKECOLOR 3 /* Calculate gfx color number based on RGBA values */ +/* Functions that affect drawing area */ +#define GFX_CLIPTOP 10 +#define GFX_CLIPLEFT 11 +#define GFX_CLIPBOTTOM 12 +#define GFX_CLIPRIGHT 13 +#define GFX_SETCLIP 14 /* NOTE: set to 0, 0, 0, 0 to disable ;) */ +/* Functions that affect drawing mode */ +#define GFX_DRAWINGMODE 20 +/* Drawing primitives */ +#define GFX_GETPIXEL 50 +#define GFX_PUTPIXEL 51 +#define GFX_LINE 52 +#define GFX_RECT 53 +#define GFX_FILLEDRECT 54 +#define GFX_CIRCLE 55 +#define GFX_FILLEDCIRCLE 56 +#define GFX_ELLIPSE 57 +#define GFX_FILLEDELLIPSE 58 +#define GFX_FLOODFILL 59 + +/* Drawing mode constants */ +#define GFX_MODE_SOLID 1 /* Solid mode, no translucency, no patterned primitives */ +#define GFX_MODE_XOR 2 /* XOR with current screen contents */ +#define GFX_MODE_ALPHA 3 /* Use alpha for transluced effect (SLOW) */ +/* TODO: add patterned mode drawings */ + +#endif /* _HBGFXDEF_CH_ */ diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index f955512405..f9aa3ec88e 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -212,6 +212,10 @@ typedef struct BOOL (* MouseButtonReleased) ( int, int *, int * ); int (* MouseReadKey) ( int ); + /* Graphics API */ + int (* GfxPrimitive) ( int, int, int, int, int, int ); + void (* GfxText) ( int, int, char *, int, int, int ); + #if 0 /* keyboard */ int (* ExtendedKeySupport) ( void ); @@ -227,10 +231,6 @@ typedef struct void (* update ) ( int ); int (* info ) ( int, BOOL , int , void * ); - /* Graphics API */ - int (* gfxPrimitive) ( int, int, int, int, int, int ); - void (* gfxText) ( int, int, char *, int, int, int ); - #endif void (* WhoCares) ( void * ); @@ -400,6 +400,8 @@ extern BOOL hb_mouse_ButtonState( int iButton ); extern BOOL hb_mouse_ButtonPressed( int iButton, int * piRow, int * piCol ); extern BOOL hb_mouse_ButtonReleased( int iButton, int * piRow, int * piCol ); extern int hb_mouse_ReadKey( int iEventMask ); +extern int hb_gt_GfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ); +extern void hb_gt_GfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ); extern void hb_gt_WhoCares( void * pCargo ); #define HB_GTSUPER_NEW() (HB_GTSUPER)->New() @@ -499,6 +501,8 @@ extern void hb_gt_WhoCares( void * pCargo ); #define HB_GTSUPER_MOUSEBUTTONPRESSED(b,r,c) (HB_GTSUPER)->MouseButtonPressed(b,r,c) #define HB_GTSUPER_MOUSEBUTTONRELEASED(b,r,c) (HB_GTSUPER)->MouseButtonReleased(b,r,c) #define HB_GTSUPER_MOUSEREADKEY(m) (HB_GTSUPER)->MouseReadKey(m) +#define HB_GTSUPER_GFXPRIMITIVE(g,t,l,b,r,c) (HB_GTSUPER)->GfxPrimitive(g,t,l,b,r,c) +#define HB_GTSUPER_GFXTEXT(t,l,s,c,h,w) (HB_GTSUPER)->GfxPrimitive(t,l,s,c,h,w) #define HB_GTSUPER_WHOCARES(p) (HB_GTSUPER)->WhoCares(p) extern HB_EXPORT void hb_gtSetDefault( char * szGtName ); diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index 92b1f0b461..174557c492 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -106,7 +106,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fprintf( yyc, "HB_FUNC( %s );\n", pFunc->szName ); /* Is it a STATIC$ */ else if ( bIsStaticVariable ) - fprintf( yyc, "static HARBOUR hb_INITSTATICS( void );\n" ); /* NOTE: hb_ intentionally in lower case */ + fprintf( yyc, "HB_FUNC_INITSTATICS();\n" ); /* NOTE: hb_ intentionally in lower case */ /* Is it an INIT FUNCTION/PROCEDURE */ else if ( bIsInitFunction ) hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s );\n", pFunc->szName, 1 ); @@ -170,7 +170,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou * we are using these two bits to mark the special function used to * initialize static variables */ - fprintf( yyc, "{ \"(_INITSTATICS)\", {HB_FS_INIT | HB_FS_EXIT}, {hb_INITSTATICS}, NULL }" ); /* NOTE: hb_ intentionally in lower case */ + fprintf( yyc, "{ \"(_INITSTATICS)\", {HB_FS_INITEXIT}, {hb_INITSTATICS}, NULL }" ); /* NOTE: hb_ intentionally in lower case */ } else { @@ -242,7 +242,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fprintf( yyc, "HB_FUNC( %s )", pFunc->szName ); /* Is it STATICS$ */ else if( bIsStaticVariable ) - fprintf( yyc, "static HARBOUR hb_INITSTATICS( void )" ); /* NOTE: hb_ intentionally in lower case */ + fprintf( yyc, "HB_FUNC_INITSTATICS()" ); /* NOTE: hb_ intentionally in lower case */ /* Is it an INIT FUNCTION/PROCEDURE */ else if ( bIsInitFunction ) hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s )", pFunc->szName, 1 ); @@ -1214,7 +1214,7 @@ static HB_GENC_FUNC( hb_p_pushblock ) * because at the time of C code generation we don't know * in which function was defined this local variable */ - if( ( pFunc->cScope & ( HB_FS_INIT | HB_FS_EXIT ) ) != ( HB_FS_INIT | HB_FS_EXIT ) ) + if( ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT ) if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, w )->szName ); fprintf( cargo->yyc, "\n" ); lPCodePos +=2; diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index a28b917b40..bf4d83f226 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -2353,7 +2353,7 @@ int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a variabl while( pFunc ) { bStatic = FALSE; - if( ( pFunc->cScope & ( HB_FS_INIT | HB_FS_EXIT ) ) == ( HB_FS_INIT | HB_FS_EXIT ) ) + if( ( pFunc->cScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT ) { /* we are in a codeblock used to initialize a static variable - * skip to a function where this static variable was declared @@ -3142,7 +3142,7 @@ void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value * initialization function - if YES then we have to switch to a function * where the static variable was declared */ - if( ( hb_comp_functions.pLast->cScope & ( HB_FS_INIT | HB_FS_EXIT ) ) == ( HB_FS_INIT | HB_FS_EXIT ) ) + if( ( hb_comp_functions.pLast->cScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT ) pFunc = hb_comp_functions.pLast->pOwner; else pFunc = hb_comp_functions.pLast; @@ -4408,7 +4408,7 @@ void hb_compStaticDefStart( void ) hb_comp_pInitFunc = hb_compFunctionNew( hb_compIdentifierNew("(_INITSTATICS)", TRUE), HB_FS_INIT ); hb_comp_pInitFunc->pOwner = hb_comp_functions.pLast; hb_comp_pInitFunc->bFlags = FUN_USES_STATICS | FUN_PROCEDURE; - hb_comp_pInitFunc->cScope = HB_FS_INIT | HB_FS_EXIT; + hb_comp_pInitFunc->cScope = HB_FS_INITEXIT; hb_comp_functions.pLast = hb_comp_pInitFunc; pBuffer[ 0 ] = HB_P_STATICS; @@ -5038,6 +5038,7 @@ static void hb_compCompileEnd( void ) while( hb_comp_files.pLast ) { PFILE pFile = hb_comp_files.pLast; + hb_xfree( pFile->szFileName ); fclose( pFile->handle ); if( pFile->pBuffer ) { diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 4c44f942bb..d496221f99 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1936,7 +1936,7 @@ BOOL hb_compInclude( char * szFileName, HB_PATHNAMES * pSearch ) pFile->handle = yyin; pFile->pBuffer = hb_xgrab( HB_PP_BUFF_SIZE ); pFile->iBuffer = pFile->lenBuffer = 10; - pFile->szFileName = szFileName; + pFile->szFileName = hb_strdup( szFileName ); pFile->iLine = 0; pFile->pPrev = hb_comp_files.pLast; diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 598e15225d..5cb8fa38b7 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -304,6 +304,11 @@ void hb_pp_SetRules( HB_INCLUDE_FUNC_PTR hb_compInclude, BOOL hb_comp_bQuiet ) fclose( hb_comp_files.pLast->handle ); hb_xfree( hb_comp_files.pLast->pBuffer ); + hb_xfree( hb_comp_files.pLast->szFileName ); + if( hb_comp_files.pLast->yyBuffer ) + { + hb_compParserStop(); /* uses hb_comp_files.pLast */ + } hb_xfree( hb_comp_files.pLast ); hb_comp_files.pLast = NULL; hb_comp_files.iFiles = 0; @@ -2023,7 +2028,7 @@ static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenr static int RemoveSlash( char * cpatt ) { - int i; + int i = 0; int lenres = strlen( cpatt ); while( cpatt[ i ] != '\0' ) @@ -4500,8 +4505,8 @@ static BOOL OpenInclude( char * szFileName, HB_PATHNAMES * pSearch, PHB_FNAME pM pFile->handle = fptr; pFile->pBuffer = hb_xgrab( HB_PP_BUFF_SIZE ); pFile->iBuffer = pFile->lenBuffer = 10; - pFile->szFileName = ( char * ) hb_xgrab( strlen( szFileName ) + 1 ); - hb_pp_strocpy( pFile->szFileName, szFileName ); + pFile->yyBuffer = NULL; + pFile->szFileName = hb_strdup( szFileName ); if( hb_comp_files.pLast ) hb_comp_files.pLast->iLine = hb_comp_iLine; diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index 2ae7813d43..0e4ab271c2 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -254,5 +254,10 @@ PINLINE hb_compInlineAdd( char * szFunName ) return NULL; } +void hb_compParserStop( void ) +{ + ; +} + #endif diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index a10d740adf..2f3dd04cab 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -631,6 +631,8 @@ HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYT u = uniCodes[ u ]; n += u16toutf8( &pDst[n], u ); } + pDst[ n ] = '\0'; + return n; } diff --git a/harbour/source/rtl/dateshb.c b/harbour/source/rtl/dateshb.c index 5d52bf1d66..6b493410dc 100644 --- a/harbour/source/rtl/dateshb.c +++ b/harbour/source/rtl/dateshb.c @@ -85,7 +85,6 @@ HB_FUNC( CTOD ) { char * szDate = hb_parc( 1 ); int d_value = 0, m_value = 0, y_value = 0; - char szDateFormat[ 9 ]; if( szDate ) { @@ -170,9 +169,7 @@ HB_FUNC( CTOD ) } } - sprintf( szDateFormat, "%04i%02i%02i", y_value, m_value, d_value ); - - hb_retds( szDateFormat ); + hb_retd( y_value, m_value, d_value ); } else hb_errRT_BASE_SubstR( EG_ARG, 1119, NULL, "CTOD", 1, hb_paramError( 1 ) ); diff --git a/harbour/source/rtl/gtalleg/Makefile b/harbour/source/rtl/gtalleg/Makefile new file mode 100644 index 0000000000..16f0abf7db --- /dev/null +++ b/harbour/source/rtl/gtalleg/Makefile @@ -0,0 +1,13 @@ + +ROOT = ../../../ + +C_SOURCES=\ + gtalleg.c ssf.c + +LIBNAME=gtalleg + +include $(TOP)$(ROOT)config/lib.cf + +ifeq ($(HB_MULTI_GT),yes) +CFLAGS += -DHB_MULTI_GT +endif diff --git a/harbour/source/rtl/gtalleg/fixedth.sfc b/harbour/source/rtl/gtalleg/fixedth.sfc new file mode 100644 index 0000000000..21637bdce4 --- /dev/null +++ b/harbour/source/rtl/gtalleg/fixedth.sfc @@ -0,0 +1,1371 @@ +/* + * $Id$ + */ + +/* + * + * SSF C-includable font file. + * Fixed Thin font. + * + * Copyright 2004 Mauricio Abre + * This file is licensed under the same term of SSF, see ssf.c for details. + * + * NOTE: needs fixing. + * Some chars are missing while other ones need urgent review! + * + */ + +static ssfGlyph g000 = { + 0, + {{SSF_NONE, 0, 0, 0, 0, 0, 0}} +}; + +static ssfGlyph g016 = { + 1, + {{SSF_TRIANGLE, 0, 12288, 24575, 28671, 0, 45055}} +}; + +static ssfGlyph g017 = { + 1, + {{SSF_TRIANGLE, 24575, 12288, 0, 28671, 24575, 45055}} +}; + +static ssfGlyph g030 = { + 1, + {{SSF_TRIANGLE, 0, 45055, 12287, 12288, 24575, 45055}} +}; + +static ssfGlyph g031 = { + 1, + {{SSF_TRIANGLE, 0, 12288, 12287, 45055, 24575, 12288}} +}; + +static ssfGlyph g032 = { + 1, + {{SSF_NONE, 0, 0, 32767, 65535, 0, 0}} +}; + +static ssfGlyph g033 = { + 4, + {{SSF_BOX, 8192, 12288, 12287, 28671, 0, 0}, + {SSF_BOX, 12288, 8192, 16383, 36863, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 28671, 0, 0}, + {SSF_BOX, 12288, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g034 = { + 4, + {{SSF_BOX, 0, 4096, 8191, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 16383, 0, 0}, + {SSF_BOX, 16384, 4096, 24575, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 16383, 0, 0}} +}; + +static ssfGlyph g035 = { + 4, + {{SSF_BOX, 0, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 0, 32768, 24575, 36863, 0, 0}, + {SSF_BOX, 4096, 8192, 8191, 49151, 0, 0}, + {SSF_BOX, 16384, 8192, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g036 = { + 8, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4096, 45055, 0, 0}, + {SSF_BOX, 12288, 4096, 16383, 53247, 0, 0}} +}; + +static ssfGlyph g037 = { + 9, + {{SSF_BOX, 0, 12288, 4095, 20479, 0, 0}, + {SSF_BOX, 4096, 8192, 12287, 12287, 0, 0}, + {SSF_BOX, 12288, 12288, 16384, 20479, 0, 0}, + {SSF_BOX, 4096, 20480, 12287, 24575, 0, 0}, + {SSF_LINE, 0, 49151, 20479, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 12288, 36864, 16383, 45055, 0, 0}, + {SSF_BOX, 16384, 32768, 24575, 36863, 0, 0}, + {SSF_BOX, 24576, 36864, 28671, 45055, 0, 0}, + {SSF_BOX, 16384, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g038 = { + 8, + {{SSF_BOX, 4096, 8192, 12287, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 20479, 0, 0}, + {SSF_BOX, 12288, 12288, 16383, 20479, 0, 0}, + {SSF_LINE, 0, 16384, 24575, 40959, 7168, THICK_DOWN}, + {SSF_LINE, 16383, 16384, 0, 32767, 7168, THICK_DOWN}, + {SSF_BOX, 0, 32768, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 12287, 49151, 0, 0}, + {SSF_LINE, 12288, 49151, 24575, 32768, 7168, THICK_UP}} +}; + +static ssfGlyph g039 = { + 1, + {{SSF_LINE, 16383, 4096, 8192, 16383, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g040 = { + 2, + {{SSF_SPLINE1, 16384, 4096, 0, 24575, 0, THICK_LEFT}, + {SSF_SPLINE2, 0, 32768, 16384, 53247, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g041 = { + 2, + {{SSF_SPLINE1, 4096, 4096, 20480, 24575, 0, THICK_LEFT}, + {SSF_SPLINE2, 20480, 32768, 4096, 53247, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g042 = { + 3, + {{SSF_LINE, 0, 12288, 16384, 49151, 7168, THICK_RIGHT}, + {SSF_LINE, 16384, 12288, 0, 49151, 7168, THICK_RIGHT}, + {SSF_BOX, 0, 28672, 24575, 32767, 0, 0}} +}; + +static ssfGlyph g043 = { + 2, + {{SSF_BOX, 8192, 12288, 12287, 40959, 0, 0}, + {SSF_BOX, 0, 24576, 20479, 28671, 0, 0}} +}; + +static ssfGlyph g044 = { + 2, + {{SSF_BOX, 8192, 40960, 16383, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 12287, 53247, 0, 0}} +}; + +static ssfGlyph g045 = { + 1, + {{SSF_BOX, 0, 24576, 20479, 28671, 0, 0}} +}; + +static ssfGlyph g046 = { + 1, + {{SSF_BOX, 4096, 40960, 12287, 49151, 0, 0}} +}; + +static ssfGlyph g047 = { + 1, + {{SSF_LINE, 0, 53247, 20479, 4096, 4096, THICK_RIGHT}} +}; + +static ssfGlyph g048 = { + 5, + {{SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_LINE, 4096, 45055, 20479, 16383, 4096, THICK_UP}} +}; + +static ssfGlyph g049 = { + 3, + {{SSF_BOX, 4096, 12288, 8191, 16383, 0, 0}, + {SSF_BOX, 8192, 8192, 12287, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g050 = { + 9, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 20480, 16384, 24575, 28671, 0, 0}, + {SSF_BOX, 16384, 28672, 20479, 32767, 0, 0}, + {SSF_BOX, 12288, 32768, 16383, 36863, 0, 0}, + {SSF_BOX, 8192, 36864, 12287, 40959, 0, 0}, + {SSF_BOX, 4096, 40960, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g051 = { + 7, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 8192, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g052 = { + 3, + {{SSF_BOX, 0, 28762, 24575, 32767, 0, 0}, + {SSF_LINE, 0, 32767, 16383, 16383, 7168, THICK_UP}, + {SSF_BOX, 16384, 8192, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g053 = { + 6, + {{SSF_BOX, 0, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 28761, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g054 = { + 7, + {{SSF_BOX, 20479, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g055 = { + 3, + {{SSF_BOX, 0, 8192, 24575, 12287, 0, 0}, + {SSF_LINE, 24575, 8192, 4096, 40959, 7168, THICK_DOWN}, + {SSF_BOX, 4096, 40960, 8191, 49151, 0, 0}} +}; + +static ssfGlyph g056 = { + 9, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 24575, 0, 0}, + {SSF_BOX, 0, 28672, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g057 = { + 9, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 24575, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g058 = { + 2, + {{SSF_BOX, 8192, 16384, 16383, 24575, 0, 0}, + {SSF_BOX, 8192, 32768, 16383, 40959, 0, 0}} +}; + +static ssfGlyph g059 = { + 3, + {{SSF_BOX, 8192, 24576, 16383, 32767, 0, 0}, + {SSF_BOX, 8192, 40960, 16383, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 12287, 53247, 0, 0}} +}; + +static ssfGlyph g060 = { + 2, + {{SSF_LINE, 0, 28671, 16384, 12288, 7168, THICK_RIGHT}, + {SSF_LINE, 0, 28672, 16384, 45055, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g061 = { + 2, + {{SSF_BOX, 4096, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 32768, 24575, 36863, 0, 0}} +}; + +static ssfGlyph g062 = { + 2, + {{SSF_LINE, 0, 12288, 16384, 28671, 7168, THICK_RIGHT}, + {SSF_LINE, 0, 45055, 16384, 28672, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g063 = { + 8, + {{SSF_BOX, 8192, 45056, 12287, 49151, 0, 0}, + {SSF_BOX, 8192, 32768, 12287, 36863, 0, 0}, + {SSF_BOX, 12288, 28672, 16383, 32767, 0, 0}, + {SSF_BOX, 16384, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 16384, 24575, 24575, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 16383, 0, 0}} +}; + +static ssfGlyph g064 = { + 8, + {{SSF_BOX, 12288, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 8192, 24576, 12287, 32767, 0, 0}, + {SSF_BOX, 12288, 32768, 20479, 36863, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 32767, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g065 = { + 5, + {{SSF_BOX, 0, 49151, 4095, 20480, 0, 0}, + {SSF_LINE, 12287, 8192, 0, 20479, 7168, THICK_DOWN}, + {SSF_LINE, 12288, 8192, 24575, 20479, 7168, THICK_DOWN}, + {SSF_BOX, 20480, 20480, 24575, 49151, 0, 0}, + {SSF_BOX, 4096, 28672, 20476, 32767, 0, 0}} +}; + +static ssfGlyph g066 = { + 6, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g067 = { + 5, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g068 = { + 6, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 20480, 16384, 24575, 40959, 0, 0}, + {SSF_BOX, 16384, 40960, 20479, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g069 = { + 6, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 24151, 12287, 0, 0}, + {SSF_BOX, 0, 8192, 4095, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 24576, 16383, 28671, 0, 0}} +}; + +static ssfGlyph g070 = { + 4, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 24151, 12287, 0, 0}, + {SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 24576, 16383, 28671, 0, 0}} +}; + +static ssfGlyph g071 = { + 6, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 12288, 28672, 20479, 32767, 0, 0}} +}; + +static ssfGlyph g072 = { + 3, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 20480, 8192, 24575, 49151, 0, 0}, + {SSF_BOX, 4096, 28672, 20479, 32767, 0, 0}} +}; + +static ssfGlyph g073 = { + 3, + {{SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 8192, 12288, 12287, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g074 = { + 4, + {{SSF_BOX, 12288, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20475, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}, + {SSF_BOX, 0, 36864, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g075 = { + 7, + {{SSF_BOX, 0, 8192, 8191, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 8191, 49151, 0, 0}, + {SSF_LINE, 16384, 8192, 8192, 28671, 7168, THICK_RIGHT}, + {SSF_LINE, 8192, 28672, 16384, 49151, 7168, THICK_RIGHT}, + {SSF_BOX, 20480, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 20480, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g076 = { + 4, + {{SSF_BOX, 0, 8192, 12287, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g077 = { + 4, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_LINE, 4096, 8192, 12287, 32767, 7168, THICK_DOWN}, + {SSF_LINE, 12288, 32767, 20479, 8192, 7168, THICK_DOWN}, + {SSF_BOX, 20480, 8192, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g078 = { + 3, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_LINE, 0, 12288, 20575, 45055, 4096, THICK_RIGHT}, + {SSF_BOX, 20480, 8192, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g079 = { + 4, + {{SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g080 = { + 4, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}} +}; + +static ssfGlyph g081 = { + 5, + {{SSF_BOX, 0, 12288, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}, + {SSF_LINE, 12288, 36864, 24575, 53247, 7168, THICK_LEFT}} +}; + +static ssfGlyph g082 = { + 5, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 20480, 12288, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_LINE, 4096, 28672, 20479, 49151, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g083 = { + 7, + {{SSF_BOX, 20480, 12288, 24575, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 4095, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}} +}; + +static ssfGlyph g084 = { + 5, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 0, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 8192, 12288, 12287, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g085 = { + 3, + {{SSF_BOX, 0, 8192, 4095, 45055, 0, 0}, + {SSF_BOX, 20480, 8192, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g086 = { + 4, + {{SSF_BOX, 0, 8192, 4095, 36863, 0, 0}, + {SSF_LINE, 12287, 49151, 0, 36864, 7168, THICK_UP}, + {SSF_LINE, 12288, 49151, 24575, 36864, 7168, THICK_UP}, + {SSF_BOX, 20480, 8192, 24575, 36863, 0, 0}} +}; + +static ssfGlyph g087 = { + 4, + {{SSF_BOX, 0, 8192, 4095, 49151, 0, 0}, + {SSF_LINE, 4096, 49151, 12287, 32768, 7168, THICK_UP}, + {SSF_LINE, 12288, 32768, 20479, 49151, 7168, THICK_UP}, + {SSF_BOX, 20480, 8192, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g088 = { + 2, + {{SSF_LINE, 0, 8192, 16384, 49151, 7168, THICK_RIGHT}, + {SSF_LINE, 16384, 8192, 0, 49151, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g089 = { + 2, + {{SSF_LINE, 0, 8192, 8192, 28671, 7168, THICK_RIGHT}, + {SSF_LINE, 16384, 8192, 0, 49151, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g090 = { + 3, + {{SSF_BOX, 0, 8192, 23551, 12287, 0, 0}, + {SSF_LINE, 16384, 12288, 0, 45055, 7168, THICK_RIGHT}, + {SSF_BOX, 0, 45056, 23551, 49151, 0, 0}} +}; + +static ssfGlyph g091 = { + 3, + {{SSF_BOX, 4096, 4096, 16383, 8191, 0, 0}, + {SSF_BOX, 4096, 8192, 8191, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 16383, 53247, 0, 0}} +}; + +static ssfGlyph g092 = { + 1, + {{SSF_LINE, 0, 4096, 20476, 53247, 4096, THICK_RIGHT}} +}; + +static ssfGlyph g093 = { + 3, + {{SSF_BOX, 4096, 4096, 16383, 8191, 0, 0}, + {SSF_BOX, 12288, 8192, 16383, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 16383, 53247, 0, 0}} +}; + +static ssfGlyph g094 = { + 2, + {{SSF_LINE, 4096, 28671, 12287, 12288, 7168, THICK_UP}, + {SSF_LINE, 12288, 12288, 20479, 28671, 7168, THICK_UP}} +}; + +static ssfGlyph g095 = { + 1, + {{SSF_BOX, 0, 45060, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g096 = { + 1, + {{SSF_LINE, 8192, 4096, 16383, 16383, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g097 = { + 6, + {{SSF_BOX, 4096, 20480, 16383, 24575, 0, 0}, + {SSF_BOX, 16384, 24576, 20479, 45055, 0, 0}, + {SSF_BOX, 20480, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}, + {SSF_BOX, 0, 36864, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 32768, 16383, 36863, 0, 0}} +}; + +static ssfGlyph g098 = { + 6, + {{SSF_BOX, 0, 8192, 8191, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 4095, 49151, 0, 0}, + {SSF_BOX, 8192, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 45055, 0, 0}, + {SSF_BOX, 8192, 24576, 20479, 28671, 0, 0}} +}; + +static ssfGlyph g099 = { + 5, + {{SSF_BOX, 20480, 24576, 24575, 28671, 0, 0}, + {SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g100 = { + 6, + {{SSF_BOX, 16384, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 45055, 0, 0}, + {SSF_BOX, 20480, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}, + {SSF_BOX, 0, 28672, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 24576, 16383, 28671, 0, 0}} +}; + +static ssfGlyph g101 = { + 5, + {{SSF_BOX, 4096, 32768, 20479, 36863, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 32767, 0, 0}, + {SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g102 = { + 3, + {{SSF_BOX, 12288, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 8192, 12288, 12287, 49151, 0, 0}, + {SSF_BOX, 4096, 28672, 16383, 32767, 0, 0}} +}; + +static ssfGlyph g103 = { + 6, + {{SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 40959, 0, 0}, + {SSF_BOX, 4096, 40960, 20479, 45055, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 57343, 0, 0}, + {SSF_BOX, 4096, 57344, 20479, 61439, 0, 0}, + {SSF_BOX, 0, 53248, 4095, 57343, 0, 0}} +}; + +static ssfGlyph g104 = { + 4, + {{SSF_BOX, 0, 8192, 8191, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 49151, 0, 0}, + {SSF_BOX, 8192, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 20480, 28672, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g105 = { + 4, + {{SSF_BOX, 12288, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 8192, 20480, 16383, 24575, 0, 0}, + {SSF_BOX, 12288, 24576, 16383, 45055, 0, 0}, + {SSF_BOX, 8192, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g106 = { + 5, + {{SSF_BOX, 16384, 16384, 20479, 20479, 0, 0}, + {SSF_BOX, 12288, 28672, 20479, 32767, 0, 0}, + {SSF_BOX, 16384, 32768, 20479, 57343, 0, 0}, + {SSF_BOX, 4096, 57344, 16383, 61439, 0, 0}, + {SSF_BOX, 0, 53248, 4095, 57343, 0, 0}} +}; + +static ssfGlyph g107 = { + 7, + {{SSF_BOX, 0, 8192, 8191, 12287, 0, 0}, + {SSF_BOX, 4096, 12288, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 8191, 49151, 0, 0}, + {SSF_LINE, 16384, 20480, 8192, 32767, 7168, THICK_RIGHT}, + {SSF_LINE, 8192, 32768, 16384, 49151, 7168, THICK_RIGHT}, + {SSF_BOX, 20480, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 20480, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g108 = { + 3, + {{SSF_BOX, 4096, 8192, 12287, 12287, 0, 0}, + {SSF_BOX, 8192, 12288, 12287, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g109 = { + 5, + {{SSF_BOX, 0, 20480, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 20480, 12287, 24575, 0, 0}, + {SSF_BOX, 12288, 24576, 16383, 49151, 0, 0}, + {SSF_BOX, 16384, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 24576, 24576, 28671, 49151, 0, 0}} +}; + +static ssfGlyph g110 = { + 6, + {{SSF_BOX, 0, 20480, 4095, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 49151, 0, 0}, + {SSF_BOX, 0, 45056, 4095, 49151, 0, 0}, + {SSF_BOX, 8192, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 49151, 0, 0}, + {SSF_BOX, 24576, 45056, 28671, 49151, 0, 0}} +}; + +static ssfGlyph g111 = { + 4, + {{SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g112 = { + 6, + {{SSF_BOX, 0, 57344, 8191, 61439, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 57343, 0, 0}, + {SSF_BOX, 0, 20480, 4095, 24575, 0, 0}, + {SSF_BOX, 8192, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 40959, 0, 0}, + {SSF_BOX, 8192, 40960, 20479, 45055, 0, 0}} +}; + +static ssfGlyph g113 = { + 6, + {{SSF_BOX, 16384, 57344, 24575, 61439, 0, 0}, + {SSF_BOX, 16384, 24576, 20479, 57343, 0, 0}, + {SSF_BOX, 20480, 20480, 24575, 24575, 0, 0}, + {SSF_BOX, 4096, 20480, 16383, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 40959, 0, 0}, + {SSF_BOX, 4096, 40960, 16383, 45055, 0, 0}} +}; + +static ssfGlyph g114 = { + 4, + {{SSF_BOX, 0, 20480, 4095, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 8191, 49151, 0, 0}, + {SSF_BOX, 8192, 20480, 20479, 24575, 0, 0}} +}; + +static ssfGlyph g115 = { + 5, + {{SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 32767, 0, 0}, + {SSF_BOX, 4096, 32768, 20479, 36863, 0, 0}, + {SSF_BOX, 20480, 36864, 24575, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g116 = { + 3, + {{SSF_BOX, 4094, 16384, 24575, 20479, 0, 0}, + {SSF_BOX, 12288, 8192, 16383, 45055, 0, 0}, + {SSF_BOX, 16384, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g117 = { + 6, + {{SSF_BOX, 0, 20480, 8191, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 45055, 0, 0}, + {SSF_BOX, 8192, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 20480, 28671, 24575, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 45055, 0, 0}, + {SSF_BOX, 24576, 45056, 28671, 49151, 0, 0}} +}; + +static ssfGlyph g118 = { + 4, + {{SSF_BOX, 0, 20480, 4095, 36863, 0, 0}, + {SSF_LINE, 12287, 49151, 0, 36864, 7168, THICK_UP}, + {SSF_LINE, 12288, 49151, 24575, 36864, 7168, THICK_UP}, + {SSF_BOX, 20480, 20480, 24575, 36863, 0, 0}} +}; + +static ssfGlyph g119 = { + 4, + {{SSF_BOX, 0, 20480, 4095, 49151, 0, 0}, + {SSF_LINE, 4096, 49151, 12287, 32768, 7168, THICK_UP}, + {SSF_LINE, 12288, 32768, 20479, 49151, 7168, THICK_UP}, + {SSF_BOX, 20480, 20480, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g120 = { + 2, + {{SSF_LINE, 0, 20480, 16384, 49151, 7168, THICK_RIGHT}, + {SSF_LINE, 16384, 20480, 0, 49151, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g121 = { + 2, + {{SSF_LINE, 0, 61439, 16384, 20480, 7168, THICK_RIGHT}, + {SSF_LINE, 0, 20480, 8191, 40959, 7168, THICK_RIGHT}} +}; + +static ssfGlyph g122 = { + 3, + {{SSF_BOX, 0, 20480, 24575, 24575, 0, 0}, + {SSF_LINE, 16384, 24576, 0, 45055, 7168, THICK_RIGHT}, + {SSF_BOX, 0, 45056, 24575, 49151, 0, 0}} +}; + +static ssfGlyph g123 = { + 5, + {{SSF_BOX, 12288, 4096, 20479, 8191, 0, 0}, + {SSF_BOX, 8192, 8192, 12287, 28761, 0, 0}, + {SSF_BOX, 0, 28672, 8191, 32767, 0, 0}, + {SSF_BOX, 8192, 32768, 12287, 49151, 0, 0}, + {SSF_BOX, 12288, 49152, 20479, 53247, 0, 0}} +}; + +static ssfGlyph g124 = { + 2, + {{SSF_BOX, 12288, 4096, 16383, 24575, 0, 0}, + {SSF_BOX, 12288, 32768, 16383, 53247, 0, 0}} +}; + +static ssfGlyph g125 = { + 5, + {{SSF_BOX, 4096, 4096, 12287, 8191, 0, 0}, + {SSF_BOX, 12288, 8192, 16383, 28671, 0, 0}, + {SSF_BOX, 16384, 28672, 24575, 32767, 0, 0}, + {SSF_BOX, 12288, 32768, 16383, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 12287, 53247, 0, 0}} +}; + +static ssfGlyph g126 = { + 4, + {{SSF_BOX, 0, 28672, 4095, 32767, 0, 0}, + {SSF_BOX, 4096, 24576, 12287, 28761, 0, 0}, + {SSF_BOX, 12288, 28672, 20479, 32767, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 28671, 0, 0}} +}; + +static ssfGlyph g130 = { + 6, + {{SSF_LINE, 8192, 16383, 16384, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 4096, 32768, 20479, 36863, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 32767, 0, 0}, + {SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}} +}; + +static ssfGlyph g160 = { + 7, + {{SSF_LINE, 8192, 16383, 16384, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 4096, 20480, 16383, 24575, 0, 0}, + {SSF_BOX, 16384, 24576, 20479, 45055, 0, 0}, + {SSF_BOX, 20480, 45056, 24575, 49151, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}, + {SSF_BOX, 0, 36864, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 32768, 16383, 36863, 0, 0}} +}; + +static ssfGlyph g161 = { + 4, + {{SSF_LINE, 8192, 16383, 16384, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 4096, 20480, 12287, 24575, 0, 0}, + {SSF_BOX, 8192, 24576, 12287, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 16383, 49151, 0, 0}} +}; + +static ssfGlyph g162 = { + 5, + {{SSF_LINE, 8192, 16383, 16384, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 4096, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 45055, 0, 0}, + {SSF_BOX, 4096, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 45055, 0, 0}} +}; + +static ssfGlyph g163 = { + 7, + {{SSF_LINE, 8192, 16383, 16384, 8192, 7168, THICK_RIGHT}, + {SSF_BOX, 0, 20480, 8191, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 45055, 0, 0}, + {SSF_BOX, 8192, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 20480, 20480, 28671, 24575, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 45055, 0, 0}, + {SSF_BOX, 24576, 45056, 28671, 49151, 0, 0}} +}; + +static ssfGlyph g164 = { + 10, + {{SSF_BOX, 0, 12288, 4095, 16383, 0, 0}, + {SSF_BOX, 4096, 8192, 12287, 12287, 0, 0}, + {SSF_BOX, 12288, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 20480, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 0, 20480, 4095, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 8191, 49151, 0, 0}, + {SSF_BOX, 0, 45056, 4095, 49151, 0, 0}, + {SSF_BOX, 8192, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 49151, 0, 0}, + {SSF_BOX, 24576, 45056, 28671, 49151, 0, 0}} +}; + +static ssfGlyph g165 = { + 7, + {{SSF_BOX, 0, 12288, 4095, 49151, 0, 0}, + {SSF_LINE, 0, 12288, 20575, 45055, 4096, THICK_RIGHT}, + {SSF_BOX, 20480, 12288, 24575, 49151, 0, 0}, + {SSF_BOX, 0, 4096, 4095, 8191, 0, 0}, + {SSF_BOX, 4096, 0, 12287, 4095, 0, 0}, + {SSF_BOX, 12288, 4096, 20479, 8191, 0, 0}, + {SSF_BOX, 20480, 0, 24575, 4095, 0, 0}} +}; + +static ssfGlyph g166 = { + 6, + {{SSF_BOX, 4096, 20480, 8191, 24575, 0, 0}, + {SSF_BOX, 8192, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 24575, 0, 0}, + {SSF_BOX, 8192, 16384, 16383, 20479, 0, 0}, + {SSF_BOX, 4096, 28672, 20480, 32767, 0, 0}, + {SSF_BOX, 8192, 24576, 16383, 28671, 0, 0}} +}; + +static ssfGlyph g168 = { + 8, + {{SSF_BOX, 12288, 16384, 16383, 20479, 0, 0}, + {SSF_BOX, 12288, 28672, 16383, 32767, 0, 0}, + {SSF_BOX, 8192, 32768, 12287, 36863, 0, 0}, + {SSF_BOX, 4096, 36864, 8191, 40959, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 8191, 53247, 0, 0}, + {SSF_BOX, 8192, 53248, 20479, 57343, 0, 0}, + {SSF_BOX, 20480, 49152, 24575, 53247, 0, 0}} +}; + +static ssfGlyph g173 = { + 4, + {{SSF_BOX, 12288, 16384, 16383, 20479, 0, 0}, + {SSF_BOX, 8192, 36864, 12287, 53247, 0, 0}, + {SSF_BOX, 12288, 28672, 16383, 57343, 0, 0}, + {SSF_BOX, 16384, 36864, 20479, 53247, 0, 0}} +}; + +static ssfGlyph g167 = { + 5, + {{SSF_BOX, 4096, 12288, 8191, 20479, 0, 0}, + {SSF_BOX, 8192, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 16384, 12288, 20479, 20479, 0, 0}, + {SSF_BOX, 8192, 20480, 16383, 24575, 0, 0}, + {SSF_BOX, 4096, 28672, 20480, 32767, 0, 0}} +}; + +static ssfGlyph g176 = { + 32, + {{SSF_BOX, 0, 0, 4095, 4095, 0, 0}, + {SSF_BOX, 16384, 0, 20479, 4095, 0, 0}, + {SSF_BOX, 8192, 4096, 12287, 8191, 0, 0}, + {SSF_BOX, 24576, 4096, 28671, 8191, 0, 0}, + {SSF_BOX, 0, 8192, 4095, 12287, 0, 0}, + {SSF_BOX, 16384, 8192, 20479, 12287, 0, 0}, + {SSF_BOX, 8192, 12288, 12287, 16383, 0, 0}, + {SSF_BOX, 24576, 12288, 28671, 16383, 0, 0}, + {SSF_BOX, 0, 16384, 4095, 20479, 0, 0}, + {SSF_BOX, 16384, 16384, 20479, 20479, 0, 0}, + {SSF_BOX, 8192, 20480, 12287, 24575, 0, 0}, + {SSF_BOX, 24576, 20480, 28671, 24575, 0, 0}, + {SSF_BOX, 0, 24576, 4095, 28671, 0, 0}, + {SSF_BOX, 16384, 24576, 20479, 28671, 0, 0}, + {SSF_BOX, 8192, 28672, 12287, 32767, 0, 0}, + {SSF_BOX, 24576, 28672, 28671, 32767, 0, 0}, + {SSF_BOX, 0, 32768, 4095, 36863, 0, 0}, + {SSF_BOX, 16384, 32768, 20479, 36863, 0, 0}, + {SSF_BOX, 8192, 36864, 12287, 40959, 0, 0}, + {SSF_BOX, 24576, 36864, 28671, 40959, 0, 0}, + {SSF_BOX, 0, 40960, 4095, 45055, 0, 0}, + {SSF_BOX, 16384, 40960, 20479, 45055, 0, 0}, + {SSF_BOX, 8192, 45056, 12287, 49151, 0, 0}, + {SSF_BOX, 24576, 45056, 28671, 49151, 0, 0}, + {SSF_BOX, 0, 49152, 4095, 53247, 0, 0}, + {SSF_BOX, 16384, 49152, 20479, 53247, 0, 0}, + {SSF_BOX, 8192, 53248, 12287, 57343, 0, 0}, + {SSF_BOX, 24576, 53248, 28671, 57343, 0, 0}, + {SSF_BOX, 0, 57344, 4095, 61439, 0, 0}, + {SSF_BOX, 16384, 57344, 20479, 61439, 0, 0}, + {SSF_BOX, 8192, 61440, 12287, 65535, 0, 0}, + {SSF_BOX, 24576, 61440, 28671, 65535, 0, 0}} +}; + +static ssfGlyph g177 = { + 16, + {{SSF_BOX, 0, 0, 8191, 8191, 0, 0}, + {SSF_BOX, 16384, 0, 24575, 8191, 0, 0}, + {SSF_BOX, 8192, 8192, 16383, 16383, 0, 0}, + {SSF_BOX, 24576, 8192, 32767, 16383, 0, 0}, + {SSF_BOX, 0, 16384, 8191, 24575, 0, 0}, + {SSF_BOX, 16384, 16384, 24575, 24575, 0, 0}, + {SSF_BOX, 8192, 24576, 16383, 32767, 0, 0}, + {SSF_BOX, 24576, 24576, 32767, 32767, 0, 0}, + {SSF_BOX, 0, 32768, 8191, 40959, 0, 0}, + {SSF_BOX, 16384, 32768, 24575, 40959, 0, 0}, + {SSF_BOX, 8192, 40960, 16383, 49151, 0, 0}, + {SSF_BOX, 24576, 40960, 32767, 49151, 0, 0}, + {SSF_BOX, 0, 49152, 8191, 57343, 0, 0}, + {SSF_BOX, 16384, 49152, 24575, 57343, 0, 0}, + {SSF_BOX, 8192, 57344, 16383, 65535, 0, 0}, + {SSF_BOX, 24576, 57344, 32767, 65535, 0, 0}} +}; + +static ssfGlyph g178 = { + 32, + {{SSF_BOX, 4096, 0, 16383, 4095, 0, 0}, + {SSF_BOX, 20480, 0, 24575, 4095, 0, 0}, + {SSF_BOX, 0, 4096, 8191, 8191, 0, 0}, + {SSF_BOX, 12288, 4096, 20479, 8191, 0, 0}, + {SSF_BOX, 4096, 8192, 16383, 12287, 0, 0}, + {SSF_BOX, 20480, 8192, 24575, 12287, 0, 0}, + {SSF_BOX, 0, 12288, 8191, 16383, 0, 0}, + {SSF_BOX, 12288, 12288, 20479, 16383, 0, 0}, + {SSF_BOX, 4096, 16384, 16383, 20479, 0, 0}, + {SSF_BOX, 20480, 16384, 24575, 20479, 0, 0}, + {SSF_BOX, 0, 20480, 8191, 24575, 0, 0}, + {SSF_BOX, 12288, 20480, 20479, 24575, 0, 0}, + {SSF_BOX, 4096, 24576, 16383, 28671, 0, 0}, + {SSF_BOX, 20480, 24576, 24575, 28671, 0, 0}, + {SSF_BOX, 0, 28672, 8191, 32767, 0, 0}, + {SSF_BOX, 12288, 28672, 20479, 32767, 0, 0}, + {SSF_BOX, 4096, 32768, 16383, 36863, 0, 0}, + {SSF_BOX, 20480, 32768, 24575, 36863, 0, 0}, + {SSF_BOX, 0, 36864, 8191, 40959, 0, 0}, + {SSF_BOX, 12288, 36864, 20479, 40959, 0, 0}, + {SSF_BOX, 4096, 40960, 16383, 45055, 0, 0}, + {SSF_BOX, 20480, 40960, 24575, 45055, 0, 0}, + {SSF_BOX, 0, 45056, 8191, 49151, 0, 0}, + {SSF_BOX, 12288, 45056, 20479, 49151, 0, 0}, + {SSF_BOX, 4096, 49152, 16383, 53247, 0, 0}, + {SSF_BOX, 20480, 49152, 24575, 53247, 0, 0}, + {SSF_BOX, 0, 53248, 8191, 57343, 0, 0}, + {SSF_BOX, 12288, 53248, 20479, 57343, 0, 0}, + {SSF_BOX, 4096, 57344, 16383, 61439, 0, 0}, + {SSF_BOX, 20480, 57344, 24575, 61439, 0, 0}, + {SSF_BOX, 0, 61440, 8191, 65535, 0, 0}, + {SSF_BOX, 12288, 61440, 20479, 65535, 0, 0}} +}; + +static ssfGlyph g179 = { + 1, + {{SSF_BOX, 12288, 0, 20479, 65535, 0, 0}} +}; + +static ssfGlyph g180 = { + 2, + {{SSF_BOX, 12288, 0, 20479, 65535, 0, 0}, + {SSF_BOX, 0, 24576, 12287, 32767, 0, 0}} +}; + +static ssfGlyph g191 = { + 2, + {{SSF_BOX, 0, 24576, 20479, 32767, 0, 0}, + {SSF_BOX, 12288, 32768, 20479, 65535, 0, 0}} +}; + +static ssfGlyph g192 = { + 2, + {{SSF_BOX, 12288, 0, 20479, 32767, 0, 0}, + {SSF_BOX, 20480, 24576, 32767, 32767, 0, 0}} +}; + +static ssfGlyph g193 = { + 2, + {{SSF_BOX, 0, 24576, 32767, 32767, 0, 0}, + {SSF_BOX, 12288, 0, 20479, 24575, 0, 0}} +}; + +static ssfGlyph g194 = { + 2, + {{SSF_BOX, 0, 24576, 32767, 32767, 0, 0}, + {SSF_BOX, 12288, 32768, 20479, 65535, 0, 0}} +}; + +static ssfGlyph g195 = { + 2, + {{SSF_BOX, 12288, 0, 20479, 65535, 0, 0}, + {SSF_BOX, 20480, 24576, 32767, 32767, 0, 0}} +}; + +static ssfGlyph g196 = { + 1, + {{SSF_BOX, 0, 24576, 32767, 32767, 0, 0}} +}; + +static ssfGlyph g197 = { + 2, + {{SSF_BOX, 12288, 0, 20479, 65535, 0, 0}, + {SSF_BOX, 0, 24576, 32767, 32767, 0, 0}} +}; + +static ssfGlyph g217 = { + 2, + {{SSF_BOX, 0, 24576, 20479, 32767, 0, 0}, + {SSF_BOX, 12288, 0, 20479, 24575, 0, 0}} +}; + +static ssfGlyph g218 = { + 2, + {{SSF_BOX, 12288, 24576, 20479, 65535, 0, 0}, + {SSF_BOX, 20480, 24576, 32767, 32767, 0, 0}} +}; + +static ssfGlyph g219 = { + 1, + {{SSF_BOX, 0, 0, 32767, 65535, 0, 0}} +}; + +static ssfGlyph g220 = { + 1, + {{SSF_BOX, 0, 32768, 32767, 65535, 0, 0}} +}; + +static ssfGlyph g223 = { + 1, + {{SSF_BOX, 0, 0, 32767, 32767, 0, 0}} +}; + +static ssfGlyph *ssfFixedThinChars[] = { + &g000, + &g000, // 1 + &g000, // 2 + &g000, // 3 + &g000, // 4 + &g000, // 5 + &g000, // 6 + &g000, // 7 + &g000, // 8 + &g000, // 9 + &g000, // 10 + &g000, // 11 + &g000, // 12 + &g000, // 13 + &g000, // 14 + &g000, // 15 + &g016, + &g017, + &g000, // 18 + &g000, // 19 + &g000, // 20 + &g000, // 21 + &g000, // 22 + &g000, // 23 + &g000, // 24 + &g000, // 25 + &g000, // 26 + &g000, // 27 + &g000, // 28 + &g000, // 29 + &g030, + &g031, + &g032, + &g033, + &g034, + &g035, + &g036, + &g037, + &g038, + &g039, + &g040, + &g041, + &g042, + &g043, + &g044, + &g045, + &g046, + &g047, + &g048, + &g049, + &g050, + &g051, + &g052, + &g053, + &g054, + &g055, + &g056, + &g057, + &g058, + &g059, + &g060, + &g061, + &g062, + &g063, + &g064, + &g065, + &g066, + &g067, + &g068, + &g069, + &g070, + &g071, + &g072, + &g073, + &g074, + &g075, + &g076, + &g077, + &g078, + &g079, + &g080, + &g081, + &g082, + &g083, + &g084, + &g085, + &g086, + &g087, + &g088, + &g089, + &g090, + &g091, + &g092, + &g093, + &g094, + &g095, + &g096, + &g097, + &g098, + &g099, + &g100, + &g101, + &g102, + &g103, + &g104, + &g105, + &g106, + &g107, + &g108, + &g109, + &g110, + &g111, + &g112, + &g113, + &g114, + &g115, + &g116, + &g117, + &g118, + &g119, + &g120, + &g121, + &g122, + &g123, + &g124, + &g125, + &g126, + &g000, // 127 + &g000, // 128 + &g000, // 129 + &g130, + &g000, // 131 + &g000, // 132 + &g000, // 133 + &g000, // 134 + &g000, // 135 + &g000, // 136 + &g000, // 137 + &g000, // 138 + &g000, // 139 + &g000, // 140 + &g000, // 141 + &g000, // 142 + &g000, // 143 + &g000, // 144 + &g000, // 145 + &g000, // 146 + &g000, // 147 + &g000, // 148 + &g000, // 149 + &g000, // 150 + &g000, // 151 + &g000, // 152 + &g000, // 153 + &g000, // 154 + &g000, // 155 + &g000, // 156 + &g000, // 157 + &g000, // 158 + &g000, // 159 + &g160, + &g161, + &g162, + &g163, + &g164, + &g165, + &g166, + &g167, + &g168, + &g000, // 169 + &g000, // 170 + &g000, // 171 + &g000, // 172 + &g173, + &g000, // 174 + &g000, // 175 + &g176, + &g177, + &g178, + &g179, + &g180, + &g000, // 181 + &g000, // 182 + &g000, // 183 + &g000, // 184 + &g180, // 185 + &g179, // 186 + &g191, // 187 + &g217, // 188 + &g000, // 189 + &g000, // 190 + &g191, + &g192, + &g193, + &g194, + &g195, + &g196, + &g197, + &g000, // 198 + &g000, // 199 + &g192, // 200 + &g218, // 201 + &g193, // 202 + &g194, // 203 + &g195, // 204 + &g196, // 205 + &g197, // 206 + &g000, // 207 + &g000, // 208 + &g000, // 209 + &g000, // 210 + &g000, // 211 + &g000, // 212 + &g000, // 213 + &g000, // 214 + &g000, // 215 + &g000, // 216 + &g217, + &g218, + &g219, + &g220, + &g000, // 221 + &g000, // 222 + &g223, + &g000, // 224 + &g000, // 225 + &g000, // 226 + &g000, // 227 + &g000, // 228 + &g000, // 229 + &g000, // 230 + &g000, // 231 + &g000, // 232 + &g000, // 233 + &g000, // 234 + &g000, // 235 + &g000, // 236 + &g000, // 237 + &g000, // 238 + &g000, // 239 + &g000, // 240 + &g000, // 241 + &g000, // 242 + &g000, // 243 + &g000, // 244 + &g000, // 245 + &g000, // 246 + &g000, // 247 + &g000, // 248 + &g000, // 249 + &g000, // 250 + &g000, // 251 + &g000, // 252 + &g000, // 253 + &g000, // 254 + &g000, // 255 +}; + +static ssfFont ssfFixedThinFont = { + 16, // default pitch + ssfFixedThinChars // chars +}; diff --git a/harbour/source/rtl/gtalleg/gtalleg.c b/harbour/source/rtl/gtalleg/gtalleg.c new file mode 100644 index 0000000000..6abc75fdee --- /dev/null +++ b/harbour/source/rtl/gtalleg/gtalleg.c @@ -0,0 +1,1227 @@ +/* + * $Id$ + */ + +/* +* xHarbour Project source code: +* Allegro based virtual gt with graphic extensions. +* +* Copyright 2004 Mauricio Abre +* www - http://www.xharbour.org +* 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. +* +*/ + +#define HB_GT_NAME ALLEG + +#include "ssf.h" + +#include "hbgtcore.h" +#include "hbinit.h" +#include "hbvm.h" +#include "hbapi.h" +#include "hbapiitm.h" +#include "hbapierr.h" +#include "hbapifs.h" + +#include "inkey.ch" +#include "hbgfxdef.ch" + +static HB_GT_FUNCS SuperTable; +#define HB_GTSUPER (&SuperTable) +static BOOL s_fInit; +static BOOL s_fMakeInit; +static BOOL s_fGtError; + +static int s_iMsButtons, s_iMSBoundTop, s_iMSBoundLeft, s_iMSBoundBottom, s_iMSBoundRight; +static int s_iMSX, s_iMSY; +static BYTE s_byMSButtons; +static int s_iScrWidth = 80, s_iScrHeight = 25; +static int s_iGFXWidth = 0, s_iGFXHeight = 0; +static int s_iGFXUpdTop, s_iGFXUpdLeft, s_iGFXUpdBottom, s_iGFXUpdRight; +static int s_iCTop, s_iCLeft, s_iCBottom, s_iCRight; +static int s_iCurCol, s_iCurRow; +static int s_iCursorStyle; +static int s_pClr[16]; +static BYTE s_byFontSize = 16, s_byFontWidth = 8; +static AL_BITMAP * bmp = NULL; + +/* + * I'm not sure of removing these (yet) + * (they used to be static vars to center gt in hw screen, but now the + * font size is set based on screen size, so gtAlleg will use about all screen) + * + * NOTE: This is only a Linux fb & DOS issue, where we don't have windows + */ +#define s_iHBorder 0 +#define s_iVBorder 0 + +typedef struct { + int al_key; + int xhb_key; +} gtAllegKey; + +#define GT_KEY_TABLE_SIZE 49 + +static const gtAllegKey sKeyTable[GT_KEY_TABLE_SIZE] = { + {AL_KEY_ESC, K_ESC}, + {AL_KEY_INSERT, K_INS}, + {AL_KEY_HOME, K_HOME}, + {AL_KEY_PGUP, K_PGUP}, + {AL_KEY_PGDN, K_PGDN}, + {AL_KEY_END, K_END}, + {AL_KEY_DEL, K_DEL}, + {AL_KEY_UP, K_UP}, + {AL_KEY_DOWN, K_DOWN}, + {AL_KEY_LEFT, K_LEFT}, + {AL_KEY_RIGHT, K_RIGHT}, + {AL_KEY_A, K_ALT_A}, + {AL_KEY_B, K_ALT_B}, + {AL_KEY_C, K_ALT_C}, + {AL_KEY_D, K_ALT_D}, + {AL_KEY_E, K_ALT_E}, + {AL_KEY_F, K_ALT_F}, + {AL_KEY_G, K_ALT_G}, + {AL_KEY_H, K_ALT_H}, + {AL_KEY_I, K_ALT_I}, + {AL_KEY_J, K_ALT_J}, + {AL_KEY_K, K_ALT_K}, + {AL_KEY_L, K_ALT_L}, + {AL_KEY_M, K_ALT_M}, + {AL_KEY_N, K_ALT_N}, + {AL_KEY_O, K_ALT_O}, + {AL_KEY_P, K_ALT_P}, + {AL_KEY_Q, K_ALT_Q}, + {AL_KEY_R, K_ALT_R}, + {AL_KEY_S, K_ALT_S}, + {AL_KEY_T, K_ALT_T}, + {AL_KEY_U, K_ALT_U}, + {AL_KEY_V, K_ALT_V}, + {AL_KEY_W, K_ALT_W}, + {AL_KEY_X, K_ALT_X}, + {AL_KEY_Y, K_ALT_Y}, + {AL_KEY_Z, K_ALT_Z}, + {AL_KEY_F1, K_F1}, + {AL_KEY_F2, K_F2}, + {AL_KEY_F3, K_F3}, + {AL_KEY_F4, K_F4}, + {AL_KEY_F5, K_F5}, + {AL_KEY_F6, K_F6}, + {AL_KEY_F7, K_F7}, + {AL_KEY_F8, K_F8}, + {AL_KEY_F9, K_F9}, + {AL_KEY_F10, K_F10}, + {AL_KEY_F11, K_F11}, + {AL_KEY_F12, K_F12} +}; + +#define GT_CTRL_TABLE_SIZE 11 + +static const gtAllegKey sCtrlTable[GT_CTRL_TABLE_SIZE] = { + {AL_KEY_LEFT, K_CTRL_LEFT}, + {AL_KEY_RIGHT, K_CTRL_RIGHT}, + {AL_KEY_UP, K_CTRL_UP}, + {AL_KEY_DOWN, K_CTRL_DOWN}, + {AL_KEY_QUOTE, K_CTRL_PRTSCR}, + {AL_KEY_INSERT, K_CTRL_INS}, + {AL_KEY_DEL, K_CTRL_DEL}, + {AL_KEY_HOME, K_CTRL_HOME}, + {AL_KEY_END, K_CTRL_END}, + {AL_KEY_PGUP, K_CTRL_PGUP}, + {AL_KEY_PGDN, K_CTRL_PGDN} +}; + +#define GT_UPD_GFXRECT(t,l,b,r) do {if (ts_iGFXUpdBottom) s_iGFXUpdBottom=b; if (r>s_iGFXUpdRight) s_iGFXUpdRight=r;} while(0) +#define GT_SCREENINIT() do {if (!s_fInit) hb_gt_alleg_InitializeScreen(s_iScrHeight, s_iScrWidth, TRUE);} while(0) +#define MK_GT8BCOLOR(n) ((n & 0xFF) / 16 | (n & 0xFF00) / 256) + + +static void hb_gt_alleg_Error( char * szMsg ) +{ + s_fGtError = TRUE; + hb_errInternal( 9997, "%s: %s", szMsg, allegro_error ); +} + +static BOOL hb_gt_alleg_CursorRect( int iRow, int iCol, int iStyle, + int * piTop, int * piLeft, + int * piBottom, int * piRight ) +{ + *piLeft = s_iHBorder + iCol * s_byFontWidth; + *piRight = *piLeft + s_byFontWidth - 1; + *piTop = s_iVBorder + iRow * s_byFontSize; + *piBottom = *piTop; + + switch( iStyle ) + { + case SC_NORMAL: + *piBottom += s_byFontSize - 1; + *piTop = *piBottom - 1; + break; + + case SC_INSERT: + *piBottom += s_byFontSize - 1; + *piTop = *piBottom - ( s_byFontSize / 2 ) + 1; + break; + + case SC_UNDEF: + case SC_SPECIAL1: + *piBottom += s_byFontSize - 1; + break; + + case SC_SPECIAL2: + *piBottom += ( s_byFontSize / 2 ) - 1; + break; + + default: + return FALSE; + } + + return TRUE; +} + +static void hb_gt_alleg_DoCursor( int iRow, int iCol, int iStyle ) +{ + int iTop, iLeft, iBottom, iRight; + + /* Hide the previous cursor */ + if( s_iCursorStyle != SC_NONE && + hb_gt_alleg_CursorRect( s_iCurRow, s_iCurCol, s_iCursorStyle, + &iTop, &iLeft, &iBottom, &iRight ) ) + { + al_scare_mouse_area( iLeft, iTop, iRight, iBottom ); + al_blit( bmp, al_screen, iLeft, iTop, iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1 ); + al_unscare_mouse(); + } + /* Show the new one */ + if( iStyle != SC_NONE && + hb_gt_alleg_CursorRect( iRow, iCol, iStyle, + &iTop, &iLeft, &iBottom, &iRight ) ) + { + al_drawing_mode( DRAW_MODE_XOR, NULL, 0, 0 ); + al_scare_mouse_area( iLeft, iTop, iRight, iBottom ); + al_draw_rect_fill( al_screen, iLeft, iTop, iRight, iBottom, s_pClr[7] ); + al_unscare_mouse(); + al_drawing_mode( DRAW_MODE_SOLID, NULL, 0, 0 ); + } + s_iCurRow = iRow; + s_iCurCol = iCol; + s_iCursorStyle = iStyle; +} + +static void hb_gt_alleg_ScreenUpdate( void ) +{ + int iRow, iCol, iStyle; + BOOL fPix, fCursor; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_ScreenUpdate()")); + + hb_gt_GetScrCursor( &iRow, &iCol, &iStyle ); + fPix = s_iGFXUpdTop <= s_iGFXUpdBottom && s_iGFXUpdLeft <= s_iGFXUpdRight; + fCursor = s_iCurRow != iRow || s_iCurCol != iCol || s_iCursorStyle != iStyle; + + if( fPix || fCursor ) + { + al_acquire_screen(); + + if( fPix ) + { + al_scare_mouse_area( s_iGFXUpdLeft, s_iGFXUpdTop, s_iGFXUpdRight, s_iGFXUpdBottom ); + al_blit( bmp, al_screen, s_iGFXUpdLeft, s_iGFXUpdTop, s_iGFXUpdLeft, s_iGFXUpdTop, s_iGFXUpdRight - s_iGFXUpdLeft + 1, s_iGFXUpdBottom - s_iGFXUpdTop + 1 ); + al_unscare_mouse(); + } + if( fCursor ) + { + hb_gt_alleg_DoCursor( iRow, iCol, iStyle ); + } + al_release_screen(); + + s_iGFXUpdTop = s_iScrHeight * s_byFontSize; + s_iGFXUpdLeft = s_iScrWidth * s_byFontWidth; + s_iGFXUpdBottom = 0; + s_iGFXUpdRight = 0; + } +} + +static BOOL hb_gt_alleg_InitializeScreen( int iRows, int iCols, BOOL lClearInit ) +{ + PHB_FNAME pFileName; + int iRet = 1, iWidth, iHeight; /* Don't remove iRet, ixFP and iyFP initializers! */ + short ixFP = 0, iyFP = 0; + BOOL lMode = FALSE, lPrev = s_fInit; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_InitializeScreen(%d, %d, %d)", iRows, iCols, (int) lClearInit )); + + if( s_fGtError ) + { + return FALSE; + } + + if ( lPrev ) + { + al_destroy_bitmap(bmp); + bmp = NULL; + } + + if ( s_iGFXWidth != 0 && s_iGFXHeight != 0 ) + { + iWidth = (int) s_iGFXWidth; + iHeight = (int) s_iGFXHeight; + } + else + { + iWidth = s_byFontWidth * iCols; + iHeight = s_byFontSize * iRows; + } + + if ( iRows > 11 && iCols > 23 && iRows < 129 && iCols < 257 ) + { +#if defined(AL_GFX_XWINDOWS) + HB_TRACE(HB_TR_DEBUG, ("trying X DGA2 mode")); + iRet = al_set_gfx_mode( AL_GFX_XDGA2, iWidth, iHeight, 0, 0 ); + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying X DGA mode")); + iRet = al_set_gfx_mode( AL_GFX_XDGA, iWidth, iHeight, 0, 0 ); + } + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying X Windows mode")); + iRet = al_set_gfx_mode( AL_GFX_XWINDOWS, iWidth, iHeight, 0, 0 ); + } +#endif +#if defined (ALLEGRO_UNIX) || defined(ALLEGRO_LINUX) || defined(ALLEGRO_DOS) + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying VBE/AF mode")); + iRet = al_set_gfx_mode( AL_GFX_VBEAF, iWidth, iHeight, 0, 0 ); + } +#endif +#if (defined(ALLEGRO_UNIX) || defined(ALLEGRO_LINUX)) && defined(AL_GFX_FBCON) + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying fb console mode")); + iRet = al_set_gfx_mode( AL_GFX_FBCON, iWidth, iHeight, 0, 0 ); + } +#endif + /* Trying safe (slower) modes */ + /* Try a windowed mode first */ + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying autodetect windowed mode")); + iRet = al_set_gfx_mode( AL_GFX_AUTODETECT_WINDOWED, iWidth, iHeight, 0, 0 ); + } +#ifdef ALLEGRO_WINDOWS + /* GDI is slower, but it is more likely to bring a windowed mode than DirectX */ + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying GDI windowed mode")); + iRet = al_set_gfx_mode( AL_GFX_GDI, iWidth, iHeight, 0, 0 ); + } + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying DirectX windowed mode")); + iRet = al_set_gfx_mode( AL_GFX_DIRECTX_WIN, iWidth, iHeight, 0, 0 ); + } +#endif + if ( iRet != 0 ) + { + HB_TRACE(HB_TR_DEBUG, ("trying autodetect console mode")); + iRet = al_set_gfx_mode( AL_GFX_AUTODETECT, iWidth, iHeight, 0, 0 ); + } + if ( iRet != 0 ) + { + /* If that fails (ie, plain DOS or Linux VESA Framebuffer) + ensure to get any available gfx mode */ + HB_TRACE(HB_TR_DEBUG, ("trying safe mode")); + iRet = al_set_gfx_mode(AL_GFX_SAFE, iWidth, iHeight, 0, 0 ); + } + if ( iRet != 0 ) /* Doh! */ + { + if ( lPrev ) + { + iCols = s_iScrWidth; + iRows = s_iScrHeight; + } + else + { + hb_gt_alleg_Error( "Could not switch to graphic mode" ); + } + } + else + { + lMode = TRUE; + } + + pFileName = hb_fsFNameSplit(hb_cmdargARGV()[0]); + al_set_window_title(pFileName->szName); + hb_xfree( pFileName ); + + if ( !lPrev ) + { + al_install_timer(); + al_install_keyboard(); + s_iMsButtons = al_install_mouse(); + } + + s_fInit = TRUE; + s_iMSBoundLeft = 0; + s_iMSBoundTop = 0; + s_iMSBoundRight = AL_SCREEN_W - 1; + s_iMSBoundBottom = AL_SCREEN_H - 1; + s_byMSButtons = (BYTE) al_mouse_b; + al_show_mouse(al_screen); + s_iScrWidth = iCols; + s_iScrHeight = iRows; + + /* WAS: Center console in screen if we got a larger resolution than requested + * NOW: Calculate proper font size + * eg: Linux vesafb (doesn't support mode switching) + * or for DOS, we'll mostly request unavailable resolutions + */ + if ( AL_SCREEN_W != s_byFontWidth * s_iScrWidth ) + { + ixFP = (BYTE) (AL_SCREEN_W / s_iScrWidth) * 2; + } + + if ( AL_SCREEN_H != s_byFontSize * s_iScrHeight ) + { + iyFP = (BYTE) (AL_SCREEN_H / s_iScrHeight); + if ( iyFP % 2 == 1 ) + { + iyFP--; + } + } + + if ( ixFP || iyFP ) + { + if ( !ixFP ) + { + ixFP = iyFP; + } + if ( !iyFP ) + { + iyFP = ixFP; + } + s_byFontSize = ( ixFP < iyFP ? ixFP : iyFP ); + s_byFontWidth = s_byFontSize / 2; + } + + s_iMSX = al_mouse_x / s_byFontWidth; + s_iMSY = al_mouse_y / s_byFontSize; + s_iGFXUpdTop = s_iScrHeight; + s_iGFXUpdLeft = s_iScrWidth; + s_iGFXUpdBottom = 0; + s_iGFXUpdRight = 0; + s_iCTop = 0; + s_iCLeft = 0; + s_iCBottom = AL_SCREEN_H - 1; + s_iCRight = AL_SCREEN_W - 1; + s_iCurCol = 0; + s_iCurRow = 0; + s_iCursorStyle = SC_NONE; + ssfSetFontSize(ssfDefaultFont, s_byFontSize); + s_pClr[ 0] = al_make_color(0x00, 0x00, 0x00); /* black */ + s_pClr[ 1] = al_make_color(0x00, 0x00, 0xAA); /* blue */ + s_pClr[ 2] = al_make_color(0x00, 0xAA, 0x00); /* green */ + s_pClr[ 3] = al_make_color(0x00, 0xAA, 0xAA); /* cyan */ + s_pClr[ 4] = al_make_color(0xAA, 0x00, 0x00); /* red */ + s_pClr[ 5] = al_make_color(0xAA, 0x00, 0xAA); /* magenta */ + s_pClr[ 6] = al_make_color(0xAA, 0x55, 0x00); /* brown */ + s_pClr[ 7] = al_make_color(0xAA, 0xAA, 0xAA); /* white */ + s_pClr[ 8] = al_make_color(0x55, 0x55, 0x55); /* gray */ + s_pClr[ 9] = al_make_color(0x55, 0x55, 0xFF); /* bright blue */ + s_pClr[10] = al_make_color(0x55, 0xFF, 0x55); /* bright green */ + s_pClr[11] = al_make_color(0x55, 0xFF, 0xFF); /* bright cyan */ + s_pClr[12] = al_make_color(0xFF, 0x55, 0x55); /* bright red */ + s_pClr[13] = al_make_color(0xFF, 0x55, 0xFF); /* bright magenta */ + s_pClr[14] = al_make_color(0xFF, 0xFF, 0x55); /* yellow */ + s_pClr[15] = al_make_color(0xFF, 0xFF, 0xFF); /* bright white */ + + bmp = al_create_system_bitmap(AL_SCREEN_W, AL_SCREEN_H); + if ( bmp == NULL ) + { + bmp = al_create_bitmap(AL_SCREEN_W, AL_SCREEN_H); + if ( bmp == NULL ) + { + hb_gt_alleg_Error( "Could not allocate double buffer bitmap" ); + } + } + + if ( !lClearInit ) + { + BYTE bColor = s_pClr[ ( hb_gt_GetClearColor() >> 4 ) & 0x0f ]; + al_clear_to_color( bmp, bColor ); + al_clear_to_color( al_screen, bColor ); + } + + HB_GTSUPER_RESIZE( s_iScrHeight, s_iScrWidth ); + hb_gt_ExposeArea( 0, 0, s_iScrHeight, s_iScrWidth ); + hb_gt_Refresh(); + } + + s_iGFXWidth = 0; + s_iGFXHeight = 0; + + return lMode; +} + +static void hb_gt_alleg_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE hFilenoStderr ) +{ + int iRet; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Init(%p,%p,%p)", hFilenoStdin, hFilenoStdout, hFilenoStderr)); + + s_iCursorStyle = SC_NONE; + s_fMakeInit = s_fGtError = FALSE; + + if( allegro_init() != 0 ) + { + hb_gt_alleg_Error( "Screen driver initialization failure" ); + } + + iRet = al_desktop_color_depth(); + + if ( iRet > 0 ) + { + al_set_color_depth( iRet ); + } + + HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr ); + HB_GTSUPER_RESIZE( s_iScrHeight, s_iScrWidth ); +} + +static void hb_gt_alleg_Exit( void ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Exit()")); + + HB_GTSUPER_EXIT(); + + if ( bmp ) + { + al_destroy_bitmap( bmp ); + bmp = NULL; + } +} + +static char * hb_gt_alleg_Version( int iType ) +{ + if ( iType == 0 ) + return HB_GT_DRVNAME( HB_GT_NAME ); + + return "Harbour Terminal: Multiplatform Allegro graphics console"; +} + +static BOOL hb_gt_alleg_SetMode( int iRows, int iCols ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_SetMode(%d, %d)", iRows, iCols)); + + return hb_gt_alleg_InitializeScreen( iRows, iCols, TRUE ); +} + +static int hb_gt_alleg_ReadKey( int iEventMask ) +{ + int nKey = 0; + int i, iMSX, iMSY; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_ReadKey(%d)", iEventMask)); + + GT_SCREENINIT(); + + if ( al_mouse_needs_poll() ) + { + al_poll_mouse(); + } + + iMSX = al_mouse_x / s_byFontWidth; + iMSY = al_mouse_y / s_byFontSize; + if ( iMSX != s_iMSX || iMSY != s_iMSY ) + { + s_iMSX = iMSX; + s_iMSY = iMSY; + if ( iEventMask & INKEY_MOVE ) + { + nKey = K_MOUSEMOVE; + } + } + + if ( ( nKey == 0 ) && ( (BYTE) al_mouse_b != s_byMSButtons ) ) + { + if ( ( al_mouse_b & 1 ) != ( s_byMSButtons & 1 ) ) + { + if ( al_mouse_b & 1 ) + { + if ( iEventMask & INKEY_LDOWN ) + { + nKey = K_LBUTTONDOWN; + } + } + else + { + if ( iEventMask & INKEY_LUP ) + { + nKey = K_LBUTTONUP; + } + } + } else if ( ( al_mouse_b & 2 ) != ( s_byMSButtons & 2 ) ) + { + if ( al_mouse_b & 2 ) + { + if ( iEventMask & INKEY_RDOWN ) + { + nKey = K_RBUTTONDOWN; + } + } + else + { + if ( iEventMask & INKEY_RUP ) + { + nKey = K_RBUTTONUP; + } + } + } /* else if ( ( al_mouse_b & 4 ) != ( s_byMSButtons & 4 ) ) + { + if ( al_mouse_b & 4 ) + { + if ( iEventMask & INKEY_MDOWN ) + { + nKey = K_MBUTTONDOWN; + } + } else + { + if ( iEventMask & INKEY_MUP ) + { + nKey = K_MBUTTONUP; + } + } + } */ + /* We need to define INKEY_M* & K_MBUTTON* in inkey.ch ! */ + s_byMSButtons = (BYTE) al_mouse_b; + } + + if ( ( nKey == 0 ) && ( iEventMask & INKEY_KEYBOARD ) ) + { + if ( al_keyboard_needs_poll() ) + { + al_poll_keyboard(); + } + + if ( al_key_pressed() ) + { + nKey = al_read_key(); + } + +#ifdef DEBUG + if (nKey != 0) + { + /* Good standard debuging... */ + printf("gtAlleg: Scancode: %d (0x%0x) ascii: %d (0x%0x) raw: %d (0x%0x)\n", nKey>>8, nKey>>8, nKey&0xff, nKey&0xff, nKey, nKey); + } +#endif + + if ( ( ( nKey & 255 ) == 2 || ( nKey & 255 ) == 3 ) && ( nKey >> 8 ) > 31 ) /* K_CTRL_ + navigation key */ + { + for ( i = 0; i < GT_CTRL_TABLE_SIZE; i++ ) + { + if ( ( nKey >> 8 ) == sCtrlTable[i].al_key ) + { + nKey = sCtrlTable[i].xhb_key; + break; + } + } + } + else if ( ( nKey != 0 ) && ( ( nKey & 255 ) < 32 ) && ( ( nKey & 255 ) == ( nKey >> 8 ) ) ) /* K_CTRL_A .. Z */ + { +#ifdef HB_NEW_KCTRL + nKey = 512 + ( nKey & 255 ); +#else + nKey = nKey & 255; +#endif + } + else if ( ( ( ( nKey & 255 ) == 1 ) || ( ( nKey & 255 ) == 4 ) ) && ( ( ( nKey >> 8 ) >= AL_KEY_F1 ) && ( ( nKey >> 8 ) <= AL_KEY_F12 ) ) ) /* K_SH_F1 .. F12, K_ALT_F1..F12 */ + { + if ( ( nKey & 255 ) == 1 ) + { + int iFKeys[12] = {K_SH_F1, K_SH_F2, K_SH_F2, K_SH_F4, K_SH_F5, K_SH_F6, + K_SH_F7, K_SH_F8, K_SH_F9, K_SH_F10, K_SH_F11, K_SH_F12}; + nKey = iFKeys[( nKey >> 8 ) - AL_KEY_F1]; + } + else + { + int iFKeys[12] = {K_ALT_F1, K_ALT_F2, K_ALT_F2, K_ALT_F4, K_ALT_F5, K_ALT_F6, + K_ALT_F7, K_ALT_F8, K_ALT_F9, K_ALT_F10, K_ALT_F11, K_ALT_F12}; + nKey = iFKeys[( nKey >> 8 ) - AL_KEY_F1]; + } + } + else if ( nKey & 255 ) + { + nKey = nKey & 255; + } + else if ( nKey != 0 ) + { + for ( i = 0; i < GT_KEY_TABLE_SIZE; i++ ) + { + if ( ( nKey >> 8 ) == sKeyTable[i].al_key ) + { + nKey = sKeyTable[i].xhb_key; + break; + } + } + } + } + + return nKey; +} + +static BOOL hb_gt_alleg_mouse_IsPresent( void ) +{ + return TRUE; +} + +static void hb_gt_alleg_mouse_GetPos( int * piRow, int * piCol ) +{ + GT_SCREENINIT(); + + if ( al_mouse_needs_poll() ) + { + al_poll_mouse(); + } + + *piRow = al_mouse_y / s_byFontSize; + *piCol = al_mouse_x / s_byFontWidth; +} + +static void hb_gt_alleg_mouse_SetPos( int iRow, int iCol ) +{ + GT_SCREENINIT(); + + al_position_mouse(iCol * s_byFontWidth, iRow * s_byFontSize); +} + +static BOOL hb_gt_alleg_mouse_ButtonState( int iButton ) +{ + GT_SCREENINIT(); + + if ( al_mouse_needs_poll() ) + { + al_poll_mouse(); + } + + return ( al_mouse_b & ( 1 << ( iButton - 1 ) ) ) != 0; +} + +static int hb_gt_alleg_mouse_CountButton( void ) +{ + GT_SCREENINIT(); + + return s_iMsButtons; +} + +static void hb_gt_alleg_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) +{ + GT_SCREENINIT(); + + if ( iTop > -1 && iTop * s_byFontSize < AL_SCREEN_H ) + { + s_iMSBoundTop = iTop * s_byFontSize; + } + + if ( iLeft > -1 && iLeft * s_byFontWidth < AL_SCREEN_W ) + { + s_iMSBoundLeft = iLeft * s_byFontWidth; + } + + if ( iBottom >= iTop && iBottom * s_byFontSize < AL_SCREEN_H ) + { + s_iMSBoundBottom = iBottom * s_byFontSize; + } + + if ( iRight >= iLeft && iRight * s_byFontWidth < AL_SCREEN_W ) + { + s_iMSBoundRight = iRight * s_byFontWidth; + } + + al_set_mouse_range( s_iMSBoundLeft, s_iMSBoundTop, s_iMSBoundRight, s_iMSBoundBottom ); +} + +static void hb_gt_alleg_mouse_GetBounds( int *piTop, int *piLeft, int *piBottom, int *piRight ) +{ + GT_SCREENINIT(); + + *piTop = s_iMSBoundTop; + *piLeft = s_iMSBoundLeft; + *piBottom = s_iMSBoundBottom; + *piRight = s_iMSBoundRight; +} + +static BOOL hb_gt_alleg_Info( int iType, PHB_GT_INFO pInfo ) +{ + int iWidth, iHeight, iValue; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_Info(%d, %p)", iType, pInfo)); + + switch( iType ) + { + case GTI_ISGRAPHIC: + pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE ); + break; + + case GTI_INPUTFD: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, -1 ); + break; + + case GTI_SCREENWIDTH: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ? + AL_SCREEN_W : s_byFontWidth * s_iScrWidth ); + iWidth = hb_itemGetNI( pInfo->pNewVal ); + if( iWidth > 0 ) + { + s_iGFXWidth = iWidth; + /* hb_gt_alleg_InitializeScreen(s_iScrHeight, s_iScrWidth, s_fInit); */ + } + break; + + case GTI_SCREENHEIGHT: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ? + AL_SCREEN_H : s_byFontSize * s_iScrHeight ); + iHeight = hb_itemGetNI( pInfo->pNewVal ); + if( iHeight > 0 ) + { + s_iGFXHeight = iHeight; + hb_gt_alleg_InitializeScreen(s_iScrHeight, s_iScrWidth, s_fInit); + } + break; + + case GTI_SCREENDEPTH: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_fInit ? + al_bitmap_color_depth( al_screen ) : al_desktop_color_depth() ); + iValue = hb_itemGetNI( pInfo->pNewVal ); + if( iValue == 8 || iValue == 15 || iValue == 16 || + iValue == 24 || iValue == 32 ) + { + al_set_color_depth( iValue ); + hb_gt_alleg_InitializeScreen(s_iScrHeight, s_iScrWidth, s_fInit); + } + break; + + case GTI_FONTSIZE: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_byFontSize ); + iValue = hb_itemGetNI( pInfo->pNewVal ); + if ( iValue > 0 && iValue < 256 ) + { + s_byFontSize = ( BYTE ) iValue; + s_byFontWidth = s_byFontSize / 2; + hb_gt_alleg_InitializeScreen(s_iScrHeight, s_iScrWidth, s_fInit); + } + break; + + case GTI_FONTWIDTH: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_byFontWidth ); + break; + + case GTI_DESKTOPWIDTH: + al_get_desktop_resolution( &iWidth, &iHeight ); + pInfo->pResult = hb_itemPutNI( pInfo->pResult, iWidth ); + break; + + case GTI_DESKTOPHEIGHT: + al_get_desktop_resolution( &iWidth, &iHeight ); + pInfo->pResult = hb_itemPutNI( pInfo->pResult, iHeight ); + break; + + case GTI_DESKTOPDEPTH: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, al_desktop_color_depth() ); + break; + + case GTI_KBDSHIFTS: + if ( al_keyboard_needs_poll() ) + { + al_poll_keyboard(); + } + pInfo->pResult = hb_itemPutNI( pInfo->pResult, al_key_shifts ); + if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) + { + al_set_keyboard_leds( hb_itemGetNI( pInfo->pNewVal ) ); + } + break; + + case GTI_WINTITLE: + if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) + { + al_set_window_title( hb_itemGetCPtr( pInfo->pNewVal ) ); + } + break; + + case GTI_VIEWMAXWIDTH: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_iScrWidth ); + break; + + case GTI_VIEWMAXHEIGHT: + pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_iScrHeight ); + break; + + default: + return HB_GTSUPER_INFO( iType, pInfo ); + } + + return TRUE; +} + +/* ********** Graphics API ********** */ + +static int hb_gt_alleg_gfx_Primitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +{ + int iRet = 1; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_gfx_Primitive(%d, %d, %d, %d, %d, %d)", iType, iTop, iLeft, iBottom, iRight, iColor)); + + GT_SCREENINIT(); + hb_gt_Refresh(); + + switch (iType) + { + case GFX_ACQUIRESCREEN: + al_acquire_bitmap(bmp); + break; + + case GFX_RELEASESCREEN: + al_release_bitmap(bmp); + break; + + case GFX_MAKECOLOR: + iRet = al_make_color(iTop, iLeft, iBottom); + break; + + case GFX_CLIPTOP: + iRet = s_iCTop; + break; + + case GFX_CLIPLEFT: + iRet = s_iCLeft; + break; + + case GFX_CLIPBOTTOM: + iRet = s_iCBottom; + break; + + case GFX_CLIPRIGHT: + iRet = s_iCRight; + break; + + case GFX_SETCLIP: + al_set_clip(bmp, iLeft, iTop, iRight, iBottom); + s_iCTop = iTop; + s_iCLeft = iLeft; + s_iCBottom = iBottom; + s_iCRight = iRight; + break; + + case GFX_DRAWINGMODE: + iRet = GFX_MODE_SOLID; + break; + + case GFX_GETPIXEL: + iRet = al_get_pixel(bmp, iLeft, iTop); + break; + + case GFX_PUTPIXEL: + al_acquire_bitmap(bmp); + al_put_pixel(bmp, iLeft, iTop, iBottom); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop,iLeft,iTop,iLeft); + break; + + case GFX_LINE: + al_acquire_bitmap(bmp); + if ( iLeft == iRight ) + al_draw_vline(bmp, iLeft, iTop, iBottom, iColor); + else if ( iTop == iBottom ) + al_draw_hline(bmp, iLeft, iTop, iRight, iColor); + else + al_draw_line(bmp, iLeft, iTop, iRight, iBottom, iColor); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop,iLeft,iBottom,iRight); + break; + + case GFX_RECT: + al_acquire_bitmap(bmp); + al_draw_rect(bmp, iLeft, iTop, iRight, iBottom, iColor); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop,iLeft,iBottom,iRight); + break; + + case GFX_FILLEDRECT: + al_acquire_bitmap(bmp); + al_draw_rect_fill(bmp, iLeft, iTop, iRight, iBottom, iColor); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop,iLeft,iBottom,iRight); + break; + + case GFX_CIRCLE: + al_acquire_bitmap(bmp); + al_draw_circle(bmp, iLeft, iTop, iBottom, iRight); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop-iBottom,iLeft-iBottom,iTop+iBottom,iLeft+iBottom); + break; + + case GFX_FILLEDCIRCLE: + al_acquire_bitmap(bmp); + al_draw_circle_fill(bmp, iLeft, iTop, iBottom, iRight); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop-iBottom,iLeft-iBottom,iTop+iBottom,iLeft+iBottom); + break; + + case GFX_ELLIPSE: + al_acquire_bitmap(bmp); + al_draw_ellipse(bmp, iLeft, iTop, iRight, iBottom, iColor); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop-iBottom,iLeft-iRight,iTop+iBottom,iLeft+iRight); + break; + + case GFX_FILLEDELLIPSE: + al_acquire_bitmap(bmp); + al_draw_ellipse_fill(bmp, iLeft, iTop, iRight, iBottom, iColor); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(iTop-iBottom,iLeft-iRight,iTop+iBottom,iLeft+iRight); + break; + + case GFX_FLOODFILL: + al_acquire_bitmap(bmp); + al_floodfill(bmp, iLeft, iTop, iBottom); + al_release_bitmap(bmp); + GT_UPD_GFXRECT(0,0,s_iScrHeight*s_byFontSize,s_iScrWidth*s_byFontWidth); + break; + + default: + return HB_GTSUPER_GFXPRIMITIVE( iType, iTop, iLeft, iBottom, iRight, iColor ); + } + + if ( hb_gt_DispCount() == 0 ) + { + hb_gt_alleg_ScreenUpdate(); + } + + return iRet; +} + +static void hb_gt_alleg_gfx_Text( int iTop, int iLeft, char * cBuf, int iColor, int iSize, int iWidth ) +{ + int iBottom, iRight; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_alleg_gfx_Text(%d, %d, %s, %d, %d, %d)", iTop, iLeft, cBuf, iColor, iSize, iWidth)); + + HB_SYMBOL_UNUSED( iWidth ); + + GT_SCREENINIT(); + hb_gt_Refresh(); + + if ( iSize ) + { + ssfSetFontSize( ssfDefaultFont, (unsigned short) iSize ); + } + + iRight = iLeft + strlen(cBuf) * ( ssfDefaultFont->fsize / 2 ) - 1; + iBottom = iTop + ssfDefaultFont->fsize - 1; + + al_acquire_bitmap(bmp); + ssfDrawText( bmp, ssfDefaultFont, cBuf, iLeft, iTop, iColor ); + al_release_bitmap(bmp); + GT_UPD_GFXRECT( iTop, iLeft, iBottom, iRight ); + + if ( iSize ) + { + ssfSetFontSize( ssfDefaultFont, s_byFontSize ); + } + + if ( hb_gt_DispCount() == 0 ) + { + hb_gt_alleg_ScreenUpdate(); + } +} + +/* ******** Graphics API end ******** */ + +static void hb_gt_alleg_Redraw( int iRow, int iCol, int iSize ) +{ + BYTE bColor, bAttr; + USHORT usChar; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Redraw(%d, %d, %d)", iRow, iCol, iSize ) ); + + if( s_fInit ) + { + int iPosX = iCol * s_byFontWidth, iPosY = iRow * s_byFontSize; + + if( s_iCursorStyle != SC_NONE && s_iCurRow == iRow && + s_iCurCol >= iCol && s_iCurCol <= iCol + iSize - 1 ) + { + s_iCursorStyle = SC_NONE; + } + GT_UPD_GFXRECT( iPosY, iPosX, iPosY + s_byFontSize - 1, iPosX + iSize * s_byFontWidth - 1 ); + + while( iSize-- ) + { + if( !hb_gt_GetScrChar( iRow, iCol++, &bColor, &bAttr, &usChar ) ) + break; + al_draw_rect_fill( bmp, iPosX, iPosY, iPosX + s_byFontWidth - 1, iPosY + s_byFontSize - 1, s_pClr[bColor >> 4] ); + ssfDrawChar( bmp, ssfDefaultFont, ( BYTE ) usChar, iPosX, iPosY, s_pClr[bColor & 0x0F] ); + iPosX += s_byFontWidth; + } + } + else if( !s_fMakeInit ) + { + BYTE bDefColor = hb_gt_GetColor(); + + while( iSize-- ) + { + if( !hb_gt_GetScrChar( iRow, iCol++, &bColor, &bAttr, &usChar ) ) + break; + + if( bColor != bDefColor || usChar != ' ' ) + { + s_fMakeInit = TRUE; + break; + } + } + } +} + +static void hb_gt_alleg_Refresh( void ) +{ + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_alleg_Refresh()" ) ); + + if( !s_fGtError ) + { + if( s_fInit ) + { + al_acquire_bitmap(bmp); + HB_GTSUPER_REFRESH(); + al_release_bitmap(bmp); + if ( hb_gt_DispCount() == 0 ) + { + hb_gt_alleg_ScreenUpdate(); + } + } + else + { + HB_GTSUPER_REFRESH(); + if( s_fMakeInit ) + { + s_fMakeInit = FALSE; + GT_SCREENINIT(); + } + } + } +} + + +/* ******************************************************************* */ + +static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_FuncInit(%p)", pFuncTable)); + + pFuncTable->Init = hb_gt_alleg_Init; + pFuncTable->Exit = hb_gt_alleg_Exit; + pFuncTable->SetMode = hb_gt_alleg_SetMode; + pFuncTable->Redraw = hb_gt_alleg_Redraw; + pFuncTable->Refresh = hb_gt_alleg_Refresh; + pFuncTable->Version = hb_gt_alleg_Version; + pFuncTable->Info = hb_gt_alleg_Info; + + pFuncTable->ReadKey = hb_gt_alleg_ReadKey; + + pFuncTable->MouseIsPresent = hb_gt_alleg_mouse_IsPresent; + pFuncTable->MouseGetPos = hb_gt_alleg_mouse_GetPos; + pFuncTable->MouseSetPos = hb_gt_alleg_mouse_SetPos; + pFuncTable->MouseSetBounds = hb_gt_alleg_mouse_SetBounds; + pFuncTable->MouseGetBounds = hb_gt_alleg_mouse_GetBounds; + pFuncTable->MouseCountButton = hb_gt_alleg_mouse_CountButton; + pFuncTable->MouseButtonState = hb_gt_alleg_mouse_ButtonState; + pFuncTable->GfxPrimitive = hb_gt_alleg_gfx_Primitive; + pFuncTable->GfxText = hb_gt_alleg_gfx_Text; + + return TRUE; +} + +/* ********************************************************************** */ + +static HB_GT_INIT gtInit = { HB_GT_DRVNAME( HB_GT_NAME ), + hb_gt_FuncInit, + HB_GTSUPER }; + +HB_GT_ANNOUNCE( HB_GT_NAME ); + +HB_CALL_ON_STARTUP_BEGIN( _hb_startup_gt_Init_ ) + hb_gtRegister( >Init ); +HB_CALL_ON_STARTUP_END( _hb_startup_gt_Init_ ) + +#if defined( HB_PRAGMA_STARTUP ) + #pragma startup _hb_startup_gt_Init_ +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto__hb_startup_gt_Init_ = _hb_startup_gt_Init_; + #pragma data_seg() +#endif + +/* ******************************************************************* */ + +/* +* this is necessary if you want to link with .so allegro libs +* or when link staticalt and your linker will force to link main() +* from allegro library not the harbour one +*/ +int _mangled_main( int argc, char * argv[] ) +{ + HB_TRACE(HB_TR_DEBUG, ("_mangled_main(%d, %p)", argc, argv)); + + hb_cmdargInit( argc, argv ); + hb_vmInit( TRUE ); + hb_vmQuit(); + + return 0; +} +void * _mangled_main_address = ( void * ) _mangled_main; diff --git a/harbour/source/rtl/gtalleg/ssf.c b/harbour/source/rtl/gtalleg/ssf.c new file mode 100644 index 0000000000..6ef4ae2e81 --- /dev/null +++ b/harbour/source/rtl/gtalleg/ssf.c @@ -0,0 +1,210 @@ +/* + * $Id$ + */ + +/* + * + * This file was conceived while I was developing an allegro based gt + * (gtAlleg) for xHarbour, so it is brought under the same license terms. + * + */ + +/* + * xHarbour Project source code: + * Simple Scalable Font library, main C module. + * + * Copyright 2004 Mauricio Abre + * www - http: (yet to be constructed...) + * + * 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 +#include +#include "hbapi.h" +#include "ssf.h" +#include "fixedth.sfc" + +ssfFont *ssfDefaultFont = &ssfFixedThinFont; + +#define fSize sfont->fsize +#define fLeft points[0] +#define fTop points[1] +#define fRight points[2] +#define fBottom points[3] +#define fLeft2 points[4] +#define fTop2 points[5] +#define fRight2 points[6] +#define fBottom2 points[7] + +void ssfSetFontSize(ssfFont *sfont, USHORT fsize) +{ + fSize = fsize; +} + +USHORT ssfDrawChar(AL_BITMAP *dst, ssfFont *sfont, char c, int x, int y, int color) +{ + BYTE p; + int i, j, thick; + ssfGlyph charGlyph; + ssfFrame charFrame; + int points[8]; + float fScale; + + p = (BYTE) c; + charGlyph = *sfont->chars[p]; + fScale = (float) ((float) sfont->fsize / (float) 65535); + + for (i = 0; i < charGlyph.num; i++) + { + charFrame = charGlyph.frames[i]; + if (charFrame.ftype == SSF_SPLINE2) + { + fLeft2 = x + (int) (fScale * charFrame.left); + fTop2 = y + (int) (fScale * charFrame.top); + fRight2 = x + (int) (fScale * charFrame.right); + fBottom2 = y + (int) (fScale * charFrame.bottom); + } + else + { + fLeft = x + (int) (fScale * charFrame.left); + fTop = y + (int) (fScale * charFrame.top); + fRight = x + (int) (fScale * charFrame.right); + fBottom = y + (int) (fScale * charFrame.bottom); + } + + switch (charFrame.ftype) + { + case SSF_SPLINE2: + thick = (int) (fScale * charFrame.thick); + + if (thick == 0) + thick++; + + for (j = 0; j < thick; j++) + { + al_draw_spline(dst, points, color); + switch (charFrame.thickdir) + { + case THICK_LEFT: + fLeft--; + fRight--; + fLeft2--; + fRight2--; + break; + case THICK_UP: + fTop--; + fBottom--; + fTop2--; + fBottom2--; + break; + case THICK_RIGHT: + fLeft++; + fRight++; + fLeft2++; + fRight2++; + break; + case THICK_DOWN: + fTop++; + fBottom++; + fTop2++; + fBottom2++; + break; + } + } + break; + + case SSF_LINE: + thick = (int) (fScale * charFrame.thick); + + if (thick == 0) + thick++; + + for (j = 0; j < thick; j++) + { + al_draw_line(dst, fLeft, fTop, fRight, fBottom, color); + switch (charFrame.thickdir) { + case THICK_LEFT: + fLeft--; + fRight--; + break; + case THICK_UP: + fTop--; + fBottom--; + break; + case THICK_RIGHT: + fLeft++; + fRight++; + break; + case THICK_DOWN: + fTop++; + fBottom++; + break; + } + } + break; + + case SSF_BOX: + al_draw_rect_fill(dst, fLeft, fTop, fRight, fBottom, color); + break; + + case SSF_TRIANGLE: + thick = x + (int) (fScale * charFrame.thick); + al_draw_triangle(dst, fLeft, fTop, fRight, fBottom, thick, y + (int) (fScale * charFrame.thickdir), color); + break; + } + } + + return (sfont->fsize / 2); +} + +int ssfDrawText(AL_BITMAP *dst, ssfFont *sfont, char *s, int x, int y, int color) +{ + int i = 0; + + while ( s[i] ) + { + x += ssfDrawChar(dst, sfont, s[i], x, y, color); + i++; + } + + return x; +} diff --git a/harbour/source/rtl/gtalleg/ssf.h b/harbour/source/rtl/gtalleg/ssf.h new file mode 100644 index 0000000000..b7998e9e96 --- /dev/null +++ b/harbour/source/rtl/gtalleg/ssf.h @@ -0,0 +1,242 @@ +/* + * $Id$ + */ + +/* + * + * This file was conceived while I was developing an allegro based gt + * (gtAlleg) for xHarbour, so it is brought under the same license terms. + * + * Mauricio Abre + * + */ + +/* + * xHarbour Project source code: + * Simple Scalable Font library, main header file. + * + * Copyright 2004 Mauricio Abre + * www - http: (yet to be constructed...) + * + * 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. + * + */ + +#ifndef _SSF_H_ +#define _SSF_H_ + +#include + +// Hack to use old Allegro branches +#ifndef AL_GFX_NONE +#define AL_GFX_NONE GFX_NONE +#define AL_GFX_SAFE GFX_SAFE +#ifdef GFX_XWINDOWS +#define AL_GFX_XDGA GFX_XDGA +#define AL_GFX_XDGA2 GFX_XDGA2 +#define AL_GFX_XWINDOWS GFX_XWINDOWS +#endif +#define AL_GFX_VBEAF GFX_VBEAF +#ifdef GFX_FBCON +#define AL_GFX_FBCON GFX_FBCON +#endif +#define AL_GFX_AUTODETECT_WINDOWED GFX_AUTODETECT_WINDOWED +#define AL_GFX_AUTODETECT GFX_AUTODETECT +#ifdef GFX_GDI +#define AL_GFX_GDI GFX_GDI +#define AL_GFX_DIRECTX_WIN GFX_DIRECTX_WIN +#endif +#define AL_BITMAP BITMAP +#define AL_SCREEN_W SCREEN_W +#define AL_SCREEN_H SCREEN_H +#define AL_KEY_ESC KEY_ESC +#define AL_KEY_INSERT KEY_INSERT +#define AL_KEY_HOME KEY_HOME +#define AL_KEY_PGUP KEY_PGUP +#define AL_KEY_PGDN KEY_PGDN +#define AL_KEY_END KEY_END +#define AL_KEY_DEL KEY_DEL +#define AL_KEY_UP KEY_UP +#define AL_KEY_DOWN KEY_DOWN +#define AL_KEY_LEFT KEY_LEFT +#define AL_KEY_RIGHT KEY_RIGHT +#define AL_KEY_QUOTE KEY_QUOTE +#define AL_KEY_A KEY_A +#define AL_KEY_B KEY_B +#define AL_KEY_C KEY_C +#define AL_KEY_D KEY_D +#define AL_KEY_E KEY_E +#define AL_KEY_F KEY_F +#define AL_KEY_G KEY_G +#define AL_KEY_H KEY_H +#define AL_KEY_I KEY_I +#define AL_KEY_J KEY_J +#define AL_KEY_K KEY_K +#define AL_KEY_L KEY_L +#define AL_KEY_M KEY_M +#define AL_KEY_N KEY_N +#define AL_KEY_O KEY_O +#define AL_KEY_P KEY_P +#define AL_KEY_Q KEY_Q +#define AL_KEY_R KEY_R +#define AL_KEY_S KEY_S +#define AL_KEY_T KEY_T +#define AL_KEY_U KEY_U +#define AL_KEY_V KEY_V +#define AL_KEY_W KEY_W +#define AL_KEY_X KEY_X +#define AL_KEY_Y KEY_Y +#define AL_KEY_Z KEY_Z +#define AL_KEY_F1 KEY_F1 +#define AL_KEY_F2 KEY_F2 +#define AL_KEY_F3 KEY_F3 +#define AL_KEY_F4 KEY_F4 +#define AL_KEY_F5 KEY_F5 +#define AL_KEY_F6 KEY_F6 +#define AL_KEY_F7 KEY_F7 +#define AL_KEY_F8 KEY_F8 +#define AL_KEY_F9 KEY_F9 +#define AL_KEY_F10 KEY_F10 +#define AL_KEY_F11 KEY_F11 +#define AL_KEY_F12 KEY_F12 +#define al_desktop_color_depth desktop_color_depth +#define al_set_color_depth set_color_depth +#define al_bitmap_color_depth bitmap_color_depth +#define al_get_desktop_resolution get_desktop_resolution +#define al_install_timer install_timer +#define al_screen screen +#define al_set_gfx_mode set_gfx_mode +#define al_set_window_title set_window_title +#define al_text_mode text_mode +#define al_make_color makecol +#define al_key_shifts key_shifts +#define al_install_keyboard install_keyboard +#define al_keyboard_needs_poll keyboard_needs_poll +#define al_poll_keyboard poll_keyboard +#define al_key_pressed keypressed +#define al_read_key readkey +#define al_set_keyboard_leds set_leds +#define al_install_mouse install_mouse +#define al_show_mouse show_mouse +#define al_mouse_needs_poll mouse_needs_poll +#define al_poll_mouse poll_mouse +#define al_mouse_x mouse_x +#define al_mouse_y mouse_y +#define al_mouse_b mouse_b +#define al_scare_mouse scare_mouse +#define al_scare_mouse_area scare_mouse_area +#define al_unscare_mouse unscare_mouse +#define al_position_mouse position_mouse +#define al_set_mouse_range set_mouse_range +#define al_create_bitmap create_bitmap +#define al_create_system_bitmap create_system_bitmap +#define al_destroy_bitmap destroy_bitmap +#define al_acquire_screen acquire_screen +#define al_release_screen release_screen +#define al_acquire_bitmap acquire_bitmap +#define al_release_bitmap release_bitmap +#define al_drawing_mode drawing_mode +#define al_get_pixel getpixel +#define al_put_pixel putpixel +#define al_draw_line line +#define al_draw_vline vline +#define al_draw_hline hline +#define al_draw_rect rect +#define al_draw_rect_fill rectfill +#define al_draw_spline spline +#define al_draw_circle circle +#define al_draw_circle_fill circlefill +#define al_draw_ellipse ellipse +#define al_draw_ellipse_fill ellipsefill +#define al_floodfill floodfill +#define al_draw_triangle triangle +#define al_blit blit +#define al_clear_to_color clear_to_color +#ifndef al_set_clip +#if ALLEGRO_SUB_VERSION < 2 +#define al_set_clip set_clip +#else +#define al_set_clip set_clip_rect +#endif +#endif +#endif + +typedef enum { + SSF_NONE, + SSF_LINE, + SSF_BOX, + SSF_SPLINE1, + SSF_SPLINE2, + SSF_TRIANGLE, + SSF_COLOR +} ssfType; + +#ifndef SSF_MAXFRAMES +#define SSF_MAXFRAMES 128 +#endif + +#define THICK_LEFT 0 +#define THICK_UP 1 +#define THICK_RIGHT 2 +#define THICK_DOWN 3 + +typedef struct _ssfFrame { + char ftype; + unsigned short left, top, right, bottom, thick; + unsigned short thickdir; +} ssfFrame; + +typedef struct _ssfGlyph { + int num; + ssfFrame frames[SSF_MAXFRAMES]; +} ssfGlyph; + +typedef struct _ssfFont { + unsigned short fsize; + ssfGlyph **chars; +} ssfFont; + +extern ssfFont *ssfDefaultFont; + +extern void ssfSetFontSize(ssfFont *sfont, unsigned short fsize); +extern unsigned short ssfDrawChar(AL_BITMAP *dst, ssfFont *sfont, char c, int x, int y, int color); +extern int ssfDrawText(AL_BITMAP *dst, ssfFont *sfont, char *s, int x, int y, int color); + +#endif // _SSF_H_ diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 35c4e5d87d..84ac518e45 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -607,3 +607,21 @@ ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo ) else return FAILURE; } + +int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +{ + int iResult; + + iResult = hb_gt_GfxPrimitive( iType, iTop, iLeft, iBottom, iRight, iColor ); + hb_gt_Flush(); + + return iResult; +} + +ERRCODE hb_gtGfxText( int iTop, int iLeft, char * cBuf, int iColor, int iSize, int iWidth ) +{ + hb_gt_GfxText( iTop, iLeft, cBuf, iColor, iSize, iWidth ); + hb_gt_Flush(); + + return SUCCESS; +} diff --git a/harbour/source/rtl/gtfunc.c b/harbour/source/rtl/gtfunc.c index c7d7bc8c59..4eab3b121e 100644 --- a/harbour/source/rtl/gtfunc.c +++ b/harbour/source/rtl/gtfunc.c @@ -126,3 +126,32 @@ HB_FUNC( HB_GTVERSION ) { hb_retc( hb_gtVersion( hb_parni( 1 ) ) ); } + +HB_FUNC( HB_GFXPRIMITIVE ) +{ + PHB_ITEM pType = hb_param( 1, HB_IT_NUMERIC ); + PHB_ITEM pTop = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pBottom = hb_param( 4, HB_IT_NUMERIC ); + PHB_ITEM pRight = hb_param( 5, HB_IT_NUMERIC ); + PHB_ITEM pColor = hb_param( 6, HB_IT_NUMERIC ); + + hb_retni( hb_gtGfxPrimitive( hb_itemGetNI(pType), + hb_itemGetNI(pTop), hb_itemGetNI(pLeft), + hb_itemGetNI(pBottom), hb_itemGetNI(pRight), + hb_itemGetNI(pColor) ) ); +} + +HB_FUNC( HB_GFXTEXT ) +{ + PHB_ITEM pTop = hb_param( 1, HB_IT_NUMERIC ); + PHB_ITEM pLeft = hb_param( 2, HB_IT_NUMERIC ); + char *cText = hb_parc(3); + PHB_ITEM pColor = hb_param( 4, HB_IT_NUMERIC ); + PHB_ITEM pSize = hb_param( 5, HB_IT_NUMERIC ); + PHB_ITEM pWidth = hb_param( 6, HB_IT_NUMERIC ); + + hb_gtGfxText( hb_itemGetNI(pTop), + hb_itemGetNI(pLeft), cText, hb_itemGetNI(pColor), + hb_itemGetNI(pSize), hb_itemGetNI(pWidth) ); +} diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index 07121d37b3..0b41b3e612 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -54,6 +54,7 @@ /* NOTE: User programs should never call this layer directly! */ +/* #define XWC_DEBUG */ #include "gtxwc.h" static HB_GT_FUNCS SuperTable; @@ -287,19 +288,26 @@ static char *rgb_colors[] = { }; static Atom s_atomDelWin; +static Atom s_atomTimestamp; +static Atom s_atomAtom; +static Atom s_atomInteger; static Atom s_atomString; static Atom s_atomUTF8String; static Atom s_atomPrimary; +static Atom s_atomSecondary; +static Atom s_atomClipboard; static Atom s_atomTargets; static Atom s_atomCutBuffer0; +static Atom s_atomText; +static Atom s_atomCompoundText; typedef struct tag_rect { int top; int left; - USHORT right; - USHORT bottom; + int right; + int bottom; } RECT; typedef struct tag_modifiers @@ -409,7 +417,15 @@ typedef struct tag_x_wnddef unsigned char * ClipboardData; ULONG ClipboardSize; Atom ClipboardRequest; + Time ClipboardTime; BOOL ClipboardOwner; + BOOL ClipboardRcvd; + + /* Clipping */ + XRectangle ClipRect; + + /* Keep last event time */ + Time lastEventTime; } XWND_DEF, *PXWND_DEF; @@ -424,7 +440,7 @@ static PXWND_DEF s_wnd = NULL; static BOOL s_fNoXServer = FALSE; static BOOL s_cursorState = TRUE; -static ULONG s_cursorBlinkRate = 100; +static ULONG s_cursorBlinkRate = 350; static ULONG s_cursorStateTime = 0; #if 1 @@ -1933,10 +1949,18 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) evt->xexpose.y + evt->xexpose.height ); break; + case NoExpose: +#ifdef XWC_DEBUG + printf( "Event: NoExpose\r\n" ); fflush(stdout); +#endif + break; + case KeyPress: #ifdef XWC_DEBUG printf( "Event: KeyPress\r\n" ); fflush(stdout); #endif + if( evt->xkey.time != CurrentTime ) + wnd->lastEventTime = evt->xkey.time; hb_gt_xwc_ProcessKey( wnd, &evt->xkey ); break; @@ -1944,6 +1968,8 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) #ifdef XWC_DEBUG printf( "Event: KeyRelease\r\n" ); fflush(stdout); #endif + if( evt->xkey.time != CurrentTime ) + wnd->lastEventTime = evt->xkey.time; out = XLookupKeysym( &evt->xkey, 0 ); switch( out ) { @@ -1970,6 +1996,9 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) #ifdef XWC_DEBUG printf( "Event: MotionNotify\r\n" ); fflush(stdout); #endif + if( evt->xmotion.time != CurrentTime ) + wnd->lastEventTime = evt->xmotion.time; + wnd->mouseCol = evt->xmotion.x / wnd->fontWidth; wnd->mouseRow = evt->xmotion.y / wnd->fontHeight; if( hb_gt_xwc_LastCharInInputQueue( wnd ) != K_MOUSEMOVE ) @@ -1986,6 +2015,8 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) #ifdef XWC_DEBUG printf( "Event: %s, button=%d\r\n", evt->type == ButtonPress ? "ButtonPress" : "ButtonRelease", button ); fflush(stdout); #endif + if( evt->xbutton.time != CurrentTime ) + wnd->lastEventTime = evt->xbutton.time; if( button >= 0 && button < XWC_MAX_BUTTONS ) { button = wnd->mouseButtonsMap[ button ] - 1; @@ -2040,6 +2071,12 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) wnd->keyModifiers.bShift = FALSE; break; + case FocusOut: +#ifdef XWC_DEBUG + printf( "Event: FocusOut\r\n" ); fflush(stdout); +#endif + break; + case ConfigureNotify: #ifdef XWC_DEBUG printf( "Event: ConfigureNotify\r\n" ); fflush(stdout); @@ -2051,7 +2088,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) case ClientMessage: #ifdef XWC_DEBUG - printf("Event: ClientMessage:%ld\r\n", evt->xclient.data.l[ 0 ]); fflush(stdout); + printf( "Event: ClientMessage:%ld (%s)\r\n", evt->xclient.data.l[ 0 ], XGetAtomName(wnd->dpy, ( Atom ) evt->xclient.data.l[ 0 ]) ); fflush(stdout); #endif if( ( Atom ) evt->xclient.data.l[ 0 ] == s_atomDelWin ) { @@ -2060,8 +2097,18 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) break; case SelectionNotify: + { + Atom aNextRequest = None; #ifdef XWC_DEBUG - printf("Event: SelectionNotify\r\n"); fflush(stdout); + printf( "Event: SelectionNotify: selection=%ld (%s), property=%ld (%s), target=%ld (%s) => %ld (%s)\r\n", + evt->xselection.selection, + evt->xselection.selection == None ? "None" : XGetAtomName(wnd->dpy, evt->xselection.selection), + evt->xselection.property, + evt->xselection.property == None ? "None" : XGetAtomName(wnd->dpy, evt->xselection.property), + evt->xselection.target, + evt->xselection.target == None ? "None" : XGetAtomName(wnd->dpy, evt->xselection.target), + wnd->ClipboardRequest, + wnd->ClipboardRequest == None ? "None" : XGetAtomName(wnd->dpy, wnd->ClipboardRequest) ); fflush(stdout); #endif if( evt->xselection.property != None && wnd->ClipboardRequest ) { @@ -2071,42 +2118,62 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) if( XGetTextProperty( wnd->dpy, wnd->window, &text, evt->xselection.property ) != 0 ) { - if( wnd->ClipboardRequest == s_atomUTF8String ) + if( evt->xselection.target == s_atomUTF8String && text.format == 8 ) { nItem = hb_cdpUTF8StringLength( text.value, text.nitems ); if( wnd->ClipboardData != NULL ) hb_xfree( wnd->ClipboardData ); wnd->ClipboardData = ( unsigned char * ) hb_xgrab( nItem + 1 ); wnd->ClipboardSize = nItem; - hb_cdpUTF8ToStrn( wnd->inCDP ? wnd->inCDP : wnd->hostCDP, - text.value, text.nitems, + hb_cdpUTF8ToStrn( wnd->hostCDP, text.value, text.nitems, wnd->ClipboardData, nItem + 1 ); + wnd->ClipboardTime = evt->xselection.time; + wnd->ClipboardRcvd = TRUE; } - else if( wnd->ClipboardRequest == s_atomString ) + else if( evt->xselection.target == s_atomString && text.format == 8 ) { - unsigned char cData; - if( wnd->ClipboardData != NULL ) hb_xfree( wnd->ClipboardData ); wnd->ClipboardData = ( unsigned char * ) hb_xgrab( text.nitems + 1 ); + memcpy( wnd->ClipboardData, text.value, text.nitems ); + if( wnd->inCDP && wnd->hostCDP && wnd->inCDP != wnd->hostCDP ) + hb_cdpnTranslate( ( char * ) wnd->ClipboardData, wnd->inCDP, wnd->hostCDP, text.nitems ); + wnd->ClipboardData[ text.nitems ] = '\0'; + wnd->ClipboardSize = text.nitems; + wnd->ClipboardTime = evt->xselection.time; + wnd->ClipboardRcvd = TRUE; + } + else if( evt->xselection.target == s_atomTargets && text.format == 32 ) + { + Atom aValue; +#ifdef XWC_DEBUG + printf("text.nitems=%ld, text.format=%d\r\n", text.nitems, text.format); fflush(stdout); +#endif for( nItem = 0; nItem < text.nitems; ++nItem ) { - switch( text.format ) - { - case 8: cData = text.value[ nItem ]; break; - case 16: cData = ( unsigned char ) ( ( unsigned short * ) text.value)[ nItem ]; break; - case 32: cData = ( unsigned char ) ( ( unsigned int * ) text.value)[ nItem ]; break; - default: cData = 0; - } - wnd->ClipboardData[ nItem ] = cData; + aValue = ( ( unsigned int * ) text.value )[ nItem ]; + if( aValue == s_atomUTF8String ) + aNextRequest = s_atomUTF8String; + else if( aValue == s_atomString && aNextRequest == None ) + aNextRequest = s_atomString; +#ifdef XWC_DEBUG + printf("%ld, %8lx (%s)\r\n", nItem, aValue, XGetAtomName(wnd->dpy, aValue));fflush(stdout); +#endif } - wnd->ClipboardData[ nItem ] = '\0'; - wnd->ClipboardSize = nItem; } } } - wnd->ClipboardRequest = 0; + else if( wnd->ClipboardRequest == s_atomTargets ) + { + aNextRequest = s_atomUTF8String; + } + else if( wnd->ClipboardRequest == s_atomUTF8String ) + { + aNextRequest = s_atomString; + } + wnd->ClipboardRequest = aNextRequest; break; + } case SelectionRequest: { @@ -2114,14 +2181,44 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) XEvent respond; #ifdef XWC_DEBUG - printf("Event: SelectionRequest\r\n"); fflush(stdout); + printf( "Event: SelectionRequest: %ld (%s)\r\n", req->target, + XGetAtomName(wnd->dpy, req->target) ); fflush(stdout); #endif respond.xselection.property = req->property; - if( req->target == s_atomString ) + + if ( req->target == s_atomTimestamp ) { XChangeProperty( wnd->dpy, req->requestor, req->property, - s_atomString, 8, PropModeReplace, - wnd->ClipboardData, wnd->ClipboardSize ); + s_atomInteger, 8 * sizeof( Time ), PropModeReplace, + ( unsigned char * ) &wnd->ClipboardTime, 1 ); + } + else if ( req->target == s_atomTargets ) + { + Atom aProp[] = { s_atomTimestamp, s_atomTargets, + s_atomString, s_atomUTF8String, + s_atomCompoundText, s_atomText }; + XChangeProperty( wnd->dpy, req->requestor, req->property, + s_atomAtom, 8 * sizeof( Atom ), PropModeReplace, + ( unsigned char * ) aProp, sizeof( aProp ) / sizeof( Atom ) ); + } + else if( req->target == s_atomString ) + { + if( wnd->inCDP && wnd->hostCDP && wnd->inCDP != wnd->hostCDP ) + { + BYTE * pBuffer = ( BYTE * ) hb_xgrab( wnd->ClipboardSize + 1 ); + memcpy( pBuffer, wnd->ClipboardData, wnd->ClipboardSize + 1 ); + hb_cdpnTranslate( ( char * ) pBuffer, wnd->inCDP, wnd->hostCDP, wnd->ClipboardSize ); + XChangeProperty( wnd->dpy, req->requestor, req->property, + s_atomString, 8, PropModeReplace, + pBuffer, wnd->ClipboardSize ); + hb_xfree( pBuffer ); + } + else + { + XChangeProperty( wnd->dpy, req->requestor, req->property, + s_atomString, 8, PropModeReplace, + wnd->ClipboardData, wnd->ClipboardSize ); + } } else if( req->target == s_atomUTF8String ) { @@ -2131,19 +2228,10 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) hb_cdpStrnToUTF8( cdp, wnd->ClipboardData, wnd->ClipboardSize, pBuffer ); XChangeProperty( wnd->dpy, req->requestor, req->property, - s_atomString, 8, PropModeReplace, + s_atomUTF8String, 8, PropModeReplace, pBuffer, ulLen ); hb_xfree( pBuffer ); } - else if ( req->target == s_atomTargets ) - { - Atom aProp[ 2 ]; - aProp[ 0 ] = s_atomUTF8String; - aProp[ 1 ] = s_atomString; - XChangeProperty( wnd->dpy, req->requestor, req->property, - s_atomTargets, 32, PropModeReplace, - ( unsigned char * ) aProp, 2 ); - } else { respond.xselection.property = None; @@ -2154,7 +2242,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) respond.xselection.requestor = req->requestor; respond.xselection.selection = req->selection; respond.xselection.target = req->target; - respond.xselection.time = CurrentTime; + respond.xselection.time = req->time; XSendEvent( wnd->dpy, req->requestor, 0, 0, &respond ); break; @@ -2162,11 +2250,19 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) case SelectionClear: #ifdef XWC_DEBUG - printf("Event: SelectionClear\r\n"); fflush(stdout); + printf( "Event: SelectionClear\r\n" ); fflush(stdout); #endif wnd->ClipboardOwner = FALSE; break; + case PropertyNotify: +#ifdef XWC_DEBUG + printf( "Event: PropertyNotify\r\n" ); fflush(stdout); +#endif + if( evt->xproperty.time != CurrentTime ) + wnd->lastEventTime = evt->xproperty.time; + break; + #ifdef XWC_DEBUG default: printf( "Event: #%d\r\n", evt->type ); fflush(stdout); @@ -2713,46 +2809,41 @@ static ULONG hb_gt_xwc_CurrentTime( void ) static void hb_gt_xwc_ProcessMessages( PXWND_DEF wnd ) { XEvent evt; - ULONG ulCurrentTime = hb_gt_xwc_CurrentTime(); - if( ulCurrentTime - s_cursorStateTime > s_cursorBlinkRate ) + if( s_cursorBlinkRate == 0 ) { - s_cursorState = !s_cursorState; - s_cursorStateTime = ulCurrentTime; + s_cursorState = TRUE; + } + else + { + ULONG ulCurrentTime = hb_gt_xwc_CurrentTime(); + + if( ulCurrentTime - s_cursorStateTime > s_cursorBlinkRate ) + { + s_cursorState = !s_cursorState; + s_cursorStateTime = ulCurrentTime; + } } - while( XEventsQueued( wnd->dpy, QueuedAfterFlush) ) - { - XNextEvent( wnd->dpy, &evt ); - hb_gt_xwc_WndProc( wnd, &evt ); - } - - hb_gt_xwc_UpdateSize( wnd ); hb_gt_xwc_UpdateChr( wnd ); - hb_gt_xwc_UpdatePts( wnd ); - hb_gt_xwc_UpdateCursor( wnd ); if( wnd->fDspTitle ) { wnd->fDspTitle = FALSE; XStoreName( wnd->dpy, wnd->window, wnd->szTitle ? wnd->szTitle : "" ); } -#if 0 - /* - * The even checking is repeated intentionaly because some operation - * can be bufferd by XLIB until incomming events are checked - */ - while( XEventsQueued( wnd->dpy, QueuedAfterFlush) ) + do { - XNextEvent( wnd->dpy, &evt ); - hb_gt_xwc_WndProc( wnd, &evt ); + while( XEventsQueued( wnd->dpy, QueuedAfterFlush ) ) + { + XNextEvent( wnd->dpy, &evt ); + hb_gt_xwc_WndProc( wnd, &evt ); + } + hb_gt_xwc_UpdateSize( wnd ); + hb_gt_xwc_UpdatePts( wnd ); + hb_gt_xwc_UpdateCursor( wnd ); } - hb_gt_xwc_UpdateSize( wnd ); - hb_gt_xwc_UpdatePts( wnd ); - hb_gt_xwc_UpdateCursor( wnd ); -#endif - - XFlush( wnd->dpy ); + while( XEventsQueued( wnd->dpy, QueuedAfterFlush ) ); } /* *********************************************************************** */ @@ -2885,6 +2976,8 @@ static PXWND_DEF hb_gt_xwc_CreateWndDef( void ) wnd->keyModifiers.bAltGr = FALSE; wnd->keyModifiers.bShift = FALSE; + wnd->lastEventTime = CurrentTime; + return wnd; } @@ -2915,11 +3008,19 @@ static BOOL hb_gt_xwc_ConnectX( PXWND_DEF wnd, BOOL fExit ) hb_gt_xwc_MouseInit( wnd ); /* set atom identifiers for atom names we will use */ - s_atomDelWin = XInternAtom( wnd->dpy, "WM_DELETE_WINDOW", True ); - s_atomString = XInternAtom( wnd->dpy, "STRING", False ); - s_atomPrimary = XInternAtom( wnd->dpy, "PRIMARY", False ); - s_atomTargets = XInternAtom( wnd->dpy, "TARGETS", False ); - s_atomCutBuffer0 = XInternAtom( wnd->dpy, "CUT_BUFFER0", False ); + s_atomDelWin = XInternAtom( wnd->dpy, "WM_DELETE_WINDOW", True ); + s_atomTimestamp = XInternAtom( wnd->dpy, "TIMESTAMP", False ); + s_atomAtom = XInternAtom( wnd->dpy, "ATOM", False ); + s_atomInteger = XInternAtom( wnd->dpy, "INTEGER", False ); + s_atomString = XInternAtom( wnd->dpy, "STRING", False ); + s_atomUTF8String = XInternAtom( wnd->dpy, "UTF8_STRING", False ); + s_atomPrimary = XInternAtom( wnd->dpy, "PRIMARY", False ); + s_atomSecondary = XInternAtom( wnd->dpy, "SECONDARY", False ); + s_atomClipboard = XInternAtom( wnd->dpy, "CLIPBOARD", False ); + s_atomTargets = XInternAtom( wnd->dpy, "TARGETS", False ); + s_atomCutBuffer0 = XInternAtom( wnd->dpy, "CUT_BUFFER0", False ); + s_atomText = XInternAtom( wnd->dpy, "TEXT", False ); + s_atomCompoundText = XInternAtom( wnd->dpy, "COMPOUND_TEXT", False ); return TRUE; } @@ -3070,15 +3171,35 @@ static void hb_gt_xwc_Initialize( PXWND_DEF wnd ) static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, char *szData, ULONG ulSize ) { + if( wnd->ClipboardOwner && ulSize == 0 ) + { + XSetSelectionOwner( wnd->dpy, s_atomPrimary, None, wnd->ClipboardTime ); + XSetSelectionOwner( wnd->dpy, s_atomClipboard, None, wnd->ClipboardTime ); + } + if( wnd->ClipboardData != NULL ) hb_xfree( wnd->ClipboardData ); wnd->ClipboardData = ( unsigned char * ) hb_xgrab( ulSize + 1 ); memcpy( wnd->ClipboardData, szData, ulSize ); wnd->ClipboardData[ ulSize ] = '\0'; wnd->ClipboardSize = ulSize; + wnd->ClipboardTime = wnd->lastEventTime; + wnd->ClipboardOwner = FALSE; - wnd->ClipboardOwner = TRUE; - XSetSelectionOwner( wnd->dpy, s_atomPrimary, wnd->window, CurrentTime ); + if( ulSize > 0 ) + { + XSetSelectionOwner( wnd->dpy, s_atomPrimary, wnd->window, wnd->ClipboardTime ); + if( XGetSelectionOwner( wnd->dpy, s_atomPrimary ) == wnd->window ) + { + wnd->ClipboardOwner = TRUE; + XSetSelectionOwner( wnd->dpy, s_atomClipboard, wnd->window, wnd->ClipboardTime ); + } + else + { + char * cMsg = "Cannot set primary selection\r\n"; + hb_gt_OutErr( ( BYTE * ) cMsg, strlen( cMsg ) ); + } + } } /* *********************************************************************** */ @@ -3087,50 +3208,57 @@ static void hb_gt_xwc_RequestSelection( PXWND_DEF wnd ) { if( !wnd->ClipboardOwner ) { - BOOL fRepeat = TRUE; - wnd->ClipboardRequest = s_atomUTF8String; - while( wnd->ClipboardRequest ) + Atom aRequest; + int iConnFD = ConnectionNumber( wnd->dpy ); + struct timeval timeout; + fd_set readfds; + + timeout.tv_sec = 3; + timeout.tv_usec = 0; + + wnd->ClipboardRcvd = FALSE; + wnd->ClipboardRequest = s_atomTargets; + aRequest = None; + + if( s_updateMode == XWC_ASYNC_UPDATE ) + s_iUpdateCounter = 150; + + do { - XConvertSelection( wnd->dpy, s_atomPrimary, wnd->ClipboardRequest, - s_atomCutBuffer0, wnd->window, CurrentTime ); + if( aRequest != wnd->ClipboardRequest ) + { + aRequest = wnd->ClipboardRequest; + if( aRequest == None ) + break; +#ifdef XWC_DEBUG + printf("XConvertSelection: %ld (%s)\r\n", aRequest, + XGetAtomName(wnd->dpy, aRequest)); fflush(stdout); +#endif + XConvertSelection( wnd->dpy, s_atomPrimary, aRequest, + s_atomCutBuffer0, wnd->window, wnd->lastEventTime ); + } if( s_updateMode == XWC_ASYNC_UPDATE ) { - s_iUpdateCounter = 100; - while( s_iUpdateCounter && wnd->ClipboardRequest ) - sleep( 1 ); + if( s_iUpdateCounter == 0 ) + break; + sleep( 1 ); } else { - int iConnFD = ConnectionNumber( wnd->dpy ); - struct timeval timeout; - fd_set readfds; - - timeout.tv_sec = 0; - timeout.tv_usec = 2500000; - - for( ;; ) + hb_gt_xwc_ProcessMessages( wnd ); + if( !wnd->ClipboardRcvd && wnd->ClipboardRequest == aRequest ) { - hb_gt_xwc_ProcessMessages( wnd ); - if( !wnd->ClipboardRequest ) - break; - FD_ZERO( &readfds ); FD_SET( iConnFD, &readfds ); if( select( iConnFD + 1, &readfds, NULL, NULL, &timeout ) <= 0 ) break; } } - if( wnd->ClipboardRequest ) - { - wnd->ClipboardRequest = 0; - } - else if( fRepeat ) - { - fRepeat = FALSE; - wnd->ClipboardRequest = s_atomString; - } } + while( !wnd->ClipboardRcvd && wnd->ClipboardRequest != None ); + + wnd->ClipboardRequest = None; } } @@ -3454,6 +3582,7 @@ static BOOL hb_gt_xwc_Info( int iType, PHB_GT_INFO pInfo ) case GTI_SCREENWIDTH: pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_wnd->width ); break; + case GTI_SCREENHEIGHT: pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_wnd->height ); break; @@ -3571,6 +3700,145 @@ static BOOL hb_gt_xwc_Info( int iType, PHB_GT_INFO pInfo ) return TRUE; } +static int hb_gt_xwc_gfx_Primitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +{ + int iRet = 1; + XColor color; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_gfx_Primitive(%d, %d, %d, %d, %d, %d)", iType, iTop, iLeft, iBottom, iRight, iColor ) ); + + hb_gt_xwc_Initialize( s_wnd ); + hb_gt_Refresh(); + + switch( iType ) + { + case GFX_ACQUIRESCREEN: + /* TODO: */ + break; + + case GFX_RELEASESCREEN: + /* TODO: */ + break; + + case GFX_MAKECOLOR: + /* TODO: */ + color.red = iTop * 256; + color.green = iLeft * 256; + color.blue = iBottom * 256; + color.flags = DoRed | DoGreen | DoBlue; + hb_gt_xwc_AllocColor( s_wnd, &color ); + iRet = color.pixel; + break; + + case GFX_CLIPTOP: + iRet = s_wnd->ClipRect.y; + break; + + case GFX_CLIPLEFT: + iRet = s_wnd->ClipRect.x; + break; + + case GFX_CLIPBOTTOM: + iRet = s_wnd->ClipRect.y + s_wnd->ClipRect.height - 1; + break; + + case GFX_CLIPRIGHT: + iRet = s_wnd->ClipRect.x + s_wnd->ClipRect.width - 1; + break; + + case GFX_SETCLIP: + s_wnd->ClipRect.y = iTop; + s_wnd->ClipRect.x = iLeft; + s_wnd->ClipRect.width = iBottom; + s_wnd->ClipRect.height = iRight; + XSetClipRectangles( s_wnd->dpy, s_wnd->gc, 0, 0, &s_wnd->ClipRect, 1, YXBanded ); + break; + + case GFX_DRAWINGMODE: + iRet = GFX_MODE_SOLID; + break; + + case GFX_GETPIXEL: + /* TODO: */ + iRet = 0; + break; + + case GFX_PUTPIXEL: + XSetForeground( s_wnd->dpy, s_wnd->gc, iBottom ); + XDrawPoint( s_wnd->dpy, s_wnd->drw, s_wnd->gc, iLeft, iTop ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft, iTop, iLeft, iTop ); + break; + + case GFX_LINE: + XSetForeground( s_wnd->dpy, s_wnd->gc, iColor ); + XDrawLine( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iRight, iBottom ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft, iTop, iRight, iBottom ); + break; + + case GFX_RECT: + XSetForeground( s_wnd->dpy, s_wnd->gc, iColor ); + XDrawRectangle( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iRight - iLeft, iBottom - iTop ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft, iTop, iRight, iBottom ); + break; + + case GFX_FILLEDRECT: + XSetForeground( s_wnd->dpy, s_wnd->gc, iColor ); + XFillRectangle( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iRight - iLeft, iBottom - iTop ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft, iTop, iRight, iBottom ); + break; + + case GFX_CIRCLE: + XSetForeground( s_wnd->dpy, s_wnd->gc, iRight ); + XDrawArc( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iBottom, iBottom, 0, 360*64 ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft - iBottom, iTop - iBottom, + iLeft + iBottom, iTop + iBottom ); + break; + + case GFX_FILLEDCIRCLE: + XSetForeground( s_wnd->dpy, s_wnd->gc, iRight ); + XFillArc( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iBottom, iBottom, 0, 360*64 ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft - iBottom, iTop - iBottom, + iLeft + iBottom, iTop + iBottom ); + break; + + case GFX_ELLIPSE: + XSetForeground( s_wnd->dpy, s_wnd->gc, iColor ); + XDrawArc( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iRight, iBottom, 0, 360*64 ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft - iRight, iTop - iBottom, + iLeft + iRight, iTop + iBottom ); + break; + + case GFX_FILLEDELLIPSE: + XSetForeground( s_wnd->dpy, s_wnd->gc, iColor ); + XFillArc( s_wnd->dpy, s_wnd->drw, s_wnd->gc, + iLeft, iTop, iRight, iBottom, 0, 360*64 ); + hb_gt_xwc_InvalidatePts( s_wnd, iLeft - iRight, iTop - iBottom, + iLeft + iRight, iTop + iBottom ); + break; + + case GFX_FLOODFILL: + /* TODO: */ + hb_gt_xwc_InvalidatePts( s_wnd, 0, 0, s_wnd->width, s_wnd->height ); + break; + + default: + return HB_GTSUPER_GFXPRIMITIVE( iType, iTop, iLeft, iBottom, iRight, iColor ); + } + + if ( hb_gt_DispCount() == 0 ) + { + hb_gt_xwc_RealRefresh(); + } + + return iRet; +} + /* *********************************************************************** */ static void hb_gt_xwc_Redraw( int iRow, int iCol, int iSize ) @@ -3646,6 +3914,8 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) pFuncTable->MouseButtonState = hb_gt_xwc_mouse_ButtonState; pFuncTable->MouseCountButton = hb_gt_xwc_mouse_CountButton; + pFuncTable->GfxPrimitive = hb_gt_xwc_gfx_Primitive; + return TRUE; } diff --git a/harbour/source/rtl/gtxwc/gtxwc.h b/harbour/source/rtl/gtxwc/gtxwc.h index 24e84fbdd8..0de2aeb938 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.h +++ b/harbour/source/rtl/gtxwc/gtxwc.h @@ -67,7 +67,7 @@ #include "hbapiitm.h" #include "hbapierr.h" #include "inkey.ch" -#include "error.ch" +#include "hbgfxdef.ch" #ifndef HB_CDP_SUPPORT_OFF #include "hbapicdp.h" diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index 483f83e426..7c44f01e5b 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -1920,6 +1920,28 @@ static int hb_gt_def_MouseReadKey( int iEventMask ) return iKey; } +static int hb_gt_def_GfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +{ + HB_SYMBOL_UNUSED( iType ); + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( iBottom ); + HB_SYMBOL_UNUSED( iRight ); + HB_SYMBOL_UNUSED( iColor ); + + return 0; +} + +static void hb_gt_def_GfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ) +{ + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( szText ); + HB_SYMBOL_UNUSED( iColor ); + HB_SYMBOL_UNUSED( iSize ); + HB_SYMBOL_UNUSED( iWidth ); +} + static void hb_gt_def_WhoCares( void * pCargo ) { HB_SYMBOL_UNUSED( pCargo ); @@ -2029,6 +2051,8 @@ static HB_GT_FUNCS gtCoreFunc = MouseButtonPressed : hb_gt_def_MouseButtonPressed , MouseButtonReleased : hb_gt_def_MouseButtonReleased , MouseReadKey : hb_gt_def_MouseReadKey , + GfxPrimitive : hb_gt_def_GfxPrimitive , + GfxText : hb_gt_def_GfxText , WhoCares : hb_gt_def_WhoCares }; #else @@ -2133,6 +2157,8 @@ static HB_GT_FUNCS gtCoreFunc = hb_gt_def_MouseButtonPressed , hb_gt_def_MouseButtonReleased , hb_gt_def_MouseReadKey , + hb_gt_def_GfxPrimitive , + hb_gt_def_GfxText , hb_gt_def_WhoCares }; #endif @@ -2633,6 +2659,16 @@ int hb_mouse_ReadKey( int iEventMask ) return gtCoreFunc.MouseReadKey( iEventMask ); } +int hb_gt_GfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +{ + return gtCoreFunc.GfxPrimitive( iType, iTop, iLeft, iBottom, iRight, iColor ); +} + +void hb_gt_GfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ) +{ + gtCoreFunc.GfxText( iTop, iLeft, szText, iColor, iSize, iWidth ); +} + void hb_gt_WhoCares( void * pCargo ) { gtCoreFunc.WhoCares( pCargo ); diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 766263567a..bea6854a04 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -4579,7 +4579,7 @@ static void hb_vmSFrame( PHB_SYMB pSym ) /* sets the statics frame for a fu HB_TRACE(HB_TR_DEBUG, ("hb_vmSFrame(%p)", pSym)); /* _INITSTATICS is now the statics frame. Statics() changed it! */ - hb_stack.iStatics = pSym->value.iStaticsBase; /* pSym is { "$_INITSTATICS", HB_FS_INIT | HB_FS_EXIT, _INITSTATICS } for each PRG */ + hb_stack.iStatics = pSym->value.iStaticsBase; /* pSym is { "$_INITSTATICS", HB_FS_INITEXIT, _INITSTATICS } for each PRG */ } static void hb_vmStatics( PHB_SYMB pSym, USHORT uiStatics ) /* initializes the global aStatics array or redimensionates it */ @@ -5697,7 +5697,7 @@ static void hb_vmReleaseLocalSymbols( void ) } /* This calls all _INITSTATICS functions defined in the application. - * We are using a special symbol's scope ( HB_FS_INIT | HB_FS_EXIT ) to mark + * We are using a special symbol's scope HB_FS_INITEXIT to mark * this function. These two bits cannot be marked at the same * time for normal user defined functions. */ @@ -5709,7 +5709,7 @@ static void hb_vmDoInitStatics( void ) do { - if( ( pLastSymbols->hScope & ( HB_FS_INIT | HB_FS_EXIT ) ) == ( HB_FS_INIT | HB_FS_EXIT ) ) + if( ( pLastSymbols->hScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT ) { USHORT ui; @@ -5717,7 +5717,7 @@ static void hb_vmDoInitStatics( void ) { HB_SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + ui )->scope.value & ( HB_FS_EXIT | HB_FS_INIT ); - if( scope == ( HB_FS_INIT | HB_FS_EXIT ) ) + if( scope == HB_FS_INITEXIT ) { hb_vmPushSymbol( pLastSymbols->pModuleSymbols + ui ); hb_vmPushNil(); diff --git a/harbour/tests/gfx.prg b/harbour/tests/gfx.prg new file mode 100644 index 0000000000..65d80a0c3c --- /dev/null +++ b/harbour/tests/gfx.prg @@ -0,0 +1,101 @@ +/* + * $Id$ + * + */ + +#include "hbgtinfo.ch" +#include "hbgfx.ch" + +#define WELCOME "Welcome to the World of xHarbour multiplatform Graphics!" + +Function Main +Local nScreenWidth, nFontHeight, nFontWidth +Local nTop, nLeft, nHeight, nWidth, nColor, nSec := Seconds() + + If !hb_gtInfo(GTI_ISGRAPHIC) + ? + ? "You are using a non graphics capable gt:" + ? hb_gtVersion() + ? + Quit + End + + If hb_gtInfo(GTI_DESKTOPWIDTH) > 1000 + hb_gtInfo(GTI_FONTSIZE, 24) + hb_gtInfo(GTI_FONTWIDTH, 12) + End + + ? hb_gtVersion(1) + + nScreenWidth := hb_gtInfo(GTI_SCREENWIDTH) + nFontHeight := hb_gtInfo(GTI_FONTSIZE) + nFontWidth := hb_gtInfo(GTI_FONTWIDTH) + + SetColor("n/w") + @ 0, 0 Say Space(MaxCol() + 1) + @ 1, 0 Say PadC(WELCOME, MaxCol() + 1) + @ 2, 0 Say Space(MaxCol() + 1) + + hb_gtInfo(GTI_WINTITLE, "Cross-GT, multiplatform graphics demo") + + PutFrame(nFontHeight / 2,; + MaxCol() / 2 * nFontWidth - Len(WELCOME) / 2 * nFontWidth - nFontWidth,; + nFontHeight * 2 + nFontHeight / 2,; + nFontWidth + MaxCol() / 2 * nFontWidth + Len(WELCOME) / 2 * nFontWidth,; + hb_gfxMakeColor(0, 0, 0), hb_gfxMakeColor(255, 255, 255)) + + While Inkey() == 0 + nTop := Int(hb_Random(3.1 * nFontHeight, hb_gtInfo(GTI_SCREENHEIGHT))) + nLeft := Int(hb_Random(hb_gtInfo(GTI_SCREENWIDTH))) + nHeight := Int(hb_Random(251)) + nWidth := Int(hb_Random(251)) + nColor := hb_gfxMakeColor(Int(hb_Random(32, 256)), Int(hb_Random(32, 256)), Int(hb_Random(32, 256))) + + Switch Int(hb_Random(1, 9)) + Case 1 + hb_gfxLine(nTop, nLeft, nTop + nHeight, nLeft + nWidth, nColor) + Exit + Case 2 + hb_gfxRect(nTop, nLeft, nTop + nHeight, nLeft + nWidth, nColor) + Exit + Case 3 + hb_gfxFilledRect(nTop, nLeft, nTop + nHeight, nLeft + nWidth, nColor) + Exit + Case 4 + nTop += nHeight + hb_gfxCircle(nTop, nLeft, nHeight, nColor) + Exit + Case 5 + nTop += nHeight + hb_gfxFilledCircle(nTop, nLeft, nHeight, nColor) + Exit + Case 6 + nTop += nHeight + hb_gfxEllipse(nTop, nLeft, nHeight, nWidth, nColor) + Exit + Case 7 + nTop += nHeight + hb_gfxFilledEllipse(nTop, nLeft, nHeight, nWidth, nColor) + Exit + Case 8 + nHeight %= 64 + If nHeight % 2 == 1 + nHeight++ + End + hb_gfxText(nTop, nLeft, "Hello", nColor, nHeight) + Exit + End + If Seconds() - nSec > 3 + hb_gfxFloodFill(0, 0, nColor) + nSec := Seconds() + End + End +Return Nil + +Function PutFrame(nTop, nLeft, nBottom, nRight, nColor1, nColor2) + + hb_gfxRect(ntop, nLeft, nBottom, nRight, nColor1) + hb_gfxRect(ntop + 1, nLeft + 1, nBottom - 1, nRight - 1, nColor2) +/* hb_gfxLine(nTop + 1, nLeft + 1, nTop + 1, nRight - 1, nColor2) + hb_gfxLine(nTop + 2, nLeft + 1, nBottom - 1, nLeft + 1, nColor2) */ +Return Nil diff --git a/harbour/utils/hbpp/hbpp.c b/harbour/utils/hbpp/hbpp.c index c2b9cbf90c..d2512976df 100644 --- a/harbour/utils/hbpp/hbpp.c +++ b/harbour/utils/hbpp/hbpp.c @@ -541,3 +541,8 @@ PINLINE hb_compInlineAdd( char * szFunName ) HB_SYMBOL_UNUSED( szFunName ); return NULL; } + +void hb_compParserStop( void ) +{ + ; +}