diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c3ea31bde9..cab7b0863e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,47 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-17 20:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/win_reg.prg + * contrib/hbwin/win_os.prg + * contrib/hbwin/win_tprn.prg + * contrib/hbwin/wapi_winbase.c + * contrib/hbwin/hbwin.h + * contrib/hbwin/hbwin.ch + * contrib/hbwin/tests/testprn.prg + * contrib/hbwin/tests/testcom1.prg + * contrib/hbwin/tests/testcom2.prg + * contrib/hbwin/tests/testreg.prg + * contrib/hbwin/tests/testmapi.prg + * contrib/hbwin/win_com.c + * contrib/hbwin/win_prn1.c + * MM_TO_INCH macro moved from hbwin.ch to win_tprn.prg. + (INCOMPATIBLE is someone happened to use this in app code) + + Prefixed all Windows constants with WIN_ in hbwin.ch. + + Prefixed all hbwin specific constants with HB_ in hbwin.ch. + + Retained all old legacy / deprecated hbwin.ch constants + for compatibility. Users are encourages to use the new + ones, as the old ones will be deleted in the future. + * Changed WIN_MULDIV() to use hb_retni() (instead of hb_retnl()) + * WIN_MULDIV() renamed to WAPI_MULDIV() and moved + to wapi source. (INCOMPATIBLE, although it's unlikely anyone + is using WIN_MULDIV() so I didn't keep it.) + + Added some additional printing related Windows constants. + + Added comments to hbwin.ch saying which constant is used + in which WIN_*() function. + * HB_WIN_MAPI_* constants renamed to WIN_MAPI_*. + (I haven't dealt with compatibility as this is brand new + functions with not much users yet) + + Marked all hbwin.ch deprecated macros with HB_LEGACY_LEVEL3 + ! Fixed to use hbwin.ch constants in few remaining places in testprn.prg + ; Now it's possible to include hbwin.ch in .c files. + ; QUESTION: Why RGB_* color constants aren't using pure colors? + If there is no special reason, I think it should be + changed to pure ones (with 0xFF components). + + * src/compiler/hbgenerr.c + * Formatting. + 2010-01-17 15:06 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/win_tprn.prg ! Fixed to not refer to legacy function WIN_GETEXEFILENAME(). diff --git a/harbour/contrib/hbwin/hbwin.ch b/harbour/contrib/hbwin/hbwin.ch index 5b2158774a..9af09b0b87 100644 --- a/harbour/contrib/hbwin/hbwin.ch +++ b/harbour/contrib/hbwin/hbwin.ch @@ -51,17 +51,79 @@ * */ +/* NOTE: This file is also used by C code. */ + #ifndef HBWIN_CH_ #define HBWIN_CH_ -/* Positions for WIN_MAPISENDMAIL() array */ +/* WIN_MAPISENDMAIL() address types */ +#define WIN_MAPI_TO 1 +#define WIN_MAPI_CC 2 +#define WIN_MAPI_BCC 3 -#define HB_WIN_MAPI_TO 1 -#define HB_WIN_MAPI_CC 2 -#define HB_WIN_MAPI_BCC 3 +/* Windows registry hives */ +#define WIN_HKEY_CLASSES_ROOT 0x80000000 +#define WIN_HKEY_CURRENT_USER 0x80000001 +#define WIN_HKEY_LOCAL_MACHINE 0x80000002 +#define WIN_HKEY_USERS 0x80000003 +#define WIN_HKEY_PERFORMANCE_DATA 0x80000004 +#define WIN_HKEY_CURRENT_CONFIG 0x80000005 +#define WIN_HKEY_DYN_DATA 0x80000006 -/* Positions for WIN_PRINTERLIST() array */ +/* WIN_PORT() related values */ +/* WIN_COMOPEN() bit rates */ +#define WIN_CBR_110 110 +#define WIN_CBR_300 300 +#define WIN_CBR_600 600 +#define WIN_CBR_1200 1200 +#define WIN_CBR_2400 2400 +#define WIN_CBR_4800 4800 +#define WIN_CBR_9600 9600 +#define WIN_CBR_14400 14400 +#define WIN_CBR_19200 19200 +#define WIN_CBR_38400 38400 +#define WIN_CBR_56000 56000 +#define WIN_CBR_57600 57600 +#define WIN_CBR_115200 115200 +#define WIN_CBR_128000 128000 +#define WIN_CBR_256000 256000 + +/* WIN_COMOPEN() parity modes */ +#define WIN_NOPARITY 0 +#define WIN_ODDPARITY 1 +#define WIN_EVENPARITY 2 +#define WIN_MARKPARITY 3 +#define WIN_SPACEPARITY 4 + +/* WIN_COMOPEN() stopbit modes */ +#define WIN_ONESTOPBIT 0 +#define WIN_ONE5STOPBITS 1 +#define WIN_TWOSTOPBITS 2 + +/* WIN_COMDTRFLOW() parameters */ +#define WIN_DTR_CONTROL_DISABLE 0x00 +#define WIN_DTR_CONTROL_ENABLE 0x01 +#define WIN_DTR_CONTROL_HANDSHAKE 0x02 + +/* WIN_COMRTSFLOW() parameters */ +#define WIN_RTS_CONTROL_DISABLE 0x00 +#define WIN_RTS_CONTROL_ENABLE 0x01 +#define WIN_RTS_CONTROL_HANDSHAKE 0x02 +#define WIN_RTS_CONTROL_TOGGLE 0x03 + +/* WIN_COMDEBUGDCB() debug levels */ +#define HB_WIN_COM_DBGBASIC 0x01 +#define HB_WIN_COM_DBGFLOW 0x02 +#define HB_WIN_COM_DBGXTRAFLOW 0x04 +#define HB_WIN_COM_DBGOTHER 0x08 +#define HB_WIN_COM_DBGTIMEOUTS 0x10 +#define HB_WIN_COM_DBGQUEUE 0x20 +#define HB_WIN_COM_DBGALL 0x3F + +/* WIN_PRN() related values */ + +/* WIN_PRINTERLIST() positions for array returned */ #define HB_WINPRN_NAME 1 #define HB_WINPRN_PORT 2 #define HB_WINPRN_TYPE 3 @@ -70,207 +132,309 @@ #define HB_WINPRN_SERVER 6 #define HB_WINPRN_LEN_ 6 -/* Registry related values */ - -#define HKEY_CLASSES_ROOT 0x80000000 -#define HKEY_CURRENT_USER 0x80000001 -#define HKEY_LOCAL_MACHINE 0x80000002 -#define HKEY_USERS 0x80000003 -#define HKEY_PERFORMANCE_DATA 0x80000004 -#define HKEY_CURRENT_CONFIG 0x80000005 -#define HKEY_DYN_DATA 0x80000006 - -/* win_Port() related values */ - -/* The following are from winbase.h */ - -#define CBR_110 110 -#define CBR_300 300 -#define CBR_600 600 -#define CBR_1200 1200 -#define CBR_2400 2400 -#define CBR_4800 4800 -#define CBR_9600 9600 -#define CBR_14400 14400 -#define CBR_19200 19200 -#define CBR_38400 38400 -#define CBR_56000 56000 -#define CBR_57600 57600 -#define CBR_115200 115200 -#define CBR_128000 128000 -#define CBR_256000 256000 - -#define NOPARITY 0 -#define ODDPARITY 1 -#define EVENPARITY 2 -#define MARKPARITY 3 -#define SPACEPARITY 4 - -#define ONESTOPBIT 0 -#define ONE5STOPBITS 1 -#define TWOSTOPBITS 2 - -/* DTR Control Flow Values. */ -#define DTR_CONTROL_DISABLE 0x00 -#define DTR_CONTROL_ENABLE 0x01 -#define DTR_CONTROL_HANDSHAKE 0x02 - -/* RTS Control Flow Values */ -#define RTS_CONTROL_DISABLE 0x00 -#define RTS_CONTROL_ENABLE 0x01 -#define RTS_CONTROL_HANDSHAKE 0x02 -#define RTS_CONTROL_TOGGLE 0x03 - -#define WIN_COM_DBGBASIC 0x01 -#define WIN_COM_DBGFLOW 0x02 -#define WIN_COM_DBGXTRAFLOW 0x04 -#define WIN_COM_DBGOTHER 0x08 -#define WIN_COM_DBGTIMEOUTS 0x10 -#define WIN_COM_DBGQUEUE 0x20 -#define WIN_COM_DBGALL 0x3F - -/* win_Prn() related values */ - -/* paper types */ -#define WIN_PRN_DMPAPER_LETTER 1 -#define WIN_PRN_DMPAPER_LEGAL 5 -#define WIN_PRN_DMPAPER_EXECUTIVE 7 -#define WIN_PRN_DMPAPER_A3 8 -#define WIN_PRN_DMPAPER_A4 9 -#define WIN_PRN_DMPAPER_A5 11 -#define WIN_PRN_DMPAPER_B4 12 -#define WIN_PRN_DMPAPER_B5 13 -#define WIN_PRN_DMPAPER_USER 256 - -/* paper types (deprecated) */ -#define FORM_LETTER WIN_PRN_DMPAPER_LETTER -#define FORM_A4 WIN_PRN_DMPAPER_A4 -#define FORM_CUSTOM WIN_PRN_DMPAPER_USER - -#define PS_SOLID 0 - #define WIN_RGB( nR, nG, nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) ) -/* deprecated */ +/* Color constants for convenience */ +#define HB_WIN_RGB_BLACK WIN_RGB( 0x00, 0x00, 0x00 ) +#define HB_WIN_RGB_BLUE WIN_RGB( 0x00, 0x00, 0x85 ) +#define HB_WIN_RGB_GREEN WIN_RGB( 0x00, 0x85, 0x00 ) +#define HB_WIN_RGB_CYAN WIN_RGB( 0x00, 0x85, 0x85 ) +#define HB_WIN_RGB_RED WIN_RGB( 0x85, 0x00, 0x00 ) +#define HB_WIN_RGB_MAGENTA WIN_RGB( 0x85, 0x00, 0x85 ) +#define HB_WIN_RGB_BROWN WIN_RGB( 0x85, 0x85, 0x00 ) +#define HB_WIN_RGB_WHITE WIN_RGB( 0xC6, 0xC6, 0xC6 ) + +/* WIN_SETDOCUMENTPROPERTIES() paper types */ +#define WIN_DMPAPER_LETTER 1 +#define WIN_DMPAPER_LEGAL 5 +#define WIN_DMPAPER_EXECUTIVE 7 +#define WIN_DMPAPER_A3 8 +#define WIN_DMPAPER_A4 9 +#define WIN_DMPAPER_A5 11 +#define WIN_DMPAPER_B4 12 +#define WIN_DMPAPER_B5 13 +#define WIN_DMPAPER_USER 256 + +/* WIN_SETDOCUMENTPROPERTIES() bin selections */ +#define WIN_DMBIN_UPPER 1 +#define WIN_DMBIN_ONLYONE 1 +#define WIN_DMBIN_LOWER 2 +#define WIN_DMBIN_MIDDLE 3 +#define WIN_DMBIN_MANUAL 4 +#define WIN_DMBIN_ENVELOPE 5 +#define WIN_DMBIN_ENVMANUAL 6 +#define WIN_DMBIN_AUTO 7 +#define WIN_DMBIN_TRACTOR 8 +#define WIN_DMBIN_SMALLFMT 9 +#define WIN_DMBIN_LARGEFMT 10 +#define WIN_DMBIN_LARGECAPACITY 11 +#define WIN_DMBIN_CASSETTE 14 +#define WIN_DMBIN_FORMSOURCE 15 +#define WIN_DMBIN_USER 256 +#define WIN_DMBIN_FIRST WIN_DMBIN_UPPER +#define WIN_DMBIN_LAST WIN_DMBIN_FORMSOURCE + +/* WIN_SETDOCUMENTPROPERTIES() print qualities */ +#define WIN_DMRES_DRAFT ( -1 ) +#define WIN_DMRES_LOW ( -2 ) +#define WIN_DMRES_MEDIUM ( -3 ) +#define WIN_DMRES_HIGH ( -4 ) + +/* WIN_SETDOCUMENTPROPERTIES() duplex modes */ +#define WIN_DMDUP_SIMPLEX 1 +#define WIN_DMDUP_VERTICAL 2 +#define WIN_DMDUP_HORIZONTAL 3 + +/* WIN_SETMAPMODE() parameters */ +#define WIN_MM_TEXT 1 +#define WIN_MM_LOMETRIC 2 +#define WIN_MM_HIMETRIC 3 +#define WIN_MM_LOENGLISH 4 +#define WIN_MM_HIENGLISH 5 +#define WIN_MM_TWIPS 6 +#define WIN_MM_ISOTROPIC 7 +#define WIN_MM_ANISOTROPIC 8 +#define WIN_MM_MAX_FIXEDSCALE WIN_MM_TWIPS + +/* WIN_CREATEFONT() font weights */ +#define WIN_FW_DONTCARE 0 +#define WIN_FW_THIN 100 +#define WIN_FW_EXTRALIGHT 200 +#define WIN_FW_ULTRALIGHT WIN_FW_EXTRALIGHT +#define WIN_FW_LIGHT 300 +#define WIN_FW_NORMAL 400 +#define WIN_FW_REGULAR WIN_FW_NORMAL +#define WIN_FW_MEDIUM 500 +#define WIN_FW_SEMIBOLD 600 +#define WIN_FW_DEMIBOLD WIN_FW_SEMIBOLD +#define WIN_FW_BOLD 700 +#define WIN_FW_EXTRABOLD 800 +#define WIN_FW_ULTRABOLD WIN_FW_EXTRABOLD +#define WIN_FW_HEAVY 900 +#define WIN_FW_BLACK WIN_FW_HEAVY + +/* Windows charset values (WIN_CREATEFONT()) */ +#define WIN_ANSI_CHARSET 0 +#define WIN_DEFAULT_CHARSET 1 +#define WIN_SYMBOL_CHARSET 2 +#define WIN_MAC_CHARSET 77 +#define WIN_SHIFTJIS_CHARSET 128 +#define WIN_HANGEUL_CHARSET 129 +#define WIN_HANGUL_CHARSET 129 +#define WIN_JOHAB_CHARSET 130 +#define WIN_GB2312_CHARSET 134 +#define WIN_CHINESEBIG5_CHARSET 136 +#define WIN_GREEK_CHARSET 161 +#define WIN_TURKISH_CHARSET 162 +#define WIN_VIETNAMESE_CHARSET 163 +#define WIN_HEBREW_CHARSET 177 +#define WIN_ARABIC_CHARSET 178 +#define WIN_BALTIC_CHARSET 186 +#define WIN_RUSSIAN_CHARSET 204 +#define WIN_THAI_CHARSET 222 +#define WIN_EASTEUROPE_CHARSET 238 +#define WIN_OEM_CHARSET 255 + +/* WIN_GETDEVICECAPS() parameters */ +#define WIN_HORZSIZE 4 // Horizontal size in millimeters +#define WIN_VERTSIZE 6 // Vertical size in millimeters +#define WIN_HORZRES 8 // Horizontal width in pixels +#define WIN_VERTRES 10 // Vertical height in pixels +#define WIN_NUMBRUSHES 16 // Number of brushes the device has +#define WIN_NUMPENS 18 // Number of pens the device has +#define WIN_NUMFONTS 22 // Number of fonts the device has +#define WIN_NUMCOLORS 24 // Number of colors the device supports +#define WIN_RASTERCAPS 38 // Bitblt capabilities +#define WIN_LOGPIXELSX 88 // Logical pixels/inch in X +#define WIN_LOGPIXELSY 90 // Logical pixels/inch in Y +#define WIN_PHYSICALWIDTH 110 // Physical Width in device units +#define WIN_PHYSICALHEIGHT 111 // Physical Height in device units +#define WIN_PHYSICALOFFSETX 112 // Physical Printable Area x margin +#define WIN_PHYSICALOFFSETY 113 // Physical Printable Area y margin +#define WIN_SCALINGFACTORX 114 // Scaling factor x +#define WIN_SCALINGFACTORY 115 // Scaling factor y + +/* WIN_TEXTOUT() text alignment modes */ +#define WIN_TA_NOUPDATECP 0 +#define WIN_TA_UPDATECP 1 +#define WIN_TA_LEFT 0 +#define WIN_TA_RIGHT 2 +#define WIN_TA_CENTER 6 +#define WIN_TA_TOP 0 +#define WIN_TA_BOTTOM 8 +#define WIN_TA_BASELINE 24 + +/* WIN_SETPEN() pen styles */ +#define WIN_PS_SOLID 0 +#define WIN_PS_DASH 1 +#define WIN_PS_DOT 2 +#define WIN_PS_DASHDOT 3 +#define WIN_PS_DASHDOTDOT 4 +#define WIN_PS_NULL 5 +#define WIN_PS_INSIDEFRAME 6 + +/* ------------------------------- */ +/* Deprecated constants and macros */ +/* ------------------------------- */ + +#ifdef HB_LEGACY_LEVEL3 + +#define HKEY_CLASSES_ROOT WIN_HKEY_CLASSES_ROOT +#define HKEY_CURRENT_USER WIN_HKEY_CURRENT_USER +#define HKEY_LOCAL_MACHINE WIN_HKEY_LOCAL_MACHINE +#define HKEY_USERS WIN_HKEY_USERS +#define HKEY_PERFORMANCE_DATA WIN_HKEY_PERFORMANCE_DATA +#define HKEY_CURRENT_CONFIG WIN_HKEY_CURRENT_CONFIG +#define HKEY_DYN_DATA WIN_HKEY_DYN_DATA + +#define CBR_110 WIN_CBR_110 +#define CBR_300 WIN_CBR_300 +#define CBR_600 WIN_CBR_600 +#define CBR_1200 WIN_CBR_1200 +#define CBR_2400 WIN_CBR_2400 +#define CBR_4800 WIN_CBR_4800 +#define CBR_9600 WIN_CBR_9600 +#define CBR_14400 WIN_CBR_14400 +#define CBR_19200 WIN_CBR_19200 +#define CBR_38400 WIN_CBR_38400 +#define CBR_56000 WIN_CBR_56000 +#define CBR_57600 WIN_CBR_57600 +#define CBR_115200 WIN_CBR_115200 +#define CBR_128000 WIN_CBR_128000 +#define CBR_256000 WIN_CBR_256000 + +#define NOPARITY WIN_NOPARITY +#define ODDPARITY WIN_ODDPARITY +#define EVENPARITY WIN_EVENPARITY +#define MARKPARITY WIN_MARKPARITY +#define SPACEPARITY WIN_SPACEPARITY + +#define ONESTOPBIT WIN_ONESTOPBIT +#define ONE5STOPBITS WIN_ONE5STOPBITS +#define TWOSTOPBITS WIN_TWOSTOPBITS + +#define DTR_CONTROL_DISABLE WIN_DTR_CONTROL_DISABLE +#define DTR_CONTROL_ENABLE WIN_DTR_CONTROL_ENABLE +#define DTR_CONTROL_HANDSHAKE WIN_DTR_CONTROL_HANDSHAKE + +#define RTS_CONTROL_DISABLE WIN_RTS_CONTROL_DISABLE +#define RTS_CONTROL_ENABLE WIN_RTS_CONTROL_ENABLE +#define RTS_CONTROL_HANDSHAKE WIN_RTS_CONTROL_HANDSHAKE +#define RTS_CONTROL_TOGGLE WIN_RTS_CONTROL_TOGGLE + +#define FORM_LETTER WIN_DMPAPER_LETTER +#define FORM_A4 WIN_DMPAPER_A4 +#define FORM_CUSTOM WIN_DMPAPER_USER + +#define PS_SOLID WIN_PS_SOLID + #define RGB( nR, nG, nB ) WIN_RGB( nR, nG, nB ) -#define RGB_BLACK RGB( 0x00, 0x00, 0x00 ) -#define RGB_BLUE RGB( 0x00, 0x00, 0x85 ) -#define RGB_GREEN RGB( 0x00, 0x85, 0x00 ) -#define RGB_CYAN RGB( 0x00, 0x85, 0x85 ) -#define RGB_RED RGB( 0x85, 0x00, 0x00 ) -#define RGB_MAGENTA RGB( 0x85, 0x00, 0x85 ) -#define RGB_BROWN RGB( 0x85, 0x85, 0x00 ) -#define RGB_WHITE RGB( 0xC6, 0xC6, 0xC6 ) +#define RGB_BLACK HB_WIN_RGB_BLACK +#define RGB_BLUE HB_WIN_RGB_BLUE +#define RGB_GREEN HB_WIN_RGB_GREEN +#define RGB_CYAN HB_WIN_RGB_CYAN +#define RGB_RED HB_WIN_RGB_RED +#define RGB_MAGENTA HB_WIN_RGB_MAGENTA +#define RGB_BROWN HB_WIN_RGB_BROWN +#define RGB_WHITE HB_WIN_RGB_WHITE -/* Cut from wingdi.h */ +#define MM_TEXT WIN_MM_TEXT +#define MM_LOMETRIC WIN_MM_LOMETRIC +#define MM_HIMETRIC WIN_MM_HIMETRIC +#define MM_LOENGLISH WIN_MM_LOENGLISH +#define MM_HIENGLISH WIN_MM_HIENGLISH -#define MM_TEXT 1 -#define MM_LOMETRIC 2 -#define MM_HIMETRIC 3 -#define MM_LOENGLISH 4 -#define MM_HIENGLISH 5 +#define FW_DONTCARE WIN_FW_DONTCARE +#define FW_THIN WIN_FW_THIN +#define FW_EXTRALIGHT WIN_FW_EXTRALIGHT +#define FW_ULTRALIGHT WIN_FW_ULTRALIGHT +#define FW_LIGHT WIN_FW_LIGHT +#define FW_NORMAL WIN_FW_NORMAL +#define FW_REGULAR WIN_FW_REGULAR +#define FW_MEDIUM WIN_FW_MEDIUM +#define FW_SEMIBOLD WIN_FW_SEMIBOLD +#define FW_DEMIBOLD WIN_FW_DEMIBOLD +#define FW_BOLD WIN_FW_BOLD +#define FW_EXTRABOLD WIN_FW_EXTRABOLD +#define FW_ULTRABOLD WIN_FW_ULTRABOLD +#define FW_HEAVY WIN_FW_HEAVY +#define FW_BLACK WIN_FW_BLACK -#define FW_DONTCARE 0 -#define FW_THIN 100 -#define FW_EXTRALIGHT 200 -#define FW_ULTRALIGHT FW_EXTRALIGHT -#define FW_LIGHT 300 -#define FW_NORMAL 400 -#define FW_REGULAR FW_NORMAL -#define FW_MEDIUM 500 -#define FW_SEMIBOLD 600 -#define FW_DEMIBOLD FW_SEMIBOLD -#define FW_BOLD 700 -#define FW_EXTRABOLD 800 -#define FW_ULTRABOLD FW_EXTRABOLD -#define FW_HEAVY 900 -#define FW_BLACK FW_HEAVY +#define TA_NOUPDATECP WIN_TA_NOUPDATECP +#define TA_UPDATECP WIN_TA_UPDATECP +#define TA_LEFT WIN_TA_LEFT +#define TA_RIGHT WIN_TA_RIGHT +#define TA_CENTER WIN_TA_CENTER +#define TA_TOP WIN_TA_TOP +#define TA_BOTTOM WIN_TA_BOTTOM +#define TA_BASELINE WIN_TA_BASELINE -#define ANSI_CHARSET 0 -#define DEFAULT_CHARSET 1 -#define SYMBOL_CHARSET 2 -#define MAC_CHARSET 77 -#define SHIFTJIS_CHARSET 128 -#define HANGEUL_CHARSET 129 -#define HANGUL_CHARSET 129 -#define JOHAB_CHARSET 130 -#define GB2312_CHARSET 134 -#define CHINESEBIG5_CHARSET 136 -#define GREEK_CHARSET 161 -#define TURKISH_CHARSET 162 -#define VIETNAMESE_CHARSET 163 -#define HEBREW_CHARSET 177 -#define ARABIC_CHARSET 178 -#define BALTIC_CHARSET 186 -#define RUSSIAN_CHARSET 204 -#define THAI_CHARSET 222 -#define EASTEUROPE_CHARSET 238 -#define OEM_CHARSET 255 +#define HORZSIZE WIN_HORZSIZE +#define VERTSIZE WIN_VERTSIZE +#define HORZRES WIN_HORZRES +#define VERTRES WIN_VERTRES +#define NUMBRUSHES WIN_NUMBRUSHES +#define NUMPENS WIN_NUMPENS +#define NUMFONTS WIN_NUMFONTS +#define NUMCOLORS WIN_NUMCOLORS +#define RASTERCAPS WIN_RASTERCAPS +#define LOGPIXELSX WIN_LOGPIXELSX +#define LOGPIXELSY WIN_LOGPIXELSY +#define PHYSICALWIDTH WIN_PHYSICALWIDTH +#define PHYSICALHEIGHT WIN_PHYSICALHEIGHT +#define PHYSICALOFFSETX WIN_PHYSICALOFFSETX +#define PHYSICALOFFSETY WIN_PHYSICALOFFSETY +#define SCALINGFACTORX WIN_SCALINGFACTORX +#define SCALINGFACTORY WIN_SCALINGFACTORY -/* Device Parameters for win_GetDeviceCaps() */ +#define DMBIN_UPPER WIN_DMBIN_UPPER +#define DMBIN_ONLYONE WIN_DMBIN_ONLYONE +#define DMBIN_LOWER WIN_DMBIN_LOWER +#define DMBIN_MIDDLE WIN_DMBIN_MIDDLE +#define DMBIN_MANUAL WIN_DMBIN_MANUAL +#define DMBIN_ENVELOPE WIN_DMBIN_ENVELOPE +#define DMBIN_ENVMANUAL WIN_DMBIN_ENVMANUAL +#define DMBIN_AUTO WIN_DMBIN_AUTO +#define DMBIN_TRACTOR WIN_DMBIN_TRACTOR +#define DMBIN_SMALLFMT WIN_DMBIN_SMALLFMT +#define DMBIN_LARGEFMT WIN_DMBIN_LARGEFMT +#define DMBIN_LARGECAPACITY WIN_DMBIN_LARGECAPACITY +#define DMBIN_CASSETTE WIN_DMBIN_CASSETTE +#define DMBIN_FORMSOURCE WIN_DMBIN_FORMSOURCE +#define DMBIN_FIRST WIN_DMBIN_FIRST +#define DMBIN_LAST WIN_DMBIN_LAST -#define HORZSIZE 4 // Horizontal size in millimeters -#define VERTSIZE 6 // Vertical size in millimeters -#define HORZRES 8 // Horizontal width in pixels -#define VERTRES 10 // Vertical height in pixels -#define NUMBRUSHES 16 // Number of brushes the device has -#define NUMPENS 18 // Number of pens the device has -#define NUMFONTS 22 // Number of fonts the device has -#define NUMCOLORS 24 // Number of colors the device supports -#define RASTERCAPS 38 // Bitblt capabilities +#define DMRES_DRAFT WIN_DMRES_DRAFT +#define DMRES_LOW WIN_DMRES_LOW +#define DMRES_MEDIUM WIN_DMRES_MEDIUM +#define DMRES_HIGH WIN_DMRES_HIGH -#define LOGPIXELSX 88 // Logical pixels/inch in X -#define LOGPIXELSY 90 // Logical pixels/inch in Y +#define DMDUP_SIMPLEX WIN_DMDUP_SIMPLEX +#define DMDUP_VERTICAL WIN_DMDUP_VERTICAL +#define DMDUP_HORIZONTAL WIN_DMDUP_HORIZONTAL -#define PHYSICALWIDTH 110 // Physical Width in device units -#define PHYSICALHEIGHT 111 // Physical Height in device units -#define PHYSICALOFFSETX 112 // Physical Printable Area x margin -#define PHYSICALOFFSETY 113 // Physical Printable Area y margin -#define SCALINGFACTORX 114 // Scaling factor x -#define SCALINGFACTORY 115 // Scaling factor y +#define ANSI_CHARSET WIN_ANSI_CHARSET +#define DEFAULT_CHARSET WIN_DEFAULT_CHARSET +#define SYMBOL_CHARSET WIN_SYMBOL_CHARSET +#define MAC_CHARSET WIN_MAC_CHARSET +#define SHIFTJIS_CHARSET WIN_SHIFTJIS_CHARSET +#define HANGEUL_CHARSET WIN_HANGEUL_CHARSET +#define HANGUL_CHARSET WIN_HANGUL_CHARSET +#define JOHAB_CHARSET WIN_JOHAB_CHARSET +#define GB2312_CHARSET WIN_GB2312_CHARSET +#define CHINESEBIG5_CHARSET WIN_CHINESEBIG5_CHARSET +#define GREEK_CHARSET WIN_GREEK_CHARSET +#define TURKISH_CHARSET WIN_TURKISH_CHARSET +#define VIETNAMESE_CHARSET WIN_VIETNAMESE_CHARSET +#define HEBREW_CHARSET WIN_HEBREW_CHARSET +#define ARABIC_CHARSET WIN_ARABIC_CHARSET +#define BALTIC_CHARSET WIN_BALTIC_CHARSET +#define RUSSIAN_CHARSET WIN_RUSSIAN_CHARSET +#define THAI_CHARSET WIN_THAI_CHARSET +#define EASTEUROPE_CHARSET WIN_EASTEUROPE_CHARSET +#define OEM_CHARSET WIN_OEM_CHARSET -/* bin selections */ -#define DMBIN_FIRST DMBIN_UPPER -#define DMBIN_UPPER 1 -#define DMBIN_ONLYONE 1 -#define DMBIN_LOWER 2 -#define DMBIN_MIDDLE 3 -#define DMBIN_MANUAL 4 -#define DMBIN_ENVELOPE 5 -#define DMBIN_ENVMANUAL 6 -#define DMBIN_AUTO 7 -#define DMBIN_TRACTOR 8 -#define DMBIN_SMALLFMT 9 -#define DMBIN_LARGEFMT 10 -#define DMBIN_LARGECAPACITY 11 -#define DMBIN_CASSETTE 14 -#define DMBIN_FORMSOURCE 15 -#define DMBIN_LAST DMBIN_FORMSOURCE - -/* print qualities */ -#define DMRES_DRAFT ( -1 ) -#define DMRES_LOW ( -2 ) -#define DMRES_MEDIUM ( -3 ) -#define DMRES_HIGH ( -4 ) - -/* duplex enable */ -#define DMDUP_SIMPLEX 1 -#define DMDUP_VERTICAL 2 -#define DMDUP_HORIZONTAL 3 - -/* Text Alignment Options */ -#define TA_NOUPDATECP 0 -#define TA_UPDATECP 1 - -#define TA_LEFT 0 -#define TA_RIGHT 2 -#define TA_CENTER 6 - -#define TA_TOP 0 -#define TA_BOTTOM 8 -#define TA_BASELINE 24 - -#define MM_TO_INCH 25.4 +#endif #endif /* HBWIN_CH_ */ diff --git a/harbour/contrib/hbwin/hbwin.h b/harbour/contrib/hbwin/hbwin.h index cfb926986a..401d5ef29a 100644 --- a/harbour/contrib/hbwin/hbwin.h +++ b/harbour/contrib/hbwin/hbwin.h @@ -53,28 +53,28 @@ #ifndef __HBWIN_H #define __HBWIN_H -#define WIN_COM_FUN_CREATEFILE 1 -#define WIN_COM_FUN_GETCOMMSTATE 2 -#define WIN_COM_FUN_SETCOMMSTATE 3 -#define WIN_COM_FUN_SETUPCOMM 4 -#define WIN_COM_FUN_GETCOMMTIMEOUTS 5 -#define WIN_COM_FUN_SETCOMMTIMEOUTS 6 -#define WIN_COM_FUN_CLOSEHANDLE 7 -#define WIN_COM_FUN_WRITEFILE 8 -#define WIN_COM_FUN_READFILE 9 -#define WIN_COM_FUN_GETCOMMMODEMSTATUS 10 /* win_com:Status() */ -#define WIN_COM_FUN_PURGECOMM 11 -#define WIN_COM_FUN_CLEARCOMMERROR 12 /* win_com:QueueStatus() */ -#define WIN_COM_FUN_ESCAPECOMMFUNCTION 13 -#define WIN_COM_FUN_GETCOMMPROPERTIES 14 -#define WIN_COM_FUN_MAX 14 +#define HB_WIN_COM_FUN_CREATEFILE 1 +#define HB_WIN_COM_FUN_GETCOMMSTATE 2 +#define HB_WIN_COM_FUN_SETCOMMSTATE 3 +#define HB_WIN_COM_FUN_SETUPCOMM 4 +#define HB_WIN_COM_FUN_GETCOMMTIMEOUTS 5 +#define HB_WIN_COM_FUN_SETCOMMTIMEOUTS 6 +#define HB_WIN_COM_FUN_CLOSEHANDLE 7 +#define HB_WIN_COM_FUN_WRITEFILE 8 +#define HB_WIN_COM_FUN_READFILE 9 +#define HB_WIN_COM_FUN_GETCOMMMODEMSTATUS 10 /* win_com:Status() */ +#define HB_WIN_COM_FUN_PURGECOMM 11 +#define HB_WIN_COM_FUN_CLEARCOMMERROR 12 /* win_com:QueueStatus() */ +#define HB_WIN_COM_FUN_ESCAPECOMMFUNCTION 13 +#define HB_WIN_COM_FUN_GETCOMMPROPERTIES 14 +#define HB_WIN_COM_FUN_MAX 14 -#define WIN_COM_DBGBASIC 0x01 -#define WIN_COM_DBGFLOW 0x02 -#define WIN_COM_DBGXTRAFLOW 0x04 -#define WIN_COM_DBGOTHER 0x08 -#define WIN_COM_DBGTIMEOUTS 0x10 -#define WIN_COM_DBGQUEUE 0x20 -#define WIN_COM_DBGALL 0x3F +#define HB_WIN_COM_DBGBASIC 0x01 +#define HB_WIN_COM_DBGFLOW 0x02 +#define HB_WIN_COM_DBGXTRAFLOW 0x04 +#define HB_WIN_COM_DBGOTHER 0x08 +#define HB_WIN_COM_DBGTIMEOUTS 0x10 +#define HB_WIN_COM_DBGQUEUE 0x20 +#define HB_WIN_COM_DBGALL 0x3F #endif /* __HBWIN_H */ diff --git a/harbour/contrib/hbwin/tests/testcom1.prg b/harbour/contrib/hbwin/tests/testcom1.prg index fc693873a6..a1bb16c674 100644 --- a/harbour/contrib/hbwin/tests/testcom1.prg +++ b/harbour/contrib/hbwin/tests/testcom1.prg @@ -54,7 +54,7 @@ PROCEDURE Main( cPortName ) - LOCAL oWinPort := win_Com():Init( cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT ) + LOCAL oWinPort := win_Com():Init( cPortName, WIN_CBR_9600, WIN_NOPARITY, 8, WIN_ONESTOPBIT ) LOCAL cString := "ATE0" + Chr( 13 ) + "ATI3" + Chr( 13 ) LOCAL nResult diff --git a/harbour/contrib/hbwin/tests/testcom2.prg b/harbour/contrib/hbwin/tests/testcom2.prg index 494728f47e..42e18a367f 100644 --- a/harbour/contrib/hbwin/tests/testcom2.prg +++ b/harbour/contrib/hbwin/tests/testcom2.prg @@ -69,7 +69,7 @@ PROCEDURE Main( cPortName ) ? Inkey( 0 ) - oWinPort := win_Com():Init( cPortName, CBR_9600, ODDPARITY, 7, ONESTOPBIT ) + oWinPort := win_Com():Init( cPortName, WIN_CBR_9600, WIN_ODDPARITY, 7, WIN_ONESTOPBIT ) IF ! oWinPort:Open() ? "Open() failed :", oWinPort:Error() ELSE @@ -110,24 +110,24 @@ PROCEDURE Main( cPortName ) ? "QueueStatus() failed :", oWinPort:Error() ENDIF ? - IF oWinPort:RTSFlow( RTS_CONTROL_HANDSHAKE ) - ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) succeeded" + IF oWinPort:RTSFlow( WIN_RTS_CONTROL_HANDSHAKE ) + ? "RTSFlow( WIN_RTS_CONTROL_HANDSHAKE ) succeeded" ELSE - ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ? "RTSFlow( WIN_RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() ENDIF - ? oWinPort:DebugDCB( WIN_COM_DBGFLOW ) + ? oWinPort:DebugDCB( HB_WIN_COM_DBGFLOW ) IF oWinPort:SetRTS( .F. ) ? "SetRTS( .F. ) succeeded (it shouldn't according to docs!)" ELSE ? "SetRTS( .F. ) failed (it should) :", oWinPort:Error() ENDIF ? - IF oWinPort:RTSFlow( RTS_CONTROL_DISABLE ) - ? "RTSFlow( RTS_CONTROL_DISABLE ) succeeded" + IF oWinPort:RTSFlow( WIN_RTS_CONTROL_DISABLE ) + ? "RTSFlow( WIN_RTS_CONTROL_DISABLE ) succeeded" ELSE - ? "RTSFlow( RTS_CONTROL_DISABLE ) failed :", oWinPort:Error() + ? "RTSFlow( WIN_RTS_CONTROL_DISABLE ) failed :", oWinPort:Error() ENDIF - ? oWinPort:DebugDCB( WIN_COM_DBGFLOW ) + ? oWinPort:DebugDCB( HB_WIN_COM_DBGFLOW ) IF oWinPort:SetRTS( .F. ) ? "SetRTS( .F. ) succeeded (it should)" ELSE @@ -164,7 +164,7 @@ PROCEDURE Main( cPortName ) ? "This is going to fail, so no device needed" Inkey( 0 ) - oWinPort := Win_Com():Init( cPortName, CBR_9600, NOPARITY, 99, ONESTOPBIT ) + oWinPort := Win_Com():Init( cPortName, WIN_CBR_9600, WIN_NOPARITY, 99, WIN_ONESTOPBIT ) IF !oWinPort:Open ? "Open() failed :", oWinPort:Error() ELSE @@ -176,13 +176,13 @@ PROCEDURE Main( cPortName ) ? Inkey( 0 ) - oWinPort := Win_Com():Init( cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT ) + oWinPort := Win_Com():Init( cPortName, WIN_CBR_9600, WIN_NOPARITY, 8, WIN_ONESTOPBIT ) IF ! oWinPort:Open ? "Open() failed :", oWinPort:Error() ELSE ? "Open succeeded" ? - ? oWinPort:DebugDCB( WIN_COM_DBGFLOW ) + ? oWinPort:DebugDCB( HB_WIN_COM_DBGFLOW ) ? "Printers will probably have CTS, DSR and DCD high, IF they are off they'll all be low" IF oWinPort:Status( @lCTS, @lDSR, @lRing, @lDCD ) ? "Status() succeeded : CTS ", lCTS, ", DSR ", lDSR, ", Ring ", lRing, ", DCD ", lDCD @@ -207,15 +207,15 @@ PROCEDURE Main( cPortName ) ? ? "Switch all handshaking on (normally only hardware and RTS)" - IF oWinPort:RTSFlow( DTR_CONTROL_HANDSHAKE ) - ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) succeeded" + IF oWinPort:RTSFlow( WIN_DTR_CONTROL_HANDSHAKE ) + ? "RTSFlow( WIN_RTS_CONTROL_HANDSHAKE ) succeeded" ELSE - ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ? "RTSFlow( WIN_RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() ENDIF - IF oWinPort:DTRFlow( DTR_CONTROL_HANDSHAKE ) - ? "DTRFlow( DTR_CONTROL_HANDSHAKE ) succeeded" + IF oWinPort:DTRFlow( WIN_DTR_CONTROL_HANDSHAKE ) + ? "DTRFlow( WIN_DTR_CONTROL_HANDSHAKE ) succeeded" ELSE - ? "DTRFlow( DTR_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ? "DTRFlow( WIN_DTR_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() ENDIF IF oWinPort:XonXoffFlow( .T. ) ? "XonXoffFlow( .T. ) ", oWinPort:XonXoffFlow( .T. ) @@ -223,7 +223,7 @@ PROCEDURE Main( cPortName ) ? "XonXoffFlow( .T. ) failed :", oWinPort:Error() ENDIF ? - ? oWinPort:DebugDCB( WIN_COM_DBGFLOW ) + ? oWinPort:DebugDCB( HB_WIN_COM_DBGFLOW ) ? "If it's on then no Hold status should be on, IF off then probably CTS and DSR" IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) diff --git a/harbour/contrib/hbwin/tests/testmapi.prg b/harbour/contrib/hbwin/tests/testmapi.prg index f733252bac..d2ccb95deb 100644 --- a/harbour/contrib/hbwin/tests/testmapi.prg +++ b/harbour/contrib/hbwin/tests/testmapi.prg @@ -11,7 +11,7 @@ PROCEDURE Main() LOCAL lMailConf := .F. LOCAL lFromUser := .T. LOCAL aSender := { "test from", "from@test.com" } - LOCAL aDest := { { "test to", "to@test.com", HB_WIN_MAPI_TO } } + LOCAL aDest := { { "test to", "to@test.com", WIN_MAPI_TO } } LOCAL aFiles := { { "testmapi.prg", "testmapi" } } ? win_MAPISendMail( cSubject, ; // subject diff --git a/harbour/contrib/hbwin/tests/testprn.prg b/harbour/contrib/hbwin/tests/testprn.prg index 75e48c0d89..d9b1705d7b 100644 --- a/harbour/contrib/hbwin/tests/testprn.prg +++ b/harbour/contrib/hbwin/tests/testprn.prg @@ -40,7 +40,7 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile ) LOCAL nColCharSet oPrinter:Landscape := .F. - oPrinter:FormType := WIN_PRN_DMPAPER_A4 + oPrinter:FormType := WIN_DMPAPER_A4 oPrinter:Copies := 1 IF ! oPrinter:Create() @@ -49,10 +49,10 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile ) IF ! oPrinter:startDoc( "Win_Prn(Doc name in Printer Properties)" ) Alert( "StartDoc() failed" ) ELSE - oPrinter:SetPen( PS_SOLID, 1, RGB_RED ) - oPrinter:Bold( 800 ) + oPrinter:SetPen( WIN_PS_SOLID, 1, HB_WIN_RGB_RED ) + oPrinter:Bold( WIN_FW_EXTRABOLD ) oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + Str( oPrinter:MaxRow(), 4 ) + " MaxCol() = " + Str( oPrinter:MaxCol(), 4 ) ) - oPrinter:Bold( 0 ) // Normal + oPrinter:Bold( WIN_FW_DONTCARE ) oPrinter:NewLine() oPrinter:TextOut(" Partial list of available fonts that are available for OEM_") oPrinter:NewLine() @@ -95,13 +95,13 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile ) NEXT oPrinter:SetFont( "Lucida Console", 8, { 3, -50 } ) // Alternative Compressed print oPrinter:CharSet( 0 ) // Reset default charset - oPrinter:Bold( 800 ) + oPrinter:Bold( WIN_FW_EXTRABOLD ) oPrinter:NewLine() oPrinter:TextOut( "This is on line" + Str( oPrinter:Prow(), 4 ) + ", Printed bold, " ) oPrinter:TextOut( " finishing at Column: " ) oPrinter:TextOut( Str( oPrinter:Pcol(), 4 ) ) oPrinter:SetPrc( oPrinter:Prow() + 3, 0 ) - oPrinter:Bold( 0 ) + oPrinter:Bold( WIN_FW_DONTCARE ) oPrinter:TextOut( "Notice: UNDERLINE only prints correctly if there is a blank line after", .T. ) oPrinter:TextOut( " it. This is because of ::LineHeight and the next line", .T. ) oPrinter:TextOut( " printing over top of the underline. To avoid this happening", .T. ) @@ -109,12 +109,12 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile ) oPrinter:NewLine() oPrinter:NewLine() oPrinter:SetFont( "Lucida Console", 18, 0 ) // Large print - oPrinter:SetColor( RGB_GREEN ) + oPrinter:SetColor( HB_WIN_RGB_GREEN ) oPrinter:TextOut( "Finally some larger print" ) oPrinter:Box( 0, oPrinter:PosY + 100, 100, oPrinter:PosY + 200 ) oPrinter:Arc( 200, oPrinter:PosY + 100, 300, oPrinter:PosY + 200 ) oPrinter:Ellipse( 400, oPrinter:PosY + 100, 500, oPrinter:PosY + 200 ) - oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY + 200, RGB_RED ) + oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY + 200, HB_WIN_RGB_RED ) // To print a barcode; // Replace 'BCod39HN' with your own bar code font or any other font diff --git a/harbour/contrib/hbwin/tests/testreg.prg b/harbour/contrib/hbwin/tests/testreg.prg index 4a64d14b63..af9c65de21 100644 --- a/harbour/contrib/hbwin/tests/testreg.prg +++ b/harbour/contrib/hbwin/tests/testreg.prg @@ -11,7 +11,7 @@ PROCEDURE Main() ? ">" + wapi_GetCommandLine() + "<" /* old API */ - ? ">" + hb_ValToStr( win_regGet( HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper" ) ) + "<" + ? ">" + hb_ValToStr( win_regGet( WIN_HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper" ) ) + "<" /* new API */ ? ">" + hb_ValToStr( win_regRead( "HKCU\Environment\PATH" ) ) + "<" diff --git a/harbour/contrib/hbwin/wapi_winbase.c b/harbour/contrib/hbwin/wapi_winbase.c index 7c20245aa9..b4ddaacc09 100644 --- a/harbour/contrib/hbwin/wapi_winbase.c +++ b/harbour/contrib/hbwin/wapi_winbase.c @@ -289,3 +289,8 @@ HB_FUNC( WAPI_FORMATMESSAGE ) hb_strfree( hSource ); hb_strfree( hBuffer ); } + +HB_FUNC( WAPI_MULDIV ) +{ + hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ); +} diff --git a/harbour/contrib/hbwin/win_com.c b/harbour/contrib/hbwin/win_com.c index 8a51eff196..31a880528a 100644 --- a/harbour/contrib/hbwin/win_com.c +++ b/harbour/contrib/hbwin/win_com.c @@ -113,7 +113,7 @@ HB_FUNC( WIN_COMOPEN ) } s_PortData[ iPort ].hPort = INVALID_HANDLE_VALUE; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_CREATEFILE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_CREATEFILE; s_PortData[ iPort ].dwError = 0; if( ( hCommPort = CreateFile( szName, @@ -164,7 +164,7 @@ HB_FUNC( WIN_COMOPEN ) /*NewDCB.EvtChar*/ /* function reinitializes all hardware and control settings, but it does not empty output or input queues */ - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETCOMMSTATE; s_PortData[ iPort ].dwError = 0; if( ! SetCommState( hCommPort, &NewDCB ) ) { @@ -195,7 +195,7 @@ HB_FUNC( WIN_COMCLOSE ) s_PortData[ iPort ].hPort = INVALID_HANDLE_VALUE; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_CLOSEHANDLE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_CLOSEHANDLE; s_PortData[ iPort ].dwError = 0; hb_retl( CloseHandle( hCommPort ) != 0 ); @@ -216,7 +216,7 @@ HB_FUNC( WIN_COMWRITE ) DWORD dwNumberofBytesToWrite = ( DWORD ) hb_parclen( 2 ); DWORD dwNumberofBytesWritten; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_WRITEFILE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_WRITEFILE; s_PortData[ iPort ].dwError = 0; if( WriteFile( hCommPort, lpBuffer, dwNumberofBytesToWrite, &dwNumberofBytesWritten, NULL ) ) hb_retnl( dwNumberofBytesWritten ); @@ -242,7 +242,7 @@ HB_FUNC( WIN_COMREAD ) DWORD dwNumberOfBytesRead; lpBuffer = ( char * ) hb_xgrab( dwNumberOfBytesToRead + 1 ); - s_PortData[ iPort ].iFunction = WIN_COM_FUN_READFILE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_READFILE; s_PortData[ iPort ].dwError = 0; if( ReadFile( hCommPort, lpBuffer, dwNumberOfBytesToRead, &dwNumberOfBytesRead, NULL ) ) { @@ -274,7 +274,7 @@ HB_FUNC( WIN_COMRECV ) DWORD dwNumberOfBytesRead; lpBuffer = ( char * ) hb_xgrab( dwNumberOfBytesToRead + 1 ); - s_PortData[ iPort ].iFunction = WIN_COM_FUN_READFILE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_READFILE; s_PortData[ iPort ].dwError = 0; if( ReadFile( hCommPort, lpBuffer, dwNumberOfBytesToRead, &dwNumberOfBytesRead, NULL ) ) { @@ -302,7 +302,7 @@ HB_FUNC( WIN_COMSTATUS ) { DWORD dwModemStat = 0; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMMODEMSTATUS; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMMODEMSTATUS; s_PortData[ iPort ].dwError = 0; if( GetCommModemStatus( hCommPort, &dwModemStat ) ) { @@ -339,7 +339,7 @@ HB_FUNC( WIN_COMPURGE ) DWORD dwFlags; dwFlags = ( hb_parl( 2 ) ? PURGE_RXCLEAR : 0 ) | ( hb_parl( 3 ) ? PURGE_TXCLEAR : 0 ); - s_PortData[ iPort ].iFunction = WIN_COM_FUN_PURGECOMM; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_PURGECOMM; s_PortData[ iPort ].dwError = 0; if( PurgeComm( hCommPort, dwFlags ) ) hb_retl( HB_TRUE ); @@ -363,7 +363,7 @@ HB_FUNC( WIN_COMQUEUESTATUS ) DWORD dwErrors = 0; COMSTAT ComStat; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_CLEARCOMMERROR; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_CLEARCOMMERROR; s_PortData[ iPort ].dwError = 0; if( ClearCommError( hCommPort, &dwErrors, &ComStat ) ) { @@ -408,7 +408,7 @@ HB_FUNC( WIN_COMSETRTS ) { DWORD dwFunc = hb_parl( 2 ) ? SETRTS : CLRRTS; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_ESCAPECOMMFUNCTION; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_ESCAPECOMMFUNCTION; s_PortData[ iPort ].dwError = 0; if( EscapeCommFunction( hCommPort, dwFunc ) ) hb_retl( HB_TRUE ); @@ -434,7 +434,7 @@ HB_FUNC( WIN_COMSETDTR ) { DWORD dwFunc = hb_parl( 2 ) ? SETDTR : CLRDTR; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_ESCAPECOMMFUNCTION; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_ESCAPECOMMFUNCTION; s_PortData[ iPort ].dwError = 0; if( EscapeCommFunction( hCommPort, dwFunc ) ) hb_retl( HB_TRUE ); @@ -458,7 +458,7 @@ HB_FUNC( WIN_COMRTSFLOW ) DCB CurDCB; int iRtsControl = hb_parni( 2 ); - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMSTATE; s_PortData[ iPort ].dwError = 0; CurDCB.DCBlength = sizeof( DCB ); if( ! GetCommState( hCommPort, &CurDCB ) ) @@ -489,7 +489,7 @@ HB_FUNC( WIN_COMRTSFLOW ) return; } - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETCOMMSTATE; s_PortData[ iPort ].dwError = 0; if( ! SetCommState( hCommPort, &CurDCB ) ) { @@ -513,7 +513,7 @@ HB_FUNC( WIN_COMDTRFLOW ) DCB CurDCB; int DtrControl = hb_parni( 2 ); - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMSTATE; s_PortData[ iPort ].dwError = 0; CurDCB.DCBlength = sizeof( DCB ); if( ! GetCommState( hCommPort, &CurDCB ) ) @@ -544,7 +544,7 @@ HB_FUNC( WIN_COMDTRFLOW ) return; } - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETCOMMSTATE; s_PortData[ iPort ].dwError = 0; if( ! SetCommState( hCommPort, &CurDCB ) ) { @@ -567,7 +567,7 @@ HB_FUNC( WIN_COMXONXOFFFLOW ) { DCB CurDCB; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMSTATE; s_PortData[ iPort ].dwError = 0; CurDCB.DCBlength = sizeof( DCB ); if( ! GetCommState( hCommPort, &CurDCB ) ) @@ -588,7 +588,7 @@ HB_FUNC( WIN_COMXONXOFFFLOW ) CurDCB.fOutX = 0; } - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETCOMMSTATE; s_PortData[ iPort ].dwError = 0; if( ! SetCommState( hCommPort, &CurDCB ) ) { @@ -671,7 +671,7 @@ HB_FUNC( WIN_COMSETTIMEOUTS ) Timeouts.WriteTotalTimeoutMultiplier = HB_ISNUM( 5 ) ? ( DWORD ) hb_parnl( 5 ) : ( DWORD ) -1; Timeouts.WriteTotalTimeoutConstant = HB_ISNUM( 6 ) ? ( DWORD ) hb_parnl( 6 ) : ( DWORD ) -1; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMSTATE; s_PortData[ iPort ].dwError = 0; CurDCB.DCBlength = sizeof( DCB ); @@ -682,7 +682,7 @@ HB_FUNC( WIN_COMSETTIMEOUTS ) return; } - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETCOMMTIMEOUTS; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETCOMMTIMEOUTS; s_PortData[ iPort ].dwError = 0; if( ! hb_win_ComSetTimeouts( hCommPort, &Timeouts, CurDCB.BaudRate, CurDCB.Parity, CurDCB.ByteSize, CurDCB.StopBits ) ) { @@ -703,7 +703,7 @@ HB_FUNC( WIN_COMSETQUEUESIZE ) if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) && ( hCommPort = s_PortData[ iPort ].hPort ) != INVALID_HANDLE_VALUE && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) ) { - s_PortData[ iPort ].iFunction = WIN_COM_FUN_SETUPCOMM; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_SETUPCOMM; s_PortData[ iPort ].dwError = 0; if( ! SetupComm( hCommPort, hb_parni( 2 ), hb_parni( 3 ) ) ) { @@ -747,26 +747,26 @@ HB_FUNC( WIN_COMDEBUGDCB ) if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) && ( hCommPort = s_PortData[ iPort ].hPort ) != INVALID_HANDLE_VALUE ) { - int iDebugLevel = HB_ISNUM( 2 ) ? hb_parni( 2 ) : WIN_COM_DBGBASIC; + int iDebugLevel = HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_WIN_COM_DBGBASIC; DCB CurDCB; COMMTIMEOUTS CurCOMMTIMEOUTS; COMMPROP CurCOMMPROP; char szDebugString[ 1024 ] = ""; char buffer[ 80 ]; - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMSTATE; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMSTATE; s_PortData[ iPort ].dwError = 0; CurDCB.DCBlength = sizeof( DCB ); if( GetCommState( hCommPort, &CurDCB ) ) { - if( iDebugLevel & WIN_COM_DBGBASIC ) + if( iDebugLevel & HB_WIN_COM_DBGBASIC ) { hb_snprintf( buffer, sizeof( buffer ), "Baud : %lu\n", CurDCB.BaudRate ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); hb_snprintf( buffer, sizeof( buffer ), "ByteSize : %i\n" , CurDCB.ByteSize ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); hb_snprintf( buffer, sizeof( buffer ), "Parity : %i\n" , CurDCB.Parity ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); hb_snprintf( buffer, sizeof( buffer ), "StopBits : %i\n" , CurDCB.StopBits ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); } - if( iDebugLevel & WIN_COM_DBGFLOW ) + if( iDebugLevel & HB_WIN_COM_DBGFLOW ) { hb_strncat( szDebugString, "fRtsControl : ", sizeof( szDebugString ) - 1 ); hb_strncat( szDebugString, CurDCB.fRtsControl == RTS_CONTROL_DISABLE ? "RTS_CONTROL_DISABLE\n" : @@ -784,7 +784,7 @@ HB_FUNC( WIN_COMDEBUGDCB ) hb_strncat( szDebugString, "fOutxDsrFlow : ", sizeof( szDebugString ) - 1 ); hb_strncat( szDebugString, CurDCB.fOutxDsrFlow ? "true\n" : "false\n", sizeof( szDebugString ) - 1 ); } - if( iDebugLevel & WIN_COM_DBGXTRAFLOW ) + if( iDebugLevel & HB_WIN_COM_DBGXTRAFLOW ) { hb_strncat( szDebugString, "fDsrSensitivity : ", sizeof( szDebugString ) - 1 ); hb_strncat( szDebugString, CurDCB.fDsrSensitivity ? "true\n" : "false\n", sizeof( szDebugString ) - 1 ); @@ -795,7 +795,7 @@ HB_FUNC( WIN_COMDEBUGDCB ) hb_snprintf( buffer, sizeof( buffer ), "XonChar : 0x%i\n" , CurDCB.XonChar ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); hb_snprintf( buffer, sizeof( buffer ), "XoffChar : 0x%i\n", CurDCB.XoffChar ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 ); } - if( iDebugLevel & WIN_COM_DBGOTHER ) + if( iDebugLevel & HB_WIN_COM_DBGOTHER ) { hb_strncat( szDebugString, "fBinary : ", sizeof( szDebugString ) - 1 ); hb_strncat( szDebugString, CurDCB.fBinary ? "true\n" : "false\n", sizeof( szDebugString ) - 1 ); @@ -819,9 +819,9 @@ HB_FUNC( WIN_COMDEBUGDCB ) return; } - if( iDebugLevel & WIN_COM_DBGTIMEOUTS ) + if( iDebugLevel & HB_WIN_COM_DBGTIMEOUTS ) { - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMTIMEOUTS; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMTIMEOUTS; s_PortData[ iPort ].dwError = 0; if( GetCommTimeouts( hCommPort, &CurCOMMTIMEOUTS ) ) { @@ -839,9 +839,9 @@ HB_FUNC( WIN_COMDEBUGDCB ) } } - if( iDebugLevel & WIN_COM_DBGQUEUE ) + if( iDebugLevel & HB_WIN_COM_DBGQUEUE ) { - s_PortData[ iPort ].iFunction = WIN_COM_FUN_GETCOMMPROPERTIES; + s_PortData[ iPort ].iFunction = HB_WIN_COM_FUN_GETCOMMPROPERTIES; s_PortData[ iPort ].dwError = 0; if( GetCommProperties( hCommPort, &CurCOMMPROP ) ) { diff --git a/harbour/contrib/hbwin/win_os.prg b/harbour/contrib/hbwin/win_os.prg index 18252b2847..7f82443876 100644 --- a/harbour/contrib/hbwin/win_os.prg +++ b/harbour/contrib/hbwin/win_os.prg @@ -78,7 +78,7 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista ) IF ! lDoVista .AND. win_osIsVistaOrUpper() /* do nothing */ ELSEIF win_osIs9X() - bRetVal := win_regQuery( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt ) + bRetVal := win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt ) ELSE cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters" cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters" @@ -88,26 +88,26 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista ) ENDIF /* Server settings */ - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */ - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */ + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt ) IF win_osIsVistaOrUpper() /* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */ - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt ) ENDIF /* Workstation settings */ - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt ) - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt ) IF win_osIs2000OrUpper() - bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt ) + bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt ) ENDIF ENDIF diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index 00bd5c72a3..bc2c82d94f 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -51,21 +51,19 @@ */ /* + WIN_PRN() was designed to make it easy to emulate Clipper Dot Matrix printing. + Dot Matrix printing was in CPI ( Characters per inch & Lines per inch ). + Even though "Mapping Mode" for WIN_PRN() is WIN_MM_TEXT, ::SetFont() accepts the + nWidth parameter in CPI not Pixels. Also the default ::LineHeight is for + 6 lines per inch so ::NewLine() works as per "LineFeed" on Dot Matrix printers. + If you do not like this then inherit from the class and override anything you want - TPRINT() was designed to make it easy to emulate Clipper Dot Matrix printing. - Dot Matrix printing was in CPI ( Characters per inch & Lines per inch ). - Even though "Mapping Mode" for TPRINT() is MM_TEXT, ::SetFont() accepts the - nWidth parameter in CPI not Pixels. Also the default ::LineHeight is for - 6 lines per inch so ::NewLine() works as per "LineFeed" on Dot Matrix printers. - If you do not like this then inherit from the class and override anything you want + Simple example - Simple example - - TO DO: Colour printing - etc.... - - Peter Rees 21 January 2004 + TODO: Colour printing + etc.... + Peter Rees 21 January 2004 */ #define HB_OS_WIN_USED @@ -373,11 +371,6 @@ HB_FUNC( WIN_SETMAPMODE ) hb_retnl( hDC && HB_ISNUM( 2 ) ? SetMapMode( hDC, hb_parni( 2 ) ) : 0 ); } -HB_FUNC( WIN_MULDIV ) -{ - hb_retnl( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ); -} - HB_FUNC( WIN_CREATEFONT ) { HDC hDC = win_HDC_par( 1 ); diff --git a/harbour/contrib/hbwin/win_reg.prg b/harbour/contrib/hbwin/win_reg.prg index c3adf7fda9..83ea7039a2 100644 --- a/harbour/contrib/hbwin/win_reg.prg +++ b/harbour/contrib/hbwin/win_reg.prg @@ -60,7 +60,7 @@ PROCEDURE win_regPathSplit( cRegPath, /* @ */ nHKEY, /* @ */ cKey, /* @ */ cEntr LOCAL cHKEY LOCAL tmp - nHKEY := HKEY_CURRENT_USER + nHKEY := WIN_HKEY_CURRENT_USER cKey := "" cEntry := "" @@ -79,20 +79,20 @@ PROCEDURE win_regPathSplit( cRegPath, /* @ */ nHKEY, /* @ */ cKey, /* @ */ cEntr /* Len( ) is optimized to a number by Harbour at compile time. */ DO CASE - CASE Left( cHKEY, Len( "HKCU" ) ) == "HKCU" ; nHKEY := HKEY_CURRENT_USER - CASE Left( cHKEY, Len( "HKLM" ) ) == "HKLM" ; nHKEY := HKEY_LOCAL_MACHINE - CASE Left( cHKEY, Len( "HKCR" ) ) == "HKCR" ; nHKEY := HKEY_CLASSES_ROOT - CASE Left( cHKEY, Len( "HKU" ) ) == "HKU" ; nHKEY := HKEY_USERS - CASE Left( cHKEY, Len( "HKPD" ) ) == "HKPD" ; nHKEY := HKEY_PERFORMANCE_DATA - CASE Left( cHKEY, Len( "HKCC" ) ) == "HKCC" ; nHKEY := HKEY_CURRENT_CONFIG - CASE Left( cHKEY, Len( "HKDD" ) ) == "HKDD" ; nHKEY := HKEY_DYN_DATA - CASE Left( cHKEY, Len( "HKEY_CURRENT_USER" ) ) == "HKEY_CURRENT_USER" ; nHKEY := HKEY_CURRENT_USER - CASE Left( cHKEY, Len( "HKEY_LOCAL_MACHINE" ) ) == "HKEY_LOCAL_MACHINE" ; nHKEY := HKEY_LOCAL_MACHINE - CASE Left( cHKEY, Len( "HKEY_CLASSES_ROOT" ) ) == "HKEY_CLASSES_ROOT" ; nHKEY := HKEY_CLASSES_ROOT - CASE Left( cHKEY, Len( "HKEY_USERS" ) ) == "HKEY_USERS" ; nHKEY := HKEY_USERS - CASE Left( cHKEY, Len( "HKEY_PERFORMANCE_DATA" ) ) == "HKEY_PERFORMANCE_DATA" ; nHKEY := HKEY_PERFORMANCE_DATA - CASE Left( cHKEY, Len( "HKEY_CURRENT_CONFIG" ) ) == "HKEY_CURRENT_CONFIG" ; nHKEY := HKEY_CURRENT_CONFIG - CASE Left( cHKEY, Len( "HKEY_DYN_DATA" ) ) == "HKEY_DYN_DATA" ; nHKEY := HKEY_DYN_DATA + CASE Left( cHKEY, Len( "HKCU" ) ) == "HKCU" ; nHKEY := WIN_HKEY_CURRENT_USER + CASE Left( cHKEY, Len( "HKLM" ) ) == "HKLM" ; nHKEY := WIN_HKEY_LOCAL_MACHINE + CASE Left( cHKEY, Len( "HKCR" ) ) == "HKCR" ; nHKEY := WIN_HKEY_CLASSES_ROOT + CASE Left( cHKEY, Len( "HKU" ) ) == "HKU" ; nHKEY := WIN_HKEY_USERS + CASE Left( cHKEY, Len( "HKPD" ) ) == "HKPD" ; nHKEY := WIN_HKEY_PERFORMANCE_DATA + CASE Left( cHKEY, Len( "HKCC" ) ) == "HKCC" ; nHKEY := WIN_HKEY_CURRENT_CONFIG + CASE Left( cHKEY, Len( "HKDD" ) ) == "HKDD" ; nHKEY := WIN_HKEY_DYN_DATA + CASE Left( cHKEY, Len( "HKEY_CURRENT_USER" ) ) == "HKEY_CURRENT_USER" ; nHKEY := WIN_HKEY_CURRENT_USER + CASE Left( cHKEY, Len( "HKEY_LOCAL_MACHINE" ) ) == "HKEY_LOCAL_MACHINE" ; nHKEY := WIN_HKEY_LOCAL_MACHINE + CASE Left( cHKEY, Len( "HKEY_CLASSES_ROOT" ) ) == "HKEY_CLASSES_ROOT" ; nHKEY := WIN_HKEY_CLASSES_ROOT + CASE Left( cHKEY, Len( "HKEY_USERS" ) ) == "HKEY_USERS" ; nHKEY := WIN_HKEY_USERS + CASE Left( cHKEY, Len( "HKEY_PERFORMANCE_DATA" ) ) == "HKEY_PERFORMANCE_DATA" ; nHKEY := WIN_HKEY_PERFORMANCE_DATA + CASE Left( cHKEY, Len( "HKEY_CURRENT_CONFIG" ) ) == "HKEY_CURRENT_CONFIG" ; nHKEY := WIN_HKEY_CURRENT_CONFIG + CASE Left( cHKEY, Len( "HKEY_DYN_DATA" ) ) == "HKEY_DYN_DATA" ; nHKEY := WIN_HKEY_DYN_DATA ENDCASE ENDIF diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index 435c14ec0d..3e61eb8a8b 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -51,19 +51,19 @@ */ /* - WIN_PRN() was designed to make it easy to emulate Clipper Dot Matrix printing. - Dot Matrix printing was in CPI ( Characters per inch & Lines per inch ). - Even though "Mapping Mode" for WIN_PRN() is MM_TEXT, ::SetFont() accepts the - nWidth parameter in CPI not Pixels. Also the default ::LineHeight is for - 6 lines per inch so ::NewLine() works as per "LineFeed" on Dot Matrix printers. - If you do not like this then inherit from the class and override anything you want + WIN_PRN() was designed to make it easy to emulate Clipper Dot Matrix printing. + Dot Matrix printing was in CPI ( Characters per inch & Lines per inch ). + Even though "Mapping Mode" for WIN_PRN() is WIN_MM_TEXT, ::SetFont() accepts the + nWidth parameter in CPI not Pixels. Also the default ::LineHeight is for + 6 lines per inch so ::NewLine() works as per "LineFeed" on Dot Matrix printers. + If you do not like this then inherit from the class and override anything you want - Simple example + Simple example - TODO: Colour printing - etc.... + TODO: Colour printing + etc.... - Peter Rees 21 January 2004 + Peter Rees 21 January 2004 */ #include "hbclass.ch" @@ -71,6 +71,8 @@ #include "hbwin.ch" +#define MM_TO_INCH 25.4 + CREATE CLASS WIN_PRN METHOD New( cPrinter ) @@ -110,7 +112,7 @@ CREATE CLASS WIN_PRN METHOD SetBkMode( nMode ) // OPAQUE == 2 or TRANSPARENT == 1 // Set Background mode - METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : TA_LEFT, TA_RGIHT, TA_CENTER, TA_TOP, TA_BOTTOM, TA_BASELINE + METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) // nAlign : WIN_TA_* METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) // **WARNING** : ( Col, Row ) _NOT_ ( Row, Col ) @@ -166,7 +168,7 @@ CREATE CLASS WIN_PRN 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:= MulDiv(nMul, GetDeviceCaps(shDC,LOGPIXELSX), nDiv) + VAR FontWidth INIT { 0, 0 } // {Mul, Div} Calc width: nWidth:= wapi_MulDiv(nMul, GetDeviceCaps(shDC,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 @@ -187,8 +189,8 @@ CREATE CLASS WIN_PRN VAR fCharWidth INIT 0 HIDDEN VAR BitmapsOk INIT .F. VAR NumColors INIT 1 - VAR fDuplexType INIT 0 HIDDEN // DMDUP_SIMPLEX, 22/02/2007 change to 0 to use default printer settings - VAR fPrintQuality INIT 0 HIDDEN // 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 @@ -234,24 +236,24 @@ METHOD Create() CLASS WIN_PRN ::Copies, ::BinNumber, ::fDuplexType, ; ::fPrintQuality, ::PaperLength, ::PaperWidth ) // Set mapping mode to pixels, topleft down - win_SetMapMode( ::hPrinterDC, MM_TEXT ) + win_SetMapMode( ::hPrinterDC, WIN_MM_TEXT ) // win_SetTextCharacterExtra( ::hPrinterDC, 0 ) // do not add extra char spacing even if bold // Get Margins etc... here - ::PageWidth := win_GetDeviceCaps( ::hPrinterDC, PHYSICALWIDTH ) - ::PageHeight := win_GetDeviceCaps( ::hPrinterDC, PHYSICALHEIGHT ) - ::LeftMargin := win_GetDeviceCaps( ::hPrinterDC, PHYSICALOFFSETX ) + ::PageWidth := win_GetDeviceCaps( ::hPrinterDC, WIN_PHYSICALWIDTH ) + ::PageHeight := win_GetDeviceCaps( ::hPrinterDC, WIN_PHYSICALHEIGHT ) + ::LeftMargin := win_GetDeviceCaps( ::hPrinterDC, WIN_PHYSICALOFFSETX ) ::RightMargin := ( ::PageWidth - ::LeftMargin ) + 1 - ::PixelsPerInchY := win_GetDeviceCaps( ::hPrinterDC, LOGPIXELSY ) - ::PixelsPerInchX := win_GetDeviceCaps( ::hPrinterDC, LOGPIXELSX ) + ::PixelsPerInchY := win_GetDeviceCaps( ::hPrinterDC, WIN_LOGPIXELSY ) + ::PixelsPerInchX := win_GetDeviceCaps( ::hPrinterDC, WIN_LOGPIXELSX ) ::LineHeight := Int( ::PixelsPerInchY / 6 ) // Default 6 lines per inch == # of pixels per line - ::TopMargin := win_GetDeviceCaps( ::hPrinterDC, PHYSICALOFFSETY ) + ::TopMargin := win_GetDeviceCaps( ::hPrinterDC, WIN_PHYSICALOFFSETY ) ::BottomMargin := ( ::PageHeight - ::TopMargin ) + 1 // Set .T. if can print bitmaps ::BitMapsOk := win_BitMapsOk( ::hPrinterDC ) // supports Colour - ::NumColors := win_GetDeviceCaps( ::hPrinterDC, NUMCOLORS ) + ::NumColors := win_GetDeviceCaps( ::hPrinterDC, WIN_NUMCOLORS ) // Set the standard font ::SetDefaultFont() @@ -567,7 +569,7 @@ METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) CLASS WIN_PRN DEFAULT lNewLine TO .F. DEFAULT lUpdatePosX TO .T. - DEFAULT nAlign TO HB_BITOR( TA_BOTTOM, TA_LEFT ) + DEFAULT nAlign TO HB_BITOR( WIN_TA_BOTTOM, WIN_TA_LEFT ) nPosX := win_TextOut( ::hPrinterDC, ::PosX, ::PosY, cString, Len( cString ), ::fCharWidth, nAlign ) @@ -588,6 +590,43 @@ METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) CLASS W ::SetPos( nPosX, nPosY ) RETURN ::TextOut( cString, lNewLine, lUpdatePosX, nAlign ) +METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, nWidth, nBold, lUnderLine, lItalic, nCharSet, lNewLine, lUpdatePosX, nColor, nAlign ) CLASS WIN_PRN + LOCAL lResult + LOCAL nDiv := 0 + LOCAL cType + LOCAL hFont + + IF ::CheckPage() + + DEFAULT nPointSize TO ::FontPointSize + + IF cFont != NIL + cType := ValType( nWidth ) + IF cType == "A" + nDiv := nWidth[ 1 ] + nWidth := nWidth[ 2 ] + ELSEIF cType == "N" .AND. ! Empty( nWidth ) + nDiv := 1 + ENDIF + hFont := ::hFont + ::hFont := win_CreateFont( ::hPrinterDC, cFont, nPointSize, nDiv, nWidth, nBold, lUnderLine, lItalic, nCharSet ) + ENDIF + IF nColor != NIL + nColor := win_SetColor( ::hPrinterDC, nColor ) + ENDIF + + lResult := ::TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) + + IF cFont != NIL + ::hFont := hFont // Reset Font + ENDIF + IF nColor != NIL + win_SetColor( ::hPrinterDC, nColor ) // Reset Color + ENDIF + + ENDIF + RETURN lResult + METHOD SetPen( nStyle, nWidth, nColor ) CLASS WIN_PRN ::PenStyle := nStyle ::PenWidth := nWidth @@ -652,7 +691,7 @@ METHOD FillRect( nX1, nY1, nX2, nY2, nColor ) CLASS WIN_PRN METHOD GetCharWidth() CLASS WIN_PRN LOCAL nWidth IF ::FontWidth[ 2 ] < 0 .AND. ! Empty( ::FontWidth[ 1 ] ) - nWidth := win_MulDiv( ::FontWidth[ 1 ], ::PixelsPerInchX, ::FontWidth[ 2 ] ) + nWidth := wapi_MulDiv( ::FontWidth[ 1 ], ::PixelsPerInchX, ::FontWidth[ 2 ] ) ELSE nWidth := win_GetCharSize( ::hPrinterDC ) ENDIF @@ -710,43 +749,6 @@ METHOD Inch_To_PosX( nInch ) CLASS WIN_PRN METHOD Inch_To_PosY( nInch ) CLASS WIN_PRN RETURN Int( ( nInch * ::PixelsPerInchY ) - ::TopMargin ) -METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, nWidth, nBold, lUnderLine, lItalic, nCharSet, lNewLine, lUpdatePosX, nColor, nAlign ) CLASS WIN_PRN - LOCAL lResult - LOCAL nDiv := 0 - LOCAL cType - LOCAL hFont - - IF ::CheckPage() - - DEFAULT nPointSize TO ::FontPointSize - - IF cFont != NIL - cType := ValType( nWidth ) - IF cType == "A" - nDiv := nWidth[ 1 ] - nWidth := nWidth[ 2 ] - ELSEIF cType == "N" .AND. ! Empty( nWidth ) - nDiv := 1 - ENDIF - hFont := ::hFont - ::hFont := win_CreateFont( ::hPrinterDC, cFont, nPointSize, nDiv, nWidth, nBold, lUnderLine, lItalic, nCharSet ) - ENDIF - IF nColor != NIL - nColor := win_SetColor( ::hPrinterDC, nColor ) - ENDIF - - lResult := ::TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlign ) - - IF cFont != NIL - ::hFont := hFont // Reset Font - ENDIF - IF nColor != NIL - win_SetColor( ::hPrinterDC, nColor ) // Reset Color - ENDIF - - ENDIF - RETURN lResult - METHOD GetDeviceCaps( nCaps ) CLASS WIN_PRN RETURN win_GetDeviceCaps( ::hPrinterDC, nCaps ) @@ -760,7 +762,7 @@ CREATE CLASS WIN_BMP METHOD LoadFile( cFileName ) METHOD Create() METHOD Destroy() - METHOD Draw( oPrn, arectangle ) + METHOD Draw( oPrn, aRectangle ) VAR Rect INIT { 0, 0, 0, 0 } // Coordinates to print BitMap // XDest, // x-coord of destination upper-left corner diff --git a/harbour/src/compiler/hbgenerr.c b/harbour/src/compiler/hbgenerr.c index 975db690d9..7f102e94e7 100644 --- a/harbour/src/compiler/hbgenerr.c +++ b/harbour/src/compiler/hbgenerr.c @@ -157,12 +157,12 @@ static void hb_compDispMessage( HB_COMP_DECL, char cPrefix, int iValue, if( HB_COMP_PARAM->currModule ) { hb_snprintf( buffer, sizeof( buffer ), "\r%s(%i) ", - HB_COMP_PARAM->currModule, HB_COMP_PARAM->currLine ); + HB_COMP_PARAM->currModule, HB_COMP_PARAM->currLine ); hb_compOutErr( HB_COMP_PARAM, buffer ); } hb_snprintf( buffer, sizeof( buffer ), "%s %c%04i ", - cPrefix == 'W' ? "Warning" : "Error", cPrefix, iValue ); + cPrefix == 'W' ? "Warning" : "Error", cPrefix, iValue ); hb_compOutErr( HB_COMP_PARAM, buffer ); hb_snprintf( buffer, sizeof( buffer ), szText, szPar1, szPar2 ); hb_compOutErr( HB_COMP_PARAM, buffer );