2010-01-21 11:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* INSTALL
    + Documented minimum requirement of CEGCC 0.55 (mingwarm)

  * contrib/hbwin/hbwin.ch
    + Added WIN_*_PRECIS constants.
    + Added WIN_DT_* (WAPI_DRAWTEXT()) constants.

  * contrib/hbwin/Makefile
  + contrib/hbwin/win_dlg.c
    + Added WIN_PRINTDLGDC() printer dialog.
      Some ideas/lines taken from HWGUI project.

  * contrib/hbwin/hbwapi.h
  * contrib/hbwin/wapi_wingdi.c
    + Added hbwapi_par_RECT() supporting both hash and array input.
    ! WAPI_CREATEFONT() fixed to use neutral defaults.
    ! WAPI_SELECTOBJECT() fixed two warnings.

  * contrib/hbwin/wapi_winuser.c
    + Added WAPI_DRAWTEXT().
This commit is contained in:
Viktor Szakats
2010-01-21 10:54:45 +00:00
parent 6d5ea44fbc
commit 2e4a02bfd7
8 changed files with 241 additions and 36 deletions

View File

@@ -17,6 +17,28 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-21 11:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
+ Documented minimum requirement of CEGCC 0.55 (mingwarm)
* contrib/hbwin/hbwin.ch
+ Added WIN_*_PRECIS constants.
+ Added WIN_DT_* (WAPI_DRAWTEXT()) constants.
* contrib/hbwin/Makefile
+ contrib/hbwin/win_dlg.c
+ Added WIN_PRINTDLGDC() printer dialog.
Some ideas/lines taken from HWGUI project.
* contrib/hbwin/hbwapi.h
* contrib/hbwin/wapi_wingdi.c
+ Added hbwapi_par_RECT() supporting both hash and array input.
! WAPI_CREATEFONT() fixed to use neutral defaults.
! WAPI_SELECTOBJECT() fixed two warnings.
* contrib/hbwin/wapi_winuser.c
+ Added WAPI_DRAWTEXT().
2010-01-21 11:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbnetio/netiocli.c
* respect passed parameters as default values in netio_decode()
@@ -40,7 +62,7 @@
* contrib/hbide/ideactions.prg
* contrib/hbide/ideeditor.prg
+ Implemented: Formatting - <Format Braces>
; These formatting actions are initiated from the fact that
code examples scattered on the net about Qt examples are
written in such a way that I was unable to grasp the contents.
@@ -58,7 +80,7 @@
This can be achieved via Mainmenu <Edit><Format...> option.
! New: Find/Replace: Current selelcted text in "Find what:" control
in selected state.
% Changed: The way hbide.ini is loaded.
% Changed: The way hbide.ini is loaded.
cHbideIni := hb_argv( 0 )
@@ -165,7 +187,7 @@
(we can readd them for extra safety, but in this case
they should be readded consistently for all source files)
% Deleted '! defined( __RSXNT__ )' guards
RSXNT is not supported a dead compiler since long.
RSXNT is not supported compiler and dead since long.
% Deleted '! defined( __CYGWIN__ )' guards.
It compiles with current Cygwin, if someone is interested
in older versions, pls send build results.

View File

@@ -528,7 +528,7 @@ HARBOUR
wce
---
mingw - MinGW GNU C x86
mingwarm - MinGW GNU C ARM
mingwarm - MinGW GNU C ARM (from CEGCC 0.55 and above)
msvcarm - Microsoft Visual C++ ARM
poccarm - Pelles C ARM 5.0

View File

@@ -21,6 +21,7 @@ C_SOURCES := \
wce_simc.c \
wce_smsc.c \
win_com.c \
win_dlg.c \
win_dll.c \
win_misc.c \
win_osc.c \

View File

