Removed the 16-bit graphics driver support; this has been broken for a
long time anyway.
This commit is contained in:
parent
ce13153821
commit
69e631d168
|
@ -52,13 +52,7 @@ C_SRCS = \
|
|||
mfdrv/mapping.c \
|
||||
mfdrv/objects.c \
|
||||
mfdrv/text.c \
|
||||
printdrv.c \
|
||||
win16drv/font.c \
|
||||
win16drv/graphics.c \
|
||||
win16drv/init.c \
|
||||
win16drv/objects.c \
|
||||
win16drv/prtdrv.c \
|
||||
win16drv/text.c
|
||||
printdrv.c
|
||||
|
||||
C_SRCS16 = \
|
||||
bidi16.c \
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "winternl.h"
|
||||
|
||||
#include "gdi.h"
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(driver);
|
||||
|
@ -43,7 +42,6 @@ struct graphics_driver
|
|||
|
||||
static struct graphics_driver *first_driver;
|
||||
static struct graphics_driver *display_driver;
|
||||
static const DC_FUNCTIONS *win16_driver;
|
||||
static CRITICAL_SECTION driver_section = CRITICAL_SECTION_INIT( "driver_section" );
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -262,9 +260,8 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
|
|||
|
||||
if (!(module = LoadLibraryA( name )))
|
||||
{
|
||||
if (!win16_driver) win16_driver = WIN16DRV_Init();
|
||||
RtlLeaveCriticalSection( &driver_section );
|
||||
return win16_driver;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(driver = create_driver( module )))
|
||||
|
@ -290,13 +287,10 @@ const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
|
|||
struct graphics_driver *driver;
|
||||
|
||||
RtlEnterCriticalSection( &driver_section );
|
||||
if (funcs != win16_driver)
|
||||
{
|
||||
for (driver = first_driver; driver; driver = driver->next)
|
||||
if (&driver->funcs == funcs) break;
|
||||
if (!driver) ERR( "driver not found, trouble ahead\n" );
|
||||
driver->count++;
|
||||
}
|
||||
for (driver = first_driver; driver; driver = driver->next)
|
||||
if (&driver->funcs == funcs) break;
|
||||
if (!driver) ERR( "driver not found, trouble ahead\n" );
|
||||
driver->count++;
|
||||
RtlLeaveCriticalSection( &driver_section );
|
||||
return funcs;
|
||||
}
|
||||
|
@ -313,8 +307,6 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
|
|||
|
||||
RtlEnterCriticalSection( &driver_section );
|
||||
|
||||
if (funcs == win16_driver) goto done;
|
||||
|
||||
for (driver = first_driver; driver; driver = driver->next)
|
||||
if (&driver->funcs == funcs) break;
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
155 pascal16 QueryAbort(word word) QueryAbort16
|
||||
156 pascal16 CreateDiscardableBitmap(word word word) CreateDiscardableBitmap16
|
||||
157 stub CompatibleBitmap # W1.1, W2.0
|
||||
158 pascal16 EnumCallback(ptr ptr word long) EnumCallback16
|
||||
158 stub EnumCallback
|
||||
159 pascal16 GetMetaFileBits(word) GetMetaFileBits16
|
||||
160 pascal16 SetMetaFileBits(word) SetMetaFileBits16
|
||||
161 pascal16 PtInRegion(word s_word s_word) PtInRegion16
|
||||
|
@ -183,11 +183,11 @@
|
|||
196 pascal16 SetMetaFileBitsBetter(word) SetMetaFileBitsBetter16
|
||||
201 stub DMBITBLT
|
||||
202 stub DMCOLORINFO
|
||||
206 pascal16 dmEnumDFonts(ptr str ptr ptr) dmEnumDFonts16
|
||||
206 stub dmEnumDFonts
|
||||
207 stub DMENUMOBJ
|
||||
208 stub DMOUTPUT
|
||||
209 stub DMPIXEL
|
||||
210 pascal16 dmRealizeObject(ptr word ptr ptr segptr) dmRealizeObject16
|
||||
210 stub dmRealizeObject
|
||||
211 stub DMSTRBLT
|
||||
212 stub DMSCANLR
|
||||
213 stub BRUTE
|
||||
|
|
|
@ -1,304 +0,0 @@
|
|||
/*
|
||||
* Windows driver font functions
|
||||
*
|
||||
* Copyright 1996 John Harvey
|
||||
* 1998 Huw Davies
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "winnls.h"
|
||||
#include "wownt32.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "gdi.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
|
||||
|
||||
|
||||
static void WIN16DRV_NewTextMetric16ToW(const NEWTEXTMETRIC16 *ptm16, LPNEWTEXTMETRICW ptmW )
|
||||
{
|
||||
ptmW->tmHeight = ptm16->tmHeight;
|
||||
ptmW->tmAscent = ptm16->tmAscent;
|
||||
ptmW->tmDescent = ptm16->tmDescent;
|
||||
ptmW->tmInternalLeading = ptm16->tmInternalLeading;
|
||||
ptmW->tmExternalLeading = ptm16->tmExternalLeading;
|
||||
ptmW->tmAveCharWidth = ptm16->tmAveCharWidth;
|
||||
ptmW->tmMaxCharWidth = ptm16->tmMaxCharWidth;
|
||||
ptmW->tmWeight = ptm16->tmWeight;
|
||||
ptmW->tmOverhang = ptm16->tmOverhang;
|
||||
ptmW->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
|
||||
ptmW->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
|
||||
ptmW->tmFirstChar = ptm16->tmFirstChar;
|
||||
ptmW->tmLastChar = ptm16->tmLastChar;
|
||||
ptmW->tmDefaultChar = ptm16->tmDefaultChar;
|
||||
ptmW->tmBreakChar = ptm16->tmBreakChar;
|
||||
ptmW->tmItalic = ptm16->tmItalic;
|
||||
ptmW->tmUnderlined = ptm16->tmUnderlined;
|
||||
ptmW->tmStruckOut = ptm16->tmStruckOut;
|
||||
ptmW->tmPitchAndFamily = ptm16->tmPitchAndFamily;
|
||||
ptmW->tmCharSet = ptm16->tmCharSet;
|
||||
ptmW->ntmFlags = ptm16->ntmFlags;
|
||||
ptmW->ntmSizeEM = ptm16->ntmSizeEM;
|
||||
ptmW->ntmCellHeight = ptm16->ntmCellHeight;
|
||||
ptmW->ntmAvgWidth = ptm16->ntmAvgWidth;
|
||||
}
|
||||
|
||||
|
||||
static void WIN16DRV_EnumLogFont16ToW( const ENUMLOGFONT16 *font16, LPENUMLOGFONTW font32 )
|
||||
{
|
||||
font32->elfLogFont.lfHeight = font16->elfLogFont.lfHeight;
|
||||
font32->elfLogFont.lfWidth = font16->elfLogFont.lfWidth;
|
||||
font32->elfLogFont.lfEscapement = font16->elfLogFont.lfEscapement;
|
||||
font32->elfLogFont.lfOrientation = font16->elfLogFont.lfOrientation;
|
||||
font32->elfLogFont.lfWeight = font16->elfLogFont.lfWeight;
|
||||
font32->elfLogFont.lfItalic = font16->elfLogFont.lfItalic;
|
||||
font32->elfLogFont.lfUnderline = font16->elfLogFont.lfUnderline;
|
||||
font32->elfLogFont.lfStrikeOut = font16->elfLogFont.lfStrikeOut;
|
||||
font32->elfLogFont.lfCharSet = font16->elfLogFont.lfCharSet;
|
||||
font32->elfLogFont.lfOutPrecision = font16->elfLogFont.lfOutPrecision;
|
||||
font32->elfLogFont.lfClipPrecision = font16->elfLogFont.lfClipPrecision;
|
||||
font32->elfLogFont.lfQuality = font16->elfLogFont.lfQuality;
|
||||
font32->elfLogFont.lfPitchAndFamily = font16->elfLogFont.lfPitchAndFamily;
|
||||
MultiByteToWideChar( CP_ACP, 0, font16->elfLogFont.lfFaceName, -1,
|
||||
font32->elfLogFont.lfFaceName, LF_FACESIZE );
|
||||
font32->elfLogFont.lfFaceName[LF_FACESIZE-1] = 0;
|
||||
MultiByteToWideChar( CP_ACP, 0, font16->elfFullName, -1, font32->elfFullName, LF_FULLFACESIZE );
|
||||
font32->elfFullName[LF_FULLFACESIZE-1] = 0;
|
||||
MultiByteToWideChar( CP_ACP, 0, font16->elfStyle, -1, font32->elfStyle, LF_FACESIZE );
|
||||
font32->elfStyle[LF_FACESIZE-1] = 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_GetTextExtentPoint
|
||||
*/
|
||||
BOOL WIN16DRV_GetTextExtentPoint( PHYSDEV dev, LPCWSTR wstr, INT count,
|
||||
LPSIZE size )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
DWORD dwRet, len;
|
||||
char *str;
|
||||
|
||||
TRACE("%p %s %d %p\n", physDev->hdc, debugstr_wn(wstr, count), count, size);
|
||||
|
||||
|
||||
len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
|
||||
str = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
|
||||
|
||||
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
|
||||
NULL, str, -len, physDev->FontInfo,
|
||||
win16drv_SegPtr_DrawMode,
|
||||
win16drv_SegPtr_TextXForm, NULL, NULL, 0);
|
||||
size->cx = XDSTOLS(dc,LOWORD(dwRet));
|
||||
size->cy = YDSTOLS(dc,HIWORD(dwRet));
|
||||
TRACE("cx=%ld, cy=%ld\n", size->cx, size->cy );
|
||||
HeapFree( GetProcessHeap(), 0, str );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_GetTextMetrics
|
||||
*/
|
||||
BOOL WIN16DRV_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
|
||||
TRACE("%p \n", physDev->hdc);
|
||||
|
||||
*metrics = physDev->tm;
|
||||
|
||||
TRACE(
|
||||
"H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n",
|
||||
metrics->tmHeight,
|
||||
metrics->tmAscent,
|
||||
metrics->tmDescent,
|
||||
metrics->tmInternalLeading,
|
||||
metrics->tmExternalLeading,
|
||||
metrics->tmAveCharWidth,
|
||||
metrics->tmMaxCharWidth,
|
||||
metrics->tmWeight);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_SelectFont
|
||||
*/
|
||||
HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT hfont)
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
int nSize;
|
||||
|
||||
if (!GetObject16( HFONT_16(hfont), sizeof(physDev->lf), &physDev->lf ))
|
||||
return HGDI_ERROR;
|
||||
|
||||
TRACE("WIN16DRV_FONT_SelectObject %s h=%d\n",
|
||||
debugstr_a(physDev->lf.lfFaceName), physDev->lf.lfHeight);
|
||||
|
||||
if( physDev->FontInfo )
|
||||
{
|
||||
TRACE("UnRealizing FontInfo\n");
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_FONT,
|
||||
physDev->FontInfo,
|
||||
physDev->FontInfo, 0);
|
||||
}
|
||||
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_FONT,
|
||||
&physDev->lf, 0, 0);
|
||||
|
||||
if( physDev->FontInfo &&
|
||||
HeapSize( GetProcessHeap(), 0, physDev->FontInfo ) < nSize )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, physDev->FontInfo );
|
||||
physDev->FontInfo = NULL;
|
||||
}
|
||||
|
||||
if( !physDev->FontInfo )
|
||||
physDev->FontInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
|
||||
|
||||
|
||||
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_FONT,
|
||||
&physDev->lf,
|
||||
physDev->FontInfo,
|
||||
win16drv_SegPtr_TextXForm );
|
||||
|
||||
#define fi physDev->FontInfo
|
||||
physDev->tm.tmHeight = YDSTOLS(dc, fi->dfPixHeight);
|
||||
physDev->tm.tmAscent = YDSTOLS(dc, fi->dfAscent);
|
||||
physDev->tm.tmDescent = physDev->tm.tmHeight - physDev->tm.tmAscent;
|
||||
physDev->tm.tmInternalLeading = YDSTOLS(dc, fi->dfInternalLeading);
|
||||
physDev->tm.tmExternalLeading = YDSTOLS(dc, fi->dfExternalLeading);
|
||||
physDev->tm.tmAveCharWidth = XDSTOLS(dc, fi->dfAvgWidth);
|
||||
physDev->tm.tmMaxCharWidth = XDSTOLS(dc, fi->dfMaxWidth);
|
||||
physDev->tm.tmWeight = fi->dfWeight;
|
||||
physDev->tm.tmOverhang = 0; /*FIXME*/
|
||||
physDev->tm.tmDigitizedAspectX = fi->dfHorizRes;
|
||||
physDev->tm.tmDigitizedAspectY = fi->dfVertRes;
|
||||
physDev->tm.tmFirstChar = fi->dfFirstChar;
|
||||
physDev->tm.tmLastChar = fi->dfLastChar;
|
||||
physDev->tm.tmDefaultChar = fi->dfDefaultChar;
|
||||
physDev->tm.tmBreakChar = fi->dfBreakChar;
|
||||
physDev->tm.tmItalic = fi->dfItalic;
|
||||
physDev->tm.tmUnderlined = fi->dfUnderline;
|
||||
physDev->tm.tmStruckOut = fi->dfStrikeOut;
|
||||
physDev->tm.tmPitchAndFamily = fi->dfPitchAndFamily;
|
||||
physDev->tm.tmCharSet = fi->dfCharSet;
|
||||
#undef fi
|
||||
|
||||
TRACE("H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n",
|
||||
physDev->tm.tmHeight,
|
||||
physDev->tm.tmAscent,
|
||||
physDev->tm.tmDescent,
|
||||
physDev->tm.tmInternalLeading,
|
||||
physDev->tm.tmExternalLeading,
|
||||
physDev->tm.tmAveCharWidth,
|
||||
physDev->tm.tmMaxCharWidth,
|
||||
physDev->tm.tmWeight);
|
||||
|
||||
return (HFONT)1; /* We'll use a device font */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_GetCharWidth
|
||||
*/
|
||||
BOOL WIN16DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar,
|
||||
LPINT buffer )
|
||||
{
|
||||
int i;
|
||||
WORD wRet;
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
|
||||
TRACE("%d - %d into %p\n", firstChar, lastChar, buffer );
|
||||
|
||||
wRet = PRTDRV_GetCharWidth( physDev->segptrPDEVICE, buffer, firstChar,
|
||||
lastChar, physDev->FontInfo,
|
||||
win16drv_SegPtr_DrawMode,
|
||||
win16drv_SegPtr_TextXForm );
|
||||
if( TRACE_ON(win16drv) ){
|
||||
for(i = 0; i <= lastChar - firstChar; i++)
|
||||
TRACE("Char %x: width %d\n", i + firstChar,
|
||||
buffer[i]);
|
||||
}
|
||||
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* WIN16DRV_EnumDeviceFonts
|
||||
*/
|
||||
|
||||
BOOL WIN16DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf,
|
||||
DEVICEFONTENUMPROC proc, LPARAM lp )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
WORD wRet;
|
||||
WEPFC wepfc;
|
||||
char *FaceNameA = NULL;
|
||||
/* EnumDFontCallback is GDI.158 */
|
||||
FARPROC16 pfnCallback = GetProcAddress16( GetModuleHandle16("GDI"), (LPCSTR)158 );
|
||||
|
||||
wepfc.proc = proc;
|
||||
wepfc.lp = lp;
|
||||
|
||||
if(plf->lfFaceName[0]) {
|
||||
INT len;
|
||||
len = WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, NULL, 0,
|
||||
NULL, NULL);
|
||||
FaceNameA = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, FaceNameA, len,
|
||||
NULL, NULL);
|
||||
}
|
||||
wRet = PRTDRV_EnumDFonts(physDev->segptrPDEVICE, FaceNameA, pfnCallback,
|
||||
&wepfc );
|
||||
if(FaceNameA) HeapFree(GetProcessHeap(), 0, FaceNameA);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* EnumCallback (GDI.158)
|
||||
*
|
||||
* This is the callback function used when EnumDFonts is called.
|
||||
* (The printer drivers uses it to pass info on available fonts).
|
||||
*
|
||||
* lpvClientData is the pointer passed to EnumDFonts, which points to a WEPFC
|
||||
* structure (WEPFC = WINE_ENUM_PRINTER_FONT_CALLBACK).
|
||||
*
|
||||
*/
|
||||
WORD WINAPI EnumCallback16(LPENUMLOGFONT16 lpLogFont,
|
||||
LPNEWTEXTMETRIC16 lpTextMetrics,
|
||||
WORD wFontType, LONG lpClientData)
|
||||
{
|
||||
ENUMLOGFONTEXW lfW;
|
||||
NEWTEXTMETRICEXW tmW;
|
||||
|
||||
TRACE("In EnumCallback16 plf=%p\n", lpLogFont);
|
||||
|
||||
memset(&lfW, 0, sizeof(lfW));
|
||||
WIN16DRV_EnumLogFont16ToW(lpLogFont, (ENUMLOGFONTW *)&lfW);
|
||||
|
||||
memset(&tmW, 0, sizeof(tmW));
|
||||
WIN16DRV_NewTextMetric16ToW(lpTextMetrics, (NEWTEXTMETRICW *)&tmW);
|
||||
|
||||
return (*(((WEPFC *)lpClientData)->proc))( &lfW, &tmW, wFontType,
|
||||
((WEPFC *)lpClientData)->lp );
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
* Windows 16 bit device driver graphics functions
|
||||
*
|
||||
* Copyright 1997 John Harvey
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "wownt32.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_LineTo
|
||||
*/
|
||||
BOOL
|
||||
WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
|
||||
{
|
||||
BOOL bRet ;
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
POINT16 points[2];
|
||||
|
||||
points[0].x = dc->CursPosX;
|
||||
points[0].y = dc->CursPosY;
|
||||
points[1].x = x;
|
||||
points[1].y = y;
|
||||
LPtoDP16( HDC_16(physDev->hdc), points, 2 );
|
||||
|
||||
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
|
||||
OS_POLYLINE, 2, points,
|
||||
physDev->PenInfo,
|
||||
NULL,
|
||||
win16drv_SegPtr_DrawMode, dc->hClipRgn);
|
||||
|
||||
dc->CursPosX = x;
|
||||
dc->CursPosY = y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_Rectangle
|
||||
*/
|
||||
BOOL
|
||||
WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
BOOL bRet = 0;
|
||||
POINT16 points[2];
|
||||
|
||||
TRACE("In WIN16DRV_Rectangle, x %d y %d\n", left, top );
|
||||
TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
|
||||
dc->vportOrgX, dc->vportOrgY);
|
||||
points[0].x = left;
|
||||
points[0].y = top;
|
||||
points[1].x = right;
|
||||
points[1].y = bottom;
|
||||
LPtoDP16( HDC_16(physDev->hdc), points, 2 );
|
||||
|
||||
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
|
||||
OS_RECTANGLE, 2, points,
|
||||
physDev->PenInfo,
|
||||
physDev->BrushInfo,
|
||||
win16drv_SegPtr_DrawMode, dc->hClipRgn);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_Polygon
|
||||
*/
|
||||
BOOL
|
||||
WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
BOOL bRet = 0;
|
||||
LPPOINT16 points;
|
||||
int i;
|
||||
|
||||
if(count < 2) return TRUE;
|
||||
if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
|
||||
count++; /* Ensure polygon is closed */
|
||||
|
||||
points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
|
||||
if(points == NULL) return FALSE;
|
||||
|
||||
for (i = 0; i < count - 1; i++)
|
||||
{
|
||||
points[i].x = pt[i].x;
|
||||
points[i].y = pt[i].y;
|
||||
}
|
||||
LPtoDP16( HDC_16(physDev->hdc), points, count-1 );
|
||||
points[count-1].x = points[0].x;
|
||||
points[count-1].y = points[0].y;
|
||||
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
|
||||
OS_WINDPOLYGON, count, points,
|
||||
physDev->PenInfo,
|
||||
physDev->BrushInfo,
|
||||
win16drv_SegPtr_DrawMode, dc->hClipRgn);
|
||||
HeapFree( GetProcessHeap(), 0, points );
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_Polyline
|
||||
*/
|
||||
BOOL
|
||||
WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
BOOL bRet = 0;
|
||||
LPPOINT16 points;
|
||||
int i;
|
||||
|
||||
if(count < 2) return TRUE;
|
||||
|
||||
points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
|
||||
if(points == NULL) return FALSE;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
points[i].x = pt[i].x;
|
||||
points[i].y = pt[i].y;
|
||||
}
|
||||
LPtoDP16( HDC_16(physDev->hdc), points, count );
|
||||
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
|
||||
OS_POLYLINE, count, points,
|
||||
physDev->PenInfo,
|
||||
NULL,
|
||||
win16drv_SegPtr_DrawMode, dc->hClipRgn);
|
||||
HeapFree( GetProcessHeap(), 0, points );
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_Ellipse
|
||||
*/
|
||||
BOOL
|
||||
WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
BOOL bRet = 0;
|
||||
POINT16 points[2];
|
||||
|
||||
TRACE("In WIN16DRV_Ellipse, x %d y %d\n", left, top );
|
||||
TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY);
|
||||
|
||||
points[0].x = left;
|
||||
points[0].y = top;
|
||||
points[1].x = right;
|
||||
points[1].y = bottom;
|
||||
LPtoDP16( HDC_16(physDev->hdc), points, 2 );
|
||||
|
||||
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
|
||||
OS_ELLIPSE, 2, points,
|
||||
physDev->PenInfo,
|
||||
physDev->BrushInfo,
|
||||
win16drv_SegPtr_DrawMode, dc->hClipRgn);
|
||||
return bRet;
|
||||
}
|
|
@ -1,452 +0,0 @@
|
|||
/*
|
||||
* Windows Device Context initialisation functions
|
||||
*
|
||||
* Copyright 1996 John Harvey
|
||||
* 1998 Huw Davies
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "winreg.h"
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "gdi.h"
|
||||
#include "bitmap.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
|
||||
|
||||
#define SUPPORT_REALIZED_FONTS 1
|
||||
#include "pshpack1.h"
|
||||
typedef struct
|
||||
{
|
||||
SHORT nSize;
|
||||
SEGPTR lpindata;
|
||||
SEGPTR lpFont;
|
||||
SEGPTR lpXForm;
|
||||
SEGPTR lpDrawMode;
|
||||
} EXTTEXTDATA, *LPEXTTEXTDATA;
|
||||
#include "poppack.h"
|
||||
|
||||
SEGPTR win16drv_SegPtr_TextXForm;
|
||||
LPTEXTXFORM16 win16drv_TextXFormP;
|
||||
SEGPTR win16drv_SegPtr_DrawMode;
|
||||
LPDRAWMODE win16drv_DrawModeP;
|
||||
|
||||
|
||||
static BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device,
|
||||
LPCSTR output, const DEVMODEA* initData );
|
||||
static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap );
|
||||
static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
|
||||
INT out_count, LPVOID out_data );
|
||||
|
||||
static const DC_FUNCTIONS WIN16DRV_Funcs =
|
||||
{
|
||||
NULL, /* pAbortDoc */
|
||||
NULL, /* pAbortPath */
|
||||
NULL, /* pAngleArc */
|
||||
NULL, /* pArc */
|
||||
NULL, /* pArcTo */
|
||||
NULL, /* pBeginPath */
|
||||
NULL, /* pBitBlt */
|
||||
NULL, /* pChoosePixelFormat */
|
||||
NULL, /* pChord */
|
||||
NULL, /* pCloseFigure */
|
||||
NULL, /* pCreateBitmap */
|
||||
WIN16DRV_CreateDC, /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pDeleteBitmap */
|
||||
NULL, /* pDeleteDC */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
WIN16DRV_DeviceCapabilities, /* pDeviceCapabilities */
|
||||
WIN16DRV_Ellipse, /* pEllipse */
|
||||
NULL, /* pEndDoc */
|
||||
NULL, /* pEndPage */
|
||||
NULL, /* pEndPath */
|
||||
WIN16DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
|
||||
NULL, /* pExcludeClipRect */
|
||||
WIN16DRV_ExtDeviceMode, /* pExtDeviceMode */
|
||||
WIN16DRV_ExtEscape, /* pExtEscape */
|
||||
NULL, /* pExtFloodFill */
|
||||
NULL, /* pExtSelectClipRgn */
|
||||
WIN16DRV_ExtTextOut, /* pExtTextOut */
|
||||
NULL, /* pFillPath */
|
||||
NULL, /* pFillRgn */
|
||||
NULL, /* pFlattenPath */
|
||||
NULL, /* pFrameRgn */
|
||||
NULL, /* pGetBitmapBits */
|
||||
WIN16DRV_GetCharWidth, /* pGetCharWidth */
|
||||
NULL, /* pGetDCOrgEx */
|
||||
NULL, /* pGetDIBColorTable */
|
||||
NULL, /* pGetDIBits */
|
||||
WIN16DRV_GetDeviceCaps, /* pGetDeviceCaps */
|
||||
NULL, /* pGetDeviceGammaRamp */
|
||||
NULL, /* pGetNearestColor */
|
||||
NULL, /* pGetPixel */
|
||||
NULL, /* pGetPixelFormat */
|
||||
NULL, /* pGetSystemPaletteEntries */
|
||||
WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
|
||||
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
|
||||
NULL, /* pIntersectClipRect */
|
||||
NULL, /* pInvertRgn */
|
||||
WIN16DRV_LineTo, /* pLineTo */
|
||||
NULL, /* pMoveTo */
|
||||
NULL, /* pOffsetClipRgn */
|
||||
NULL, /* pOffsetViewportOrgEx */
|
||||
NULL, /* pOffsetWindowOrgEx */
|
||||
NULL, /* pPaintRgn */
|
||||
WIN16DRV_PatBlt, /* pPatBlt */
|
||||
NULL, /* pPie */
|
||||
NULL, /* pPolyBezier */
|
||||
NULL, /* pPolyBezierTo */
|
||||
NULL, /* pPolyDraw */
|
||||
NULL, /* pPolyPolygon */
|
||||
NULL, /* pPolyPolyline */
|
||||
WIN16DRV_Polygon, /* pPolygon */
|
||||
WIN16DRV_Polyline, /* pPolyline */
|
||||
NULL, /* pPolylineTo */
|
||||
NULL, /* pRealizeDefaultPalette */
|
||||
NULL, /* pRealizePalette */
|
||||
WIN16DRV_Rectangle, /* pRectangle */
|
||||
NULL, /* pResetDC */
|
||||
NULL, /* pRestoreDC */
|
||||
NULL, /* pRoundRect */
|
||||
NULL, /* pSaveDC */
|
||||
NULL, /* pScaleViewportExtEx */
|
||||
NULL, /* pScaleWindowExtEx */
|
||||
WIN16DRV_SelectBitmap, /* pSelectBitmap */
|
||||
WIN16DRV_SelectBrush, /* pSelectBrush */
|
||||
NULL, /* pSelectClipPath */
|
||||
WIN16DRV_SelectFont, /* pSelectFont */
|
||||
NULL, /* pSelectPalette */
|
||||
WIN16DRV_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetBitmapBits */
|
||||
NULL, /* pSetBkColor */
|
||||
NULL, /* pSetBkMode */
|
||||
NULL, /* pSetDCOrg */
|
||||
NULL, /* pSetDIBColorTable */
|
||||
NULL, /* pSetDIBits */
|
||||
NULL, /* pSetDIBitsToDevice */
|
||||
NULL, /* pSetDeviceClipping */
|
||||
NULL, /* pSetDeviceGammaRamp */
|
||||
NULL, /* pSetMapMode */
|
||||
NULL, /* pSetMapperFlags */
|
||||
NULL, /* pSetPixel */
|
||||
NULL, /* pSetPixelFormat */
|
||||
NULL, /* pSetPolyFillMode */
|
||||
NULL, /* pSetROP2 */
|
||||
NULL, /* pSetRelAbs */
|
||||
NULL, /* pSetStretchBltMode */
|
||||
NULL, /* pSetTextAlign */
|
||||
NULL, /* pSetTextCharacterExtra */
|
||||
NULL, /* pSetTextColor */
|
||||
NULL, /* pSetTextJustification */
|
||||
NULL, /* pSetViewportExtEx */
|
||||
NULL, /* pSetViewportOrgEx */
|
||||
NULL, /* pSetWindowExtEx */
|
||||
NULL, /* pSetWindowOrgEx */
|
||||
NULL, /* pStartDoc */
|
||||
NULL, /* pStartPage */
|
||||
NULL, /* pStretchBlt */
|
||||
NULL, /* pStretchDIBits */
|
||||
NULL, /* pStrokeAndFillPath */
|
||||
NULL, /* pStrokePath */
|
||||
NULL, /* pSwapBuffers */
|
||||
NULL /* pWidenPath */
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* WIN16DRV_Init
|
||||
*/
|
||||
const DC_FUNCTIONS *WIN16DRV_Init(void)
|
||||
{
|
||||
static int enabled = -1;
|
||||
|
||||
if (enabled == -1)
|
||||
{
|
||||
char printerEnabled[20];
|
||||
HKEY hkey;
|
||||
|
||||
/* default value */
|
||||
strcpy( printerEnabled, "off" );
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\wine", &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(printerEnabled);
|
||||
RegQueryValueExA(hkey, "printer", 0, &type, printerEnabled, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
enabled = !strcasecmp( printerEnabled, "on" );
|
||||
if (!enabled)
|
||||
{
|
||||
MESSAGE("Printing disabled in wine.conf or .winerc file\n");
|
||||
MESSAGE("Use \"printer=on\" in the \"[wine]\" section to enable it.\n");
|
||||
}
|
||||
}
|
||||
|
||||
return enabled ? &WIN16DRV_Funcs : NULL;
|
||||
}
|
||||
|
||||
/* Tempory functions, for initialising structures */
|
||||
/* These values should be calculated, not hardcoded */
|
||||
void InitTextXForm(LPTEXTXFORM16 lpTextXForm)
|
||||
{
|
||||
lpTextXForm->txfHeight = 0x0001;
|
||||
lpTextXForm->txfWidth = 0x000c;
|
||||
lpTextXForm->txfEscapement = 0x0000;
|
||||
lpTextXForm->txfOrientation = 0x0000;
|
||||
lpTextXForm->txfWeight = 0x0190;
|
||||
lpTextXForm->txfItalic = 0x00;
|
||||
lpTextXForm->txfUnderline = 0x00;
|
||||
lpTextXForm->txfStrikeOut = 0x00;
|
||||
lpTextXForm->txfOutPrecision = 0x02;
|
||||
lpTextXForm->txfClipPrecision = 0x01;
|
||||
lpTextXForm->txfAccelerator = 0x0001;
|
||||
lpTextXForm->txfOverhang = 0x0000;
|
||||
}
|
||||
|
||||
|
||||
void InitDrawMode(LPDRAWMODE lpDrawMode)
|
||||
{
|
||||
lpDrawMode->Rop2 = 0x000d;
|
||||
lpDrawMode->bkMode = 0x0001;
|
||||
lpDrawMode->bkColor = 0x3fffffff;
|
||||
lpDrawMode->TextColor = 0x20000000;
|
||||
lpDrawMode->TBreakExtra = 0x0000;
|
||||
lpDrawMode->BreakExtra = 0x0000;
|
||||
lpDrawMode->BreakErr = 0x0000;
|
||||
lpDrawMode->BreakRem = 0x0000;
|
||||
lpDrawMode->BreakCount = 0x0000;
|
||||
lpDrawMode->CharExtra = 0x0000;
|
||||
lpDrawMode->LbkColor = 0x00ffffff;
|
||||
lpDrawMode->LTextColor = 0x00000000;
|
||||
lpDrawMode->ICMCXform = 0; /* ? */
|
||||
lpDrawMode->StretchBltMode = STRETCH_ANDSCANS;
|
||||
lpDrawMode->eMiterLimit = 1;
|
||||
}
|
||||
|
||||
BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device, LPCSTR output,
|
||||
const DEVMODEA* initData )
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD;
|
||||
WORD wRet;
|
||||
int nPDEVICEsize;
|
||||
PDEVICE_HEADER *pPDH;
|
||||
WIN16DRV_PDEVICE *physDev;
|
||||
|
||||
TRACE("In creatdc for (%s,%s,%s) initData %p\n",
|
||||
driver, device, output, initData);
|
||||
|
||||
physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
|
||||
if (!physDev) return FALSE;
|
||||
*pdev = (PHYSDEV)physDev;
|
||||
physDev->hdc = dc->hSelf;
|
||||
physDev->dc = dc;
|
||||
|
||||
pLPD = LoadPrinterDriver(driver);
|
||||
if (pLPD == NULL)
|
||||
{
|
||||
WARN("Failed to find printer driver\n");
|
||||
HeapFree( GetProcessHeap(), 0, physDev );
|
||||
return FALSE;
|
||||
}
|
||||
TRACE("windevCreateDC pLPD %p\n", pLPD);
|
||||
|
||||
/* Now Get the device capabilities from the printer driver */
|
||||
memset( &physDev->DevCaps, 0, sizeof(physDev->DevCaps) );
|
||||
if(!output) output = "LPT1:";
|
||||
|
||||
/* Get GDIINFO which is the same as a DeviceCaps structure */
|
||||
wRet = PRTDRV_Enable(&physDev->DevCaps, GETGDIINFO, device, driver, output,NULL);
|
||||
|
||||
/* Add this to the DC */
|
||||
dc->bitsPerPixel = physDev->DevCaps.bitsPixel;
|
||||
|
||||
TRACE("Got devcaps width %d height %d bits %d planes %d\n",
|
||||
physDev->DevCaps.horzRes, physDev->DevCaps.vertRes,
|
||||
physDev->DevCaps.bitsPixel, physDev->DevCaps.planes);
|
||||
|
||||
/* Now we allocate enough memory for the PDEVICE structure */
|
||||
/* The size of this varies between printer drivers */
|
||||
/* This PDEVICE is used by the printer DRIVER not by the GDI so must */
|
||||
/* be accessable from 16 bit code */
|
||||
nPDEVICEsize = physDev->DevCaps.pdeviceSize + sizeof(PDEVICE_HEADER);
|
||||
|
||||
/* TTD Shouldn't really do pointer arithmetic on segment points */
|
||||
physDev->segptrPDEVICE = K32WOWGlobalLock16(GlobalAlloc16(GHND, nPDEVICEsize))+sizeof(PDEVICE_HEADER);
|
||||
*((BYTE *)MapSL(physDev->segptrPDEVICE)+0) = 'N';
|
||||
*((BYTE *)MapSL(physDev->segptrPDEVICE)+1) = 'B';
|
||||
|
||||
/* Set up the header */
|
||||
pPDH = (PDEVICE_HEADER *)((BYTE*)MapSL(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER));
|
||||
pPDH->pLPD = pLPD;
|
||||
|
||||
TRACE("PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE));
|
||||
|
||||
/* Now get the printer driver to initialise this data */
|
||||
wRet = PRTDRV_Enable((LPVOID)physDev->segptrPDEVICE, INITPDEVICE, device, driver, output, NULL);
|
||||
|
||||
physDev->FontInfo = NULL;
|
||||
physDev->BrushInfo = NULL;
|
||||
physDev->PenInfo = NULL;
|
||||
win16drv_SegPtr_TextXForm = K32WOWGlobalLock16(GlobalAlloc16(GHND, sizeof(TEXTXFORM16)));
|
||||
win16drv_TextXFormP = MapSL(win16drv_SegPtr_TextXForm);
|
||||
|
||||
InitTextXForm(win16drv_TextXFormP);
|
||||
|
||||
/* TTD Lots more to do here */
|
||||
win16drv_SegPtr_DrawMode = K32WOWGlobalLock16(GlobalAlloc16(GHND, sizeof(DRAWMODE)));
|
||||
win16drv_DrawModeP = MapSL(win16drv_SegPtr_DrawMode);
|
||||
|
||||
InitDrawMode(win16drv_DrawModeP);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, DWORD rop )
|
||||
{
|
||||
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
BOOL bRet = 0;
|
||||
|
||||
bRet = PRTDRV_StretchBlt( physDev->segptrPDEVICE, left, top, width, height, (SEGPTR)NULL, 0, 0, width, height,
|
||||
PATCOPY, physDev->BrushInfo, win16drv_SegPtr_DrawMode, NULL);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_GetDeviceCaps
|
||||
*/
|
||||
static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
if (cap >= PHYSICALWIDTH || (cap % 2))
|
||||
{
|
||||
FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap );
|
||||
return 0;
|
||||
}
|
||||
return *((WORD *)&physDev->DevCaps + (cap / 2));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_ExtEscape
|
||||
*/
|
||||
static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
|
||||
INT out_count, LPVOID out_data )
|
||||
{
|
||||
#if 0
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
|
||||
int nRet = 0;
|
||||
|
||||
/* We should really process the nEscape parameter, but for now just
|
||||
pass it all to the driver */
|
||||
if (dc != NULL && physDev->segptrPDEVICE != 0)
|
||||
{
|
||||
switch(nEscape)
|
||||
{
|
||||
case ENABLEPAIRKERNING:
|
||||
FIXME("Escape: ENABLEPAIRKERNING ignored.\n");
|
||||
nRet = 1;
|
||||
break;
|
||||
case GETPAIRKERNTABLE:
|
||||
FIXME("Escape: GETPAIRKERNTABLE ignored.\n");
|
||||
nRet = 0;
|
||||
break;
|
||||
case SETABORTPROC: {
|
||||
/* FIXME: The AbortProc should be called:
|
||||
- After every write to printer port or spool file
|
||||
- Several times when no more disk space
|
||||
- Before every metafile record when GDI does banding
|
||||
*/
|
||||
|
||||
/* Call Control with hdc as lpInData */
|
||||
HDC16 *seghdc = SEGPTR_NEW(HDC16);
|
||||
*seghdc = dc->hSelf;
|
||||
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
|
||||
SEGPTR_GET(seghdc), lpOutData);
|
||||
SEGPTR_FREE(seghdc);
|
||||
break;
|
||||
}
|
||||
|
||||
case NEXTBAND:
|
||||
{
|
||||
LPPOINT16 newInData = SEGPTR_NEW(POINT16);
|
||||
|
||||
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
|
||||
SEGPTR_GET(newInData), lpOutData);
|
||||
SEGPTR_FREE(newInData);
|
||||
break;
|
||||
}
|
||||
|
||||
case GETEXTENDEDTEXTMETRICS:
|
||||
{
|
||||
EXTTEXTDATA *textData = SEGPTR_NEW(EXTTEXTDATA);
|
||||
|
||||
textData->nSize = cbInput;
|
||||
textData->lpindata = lpInData;
|
||||
textData->lpFont = SEGPTR_GET( physDev->FontInfo );
|
||||
textData->lpXForm = win16drv_SegPtr_TextXForm;
|
||||
textData->lpDrawMode = win16drv_SegPtr_DrawMode;
|
||||
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
|
||||
SEGPTR_GET(textData), lpOutData);
|
||||
SEGPTR_FREE(textData);
|
||||
}
|
||||
break;
|
||||
case STARTDOC:
|
||||
{
|
||||
/* lpInData is not necessarily \0 terminated so make it so */
|
||||
char *cp = SEGPTR_ALLOC(cbInput + 1);
|
||||
memcpy(cp, MapSL(lpInData), cbInput);
|
||||
cp[cbInput] = '\0';
|
||||
|
||||
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
|
||||
SEGPTR_GET(cp), lpOutData);
|
||||
SEGPTR_FREE(cp);
|
||||
if (nRet != -1)
|
||||
{
|
||||
HDC *tmpHdc = SEGPTR_NEW(HDC);
|
||||
|
||||
#define SETPRINTERDC SETABORTPROC
|
||||
|
||||
*tmpHdc = dc->hSelf;
|
||||
PRTDRV_Control(physDev->segptrPDEVICE, SETPRINTERDC,
|
||||
SEGPTR_GET(tmpHdc), (SEGPTR)NULL);
|
||||
SEGPTR_FREE(tmpHdc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
|
||||
lpInData, lpOutData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
WARN("Escape(nEscape = %04x) - ???\n", nEscape);
|
||||
return nRet;
|
||||
#endif
|
||||
/* FIXME: should convert args to SEGPTR and redo all the above */
|
||||
FIXME("temporarily broken, please fix\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* GDI objects
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "wownt32.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(gdi);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_SelectBitmap
|
||||
*/
|
||||
HBITMAP WIN16DRV_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
|
||||
{
|
||||
FIXME("BITMAP not implemented\n");
|
||||
return (HBITMAP)1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_SelectBrush
|
||||
*/
|
||||
HBRUSH WIN16DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
int nSize;
|
||||
LOGBRUSH16 lBrush16;
|
||||
|
||||
if (!GetObject16( HBRUSH_16(hbrush), sizeof(lBrush16), &lBrush16 )) return 0;
|
||||
|
||||
if ( physDev->BrushInfo )
|
||||
{
|
||||
TRACE("UnRealizing BrushInfo\n");
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
|
||||
physDev->BrushInfo,
|
||||
physDev->BrushInfo, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH, &lBrush16, 0, 0);
|
||||
physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
|
||||
}
|
||||
|
||||
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
|
||||
&lBrush16, physDev->BrushInfo, win16drv_SegPtr_TextXForm);
|
||||
return hbrush;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_SelectPen
|
||||
*/
|
||||
HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN hpen )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
int nSize;
|
||||
LOGPEN16 lPen16;
|
||||
|
||||
if (!GetObject16( HPEN_16(hpen), sizeof(lPen16), &lPen16 )) return 0;
|
||||
|
||||
if ( physDev->PenInfo )
|
||||
{
|
||||
TRACE("UnRealizing PenInfo\n");
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
|
||||
physDev->PenInfo,
|
||||
physDev->PenInfo, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN, &lPen16, 0, 0);
|
||||
physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
|
||||
}
|
||||
|
||||
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
|
||||
&lPen16, physDev->PenInfo, 0);
|
||||
return hpen;
|
||||
}
|
|
@ -1,825 +0,0 @@
|
|||
/*
|
||||
* Windows Device Context initialisation functions
|
||||
*
|
||||
* Copyright 1996,1997 John Harvey
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "wine/winbase16.h"
|
||||
#include "winuser.h"
|
||||
#include "wownt32.h"
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "wine/debug.h"
|
||||
#include "bitmap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
|
||||
|
||||
/* ### start build ### */
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_lwll (FARPROC16,LONG,WORD,LONG,LONG);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_lwlll (FARPROC16,LONG,WORD,LONG,LONG,
|
||||
LONG);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_llll (FARPROC16,LONG,LONG,LONG,LONG);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_lwwlllll (FARPROC16,LONG,WORD,WORD,
|
||||
LONG,LONG,LONG,LONG,LONG);
|
||||
extern LONG CALLBACK PRTDRV_CallTo16_long_lwlll (FARPROC16,LONG,WORD,LONG,LONG,
|
||||
LONG);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_lwwwwlwwwwllll (FARPROC16,LONG,WORD,
|
||||
WORD,WORD,WORD,LONG,
|
||||
WORD,WORD,WORD,WORD,
|
||||
LONG,LONG,LONG,LONG);
|
||||
extern LONG CALLBACK PRTDRV_CallTo16_long_lwwllwlllllw (FARPROC16,LONG,WORD,
|
||||
WORD,LONG,LONG,WORD,
|
||||
LONG,LONG,LONG,LONG,
|
||||
LONG,WORD);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_llwwlll (FARPROC16,LONG,LONG,WORD,
|
||||
WORD,LONG,LONG,LONG);
|
||||
extern WORD CALLBACK PRTDRV_CallTo16_word_wwlllllw (FARPROC16,WORD,WORD,LONG,
|
||||
LONG,LONG,LONG,LONG,WORD);
|
||||
extern LONG CALLBACK PRTDRV_CallTo16_long_llwll (FARPROC16,LONG,LONG,WORD,LONG,
|
||||
LONG);
|
||||
|
||||
/* ### stop build ### */
|
||||
|
||||
|
||||
#define MAX_PRINTER_DRIVERS 16
|
||||
static LOADED_PRINTER_DRIVER *gapLoadedPrinterDrivers[MAX_PRINTER_DRIVERS];
|
||||
|
||||
|
||||
static void GetPrinterDriverFunctions(HINSTANCE16 hInst, LOADED_PRINTER_DRIVER *pLPD)
|
||||
{
|
||||
#define LoadPrinterDrvFunc(A) pLPD->fn[FUNC_##A] = \
|
||||
GetProcAddress16(hInst, MAKEINTRESOURCEA(ORD_##A))
|
||||
|
||||
LoadPrinterDrvFunc(BITBLT);
|
||||
LoadPrinterDrvFunc(COLORINFO);
|
||||
LoadPrinterDrvFunc(CONTROL);
|
||||
LoadPrinterDrvFunc(DISABLE);
|
||||
LoadPrinterDrvFunc(ENABLE);
|
||||
LoadPrinterDrvFunc(ENUMDFONTS);
|
||||
LoadPrinterDrvFunc(ENUMOBJ);
|
||||
LoadPrinterDrvFunc(OUTPUT);
|
||||
LoadPrinterDrvFunc(PIXEL);
|
||||
LoadPrinterDrvFunc(REALIZEOBJECT);
|
||||
LoadPrinterDrvFunc(STRBLT);
|
||||
LoadPrinterDrvFunc(SCANLR);
|
||||
LoadPrinterDrvFunc(DEVICEMODE);
|
||||
LoadPrinterDrvFunc(EXTTEXTOUT);
|
||||
LoadPrinterDrvFunc(GETCHARWIDTH);
|
||||
LoadPrinterDrvFunc(DEVICEBITMAP);
|
||||
LoadPrinterDrvFunc(FASTBORDER);
|
||||
LoadPrinterDrvFunc(SETATTRIBUTE);
|
||||
LoadPrinterDrvFunc(STRETCHBLT);
|
||||
LoadPrinterDrvFunc(STRETCHDIBITS);
|
||||
LoadPrinterDrvFunc(SELECTBITMAP);
|
||||
LoadPrinterDrvFunc(BITMAPBITS);
|
||||
LoadPrinterDrvFunc(EXTDEVICEMODE);
|
||||
LoadPrinterDrvFunc(DEVICECAPABILITIES);
|
||||
LoadPrinterDrvFunc(ADVANCEDSETUPDIALOG);
|
||||
LoadPrinterDrvFunc(DIALOGFN);
|
||||
LoadPrinterDrvFunc(PSEUDOEDIT);
|
||||
TRACE("got func CONTROL %p enable %p enumDfonts %p realizeobject %p extextout %p\n",
|
||||
pLPD->fn[FUNC_CONTROL],
|
||||
pLPD->fn[FUNC_ENABLE],
|
||||
pLPD->fn[FUNC_ENUMDFONTS],
|
||||
pLPD->fn[FUNC_REALIZEOBJECT],
|
||||
pLPD->fn[FUNC_EXTTEXTOUT]);
|
||||
}
|
||||
|
||||
|
||||
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver)
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
int nDriverSlot = 0;
|
||||
|
||||
/* Look to see if the printer driver is already loaded */
|
||||
while (pLPD == NULL && nDriverSlot < MAX_PRINTER_DRIVERS)
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *ptmpLPD;
|
||||
ptmpLPD = gapLoadedPrinterDrivers[nDriverSlot++];
|
||||
if (ptmpLPD != NULL)
|
||||
{
|
||||
TRACE("Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
|
||||
/* Found driver store info, exit loop */
|
||||
if (strcasecmp(ptmpLPD->szDriver, pszDriver) == 0)
|
||||
pLPD = ptmpLPD;
|
||||
}
|
||||
}
|
||||
return pLPD;
|
||||
}
|
||||
|
||||
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromPDEVICE(SEGPTR segptrPDEVICE)
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
/* Find the printer driver associated with this PDEVICE */
|
||||
/* Each of the PDEVICE structures has a PDEVICE_HEADER structure */
|
||||
/* just before it */
|
||||
if (segptrPDEVICE != 0)
|
||||
{
|
||||
PDEVICE_HEADER *pPDH = ((PDEVICE_HEADER *)MapSL(segptrPDEVICE)) - 1;
|
||||
pLPD = pPDH->pLPD;
|
||||
}
|
||||
return pLPD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a printer driver, adding it self to the list of loaded drivers.
|
||||
*/
|
||||
|
||||
LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
|
||||
{
|
||||
HINSTANCE16 hInst;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
int nDriverSlot = 0;
|
||||
BOOL bSlotFound = FALSE;
|
||||
|
||||
/* First look to see if driver is loaded */
|
||||
pLPD = FindPrinterDriverFromName(pszDriver);
|
||||
if (pLPD != NULL)
|
||||
{
|
||||
/* Already loaded so increase usage count */
|
||||
pLPD->nUsageCount++;
|
||||
return pLPD;
|
||||
}
|
||||
|
||||
/* Not loaded so try and find an empty slot */
|
||||
while (!bSlotFound && nDriverSlot < MAX_PRINTER_DRIVERS)
|
||||
{
|
||||
if (gapLoadedPrinterDrivers[nDriverSlot] == NULL)
|
||||
bSlotFound = TRUE;
|
||||
else
|
||||
nDriverSlot++;
|
||||
}
|
||||
if (!bSlotFound)
|
||||
{
|
||||
WARN("Too many printers drivers loaded\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
char *p, *drvName = HeapAlloc(GetProcessHeap(), 0, strlen(pszDriver) + 5);
|
||||
strcpy(drvName, pszDriver);
|
||||
|
||||
/* Append .DRV to name if no extension present */
|
||||
if (!(p = strrchr(drvName, '.')) || strchr(p, '/') || strchr(p, '\\'))
|
||||
strcat(drvName, ".DRV");
|
||||
|
||||
hInst = LoadLibrary16(drvName);
|
||||
HeapFree(GetProcessHeap(), 0, drvName);
|
||||
}
|
||||
|
||||
|
||||
if (hInst <= 32)
|
||||
{
|
||||
/* Failed to load driver */
|
||||
WARN("Failed to load printer driver %s\n", pszDriver);
|
||||
} else {
|
||||
TRACE("Loaded the library\n");
|
||||
/* Allocate some memory for printer driver info */
|
||||
pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER));
|
||||
memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
|
||||
|
||||
pLPD->hInst = hInst;
|
||||
pLPD->szDriver = HeapAlloc(GetProcessHeap(),0,strlen(pszDriver)+1);
|
||||
strcpy( pLPD->szDriver, pszDriver );
|
||||
|
||||
/* Get DS for the printer module */
|
||||
pLPD->ds_reg = hInst;
|
||||
|
||||
TRACE("DS for %s is %x\n", pszDriver, pLPD->ds_reg);
|
||||
|
||||
/* Get address of printer driver functions */
|
||||
GetPrinterDriverFunctions(hInst, pLPD);
|
||||
|
||||
/* Set initial usage count */
|
||||
pLPD->nUsageCount = 1;
|
||||
|
||||
/* Update table of loaded printer drivers */
|
||||
pLPD->nIndex = nDriverSlot;
|
||||
gapLoadedPrinterDrivers[nDriverSlot] = pLPD;
|
||||
}
|
||||
|
||||
return pLPD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control (ordinal 3)
|
||||
*/
|
||||
INT16 PRTDRV_Control(LPPDEVICE lpDestDev, WORD wfunction, SEGPTR lpInData, SEGPTR lpOutData)
|
||||
{
|
||||
/* wfunction == Escape code */
|
||||
/* lpInData, lpOutData depend on code */
|
||||
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("%08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
if (pLPD->fn[FUNC_CONTROL] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
wRet = PRTDRV_CallTo16_word_lwll( pLPD->fn[FUNC_CONTROL],
|
||||
(SEGPTR)lpDestDev, wfunction,
|
||||
lpInData, lpOutData );
|
||||
}
|
||||
TRACE("return %x\n", wRet);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable (ordinal 5)
|
||||
*/
|
||||
WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
|
||||
LPCSTR lpDeviceName, LPCSTR lpOutputFile, LPVOID lpData)
|
||||
{
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("%s %s\n",lpDestDevType, lpOutputFile);
|
||||
|
||||
/* Get the printer driver info */
|
||||
if (wStyle == INITPDEVICE)
|
||||
pLPD = FindPrinterDriverFromPDEVICE((SEGPTR)lpDevInfo);
|
||||
else
|
||||
pLPD = FindPrinterDriverFromName((char *)lpDeviceName);
|
||||
if (pLPD != NULL) {
|
||||
LONG lP5;
|
||||
DeviceCaps devcaps;
|
||||
SEGPTR lP1, lP3,lP4;
|
||||
WORD wP2;
|
||||
|
||||
if (!pLPD->fn[FUNC_ENABLE]) {
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (wStyle == INITPDEVICE)
|
||||
lP1 = (SEGPTR)lpDevInfo;/* 16 bit segmented ptr already */
|
||||
else
|
||||
lP1 = MapLS(&devcaps);
|
||||
|
||||
wP2 = wStyle;
|
||||
|
||||
/* MapLS handles NULL like a charm ... */
|
||||
lP3 = MapLS(lpDestDevType);
|
||||
lP4 = MapLS(lpOutputFile);
|
||||
lP5 = (LONG)lpData;
|
||||
|
||||
wRet = PRTDRV_CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE], lP1, wP2, lP3, lP4, lP5);
|
||||
UnMapLS(lP3);
|
||||
UnMapLS(lP4);
|
||||
|
||||
/* Get the data back */
|
||||
if (lP1 != 0 && wStyle != INITPDEVICE) {
|
||||
memcpy(lpDevInfo,&devcaps,sizeof(DeviceCaps));
|
||||
UnMapLS(lP1);
|
||||
}
|
||||
}
|
||||
TRACE("return %x\n", wRet);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* EnumDFonts (ordinal 6)
|
||||
*/
|
||||
WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
|
||||
FARPROC16 lpCallbackFunc, LPVOID lpClientData)
|
||||
{
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("%08lx %s %p %p\n",
|
||||
lpDestDev, lpFaceName, lpCallbackFunc, lpClientData);
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
SEGPTR lP1, lP2, lP4;
|
||||
|
||||
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL) {
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = (SEGPTR)lpDestDev;
|
||||
lP2 = MapLS(lpFaceName);
|
||||
lP4 = (LONG)lpClientData;
|
||||
wRet = PRTDRV_CallTo16_word_llll( pLPD->fn[FUNC_ENUMDFONTS], lP1, lP2,
|
||||
(LONG)lpCallbackFunc,lP4);
|
||||
UnMapLS(lP2);
|
||||
} else
|
||||
WARN("Failed to find device\n");
|
||||
|
||||
TRACE("return %x\n", wRet);
|
||||
return wRet;
|
||||
}
|
||||
/*
|
||||
* EnumObj (ordinal 7)
|
||||
*/
|
||||
BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle,
|
||||
FARPROC16 lpCallbackFunc, LPVOID lpClientData)
|
||||
{
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("(some params - FIXME)\n");
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1, lP3, lP4;
|
||||
WORD wP2;
|
||||
|
||||
if (pLPD->fn[FUNC_ENUMOBJ] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = (SEGPTR)lpDestDev;
|
||||
|
||||
wP2 = iStyle;
|
||||
|
||||
/*
|
||||
* Need to pass addres of function conversion function that will switch back to 32 bit code if necessary
|
||||
*/
|
||||
lP3 = (LONG)lpCallbackFunc;
|
||||
|
||||
lP4 = (LONG)lpClientData;
|
||||
|
||||
wRet = PRTDRV_CallTo16_word_lwll( pLPD->fn[FUNC_ENUMOBJ],
|
||||
lP1, wP2, lP3, lP4 );
|
||||
}
|
||||
else
|
||||
WARN("Failed to find device\n");
|
||||
|
||||
TRACE("return %x\n", wRet);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* Output (ordinal 8)
|
||||
*/
|
||||
WORD PRTDRV_Output(LPPDEVICE lpDestDev,
|
||||
WORD wStyle,
|
||||
WORD wCount,
|
||||
POINT16 *points,
|
||||
LPLOGPEN16 lpPen,
|
||||
LPLOGBRUSH16 lpBrush,
|
||||
SEGPTR lpDrawMode,
|
||||
HRGN hClipRgn)
|
||||
{
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("PRTDRV_OUTPUT %d\n", wStyle );
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1, lP4, lP5, lP6, lP7, lP8;
|
||||
WORD wP2, wP3;
|
||||
if (pLPD->fn[FUNC_OUTPUT] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = lpDestDev;
|
||||
wP2 = wStyle;
|
||||
wP3 = wCount;
|
||||
lP4 = MapLS( points );
|
||||
lP5 = MapLS( lpPen );
|
||||
lP6 = MapLS( lpBrush );
|
||||
lP7 = lpDrawMode;
|
||||
|
||||
if (hClipRgn)
|
||||
{
|
||||
DWORD size;
|
||||
RGNDATA *clip;
|
||||
|
||||
size = GetRegionData( hClipRgn, 0, NULL );
|
||||
clip = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
if(!clip)
|
||||
{
|
||||
WARN("Can't alloc clip array in PRTDRV_Output\n");
|
||||
return FALSE;
|
||||
}
|
||||
GetRegionData( hClipRgn, size, clip );
|
||||
if( clip->rdh.nCount == 0 )
|
||||
{
|
||||
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
|
||||
lP1, wP2, wP3, lP4,
|
||||
lP5, lP6, lP7,
|
||||
(SEGPTR) NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT *pRect;
|
||||
RECT16 r16;
|
||||
lP8 = MapLS(&r16);
|
||||
|
||||
for(pRect = (RECT *)clip->Buffer;
|
||||
pRect < (RECT *)clip->Buffer + clip->rdh.nCount; pRect++)
|
||||
{
|
||||
CONV_RECT32TO16( pRect, &r16 );
|
||||
|
||||
TRACE("rect = %d,%d - %d,%d\n", r16.left, r16.top, r16.right, r16.bottom );
|
||||
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
|
||||
lP1, wP2, wP3, lP4,
|
||||
lP5, lP6, lP7, lP8);
|
||||
}
|
||||
UnMapLS(lP8);
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, clip );
|
||||
}
|
||||
else
|
||||
{
|
||||
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
|
||||
lP1, wP2, wP3, lP4,
|
||||
lP5, lP6, lP7, (SEGPTR) NULL);
|
||||
}
|
||||
UnMapLS( lP4 );
|
||||
UnMapLS( lP5 );
|
||||
UnMapLS( lP6 );
|
||||
}
|
||||
TRACE("PRTDRV_Output return %d\n", wRet);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* RealizeObject (ordinal 10)
|
||||
*/
|
||||
DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
|
||||
LPVOID lpInObj, LPVOID lpOutObj,
|
||||
SEGPTR lpTextXForm)
|
||||
{
|
||||
WORD dwRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("%08lx %04x %p %p %08lx\n",
|
||||
lpDestDev, wStyle, lpInObj, lpOutObj, lpTextXForm);
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1, lP3, lP4, lP5;
|
||||
WORD wP2;
|
||||
|
||||
if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = lpDestDev;
|
||||
wP2 = wStyle;
|
||||
lP3 = MapLS( lpInObj );
|
||||
lP4 = MapLS( lpOutObj );
|
||||
lP5 = lpTextXForm;
|
||||
TRACE("Calling Realize %08lx %04x %08lx %08lx %08lx\n",
|
||||
lP1, wP2, lP3, lP4, lP5);
|
||||
dwRet = PRTDRV_CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
|
||||
lP1, wP2, lP3, lP4, lP5);
|
||||
UnMapLS( lP3 );
|
||||
UnMapLS( lP4 );
|
||||
}
|
||||
TRACE("return %x\n", dwRet);
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* StretchBlt (ordinal 27)
|
||||
*/
|
||||
DWORD PRTDRV_StretchBlt(LPPDEVICE lpDestDev,
|
||||
WORD wDestX, WORD wDestY,
|
||||
WORD wDestXext, WORD wDestYext,
|
||||
LPPDEVICE lpSrcDev,
|
||||
WORD wSrcX, WORD wSrcY,
|
||||
WORD wSrcXext, WORD wSrcYext,
|
||||
DWORD Rop3,
|
||||
LPLOGBRUSH16 lpBrush,
|
||||
SEGPTR lpDrawMode,
|
||||
RECT16 *lpClipRect)
|
||||
{
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("(lots of params - FIXME)\n");
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1,lP6, lP11, lP12, lP13;
|
||||
SEGPTR lP14;
|
||||
WORD wP2, wP3, wP4, wP5, wP7, wP8, wP9, wP10;
|
||||
|
||||
if (pLPD->fn[FUNC_STRETCHBLT] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
lP1 = lpDestDev;
|
||||
wP2 = wDestX;
|
||||
wP3 = wDestY;
|
||||
wP4 = wDestXext;
|
||||
wP5 = wDestYext;
|
||||
lP6 = lpSrcDev;
|
||||
wP7 = wSrcX;
|
||||
wP8 = wSrcY;
|
||||
wP9 = wSrcXext;
|
||||
wP10 = wSrcYext;
|
||||
lP11 = Rop3;
|
||||
lP12 = MapLS( lpBrush );
|
||||
lP13 = lpDrawMode;
|
||||
lP14 = MapLS(lpClipRect);
|
||||
wRet = PRTDRV_CallTo16_word_lwwwwlwwwwllll(pLPD->fn[FUNC_STRETCHBLT],
|
||||
lP1, wP2, wP3, wP4, wP5,
|
||||
lP6, wP7, wP8, wP9, wP10,
|
||||
lP11, lP12, lP13, lP14);
|
||||
UnMapLS(lP12);
|
||||
UnMapLS(lP14);
|
||||
TRACE("Called StretchBlt ret %d\n",wRet);
|
||||
}
|
||||
return wRet;
|
||||
}
|
||||
|
||||
DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
|
||||
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
|
||||
LPFONTINFO16 lpFontInfo, SEGPTR lpDrawMode,
|
||||
SEGPTR lpTextXForm, SHORT *lpCharWidths,
|
||||
RECT16 * lpOpaqueRect, WORD wOptions)
|
||||
{
|
||||
DWORD dwRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("(lots of params - FIXME)\n");
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1, lP4, lP5, lP7, lP8, lP9, lP10, lP11;
|
||||
WORD wP2, wP3, wP12;
|
||||
INT16 iP6;
|
||||
|
||||
if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = lpDestDev;
|
||||
wP2 = wDestXOrg;
|
||||
wP3 = wDestYOrg;
|
||||
lP4 = MapLS( lpClipRect );
|
||||
lP5 = MapLS( lpString );
|
||||
iP6 = wCount;
|
||||
|
||||
/* This should be realized by the driver, so in 16bit data area */
|
||||
lP7 = MapLS( lpFontInfo );
|
||||
lP8 = lpDrawMode;
|
||||
lP9 = lpTextXForm;
|
||||
|
||||
if (lpCharWidths != NULL)
|
||||
FIXME("Char widths not supported\n");
|
||||
lP10 = 0;
|
||||
lP11 = MapLS( lpOpaqueRect );
|
||||
wP12 = wOptions;
|
||||
TRACE("Calling ExtTextOut 0x%lx 0x%x 0x%x 0x%lx\n", lP1, wP2, wP3, lP4);
|
||||
TRACE("%s 0x%x 0x%lx 0x%lx\n", lpString, iP6, lP7, lP8);
|
||||
TRACE("0x%lx 0x%lx 0x%lx 0x%x\n",
|
||||
lP9, lP10, lP11, wP12);
|
||||
dwRet = PRTDRV_CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT], lP1, wP2, wP3,
|
||||
lP4, lP5, iP6, lP7, lP8, lP9, lP10, lP11, wP12);
|
||||
UnMapLS( lP4 );
|
||||
UnMapLS( lP5 );
|
||||
UnMapLS( lP7 );
|
||||
UnMapLS( lP11 );
|
||||
}
|
||||
TRACE("return %lx\n", dwRet);
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dmEnumDFonts (GDI.206)
|
||||
*/
|
||||
int WINAPI dmEnumDFonts16(LPPDEVICE lpDestDev, LPSTR lpFaceName, FARPROC16 lpCallbackFunc, LPVOID lpClientData)
|
||||
{
|
||||
/* Windows 3.1 just returns 1 */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dmRealizeObject (GDI.210)
|
||||
*/
|
||||
int WINAPI dmRealizeObject16(LPPDEVICE lpDestDev, INT16 wStyle, LPSTR lpInObj, LPSTR lpOutObj, SEGPTR lpTextXForm)
|
||||
{
|
||||
FIXME("(lpDestDev=%08x,wStyle=%04x,lpInObj=%08x,lpOutObj=%08x,lpTextXForm=%08x): stub\n",
|
||||
(UINT)lpDestDev, wStyle, (UINT)lpInObj, (UINT)lpOutObj, (UINT)lpTextXForm);
|
||||
if (wStyle < 0) { /* Free extra memory of given object's structure */
|
||||
switch ( -wStyle ) {
|
||||
case DRVOBJ_PEN: {
|
||||
/* LPLOGPEN16 DeletePen = (LPLOGPEN16)lpInObj; */
|
||||
|
||||
TRACE("DRVOBJ_PEN_delete\n");
|
||||
break;
|
||||
}
|
||||
case DRVOBJ_BRUSH: {
|
||||
TRACE("DRVOBJ_BRUSH_delete\n");
|
||||
break;
|
||||
}
|
||||
case DRVOBJ_FONT: {
|
||||
/* LPTEXTXFORM16 TextXForm
|
||||
= (LPTEXTXFORM16)lpTextXForm; */
|
||||
TRACE("DRVOBJ_FONT_delete\n");
|
||||
break;
|
||||
}
|
||||
case DRVOBJ_PBITMAP: TRACE("DRVOBJ_PBITMAP_delete\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { /* Realize given object */
|
||||
|
||||
switch (wStyle) {
|
||||
case DRVOBJ_PEN: {
|
||||
LPLOGPEN16 InPen = (LPLOGPEN16)lpInObj;
|
||||
|
||||
TRACE("DRVOBJ_PEN\n");
|
||||
if (lpOutObj) {
|
||||
if (InPen->lopnStyle == PS_NULL) {
|
||||
*(DWORD *)lpOutObj = 0;
|
||||
*(WORD *)(lpOutObj+4) = InPen->lopnStyle;
|
||||
}
|
||||
else
|
||||
if ((InPen->lopnWidth.x > 1) || (InPen->lopnStyle > PS_NULL) ) {
|
||||
*(DWORD *)lpOutObj = InPen->lopnColor;
|
||||
*(WORD *)(lpOutObj+4) = 0;
|
||||
}
|
||||
else {
|
||||
*(DWORD *)lpOutObj = InPen->lopnColor & 0xffff0000;
|
||||
*(WORD *)(lpOutObj+4) = InPen->lopnStyle;
|
||||
}
|
||||
}
|
||||
return sizeof(LOGPEN16);
|
||||
}
|
||||
case DRVOBJ_BRUSH: {
|
||||
LPLOGBRUSH16 InBrush = (LPLOGBRUSH16)lpInObj;
|
||||
LPLOGBRUSH16 OutBrush = (LPLOGBRUSH16)lpOutObj;
|
||||
/* LPPOINT16 Point = (LPPOINT16)lpTextXForm; */
|
||||
|
||||
TRACE("DRVOBJ_BRUSH\n");
|
||||
if (!lpOutObj) return sizeof(LOGBRUSH16);
|
||||
else {
|
||||
OutBrush->lbStyle = InBrush->lbStyle;
|
||||
OutBrush->lbColor = InBrush->lbColor;
|
||||
OutBrush->lbHatch = InBrush->lbHatch;
|
||||
if (InBrush->lbStyle == BS_SOLID)
|
||||
return 0x8002; /* FIXME: diff mono-color */
|
||||
else return 0x8000;
|
||||
}
|
||||
}
|
||||
case DRVOBJ_FONT: {
|
||||
/* LPTEXTXFORM16 TextXForm
|
||||
= (LPTEXTXFORM16)lpTextXForm; */
|
||||
TRACE("DRVOBJ_FONT\n");
|
||||
return 0;/* DISPLAY.DRV doesn't realize fonts */
|
||||
}
|
||||
case DRVOBJ_PBITMAP: TRACE("DRVOBJ_PBITMAP\n");
|
||||
return 0; /* create memory bitmap */
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
|
||||
WORD wFirstChar, WORD wLastChar, LPFONTINFO16 lpFontInfo,
|
||||
SEGPTR lpDrawMode, SEGPTR lpTextXForm )
|
||||
{
|
||||
|
||||
WORD wRet = 0;
|
||||
LOADED_PRINTER_DRIVER *pLPD = NULL;
|
||||
|
||||
TRACE("(lots of params - FIXME)\n");
|
||||
|
||||
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
|
||||
{
|
||||
LONG lP1, lP2, lP5, lP6, lP7;
|
||||
WORD wP3, wP4;
|
||||
|
||||
if (pLPD->fn[FUNC_GETCHARWIDTH] == NULL)
|
||||
{
|
||||
WARN("Not supported by driver\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
lP1 = lpDestDev;
|
||||
lP2 = MapLS( lpBuffer );
|
||||
wP3 = wFirstChar;
|
||||
wP4 = wLastChar;
|
||||
lP5 = MapLS( lpFontInfo );
|
||||
lP6 = lpDrawMode;
|
||||
lP7 = lpTextXForm;
|
||||
|
||||
wRet = PRTDRV_CallTo16_word_llwwlll(pLPD->fn[FUNC_GETCHARWIDTH],
|
||||
lP1, lP2, wP3, wP4, lP5, lP6, lP7 );
|
||||
|
||||
UnMapLS( lP2 );
|
||||
UnMapLS( lP5 );
|
||||
}
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* WIN16DRV_ExtDeviceMode
|
||||
*/
|
||||
INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
|
||||
LPSTR lpszDevice, LPSTR lpszPort,
|
||||
LPDEVMODEA lpdmInput, LPSTR lpszProfile,
|
||||
DWORD dwMode)
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver);
|
||||
SEGPTR lpSegOut, lpSegIn, lpSegDevice, lpSegPort, lpSegProfile;
|
||||
INT16 wRet;
|
||||
|
||||
if(!pLPD) return -1;
|
||||
|
||||
if(pLPD->fn[FUNC_EXTDEVICEMODE] == NULL) {
|
||||
WARN("No EXTDEVICEMODE\n");
|
||||
return -1;
|
||||
}
|
||||
lpSegDevice = MapLS(lpszDevice);
|
||||
lpSegPort = MapLS(lpszPort);
|
||||
lpSegProfile = MapLS(lpszProfile);
|
||||
lpSegOut = MapLS(lpdmOutput);
|
||||
lpSegIn = MapLS(lpdmInput);
|
||||
wRet = PRTDRV_CallTo16_word_wwlllllw( pLPD->fn[FUNC_EXTDEVICEMODE],
|
||||
HWND_16(hwnd), pLPD->hInst,
|
||||
lpSegOut, lpSegDevice, lpSegPort, lpSegIn,
|
||||
lpSegProfile, dwMode );
|
||||
UnMapLS(lpSegOut);
|
||||
UnMapLS(lpSegIn);
|
||||
UnMapLS(lpSegDevice);
|
||||
UnMapLS(lpSegPort);
|
||||
UnMapLS(lpSegProfile);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* WIN16DRV_DeviceCapabilities
|
||||
*
|
||||
* This is a bit of a pain since we don't know the size of lpszOutput we have
|
||||
* call the driver twice.
|
||||
*/
|
||||
DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
|
||||
LPCSTR lpszPort, WORD fwCapability,
|
||||
LPSTR lpszOutput, LPDEVMODEA lpDevMode)
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver);
|
||||
SEGPTR lpSegdm, lpSegOut, lpSegDevice, lpSegPort;
|
||||
DWORD dwRet;
|
||||
|
||||
TRACE("%s,%s,%s,%d,%p,%p\n", lpszDriver, lpszDevice, lpszPort,
|
||||
fwCapability, lpszOutput, lpDevMode);
|
||||
|
||||
if(!pLPD) return -1;
|
||||
|
||||
if(pLPD->fn[FUNC_DEVICECAPABILITIES] == NULL) {
|
||||
WARN("No DEVICECAPABILITES\n");
|
||||
return -1;
|
||||
}
|
||||
lpSegDevice = MapLS(lpszDevice);
|
||||
lpSegPort = MapLS(lpszPort);
|
||||
lpSegdm = MapLS(lpDevMode);
|
||||
lpSegOut = MapLS(lpszOutput);
|
||||
dwRet = PRTDRV_CallTo16_long_llwll( pLPD->fn[FUNC_DEVICECAPABILITIES],
|
||||
lpSegDevice, lpSegPort, fwCapability, lpSegOut, lpSegdm );
|
||||
UnMapLS(lpSegOut);
|
||||
UnMapLS(lpSegdm);
|
||||
UnMapLS(lpSegDevice);
|
||||
UnMapLS(lpSegPort);
|
||||
return dwRet;
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
* win16 driver text functions
|
||||
*
|
||||
* Copyright 1996 John Harvey
|
||||
* 1998 Huw Davies
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "win16drv/win16drv.h"
|
||||
#include "gdi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
|
||||
|
||||
/***********************************************************************
|
||||
* WIN16DRV_ExtTextOut
|
||||
*/
|
||||
BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
||||
const RECT *lprect, LPCWSTR wstr, UINT count,
|
||||
const INT *lpDx )
|
||||
{
|
||||
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
BOOL bRet = 1;
|
||||
RECT16 clipRect;
|
||||
RECT16 opaqueRect;
|
||||
RECT16 *lpOpaqueRect = NULL;
|
||||
WORD wOptions = 0;
|
||||
DWORD len;
|
||||
POINT pt;
|
||||
INT16 width;
|
||||
char *str;
|
||||
DWORD dwRet;
|
||||
|
||||
if (count == 0)
|
||||
return FALSE;
|
||||
|
||||
TRACE("%p %d %d %x %p %s %p\n",
|
||||
dc->hSelf, x, y, flags, lprect, debugstr_wn(wstr, count), lpDx);
|
||||
|
||||
len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
|
||||
str = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
WideCharToMultiByte( CP_ACP, 0, wstr, count, str, len, NULL, NULL );
|
||||
|
||||
clipRect.left = 0;
|
||||
clipRect.top = 0;
|
||||
|
||||
clipRect.right = physDev->DevCaps.horzRes;
|
||||
clipRect.bottom = physDev->DevCaps.vertRes;
|
||||
if (lprect) {
|
||||
opaqueRect.left = lprect->left;
|
||||
opaqueRect.top = lprect->top;
|
||||
opaqueRect.right = lprect->right;
|
||||
opaqueRect.bottom = lprect->bottom;
|
||||
lpOpaqueRect = &opaqueRect;
|
||||
}
|
||||
|
||||
TRACE("textalign = %d\n", dc->textAlign);
|
||||
|
||||
if (dc->textAlign & TA_UPDATECP) {
|
||||
x = dc->CursPosX;
|
||||
y = dc->CursPosY;
|
||||
}
|
||||
|
||||
pt.x = x;
|
||||
pt.y = y;
|
||||
LPtoDP( physDev->hdc, &pt, 1 );
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
|
||||
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
|
||||
NULL, str, -len, physDev->FontInfo,
|
||||
win16drv_SegPtr_DrawMode,
|
||||
win16drv_SegPtr_TextXForm,
|
||||
NULL, NULL, 0);
|
||||
|
||||
width = LOWORD(dwRet);
|
||||
|
||||
switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
|
||||
case TA_LEFT:
|
||||
if (dc->textAlign & TA_UPDATECP)
|
||||
{
|
||||
pt.x = x + width;
|
||||
pt.y = y;
|
||||
DPtoLP( physDev->hdc, &pt, 1 );
|
||||
dc->CursPosX = pt.x;
|
||||
}
|
||||
break;
|
||||
case TA_RIGHT:
|
||||
x -= width;
|
||||
if (dc->textAlign & TA_UPDATECP)
|
||||
{
|
||||
pt.x = x;
|
||||
pt.y = y;
|
||||
DPtoLP( physDev->hdc, &pt, 1 );
|
||||
dc->CursPosX = pt.x;
|
||||
}
|
||||
break;
|
||||
case TA_CENTER:
|
||||
x -= width / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( dc->textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
|
||||
case TA_TOP:
|
||||
break;
|
||||
case TA_BOTTOM:
|
||||
y -= physDev->FontInfo->dfPixHeight;
|
||||
break;
|
||||
case TA_BASELINE:
|
||||
y -= physDev->FontInfo->dfAscent;
|
||||
break;
|
||||
}
|
||||
|
||||
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE,
|
||||
x, y, &clipRect, str, (WORD)len,
|
||||
physDev->FontInfo, win16drv_SegPtr_DrawMode,
|
||||
win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect,
|
||||
wOptions);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, str );
|
||||
return bRet;
|
||||
}
|
|
@ -1,302 +0,0 @@
|
|||
/*
|
||||
* Win16 printer driver definitions
|
||||
*
|
||||
* Copyright (C) the Wine project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_WIN16DRV_H
|
||||
#define __WINE_WIN16DRV_H
|
||||
|
||||
#include "windef.h"
|
||||
#include "wingdi.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#define SETHIGHBIT
|
||||
#undef SETHIGHBIT
|
||||
#ifdef SETHIGHBIT
|
||||
#define GETGDIINFO 0x8001
|
||||
#define INITPDEVICE 0x8000
|
||||
#else
|
||||
#define GETGDIINFO 0x0001
|
||||
#define INITPDEVICE 0x0000
|
||||
#endif
|
||||
|
||||
#define OS_ARC 3
|
||||
#define OS_SCANLINES 4
|
||||
#define OS_RECTANGLE 6
|
||||
#define OS_ELLIPSE 7
|
||||
#define OS_MARKER 8
|
||||
#define OS_POLYLINE 18
|
||||
#define OS_ALTPOLYGON 22
|
||||
#define OS_WINDPOLYGON 20
|
||||
#define OS_PIE 23
|
||||
#define OS_POLYMARKER 24
|
||||
#define OS_CHORD 39
|
||||
#define OS_CIRCLE 55
|
||||
#define OS_ROUNDRECT 72
|
||||
|
||||
/* Internal Data */
|
||||
#define ORD_BITBLT 1
|
||||
#define ORD_COLORINFO 2
|
||||
#define ORD_CONTROL 3
|
||||
#define ORD_DISABLE 4
|
||||
#define ORD_ENABLE 5
|
||||
#define ORD_ENUMDFONTS 6
|
||||
#define ORD_ENUMOBJ 7
|
||||
#define ORD_OUTPUT 8
|
||||
#define ORD_PIXEL 9
|
||||
#define ORD_REALIZEOBJECT 10
|
||||
#define ORD_STRBLT 11
|
||||
#define ORD_SCANLR 12
|
||||
#define ORD_DEVICEMODE 13
|
||||
#define ORD_EXTTEXTOUT 14
|
||||
#define ORD_GETCHARWIDTH 15
|
||||
#define ORD_DEVICEBITMAP 16
|
||||
#define ORD_FASTBORDER 17
|
||||
#define ORD_SETATTRIBUTE 18
|
||||
|
||||
#define ORD_STRETCHBLT 27
|
||||
#define ORD_STRETCHDIBITS 28
|
||||
#define ORD_SELECTBITMAP 29
|
||||
#define ORD_BITMAPBITS 30
|
||||
|
||||
#define ORD_EXTDEVICEMODE 90
|
||||
#define ORD_DEVICECAPABILITIES 91
|
||||
#define ORD_ADVANCEDSETUPDIALOG 93
|
||||
|
||||
#define ORD_DIALOGFN 100
|
||||
#define ORD_PSEUDOEDIT 101
|
||||
|
||||
enum {
|
||||
FUNC_BITBLT = 0,
|
||||
FUNC_COLORINFO,
|
||||
FUNC_CONTROL,
|
||||
FUNC_DISABLE,
|
||||
FUNC_ENABLE,
|
||||
FUNC_ENUMDFONTS,
|
||||
FUNC_ENUMOBJ,
|
||||
FUNC_OUTPUT,
|
||||
FUNC_PIXEL,
|
||||
FUNC_REALIZEOBJECT,
|
||||
FUNC_STRBLT,
|
||||
FUNC_SCANLR,
|
||||
FUNC_DEVICEMODE,
|
||||
FUNC_EXTTEXTOUT,
|
||||
FUNC_GETCHARWIDTH,
|
||||
FUNC_DEVICEBITMAP,
|
||||
FUNC_FASTBORDER,
|
||||
FUNC_SETATTRIBUTE,
|
||||
FUNC_STRETCHBLT,
|
||||
FUNC_STRETCHDIBITS,
|
||||
FUNC_SELECTBITMAP,
|
||||
FUNC_BITMAPBITS,
|
||||
FUNC_EXTDEVICEMODE,
|
||||
FUNC_DEVICECAPABILITIES,
|
||||
FUNC_ADVANCEDSETUPDIALOG,
|
||||
FUNC_DIALOGFN,
|
||||
FUNC_PSEUDOEDIT,
|
||||
TOTAL_PRINTER_DRIVER_FUNCTIONS /* insert functions before here */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPSTR szDriver; /* Driver name eg EPSON */
|
||||
HINSTANCE16 hInst; /* Handle for driver */
|
||||
WORD ds_reg; /* DS of driver */
|
||||
FARPROC16 fn[TOTAL_PRINTER_DRIVER_FUNCTIONS]; /* Printer functions */
|
||||
int nUsageCount; /* Usage count, unload == 0 */
|
||||
int nIndex; /* Index in global driver array */
|
||||
} LOADED_PRINTER_DRIVER;
|
||||
|
||||
typedef struct PDEVICE_HEADER
|
||||
{
|
||||
LOADED_PRINTER_DRIVER *pLPD; /* Associated printer driver */
|
||||
} PDEVICE_HEADER;
|
||||
|
||||
#include "pshpack1.h"
|
||||
#define PCOLOR DWORD
|
||||
typedef struct DRAWMODE
|
||||
{
|
||||
SHORT Rop2;
|
||||
SHORT bkMode;
|
||||
PCOLOR bkColor;
|
||||
PCOLOR TextColor;
|
||||
SHORT TBreakExtra;
|
||||
SHORT BreakExtra;
|
||||
SHORT BreakErr;
|
||||
SHORT BreakRem;
|
||||
SHORT BreakCount;
|
||||
SHORT CharExtra;
|
||||
COLORREF LbkColor;
|
||||
COLORREF LTextColor;
|
||||
DWORD ICMCXform;
|
||||
SHORT StretchBltMode;
|
||||
DWORD eMiterLimit;
|
||||
} DRAWMODE, *LPDRAWMODE;
|
||||
|
||||
|
||||
#include "poppack.h"
|
||||
|
||||
typedef struct WINE_ENUM_PRINTER_FONT_CALLBACK
|
||||
{
|
||||
DEVICEFONTENUMPROC proc;
|
||||
LPARAM lp;
|
||||
} WEPFC;
|
||||
|
||||
#define DRVOBJ_PEN 1
|
||||
#define DRVOBJ_BRUSH 2
|
||||
#define DRVOBJ_FONT 3
|
||||
#define DRVOBJ_PBITMAP 5
|
||||
|
||||
typedef struct tagDeviceCaps
|
||||
{
|
||||
WORD version; /* 0: driver version */
|
||||
WORD technology; /* 2: device technology */
|
||||
WORD horzSize; /* 4: width of display in mm */
|
||||
WORD vertSize; /* 6: height of display in mm */
|
||||
WORD horzRes; /* 8: width of display in pixels */
|
||||
WORD vertRes; /* 10: width of display in pixels */
|
||||
WORD bitsPixel; /* 12: bits per pixel */
|
||||
WORD planes; /* 14: color planes */
|
||||
WORD numBrushes; /* 16: device-specific brushes */
|
||||
WORD numPens; /* 18: device-specific pens */
|
||||
WORD numMarkers; /* 20: device-specific markers */
|
||||
WORD numFonts; /* 22: device-specific fonts */
|
||||
WORD numColors; /* 24: size of color table */
|
||||
WORD pdeviceSize; /* 26: size of PDEVICE structure */
|
||||
WORD curveCaps; /* 28: curve capabilities */
|
||||
WORD lineCaps; /* 30: line capabilities */
|
||||
WORD polygonalCaps; /* 32: polygon capabilities */
|
||||
WORD textCaps; /* 34: text capabilities */
|
||||
WORD clipCaps; /* 36: clipping capabilities */
|
||||
WORD rasterCaps; /* 38: raster capabilities */
|
||||
WORD aspectX; /* 40: relative width of device pixel */
|
||||
WORD aspectY; /* 42: relative height of device pixel */
|
||||
WORD aspectXY; /* 44: relative diagonal width of device pixel */
|
||||
WORD pad1[21]; /* 46-86: reserved */
|
||||
WORD logPixelsX; /* 88: pixels / logical X inch */
|
||||
WORD logPixelsY; /* 90: pixels / logical Y inch */
|
||||
WORD pad2[6]; /* 92-102: reserved */
|
||||
WORD sizePalette; /* 104: entries in system palette */
|
||||
WORD numReserved; /* 106: reserved entries */
|
||||
WORD colorRes; /* 108: color resolution */
|
||||
} DeviceCaps;
|
||||
|
||||
/* Win16 printer driver physical DC */
|
||||
typedef struct
|
||||
{
|
||||
SEGPTR segptrPDEVICE; /* PDEVICE used by 16 bit printer drivers */
|
||||
LOGFONT16 lf; /* Current font details */
|
||||
TEXTMETRICW tm; /* Current font metrics */
|
||||
LPFONTINFO16 FontInfo; /* Current font realized by printer driver */
|
||||
LPLOGBRUSH16 BrushInfo; /* Current brush realized by printer driver */
|
||||
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */
|
||||
HDC hdc;
|
||||
DC *dc;
|
||||
DeviceCaps DevCaps; /* Device caps */
|
||||
} WIN16DRV_PDEVICE;
|
||||
|
||||
/*
|
||||
* Printer driver functions
|
||||
*/
|
||||
typedef SEGPTR LPPDEVICE;
|
||||
LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver);
|
||||
|
||||
extern INT16 PRTDRV_Control(LPPDEVICE lpDestDev, WORD wfunction, SEGPTR lpInData, SEGPTR lpOutData);
|
||||
extern WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
|
||||
LPCSTR lpDeviceName, LPCSTR lpOutputFile, LPVOID lpData);
|
||||
extern WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
|
||||
FARPROC16 lpCallbackFunc, LPVOID lpClientData);
|
||||
extern DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
|
||||
LPVOID lpInObj, LPVOID lpOutObj,
|
||||
SEGPTR lpTextXForm);
|
||||
|
||||
extern BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle, FARPROC16 lpfn, LPVOID lpb);
|
||||
extern DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
|
||||
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
|
||||
LPFONTINFO16 lpFontInfo, SEGPTR lpDrawMode,
|
||||
SEGPTR lpTextXForm, SHORT *lpCharWidths,
|
||||
RECT16 * lpOpaqueRect, WORD wOptions);
|
||||
|
||||
extern WORD PRTDRV_Output(LPPDEVICE lpDestDev,
|
||||
WORD wStyle,
|
||||
WORD wCount,
|
||||
POINT16 *points,
|
||||
LPLOGPEN16 lpPen,
|
||||
LPLOGBRUSH16 lpBrush,
|
||||
SEGPTR lpDrawMode,
|
||||
HRGN hClipRgn);
|
||||
|
||||
DWORD PRTDRV_StretchBlt(LPPDEVICE lpDestDev,
|
||||
WORD wDestX, WORD wDestY,
|
||||
WORD wDestXext, WORD wDestYext,
|
||||
LPPDEVICE lpSrcDev,
|
||||
WORD wSrcX, WORD wSrcY,
|
||||
WORD wSrcXext, WORD wSrcYext,
|
||||
DWORD Rop3,
|
||||
LPLOGBRUSH16 lpBrush,
|
||||
SEGPTR lpDrawMode,
|
||||
RECT16 *lpClipRect);
|
||||
|
||||
extern WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
|
||||
WORD wFirstChar, WORD wLastChar, LPFONTINFO16 lpFontInfo,
|
||||
SEGPTR lpDrawMode, SEGPTR lpTextXForm );
|
||||
|
||||
/* Wine driver functions */
|
||||
|
||||
extern const DC_FUNCTIONS *WIN16DRV_Init(void);
|
||||
extern BOOL WIN16DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer );
|
||||
|
||||
extern BOOL WIN16DRV_GetTextExtentPoint( PHYSDEV dev, LPCWSTR str, INT count,
|
||||
LPSIZE size );
|
||||
extern BOOL WIN16DRV_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics );
|
||||
|
||||
extern BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
||||
const RECT *lprect, LPCWSTR str, UINT count,
|
||||
const INT *lpDx );
|
||||
extern BOOL WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y );
|
||||
extern BOOL WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count );
|
||||
extern BOOL WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count );
|
||||
extern BOOL WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom);
|
||||
extern HBITMAP WIN16DRV_SelectBitmap( PHYSDEV dev, HBITMAP handle );
|
||||
extern HBRUSH WIN16DRV_SelectBrush( PHYSDEV dev, HBRUSH handle );
|
||||
extern HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT handle );
|
||||
extern HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN handle );
|
||||
extern BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top,
|
||||
INT width, INT height, DWORD rop );
|
||||
extern BOOL WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom);
|
||||
extern BOOL WIN16DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf,
|
||||
DEVICEFONTENUMPROC proc, LPARAM lp );
|
||||
|
||||
extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
|
||||
LPDEVMODEA lpdmOutput,
|
||||
LPSTR lpszDevice,
|
||||
LPSTR lpszPort, LPDEVMODEA lpdmInput,
|
||||
LPSTR lpszProfile, DWORD dwMode);
|
||||
extern DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
|
||||
LPCSTR lpszPort, WORD fwCapability,
|
||||
LPSTR lpszOutput, LPDEVMODEA lpdm);
|
||||
|
||||
/*
|
||||
* Wine 16bit driver global variables
|
||||
*/
|
||||
extern SEGPTR win16drv_SegPtr_TextXForm;
|
||||
extern LPTEXTXFORM16 win16drv_TextXFormP;
|
||||
extern SEGPTR win16drv_SegPtr_DrawMode;
|
||||
extern LPDRAWMODE win16drv_DrawModeP;
|
||||
|
||||
#endif /* __WINE_WIN16DRV_H */
|
Loading…
Reference in New Issue