Make the standard create_file request handle serial ports too, and
[wine.git] / dlls / ttydrv / dc.c
blob972ff0bc3cf181caec91edf3544ebf5b4cc614db
1 /*
2 * TTY DC driver
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
21 #include "config.h"
23 #include "ttydrv.h"
24 #include "winbase.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
30 /**********************************************************************
31 * TTYDRV_GDI_Initialize
33 BOOL TTYDRV_GDI_Initialize(void)
35 return TTYDRV_PALETTE_Initialize();
38 /***********************************************************************
39 * TTYDRV_DC_CreateDC
41 BOOL TTYDRV_DC_CreateDC(HDC hdc, TTYDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device,
42 LPCWSTR output, const DEVMODEW *initData)
44 TTYDRV_PDEVICE *physDev;
46 TRACE("(%p, %s, %s, %s, %p)\n",
47 hdc, debugstr_w(driver), debugstr_w(device), debugstr_w(output), initData);
49 physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
50 if(!physDev) {
51 ERR("Can't allocate physDev\n");
52 return FALSE;
54 *pdev = physDev;
55 physDev->hdc = hdc;
56 physDev->org.x = physDev->org.y = 0;
58 if(GetObjectType(hdc) == OBJ_MEMDC) {
59 physDev->window = NULL;
60 physDev->cellWidth = 1;
61 physDev->cellHeight = 1;
62 } else {
63 physDev->window = root_window;
64 physDev->cellWidth = cell_width;
65 physDev->cellHeight = cell_height;
68 return TRUE;
71 /***********************************************************************
72 * TTYDRV_DC_DeleteDC
74 BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
76 TRACE("(%p)\n", physDev->hdc);
78 HeapFree( GetProcessHeap(), 0, physDev );
79 return TRUE;
83 /***********************************************************************
84 * GetDeviceCaps (TTYDRV.@)
86 INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
88 switch(cap)
90 case DRIVERVERSION:
91 return 0x300;
92 case TECHNOLOGY:
93 return DT_RASDISPLAY;
94 case HORZSIZE:
95 return 0; /* FIXME: Screen width in mm */
96 case VERTSIZE:
97 return 0; /* FIXME: Screen height in mm */
98 case HORZRES:
99 return cell_width * screen_cols;
100 case VERTRES:
101 return cell_height * screen_rows;
102 case BITSPIXEL:
103 return 1; /* FIXME */
104 case PLANES:
105 return 1;
106 case NUMBRUSHES:
107 return 16 + 6;
108 case NUMPENS:
109 return 16;
110 case NUMMARKERS:
111 return 0;
112 case NUMFONTS:
113 return 0;
114 case NUMCOLORS:
115 return 100;
116 case PDEVICESIZE:
117 return sizeof(TTYDRV_PDEVICE);
118 case CURVECAPS:
119 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
120 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
121 case LINECAPS:
122 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
123 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
124 case POLYGONALCAPS:
125 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
126 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
127 case TEXTCAPS:
128 return 0;
129 case CLIPCAPS:
130 return CP_REGION;
131 case RASTERCAPS:
132 return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
133 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
134 case ASPECTX:
135 case ASPECTY:
136 return 36;
137 case ASPECTXY:
138 return 51;
139 case LOGPIXELSX:
140 case LOGPIXELSY:
141 return 72; /* FIXME */
142 case SIZEPALETTE:
143 return 256; /* FIXME */
144 case NUMRESERVED:
145 return 0;
146 case COLORRES:
147 return 0;
148 case PHYSICALWIDTH:
149 case PHYSICALHEIGHT:
150 case PHYSICALOFFSETX:
151 case PHYSICALOFFSETY:
152 case SCALINGFACTORX:
153 case SCALINGFACTORY:
154 case VREFRESH:
155 case DESKTOPVERTRES:
156 case DESKTOPHORZRES:
157 case BTLALIGNMENT:
158 return 0;
159 default:
160 FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap );
161 return 0;
166 /***********************************************************************
167 * GetDCOrgEx (TTYDRV.@)
169 BOOL TTYDRV_GetDCOrgEx( TTYDRV_PDEVICE *physDev, LPPOINT pt )
171 *pt = physDev->org;
172 return TRUE;
176 /***********************************************************************
177 * SetDCOrg (TTYDRV.@)
179 DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
181 DWORD ret = MAKELONG( physDev->org.x, physDev->org.y );
182 physDev->org.x = x;
183 physDev->org.y = y;
184 return ret;