comparison Gui/win32/gui.c @ 19718:e701a6eed5cb

ISO C90 warnings fixes
author vayne
date Wed, 06 Sep 2006 17:44:41 +0000
parents a894b3a3d28c
children b69d78e8aee8
comparison
equal deleted inserted replaced
19717:0fb41010767d 19718:e701a6eed5cb
267 } 267 }
268 268
269 /* updates sliders and the display */ 269 /* updates sliders and the display */
270 static void updatedisplay(gui_t *gui, HWND hwnd) 270 static void updatedisplay(gui_t *gui, HWND hwnd)
271 { 271 {
272 if(!hwnd) return;
273
274 unsigned int i; 272 unsigned int i;
275 window_priv_t *priv = NULL; 273 window_priv_t *priv = NULL;
274 DWORD time = timeGetTime();
275
276 if(!hwnd) return;
276 277
277 /* load all potmeters hpotmeters */ 278 /* load all potmeters hpotmeters */
278 for(i=0; i<gui->skin->widgetcount; i++) 279 for(i=0; i<gui->skin->widgetcount; i++)
279 { 280 {
280 if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter) 281 if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
306 } 307 }
307 } 308 }
308 } 309 }
309 310
310 /* updating the display once a 100.second is enough imo */ 311 /* updating the display once a 100.second is enough imo */
311 DWORD time = timeGetTime();
312 if((time - oldtime) < 100) return; 312 if((time - oldtime) < 100) return;
313 oldtime=time; 313 oldtime=time;
314 314
315 /* suppress directx's fullscreen window when using the sub window */ 315 /* suppress directx's fullscreen window when using the sub window */
316 if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0])) 316 if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0]))
408 break; 408 break;
409 case IDDIR_OPEN: 409 case IDDIR_OPEN:
410 { 410 {
411 static char path[MAX_PATH]; 411 static char path[MAX_PATH];
412 BROWSEINFO bi; 412 BROWSEINFO bi;
413 LPITEMIDLIST pidl;
413 memset(&bi, 0, sizeof(BROWSEINFO)); 414 memset(&bi, 0, sizeof(BROWSEINFO));
414 bi.lpszTitle = "Choose a Directory..."; 415 bi.lpszTitle = "Choose a Directory...";
415 LPITEMIDLIST pidl = SHBrowseForFolder(&bi); 416 pidl = SHBrowseForFolder(&bi);
416 if (SHGetPathFromIDList(pidl, path)) 417 if (SHGetPathFromIDList(pidl, path))
417 { 418 {
418 gui->playlist->clear_playlist(gui->playlist); 419 gui->playlist->clear_playlist(gui->playlist);
419 adddirtoplaylist(gui->playlist, path, TRUE); 420 adddirtoplaylist(gui->playlist, path, TRUE);
420 gui->startplay(gui); 421 gui->startplay(gui);
534 mplayer_put_key(MOUSE_BTN2_DBL); 535 mplayer_put_key(MOUSE_BTN2_DBL);
535 break; 536 break;
536 } 537 }
537 case WM_MOUSEWHEEL: 538 case WM_MOUSEWHEEL:
538 { 539 {
540 int x = GET_WHEEL_DELTA_WPARAM(wParam);
539 if(vo_nomouse_input) 541 if(vo_nomouse_input)
540 break; 542 break;
541 int x = GET_WHEEL_DELTA_WPARAM(wParam);
542 if (x > 0) 543 if (x > 0)
543 mplayer_put_key(MOUSE_BTN3); 544 mplayer_put_key(MOUSE_BTN3);
544 else 545 else
545 mplayer_put_key(MOUSE_BTN4); 546 mplayer_put_key(MOUSE_BTN4);
546 break; 547 break;
918 break; 919 break;
919 case IDDIR_OPEN: 920 case IDDIR_OPEN:
920 { 921 {
921 static char path[MAX_PATH]; 922 static char path[MAX_PATH];
922 BROWSEINFO bi; 923 BROWSEINFO bi;
924 LPITEMIDLIST pidl;
923 memset(&bi, 0, sizeof(BROWSEINFO)); 925 memset(&bi, 0, sizeof(BROWSEINFO));
924 bi.lpszTitle = "Choose a Directory..."; 926 bi.lpszTitle = "Choose a Directory...";
925 LPITEMIDLIST pidl = SHBrowseForFolder(&bi); 927 pidl = SHBrowseForFolder(&bi);
926 if (SHGetPathFromIDList(pidl, path)) 928 if (SHGetPathFromIDList(pidl, path))
927 { 929 {
928 gui->playlist->clear_playlist(gui->playlist); 930 gui->playlist->clear_playlist(gui->playlist);
929 adddirtoplaylist(gui->playlist, path, TRUE); 931 adddirtoplaylist(gui->playlist, path, TRUE);
930 gui->startplay(gui); 932 gui->startplay(gui);
1419 BITMAPINFO binfo; 1421 BITMAPINFO binfo;
1420 window_priv_t *priv = NULL; 1422 window_priv_t *priv = NULL;
1421 window *desc = NULL; 1423 window *desc = NULL;
1422 char dir[MAX_PATH]; 1424 char dir[MAX_PATH];
1423 unsigned int i; 1425 unsigned int i;
1426 int x = -1, y = -1;
1424 1427
1425 /* destroy the current main window */ 1428 /* destroy the current main window */
1426 if(gui->skin) destroy_window(gui); 1429 if(gui->skin) destroy_window(gui);
1427 1430
1428 /* get screenproperties */ 1431 /* get screenproperties */
1455 } 1458 }
1456 1459
1457 /* load the icon from the executable */ 1460 /* load the icon from the executable */
1458 GetModuleFileName(NULL, dir, MAX_PATH); 1461 GetModuleFileName(NULL, dir, MAX_PATH);
1459 gui->icon = ExtractIcon(instance, dir, 0); 1462 gui->icon = ExtractIcon(instance, dir, 0);
1460 int x = -1, y = -1;
1461 1463
1462 /* create the window class */ 1464 /* create the window class */
1463 wc.style = CS_HREDRAW | CS_VREDRAW; 1465 wc.style = CS_HREDRAW | CS_VREDRAW;
1464 wc.lpfnWndProc = EventProc; 1466 wc.lpfnWndProc = EventProc;
1465 wc.cbClsExtra = 0; 1467 wc.cbClsExtra = 0;
1537 } 1539 }
1538 1540
1539 gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event)) 1541 gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event))
1540 { 1542 {
1541 gui_t *gui = calloc(1, sizeof(gui_t)); 1543 gui_t *gui = calloc(1, sizeof(gui_t));
1542 1544 char temp[MAX_PATH];
1543 HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); 1545 HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
1546
1544 if(runningmplayer) 1547 if(runningmplayer)
1545 { 1548 {
1546 free(gui); 1549 free(gui);
1547 return NULL; 1550 return NULL;
1548 } 1551 }
1554 1557
1555 /* create playlist */ 1558 /* create playlist */
1556 gui->playlist = create_playlist(); 1559 gui->playlist = create_playlist();
1557 1560
1558 if(!skinName) skinName = strdup("Blue"); 1561 if(!skinName) skinName = strdup("Blue");
1559 char temp[MAX_PATH];
1560 sprintf(temp, "%s\\%s", skindir, skinName); 1562 sprintf(temp, "%s\\%s", skindir, skinName);
1561 if(create_window(gui, temp)) return NULL; 1563 if(create_window(gui, temp)) return NULL;
1562 if(create_subwindow(gui, temp)) return NULL; 1564 if(create_subwindow(gui, temp)) return NULL;
1563 if(console) console_toggle(); 1565 if(console) console_toggle();
1564 return gui; 1566 return gui;