@@ -99,16 +99,19 @@
HB_EXTERN_BEGIN
HB_EXPORT void hbwapi_SetLastError( DWORD dwLastError );
HB_EXPORT DWORD hbwapi_GetLastError( void );
HB_EXPORT void hbwapi_SetLastError( DWORD dwLastError );
HB_EXPORT DWORD hbwapi_GetLastError( void );
HB_EXPORT HDC hbwapi_par_HDC( int iParam );
HB_EXPORT HPEN hbwapi_par_HPEN( int iParam );
HB_EXPORT HFONT hbwapi_par_HFONT( int iParam );
HB_EXPORT RECT * hbwapi_par_RECT( RECT * p, int iParam, HB_BOOL bMandatory );
HB_EXPORT DEVMODE * hbwapi_par_DEVMODE( DEVMODE * p, int iParam, HB_BOOL bMandatory );
HB_EXPORT void hbwapi_ret_HDC( HDC p );
HB_EXPORT void hbwapi_ret_HPEN( HPEN p );
HB_EXPORT void hbwapi_ret_HFONT( HFONT p );
HB_EXPORT HDC hbwapi_par_HDC( int iParam );
HB_EXPORT HPEN hbwapi_par_HPEN( int iParam );
HB_EXPORT HFONT hbwapi_par_HFONT( int iParam );
HB_EXPORT void hbwapi_ret_HDC( HDC p );
HB_EXPORT void hbwapi_ret_HPEN( HPEN p );
HB_EXPORT void hbwapi_ret_HFONT( HFONT p );
HB_EXTERN_END

View File

@@ -231,10 +231,45 @@
#define WIN_NONANTIALIASED_QUALITY 3
#define WIN_ANTIALIASED_QUALITY 4
/* WAPI_CREATEFONT() output precision values */
#define WIN_OUT_DEFAULT_PRECIS 0
#define WIN_OUT_STRING_PRECIS 1
#define WIN_OUT_CHARACTER_PRECIS 2
#define WIN_OUT_STROKE_PRECIS 3
#define WIN_OUT_TT_PRECIS 4
#define WIN_OUT_DEVICE_PRECIS 5
#define WIN_OUT_RASTER_PRECIS 6
#define WIN_OUT_TT_ONLY_PRECIS 7
#define WIN_OUT_OUTLINE_PRECIS 8
#define WIN_OUT_PS_ONLY_PRECIS 10
/* WIN_SETBKMODE() modes */
#define WIN_TRANSPARENT 1
#define WIN_OPAQUE 2
/* WAPI_DRAWTEXT() format methods */
#define WIN_DT_BOTTOM 8
#define WIN_DT_CALCRECT 1024
#define WIN_DT_CENTER 1
#define WIN_DT_EDITCONTROL 8192
#define WIN_DT_END_ELLIPSIS 32768
#define WIN_DT_PATH_ELLIPSIS 16384
#define WIN_DT_WORD_ELLIPSIS 0x40000
#define WIN_DT_EXPANDTABS 64
#define WIN_DT_EXTERNALLEADING 512
#define WIN_DT_LEFT 0
#define WIN_DT_MODIFYSTRING 65536
#define WIN_DT_NOCLIP 256
#define WIN_DT_NOPREFIX 2048
#define WIN_DT_RIGHT 2
#define WIN_DT_RTLREADING 131072
#define WIN_DT_SINGLELINE 32
#define WIN_DT_TABSTOP 128
#define WIN_DT_TOP 0
#define WIN_DT_VCENTER 4
#define WIN_DT_WORDBREAK 16
#define WIN_DT_INTERNAL 4096
/* Windows charset values (WIN_CREATEFONT()) */
#define WIN_ANSI_CHARSET 0
#define WIN_DEFAULT_CHARSET 1

View File

