~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/mciavi32/wnd.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Digital video MCI Wine Driver
  3  *
  4  * Copyright 1999, 2000 Eric POUECH
  5  * Copyright 2003 Dmitry Timoshkov
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2.1 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the Free Software
 19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 20  */
 21 
 22 #include <string.h>
 23 #include "private_mciavi.h"
 24 #include "wine/debug.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(mciavi);
 27 
 28 static const WCHAR mciaviW[] = {'M','C','I','A','V','I',0};
 29 
 30 static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 31 {
 32     TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hWnd, uMsg, wParam, lParam);
 33 
 34     switch (uMsg) {
 35     case WM_CREATE:
 36         SetWindowLongW(hWnd, 0, (LPARAM)((CREATESTRUCTW *)lParam)->lpCreateParams);
 37         return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 38 
 39     case WM_DESTROY:
 40         MCIAVI_mciClose(GetWindowLongW(hWnd, 0), MCI_WAIT, NULL);
 41         SetWindowLongW(hWnd, 0, 0);
 42         return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 43 
 44     case WM_ERASEBKGND:
 45         {
 46             RECT        rect;
 47             GetClientRect(hWnd, &rect);
 48             FillRect((HDC)wParam, &rect, GetStockObject(BLACK_BRUSH));
 49         }
 50        return 1;
 51 
 52     case WM_PAINT:
 53         {
 54             WINE_MCIAVI *wma = (WINE_MCIAVI *)mciGetDriverData(GetWindowLongW(hWnd, 0));
 55 
 56             if (!wma)
 57                 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 58             
 59             EnterCriticalSection(&wma->cs);
 60 
 61             /* the animation isn't playing, don't paint */
 62             if (wma->dwStatus == MCI_MODE_NOT_READY)
 63             {
 64                 LeaveCriticalSection(&wma->cs);
 65                 /* default paint handling */
 66                 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 67             }
 68 
 69             if (wParam)
 70                 MCIAVI_PaintFrame(wma, (HDC)wParam);
 71             else
 72             {
 73                 PAINTSTRUCT ps;
 74                 BeginPaint(hWnd, &ps);
 75                 MCIAVI_PaintFrame(wma, ps.hdc);
 76                 EndPaint(hWnd, &ps);
 77             }
 78 
 79             LeaveCriticalSection(&wma->cs);
 80         }
 81        return 1;
 82 
 83     default:
 84         return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 85     }
 86 }
 87 
 88 BOOL MCIAVI_UnregisterClass(void)
 89 {
 90     return UnregisterClassW(mciaviW, MCIAVI_hInstance);
 91 }
 92 
 93 BOOL MCIAVI_RegisterClass(void)
 94 {
 95     WNDCLASSW wndClass;
 96 
 97     ZeroMemory(&wndClass, sizeof(WNDCLASSW));
 98     wndClass.style         = CS_DBLCLKS;
 99     wndClass.lpfnWndProc   = MCIAVI_WindowProc;
100     wndClass.cbWndExtra    = sizeof(MCIDEVICEID);
101     wndClass.hInstance     = MCIAVI_hInstance;
102     wndClass.hCursor       = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
103     wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
104     wndClass.lpszClassName = mciaviW;
105 
106     if (RegisterClassW(&wndClass)) return TRUE;
107     if (GetLastError() == ERROR_CLASS_ALREADY_EXISTS) return TRUE;
108 
109     return FALSE;
110 }
111 
112 BOOL    MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms)
113 {
114     static const WCHAR captionW[] = {'W','i','n','e',' ','M','C','I','-','A','V','I',' ','p','l','a','y','e','r',0};
115     HWND        hParent = 0;
116     DWORD       dwStyle = WS_OVERLAPPEDWINDOW;
117     RECT        rc;
118 
119     /* what should be done ? */
120     if (wma->hWnd) return TRUE;
121 
122     if (dwFlags & MCI_DGV_OPEN_PARENT)  hParent = lpOpenParms->hWndParent;
123     if (dwFlags & MCI_DGV_OPEN_WS)      dwStyle = lpOpenParms->dwStyle;
124 
125     rc.left = rc.top = 0;
126     rc.right = (wma->hic ? wma->outbih : wma->inbih)->biWidth;
127     rc.bottom = (wma->hic ? wma->outbih : wma->inbih)->biHeight;
128     AdjustWindowRect(&rc, dwStyle, FALSE);
129     if (!(dwStyle & (WS_CHILD|WS_POPUP))) /* overlapped window ? */
130     {
131         rc.right -= rc.left;
132         rc.bottom -= rc.top;
133         rc.left = rc.top = CW_USEDEFAULT;
134     }
135 
136     wma->hWnd = CreateWindowW(mciaviW, captionW,
137                               dwStyle, rc.left, rc.top,
138                               rc.right, rc.bottom,
139                               hParent, 0, MCIAVI_hInstance,
140                               ULongToPtr(wma->wDevID));
141     wma->hWndPaint = wma->hWnd;
142     return wma->hWnd != 0;
143 }
144 
145 /***************************************************************************
146  *                              MCIAVI_mciPut                   [internal]
147  */
148 DWORD   MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms)
149 {
150     WINE_MCIAVI*        wma = MCIAVI_mciGetOpenDev(wDevID);
151     RECT                rc;
152 
153     TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
154 
155     if (lpParms == NULL)        return MCIERR_NULL_PARAMETER_BLOCK;
156     if (wma == NULL)            return MCIERR_INVALID_DEVICE_ID;
157 
158     EnterCriticalSection(&wma->cs);
159 
160     if (dwFlags & MCI_DGV_RECT) {
161         /* In MCI, RECT structure is used differently: rc.right = width & rc.bottom = height
162          * So convert input MCI RECT into a normal RECT */
163         rc.left = lpParms->rc.left;
164         rc.top = lpParms->rc.top;
165         rc.right = lpParms->rc.left + lpParms->rc.right;
166         rc.bottom = lpParms->rc.top + lpParms->rc.bottom;
167     } else {
168         GetClientRect(wma->hWndPaint, &rc);
169     }
170 
171     if (dwFlags & MCI_DGV_PUT_CLIENT) {
172         FIXME("PUT_CLIENT %s\n", wine_dbgstr_rect(&rc));
173         LeaveCriticalSection(&wma->cs);
174         return MCIERR_UNRECOGNIZED_COMMAND;
175     }
176     if (dwFlags & MCI_DGV_PUT_DESTINATION) {
177         TRACE("PUT_DESTINATION %s\n", wine_dbgstr_rect(&rc));
178         wma->dest = rc;
179     }
180     if (dwFlags & MCI_DGV_PUT_FRAME) {
181         FIXME("PUT_FRAME %s\n", wine_dbgstr_rect(&rc));
182         LeaveCriticalSection(&wma->cs);
183         return MCIERR_UNRECOGNIZED_COMMAND;
184     }
185     if (dwFlags & MCI_DGV_PUT_SOURCE) {
186         TRACE("PUT_SOURCE %s\n", wine_dbgstr_rect(&rc));
187         wma->source = rc;
188     }
189     if (dwFlags & MCI_DGV_PUT_VIDEO) {
190         FIXME("PUT_VIDEO %s\n", wine_dbgstr_rect(&rc));
191         LeaveCriticalSection(&wma->cs);
192         return MCIERR_UNRECOGNIZED_COMMAND;
193     }
194     if (dwFlags & MCI_DGV_PUT_WINDOW) {
195         TRACE("PUT_WINDOW %s\n", wine_dbgstr_rect(&rc));
196         SetWindowPos(wma->hWndPaint, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER);
197     }
198     LeaveCriticalSection(&wma->cs);
199     return 0;
200 }
201 
202 /******************************************************************************
203  *                              MCIAVI_mciWhere                 [internal]
204  */
205 DWORD   MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
206 {
207     WINE_MCIAVI*        wma = MCIAVI_mciGetOpenDev(wDevID);
208     RECT                rc;
209 
210     TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
211 
212     if (lpParms == NULL)        return MCIERR_NULL_PARAMETER_BLOCK;
213     if (wma == NULL)            return MCIERR_INVALID_DEVICE_ID;
214 
215     EnterCriticalSection(&wma->cs);
216 
217     if (dwFlags & MCI_DGV_WHERE_DESTINATION) {
218         if (dwFlags & MCI_DGV_WHERE_MAX) {
219             GetClientRect(wma->hWndPaint, &rc);
220             TRACE("WHERE_DESTINATION_MAX %s\n", wine_dbgstr_rect(&rc));
221         } else {
222             TRACE("WHERE_DESTINATION %s\n", wine_dbgstr_rect(&wma->dest));
223             rc = wma->dest;
224         }
225     }
226     if (dwFlags & MCI_DGV_WHERE_FRAME) {
227         if (dwFlags & MCI_DGV_WHERE_MAX)
228             FIXME("MCI_DGV_WHERE_FRAME_MAX\n");
229         else
230             FIXME("MCI_DGV_WHERE_FRAME\n");
231         LeaveCriticalSection(&wma->cs);
232         return MCIERR_UNRECOGNIZED_COMMAND;
233     }
234     if (dwFlags & MCI_DGV_WHERE_SOURCE) {
235         if (dwFlags & MCI_DGV_WHERE_MAX) {
236             rc.left = 0;
237             rc.top = 0;
238             rc.right = wma->inbih->biWidth;
239             rc.bottom = wma->inbih->biHeight;
240             TRACE("WHERE_SOURCE_MAX %s\n", wine_dbgstr_rect(&rc));
241         } else {
242             TRACE("WHERE_SOURCE %s\n", wine_dbgstr_rect(&wma->source));
243             rc = wma->source;
244         }
245     }
246     if (dwFlags & MCI_DGV_WHERE_VIDEO) {
247         if (dwFlags & MCI_DGV_WHERE_MAX)
248             FIXME("WHERE_VIDEO_MAX\n");
249         else
250             FIXME("WHERE_VIDEO\n");
251         LeaveCriticalSection(&wma->cs);
252         return MCIERR_UNRECOGNIZED_COMMAND;
253     }
254     if (dwFlags & MCI_DGV_WHERE_WINDOW) {
255         if (dwFlags & MCI_DGV_WHERE_MAX) {
256             GetWindowRect(GetDesktopWindow(), &rc);
257             TRACE("WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc));
258         } else {
259             GetWindowRect(wma->hWndPaint, &rc);
260             TRACE("WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc));
261         }
262     }
263 
264     /* In MCI, RECT structure is used differently: rc.right = width & rc.bottom = height
265      * So convert the normal RECT into a MCI RECT before returning */
266     lpParms->rc.left = rc.left;
267     lpParms->rc.top = rc.top;
268     lpParms->rc.right = rc.right - rc.left;
269     lpParms->rc.bottom = rc.bottom - rc.top;
270 
271     LeaveCriticalSection(&wma->cs);
272     return 0;
273 }
274 
275 /***************************************************************************
276  *                              MCIAVI_mciWindow                        [internal]
277  */
278 DWORD   MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms)
279 {
280     WINE_MCIAVI*        wma = MCIAVI_mciGetOpenDev(wDevID);
281 
282     TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
283 
284     if (lpParms == NULL)        return MCIERR_NULL_PARAMETER_BLOCK;
285     if (wma == NULL)            return MCIERR_INVALID_DEVICE_ID;
286 
287     EnterCriticalSection(&wma->cs);
288 
289     if (dwFlags & MCI_DGV_WINDOW_HWND) {
290         if (IsWindow(lpParms->hWnd))
291         {
292             TRACE("Setting hWnd to %p\n", lpParms->hWnd);
293             if (wma->hWnd) ShowWindow(wma->hWnd, SW_HIDE);
294             wma->hWndPaint = (lpParms->hWnd == MCI_DGV_WINDOW_DEFAULT) ? wma->hWnd : lpParms->hWnd;
295         }
296     }
297     if (dwFlags & MCI_DGV_WINDOW_STATE) {
298         TRACE("Setting nCmdShow to %d\n", lpParms->nCmdShow);
299         ShowWindow(wma->hWndPaint, lpParms->nCmdShow);
300     }
301     if (dwFlags & MCI_DGV_WINDOW_TEXT) {
302         TRACE("Setting caption to %s\n", debugstr_w(lpParms->lpstrText));
303         SetWindowTextW(wma->hWndPaint, lpParms->lpstrText);
304     }
305 
306     LeaveCriticalSection(&wma->cs);
307     return 0;
308 }
309 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.