2010-01-18 11:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/dbinfo.ch
  * harbour/include/hbrdddbf.h
  * harbour/src/rdd/dbf1.c
  * harbour/src/rdd/dbfntx/dbfntx1.c
  * harbour/src/rdd/dbfnsx/dbfnsx1.c
    * renamed DB_DBFLOCK_XHB64 => DB_DBFLOCK_HB64

  * harbour/contrib/hbwin/win_tprn.prg
    * updated some comments and formatting

  * harbour/contrib/xhb/Makefile
  + harbour/contrib/xhb/xhw32prn.prg
    + added WIN32PRN class, it inherits from WIN_PRN class hiding some
      differences between Harbour and xHarbour in paper size setting and
      separated horizontal and vertical alignment setting
This commit is contained in:
Przemyslaw Czerpak
2010-01-18 10:21:26 +00:00
parent b3f7ff7e11
commit 1b9a7424b9
9 changed files with 200 additions and 50 deletions

View File

@@ -17,6 +17,23 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-18 11:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/dbinfo.ch
* harbour/include/hbrdddbf.h
* harbour/src/rdd/dbf1.c
* harbour/src/rdd/dbfntx/dbfntx1.c
* harbour/src/rdd/dbfnsx/dbfnsx1.c
* renamed DB_DBFLOCK_XHB64 => DB_DBFLOCK_HB64
* harbour/contrib/hbwin/win_tprn.prg
* updated some comments and formatting
* harbour/contrib/xhb/Makefile
+ harbour/contrib/xhb/xhw32prn.prg
+ added WIN32PRN class, it inherits from WIN_PRN class hiding some
differences between Harbour and xHarbour in paper size setting and
separated horizontal and vertical alignment setting
2010-01-18 11:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_tprn.prg
! Fix to prev.

View File

