4 * Copyright 1999 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
33 /***********************************************************************
36 BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
37 INT xstart, INT ystart, INT xend, INT yend)
39 FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
40 physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
44 /***********************************************************************
47 BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
48 INT xstart, INT ystart, INT xend, INT yend)
50 FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
51 physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
55 /***********************************************************************
58 BOOL TTYDRV_DC_Ellipse(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
60 FIXME("(%p, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
64 /***********************************************************************
65 * TTYDRV_DC_ExtFloodFill
67 BOOL TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE *physDev, INT x, INT y,
68 COLORREF color, UINT fillType)
70 FIXME("(%p, %d, %d, 0x%08lx, %u): stub\n", physDev->hdc, x, y, color, fillType);
74 /***********************************************************************
77 COLORREF TTYDRV_DC_GetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y)
79 FIXME("(%p, %d, %d): stub\n", physDev->hdc, x, y);
80 return RGB(0,0,0); /* FIXME: Always returns black */
83 /***********************************************************************
86 BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y)
89 INT row1, col1, row2, col2;
92 TRACE("(%p, %d, %d)\n", physDev->hdc, x, y);
97 GetCurrentPositionEx( physDev->hdc, &pt[0] );
100 LPtoDP( physDev->hdc, pt, 2 );
102 row1 = (physDev->org.y + pt[0].y) / physDev->cellHeight;
103 col1 = (physDev->org.x + pt[0].x) / physDev->cellWidth;
104 row2 = (physDev->org.y + pt[1].y) / physDev->cellHeight;
105 col2 = (physDev->org.x + pt[1].x) / physDev->cellWidth;
119 wmove(physDev->window, row1, col1);
121 wvline(physDev->window, ACS_VLINE, row2-row1);
122 } else if(row1 == row2) {
123 whline(physDev->window, ACS_HLINE, col2-col1);
125 FIXME("Diagonal line drawing not yet supported\n");
127 wrefresh(physDev->window);
130 #else /* defined(WINE_CURSES) */
131 FIXME("(%p, %d, %d): stub\n", physDev->hdc, x, y);
134 #endif /* defined(WINE_CURSES) */
137 /***********************************************************************
140 BOOL TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE *physDev, HRGN hrgn)
142 FIXME("(%p, %p): stub\n", physDev->hdc, hrgn);
146 /***********************************************************************
149 BOOL TTYDRV_DC_Pie(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
150 INT xstart, INT ystart, INT xend, INT yend)
152 FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
153 physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
157 /***********************************************************************
160 BOOL TTYDRV_DC_Polygon(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
162 FIXME("(%p, %p, %d): stub\n", physDev->hdc, pt, count);
166 /***********************************************************************
169 BOOL TTYDRV_DC_Polyline(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
171 FIXME("(%p, %p, %d): stub\n", physDev->hdc, pt, count);
175 /***********************************************************************
176 * TTYDRV_DC_PolyPolygon
178 BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons)
180 FIXME("(%p, %p, %p, %u): stub\n", physDev->hdc, pt, counts, polygons);
184 /***********************************************************************
185 * TTYDRV_DC_PolyPolyline
187 BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines)
189 FIXME("(%p, %p, %p, %lu): stub\n", physDev->hdc, pt, counts, polylines);
194 /***********************************************************************
195 * TTYDRV_DC_Rectangle
197 BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
200 INT row1, col1, row2, col2;
203 TRACE("(%p, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom);
211 rect.bottom = bottom;
212 LPtoDP( physDev->hdc, (POINT *)&rect, 2 );
213 row1 = (physDev->org.y + rect.top) / physDev->cellHeight;
214 col1 = (physDev->org.x + rect.left) / physDev->cellWidth;
215 row2 = (physDev->org.y + rect.bottom) / physDev->cellHeight;
216 col2 = (physDev->org.x + rect.right) / physDev->cellWidth;
229 wmove(physDev->window, row1, col1);
230 whline(physDev->window, ACS_HLINE, col2-col1);
232 wmove(physDev->window, row1, col2);
233 wvline(physDev->window, ACS_VLINE, row2-row1);
235 wmove(physDev->window, row2, col1);
236 whline(physDev->window, ACS_HLINE, col2-col1);
238 wmove(physDev->window, row1, col1);
239 wvline(physDev->window, ACS_VLINE, row2-row1);
241 mvwaddch(physDev->window, row1, col1, ACS_ULCORNER);
242 mvwaddch(physDev->window, row1, col2, ACS_URCORNER);
243 mvwaddch(physDev->window, row2, col2, ACS_LRCORNER);
244 mvwaddch(physDev->window, row2, col1, ACS_LLCORNER);
246 wrefresh(physDev->window);
249 #else /* defined(WINE_CURSES) */
250 FIXME("(%p, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
253 #endif /* defined(WINE_CURSES) */
256 /***********************************************************************
257 * TTYDRV_DC_RoundRect
259 BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right,
260 INT bottom, INT ell_width, INT ell_height)
262 FIXME("(%p, %d, %d, %d, %d, %d, %d): stub\n",
263 physDev->hdc, left, top, right, bottom, ell_width, ell_height);
268 /***********************************************************************
271 COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color)
277 TRACE("(%p, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color);
284 LPtoDP( physDev->hdc, &pt, 1 );
285 row = (physDev->org.y + pt.y) / physDev->cellHeight;
286 col = (physDev->org.x + pt.x) / physDev->cellWidth;
288 mvwaddch(physDev->window, row, col, ACS_BULLET);
289 wrefresh(physDev->window);
291 return RGB(0,0,0); /* FIXME: Always returns black */
292 #else /* defined(WINE_CURSES) */
293 FIXME("(%p, %d, %d, 0x%08lx): stub\n", physDev->hdc, x, y, color);
295 return RGB(0,0,0); /* FIXME: Always returns black */
296 #endif /* defined(WINE_CURSES) */
299 /***********************************************************************
302 BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
303 INT width, INT height, TTYDRV_PDEVICE *physDevSrc,
304 INT xSrc, INT ySrc, DWORD rop)
306 FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %lu): stub\n",
307 physDevDst->hdc, xDst, yDst, width, height, physDevSrc->hdc, xSrc, ySrc, rop );
311 /***********************************************************************
314 BOOL TTYDRV_DC_PatBlt(TTYDRV_PDEVICE *physDev, INT left, INT top,
315 INT width, INT height, DWORD rop)
317 FIXME("(%p, %d, %d, %d, %d, %lu): stub\n", physDev->hdc, left, top, width, height, rop );
321 /***********************************************************************
322 * TTYDRV_DC_StretchBlt
324 BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
325 INT widthDst, INT heightDst,
326 TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
327 INT widthSrc, INT heightSrc, DWORD rop)
329 FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d, %lu): stub\n",
330 physDevDst->hdc, xDst, yDst, widthDst, heightDst,
331 physDevSrc->hdc, xSrc, ySrc, widthSrc, heightSrc, rop );
336 /***********************************************************************
337 * TTYDRV_DC_ExtTextOut
339 BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
340 const RECT *lpRect, LPCWSTR str, UINT count,
341 const INT *lpDx, INT breakExtra )
348 UINT text_align = GetTextAlign( physDev->hdc );
350 TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
351 physDev->hdc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
358 /* FIXME: Is this really correct? */
359 if(text_align & TA_UPDATECP) GetCurrentPositionEx( physDev->hdc, &pt );
361 LPtoDP( physDev->hdc, &pt, 1 );
362 row = (physDev->org.y + pt.y) / physDev->cellHeight;
363 col = (physDev->org.x + pt.x) / physDev->cellWidth;
364 len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL );
365 ascii = HeapAlloc( GetProcessHeap(), 0, len );
366 WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL );
367 mvwaddnstr(physDev->window, row, col, ascii, len);
368 HeapFree( GetProcessHeap(), 0, ascii );
369 wrefresh(physDev->window);
371 if(text_align & TA_UPDATECP)
373 pt.x += count * physDev->cellWidth;
374 pt.y += physDev->cellHeight;
375 DPtoLP( physDev->hdc, &pt, 1 );
376 MoveToEx( physDev->hdc, pt.x, pt.y, NULL );
380 #else /* defined(WINE_CURSES) */
381 FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
382 physDev->hdc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
385 #endif /* defined(WINE_CURSES) */
388 /***********************************************************************
389 * TTYDRV_DC_GetCharWidth
391 BOOL TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
396 FIXME("(%p, %u, %u, %p): semistub\n", physDev->hdc, firstChar, lastChar, buffer);
398 for(c=firstChar; c<=lastChar; c++) {
399 buffer[c-firstChar] = physDev->cellWidth;
405 /***********************************************************************
406 * TTYDRV_DC_GetTextExtentPoint
408 BOOL TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE *physDev, LPCWSTR str, INT count,
411 TRACE("(%p, %s, %d, %p)\n", physDev->hdc, debugstr_wn(str, count), count, size);
413 size->cx = count * physDev->cellWidth;
414 size->cy = physDev->cellHeight;
419 /***********************************************************************
420 * TTYDRV_DC_GetTextMetrics
422 BOOL TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE *physDev, LPTEXTMETRICW lptm)
424 TRACE("(%p, %p)\n", physDev->hdc, lptm);
426 lptm->tmHeight = physDev->cellHeight;
429 lptm->tmInternalLeading = 0;
430 lptm->tmExternalLeading = 0;
431 lptm->tmAveCharWidth = physDev->cellWidth;
432 lptm->tmMaxCharWidth = physDev->cellWidth;
433 lptm->tmWeight = FW_MEDIUM;
434 lptm->tmOverhang = 0;
435 lptm->tmDigitizedAspectX = physDev->cellWidth;
436 lptm->tmDigitizedAspectY = physDev->cellHeight;
437 lptm->tmFirstChar = 32;
438 lptm->tmLastChar = 255;
439 lptm->tmDefaultChar = 0;
440 lptm->tmBreakChar = 32;
441 lptm->tmItalic = FALSE;
442 lptm->tmUnderlined = FALSE;
443 lptm->tmStruckOut = FALSE;
444 lptm->tmPitchAndFamily = TMPF_FIXED_PITCH|TMPF_DEVICE;
445 lptm->tmCharSet = ANSI_CHARSET;