summaryrefslogtreecommitdiffstats
path: root/gui/win32/gui.c
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-07-07 19:35:54 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-07-07 21:49:42 +0300
commit87366694d82c8d4c7f0bc210e6baa0ccd651d0c2 (patch)
tree57c6a283eed4934c6041658effab17435ef2ff1c /gui/win32/gui.c
parenta2037a2effbd4622d0e8336245a9b14c3f886bde (diff)
downloadmpv-87366694d82c8d4c7f0bc210e6baa0ccd651d0c2.tar.bz2
mpv-87366694d82c8d4c7f0bc210e6baa0ccd651d0c2.tar.xz
Remove the internal GUI
The GUI is badly designed and too closely coupled to the internal details of other code. The GUI code is in bad shape and unmaintained for years. There is no indication that anyone would maintain it in the future either. Even if someone did volunteer to implement a better integrated GUI having the current code in the tree probably wouldn't help much. So get rid of it.
Diffstat (limited to 'gui/win32/gui.c')
-rw-r--r--gui/win32/gui.c1549
1 files changed, 0 insertions, 1549 deletions
diff --git a/gui/win32/gui.c b/gui/win32/gui.c
deleted file mode 100644
index d9d86f58a3..0000000000
--- a/gui/win32/gui.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <shlobj.h>
-
-#include "version.h"
-#include "mplayer.h"
-#include "mp_fifo.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "input/input.h"
-#include "input/mouse.h"
-#include "osdep/keycodes.h"
-#include "stream/stream.h"
-#include "libvo/video_out.h"
-#include "gui/interface.h"
-#include "gui.h"
-#include "dialogs.h"
-
-// HACK around bug in old mingw
-#undef INVALID_FILE_ATTRIBUTES
-#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
-
-#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 0x020B
-# define WM_XBUTTONUP 0x020C
-# define WM_XBUTTONDBLCLK 0x020D
-#endif
-
-/* Globals / Externs */
-void renderinfobox(skin_t *skin, window_priv_t *priv);
-void renderwidget(skin_t *skin, image *dest, widget *item, int state);
-void print_version(void);
-float sub_aspect;
-
-DWORD oldtime;
-NOTIFYICONDATA nid;
-int console_state = 0;
-play_tree_t *playtree = NULL;
-
-static HBRUSH colorbrush = NULL; //Handle to colorkey brush
-static COLORREF windowcolor = RGB(255,0,255); //Windowcolor == colorkey
-
-void console_toggle(void)
-{
- if (console_state)
- {
- FreeConsole();
- console = 0;
- console_state = 0;
- }
- else
- {
- /* This code comes from: http://dslweb.nwnexus.com/~ast/dload/guicon.htm */
- CONSOLE_SCREEN_BUFFER_INFO coninfo;
- FILE *fp;
- HWND hwnd = NULL;
- console = 1;
- AllocConsole();
- SetConsoleTitle(MP_TITLE);
-
- /* disable the close button for now */
- while (!hwnd)
- {
- hwnd = FindWindow(NULL, MP_TITLE);
- Sleep(100);
- }
- DeleteMenu(GetSystemMenu(hwnd, 0), SC_CLOSE, MF_BYCOMMAND);
-
- GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
- coninfo.dwSize.Y = 1000;
- SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
- fp = freopen("con", "w", stdout);
- *stdout = *fp;
- setvbuf(stdout, NULL, _IONBF, 0);
- fp = freopen("con", "r", stdin);
- *stdin = *fp;
- setvbuf(stdin, NULL, _IONBF, 0);
- fp = freopen("con", "w", stdout);
- *stderr = *fp;
- setvbuf(stderr, NULL, _IONBF, 0);
- print_version();
- console_state = 1;
- }
-}
-
-void capitalize(char *filename)
-{
- unsigned int i;
- BOOL cap = TRUE;
- for (i=0; i < strlen(filename); i++)
- {
- if (cap)
- {
- cap = FALSE;
- filename[i] = toupper(filename[i]);
- }
- else if (filename[i] == ' ')
- cap = TRUE;
- else
- filename[i] = tolower(filename[i]);
- }
-}
-
-static image *get_drawground(HWND hwnd)
-{
- gui_t * gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return NULL;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd==hwnd)
- return &gui->window_priv[i]->img;
- return NULL;
-}
-
-static HBITMAP get_bitmap(HWND hwnd)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return NULL;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd == hwnd)
- return gui->window_priv[i]->bitmap;
- return NULL;
-}
-
-static int get_windowtype(HWND hwnd)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return -1;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd == hwnd)
- return gui->window_priv[i]->type;
- return -1;
-}
-
-static void uninit(gui_t *gui)
-{
- if(gui->skin) destroy_window(gui);
- if(gui->playlist) gui->playlist->free_playlist(gui->playlist);
- gui->playlist = NULL;
-}
-
-/*
- the gui message handler
- tries to handle the incoming messages
- and passes them to the player's message handler if it can't handle them
-*/
-static void handlemsg(HWND hWnd, int msg)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if(msg == evNone) return;
-
- switch(msg)
- {
- case evLoadPlay:
- case evLoad:
- if(display_openfilewindow(gui, 0) && (msg == evLoadPlay))
- handlemsg(hWnd, evDropFile);
- return;
- case evLoadSubtitle:
- display_opensubtitlewindow(gui);
- break;
- case evPreferences:
- display_prefswindow(gui);
- return;
- case evPlayList:
- display_playlistwindow(gui);
- return;
- case evSkinBrowser:
- display_skinbrowser(gui);
- break;
- case evEqualizer:
- display_eqwindow(gui);
- break;
- case evAbout:
- MessageBox(hWnd, COPYRIGHT, "About", MB_OK);
- break;
- case evIconify:
- ShowWindow(hWnd, SW_MINIMIZE);
- break;
- case evIncVolume:
- mplayer_put_key(KEY_VOLUME_UP);
- break;
- case evDecVolume:
- mplayer_put_key(KEY_VOLUME_DOWN);
- break;
- default:
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] received msg %s (%i)\n", gui->skin->geteventname(msg), msg);
- break;
- }
- gui->playercontrol(msg);
-}
-
-static widget *clickedinsidewidget(gui_t *gui, int window, int x, int y)
-{
- unsigned int i;
- widget *item;
- for(i=0; i<gui->skin->widgetcount; i++)
- {
- item = gui->skin->widgets[i];
- if((item->window == window) && (item->x <= x) && (item->x + item->width >= x) &&
- (item->y <= y) && (item->y + item->height >= y))
- return item;
- }
- return NULL;
-}
-
-/* updates sliders and the display */
-static void updatedisplay(gui_t *gui, HWND hwnd)
-{
- unsigned int i;
- window_priv_t *priv = NULL;
- DWORD time = timeGetTime();
-
- if(!hwnd) return;
-
- /* load all potmeters hpotmeters */
- for(i=0; i<gui->skin->widgetcount; i++)
- {
- if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
- {
- if(gui->skin->widgets[i]->msg == evSetVolume)
- gui->skin->widgets[i]->value = guiIntfStruct.Volume;
- else if(gui->skin->widgets[i]->msg == evSetMoviePosition)
- gui->skin->widgets[i]->value = guiIntfStruct.Position;
- else if(gui->skin->widgets[i]->msg == evSetBalance)
- gui->skin->widgets[i]->value = guiIntfStruct.Balance;
- if(gui->skin->widgets[i]->window == get_windowtype(hwnd))
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- gui->skin->widgets[i]->pressed ? 0 : 1);
- }
- /* update some buttons */
- if(gui->skin->widgets[i]->type == tyButton && gui->skin->widgets[i]->window == get_windowtype(hwnd))
- {
- if(gui->skin->widgets[i]->msg == evPlaySwitchToPause)
- {
- gui->skin->widgets[i]->value = guiIntfStruct.Playing;
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- guiIntfStruct.Playing == 1 ? 0 : 1);
- }
- if(gui->skin->widgets[i]->msg == evMute)
- {
- gui->skin->widgets[i]->value = guiIntfStruct.Volume;
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- guiIntfStruct.Volume == 0.0f ? 0 : 1);
- }
- }
- }
-
- /* updating the display once a 100.second is enough imo */
- if((time - oldtime) < 100) return;
- oldtime=time;
-
- /* suppress directx's fullscreen window when using the sub window */
- if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0]))
- {
- HWND hWndFS = NULL; //handle to directx's fullscreen window
- if(hWndFS == NULL)
- {
- hWndFS = FindWindow(NULL, "MPlayer Fullscreen");
- if(hWndFS != NULL) DestroyWindow(hWndFS); //sub window handles fullscreen
- }
- }
-
- for (i=0; i<gui->window_priv_count; i++)
- {
- if(gui->window_priv[i]->hwnd == hwnd)
- priv=gui->window_priv[i];
- }// Sherpya
- /* display the status msgs */
- renderinfobox(gui->skin, priv);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
-}
-
-static LRESULT CALLBACK SubProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (gui && (gui->subwindow != hWnd)) return FALSE;
-
- switch (message)
- {
- case WM_CLOSE:
- handlemsg(hWnd, evExit);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- case WM_KEYDOWN:
- {
- switch(wParam)
- {
- case VK_LEFT:
- mplayer_put_key(KEY_LEFT);
- break;
- case VK_UP:
- mplayer_put_key(KEY_UP);
- break;
- case VK_RIGHT:
- mplayer_put_key(KEY_RIGHT);
- break;
- case VK_DOWN:
- mplayer_put_key(KEY_DOWN);
- break;
- case VK_TAB:
- mplayer_put_key(KEY_TAB);
- break;
- case VK_BACK:
- mplayer_put_key(KEY_BS);
- break;
- case VK_DELETE:
- mplayer_put_key(KEY_DELETE);
- break;
- case VK_INSERT:
- mplayer_put_key(KEY_INSERT);
- break;
- case VK_HOME:
- mplayer_put_key(KEY_HOME);
- break;
- case VK_END:
- mplayer_put_key(KEY_END);
- break;
- case VK_PRIOR:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case VK_NEXT:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- case VK_ESCAPE:
- mplayer_put_key(KEY_ESC);
- break;
- }
- break;
- }
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDEXIT:
- PostQuitMessage(0);
- handlemsg(hWnd, evExit);
- break;
- case IDFILE_OPEN:
- handlemsg(hWnd, evLoadPlay);
- break;
- case IDURL_OPEN:
- display_openurlwindow(gui, 0);
- break;
- case IDDIR_OPEN:
- {
- static char path[MAX_PATH];
- BROWSEINFO bi;
- LPITEMIDLIST pidl;
- memset(&bi, 0, sizeof(BROWSEINFO));
- bi.lpszTitle = "Choose a Directory...";
- pidl = SHBrowseForFolder(&bi);
- if (SHGetPathFromIDList(pidl, path))
- {
- gui->playlist->clear_playlist(gui->playlist);
- adddirtoplaylist(gui->playlist, path, TRUE);
- gui->startplay(gui);
- }
- break;
- }
- case ID_PTRACK:
- handlemsg(hWnd, evPrev);
- break;
- case ID_SEEKB:
- handlemsg(hWnd, evBackward10sec);
- break;
- case ID_PLAY:
- handlemsg(hWnd, evPlaySwitchToPause);
- break;
- case ID_STOP:
- handlemsg(hWnd, evStop);
- break;
- case ID_SEEKF:
- handlemsg(hWnd, evForward10sec);
- break;
- case ID_NTRACK:
- handlemsg(hWnd, evNext);
- break;
-#ifdef CONFIG_DVDREAD
- case ID_CHAPTERSEL:
- display_chapterselwindow(gui);
- break;
-#endif
- case ID_FULLSCREEN:
- mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
- break;
- case ID_MUTE:
- mp_input_queue_cmd(mp_input_parse_cmd("mute"));
- break;
- case ID_ASPECT1:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.777777"));
- break;
- case ID_ASPECT2:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.333333"));
- break;
- case ID_ASPECT3:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 2.35"));
- break;
- case ID_ASPECT4:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 0"));
- break;
- case IDSUB_TOGGLE:
- mp_input_queue_cmd(mp_input_parse_cmd("sub_visibility"));
- break;
- case IDSUB_CYCLE:
- mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
- break;
- }
- return 0;
- }
- case WM_CHAR:
- mplayer_put_key(wParam);
- break;
- case WM_DROPFILES:
- {
- if(!lParam)
- {
- char file[MAX_PATH];
- int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
- int i;
- for(i=0; i<filecount; i++)
- {
- DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
- mplSetFileName(NULL, file, STREAMTYPE_FILE);
- if(!parse_filename(file, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
- }
- DragFinish((HDROP) wParam);
- handlemsg(hWnd, evDropFile);
- }
- else
- {
- gui->playlist->clear_playlist(gui->playlist);
- gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
- handlemsg(hWnd, evDropFile);
- }
- SetForegroundWindow(gui->subwindow);
- return 0;
- }
- case WM_LBUTTONDOWN:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN0);
- break;
- }
- case WM_MBUTTONDOWN:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN1);
- break;
- }
- case WM_RBUTTONDOWN:
- {
- POINT point;
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- if(guiIntfStruct.StreamType == STREAMTYPE_DVD)
- EnableMenuItem(gui->dvdmenu, ID_CHAPTERSEL, MF_BYCOMMAND | MF_ENABLED);
- TrackPopupMenu(gui->submenu, 0, point.x, point.y, 0, hWnd, NULL);
- return 0;
- }
- case WM_LBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN0_DBL);
- break;
- }
- case WM_MBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN1_DBL);
- break;
- }
- case WM_RBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN2_DBL);
- break;
- }
- case WM_MOUSEWHEEL:
- {
- int x = GET_WHEEL_DELTA_WPARAM(wParam);
- if(vo_nomouse_input)
- break;
- if (x > 0)
- mplayer_put_key(MOUSE_BTN3);
- else
- mplayer_put_key(MOUSE_BTN4);
- break;
- }
- case WM_XBUTTONDOWN:
- {
- if(vo_nomouse_input)
- break;
- if(HIWORD(wParam) == 1)
- mplayer_put_key(MOUSE_BTN5);
- else
- mplayer_put_key(MOUSE_BTN6);
- break;
- }
- case WM_XBUTTONDBLCLK:
- {
- if(vo_nomouse_input)
- break;
- if(HIWORD(wParam) == 1)
- mplayer_put_key(MOUSE_BTN5_DBL);
- else
- mplayer_put_key(MOUSE_BTN6_DBL);
- break;
- }
- case WM_TIMER:
- {
- if(fullscreen) while(ShowCursor(FALSE) >= 0){}
- KillTimer(hWnd, ID_TIMER);
- return 0;
- }
- case WM_MOUSEMOVE:
- {
- ShowCursor(TRUE);
- SetTimer(hWnd, ID_TIMER, 3000, (TIMERPROC) NULL);
- break;
- }
- case WM_WINDOWPOSCHANGED:
- {
- int tmpheight=0;
- static uint32_t rect_width;
- static uint32_t rect_height;
- RECT rd;
- POINT pt;
- pt.x = 0;
- pt.y = 0;
- GetClientRect(hWnd, &rd);
- ClientToScreen(hWnd, &pt);
-
- rect_width = rd.right - rd.left;
- rect_height = rd.bottom - rd.top;
-
- /* maintain our aspect ratio */
- tmpheight = ((float)rect_width/sub_aspect);
- tmpheight += tmpheight % 2;
- if(tmpheight > rect_height)
- {
- rect_width = ((float)rect_height*sub_aspect);
- rect_width += rect_width % 2;
- }
- else rect_height = tmpheight;
-
- rd.right = rd.left + rect_width;
- rd.bottom = rd.top + rect_height;
-
- AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
- SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,
- fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, SWP_NOOWNERZORDER);
- SetForegroundWindow(hWnd);
- return 0;
- }
- case WM_SYSCOMMAND:
- {
- switch(wParam)
- {
- case SC_SCREENSAVE:
- case SC_MONITORPOWER:
- mp_msg(MSGT_VO, MSGL_V ,"<vo_directx><INFO>killing screensaver\n" );
- return 0;
- }
- break;
- }
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- RECT rect;
- HDC hdc = BeginPaint(hWnd, &ps);
- HDC hMemDC = CreateCompatibleDC(hdc);
- HBRUSH blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
- int width, height;
- GetClientRect(hWnd, &rect);
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
- if(guiIntfStruct.Playing == 0)
- {
- int i;
- window *desc = NULL;
-
- for (i=0; i<gui->skin->windowcount; i++)
- if(gui->skin->windows[i]->type == wiSub)
- desc = gui->skin->windows[i];
-
- SelectObject(hMemDC, get_bitmap(hWnd));
- StretchBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, desc->base->bitmap[0]->width,
- desc->base->bitmap[0]->height, SRCCOPY);
- } else {
- FillRect(GetDC(hWnd), &rect, fullscreen?blackbrush:colorbrush);
- }
- DeleteDC(hMemDC);
- EndPaint(hWnd, &ps);
- return 0;
- }
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-/* Window Proc for the gui Window */
-static LRESULT CALLBACK EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
-
- /* Avoid processing when then window doesn't match gui mainwindow */
- if (gui && (gui->mainwindow != hWnd)) return FALSE;
-
- switch (message)
- {
- case WM_CLOSE:
- handlemsg(hWnd, evExit);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- case WM_SYSTRAY:
- {
- switch(lParam)
- {
- POINT cursor;
- case WM_RBUTTONDOWN:
- {
- GetCursorPos(&cursor);
- SetForegroundWindow(hWnd);
- TrackPopupMenu(gui->traymenu, 0, cursor.x, cursor.y, 0, hWnd, NULL);
- break;
- }
- case WM_MBUTTONDBLCLK:
- case WM_LBUTTONDBLCLK:
- {
- if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);
- else { ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); }
- break;
- }
- }
- break;
- }
- case WM_KEYDOWN:
- {
- switch(wParam)
- {
- case VK_LEFT:
- mplayer_put_key(KEY_LEFT);
- break;
- case VK_UP:
- mplayer_put_key(KEY_UP);
- break;
- case VK_RIGHT:
- mplayer_put_key(KEY_RIGHT);
- break;
- case VK_DOWN:
- mplayer_put_key(KEY_DOWN);
- break;
- case VK_TAB:
- mplayer_put_key(KEY_TAB);
- break;
- case VK_BACK:
- mplayer_put_key(KEY_BS);
- break;
- case VK_DELETE:
- mplayer_put_key(KEY_DELETE);
- break;
- case VK_INSERT:
- mplayer_put_key(KEY_INSERT);
- break;
- case VK_HOME:
- mplayer_put_key(KEY_HOME);
- break;
- case VK_END:
- mplayer_put_key(KEY_END);
- break;
- case VK_PRIOR:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case VK_NEXT:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- case VK_ESCAPE:
- mplayer_put_key(KEY_ESC);
- break;
- }
- break;
- }
- case WM_CHAR:
- mplayer_put_key(wParam);
- break;
- case WM_COPYDATA:
- {
- if(lParam)
- {
- PCOPYDATASTRUCT cdData;
- cdData = (PCOPYDATASTRUCT) lParam;
- mplSetFileName(NULL, cdData->lpData, STREAMTYPE_FILE);
- if(!parse_filename(cdData->lpData, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, cdData->lpData, NULL, NULL, 0);
- gui->startplay(gui);
- }
- break;
- }
- case WM_DROPFILES:
- {
- if(!lParam)
- {
- char file[MAX_PATH];
- int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
- int i;
- for(i=0; i<filecount; i++)
- {
- DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
- mplSetFileName(NULL, file, STREAMTYPE_FILE);
- if(!parse_filename(file, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
- }
- DragFinish((HDROP) wParam);
- handlemsg(hWnd, evDropFile);
- }
- else
- {
- gui->playlist->clear_playlist(gui->playlist);
- gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
- handlemsg(hWnd, evDropFile);
- }
- SetForegroundWindow(gui->mainwindow);
- return 0;
- }
- case WM_LBUTTONDOWN:
- {
- SetCapture(hWnd);
- gui->mousex = GET_X_LPARAM(lParam);
- gui->mousey = GET_Y_LPARAM(lParam);
- /* inside a widget */
- gui->activewidget = clickedinsidewidget(gui, get_windowtype(hWnd), gui->mousex, gui->mousey);
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 1;
- gui->mousewx = gui->mousex - gui->activewidget->x;
- gui->mousewy = gui->mousey - gui->activewidget->y;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 0);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- handlemsg(hWnd, gui->activewidget->msg);
- }
- break;
- }
- case WM_CAPTURECHANGED:
- {
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 0;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- gui->activewidget = NULL;
- }
- break;
- }
- case WM_LBUTTONUP:
- {
- ReleaseCapture();
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 0;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- gui->activewidget = NULL;
- }
- break;
- }
- case WM_RBUTTONDOWN:
- {
- POINT point;
- char device[MAX_PATH];
- char searchpath[MAX_PATH];
- char searchpath2[MAX_PATH];
-#ifdef CONFIG_LIBCDIO
- char searchpath3[MAX_PATH];
-#endif
- int len, pos = 0, cdromdrive = 0;
- UINT errmode;
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- errmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- while (GetMenuItemCount(gui->diskmenu) > 0)
- DeleteMenu(gui->diskmenu, 0, MF_BYPOSITION);
- len = GetLogicalDriveStrings(MAX_PATH, device);
- while(pos < len)
- {
- if(GetDriveType(device + pos) == DRIVE_CDROM)
- {
- char volname[MAX_PATH];
- char menuitem[MAX_PATH];
- int flags = MF_STRING;
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
- sprintf(searchpath, "%sVIDEO_TS", device + pos);
- sprintf(searchpath2, "%sMpegav", device + pos);
-#ifdef CONFIG_LIBCDIO
- sprintf(searchpath3, "%sTrack01.cda", device + pos);
-#endif
- if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
- else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
-#ifdef CONFIG_LIBCDIO
- else if(GetFileAttributes(searchpath3) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
-#endif
- else
- flags |= MF_GRAYED;
- volname[0] = 0;
- strcpy(menuitem, device + pos);
- menuitem[strlen(menuitem) - 1]=0;
- GetVolumeInformation(device + pos, volname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
- if (strlen(volname))
- {
- capitalize(volname);
- strcat(menuitem, " - ");
- strcat(menuitem, volname);
- }
- AppendMenu(gui->diskmenu, flags, IDPLAYDISK + cdromdrive, menuitem);
- cdromdrive++;
- }
- pos += strlen(device + pos) + 1;
- }
- SetErrorMode(errmode);
- TrackPopupMenu(gui->menu, 0, point.x, point.y, 0, hWnd, NULL);
- return 0;
- }
- case WM_MOUSEMOVE:
- {
- if(wParam & MK_LBUTTON)
- {
- POINT point;
- RECT rect;
- if(gui->activewidget)
- {
- widget *item = gui->activewidget;
-
- if(item->type == tyHpotmeter)
- {
- item->x = GET_X_LPARAM(lParam) - gui->mousewx;
- item->value = (float)((float)((item->x - item->wx) * 100.0f) / (float)(item->wwidth - item->width));
- }
- if(item->type == tyPotmeter)
- {
- gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
- item->value = (float) (gui->mousewx * 100.0f) / (float) item->wwidth;
- }
-
- if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
- {
- /* Bound checks */
- if(item->value > 100.0f)
- item->value = 100.0f;
- else if(item->value < 0.0f)
- item->value = 0.0f;
-
- if(item->msg == evSetVolume)
- guiIntfStruct.Volume = (float) item->value;
- else if(item->msg == evSetMoviePosition)
- guiIntfStruct.Position = (float) item->value;
- else if(item->msg == evSetBalance)
- {
- /* make the range for 50% a bit bigger, because the sliders for balance usually suck */
- if((item->value - 50.0f < 1.5f) && (item->value - 50.0f > -1.5f))
- item->value = 50.0f;
- guiIntfStruct.Balance = (float) item->value;
- }
- updatedisplay(gui, hWnd);
- handlemsg(hWnd, item->msg);
- }
- break;
- }
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- GetWindowRect(hWnd, &rect);
- MoveWindow(hWnd, point.x - gui->mousex, point.y - gui->mousey,
- rect.right-rect.left,rect.bottom-rect.top,TRUE);
- break;
- }
- break;
- }
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDEXIT:
- PostQuitMessage(0);
- handlemsg(hWnd, evExit);
- break;
- case IDFILE_OPEN:
- handlemsg(hWnd, evLoadPlay);
- break;
- case IDDIR_OPEN:
- {
- static char path[MAX_PATH];
- BROWSEINFO bi;
- LPITEMIDLIST pidl;
- memset(&bi, 0, sizeof(BROWSEINFO));
- bi.lpszTitle = "Choose a Directory...";
- pidl = SHBrowseForFolder(&bi);
- if (SHGetPathFromIDList(pidl, path))
- {
- gui->playlist->clear_playlist(gui->playlist);
- adddirtoplaylist(gui->playlist, path, TRUE);
- gui->startplay(gui);
- }
- break;
- }
- case ID_SKINBROWSER:
- handlemsg(hWnd, evSkinBrowser);
- break;
- case IDURL_OPEN:
- display_openurlwindow(gui, 0);
- break;
- case ID_MUTE:
- mp_input_queue_cmd(mp_input_parse_cmd("mute"));
- break;
- case IDSUBTITLE_OPEN:
- display_opensubtitlewindow(gui);
- break;
-