@@ -90,30 +90,30 @@ CREATE CLASS WIN_PRN
METHOD CheckPage()
METHOD GetDocumentProperties()
METHOD SetFont( cFontName, nPointSize, xWidth, nBold, lUnderline, lItalic, nCharSet )
// NB: xWidth is in "CharactersPerInch"
// _OR_ { nMul, nDiv } which equates to "CharactersPerInch"
// _OR_ ZERO ( 0 ) which uses the default width of the font
// for the nPointSize
// IF xWidth (or nDiv) is < 0 then Fixed font is emulated
// NB: xWidth is in "CharactersPerInch"
// _OR_ { nMul, nDiv } which equates to "CharactersPerInch"
// _OR_ ZERO ( 0 ) which uses the default width of the font
// for the nPointSize
// IF xWidth (or nDiv) is < 0 then Fixed font is emulated
METHOD SetDefaultFont()
METHOD GetFonts() // Returns array of { "FontName", lFixed, lTrueType, nCharSetRequired }
METHOD GetFonts() // Returns array of { "FontName", lFixed, lTrueType, nCharSetRequired }
METHOD Bold( nWeight )
METHOD UnderLine( lUnderline )
METHOD Italic( lItalic )
METHOD SetDuplexType( nDuplexType ) // Get/Set current Duplexmode
METHOD SetPrintQuality( nPrintQuality ) // Get/Set Printquality
METHOD SetDuplexType( nDuplexType ) // Get/Set current Duplexmode
METHOD SetPrintQuality( nPrintQuality ) // Get/Set Printquality
METHOD CharSet( nCharSet )
METHOD SetPos( nPosX, nPosY ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col )
METHOD SetPos( nPosX, nPosY ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col )
METHOD SetColor( nClrText, nClrPane, nAlign )
METHOD SetBkMode( nMode ) // OPAQUE == 2 or TRANSPARENT == 1
// Set Background mode
METHOD SetBkMode( nMode ) // Set Background mode
// 1 == TRANSPARENT or 2 == OPAQUE
METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : WIN_TA_*
METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col )
METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : WIN_TA_*
METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col )
METHOD SetPen( nStyle, nWidth, nColor )
@@ -129,11 +129,11 @@ CREATE CLASS WIN_PRN
METHOD DrawBitMap( oBmp )
/* Clipper DOS compatible functions. */
METHOD SetPrc( nRow, nCol ) // Based on ::LineHeight and current ::CharWidth
METHOD SetPrc( nRow, nCol ) // Based on ::LineHeight and current ::CharWidth
METHOD PRow()
METHOD PCol()
METHOD MaxRow() // Based on ::LineHeight & Form dimensions
METHOD MaxCol() // Based on ::CharWidth & Form dimensions
METHOD MaxRow() // Based on ::LineHeight & Form dimensions
METHOD MaxCol() // Based on ::CharWidth & Form dimensions
METHOD MM_TO_POSX( nMm ) // Convert position on page from MM to pixel location Column
METHOD MM_TO_POSY( nMm ) // " " " " " " " " " Row
@@ -154,25 +154,24 @@ CREATE CLASS WIN_PRN
VAR PageNumber INIT 0
VAR hPrinterDc INIT 0
// These next 4 variables must be set before calling ::Create() if
// you wish to alter the defaults
// These next 6 variables must be set before calling ::Create() if
// you wish to alter the defaults
VAR FormType INIT 0
VAR BinNumber INIT 0
VAR Landscape INIT .F.
VAR Copies INIT 1
VAR PaperLength INIT 0 // Value is * 1/10 of mm 1000 = 10cm
VAR PaperWidth INIT 0 // " " " " " "
VAR PaperLength INIT 0 // Value is * 1/10 of mm 1000 = 10cm
VAR PaperWidth INIT 0 // " " " " " "
VAR SetFontOk INIT .F.
VAR hFont INIT 0
VAR FontName INIT "" // Current Point size for font
VAR FontPointSize INIT 12 // Point size for font
VAR FontWidth INIT { 0, 0 } // { Mul, Div } Calc width: nWidth := wapi_MulDiv( nMul, win_GetDeviceCaps( HDC, WIN_LOGPIXELSX ), nDiv )
// If font width is specified it is in "characters per inch" to emulate DotMatrix
VAR fBold INIT 0 HIDDEN // font darkness weight (Bold). See wingdi.h or WIN SDK CreateFont() for valid values
VAR fUnderLine INIT .F. HIDDEN // UnderLine is on or off
VAR fItalic INIT .F. HIDDEN // Italic is on or off
VAR FontName INIT "" // Current Point size for font
VAR FontPointSize INIT 12 // Point size for font
VAR FontWidth INIT { 0, 0 } // { Mul, Div } Calc width: nWidth := wapi_MulDiv( nMul, win_GetDeviceCaps( HDC, WIN_LOGPIXELSX ), nDiv )
// If font width is specified it is in "characters per inch" to emulate DotMatrix
VAR fBold INIT 0 HIDDEN // font darkness weight (Bold). See wingdi.h or WIN SDK CreateFont() for valid values
VAR fUnderLine INIT .F. HIDDEN // UnderLine is on or off
VAR fItalic INIT .F. HIDDEN // Italic is on or off
VAR fCharSet INIT WIN_DEFAULT_CHARSET HIDDEN
VAR PixelsPerInchY INIT 0
@@ -189,8 +188,8 @@ CREATE CLASS WIN_PRN
VAR fCharWidth INIT 0 HIDDEN
VAR BitmapsOk INIT .F.
VAR NumColors INIT 1
VAR fDuplexType INIT 0 HIDDEN // WIN_DMDUP_SIMPLEX, 22/02/2007 change to 0 to use default printer settings
VAR fPrintQuality INIT 0 HIDDEN // WIN_DMRES_HIGH, 22/02/2007 change to 0 to use default printer settings
VAR fDuplexType INIT 0 HIDDEN // WIN_DMDUP_SIMPLEX, 22/02/2007 change to 0 to use default printer settings
VAR fPrintQuality INIT 0 HIDDEN // WIN_DMRES_HIGH, 22/02/2007 change to 0 to use default printer settings
VAR fNewDuplexType INIT 0 HIDDEN
VAR fNewPrintQuality INIT 0 HIDDEN
VAR fOldLandScape INIT .F. HIDDEN

View File

@@ -68,6 +68,7 @@ PRG_SOURCES := \
xhbmt.prg \
xhbver.prg \
xthrow.prg \
xhw32prn.prg \
\
hjwindow.prg \
hterrsys.prg \

View File