@@ -58,35 +58,63 @@
#include "hbwinuni.h"
#include "hbwapi.h"
RECT * hbwapi_par_RECT( RECT * p, int iParam, HB_BOOL bMandatory )
{
PHB_ITEM pStru = hb_param( iParam, HB_IT_ANY );
memset( p, 0, sizeof( RECT ) );
if( HB_IS_HASH( pStru ) )
{
p->left = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "left" ) );
p->top = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "top" ) );
p->right = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "right" ) );
p->bottom = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "bottom" ) );
return p;
}
else if( HB_IS_ARRAY( pStru ) && hb_arrayLen( pStru ) >= 4 )
{
p->left = ( LONG ) hb_arrayGetNL( pStru, 1 );
p->top = ( LONG ) hb_arrayGetNL( pStru, 2 );
p->right = ( LONG ) hb_arrayGetNL( pStru, 3 );
p->bottom = ( LONG ) hb_arrayGetNL( pStru, 4 );
return p;
}
else
return bMandatory ? p : NULL;
}
DEVMODE * hbwapi_par_DEVMODE( DEVMODE * p, int iParam, HB_BOOL bMandatory )
{
PHB_ITEM pHash = hb_param( iParam, HB_IT_HASH );
PHB_ITEM pStru = hb_param( iParam, HB_IT_ANY );
memset( p, 0, sizeof( DEVMODE ) );
p->dmSize = sizeof( DEVMODE );
if( pHash )
if( HB_IS_HASH( pStru ) )
{
p->dmOrientation = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmOrientation" ) );
p->dmPaperSize = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmPaperSize" ) );
p->dmPaperLength = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmPaperLength" ) );
p->dmPaperWidth = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmPaperWidth" ) );
p->dmScale = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmScale" ) );
p->dmCopies = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmCopies" ) );
p->dmDefaultSource = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmDefaultSource" ) );
p->dmPrintQuality = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmPrintQuality" ) );
p->dmDuplex = hb_itemGetNI( hb_hashGetCItemPtr( pHash, "dmDuplex" ) );
p->dmOrientation = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmOrientation" ) );
p->dmPaperSize = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmPaperSize" ) );
p->dmPaperLength = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmPaperLength" ) );
p->dmPaperWidth = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmPaperWidth" ) );
p->dmScale = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmScale" ) );
p->dmCopies = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmCopies" ) );
p->dmDefaultSource = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmDefaultSource" ) );
p->dmPrintQuality = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmPrintQuality" ) );
p->dmDuplex = ( short ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "dmDuplex" ) );
if( hb_hashGetCItemPtr( pHash, "dmOrientation" ) ) p->dmFields |= DM_ORIENTATION;
if( hb_hashGetCItemPtr( pHash, "dmPaperSize" ) ) p->dmFields |= DM_PAPERSIZE;
if( hb_hashGetCItemPtr( pHash, "dmPaperLength" ) ) p->dmFields |= DM_PAPERLENGTH;
if( hb_hashGetCItemPtr( pHash, "dmPaperWidth" ) ) p->dmFields |= DM_PAPERWIDTH;
if( hb_hashGetCItemPtr( pHash, "dmScale" ) ) p->dmFields |= DM_SCALE;
if( hb_hashGetCItemPtr( pHash, "dmCopies" ) ) p->dmFields |= DM_COPIES;
if( hb_hashGetCItemPtr( pHash, "dmDefaultSource" ) ) p->dmFields |= DM_DEFAULTSOURCE;
if( hb_hashGetCItemPtr( pHash, "dmPrintQuality" ) ) p->dmFields |= DM_PRINTQUALITY;
if( hb_hashGetCItemPtr( pHash, "dmDuplex" ) ) p->dmFields |= DM_DUPLEX;
if( hb_hashGetCItemPtr( pStru, "dmOrientation" ) ) p->dmFields |= DM_ORIENTATION;
if( hb_hashGetCItemPtr( pStru, "dmPaperSize" ) ) p->dmFields |= DM_PAPERSIZE;
if( hb_hashGetCItemPtr( pStru, "dmPaperLength" ) ) p->dmFields |= DM_PAPERLENGTH;
if( hb_hashGetCItemPtr( pStru, "dmPaperWidth" ) ) p->dmFields |= DM_PAPERWIDTH;
if( hb_hashGetCItemPtr( pStru, "dmScale" ) ) p->dmFields |= DM_SCALE;
if( hb_hashGetCItemPtr( pStru, "dmCopies" ) ) p->dmFields |= DM_COPIES;
if( hb_hashGetCItemPtr( pStru, "dmDefaultSource" ) ) p->dmFields |= DM_DEFAULTSOURCE;
if( hb_hashGetCItemPtr( pStru, "dmPrintQuality" ) ) p->dmFields |= DM_PRINTQUALITY;
if( hb_hashGetCItemPtr( pStru, "dmDuplex" ) ) p->dmFields |= DM_DUPLEX;
return p;
}
@@ -345,9 +373,9 @@ HB_FUNC( WAPI_CREATEFONT )
( DWORD ) hb_parl( 7 ) /* fdwUnderline */,
( DWORD ) hb_parl( 8 ) /* fdwStrikeOut */,
( DWORD ) hb_parnl( 9 ) /* fdwCharSet */,
( DWORD ) hb_parnldef( 10, OUT_DEVICE_PRECIS ) /* fdwOutputPrecision */,
( DWORD ) hb_parnldef( 10, OUT_DEFAULT_PRECIS ) /* fdwOutputPrecision */,
( DWORD ) hb_parnldef( 11, CLIP_DEFAULT_PRECIS ) /* fdwClipPrecision */,
( DWORD ) hb_parnldef( 12, DRAFT_QUALITY ) /* fdwQuality */,
( DWORD ) hb_parnldef( 12, DEFAULT_QUALITY ) /* fdwQuality */,
( DWORD ) hb_parnldef( 13, DEFAULT_PITCH | FF_DONTCARE ) /* fdwPitchAndFamily */,
HB_PARSTR( 14, &hFontFace, NULL ) /* lpszFace */ ) );
@@ -359,8 +387,8 @@ HB_FUNC( WAPI_SELECTOBJECT )
HDC hDC = hbwapi_par_HDC( 1 );
HGDIOBJ h;
if( ( h = hbwapi_par_HPEN( 2 ) ) );
else if( ( h = hbwapi_par_HFONT( 2 ) ) );
if( ( h = hbwapi_par_HPEN( 2 ) ) != NULL );
else if( ( h = hbwapi_par_HFONT( 2 ) ) != NULL );
/* TODO: Add BRUSH, BITMAP, REGION */
else
h = NULL;

