Sweden-Number/graphics/ttydrv/text.c

66 lines
1.6 KiB
C
Raw Normal View History

1999-11-24 00:43:29 +01:00
/*
* TTY DC text
*
* Copyright 1999 Patrik Stridvall
*/
#include "config.h"
#include "windef.h"
#include "wingdi.h"
1999-11-24 00:43:29 +01:00
#include "dc.h"
#include "debugtools.h"
#include "gdi.h"
#include "ttydrv.h"
DEFAULT_DEBUG_CHANNEL(ttydrv);
1999-11-24 00:43:29 +01:00
/***********************************************************************
* TTYDRV_DC_ExtTextOut
*/
BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
const RECT *lpRect, LPCWSTR str, UINT count,
1999-11-24 00:43:29 +01:00
const INT *lpDx)
{
#ifdef HAVE_LIBCURSES
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
INT row, col;
LPSTR ascii;
1999-11-24 00:43:29 +01:00
1999-12-12 00:08:48 +01:00
TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
dc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
1999-11-24 00:43:29 +01:00
1999-12-12 00:08:48 +01:00
if(!physDev->window)
return FALSE;
1999-11-24 00:43:29 +01:00
/* FIXME: Is this really correct? */
if(dc->w.textAlign & TA_UPDATECP) {
x = dc->w.CursPosX;
y = dc->w.CursPosY;
}
x = XLPTODP(dc, x);
y = YLPTODP(dc, y);
row = (dc->w.DCOrgY + y) / physDev->cellHeight;
col = (dc->w.DCOrgX + x) / physDev->cellWidth;
ascii = HeapAlloc( GetProcessHeap(), 0, count+1 );
lstrcpynWtoA(ascii, str, count+1);
mvwaddnstr(physDev->window, row, col, ascii, count);
HeapFree( GetProcessHeap(), 0, ascii );
1999-11-24 00:43:29 +01:00
wrefresh(physDev->window);
if(dc->w.textAlign & TA_UPDATECP) {
dc->w.CursPosX += count * physDev->cellWidth;
dc->w.CursPosY += physDev->cellHeight;
1999-11-24 00:43:29 +01:00
}
return TRUE;
#else /* defined(HAVE_LIBCURSES) */
FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
1999-11-24 00:43:29 +01:00
return TRUE;
#endif /* defined(HAVE_LIBCURSES) */
}