Fixed ttydrv compile when using curses. Cleaned up a few #ifdefs.
[wine/multimedia.git] / graphics / ttydrv / text.c
blobdb35deb2be79048b353ad85ac5444a0c13136b67
1 /*
2 * TTY DC text
4 * Copyright 1999 Patrik Stridvall
5 */
7 #include "config.h"
9 #include "windef.h"
10 #include "winbase.h"
11 #include "wingdi.h"
12 #include "dc.h"
13 #include "debugtools.h"
14 #include "gdi.h"
15 #include "ttydrv.h"
17 DEFAULT_DEBUG_CHANNEL(ttydrv);
19 /***********************************************************************
20 * TTYDRV_DC_ExtTextOut
22 BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
23 const RECT *lpRect, LPCWSTR str, UINT count,
24 const INT *lpDx)
26 #ifdef WINE_CURSES
27 TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
28 INT row, col;
29 LPSTR ascii;
31 TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
32 dc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
34 if(!physDev->window)
35 return FALSE;
37 /* FIXME: Is this really correct? */
38 if(dc->w.textAlign & TA_UPDATECP) {
39 x = dc->w.CursPosX;
40 y = dc->w.CursPosY;
43 x = XLPTODP(dc, x);
44 y = YLPTODP(dc, y);
46 row = (dc->w.DCOrgY + y) / physDev->cellHeight;
47 col = (dc->w.DCOrgX + x) / physDev->cellWidth;
48 ascii = HeapAlloc( GetProcessHeap(), 0, count+1 );
49 lstrcpynWtoA(ascii, str, count+1);
50 mvwaddnstr(physDev->window, row, col, ascii, count);
51 HeapFree( GetProcessHeap(), 0, ascii );
52 wrefresh(physDev->window);
54 if(dc->w.textAlign & TA_UPDATECP) {
55 dc->w.CursPosX += count * physDev->cellWidth;
56 dc->w.CursPosY += physDev->cellHeight;
59 return TRUE;
60 #else /* defined(WINE_CURSES) */
61 FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
62 dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
64 return TRUE;
65 #endif /* defined(WINE_CURSES) */