@@ -0,0 +1,133 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* xHarbour compatible WIN32PRN class which inherits from WIN_PRN class
* hiding some differences between Harbour and xHarbour
*
* original WIN32PRN/WIN_PRN class author:
* Copyright 2004 Peter Rees <peter@rees.co.nz> Rees Software & Systems Ltd
* this wrapper:
* Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option )
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/ ).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*/
#ifndef __PLATFORM__WINDOWS
FUNCTION WIN32PRN()
RETURN NIL
#else
#include "hbclass.ch"
#include "common.ch"
#define TA_LEFT 0
#define TA_BOTTOM 8
#define FORM_CUSTOM 256
CREATE CLASS WIN32PRN FROM WIN_PRN
METHOD Create()
METHOD StartPage()
METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert )
METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert )
METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, ;
nWidth, nBold, lUnderLine, lItalic, lNewLine, ;
lUpdatePosX, nColor, nAlignHori, nAlignVert )
VAR SetTextHori INIT TA_LEFT // Default horizontal alignment SetTextAlign() (TEXTOUT)
VAR SetTextVert INIT TA_BOTTOM // Default vertical alignment for SetTextAlign() (TEXTOUT)
/* not implemented */
// METHOD TextOutW( wString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert )
// METHOD TextOutWAt( nPosX, nPosY, wString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert )
// VAR AskProperties INIT .F.
ENDCLASS
METHOD StartPage() CLASS WIN32PRN
IF ::PaperLength > 0 .AND. ::PaperWidth > 0
::FormType := FORM_CUSTOM
ENDIF
RETURN ::WIN_PRN:Create()
METHOD Create() CLASS WIN32PRN
IF ::PaperLength > 0 .AND. ::PaperWidth > 0
::FormType := FORM_CUSTOM
ENDIF
RETURN ::WIN_PRN:StartPage()
METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert ) CLASS WIN32PRN
DEFAULT nAlignHori TO ::SetTextHori
DEFAULT nAlignVert TO ::SetTextVert
RETURN ::WIN_PRN:TextOut( cString, lNewLine, lUpdatePosX, ;
HB_BITOR( nAlignHori, nAlignVert ) )
METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert ) CLASS WIN32PRN
DEFAULT nAlignHori TO ::SetTextHori
DEFAULT nAlignVert TO ::SetTextVert
RETURN ::WIN_PRN:TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, ;
HB_BITOR( nAlignHori, nAlignVert ) )
METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, ;
nWidth, nBold, lUnderLine, lItalic, lNewLine, ;
lUpdatePosX, nColor, nAlignHori, nAlignVert ) CLASS WIN32PRN
DEFAULT nAlignHori TO ::SetTextHori
DEFAULT nAlignVert TO ::SetTextVert
RETURN ::WIN_PRN:TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, ;
nWidth, nBold, lUnderLine, lItalic, lNewLine, ;
lUpdatePosX, nColor, nAlignHori, ;
HB_BITOR( nAlignHori, nAlignVert ) )
#endif /* __PLATFORM__WINDOWS */

View File

@@ -368,7 +368,7 @@
#define DB_DBFLOCK_CL53 2
#define DB_DBFLOCK_VFP 3
#define DB_DBFLOCK_CL53EXT 4
#define DB_DBFLOCK_XHB64 5
#define DB_DBFLOCK_HB64 5
#endif /* HB_DBINFO_CH_ */

View File

@@ -68,40 +68,40 @@ HB_EXTERN_BEGIN
#define DBF_LOCKPOS_VFP 0x40000000UL
#define DBF_LOCKPOS_VFPX 0x7ffffffeUL
#define DBF_LOCKPOS_CL53EXT 4000000000UL
#define DBF_LOCKPOS_XHB64 HB_LL( 0x7FFFFFFF00000001 )
#define DBF_LOCKPOS_HB64 HB_LL( 0x7FFFFFFF00000001 )
#define DBF_LOCKDIR_CLIP 1
#define DBF_LOCKDIR_CL53 1
#define DBF_LOCKDIR_VFP 2 /* lock forward at at record offset */
#define DBF_LOCKDIR_VFPX -1
#define DBF_LOCKDIR_CL53EXT 1
#define DBF_LOCKDIR_XHB64 1
#define DBF_LOCKDIR_HB64 1
#define DBF_FLCKSIZE_CLIP 1000000000UL
#define DBF_FLCKSIZE_CL53 1000000000UL
#define DBF_FLCKSIZE_VFP 0x3ffffffdUL
#define DBF_FLCKSIZE_VFPX 0x07ffffffUL
#define DBF_FLCKSIZE_CL53EXT 294967295UL
#define DBF_FLCKSIZE_XHB64 0x7ffffffeUL
#define DBF_FLCKSIZE_HB64 0x7ffffffeUL
#define DBF_RLCKSIZE_CLIP 1UL
#define DBF_RLCKSIZE_CL53 1UL
#define DBF_RLCKSIZE_VFP 1UL
#define DBF_RLCKSIZE_VFPX 1UL
#define DBF_RLCKSIZE_CL53EXT 1UL
#define DBF_RLCKSIZE_XHB64 1UL
#define DBF_RLCKSIZE_HB64 1UL
#define IDX_LOCKPOS_CLIP 1000000000UL
#define IDX_LOCKPOS_CL53 0xfffeffffUL
#define IDX_LOCKPOS_VFP 0x7ffffffeUL
#define IDX_LOCKPOS_CL53EXT 0xfffeffffUL
#define IDX_LOCKPOS_XHB64 HB_LL( 0x7FFFFFFF00000001 )
#define IDX_LOCKPOS_HB64 HB_LL( 0x7FFFFFFF00000001 )
#define IDX_LOCKPOOL_CLIP 0UL
#define IDX_LOCKPOOL_CL53 0x00010000UL
#define IDX_LOCKPOOL_VFP 0UL
#define IDX_LOCKPOOL_CL53EXT 0x00010000UL
#define IDX_LOCKPOOL_XHB64 0UL
#define IDX_LOCKPOOL_HB64 0UL
/* Index dirty read flags */