View File

@@ -54,6 +54,7 @@
#define HB_OS_WIN_USED
#include "hbapi.h"
#include "hbapierr.h"
#include "hbwinuni.h"
#include "hbwapi.h"
@@ -113,6 +114,29 @@ HB_FUNC( WAPI_DESTROYWINDOW )
hb_retl( bResult );
}
HB_FUNC( WAPI_DRAWTEXT )
{
HDC hDC = hbwapi_par_HDC( 1 );
RECT rect;
if( hDC && hbwapi_par_RECT( &rect, 3, HB_TRUE ) )
{
void * hText;
HB_SIZE nTextLen;
LPCTSTR lpText = HB_PARSTR( 2, &hText, &nTextLen );
hb_retni( DrawText( hDC,
lpText,
nTextLen,
&rect,
( UINT ) hb_parni( 4 ) ) );
hb_strfree( hText );
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
/*-----------------------------------------------------------------------/
BEGIN SCROLLBAR MANIPULATION WINAPI FUNCTIONS
/-----------------------------------------------------------------------*/

View File

@@ -0,0 +1,92 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Windows dialogs
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* 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_OS_WIN_USED
#include "hbapi.h"
#include "hbwinuni.h"
#include "hbwapi.h"
#if ! defined( HB_OS_WIN_CE )
HB_FUNC( WIN_PRINTDLGDC )
{
PRINTDLG pd;
memset( &pd, 0, sizeof( PRINTDLG ) );
pd.lStructSize = sizeof( PRINTDLG );
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
pd.nFromPage = ( WORD ) hb_parnidef( 2, 1 );
pd.nToPage = ( WORD ) hb_parnidef( 3, 1 );
pd.nCopies = ( WORD ) hb_parnidef( 4, 1 );
if( PrintDlg( &pd ) )
{
if( pd.hDevNames )
{
LPDEVNAMES lpdn = ( LPDEVNAMES ) GlobalLock( pd.hDevNames );
HB_STORSTR( ( LPCTSTR ) lpdn + lpdn->wDeviceOffset, 1 );
GlobalUnlock( pd.hDevNames );
GlobalFree( pd.hDevNames );
}
if( pd.hDevMode )
GlobalFree( pd.hDevMode );
hbwapi_ret_HDC( pd.hDC );
}
else
hb_retptr( NULL );
}
#endif