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
25 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv
);
30 /***********************************************************************
33 BOOL
TTYDRV_DC_Arc(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
34 INT xstart
, INT ystart
, INT xend
, INT yend
)
36 FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
37 physDev
->hdc
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
41 /***********************************************************************
44 BOOL
TTYDRV_DC_Chord(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
45 INT xstart
, INT ystart
, INT xend
, INT yend
)
47 FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
48 physDev
->hdc
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
52 /***********************************************************************
55 BOOL
TTYDRV_DC_Ellipse(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
57 FIXME("(%x, %d, %d, %d, %d): stub\n", physDev
->hdc
, left
, top
, right
, bottom
);
61 /***********************************************************************
62 * TTYDRV_DC_ExtFloodFill
64 BOOL
TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE
*physDev
, INT x
, INT y
,
65 COLORREF color
, UINT fillType
)
67 FIXME("(%x, %d, %d, 0x%08lx, %u): stub\n", physDev
->hdc
, x
, y
, color
, fillType
);
71 /***********************************************************************
74 COLORREF
TTYDRV_DC_GetPixel(TTYDRV_PDEVICE
*physDev
, INT x
, INT y
)
76 FIXME("(%x, %d, %d): stub\n", physDev
->hdc
, x
, y
);
77 return RGB(0,0,0); /* FIXME: Always returns black */
80 /***********************************************************************
83 BOOL
TTYDRV_DC_LineTo(TTYDRV_PDEVICE
*physDev
, INT x
, INT y
)
86 INT row1
, col1
, row2
, col2
;
89 TRACE("(%x, %d, %d)\n", physDev
->hdc
, x
, y
);
94 GetCurrentPositionEx( physDev
->hdc
, &pt
[0] );
97 LPtoDP( physDev
->hdc
, pt
, 2 );
99 row1
= (physDev
->org
.y
+ pt
[0].y
) / physDev
->cellHeight
;
100 col1
= (physDev
->org
.x
+ pt
[0].x
) / physDev
->cellWidth
;
101 row2
= (physDev
->org
.y
+ pt
[1].y
) / physDev
->cellHeight
;
102 col2
= (physDev
->org
.x
+ pt
[1].x
) / physDev
->cellWidth
;
116 wmove(physDev
->window
, row1
, col1
);
118 wvline(physDev
->window
, ACS_VLINE
, row2
-row1
);
119 } else if(row1
== row2
) {
120 whline(physDev
->window
, ACS_HLINE
, col2
-col1
);
122 FIXME("Diagonal line drawing not yet supported\n");
124 wrefresh(physDev
->window
);
127 #else /* defined(WINE_CURSES) */
128 FIXME("(%x, %d, %d): stub\n", physDev
->hdc
, x
, y
);
131 #endif /* defined(WINE_CURSES) */
134 /***********************************************************************
137 BOOL
TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE
*physDev
, HRGN hrgn
)
139 FIXME("(%x, 0x%04x): stub\n", physDev
->hdc
, hrgn
);
143 /***********************************************************************
146 BOOL
TTYDRV_DC_Pie(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
147 INT xstart
, INT ystart
, INT xend
, INT yend
)
149 FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
150 physDev
->hdc
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
154 /***********************************************************************
157 BOOL
TTYDRV_DC_Polygon(TTYDRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
159 FIXME("(%x, %p, %d): stub\n", physDev
->hdc
, pt
, count
);
163 /***********************************************************************
166 BOOL
TTYDRV_DC_Polyline(TTYDRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
168 FIXME("(%x, %p, %d): stub\n", physDev
->hdc
, pt
, count
);
172 /***********************************************************************
173 * TTYDRV_DC_PolyPolygon
175 BOOL
TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE
*physDev
, const POINT
* pt
, const INT
* counts
, UINT polygons
)
177 FIXME("(%x, %p, %p, %u): stub\n", physDev
->hdc
, pt
, counts
, polygons
);
181 /***********************************************************************
182 * TTYDRV_DC_PolyPolyline
184 BOOL
TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE
*physDev
, const POINT
* pt
, const DWORD
* counts
, DWORD polylines
)
186 FIXME("(%x, %p, %p, %lu): stub\n", physDev
->hdc
, pt
, counts
, polylines
);
191 /***********************************************************************
192 * TTYDRV_DC_Rectangle
194 BOOL
TTYDRV_DC_Rectangle(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
197 INT row1
, col1
, row2
, col2
;
200 TRACE("(%x, %d, %d, %d, %d)\n", physDev
->hdc
, left
, top
, right
, bottom
);
208 rect
.bottom
= bottom
;
209 LPtoDP( physDev
->hdc
, (POINT
*)&rect
, 2 );
210 row1
= (physDev
->org
.y
+ rect
.top
) / physDev
->cellHeight
;
211 col1
= (physDev
->org
.x
+ rect
.left
) / physDev
->cellWidth
;
212 row2
= (physDev
->org
.y
+ rect
.bottom
) / physDev
->cellHeight
;
213 col2
= (physDev
->org
.x
+ rect
.right
) / physDev
->cellWidth
;
226 wmove(physDev
->window
, row1
, col1
);
227 whline(physDev
->window
, ACS_HLINE
, col2
-col1
);
229 wmove(physDev
->window
, row1
, col2
);
230 wvline(physDev
->window
, ACS_VLINE
, row2
-row1
);
232 wmove(physDev
->window
, row2
, col1
);
233 whline(physDev
->window
, ACS_HLINE
, col2
-col1
);
235 wmove(physDev
->window
, row1
, col1
);
236 wvline(physDev
->window
, ACS_VLINE
, row2
-row1
);
238 mvwaddch(physDev
->window
, row1
, col1
, ACS_ULCORNER
);
239 mvwaddch(physDev
->window
, row1
, col2
, ACS_URCORNER
);
240 mvwaddch(physDev
->window
, row2
, col2
, ACS_LRCORNER
);
241 mvwaddch(physDev
->window
, row2
, col1
, ACS_LLCORNER
);
243 wrefresh(physDev
->window
);
246 #else /* defined(WINE_CURSES) */
247 FIXME("(%x, %d, %d, %d, %d): stub\n", physDev
->hdc
, left
, top
, right
, bottom
);
250 #endif /* defined(WINE_CURSES) */
253 /***********************************************************************
254 * TTYDRV_DC_RoundRect
256 BOOL
TTYDRV_DC_RoundRect(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
257 INT bottom
, INT ell_width
, INT ell_height
)
259 FIXME("(%x, %d, %d, %d, %d, %d, %d): stub\n",
260 physDev
->hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
265 /***********************************************************************
268 COLORREF
TTYDRV_DC_SetPixel(TTYDRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
)
274 TRACE("(%x, %d, %d, 0x%08lx)\n", physDev
->hdc
, x
, y
, color
);
281 LPtoDP( physDev
->hdc
, &pt
, 1 );
282 row
= (physDev
->org
.y
+ pt
.y
) / physDev
->cellHeight
;
283 col
= (physDev
->org
.x
+ pt
.x
) / physDev
->cellWidth
;
285 mvwaddch(physDev
->window
, row
, col
, ACS_BULLET
);
286 wrefresh(physDev
->window
);
288 return RGB(0,0,0); /* FIXME: Always returns black */
289 #else /* defined(WINE_CURSES) */
290 FIXME("(%x, %d, %d, 0x%08lx): stub\n", physDev
->hdc
, x
, y
, color
);
292 return RGB(0,0,0); /* FIXME: Always returns black */
293 #endif /* defined(WINE_CURSES) */
296 /***********************************************************************
299 BOOL
TTYDRV_DC_BitBlt(TTYDRV_PDEVICE
*physDevDst
, INT xDst
, INT yDst
,
300 INT width
, INT height
, TTYDRV_PDEVICE
*physDevSrc
,
301 INT xSrc
, INT ySrc
, DWORD rop
)
303 FIXME("(%x, %d, %d, %d, %d, %x, %d, %d, %lu): stub\n",
304 physDevDst
->hdc
, xDst
, yDst
, width
, height
, physDevSrc
->hdc
, xSrc
, ySrc
, rop
);
308 /***********************************************************************
311 BOOL
TTYDRV_DC_PatBlt(TTYDRV_PDEVICE
*physDev
, INT left
, INT top
,
312 INT width
, INT height
, DWORD rop
)
314 FIXME("(%x, %d, %d, %d, %d, %lu): stub\n", physDev
->hdc
, left
, top
, width
, height
, rop
);
318 /***********************************************************************
319 * TTYDRV_DC_StretchBlt
321 BOOL
TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE
*physDevDst
, INT xDst
, INT yDst
,
322 INT widthDst
, INT heightDst
,
323 TTYDRV_PDEVICE
*physDevSrc
, INT xSrc
, INT ySrc
,
324 INT widthSrc
, INT heightSrc
, DWORD rop
)
326 FIXME("(%x, %d, %d, %d, %d, %x, %d, %d, %d, %d, %lu): stub\n",
327 physDevDst
->hdc
, xDst
, yDst
, widthDst
, heightDst
,
328 physDevSrc
->hdc
, xSrc
, ySrc
, widthSrc
, heightSrc
, rop
);
333 /***********************************************************************
334 * TTYDRV_DC_ExtTextOut
336 BOOL
TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE
*physDev
, INT x
, INT y
, UINT flags
,
337 const RECT
*lpRect
, LPCWSTR str
, UINT count
,
345 UINT text_align
= GetTextAlign( physDev
->hdc
);
347 TRACE("(%x, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
348 physDev
->hdc
, x
, y
, flags
, lpRect
, debugstr_wn(str
, count
), count
, lpDx
);
355 /* FIXME: Is this really correct? */
356 if(text_align
& TA_UPDATECP
) GetCurrentPositionEx( physDev
->hdc
, &pt
);
358 LPtoDP( physDev
->hdc
, &pt
, 1 );
359 row
= (physDev
->org
.y
+ pt
.y
) / physDev
->cellHeight
;
360 col
= (physDev
->org
.x
+ pt
.x
) / physDev
->cellWidth
;
361 len
= WideCharToMultiByte( CP_ACP
, 0, str
, count
, NULL
, 0, NULL
, NULL
);
362 ascii
= HeapAlloc( GetProcessHeap(), 0, len
);
363 WideCharToMultiByte( CP_ACP
, 0, str
, count
, ascii
, len
, NULL
, NULL
);
364 mvwaddnstr(physDev
->window
, row
, col
, ascii
, len
);
365 HeapFree( GetProcessHeap(), 0, ascii
);
366 wrefresh(physDev
->window
);
368 if(text_align
& TA_UPDATECP
)
370 pt
.x
+= count
* physDev
->cellWidth
;
371 pt
.y
+= physDev
->cellHeight
;
372 DPtoLP( physDev
->hdc
, &pt
, 1 );
373 MoveToEx( physDev
->hdc
, pt
.x
, pt
.y
, NULL
);
377 #else /* defined(WINE_CURSES) */
378 FIXME("(%x, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
379 physDev
->hdc
, x
, y
, flags
, lpRect
, debugstr_wn(str
,count
), count
, lpDx
);
382 #endif /* defined(WINE_CURSES) */
385 /***********************************************************************
386 * TTYDRV_DC_GetCharWidth
388 BOOL
TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE
*physDev
, UINT firstChar
, UINT lastChar
,
393 FIXME("(%x, %u, %u, %p): semistub\n", physDev
->hdc
, firstChar
, lastChar
, buffer
);
395 for(c
=firstChar
; c
<=lastChar
; c
++) {
396 buffer
[c
-firstChar
] = physDev
->cellWidth
;
402 /***********************************************************************
403 * TTYDRV_DC_GetTextExtentPoint
405 BOOL
TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE
*physDev
, LPCWSTR str
, INT count
,
408 TRACE("(%x, %s, %d, %p)\n", physDev
->hdc
, debugstr_wn(str
, count
), count
, size
);
410 size
->cx
= count
* physDev
->cellWidth
;
411 size
->cy
= physDev
->cellHeight
;
416 /***********************************************************************
417 * TTYDRV_DC_GetTextMetrics
419 BOOL
TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE
*physDev
, LPTEXTMETRICW lptm
)
421 TRACE("(%x, %p)\n", physDev
->hdc
, lptm
);
423 lptm
->tmHeight
= physDev
->cellHeight
;
426 lptm
->tmInternalLeading
= 0;
427 lptm
->tmExternalLeading
= 0;
428 lptm
->tmAveCharWidth
= physDev
->cellWidth
;
429 lptm
->tmMaxCharWidth
= physDev
->cellWidth
;
430 lptm
->tmWeight
= FW_MEDIUM
;
431 lptm
->tmOverhang
= 0;
432 lptm
->tmDigitizedAspectX
= physDev
->cellWidth
;
433 lptm
->tmDigitizedAspectY
= physDev
->cellHeight
;
434 lptm
->tmFirstChar
= 32;
435 lptm
->tmLastChar
= 255;
436 lptm
->tmDefaultChar
= 0;
437 lptm
->tmBreakChar
= 32;
438 lptm
->tmItalic
= FALSE
;
439 lptm
->tmUnderlined
= FALSE
;
440 lptm
->tmStruckOut
= FALSE
;
441 lptm
->tmPitchAndFamily
= TMPF_FIXED_PITCH
|TMPF_DEVICE
;
442 lptm
->tmCharSet
= ANSI_CHARSET
;