View File

@@ -1142,9 +1142,9 @@ HB_BOOL hb_dbfLockIdxGetData( BYTE bScheme, HB_FOFFSET *ulPos, HB_FOFFSET *ulPoo
break;
#ifndef HB_LONG_LONG_OFF
case DB_DBFLOCK_XHB64:
*ulPos = IDX_LOCKPOS_XHB64;
*ulPool = IDX_LOCKPOOL_XHB64;
case DB_DBFLOCK_HB64:
*ulPos = IDX_LOCKPOS_HB64;
*ulPool = IDX_LOCKPOOL_HB64;
break;
#endif
@@ -1263,11 +1263,11 @@ static HB_ERRCODE hb_dbfLockData( DBFAREAP pArea,
break;
#ifndef HB_LONG_LONG_OFF
case DB_DBFLOCK_XHB64:
*ulPos = DBF_LOCKPOS_XHB64;
*iDir = DBF_LOCKDIR_XHB64;
*ulFlSize = DBF_FLCKSIZE_XHB64;
*ulRlSize = DBF_RLCKSIZE_XHB64;
case DB_DBFLOCK_HB64:
*ulPos = DBF_LOCKPOS_HB64;
*iDir = DBF_LOCKDIR_HB64;
*ulFlSize = DBF_FLCKSIZE_HB64;
*ulRlSize = DBF_RLCKSIZE_HB64;
break;
#endif
default:
@@ -3376,7 +3376,7 @@ static HB_ERRCODE hb_dbfInfo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
case DB_DBFLOCK_CL53EXT:
case DB_DBFLOCK_VFP:
#ifndef HB_LONG_LONG_OFF
case DB_DBFLOCK_XHB64:
case DB_DBFLOCK_HB64:
#endif
pArea->bLockType = ( BYTE ) iScheme;
}
@@ -5709,7 +5709,7 @@ static HB_ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect
case DB_DBFLOCK_CL53EXT:
case DB_DBFLOCK_VFP:
#ifndef HB_LONG_LONG_OFF
case DB_DBFLOCK_XHB64:
case DB_DBFLOCK_HB64:
#endif
pData->bLockType = ( int ) iScheme;
}

View File

@@ -6866,7 +6866,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI
}
else
{
pIndex->LargeFile = ( pIndex->pArea->dbfarea.bLockType == DB_DBFLOCK_XHB64 );
pIndex->LargeFile = ( pIndex->pArea->dbfarea.bLockType == DB_DBFLOCK_HB64 );
}
pIndexPtr = &pArea->lpIndexes;

View File

@@ -1600,7 +1600,7 @@ static LPTAGINFO hb_ntxTagLoad( LPNTXINDEX pIndex, ULONG ulBlock,
/* TODO: this breaks unlocking !!! */
if( usType & NTX_FLAG_LARGEFILE )
{
pIndex->Owner->dbfarea.bLockType = DB_DBFLOCK_XHB64;
pIndex->Owner->dbfarea.bLockType = DB_DBFLOCK_HB64;
}
else if( usType & NTX_FLAG_EXTLOCK )
{
@@ -6477,7 +6477,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI
}
else
{
pIndex->LargeFile = ( pIndex->Owner->dbfarea.bLockType == DB_DBFLOCK_XHB64 );
pIndex->LargeFile = ( pIndex->Owner->dbfarea.bLockType == DB_DBFLOCK_HB64 );
}
}