mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 09:29:29 +00:00
Initial win32 gui release.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18919 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c5cf04f543
commit
4aa477ef2c
317
Gui/win32/Changelog
Normal file
317
Gui/win32/Changelog
Normal file
@ -0,0 +1,317 @@
|
||||
HISTORY
|
||||
2006/06/30 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed display of wrong aspect ratios.
|
||||
|
||||
2006/06/13 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Minor bugfixes.
|
||||
- Updated to current SVN
|
||||
|
||||
2006/04/14 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a crash bug.
|
||||
- Fixed a major fullscreen bug (WinID wasn't getting
|
||||
reset when FS switching).
|
||||
|
||||
2006/04/13 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- More minor fixups
|
||||
|
||||
2006/04/07 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Minor fixups to openurl and openfile from dialogs.c
|
||||
|
||||
2006/04/06 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed IPC and drag&drop appending files to the
|
||||
playlist instead of opening them right away.
|
||||
- Updated dvdnav patch.
|
||||
|
||||
2006/04/03 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a long pathnames issue with WM_COPYDATA.
|
||||
- Fixed a minor crash happening when rendering the
|
||||
codec name.
|
||||
- Some code cleanup.
|
||||
|
||||
2006/04/01 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added ability to enable/disable videos displaying
|
||||
in the sub window in preferences.
|
||||
- Small fix in update_subwindow() for coming out
|
||||
of fullscreen when the sub window was minimized.
|
||||
|
||||
2006/03/27 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Updated to current CVS.
|
||||
- Debug console now shows the extensions mplayer
|
||||
was compiled with.
|
||||
|
||||
2006/03/23 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed using -playlist and -shuffle.
|
||||
|
||||
2006/03/22 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a small bug with input events for dialogs.
|
||||
|
||||
2006/03/16 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed left button mouse event in dvdnav patch.
|
||||
- More aspect fixes.
|
||||
- Fixed double-click in the playlist.
|
||||
- Fixed some drag&drop functionality.
|
||||
|
||||
2006/03/14 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Simplified title/chapter selection dialog.
|
||||
- Code cleanup.
|
||||
|
||||
2006/03/14 - Erik Augustson <erik_27can@yahoo.com>
|
||||
|
||||
- Fixed resetting aspect on file ending in mplEnd()
|
||||
|
||||
2006/03/13 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed double click events, forgot to add CS_DBLCLKS
|
||||
to sub window's window style.
|
||||
- Fixed window focusing with drag&drop files.
|
||||
- Re-arranged some menu items, and added support for
|
||||
runtime aspect switching. This adds 3 lines to
|
||||
mplayer.c but is well worth it IMO.
|
||||
|
||||
2006/03/12 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed window positioning for both windows.
|
||||
- Added more mouse button events.
|
||||
|
||||
2006/03/10 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed mouse and sub window vanishing after coming
|
||||
out of fullscreen by end of file.
|
||||
- Fixed sub window popping up when switching to
|
||||
fullscreen and *not* using directx.
|
||||
- Added codec name to widgets to properly render
|
||||
in some skins.
|
||||
- Middle and scroll wheel mouse event should work
|
||||
now on the sub window.
|
||||
- #ifdef'd USE_DVDREAD to allow for compilation
|
||||
when disabling mpdvdkit.
|
||||
- Updated license information.
|
||||
|
||||
2006/03/08 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Removed unnecessary playerinfo struct
|
||||
- Fixed movies playing at wrong aspects
|
||||
- Minor bugfixes all around
|
||||
|
||||
2006/03/07 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed some skin labels not displaying properly
|
||||
|
||||
2006/03/06 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Temporaly fix crash if no vo_driver is specified
|
||||
(interface.c:877)
|
||||
|
||||
2006/02/28 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added sub window. The sub window is the WinID
|
||||
(-wid) when using the directx vo. The sub window
|
||||
hides when the file is audio only, and as well
|
||||
when the vo is not directx, and automatically
|
||||
adjusts and maintains video aspect ratios
|
||||
- Minor fixups
|
||||
- TODO: Get WinID working when using gl2, and add
|
||||
fix for both windows if going out of bounds on
|
||||
right and bottom of screen.
|
||||
|
||||
2006/01/30 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed playing movies from network drives.
|
||||
|
||||
2006/01/27 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a small annoyance when playing a network file
|
||||
with file associations when mplayer wasn't running,
|
||||
using GetLongPathNameA()
|
||||
|
||||
2006/01/15 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added some CD functionality if using libcdio.
|
||||
|
||||
2005/12/02 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fix to disable gui if running in slave mode.
|
||||
|
||||
2005/11/14 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Implemented IPC with WM_COPYDATA to open new
|
||||
files/playlists in the current running mplayer,
|
||||
rather than having a new mplayer process spawn.
|
||||
|
||||
2005/11/12 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Modified evMute to mute/unmute
|
||||
- Mute button should show as pressed when muted
|
||||
- Added evDecVolume and evIncVolume
|
||||
|
||||
2005/11/09 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed screensaver issues
|
||||
|
||||
2005/11/06 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Display fixes
|
||||
|
||||
2005/09/18 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Playlist additions
|
||||
- Minor playlist bugfixes
|
||||
|
||||
2005/09/16 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Code cleanup
|
||||
|
||||
2005/09/05 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Updated to apply to current CVS
|
||||
|
||||
2005/07/27 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added initial evEqualizer for brightness, contrast,
|
||||
hue and saturation of videos.
|
||||
|
||||
2005/07/26 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed double click on playlist
|
||||
- Added support for screenshot video filter, vf_screenshot patch
|
||||
is also needed
|
||||
|
||||
2005/06/19 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Removed -console switch, moved console stuff out of mplayer main,
|
||||
console option is handled in wincfg, it's switchable at runtime
|
||||
from the gui and the state is saved
|
||||
|
||||
2005/06/15 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed bugs with DVD chapter skipping
|
||||
- Title/chapter switching dialog works again :)
|
||||
- Fixed a bug with url's not working after playing a DVD
|
||||
- Removed fullscreen handling from mplayer.c. It's now
|
||||
handled in interface.c
|
||||
- Disabled loading/saving playlists, and adding files/urls
|
||||
while playing a DVD
|
||||
|
||||
2005/06/12 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Added -console cmd line option to bring up a dos console
|
||||
that displays mplayer messages
|
||||
|
||||
2005/06/10 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a bug with the audio filters not loading
|
||||
- Fixed bugs with the audio delay and stereo sliders
|
||||
- Added a few safety checks
|
||||
|
||||
2005/06/08 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added initial evPreferences
|
||||
- Fixed a bug with the load subtitle dialog
|
||||
- Some code cleanup and minor fixes here and there
|
||||
|
||||
2005/06/02 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Fixed a bug with pathnames in the open url dialog
|
||||
|
||||
2005/05/26 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added "Add file" and "Add url" menu to the playlist
|
||||
- Fixed file skipping when double-clicking playlist entries
|
||||
|
||||
2005/05/19 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- added simple url history
|
||||
|
||||
2005/05/12 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- added load and save playlists options
|
||||
- fixed opening remote m3u and pls files in open url
|
||||
- no problems so far with evprev and evnext :)
|
||||
|
||||
2005/05/10 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- more evNext and evPrev fixes
|
||||
|
||||
2005/05/06 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- implemented mplEnd() for proper looping fix
|
||||
- fixed bugs in evNext and evPrev
|
||||
- re-organized the menus
|
||||
|
||||
2005/03/02 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- adapted subtitle patch from Raul <zomps@mail.astar.ee>
|
||||
- readapted endless loop fix to not touch mp_msg.c
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- small fixes, orginal endless loop fix
|
||||
|
||||
2005/02/25 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Fixed exit stuff (I hope ;P)
|
||||
- Fixes to Erik's title/chapter selector
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added additional gui events
|
||||
- Added evPrev and evNext dvd chapter switching
|
||||
|
||||
2005/02/23 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- added dvd title/chapter switching
|
||||
|
||||
2005/02/20 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- fixed dvd stop and play
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- imported some stuff from unix gui
|
||||
- fixed file play after dvd
|
||||
|
||||
2005/02/18 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- addons for dvd playing
|
||||
|
||||
2005/02/16 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- renamed README to README.txt
|
||||
- retain window position even when switching the skin
|
||||
- converted all opendir calls to native win32 calls
|
||||
- adding filename as title without directory for all calls
|
||||
- more cleanups in skinloader/unloader
|
||||
- removed a lot of warnings
|
||||
- removed unused includes
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- added online help menu
|
||||
|
||||
2005/02/15 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Disabled access to gui when gui->mainwindow doesn't match hwnd passed to windproc
|
||||
- Fixed save position for main window gui
|
||||
- Cleanups in skinloader/unloader
|
||||
Erik Augustson erik_27can@yahoo.com
|
||||
- Added saving main window position to gui config
|
||||
- Fixes on playlist for vcd
|
||||
|
||||
2005/02/13 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Fixed multithreaded (I hope ;P)
|
||||
- Skinbrowser window is closed when a skin is changed, this prevents crashes if multiple clicks
|
||||
- Playlist window is updated if files are added while playlist is visible
|
||||
- Removed patch on mplayer.rc, take icon using the included routine
|
||||
- SkinBrowser and Playlist dialogs can be opened/closed by clicking multiple times gui buttons
|
||||
- Added support for DVD, stop dvd + play is broken ;(
|
||||
- ifdef-ed a lot of debug stuff
|
||||
- Fixed systray icon removing
|
||||
- Added Erik and me to about dialog ;)
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added key handling for the gui window
|
||||
- Small fixes on tray icon stuff
|
||||
|
||||
2005/02/11 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- fixed sliders, balance is not 100% working, anyway dsound output driver doesn't support balanced audio
|
||||
- remade threaded
|
||||
- removed demuxer/avi patches, really needed ??
|
||||
- added a fake vo_init if opengl is not enabled
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- fixes on traymenu play
|
||||
- added a base configuration reader/writer - only support for skin selection for now
|
||||
|
||||
2005/02/10 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- fixed (workarounded) the NULL filename bug
|
||||
- moved add directory directly into gui.c
|
||||
- it starts to be usable :)
|
||||
Erik Augustson <erik_27can@yahoo.com>
|
||||
- Added systray support
|
||||
- Added skin browser option to menu (some skins don't show a skin browser button)
|
||||
|
||||
2005/02/09 - Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
- Fixed window disappearing bug
|
||||
- Made a patch compatible with current tree
|
||||
- Fixed icons in minor dialogs
|
||||
- Major cleanup and code reorganization
|
||||
|
||||
2005/02/08 - Erik Augustson <erik_27can@yahoo.com>
|
||||
- Removed multi-threading, mplayer now runs in a single thread
|
||||
- Play directory now works as intended
|
||||
- Added a Skin browser, double-click skin names to switch skins
|
||||
- Still more things todo
|
||||
|
||||
pre4
|
||||
- URL open
|
||||
- use windows native menus
|
||||
- Gui runs in a seperate thread now because some controls interupt playback :(
|
||||
|
||||
pre 3
|
||||
- some of the previous features broken again
|
||||
- full font loading/display support
|
||||
- better integration into mplayer
|
||||
- seek bar, balance, volume control work
|
||||
|
||||
pre 2
|
||||
- playlist
|
||||
- Drag 'N Drop support
|
||||
- fixed segfault when no skinfile found
|
||||
|
||||
pre 1
|
||||
- initial revision
|
||||
- play/pause works
|
||||
- loads "blue" skin
|
||||
- still lot of things todo
|
17
Gui/win32/README
Normal file
17
Gui/win32/README
Normal file
@ -0,0 +1,17 @@
|
||||
MPlayer Windows GUI (c)
|
||||
2003 Sascha Sommer - <saschasommer@freenet.de>
|
||||
2006 Erik Augustson - <erik_27can@yahoo.com>
|
||||
2006 Gianluigi Tiesi - <sherpya@netfarm.it>
|
||||
|
||||
This beta gui for win32 was originally written by Sascha Sommer and
|
||||
has since been heavily modified by myself (Erik Augustson) and Gianluigi
|
||||
Tiesi. It follows the same concept for the linux gui, and should be
|
||||
able to load all(most) of the current skins available for the linux gui.
|
||||
|
||||
To compile, quite simply pass --enable-gui to configure, and it is highly
|
||||
recommended to also pass --enable-static="-mwindows" to link mplayer as
|
||||
a windows binary. NOTE: this will also link mencoder with -mwindows
|
||||
and thus link mencoder as a windows binary as well.
|
||||
|
||||
Please send all bug reports/comments/requests/gripes to:
|
||||
<erik_27can@yahoo.com>
|
1142
Gui/win32/dialogs.c
Normal file
1142
Gui/win32/dialogs.c
Normal file
File diff suppressed because it is too large
Load Diff
129
Gui/win32/dialogs.h
Normal file
129
Gui/win32/dialogs.h
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _DIALOGS_H
|
||||
#define _DIALOGS_H
|
||||
|
||||
#define TBS_TOOLTIPS 0x0100
|
||||
#define WM_SYSTRAY (WM_USER+1)
|
||||
#define UDM_SETRANGE32 (WM_USER+111)
|
||||
#define UDM_GETRANGE32 (WM_USER+112)
|
||||
#define UDM_SETPOS32 (WM_USER+113)
|
||||
#define UDM_GETPOS32 (WM_USER+114)
|
||||
|
||||
#define SOLID_GREY (HBRUSH) CreateSolidBrush(RGB(232, 232, 232))
|
||||
#define SOLID_GREY2 (HBRUSH) CreateSolidBrush(RGB(175, 175, 175))
|
||||
|
||||
#define gfree free
|
||||
|
||||
#define MAXFILE 1024
|
||||
|
||||
#define COPYRIGHT " MPlayer GUI for Windows\n\n" \
|
||||
" Copyright (c) 2003 Sascha Sommer\n" \
|
||||
" Copyright (c) 2006 Erik Augustson\n" \
|
||||
" Copyright (c) 2006 Gianluigi Tiesi"
|
||||
|
||||
#define ONLINE_HELP_URL "http://www.mplayerhq.hu/DOCS/HTML/en/index.html"
|
||||
|
||||
#define ID_OK 12
|
||||
#define ID_APPLY 13
|
||||
#define ID_CANCEL 14
|
||||
#define ID_CLOSE 15
|
||||
#define ID_DEFAULTS 16
|
||||
#define ID_VO_DRIVER 17
|
||||
#define ID_AO_DRIVER 18
|
||||
#define ID_DOUBLE 19
|
||||
#define ID_DIRECT 20
|
||||
#define ID_FRAMEDROP 21
|
||||
#define ID_NORMALIZE 22
|
||||
#define ID_SOFTMIX 23
|
||||
#define ID_EXTRASTEREO 24
|
||||
#define ID_TRACKBAR1 25
|
||||
#define ID_TRACKBAR2 26
|
||||
#define ID_UPDOWN1 27
|
||||
#define ID_UPDOWN2 28
|
||||
#define ID_EDIT1 29
|
||||
#define ID_EDIT2 30
|
||||
#define ID_CACHE 31
|
||||
#define ID_AUTOSYNC 32
|
||||
#define ID_NONE 33
|
||||
#define ID_OSD1 34
|
||||
#define ID_OSD2 35
|
||||
#define ID_OSD3 36
|
||||
#define ID_DVDDEVICE 37
|
||||
#define ID_CDDEVICE 38
|
||||
#define ID_PRIO 39
|
||||
#define ID_URL 40
|
||||
#define ID_TITLESEL 41
|
||||
#define ID_UP 42
|
||||
#define ID_DOWN 43
|
||||
#define ID_REMOVE 44
|
||||
#define ID_ADDFILE 45
|
||||
#define ID_TRACKLIST 46
|
||||
#define ID_SUBTITLE 47
|
||||
#define ID_PLAYLISTLOAD 48
|
||||
#define ID_PLAYLISTSAVE 49
|
||||
#define ID_ADDURL 50
|
||||
#define ID_DIR 51
|
||||
#define ID_PLAY 52
|
||||
#define ID_STOP 53
|
||||
#define ID_SEEKF 54
|
||||
#define ID_SEEKB 55
|
||||
#define ID_NTRACK 56
|
||||
#define ID_PTRACK 57
|
||||
#define ID_PLAYLIST 58
|
||||
#define ID_CLEAR 59
|
||||
#define ID_SHOWHIDE 60
|
||||
#define ID_SKINBROWSER 61
|
||||
#define ID_KEYHELP 62
|
||||
#define ID_ONLINEHELP 63
|
||||
#define ID_CHAPTERSEL 64
|
||||
#define ID_PREFS 65
|
||||
#define TRAYMENU 66
|
||||
#define IDFILE_OPEN 67
|
||||
#define IDEXIT 68
|
||||
#define IDURL_OPEN 69
|
||||
#define IDDIR_OPEN 70
|
||||
#define IDFILE_NEW 71
|
||||
#define IDFILE_SAVE 72
|
||||
#define IDHELP_ABOUT 73
|
||||
#define IDSUBTITLE_OPEN 74
|
||||
#define IDPLAYDISK 75
|
||||
#define ID_CONSOLE 76
|
||||
#define ID_EQ0 77
|
||||
#define ID_EQ1 78
|
||||
#define ID_EQ2 79
|
||||
#define ID_EQ3 80
|
||||
#define IDSUB_TOGGLE 81
|
||||
#define IDSUB_CYCLE 82
|
||||
#define ID_ASPECT1 83
|
||||
#define ID_ASPECT2 84
|
||||
#define ID_ASPECT3 85
|
||||
#define ID_ASPECT4 86
|
||||
#define ID_SUBWINDOW 87
|
||||
|
||||
/* gtk emulation */
|
||||
#define GTK_MB_FATAL 0x1
|
||||
#define GTK_MB_ERROR 0x2
|
||||
#define GTK_MB_WARNING 0x4
|
||||
#define GTK_MB_SIMPLE 0x8
|
||||
|
||||
#endif
|
1555
Gui/win32/gui.c
Normal file
1555
Gui/win32/gui.c
Normal file
File diff suppressed because it is too large
Load Diff
118
Gui/win32/gui.h
Normal file
118
Gui/win32/gui.h
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _GUI_H
|
||||
#define _GUI_H
|
||||
#include <config.h>
|
||||
#include <playtree.h>
|
||||
#include <m_config.h>
|
||||
#include "skinload.h"
|
||||
#include "playlist.h"
|
||||
|
||||
extern char *skinName;
|
||||
extern float sub_aspect;
|
||||
extern play_tree_t* playtree;
|
||||
extern m_config_t* mconfig;
|
||||
|
||||
extern NOTIFYICONDATA nid;
|
||||
|
||||
typedef struct window_priv_t window_priv_t;
|
||||
struct window_priv_t
|
||||
{
|
||||
HWND hwnd;
|
||||
image img;
|
||||
image *background;
|
||||
HBITMAP bitmap;
|
||||
int type;
|
||||
};
|
||||
|
||||
typedef struct gui_t gui_t;
|
||||
struct gui_t
|
||||
{
|
||||
/* screenproperties */
|
||||
int screenw, screenh, screenbpp;
|
||||
/* window related stuff */
|
||||
char *classname;
|
||||
HICON icon;
|
||||
unsigned int window_priv_count;
|
||||
window_priv_t **window_priv;
|
||||
|
||||
HWND mainwindow;
|
||||
HWND subwindow;
|
||||
|
||||
/* for event handling */
|
||||
widget *activewidget;
|
||||
|
||||
int mousewx, mousewy; /* mousepos inside widget */
|
||||
int mousex, mousey;
|
||||
|
||||
HMENU menu;
|
||||
HMENU diskmenu;
|
||||
HMENU traymenu;
|
||||
HMENU trayplaymenu;
|
||||
HMENU trayplaybackmenu;
|
||||
HMENU submenu;
|
||||
HMENU subtitlemenu;
|
||||
HMENU aspectmenu;
|
||||
HMENU dvdmenu;
|
||||
HMENU playlistmenu;
|
||||
|
||||
int skinbrowserwindow;
|
||||
int playlistwindow;
|
||||
int aboutwindow;
|
||||
|
||||
skin_t *skin;
|
||||
playlist_t *playlist;
|
||||
|
||||
void (*startplay)(gui_t *gui);
|
||||
void (*updatedisplay)(gui_t *gui, HWND hwnd);
|
||||
void (*playercontrol)(int event); /* userdefine call back function */
|
||||
void (*uninit)(gui_t *gui);
|
||||
};
|
||||
|
||||
#define wsShowWindow 8
|
||||
#define wsHideWindow 16
|
||||
#define wsShowFrame 1
|
||||
#define wsMovable 2
|
||||
#define wsSizeable 4
|
||||
|
||||
extern gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event));
|
||||
extern int destroy_window(gui_t *gui);
|
||||
extern int create_window(gui_t *gui, char *skindir);
|
||||
extern int create_subwindow(gui_t *gui, char *skindir);
|
||||
extern int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear);
|
||||
extern void capitalize(char *filename);
|
||||
extern int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config);
|
||||
|
||||
/* Dialogs */
|
||||
extern void display_playlistwindow(gui_t *gui);
|
||||
extern void update_playlistwindow(void);
|
||||
extern int display_openfilewindow(gui_t *gui, int add);
|
||||
extern void display_openurlwindow(gui_t *gui, int add);
|
||||
extern void display_skinbrowser(gui_t *gui);
|
||||
extern void display_chapterselwindow(gui_t *gui);
|
||||
extern void display_eqwindow(gui_t *gui);
|
||||
extern void display_prefswindow(gui_t *gui);
|
||||
#ifdef USE_SUB
|
||||
extern void display_opensubtitlewindow(gui_t *gui);
|
||||
#endif
|
||||
|
||||
#endif
|
975
Gui/win32/interface.c
Normal file
975
Gui/win32/interface.c
Normal file
@ -0,0 +1,975 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <interface.h>
|
||||
#include <m_option.h>
|
||||
#include <mixer.h>
|
||||
#include <mp_msg.h>
|
||||
#include <help_mp.h>
|
||||
#include <codec-cfg.h>
|
||||
#include <libmpdemux/stream.h>
|
||||
#include <libmpdemux/demuxer.h>
|
||||
#include <libmpdemux/stheader.h>
|
||||
#ifdef USE_DVDREAD
|
||||
#include <libmpdemux/stream_dvd.h>
|
||||
#endif
|
||||
#include <input/input.h>
|
||||
#include <libvo/video_out.h>
|
||||
#include <libao2/audio_out.h>
|
||||
#include "gui.h"
|
||||
#include "dialogs.h"
|
||||
#include "wincfg.h"
|
||||
#ifdef HAVE_LIBCDIO
|
||||
#include <cdio/cdio.h>
|
||||
#endif
|
||||
|
||||
extern m_obj_settings_t* vo_plugin_args;
|
||||
extern vo_functions_t *video_out;
|
||||
extern ao_functions_t *audio_out;
|
||||
extern void exit_player(char *how);
|
||||
extern char *filename;
|
||||
extern int abs_seek_pos;
|
||||
extern float rel_seek_secs;
|
||||
extern mixer_t mixer;
|
||||
extern int audio_id;
|
||||
extern int video_id;
|
||||
extern int dvdsub_id;
|
||||
extern int vobsub_id;
|
||||
extern int stream_cache_size;
|
||||
extern int autosync;
|
||||
extern int vcd_track;
|
||||
extern int dvd_title;
|
||||
extern float force_fps;
|
||||
extern af_cfg_t af_cfg;
|
||||
int guiWinID = 0;
|
||||
|
||||
char *skinName = NULL;
|
||||
char *codecname = NULL;
|
||||
int mplGotoTheNext = 1;
|
||||
static gui_t *mygui = NULL;
|
||||
static int update_subwindow(void);
|
||||
|
||||
/* test for playlist files, no need to specify -playlist on the commandline.
|
||||
* add any conceivable playlist extensions here.
|
||||
* - Erik
|
||||
*/
|
||||
int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear)
|
||||
{
|
||||
if(clear)
|
||||
mygui->playlist->clear_playlist(mygui->playlist);
|
||||
|
||||
if(strstr(file, ".m3u") || strstr(file, ".pls"))
|
||||
{
|
||||
playtree = parse_playlist_file(file);
|
||||
import_playtree_playlist_into_gui(playtree, mconfig);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief this actually creates a new list containing only one element...
|
||||
*/
|
||||
void gaddlist( char ***list, char *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (*list)
|
||||
{
|
||||
for (i=0; (*list)[i]; i++) free((*list)[i]);
|
||||
free(*list);
|
||||
}
|
||||
|
||||
*list = malloc(2 * sizeof(char **));
|
||||
(*list)[0] = gstrdup(entry);
|
||||
(*list)[1] = NULL;
|
||||
}
|
||||
|
||||
char *gstrdup(char *str)
|
||||
{
|
||||
if (!str) return NULL;
|
||||
return strdup(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief this replaces a string starting with search by replace.
|
||||
* If not found, replace is appended.
|
||||
*/
|
||||
void greplace(char ***list, char *search, char *replace)
|
||||
{
|
||||
int i = 0;
|
||||
int len = (search) ? strlen(search) : 0;
|
||||
|
||||
if (*list)
|
||||
{
|
||||
for (i = 0; (*list)[i]; i++)
|
||||
{
|
||||
if (search && (!strncmp((*list)[i], search, len)))
|
||||
{
|
||||
free((*list)[i]);
|
||||
(*list)[i] = gstrdup(replace);
|
||||
return;
|
||||
}
|
||||
}
|
||||
*list = realloc(*list, (i + 2) * sizeof(char *));
|
||||
}
|
||||
else
|
||||
*list = malloc(2 * sizeof(char *));
|
||||
|
||||
(*list)[i] = gstrdup(replace);
|
||||
(*list)[i + 1] = NULL;
|
||||
}
|
||||
|
||||
/* this function gets called by the gui to update mplayer */
|
||||
static void guiSetEvent(int event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case evPlay:
|
||||
case evPlaySwitchToPause:
|
||||
mplPlay();
|
||||
break;
|
||||
case evPause:
|
||||
mplPause();
|
||||
break;
|
||||
#ifdef USE_DVDREAD
|
||||
case evPlayDVD:
|
||||
{
|
||||
static char dvdname[MAX_PATH];
|
||||
guiIntfStruct.DVD.current_title = dvd_title;
|
||||
guiIntfStruct.DVD.current_chapter = dvd_chapter;
|
||||
guiIntfStruct.DVD.current_angle = dvd_angle;
|
||||
guiIntfStruct.DiskChanged = 1;
|
||||
|
||||
mplSetFileName(NULL, dvd_device, STREAMTYPE_DVD);
|
||||
guiIntfStruct.Title = guiIntfStruct.DVD.current_title;
|
||||
guiIntfStruct.Chapter = guiIntfStruct.DVD.current_chapter;
|
||||
guiIntfStruct.Angle = guiIntfStruct.DVD.current_angle;
|
||||
|
||||
dvdname[0] = 0;
|
||||
strcat(dvdname, "DVD Movie");
|
||||
GetVolumeInformation(dvd_device, dvdname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
|
||||
capitalize(dvdname);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "Opening DVD %s -> %s\n", dvd_device, dvdname);
|
||||
guiGetEvent(guiSetParameters, (char *) STREAMTYPE_DVD);
|
||||
mygui->playlist->clear_playlist(mygui->playlist);
|
||||
mygui->playlist->add_track(mygui->playlist, filename, NULL, dvdname, 0);
|
||||
mygui->startplay(mygui);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBCDIO
|
||||
case evPlayCD:
|
||||
{
|
||||
int i;
|
||||
char track[10];
|
||||
char trackname[10];
|
||||
CdIo_t *p_cdio = cdio_open(NULL, DRIVER_UNKNOWN);
|
||||
track_t i_tracks;
|
||||
|
||||
if(p_cdio == NULL) printf("Couldn't find a driver.\n");
|
||||
i_tracks = cdio_get_num_tracks(p_cdio);
|
||||
|
||||
mygui->playlist->clear_playlist(mygui->playlist);
|
||||
for(i=0;i<i_tracks;i++)
|
||||
{
|
||||
sprintf(track, "cdda://%d", i+1);
|
||||
sprintf(trackname, "Track %d", i+1);
|
||||
mygui->playlist->add_track(mygui->playlist, track, NULL, trackname, 0);
|
||||
}
|
||||
cdio_destroy(p_cdio);
|
||||
mygui->startplay(mygui);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case evFullScreen:
|
||||
mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
|
||||
break;
|
||||
case evExit:
|
||||
{
|
||||
/* We are asking mplayer to exit, later it will ask us after uninit is made
|
||||
this should be the only safe way to quit */
|
||||
mygui->activewidget = NULL;
|
||||
mp_input_queue_cmd(mp_input_parse_cmd("quit"));
|
||||
break;
|
||||
}
|
||||
case evStop:
|
||||
if(guiIntfStruct.Playing)
|
||||
guiGetEvent(guiCEvent, (void *) guiSetStop);
|
||||
break;
|
||||
case evSetMoviePosition:
|
||||
{
|
||||
rel_seek_secs = guiIntfStruct.Position / 100.0f;
|
||||
abs_seek_pos = 3;
|
||||
break;
|
||||
}
|
||||
case evForward10sec:
|
||||
{
|
||||
rel_seek_secs = 10.0f;
|
||||
abs_seek_pos = 0;
|
||||
break;
|
||||
}
|
||||
case evBackward10sec:
|
||||
{
|
||||
rel_seek_secs = -10.0f;
|
||||
abs_seek_pos = 0;
|
||||
break;
|
||||
}
|
||||
case evSetBalance:
|
||||
case evSetVolume:
|
||||
{
|
||||
float l,r;
|
||||
|
||||
if (guiIntfStruct.Balance == 50.0f)
|
||||
mixer_setvolume(&mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
|
||||
|
||||
l = guiIntfStruct.Volume * ((100.0f - guiIntfStruct.Balance) / 50.0f);
|
||||
r = guiIntfStruct.Volume * ((guiIntfStruct.Balance) / 50.0f);
|
||||
|
||||
if (l > guiIntfStruct.Volume) l=guiIntfStruct.Volume;
|
||||
if (r > guiIntfStruct.Volume) r=guiIntfStruct.Volume;
|
||||
mixer_setvolume(&mixer, l, r);
|
||||
/* Check for balance support on mixer - there is a better way ?? */
|
||||
if (r != l)
|
||||
{
|
||||
mixer_getvolume(&mixer, &l, &r);
|
||||
if (r == l)
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Mixer doesn't support balanced audio\n");
|
||||
mixer_setvolume(&mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
|
||||
guiIntfStruct.Balance = 50.0f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case evMute:
|
||||
{
|
||||
mp_cmd_t * cmd = (mp_cmd_t *)calloc(1, sizeof(*cmd));
|
||||
cmd->id=MP_CMD_MUTE;
|
||||
cmd->name=strdup("mute");
|
||||
mp_input_queue_cmd(cmd);
|
||||
break;
|
||||
}
|
||||
case evDropFile:
|
||||
case evLoadPlay:
|
||||
{
|
||||
mplSetFileName(NULL, filename, STREAMTYPE_FILE);
|
||||
guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
|
||||
update_playlistwindow();
|
||||
guiGetEvent(guiCEvent, (void *) guiSetStop);
|
||||
guiGetEvent(guiCEvent, (void *) guiSetPlay);
|
||||
break;
|
||||
}
|
||||
case evNext:
|
||||
mplNext();
|
||||
break;
|
||||
case evPrev:
|
||||
mplPrev();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void mplPlay( void )
|
||||
{
|
||||
if((!guiIntfStruct.Filename ) || (guiIntfStruct.Filename[0] == 0))
|
||||
return;
|
||||
|
||||
if(guiIntfStruct.Playing > 0)
|
||||
{
|
||||
mplPause();
|
||||
return;
|
||||
}
|
||||
guiIntfStruct.NewPlay = 1;
|
||||
guiGetEvent(guiCEvent, (void *) guiSetPlay);
|
||||
}
|
||||
|
||||
void mplPause( void )
|
||||
{
|
||||
if(!guiIntfStruct.Playing) return;
|
||||
|
||||
if(guiIntfStruct.Playing == 1)
|
||||
{
|
||||
mp_cmd_t * cmd = (mp_cmd_t *)calloc(1, sizeof(*cmd));
|
||||
cmd->id=MP_CMD_PAUSE;
|
||||
cmd->name=strdup("pause");
|
||||
mp_input_queue_cmd(cmd);
|
||||
} else guiIntfStruct.Playing = 1;
|
||||
}
|
||||
|
||||
void mplNext(void)
|
||||
{
|
||||
if(guiIntfStruct.Playing == 2) return;
|
||||
switch(guiIntfStruct.StreamType)
|
||||
{
|
||||
#ifdef USE_DVDREAD
|
||||
case STREAMTYPE_DVD:
|
||||
if(guiIntfStruct.DVD.current_chapter == (guiIntfStruct.DVD.chapters - 1))
|
||||
return;
|
||||
guiIntfStruct.DVD.current_chapter++;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if(mygui->playlist->current == (mygui->playlist->trackcount - 1))
|
||||
return;
|
||||
mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename,
|
||||
STREAMTYPE_STREAM);
|
||||
break;
|
||||
}
|
||||
mplGotoTheNext = 0;
|
||||
mygui->startplay(mygui);
|
||||
}
|
||||
|
||||
void mplPrev(void)
|
||||
{
|
||||
if(guiIntfStruct.Playing == 2) return;
|
||||
switch(guiIntfStruct.StreamType)
|
||||
{
|
||||
#ifdef USE_DVDREAD
|
||||
case STREAMTYPE_DVD:
|
||||
if(guiIntfStruct.DVD.current_chapter == 1)
|
||||
return;
|
||||
guiIntfStruct.DVD.current_chapter--;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if(mygui->playlist->current == 0)
|
||||
return;
|
||||
mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)--]->filename,
|
||||
STREAMTYPE_STREAM);
|
||||
break;
|
||||
}
|
||||
mplGotoTheNext = 0;
|
||||
mygui->startplay(mygui);
|
||||
}
|
||||
|
||||
void mplEnd( void )
|
||||
{
|
||||
if(!mplGotoTheNext && guiIntfStruct.Playing)
|
||||
{
|
||||
mplGotoTheNext = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(mplGotoTheNext && guiIntfStruct.Playing &&
|
||||
(mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
|
||||
guiIntfStruct.StreamType != STREAMTYPE_DVD &&
|
||||
guiIntfStruct.StreamType != STREAMTYPE_DVDNAV)
|
||||
{
|
||||
/* we've finished this file, reset the aspect */
|
||||
if(movie_aspect >= 0)
|
||||
movie_aspect = -1;
|
||||
|
||||
mplGotoTheNext = guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
|
||||
mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
|
||||
//sprintf(guiIntfStruct.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
|
||||
}
|
||||
|
||||
if(guiIntfStruct.FilenameChanged && guiIntfStruct.NewPlay)
|
||||
return;
|
||||
|
||||
guiIntfStruct.TimeSec = 0;
|
||||
guiIntfStruct.Position = 0;
|
||||
guiIntfStruct.AudioType = 0;
|
||||
|
||||
#ifdef USE_DVDREAD
|
||||
guiIntfStruct.DVD.current_title = 1;
|
||||
guiIntfStruct.DVD.current_chapter = 1;
|
||||
guiIntfStruct.DVD.current_angle = 1;
|
||||
#endif
|
||||
|
||||
if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
|
||||
mygui->playlist->current = 0;
|
||||
|
||||
guiGetEvent(guiCEvent, (void *) guiSetStop);
|
||||
}
|
||||
|
||||
void mplSetFileName(char *dir, char *name, int type)
|
||||
{
|
||||
if(!name) return;
|
||||
if(!dir)
|
||||
guiSetFilename(guiIntfStruct.Filename, name)
|
||||
else
|
||||
guiSetDF(guiIntfStruct.Filename, dir, name);
|
||||
|
||||
guiIntfStruct.StreamType = type;
|
||||
free((void **) &guiIntfStruct.AudioFile);
|
||||
free((void **) &guiIntfStruct.Subtitlename);
|
||||
}
|
||||
|
||||
static DWORD WINAPI GuiThread(void)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
if(!skinName) skinName = strdup("Blue");
|
||||
if(!mygui) mygui = create_gui(get_path("skins"), skinName, guiSetEvent);
|
||||
if(!mygui) exit_player("Unable to load gui");
|
||||
|
||||
if(autosync && autosync != gtkAutoSync)
|
||||
{
|
||||
gtkAutoSyncOn = 1;
|
||||
gtkAutoSync = autosync;
|
||||
}
|
||||
|
||||
while(mygui)
|
||||
{
|
||||
GetMessage(&msg, NULL, 0, 0);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
fprintf(stderr, "[GUI] Gui Thread Terminated\n");
|
||||
fflush(stderr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void guiInit(void)
|
||||
{
|
||||
memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
|
||||
/* Create The gui thread */
|
||||
if (!mygui)
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n",
|
||||
(int) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, NULL));
|
||||
|
||||
/* Wait until the gui is created */
|
||||
while(!mygui) Sleep(100);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Gui Thread started\n");
|
||||
}
|
||||
|
||||
void guiDone(void)
|
||||
{
|
||||
if(mygui)
|
||||
{
|
||||
fprintf(stderr, "[GUI] Closed by main mplayer window\n");
|
||||
fflush(stderr);
|
||||
mygui->uninit(mygui);
|
||||
free(mygui);
|
||||
TerminateThread(GuiThread, 0);
|
||||
mygui = NULL;
|
||||
}
|
||||
/* Remove tray icon */
|
||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
||||
cfg_write();
|
||||
}
|
||||
|
||||
static void add_vop(char * str)
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_AddingVideoFilter, str);
|
||||
if (vo_plugin_args)
|
||||
{
|
||||
int i = 0;
|
||||
while (vo_plugin_args[i].name)
|
||||
if (!strcmp(vo_plugin_args[i++].name, str))
|
||||
{
|
||||
i = -1;
|
||||
break;
|
||||
}
|
||||
if (i != -1)
|
||||
{
|
||||
vo_plugin_args = realloc(vo_plugin_args, (i + 2) * sizeof(m_obj_settings_t));
|
||||
vo_plugin_args[i].name = strdup(str);
|
||||
vo_plugin_args[i].attribs = NULL;
|
||||
vo_plugin_args[i + 1].name = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vo_plugin_args = malloc(2 * sizeof(m_obj_settings_t));
|
||||
vo_plugin_args[0].name = strdup(str);
|
||||
vo_plugin_args[0].attribs = NULL;
|
||||
vo_plugin_args[1].name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void remove_vop(char * str)
|
||||
{
|
||||
int n = 0;
|
||||
if (!vo_plugin_args ) return;
|
||||
|
||||
mp_msg(MSGT_GPLAYER,MSGL_STATUS, MSGTR_RemovingVideoFilter, str);
|
||||
|
||||
while (vo_plugin_args[n++].name);
|
||||
n--;
|
||||
if ( n > -1 )
|
||||
{
|
||||
int i = 0, m = -1;
|
||||
while (vo_plugin_args[i].name)
|
||||
if (!strcmp(vo_plugin_args[i++].name, str))
|
||||
{
|
||||
m = i - 1;
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
if (m > -1)
|
||||
{
|
||||
if (n == 1)
|
||||
{
|
||||
free(vo_plugin_args[0].name);
|
||||
free(vo_plugin_args[0].attribs);
|
||||
free(vo_plugin_args);
|
||||
vo_plugin_args=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(vo_plugin_args[i].name);
|
||||
free(vo_plugin_args[i].attribs);
|
||||
memcpy(&vo_plugin_args[i], &vo_plugin_args[i + 1], (n - i) * sizeof(m_obj_settings_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* this function gets called by mplayer to update the gui */
|
||||
int guiGetEvent(int type, char *arg)
|
||||
{
|
||||
if(!mygui || !mygui->skin) return 0;
|
||||
|
||||
stream_t *stream = (stream_t *) arg;
|
||||
#ifdef USE_DVDREAD
|
||||
dvd_priv_t *dvdp = (dvd_priv_t *) arg;
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case guiSetFileFormat:
|
||||
guiIntfStruct.FileFormat = (int) arg;
|
||||
break;
|
||||
case guiSetParameters:
|
||||
{
|
||||
guiGetEvent(guiSetDefaults, NULL);
|
||||
guiIntfStruct.DiskChanged = 0;
|
||||
guiIntfStruct.FilenameChanged = 0;
|
||||
guiIntfStruct.NewPlay = 0;
|
||||
switch(guiIntfStruct.StreamType)
|
||||
{
|
||||
case STREAMTYPE_PLAYLIST:
|
||||
break;
|
||||
#ifdef USE_DVDREAD
|
||||
case STREAMTYPE_DVD:
|
||||
{
|
||||
char tmp[512];
|
||||
dvd_title = guiIntfStruct.DVD.current_title;
|
||||
dvd_chapter = guiIntfStruct.DVD.current_chapter;
|
||||
dvd_angle = guiIntfStruct.DVD.current_angle;
|
||||
sprintf(tmp,"dvd://%d", guiIntfStruct.Title);
|
||||
guiSetFilename(guiIntfStruct.Filename, tmp);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(guiIntfStruct.Filename)
|
||||
filename = strdup(guiIntfStruct.Filename);
|
||||
else if(filename)
|
||||
strcpy(guiIntfStruct.Filename, filename);
|
||||
break;
|
||||
}
|
||||
case guiSetAudioOnly:
|
||||
{
|
||||
guiIntfStruct.AudioOnly = (int) arg;
|
||||
if(IsWindowVisible(mygui->subwindow))
|
||||
ShowWindow(mygui->subwindow, SW_HIDE);
|
||||
break;
|
||||
}
|
||||
case guiSetDemuxer:
|
||||
guiIntfStruct.demuxer = (void *) arg;
|
||||
break;
|
||||
case guiSetValues:
|
||||
{
|
||||
guiIntfStruct.sh_video = arg;
|
||||
if (arg)
|
||||
{
|
||||
sh_video_t *sh = (sh_video_t *)arg;
|
||||
codecname = sh->codec->name;
|
||||
guiIntfStruct.FPS = sh->fps;
|
||||
|
||||
/* we have video, show the subwindow */
|
||||
if(!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow))
|
||||
ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
|
||||
if(WinID == -1)
|
||||
update_subwindow();
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case guiSetShVideo:
|
||||
{
|
||||
guiIntfStruct.MovieWidth = vo_dwidth;
|
||||
guiIntfStruct.MovieHeight = vo_dheight;
|
||||
|
||||
sub_aspect = (float)guiIntfStruct.MovieWidth/guiIntfStruct.MovieHeight;
|
||||
if(WinID != -1)
|
||||
update_subwindow();
|
||||
break;
|
||||
}
|
||||
case guiSetStream:
|
||||
{
|
||||
guiIntfStruct.StreamType = stream->type;
|
||||
switch(stream->type)
|
||||
{
|
||||
#ifdef USE_DVDREAD
|
||||
case STREAMTYPE_DVD:
|
||||
guiGetEvent(guiSetDVD, (char *) stream->priv);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef USE_DVDREAD
|
||||
case guiSetDVD:
|
||||
{
|
||||
guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
|
||||
guiIntfStruct.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
|
||||
guiIntfStruct.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
|
||||
guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
|
||||
memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
|
||||
guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
|
||||
memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
|
||||
guiIntfStruct.DVD.current_title = dvd_title + 1;
|
||||
guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
|
||||
guiIntfStruct.DVD.current_angle = dvd_angle + 1;
|
||||
guiIntfStruct.Track = dvd_title + 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case guiReDraw:
|
||||
mygui->updatedisplay(mygui, mygui->mainwindow);
|
||||
break;
|
||||
case guiSetAfilter:
|
||||
guiIntfStruct.afilter = (void *) arg;
|
||||
break;
|
||||
case guiCEvent:
|
||||
{
|
||||
guiIntfStruct.Playing = (int) arg;
|
||||
switch (guiIntfStruct.Playing)
|
||||
{
|
||||
case guiSetPlay:
|
||||
{
|
||||
guiIntfStruct.Playing = 1;
|
||||
break;
|
||||
}
|
||||
case guiSetStop:
|
||||
{
|
||||
guiIntfStruct.Playing = 0;
|
||||
if(movie_aspect >= 0)
|
||||
movie_aspect = -1;
|
||||
update_subwindow();
|
||||
break;
|
||||
}
|
||||
case guiSetPause:
|
||||
guiIntfStruct.Playing = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case guiIEvent:
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", (int) arg);
|
||||
/* MPlayer asks us to quit */
|
||||
switch((int) arg)
|
||||
{
|
||||
case MP_CMD_GUI_FULLSCREEN:
|
||||
{
|
||||
if(!guiIntfStruct.sh_video) break;
|
||||
video_out->control(VOCTRL_FULLSCREEN, 0);
|
||||
|
||||
/* no WinID, keep the sub window hidden */
|
||||
if((video_driver_list && !strstr(video_driver_list[0], "directx")) || !sub_window)
|
||||
break;
|
||||
|
||||
if(vo_fs)
|
||||
{
|
||||
WinID = -1;
|
||||
ShowWindow(mygui->subwindow, SW_HIDE);
|
||||
while(ShowCursor(FALSE) >= 0){}
|
||||
} else {
|
||||
WinID = mygui->subwindow;
|
||||
ShowWindow(mygui->subwindow, SW_SHOW);
|
||||
while(ShowCursor(TRUE) <= 0){}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MP_CMD_QUIT:
|
||||
{
|
||||
mygui->uninit(mygui);
|
||||
free(mygui);
|
||||
mygui = NULL;
|
||||
exit_player("Done");
|
||||
return 0;
|
||||
}
|
||||
case MP_CMD_GUI_STOP:
|
||||
guiGetEvent(guiCEvent, (void *) guiSetStop);
|
||||
break;
|
||||
case MP_CMD_GUI_PLAY:
|
||||
guiGetEvent(guiCEvent, (void *) guiSetPlay);
|
||||
break;
|
||||
case MP_CMD_GUI_SKINBROWSER:
|
||||
if(vo_fs) guiSetEvent(evFullScreen);
|
||||
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
|
||||
break;
|
||||
case MP_CMD_GUI_PLAYLIST:
|
||||
if(vo_fs) guiSetEvent(evFullScreen);
|
||||
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
|
||||
break;
|
||||
case MP_CMD_GUI_PREFERENCES:
|
||||
if(vo_fs) guiSetEvent(evFullScreen);
|
||||
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
|
||||
break;
|
||||
case MP_CMD_GUI_LOADFILE:
|
||||
if(vo_fs) guiSetEvent(evFullScreen);
|
||||
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
|
||||
break;
|
||||
#ifdef USE_SUB
|
||||
case MP_CMD_GUI_LOADSUBTITLE:
|
||||
if(vo_fs) guiSetEvent(evFullScreen);
|
||||
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case guiSetFileName:
|
||||
if (arg) guiIntfStruct.Filename = (char *) arg;
|
||||
break;
|
||||
case guiSetDefaults:
|
||||
{
|
||||
audio_id = -1;
|
||||
video_id = -1;
|
||||
dvdsub_id = -1;
|
||||
vobsub_id = -1;
|
||||
stream_cache_size = -1;
|
||||
autosync = 0;
|
||||
vcd_track = 0;
|
||||
dvd_title = 0;
|
||||
force_fps = 0;
|
||||
if(!mygui->playlist->tracks) return 0;
|
||||
filename = guiIntfStruct.Filename = mygui->playlist->tracks[mygui->playlist->current]->filename;
|
||||
guiIntfStruct.Track = mygui->playlist->current + 1;
|
||||
if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm");
|
||||
if(gtkAOExtraStereo)
|
||||
{
|
||||
char *name = malloc(12 + 20 + 1);
|
||||
snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
|
||||
name[12 + 20] = 0;
|
||||
greplace(&af_cfg.list, "extrastereo", name);
|
||||
free(name);
|
||||
}
|
||||
if(gtkCacheOn) stream_cache_size = gtkCacheSize;
|
||||
if(gtkAutoSyncOn) autosync = gtkAutoSync;
|
||||
break;
|
||||
}
|
||||
case guiSetVolume:
|
||||
{
|
||||
if(audio_out)
|
||||
{
|
||||
/* Some audio_out drivers do not support balance e.g. dsound */
|
||||
/* FIXME this algo is not correct */
|
||||
float l, r;
|
||||
mixer_getvolume(&mixer, &l, &r);
|
||||
guiIntfStruct.Volume = (r > l ? r : l); /* max(r,l) */
|
||||
if (r != l)
|
||||
guiIntfStruct.Balance = ((r-l) + 100.0f) * 0.5f;
|
||||
else
|
||||
guiIntfStruct.Balance = 50.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function adds/inserts one file into the gui playlist */
|
||||
int import_file_into_gui(char *pathname, int insert)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
char *filepart = filename;
|
||||
|
||||
if (strstr(pathname, "://"))
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
|
||||
mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
|
||||
{
|
||||
if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
|
||||
mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", filename);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function imports the initial playtree (based on cmd-line files) into the gui playlist
|
||||
by either:
|
||||
- overwriting gui pl (enqueue=0) */
|
||||
|
||||
int import_initial_playtree_into_gui(play_tree_t *my_playtree, m_config_t *config, int enqueue)
|
||||
{
|
||||
play_tree_iter_t *my_pt_iter = NULL;
|
||||
int result = 0;
|
||||
|
||||
if(!mygui) guiInit();
|
||||
|
||||
if((my_pt_iter = pt_iter_create(&my_playtree, config)))
|
||||
{
|
||||
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
|
||||
{
|
||||
if (parse_filename(filename, my_playtree, config, 0))
|
||||
result = 1;
|
||||
else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
mplGotoTheNext = 1;
|
||||
|
||||
if (result)
|
||||
{
|
||||
mygui->playlist->current = 0;
|
||||
filename = mygui->playlist->tracks[0]->filename;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This function imports and inserts an playtree, that is created "on the fly", for example by
|
||||
parsing some MOV-Reference-File; or by loading an playlist with "File Open"
|
||||
The file which contained the playlist is thereby replaced with it's contents. */
|
||||
|
||||
int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config)
|
||||
{
|
||||
play_tree_iter_t *my_pt_iter = NULL;
|
||||
int result = 0;
|
||||
|
||||
if((my_pt_iter = pt_iter_create(&my_playtree, config)))
|
||||
{
|
||||
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
|
||||
if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
|
||||
result = 1;
|
||||
pt_iter_destroy(&my_pt_iter);
|
||||
}
|
||||
filename = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void gtkMessageBox(int type, const char *str)
|
||||
{
|
||||
if (type & GTK_MB_FATAL)
|
||||
MessageBox(NULL, str, "MPlayer GUI for Windows Error", MB_OK | MB_ICONERROR);
|
||||
|
||||
fprintf(stderr, "[GUI] MessageBox: %s\n", str);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
void guiMessageBox(int level, char *str)
|
||||
{
|
||||
switch(level)
|
||||
{
|
||||
case MSGL_FATAL:
|
||||
gtkMessageBox(GTK_MB_FATAL | GTK_MB_SIMPLE, str);
|
||||
break;
|
||||
case MSGL_ERR:
|
||||
gtkMessageBox(GTK_MB_ERROR | GTK_MB_SIMPLE, str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int update_subwindow(void)
|
||||
{
|
||||
int x,y;
|
||||
RECT rd;
|
||||
WINDOWPOS wp;
|
||||
|
||||
/* it's not the best way to check if selected driver is directx,
|
||||
if no driver is specified video_driver_list is null.
|
||||
Right now I don't have a functional way to do this
|
||||
- Sherpya */
|
||||
if((video_driver_list && !strstr(video_driver_list[0], "directx")) || !sub_window)
|
||||
{
|
||||
WinID = -1; // so far only directx supports WinID in windows
|
||||
|
||||
if(IsWindowVisible(mygui->subwindow) && guiIntfStruct.sh_video && guiIntfStruct.Playing)
|
||||
{
|
||||
ShowWindow(mygui->subwindow, SW_HIDE);
|
||||
return 0;
|
||||
}
|
||||
else if(guiIntfStruct.AudioOnly)
|
||||
return 0;
|
||||
else ShowWindow(mygui->subwindow, SW_SHOW);
|
||||
}
|
||||
|
||||
/* we've come out of fullscreen at the end of file */
|
||||
if((!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow)) && !guiIntfStruct.AudioOnly)
|
||||
ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
|
||||
|
||||
/* get our current window coordinates */
|
||||
GetWindowRect(mygui->subwindow, &rd);
|
||||
x = rd.left;
|
||||
y = rd.top;
|
||||
|
||||
if(!guiIntfStruct.Playing)
|
||||
{
|
||||
window *desc = NULL;
|
||||
int i;
|
||||
|
||||
for (i=0; i<mygui->skin->windowcount; i++)
|
||||
if(mygui->skin->windows[i]->type == wiSub)
|
||||
desc = mygui->skin->windows[i];
|
||||
|
||||
rd.right = rd.left+desc->base->bitmap[0]->width;
|
||||
rd.bottom = rd.top+desc->base->bitmap[0]->height;
|
||||
sub_aspect = (float)(rd.right-rd.left)/(rd.bottom-rd.top);
|
||||
}
|
||||
else
|
||||
{
|
||||
rd.right = rd.left+guiIntfStruct.MovieWidth;
|
||||
rd.bottom = rd.top+guiIntfStruct.MovieHeight;
|
||||
|
||||
if (movie_aspect > 0.0) // forced aspect from the cmdline
|
||||
sub_aspect = movie_aspect;
|
||||
}
|
||||
|
||||
AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
|
||||
SetWindowPos(mygui->subwindow, HWND_NOTOPMOST, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
|
||||
|
||||
wp.hwnd = mygui->subwindow;
|
||||
wp.x = rd.left;
|
||||
wp.y = rd.top;
|
||||
wp.cx = rd.right-rd.left;
|
||||
wp.cy = rd.bottom-rd.top;
|
||||
wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
|
||||
|
||||
/* erase the bitmap image if there's video */
|
||||
if(guiIntfStruct.Playing != 0 && guiIntfStruct.sh_video)
|
||||
SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
|
||||
|
||||
/* reset the window aspect */
|
||||
SendMessage(mygui->subwindow, WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void guiEventHandling(void) {}
|
154
Gui/win32/playlist.c
Normal file
154
Gui/win32/playlist.c
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <mp_msg.h>
|
||||
#include "playlist.h"
|
||||
|
||||
/* TODO: implement sort_playlist */
|
||||
|
||||
BOOL adddirtoplaylist(playlist_t *playlist, const char *path, BOOL recursive)
|
||||
{
|
||||
HANDLE findHandle = INVALID_HANDLE_VALUE;
|
||||
WIN32_FIND_DATA finddata;
|
||||
char findpath[MAX_PATH], filename[MAX_PATH];
|
||||
char *filepart;
|
||||
|
||||
sprintf(findpath, "%s\\*.*", path);
|
||||
|
||||
findHandle = FindFirstFile(findpath, &finddata);
|
||||
|
||||
if (findHandle == INVALID_HANDLE_VALUE) return FALSE;
|
||||
do
|
||||
{
|
||||
if (finddata.cFileName[0] == '.' || strstr(finddata.cFileName, "Thumbs.db")) continue;
|
||||
sprintf(findpath, "%s\\%s", path, finddata.cFileName);
|
||||
|
||||
if (GetFileAttributes(findpath) & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
if(recursive)
|
||||
adddirtoplaylist(playlist, findpath, recursive);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetFullPathName(findpath, MAX_PATH, filename, &filepart))
|
||||
playlist->add_track(playlist, filename, NULL, filepart, 0);
|
||||
}
|
||||
} while (FindNextFile(findHandle, &finddata));
|
||||
FindClose(findHandle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void add_track(playlist_t *playlist, const char *filename, const char *artist, const char *title, int duration)
|
||||
{
|
||||
(playlist->trackcount)++;
|
||||
playlist->tracks = realloc(playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
|
||||
playlist->tracks[playlist->trackcount - 1] = calloc(1, sizeof(pl_track_t));
|
||||
if(filename) playlist->tracks[playlist->trackcount - 1]->filename = strdup(filename);
|
||||
if(artist) playlist->tracks[playlist->trackcount - 1]->artist = strdup(artist);
|
||||
if(title) playlist->tracks[playlist->trackcount - 1]->title = strdup(title);
|
||||
if(duration) playlist->tracks[playlist->trackcount - 1]->duration = duration;
|
||||
}
|
||||
|
||||
static void remove_track(playlist_t *playlist, int number)
|
||||
{
|
||||
pl_track_t **tmp = calloc(1, playlist->trackcount * sizeof(pl_track_t *));
|
||||
int i, p = 0;
|
||||
memcpy(tmp, playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
|
||||
(playlist->trackcount)--;
|
||||
playlist->tracks = realloc(playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
|
||||
for(i=0; i<playlist->trackcount + 1; i++)
|
||||
{
|
||||
if(i != (number - 1))
|
||||
{
|
||||
playlist->tracks[p] = tmp[i];
|
||||
p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tmp[i]->filename) free(tmp[i]->filename);
|
||||
if(tmp[i]->artist) free(tmp[i]->artist);
|
||||
if(tmp[i]->title) free(tmp[i]->title);
|
||||
free(tmp[i]);
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
static void moveup_track(playlist_t *playlist, int number)
|
||||
{
|
||||
pl_track_t *tmp;
|
||||
if(number == 1) return; /* already first */
|
||||
tmp = playlist->tracks[number - 2];
|
||||
playlist->tracks[number - 2] = playlist->tracks[number - 1];
|
||||
playlist->tracks[number - 1] = tmp;
|
||||
}
|
||||
|
||||
static void movedown_track(playlist_t *playlist, int number)
|
||||
{
|
||||
pl_track_t *tmp;
|
||||
if(number == playlist->trackcount) return; /* already latest */
|
||||
tmp = playlist->tracks[number];
|
||||
playlist->tracks[number] = playlist->tracks[number - 1];
|
||||
playlist->tracks[number - 1] = tmp;
|
||||
}
|
||||
|
||||
static void sort_playlist(playlist_t *playlist, int opt) {}
|
||||
|
||||
static void clear_playlist(playlist_t *playlist)
|
||||
{
|
||||
while(playlist->trackcount) playlist->remove_track(playlist, 1);
|
||||
playlist->tracks = NULL;
|
||||
playlist->current = 0;
|
||||
}
|
||||
|
||||
static void free_playlist(playlist_t *playlist)
|
||||
{
|
||||
if(playlist->tracks) playlist->clear_playlist(playlist);
|
||||
free(playlist);
|
||||
}
|
||||
|
||||
static void dump_playlist(playlist_t *playlist)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<playlist->trackcount; i++)
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "track %i %s ", i + 1, playlist->tracks[i]->filename);
|
||||
if(playlist->tracks[i]->artist) mp_msg(MSGT_GPLAYER, MSGL_V, "%s ", playlist->tracks[i]->artist);
|
||||
if(playlist->tracks[i]->title) mp_msg(MSGT_GPLAYER, MSGL_V, "- %s ", playlist->tracks[i]->title);
|
||||
if(playlist->tracks[i]->duration) mp_msg(MSGT_GPLAYER, MSGL_V, "%i ", playlist->tracks[i]->duration);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
playlist_t *create_playlist(void)
|
||||
{
|
||||
playlist_t *playlist = calloc(1, sizeof(playlist_t));
|
||||
playlist->add_track = add_track;
|
||||
playlist->remove_track = remove_track;
|
||||
playlist->moveup_track = moveup_track;
|
||||
playlist->movedown_track = movedown_track;
|
||||
playlist->dump_playlist = dump_playlist;
|
||||
playlist->sort_playlist = sort_playlist;
|
||||
playlist->clear_playlist = clear_playlist;
|
||||
playlist->free_playlist = free_playlist;
|
||||
return playlist;
|
||||
}
|
57
Gui/win32/playlist.h
Normal file
57
Gui/win32/playlist.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _PLAYLIST_H
|
||||
#define _PLAYLIST_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
char *artist;
|
||||
char *title;
|
||||
int duration;
|
||||
} pl_track_t;
|
||||
|
||||
typedef struct playlist_t playlist_t;
|
||||
struct playlist_t
|
||||
{
|
||||
int current; /* currently used track */
|
||||
int trackcount; /* number of tracknumber */
|
||||
pl_track_t **tracks; /* tracklist */
|
||||
void (*add_track)(playlist_t* playlist, const char *filename, const char *artist, const char *title, int duration);
|
||||
void (*remove_track)(playlist_t* playlist, int number);
|
||||
void (*moveup_track)(playlist_t* playlist, int number);
|
||||
void (*movedown_track)(playlist_t* playlist, int number);
|
||||
void (*dump_playlist)(playlist_t* playlist);
|
||||
void (*sort_playlist)(playlist_t* playlist, int opt);
|
||||
void (*clear_playlist)(playlist_t* playlist);
|
||||
void (*free_playlist)(playlist_t* playlist);
|
||||
};
|
||||
|
||||
#define SORT_BYFILENAME 1
|
||||
#define SORT_BYARTIST 2
|
||||
#define SORT_BYTITLE 3
|
||||
#define SORT_BYDURATION 4
|
||||
|
||||
extern playlist_t *create_playlist(void);
|
||||
extern BOOL adddirtoplaylist(playlist_t *playlist, const char* path, BOOL recursive);
|
||||
|
||||
#endif
|
714
Gui/win32/preferences.c
Normal file
714
Gui/win32/preferences.c
Normal file
@ -0,0 +1,714 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libvo/video_out.h>
|
||||
#include <libao2/audio_out.h>
|
||||
#include <mixer.h>
|
||||
#include "interface.h"
|
||||
#include "gui.h"
|
||||
#include "mp_msg.h"
|
||||
#include "help_mp.h"
|
||||
#include "dialogs.h"
|
||||
#include "wincfg.h"
|
||||
|
||||
extern int vo_doublebuffering;
|
||||
extern int vo_directrendering;
|
||||
extern int frame_dropping;
|
||||
extern int soft_vol;
|
||||
extern float audio_delay;
|
||||
extern int osd_level;
|
||||
extern char *dvd_device, *cdrom_device;
|
||||
extern char *proc_priority;
|
||||
|
||||
static void set_defaults(void);
|
||||
|
||||
static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND btn, label, edit1, edit2, edit3, updown1, updown2, track1, track2;
|
||||
static HWND vo_driver, ao_driver, prio;
|
||||
int i = 0, j = 0;
|
||||
char dvddevice[MAX_PATH];
|
||||
char cdromdevice[MAX_PATH];
|
||||
char procprio[11];
|
||||
float x = 10.0, y = 100.0, stereopos, delaypos;
|
||||
stereopos = gtkAOExtraStereoMul * x;
|
||||
delaypos = audio_delay * y;
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
/* video and audio drivers */
|
||||
label = CreateWindow("static", "Video Driver:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
10, 13, 70, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "Audio Driver:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
190, 13, 70, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "Extra stereo coefficient:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
10, 126, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "Audio delay:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
36, 165, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "OSD level:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
10, 264, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "DVD device:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
80, 363, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "CD device:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
202, 363, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
label = CreateWindow("static", "Priority:",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
217, 264, 115, 15, hwnd,
|
||||
NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
vo_driver = CreateWindow("combobox", NULL,
|
||||
CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
|
||||
CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
|
||||
WS_CHILD | WS_VISIBLE |
|
||||
WS_VSCROLL | WS_TABSTOP,
|
||||
80, 10, 100, 160, hwnd,
|
||||
(HMENU) ID_VO_DRIVER,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
|
||||
ao_driver = CreateWindow("combobox", NULL,
|
||||
CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
|
||||
CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
|
||||
WS_CHILD | WS_VISIBLE |
|
||||
WS_VSCROLL | WS_TABSTOP,
|
||||
260, 10, 100, 160, hwnd,
|
||||
(HMENU) ID_AO_DRIVER,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
|
||||
prio = CreateWindow("combobox", NULL,
|
||||
CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
|
||||
CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
|
||||
WS_CHILD | WS_VISIBLE |
|
||||
WS_VSCROLL | WS_TABSTOP,
|
||||
260, 260, 100, 160, hwnd,
|
||||
(HMENU) ID_PRIO,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
|
||||
/* checkboxes */
|
||||
btn = CreateWindow("button", "Enable double buffering",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
25, 35, 150, 25,
|
||||
hwnd, (HMENU) ID_DOUBLE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable direct rendering",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
25, 57, 150, 25,
|
||||
hwnd, (HMENU) ID_DIRECT,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable framedropping",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
25, 79, 150, 25,
|
||||
hwnd, (HMENU) ID_FRAMEDROP,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Normalize sound",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
205, 35, 150, 25,
|
||||
hwnd, (HMENU) ID_NORMALIZE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable software mixer",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
205, 57, 150, 25,
|
||||
hwnd, (HMENU) ID_SOFTMIX,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable extra stereo",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
205, 79, 150, 25,
|
||||
hwnd, (HMENU) ID_EXTRASTEREO,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable cache",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
10, 200, 90, 25,
|
||||
hwnd, (HMENU) ID_CACHE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Enable autosync",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
192, 200, 100, 25, hwnd,
|
||||
(HMENU) ID_AUTOSYNC,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Display videos in the sub window (directx only)",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||
55, 227, 250, 25,
|
||||
hwnd, (HMENU) ID_SUBWINDOW,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
/* osd level */
|
||||
btn = CreateWindow("button", "None",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
|
||||
95, 260, 100, 25, hwnd,
|
||||
(HMENU) ID_NONE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Timer and indicators",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
|
||||
95, 280, 180, 25, hwnd,
|
||||
(HMENU) ID_OSD1,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Progress bar only",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
|
||||
95, 300, 180, 25, hwnd,
|
||||
(HMENU) ID_OSD2,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Timer, percentage, and total time",
|
||||
WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
|
||||
95, 320, 180, 25, hwnd,
|
||||
(HMENU) ID_OSD3,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Apply",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
199, 395, 80, 25, hwnd,
|
||||
(HMENU) ID_APPLY,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Cancel",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
285, 395, 80, 25, hwnd,
|
||||
(HMENU) ID_CANCEL,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
btn = CreateWindow("button", "Defaults",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
4, 395, 80, 25, hwnd,
|
||||
(HMENU) ID_DEFAULTS,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
/* extra stereo coefficient trackbar */
|
||||
track1 = CreateWindow(TRACKBAR_CLASS, "Coefficient",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
|
||||
WS_DISABLED | TBS_HORZ |
|
||||
TBS_BOTTOM | TBS_NOTICKS,
|
||||
120, 120, 245, 35, hwnd,
|
||||
(HMENU) ID_TRACKBAR1,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETRANGE, 1, MAKELONG(-100, 100));
|
||||
|
||||
/* audio delay */
|
||||
track2 = CreateWindow(TRACKBAR_CLASS, "Audio delay",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
|
||||
WS_DISABLED | TBS_HORZ |
|
||||
TBS_BOTTOM | TBS_NOTICKS,
|
||||
120, 160, 245, 35, hwnd,
|
||||
(HMENU) ID_TRACKBAR2,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETRANGE, 1, MAKELONG(-1000, 1000));
|
||||
|
||||
/* cache */
|
||||
edit1 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "cache",
|
||||
WS_CHILD | WS_VISIBLE | WS_DISABLED |
|
||||
ES_LEFT | ES_AUTOHSCROLL,
|
||||
105, 203, 40, 20, hwnd,
|
||||
(HMENU) ID_EDIT1,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(edit1, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
updown1 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
|
||||
WS_DISABLED | UDS_SETBUDDYINT |
|
||||
UDS_ARROWKEYS | UDS_NOTHOUSANDS,
|
||||
145, 203, 20, 20, hwnd,
|
||||
ID_UPDOWN1,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
(HWND)edit1, 0, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETRANGE32, (WPARAM)0, (LPARAM)65535);
|
||||
|
||||
/* autosync */
|
||||
edit2 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "autosync",
|
||||
WS_CHILD | WS_VISIBLE | WS_DISABLED |
|
||||
ES_LEFT | ES_AUTOHSCROLL,
|
||||
300, 203, 40, 20, hwnd,
|
||||
(HMENU) ID_EDIT2,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(edit2, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
updown2 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
|
||||
WS_DISABLED | UDS_SETBUDDYINT |
|
||||
UDS_ARROWKEYS | UDS_NOTHOUSANDS,
|
||||
340, 203, 20, 20, hwnd,
|
||||
ID_UPDOWN2,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
(HWND)edit2, 0, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETRANGE32, (WPARAM)0, (LPARAM)10000);
|
||||
|
||||
/* dvd and cd devices */
|
||||
edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
|
||||
WS_CHILD | WS_VISIBLE |
|
||||
ES_LEFT | ES_AUTOHSCROLL,
|
||||
145, 360, 20, 20, hwnd,
|
||||
(HMENU) ID_DVDDEVICE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
|
||||
WS_CHILD | WS_VISIBLE |
|
||||
ES_LEFT| ES_AUTOHSCROLL,
|
||||
260, 360, 20, 20, hwnd,
|
||||
(HMENU) ID_CDDEVICE,
|
||||
((LPCREATESTRUCT) lParam) -> hInstance,
|
||||
NULL);
|
||||
SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
while(video_out_drivers[i])
|
||||
{
|
||||
const vo_info_t *info = video_out_drivers[i++]->info;
|
||||
if(!video_driver_list) gaddlist(&video_driver_list, (char *)info->short_name);
|
||||
SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
|
||||
}
|
||||
/* Special case for directx:noaccel */
|
||||
SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) "directx:noaccel");
|
||||
SendMessage(vo_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
while(audio_out_drivers[j])
|
||||
{
|
||||
const ao_info_t *info = audio_out_drivers[j++]->info;
|
||||
if(!audio_driver_list)
|
||||
{
|
||||
gaddlist(&audio_driver_list, (char *)info->short_name);
|
||||
audio_driver_list[0] = "win32";
|
||||
}
|
||||
SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
|
||||
}
|
||||
SendMessage(ao_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
/* priority list, i'm leaving out realtime for safety's sake */
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "low");
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "belownormal");
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "normal");
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "abovenormal");
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "high");
|
||||
SendMessage(prio, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
|
||||
/* set our preferences on what we already have */
|
||||
if(video_driver_list)
|
||||
SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1,
|
||||
(LPARAM)video_driver_list[0]), 0);
|
||||
|
||||
if(audio_driver_list)
|
||||
SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1,
|
||||
(LPARAM)audio_driver_list[0]), 0);
|
||||
|
||||
if(vo_doublebuffering)
|
||||
SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 1, 0);
|
||||
if(vo_directrendering)
|
||||
SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 1, 0);
|
||||
if(frame_dropping)
|
||||
SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 1, 0);
|
||||
if(gtkAONorm)
|
||||
SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 1, 0);
|
||||
if(soft_vol)
|
||||
SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 1, 0);
|
||||
if(gtkAOExtraStereo)
|
||||
{
|
||||
SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 1, 0);
|
||||
if(!guiIntfStruct.Playing)
|
||||
{
|
||||
EnableWindow(track1, 1);
|
||||
EnableWindow(track2, 1);
|
||||
}
|
||||
}
|
||||
else gtkAOExtraStereoMul = 1.0;
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)stereopos);
|
||||
|
||||
if(audio_delay)
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)delaypos);
|
||||
|
||||
if(gtkCacheOn) {
|
||||
SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 1, 0);
|
||||
EnableWindow(edit1, 1);
|
||||
EnableWindow(updown1, 1);
|
||||
}
|
||||
else gtkCacheSize = 2048;
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize);
|
||||
|
||||
if(gtkAutoSyncOn) {
|
||||
SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 1, 0);
|
||||
EnableWindow(edit2, 1);
|
||||
EnableWindow(updown2, 1);
|
||||
}
|
||||
else gtkAutoSync = 0;
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync);
|
||||
|
||||
if(sub_window)
|
||||
SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0);
|
||||
|
||||
if(!osd_level)
|
||||
SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 1, 0);
|
||||
else if(osd_level == 1)
|
||||
SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0);
|
||||
else if(osd_level == 2)
|
||||
SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 1, 0);
|
||||
else if(osd_level == 3)
|
||||
SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 1, 0);
|
||||
|
||||
if(dvd_device)
|
||||
SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)dvd_device);
|
||||
else SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
|
||||
|
||||
if(cdrom_device)
|
||||
SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)cdrom_device);
|
||||
else SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
|
||||
|
||||
if(proc_priority)
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(prio, CB_FINDSTRING, -1,
|
||||
(LPARAM)proc_priority), 0);
|
||||
|
||||
else SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, 2, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
HDC hdc = (HDC)wParam;
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
return (INT_PTR)SOLID_GREY;
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case ID_EXTRASTEREO:
|
||||
{
|
||||
if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 1);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 1);
|
||||
} else {
|
||||
EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 0);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 0);
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0);
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_CACHE:
|
||||
{
|
||||
if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 1);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 1);
|
||||
} else {
|
||||
EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 0);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 0);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 1, (LPARAM)2048);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_AUTOSYNC:
|
||||
{
|
||||
if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 1);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 1);
|
||||
} else {
|
||||
EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 0);
|
||||
EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 0);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 1, (LPARAM)0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_DEFAULTS:
|
||||
{
|
||||
set_defaults();
|
||||
SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, (LPARAM)"directx"), 0);
|
||||
|
||||
SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, (LPARAM)"dsound"), 0);
|
||||
|
||||
SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL,
|
||||
(WPARAM)SendMessage(prio, CB_FINDSTRING, -1, (LPARAM)proc_priority), 0);
|
||||
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0);
|
||||
SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0.0);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize);
|
||||
SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync);
|
||||
SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0);
|
||||
SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0);
|
||||
SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
|
||||
SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
|
||||
SendMessage(hwnd, WM_COMMAND, (WPARAM)ID_APPLY, 0);
|
||||
break;
|
||||
}
|
||||
case ID_CANCEL:
|
||||
DestroyWindow(hwnd);
|
||||
return 0;
|
||||
case ID_APPLY:
|
||||
{
|
||||
if(guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *)guiSetStop);
|
||||
|
||||
/* Set the video driver */
|
||||
SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)SendMessage(vo_driver, CB_GETCURSEL, 0, 0),
|
||||
(LPARAM)video_driver_list[0]);
|
||||
|
||||
/* Set the audio driver */
|
||||
SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)SendMessage(ao_driver, CB_GETCURSEL, 0, 0),
|
||||
(LPARAM)audio_driver_list[0]);
|
||||
|
||||
/* Set the priority level */
|
||||
SendMessage(prio, CB_GETLBTEXT, (WPARAM)SendMessage(prio, CB_GETCURSEL, 0, 0), (LPARAM)procprio);
|
||||
proc_priority = strdup(procprio);
|
||||
|
||||
/* double buffering */
|
||||
if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
vo_doublebuffering = 1;
|
||||
else vo_doublebuffering = 0;
|
||||
|
||||
/* direct rendering */
|
||||
if(SendDlgItemMessage(hwnd, ID_DIRECT, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
vo_directrendering = 1;
|
||||
else vo_directrendering = 0;
|
||||
|
||||
/* frame dropping */
|
||||
if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
frame_dropping = 1;
|
||||
else frame_dropping = 0;
|
||||
|
||||
/* normalize */
|
||||
if(SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
gtkAONorm = 1;
|
||||
else gtkAONorm = 0;
|
||||
|
||||
/* software mixer */
|
||||
if(SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
soft_vol = 1;
|
||||
else soft_vol = 0;
|
||||
|
||||
/* extra stereo */
|
||||
if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
gtkAOExtraStereo = 1;
|
||||
else {
|
||||
gtkAOExtraStereo = 0;
|
||||
gtkAOExtraStereoMul = 10.0;
|
||||
}
|
||||
gtkAOExtraStereoMul = SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_GETPOS, 0, 0) / 10.0;
|
||||
|
||||
/* audio delay */
|
||||
audio_delay = SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_GETPOS, 0, 0) / 100.0;
|
||||
|
||||
/* cache */
|
||||
if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
gtkCacheOn = 1;
|
||||
else gtkCacheOn = 0;
|
||||
gtkCacheSize = SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_GETPOS32, 0, 0);
|
||||
|
||||
/* autosync */
|
||||
if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
gtkAutoSyncOn = 1;
|
||||
else gtkAutoSyncOn = 0;
|
||||
gtkAutoSync = SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_GETPOS32, 0, 0);
|
||||
|
||||
/* sub window */
|
||||
if(SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
sub_window = 1;
|
||||
else sub_window = 0;
|
||||
|
||||
/* osd level */
|
||||
if(SendDlgItemMessage(hwnd, ID_NONE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
osd_level = 0;
|
||||
else if(SendDlgItemMessage(hwnd, ID_OSD1, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
osd_level = 1;
|
||||
else if(SendDlgItemMessage(hwnd, ID_OSD2, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
osd_level = 2;
|
||||
else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
osd_level = 3;
|
||||
|
||||
/* dvd and cd devices */
|
||||
SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)dvddevice);
|
||||
dvd_device = strdup(dvddevice);
|
||||
SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)cdromdevice);
|
||||
cdrom_device = strdup(cdromdevice);
|
||||
|
||||
MessageBox(hwnd, "You must restart MPlayer for the changes to take effect.", "MPlayer - Info:", MB_OK);
|
||||
DestroyWindow(hwnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hwnd, iMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void display_prefswindow(gui_t *gui)
|
||||
{
|
||||
HWND hWnd;
|
||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
||||
WNDCLASS wc;
|
||||
int x, y;
|
||||
if(FindWindow(NULL, "MPlayer - Preferences")) return;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = PrefsWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hIcon = gui->icon;
|
||||
wc.hbrBackground = SOLID_GREY;
|
||||
wc.lpszClassName = "MPlayer - Preferences";
|
||||
wc.lpszMenuName = NULL;
|
||||
RegisterClass(&wc);
|
||||
x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (375 / 2);
|
||||
y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (452 / 2);
|
||||
hWnd = CreateWindow("MPlayer - Preferences",
|
||||
"MPlayer - Preferences",
|
||||
WS_POPUPWINDOW | WS_CAPTION,
|
||||
x,
|
||||
y,
|
||||
375,
|
||||
452,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static void set_defaults(void)
|
||||
{
|
||||
proc_priority = "normal";
|
||||
vo_doublebuffering = 1;
|
||||
vo_directrendering = 0;
|
||||
frame_dropping = 0;
|
||||
soft_vol = 0;
|
||||
gtkAONorm = 0;
|
||||
gtkAOExtraStereo = 0;
|
||||
gtkAOExtraStereoMul = 1.0;
|
||||
audio_delay = 0.0;
|
||||
sub_window = 1;
|
||||
gtkCacheOn = 0;
|
||||
gtkCacheSize = 2048;
|
||||
gtkAutoSyncOn = 0;
|
||||
gtkAutoSync = 0;
|
||||
}
|
809
Gui/win32/skinload.c
Normal file
809
Gui/win32/skinload.c
Normal file
@ -0,0 +1,809 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <windows.h>
|
||||
#include <png.h>
|
||||
|
||||
#include <mp_msg.h>
|
||||
#include <cpudetect.h>
|
||||
#include <libswscale/rgb2rgb.h>
|
||||
#include <libswscale/swscale.h>
|
||||
|
||||
#include "gui.h"
|
||||
|
||||
#define MAX_LINESIZE 256
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int msg;
|
||||
char *name;
|
||||
} evName;
|
||||
|
||||
static const evName evNames[] =
|
||||
{
|
||||
{ evNone, "evNone" },
|
||||
{ evPlay, "evPlay" },
|
||||
{ evDropFile, "evDropFile" },
|
||||
{ evStop, "evStop" },
|
||||
{ evPause, "evPause" },
|
||||
{ evPrev, "evPrev" },
|
||||
{ evNext, "evNext" },
|
||||
{ evLoad, "evLoad" },
|
||||
{ evEqualizer, "evEqualizer" },
|
||||
{ evEqualizer, "evEqualeaser" },
|
||||
{ evPlayList, "evPlaylist" },
|
||||
{ evExit, "evExit" },
|
||||
{ evIconify, "evIconify" },
|
||||
{ evIncBalance, "evIncBalance" },
|
||||
{ evDecBalance, "evDecBalance" },
|
||||
{ evFullScreen, "evFullScreen" },
|
||||
{ evFName, "evFName" },
|
||||
{ evMovieTime, "evMovieTime" },
|
||||
{ evAbout, "evAbout" },
|
||||
{ evLoadPlay, "evLoadPlay" },
|
||||
{ evPreferences, "evPreferences" },
|
||||
{ evSkinBrowser, "evSkinBrowser" },
|
||||
{ evBackward10sec, "evBackward10sec" },
|
||||
{ evForward10sec, "evForward10sec" },
|
||||
{ evBackward1min, "evBackward1min" },
|
||||
{ evForward1min, "evForward1min" },
|
||||
{ evBackward10min, "evBackward10min" },
|
||||
{ evForward10min, "evForward10min" },
|
||||
{ evIncVolume, "evIncVolume" },
|
||||
{ evDecVolume, "evDecVolume" },
|
||||
{ evMute, "evMute" },
|
||||
{ evIncAudioBufDelay, "evIncAudioBufDelay" },
|
||||
{ evDecAudioBufDelay, "evDecAudioBufDelay" },
|
||||
{ evPlaySwitchToPause, "evPlaySwitchToPause" },
|
||||
{ evPauseSwitchToPlay, "evPauseSwitchToPlay" },
|
||||
{ evNormalSize, "evNormalSize" },
|
||||
{ evDoubleSize, "evDoubleSize" },
|
||||
{ evSetMoviePosition, "evSetMoviePosition" },
|
||||
{ evSetVolume, "evSetVolume" },
|
||||
{ evSetBalance, "evSetBalance" },
|
||||
{ evHelp, "evHelp" },
|
||||
{ evLoadSubtitle, "evLoadSubtitle" },
|
||||
{ evPlayDVD, "evPlayDVD" },
|
||||
{ evPlayVCD, "evPlayVCD" },
|
||||
{ evSetURL, "evSetURL" },
|
||||
{ evLoadAudioFile, "evLoadAudioFile" },
|
||||
{ evDropSubtitle, "evDropSubtitle" },
|
||||
{ evSetAspect, "evSetAspect" }
|
||||
};
|
||||
|
||||
static const int evBoxs = sizeof(evNames) / sizeof(evName);
|
||||
|
||||
static char *geteventname(int event)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<evBoxs; i++)
|
||||
if(evNames[i].msg == event)
|
||||
return evNames[i].name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int get_sws_cpuflags(void)
|
||||
{
|
||||
return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) |
|
||||
(gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) |
|
||||
(gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
|
||||
}
|
||||
|
||||
/* reads a complete image as is into image buffer */
|
||||
static image *pngRead(skin_t *skin, unsigned char *fname)
|
||||
{
|
||||
unsigned char header[8];
|
||||
png_structp png;
|
||||
png_infop info;
|
||||
png_infop endinfo;
|
||||
png_bytep *row_p;
|
||||
int color, h;
|
||||
png_uint_32 i;
|
||||
int BPP;
|
||||
char *img;
|
||||
unsigned int imgsize;
|
||||
image *bf;
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
|
||||
if(!stricmp(fname, "NULL")) return 0;
|
||||
|
||||
/* find filename in order file file.png */
|
||||
if(!(fp = fopen(fname, "rb")))
|
||||
{
|
||||
filename = calloc(1, strlen(skin->skindir) + strlen(fname) + 6);
|
||||
sprintf(filename, "%s\\%s.png", skin->skindir, fname);
|
||||
if(!(fp = fopen(filename, "rb")))
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_ERR, "[png] cannot find image %s\n", filename);
|
||||
free(filename);
|
||||
return 0;
|
||||
}
|
||||
free(filename);
|
||||
}
|
||||
|
||||
for (i=0; i < skin->imagecount; i++)
|
||||
if(!strcmp(fname, skin->images[i]->name))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] skinfile %s already exists\n", fname);
|
||||
#endif
|
||||
return skin->images[i];
|
||||
}
|
||||
(skin->imagecount)++;
|
||||
skin->images = realloc(skin->images, sizeof(image *) * skin->imagecount);
|
||||
bf = skin->images[(skin->imagecount) - 1] = calloc(1, sizeof(image));
|
||||
bf->name = strdup(fname);
|
||||
fread(header,1,8,fp);
|
||||
if (!png_check_sig(header, 8)) return 0;
|
||||
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
info = png_create_info_struct(png);
|
||||
endinfo = png_create_info_struct(png);
|
||||
|
||||
png_init_io(png, fp);
|
||||
png_set_sig_bytes(png, 8);
|
||||
png_read_info(png, info);
|
||||
png_get_IHDR(png, info, (png_uint_32*) &bf->width, (png_uint_32*) &bf->height, &BPP, &color, NULL, NULL, NULL);
|
||||
|
||||
if(color & PNG_COLOR_MASK_ALPHA)
|
||||
{
|
||||
if(color & PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA ) BPP *= 2;
|
||||
else BPP *= 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(color & PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY ) BPP *= 1;
|
||||
else BPP *= 3;
|
||||
}
|
||||
row_p = (png_bytep *) malloc (sizeof(png_bytep) * bf->height);
|
||||
img = (png_bytep) calloc(png_get_rowbytes(png, info), bf->height);
|
||||
for (h=0; h < bf->height; h++)
|
||||
row_p[h] = &img[png_get_rowbytes(png, info) * h];
|
||||
png_read_image(png, row_p);
|
||||
free(row_p);
|
||||
|
||||
png_read_end(png, endinfo);
|
||||
png_destroy_read_struct(&png, &info, &endinfo);
|
||||
fclose(fp);
|
||||
imgsize=bf->width * bf->height * (BPP / 8);
|
||||
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] loaded image %s\n", fname);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] size: %dx%d bits: %d\n", bf->width, bf->height, BPP);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] imagesize: %u\n", imgsize);
|
||||
#endif
|
||||
|
||||
bf->size = bf->width * bf->height * skin->desktopbpp / 8;
|
||||
bf->data = malloc(bf->size);
|
||||
if(skin->desktopbpp == 16 && BPP == 24) rgb24tobgr15(img, bf->data, imgsize);
|
||||
else if(skin->desktopbpp == 16 && BPP == 32) rgb32tobgr15(img, bf->data, imgsize);
|
||||
else if(skin->desktopbpp == 24 && BPP == 24) rgb24tobgr24(img, bf->data, imgsize);
|
||||
else if(skin->desktopbpp == 24 && BPP == 32) rgb32tobgr24(img, bf->data, imgsize);
|
||||
else if(skin->desktopbpp == 32 && BPP == 24) rgb24tobgr32(img, bf->data, imgsize);
|
||||
else if(skin->desktopbpp == 32 && BPP == 32) rgb32tobgr32(img, bf->data, imgsize);
|
||||
free(img);
|
||||
return bf;
|
||||
}
|
||||
|
||||
/* frees all skin images */
|
||||
static void freeimages(skin_t *skin)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<skin->imagecount; i++)
|
||||
{
|
||||
if(skin->images && skin->images[i])
|
||||
{
|
||||
if(skin->images[i]->data) free(skin->images[i]->data);
|
||||
if(skin->images[i]->name) free(skin->images[i]->name);
|
||||
free(skin->images[i]);
|
||||
}
|
||||
}
|
||||
free(skin->images);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void dumpwidgets(skin_t *skin)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<skin->widgetcount; i++)
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "widget %p id %i\n", skin->widgets[i], skin->widgets[i]->id);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int counttonextchar(const char *s1, char c)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<strlen(s1); i++)
|
||||
if(s1[i] == c) return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *findnextstring(char *temp, const char *desc, int *base)
|
||||
{
|
||||
int len = counttonextchar(*base + desc, ',');
|
||||
memset(temp, 0, strlen(desc) + 1);
|
||||
if(!len) len = strlen(desc);
|
||||
memcpy(temp, *base + desc, len);
|
||||
*base += (len+1);
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void freeskin(skin_t *skin)
|
||||
{
|
||||
unsigned int i;
|
||||
if(skin->skindir)
|
||||
{
|
||||
free(skin->skindir);
|
||||
skin->skindir = NULL;
|
||||
}
|
||||
|
||||
for (i=1; i<=skin->lastusedid; i++)
|
||||
skin->removewidget(skin, i);
|
||||
|
||||
if(skin->widgets)
|
||||
{
|
||||
free(skin->widgets);
|
||||
skin->widgets = NULL;
|
||||
}
|
||||
|
||||
freeimages(skin);
|
||||
for(i=0; i<skin->windowcount; i++)
|
||||
{
|
||||
if(skin->windows[i]->name)
|
||||
{
|
||||
free(skin->windows[i]->name);
|
||||
skin->windows[i]->name = NULL;
|
||||
}
|
||||
free(skin->windows[i]);
|
||||
}
|
||||
|
||||
free(skin->windows);
|
||||
skin->windows = NULL;
|
||||
|
||||
for (i=0; i<skin->fontcount; i++)
|
||||
{
|
||||
unsigned int x;
|
||||
if(skin->fonts[i]->name)
|
||||
{
|
||||
free(skin->fonts[i]->name);
|
||||
skin->fonts[i]->name = NULL;
|
||||
}
|
||||
|
||||
if(skin->fonts[i]->id)
|
||||
{
|
||||
free(skin->fonts[i]->id);
|
||||
skin->fonts[i]->id = NULL;
|
||||
}
|
||||
|
||||
for (x=0; x<skin->fonts[i]->charcount; x++)
|
||||
{
|
||||
free(skin->fonts[i]->chars[x]);
|
||||
skin->fonts[i]->chars[x] = NULL;
|
||||
}
|
||||
|
||||
if(skin->fonts[i]->chars)
|
||||
{
|
||||
free(skin->fonts[i]->chars);
|
||||
skin->fonts[i]->chars = NULL;
|
||||
}
|
||||
|
||||
free(skin->fonts[i]);
|
||||
skin->fonts[i] = NULL;
|
||||
}
|
||||
free(skin->fonts);
|
||||
skin->fonts = NULL;
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN FREE] skin freed\n");
|
||||
#endif
|
||||
free(skin);
|
||||
skin = NULL;
|
||||
}
|
||||
|
||||
static void removewidget(skin_t *skin, int id)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int pos=0;
|
||||
widget **temp = calloc(skin->widgetcount - 1, sizeof(widget *));
|
||||
|
||||
for (i=0; i<skin->widgetcount; i++)
|
||||
{
|
||||
if(skin->widgets[i]->id == id)
|
||||
{
|
||||
if(skin->widgets[i]->label)
|
||||
free(skin->widgets[i]->label);
|
||||
free(skin->widgets[i]);
|
||||
skin->widgets[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp[pos] = skin->widgets[i];
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
if (pos != i)
|
||||
{
|
||||
(skin->widgetcount)--;
|
||||
free(skin->widgets);
|
||||
skin->widgets = temp;
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "removed widget %i\n", id);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
free(temp);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_ERR, "widget %i not found\n", id);
|
||||
}
|
||||
|
||||
static void addwidget(skin_t *skin, window *win, const char *desc)
|
||||
{
|
||||
widget *mywidget;
|
||||
char *temp = calloc(1, strlen(desc) + 1);
|
||||
(skin->widgetcount)++;
|
||||
(skin->lastusedid)++;
|
||||
skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount);
|
||||
mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget));
|
||||
mywidget->id = skin->lastusedid;
|
||||
mywidget->window = win->type;
|
||||
/* parse and fill widget specific info */
|
||||
if(!strncmp(desc, "base", 4))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
mywidget->type = tyBase;
|
||||
mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
|
||||
mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
|
||||
win->base = mywidget;
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n",
|
||||
(mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
|
||||
mywidget->x, mywidget->y, mywidget->width, mywidget->height);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "button", 6))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
int i;
|
||||
mywidget->type = tyButton;
|
||||
mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
|
||||
mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
|
||||
/* Assign corresponding event to the widget */
|
||||
mywidget->msg = evNone;
|
||||
for (i=0; i<evBoxs; i++)
|
||||
{
|
||||
if(!strcmp(temp, evNames[i].name))
|
||||
{
|
||||
mywidget->msg = evNames[i].msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n",
|
||||
(mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
|
||||
mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
int i;
|
||||
/* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */
|
||||
if(!strncmp(desc, "hpotmeter", 9)) mywidget->type = tyHpotmeter;
|
||||
else mywidget->type = tyVpotmeter;
|
||||
mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
|
||||
mywidget->width = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->height = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->bitmap[1] = pngRead(skin, findnextstring(temp, desc, &base));
|
||||
mywidget->phases = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->value = atof(findnextstring(temp, desc, &base));
|
||||
mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wwidth = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wheight = atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
mywidget->msg = evNone;
|
||||
for (i=0; i<evBoxs; i++)
|
||||
{
|
||||
if(!strcmp(temp, evNames[i].name))
|
||||
{
|
||||
mywidget->msg = evNames[i].msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] %s %s %i %i %s %i %f %i %i %i %i msg %i\n",
|
||||
(mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : "[VPOTMETER]",
|
||||
(mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
|
||||
mywidget->width, mywidget->height,
|
||||
(mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL,
|
||||
mywidget->phases, mywidget->value,
|
||||
mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth,
|
||||
mywidget->msg);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "potmeter", 8))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
int i;
|
||||
/* potmeter = phases, numphases, default, X, Y, width, height, message */
|
||||
mywidget->type = tyPotmeter;
|
||||
mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
|
||||
mywidget->phases = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->value = atof(findnextstring(temp, desc, &base));
|
||||
mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
mywidget->msg = evNone;
|
||||
for (i=0; i<evBoxs; i++)
|
||||
{
|
||||
if(!strcmp(temp, evNames[i].name))
|
||||
{
|
||||
mywidget->msg=evNames[i].msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [POTMETER] %s %i %i %i %f %i %i msg %i\n",
|
||||
(mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
|
||||
mywidget->width, mywidget->height,
|
||||
mywidget->phases, mywidget->value,
|
||||
mywidget->x, mywidget->y,
|
||||
mywidget->msg);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "menu", 4))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
int i;
|
||||
mywidget->type = tyMenu;
|
||||
mywidget->wx=atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->x=0;
|
||||
mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
mywidget->msg = evNone;
|
||||
for (i=0; i<evBoxs; i++)
|
||||
{
|
||||
if(!strcmp(temp, evNames[i].name))
|
||||
{
|
||||
mywidget->msg = evNames[i].msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n",
|
||||
mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "selected", 8))
|
||||
{
|
||||
win->base->bitmap[1] = pngRead(skin, (char *) desc + 9);
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "slabel",6))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
unsigned int i;
|
||||
mywidget->type = tySlabel;
|
||||
mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
mywidget->font = NULL;
|
||||
for (i=0; i<skin->fontcount; i++)
|
||||
{
|
||||
if(!strcmp(temp, skin->fonts[i]->name))
|
||||
{
|
||||
mywidget->font = skin->fonts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
mywidget->label = strdup(findnextstring(temp, desc, &base));
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n",
|
||||
mywidget->x, mywidget->y, mywidget->font->name, mywidget->label);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "dlabel", 6))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
unsigned int i;
|
||||
mywidget->type = tyDlabel;
|
||||
mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->length = atoi(findnextstring(temp, desc, &base));
|
||||
mywidget->align = atoi(findnextstring(temp, desc, &base));
|
||||
findnextstring(temp, desc, &base);
|
||||
mywidget->font = NULL;
|
||||
for (i=0; i<skin->fontcount; i++)
|
||||
{
|
||||
if(!strcmp(temp, skin->fonts[i]->name))
|
||||
{
|
||||
mywidget->font=skin->fonts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
mywidget->label=strdup(findnextstring(temp, desc, &base));
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n",
|
||||
mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label);
|
||||
#endif
|
||||
}
|
||||
free(temp);
|
||||
}
|
||||
|
||||
static void loadfonts(skin_t* skin)
|
||||
{
|
||||
unsigned int x;
|
||||
for (x=0; x<skin->fontcount; x++)
|
||||
{
|
||||
FILE *fp;
|
||||
int linenumber=0;
|
||||
char *filename;
|
||||
char *tmp = calloc(1, MAX_LINESIZE);
|
||||
char *desc = calloc(1, MAX_LINESIZE);
|
||||
filename = calloc(1, strlen(skin->skindir) + strlen(skin->fonts[x]->name) + 6);
|
||||
sprintf(filename, "%s\\%s.fnt", skin->skindir, skin->fonts[x]->name);
|
||||
if(!(fp = fopen(filename,"rb")))
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_ERR, "[FONT LOAD] Font not found \"%s\"\n", skin->fonts[x]->name);
|
||||
return;
|
||||
}
|
||||
while(!feof(fp))
|
||||
{
|
||||
int pos = 0;
|
||||
unsigned int i;
|
||||
fgets(tmp, MAX_LINESIZE, fp);
|
||||
linenumber++;
|
||||
memset(desc, 0, MAX_LINESIZE);
|
||||
for (i=0; i<strlen(tmp); i++)
|
||||
{
|
||||
/* remove spaces and linebreaks */
|
||||
if((tmp[i] == ' ') || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
|
||||
/* remove comments */
|
||||
if((tmp[i] == ';') && ((i < 1) || (tmp[i-1] != '\"')))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT LOAD] Comment: %s", tmp + i + 1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
desc[pos] = tmp[i];
|
||||
pos++;
|
||||
}
|
||||
if(!strlen(desc)) continue;
|
||||
/* now we have "readable" output -> parse it */
|
||||
if(!strncmp(desc, "image", 5))
|
||||
{
|
||||
skin->fonts[x]->image = pngRead(skin, desc + 6);
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [IMAGE] \"%s\"\n", desc + 6);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
int base = 4;
|
||||
if(*desc != '"') break;
|
||||
if(*(desc + 1) == 0) break;
|
||||
(skin->fonts[x]->charcount)++;
|
||||
skin->fonts[x]->chars = realloc(skin->fonts[x]->chars, sizeof(char_t *) *skin->fonts[x]->charcount);
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]=calloc(1, sizeof(char_t));
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c = ((*(desc + 1) == '"') && (*(desc + 2) != '"')) ? ' ': *(desc + 1);
|
||||
if((*(desc + 1) == '"') && (*(desc + 2) != '"')) base = 3;
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x = atoi(findnextstring(tmp, desc, &base));
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y = atoi(findnextstring(tmp, desc, &base));
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width = atoi(findnextstring(tmp, desc, &base));
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height = atoi(findnextstring(tmp, desc, &base));
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [CHAR] %c %i %i %i %i\n",
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c,
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x,
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y,
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width,
|
||||
skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(desc);
|
||||
free(filename);
|
||||
free(tmp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
skin_t* loadskin(char* skindir, int desktopbpp)
|
||||
{
|
||||
FILE *fp;
|
||||
int reachedendofwindow = 0;
|
||||
int linenumber = 0;
|
||||
skin_t *skin = calloc(1, sizeof(skin_t));
|
||||
char *filename;
|
||||
char *tmp = calloc(1, MAX_LINESIZE);
|
||||
char *desc = calloc(1, MAX_LINESIZE);
|
||||
window* mywindow = NULL;
|
||||
|
||||
/* init swscaler */
|
||||
sws_rgb2rgb_init(get_sws_cpuflags());
|
||||
/* setup funcs */
|
||||
skin->freeskin = freeskin;
|
||||
skin->pngRead = pngRead;
|
||||
skin->addwidget = addwidget;
|
||||
skin->removewidget = removewidget;
|
||||
skin->geteventname = geteventname;
|
||||
skin->desktopbpp = desktopbpp;
|
||||
skin->skindir = strdup(skindir);
|
||||
|
||||
filename = calloc(1, strlen(skin->skindir) + strlen("skin") + 2);
|
||||
sprintf(filename, "%s\\skin", skin->skindir);
|
||||
if(!(fp = fopen(filename, "rb")))
|
||||
{
|
||||
mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[SKIN LOAD] Skin \"%s\" not found\n", skindir);
|
||||
skin->freeskin(skin);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while(!feof(fp))
|
||||
{
|
||||
int pos = 0;
|
||||
unsigned int i;
|
||||
int insidequote = 0;
|
||||
fgets(tmp, MAX_LINESIZE, fp);
|
||||
linenumber++;
|
||||
memset(desc, 0, MAX_LINESIZE);
|
||||
for (i=0; i<strlen(tmp); i++)
|
||||
{
|
||||
if((tmp[i] == '"') && !insidequote) { insidequote=1; continue; }
|
||||
else if((tmp[i] == '"') && insidequote) { insidequote=0 ; continue; }
|
||||
/* remove spaces and linebreaks */
|
||||
if((!insidequote && (tmp[i] == ' ')) || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
|
||||
/* remove comments */
|
||||
else if(tmp[i] == ';')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN LOAD] Comment: %s", tmp + i + 1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
desc[pos] = tmp[i];
|
||||
pos++;
|
||||
}
|
||||
|
||||
if(!strlen(desc)) continue;
|
||||
/* now we have "readable" output -> parse it */
|
||||
/* parse window specific info */
|
||||
if(!strncmp(desc, "section", 7))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [SECTION] \"%s\"\n", desc + 8);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "window", 6))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [WINDOW] \"%s\"\n", desc + 7);
|
||||
#endif
|
||||
reachedendofwindow = 0;
|
||||
(skin->windowcount)++;
|
||||
skin->windows = realloc(skin->windows, sizeof(window *) * skin->windowcount);
|
||||
mywindow = skin->windows[(skin->windowcount) - 1] = calloc(1, sizeof(window));
|
||||
mywindow->name = strdup(desc + 7);
|
||||
if(!strncmp(desc + 7, "main", 4)) mywindow->type = wiMain;
|
||||
else if(!strncmp(desc+7, "sub", 3))
|
||||
{
|
||||
mywindow->type = wiSub;
|
||||
mywindow->decoration = 1;
|
||||
}
|
||||
else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu;
|
||||
else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar;
|
||||
else mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN] warning found unknown windowtype");
|
||||
}
|
||||
else if(!strncmp(desc, "decoration", 10) && !strncmp(desc + 11, "enable", 6))
|
||||
{
|
||||
mywindow->decoration = 1;
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [DECORATION] enabled decoration for window \"%s\"\n", mywindow->name);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "background", 10))
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
char temp[MAX_LINESIZE];
|
||||
mywindow->backgroundcolor[0] = atoi(findnextstring(temp, desc, &base));
|
||||
mywindow->backgroundcolor[1] = atoi(findnextstring(temp, desc, &base));
|
||||
mywindow->backgroundcolor[2] = atoi(findnextstring(temp, desc, &base));
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [BACKGROUND] window \"%s\" has backgroundcolor (%i,%i,%i)\n", mywindow->name,
|
||||
mywindow->backgroundcolor[0],
|
||||
mywindow->backgroundcolor[1],
|
||||
mywindow->backgroundcolor[2]);
|
||||
#endif
|
||||
}
|
||||
else if(!strncmp(desc, "end", 3))
|
||||
{
|
||||
if(reachedendofwindow)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [END] of section\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
reachedendofwindow = 1;
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [END] of window \"%s\"\n", mywindow->name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if(!strncmp(desc, "font", 4))
|
||||
{
|
||||
unsigned int i;
|
||||
int id = 0;
|
||||
char temp[MAX_LINESIZE];
|
||||
int base = counttonextchar(desc, '=')+1;
|
||||
findnextstring(temp, desc, &base);
|
||||
findnextstring(temp, desc, &base);
|
||||
for (i=0; i<skin->fontcount; i++)
|
||||
if(!strcmp(skin->fonts[i]->id, temp))
|
||||
{
|
||||
id = i;
|
||||
break;
|
||||
}
|
||||
if(!id)
|
||||
{
|
||||
int base = counttonextchar(desc, '=') + 1;
|
||||
findnextstring(temp, desc, &base);
|
||||
id = skin->fontcount;
|
||||
(skin->fontcount)++;
|
||||
skin->fonts = realloc(skin->fonts, sizeof(font_t *) * skin->fontcount);
|
||||
skin->fonts[id]=calloc(1, sizeof(font_t));
|
||||
skin->fonts[id]->name = strdup(temp);
|
||||
skin->fonts[id]->id = strdup(findnextstring(temp, desc, &base));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [FONT] id \"%s\" name \"%s\"\n", skin->fonts[id]->name, skin->fonts[id]->id);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
skin->addwidget(skin, mywindow, desc);
|
||||
}
|
||||
|
||||
free(desc);
|
||||
free(filename);
|
||||
free(tmp);
|
||||
fclose(fp);
|
||||
loadfonts(skin);
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN LOAD] loaded skin \"%s\"\n", skin->skindir);
|
||||
/* dumpwidgets(skin); */
|
||||
return skin;
|
||||
}
|
213
Gui/win32/skinload.h
Normal file
213
Gui/win32/skinload.h
Normal file
@ -0,0 +1,213 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _SKINLOAD_H
|
||||
#define _SKINLOAD_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name; /* image name */
|
||||
int size; /* image data size in bytes */
|
||||
int width; /* image width */
|
||||
int height; /* image height */
|
||||
char *data; /* pointer to image data */
|
||||
} image;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char c;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} char_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
char *id;
|
||||
image *image;
|
||||
unsigned int charcount;
|
||||
char_t **chars;
|
||||
} font_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; /* widget id */
|
||||
int type; /* widget type */
|
||||
int window; /* the window it belongs to */
|
||||
// ---
|
||||
int x, y; /* x and y position the button */
|
||||
int wx, wy; /* x and y postion of the widget */
|
||||
int width, height; /* width and height of the button */
|
||||
int wwidth, wheight; /* width and height of the widget */
|
||||
// ---
|
||||
// ---
|
||||
int msg, msg2;
|
||||
int pressed, tmp;
|
||||
int key, key2;
|
||||
int phases;
|
||||
float value;
|
||||
image *bitmap[2]; /* Associated image(s) in imagepool */
|
||||
// ---
|
||||
font_t *font;
|
||||
int length;
|
||||
int align;
|
||||
char *label;
|
||||
// ---
|
||||
int event;
|
||||
} widget;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int decoration;
|
||||
int type;
|
||||
widget *base;
|
||||
int backgroundcolor[3];
|
||||
void *priv;
|
||||
} window;
|
||||
|
||||
typedef struct skin_t skin_t;
|
||||
struct skin_t
|
||||
{
|
||||
char *skindir;
|
||||
unsigned int widgetcount; /* number of widgets */
|
||||
unsigned int lastusedid; /* which widget id was used last */
|
||||
widget **widgets; /* widget handle */
|
||||
unsigned int imagecount; /* number of images */
|
||||
image **images; /* image handle */
|
||||
int desktopbpp; /* image format of those images */
|
||||
unsigned int fontcount;
|
||||
font_t **fonts;
|
||||
|
||||
unsigned int windowcount; /* number of windows */
|
||||
window **windows;
|
||||
void (*freeskin)(skin_t* skin);
|
||||
void (*addwidget)(skin_t *skin, window *win, const char *desc);
|
||||
void (*removewidget)(skin_t *skin, int id);
|
||||
char *(*geteventname)(int event);
|
||||
image *(*pngRead)(skin_t *skin, unsigned char *fname);
|
||||
};
|
||||
|
||||
extern skin_t *loadskin(char *skindir, int desktopbpp);
|
||||
|
||||
// --- Widget types ---
|
||||
|
||||
#define tyBase 1
|
||||
#define tyButton 2
|
||||
#define tyHpotmeter 3
|
||||
#define tyVpotmeter 4
|
||||
#define tyPotmeter 5
|
||||
#define tyMenu 6
|
||||
#define tySlabel 7
|
||||
#define tyDlabel 8
|
||||
|
||||
// --- Window types ---
|
||||
|
||||
#define wiMain 1
|
||||
#define wiSub 2
|
||||
#define wiMenu 3
|
||||
#define wiPlaybar 4
|
||||
|
||||
// --- User events ------
|
||||
|
||||
#define evNone 0
|
||||
#define evPlay 1
|
||||
#define evStop 2
|
||||
#define evPause 3
|
||||
#define evPrev 6
|
||||
#define evNext 7
|
||||
#define evLoad 8
|
||||
#define evEqualizer 9
|
||||
#define evPlayList 10
|
||||
#define evIconify 11
|
||||
#define evAbout 12
|
||||
#define evLoadPlay 13
|
||||
#define evPreferences 14
|
||||
#define evSkinBrowser 15
|
||||
#define evPlaySwitchToPause 16
|
||||
#define evPauseSwitchToPlay 17
|
||||
|
||||
#define evBackward10sec 18
|
||||
#define evForward10sec 19
|
||||
#define evBackward1min 20
|
||||
#define evForward1min 21
|
||||
#define evBackward10min 22
|
||||
#define evForward10min 23
|
||||
|
||||
#define evNormalSize 24
|
||||
#define evDoubleSize 25
|
||||
#define evFullScreen 26
|
||||
|
||||
#define evSetMoviePosition 27
|
||||
#define evSetVolume 28
|
||||
#define evSetBalance 29
|
||||
#define evMute 30
|
||||
|
||||
#define evIncVolume 31
|
||||
#define evDecVolume 32
|
||||
#define evIncAudioBufDelay 33
|
||||
#define evDecAudioBufDelay 34
|
||||
#define evIncBalance 35
|
||||
#define evDecBalance 36
|
||||
|
||||
#define evHelp 37
|
||||
|
||||
#define evLoadSubtitle 38
|
||||
#define evDropSubtitle 43
|
||||
#define evPlayDVD 39
|
||||
#define evPlayVCD 40
|
||||
#define evPlayNetwork 41
|
||||
#define evLoadAudioFile 42
|
||||
#define evSetAspect 44
|
||||
#define evSetAudio 45
|
||||
#define evSetVideo 46
|
||||
#define evDropFile 47
|
||||
#define evPlayCD 48
|
||||
|
||||
#define evExit 1000
|
||||
|
||||
// --- General events ---
|
||||
|
||||
#define evFileLoaded 5000
|
||||
#define evHideMouseCursor 5001
|
||||
#define evMessageBox 5002
|
||||
#define evGeneralTimer 5003
|
||||
#define evGtkIsOk 5004
|
||||
#define evShowPopUpMenu 5005
|
||||
#define evHidePopUpMenu 5006
|
||||
#define evSetDVDAudio 5007
|
||||
#define evSetDVDSubtitle 5008
|
||||
#define evSetDVDTitle 5009
|
||||
#define evSetDVDChapter 5010
|
||||
#define evSubtitleLoaded 5011
|
||||
#define evSetVCDTrack 5012
|
||||
#define evSetURL 5013
|
||||
|
||||
#define evFName 7000
|
||||
#define evMovieTime 7001
|
||||
#define evRedraw 7002
|
||||
#define evHideWindow 7003
|
||||
#define evShowWindow 7004
|
||||
#define evFirstLoad 7005
|
||||
|
||||
#endif
|
350
Gui/win32/widgetrender.c
Normal file
350
Gui/win32/widgetrender.c
Normal file
@ -0,0 +1,350 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <windows.h>
|
||||
#include <interface.h>
|
||||
#include "gui.h"
|
||||
|
||||
extern char *codecname;
|
||||
#define MAX_LABELSIZE 250
|
||||
|
||||
static void render(int bitsperpixel, image *dst, image *src, int x, int y, int sx, int sy, int sw, int sh, int transparent)
|
||||
{
|
||||
int i;
|
||||
int bpp = bitsperpixel / 8;
|
||||
int offset = (dst->width * bpp * y) + (x * bpp);
|
||||
int soffset = (src->width * bpp * sy) + (sx * bpp);
|
||||
|
||||
for(i=0; i<sh; i++)
|
||||
{
|
||||
int c;
|
||||
for(c=0; c < (sw * bpp); c += bpp)
|
||||
{
|
||||
if(bpp == 2)
|
||||
{
|
||||
if(!transparent || (((src->data + soffset + (i * src->width * bpp) + c)[0] != 0x1f)
|
||||
&& ((src->data + soffset + (i * src->width * bpp) + c)[1] != 0x7c)))
|
||||
memcpy(dst->data + offset + c, src->data + soffset + (i * src->width * bpp) + c, bpp);
|
||||
}
|
||||
else if(bpp > 2)
|
||||
{
|
||||
if(!transparent || *((unsigned int *) (src->data + soffset + (i * src->width * bpp) + c)) != 0x00ff00ff)
|
||||
memcpy(dst->data + offset + c, src->data + soffset + (i * src->width * bpp) + c, bpp);
|
||||
}
|
||||
}
|
||||
offset += (dst->width * bpp);
|
||||
}
|
||||
}
|
||||
|
||||
static image *find_background(skin_t *skin, widget *item)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i < skin->windowcount; i++)
|
||||
if(skin->windows[i]->type == item->window)
|
||||
return skin->windows[i]->base->bitmap[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* FONT related functions */
|
||||
/******************************************************************/
|
||||
|
||||
/* returns the pos of s2 inside s1 or -1 if s1 doesn't contain s2 */
|
||||
static int strpos(char *s1, const char* s2)
|
||||
{
|
||||
unsigned int i, x;
|
||||
for (i=0; i < strlen(s1); i++)
|
||||
{
|
||||
if(s1[i] == s2[0])
|
||||
{
|
||||
if(strlen(s1 + i) >= strlen(s2))
|
||||
{
|
||||
for (x=0; x <strlen(s2); x++)
|
||||
if(s1[i + x] != s2[x]) break;
|
||||
if(x == strlen(s2)) return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* replaces all occurences of what in dest with format */
|
||||
static void stringreplace(char *dest, const char *what, const char *format, ... )
|
||||
{
|
||||
char tmp[MAX_LABELSIZE];
|
||||
int offset=0;
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsnprintf(tmp, MAX_LABELSIZE, format, va);
|
||||
va_end(va);
|
||||
/* no search string == replace the entire string */
|
||||
if(!what)
|
||||
{
|
||||
memcpy(dest, tmp, strlen(tmp));
|
||||
dest[strlen(tmp)] = 0;
|
||||
return;
|
||||
}
|
||||
while((offset = strpos(dest, what)) != -1)
|
||||
{
|
||||
memmove(dest + offset + strlen(tmp), dest + offset + strlen(what), strlen(dest + offset + strlen(what)) + 1);
|
||||
memcpy(dest + offset, tmp, strlen(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
/* replaces the chars with special meaning with the associated data from the player info struct */
|
||||
static char *generatetextfromlabel(widget *item)
|
||||
{
|
||||
char *text = malloc(MAX_LABELSIZE);
|
||||
char tmp[MAX_LABELSIZE];
|
||||
unsigned int i;
|
||||
if(!item)
|
||||
{
|
||||
free(text);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(text, item->label);
|
||||
if(item->type == tySlabel) return text;
|
||||
stringreplace(text, "$1", "%.2i:%.2i:%.2i", guiIntfStruct.TimeSec / 3600,
|
||||
(guiIntfStruct.TimeSec / 60) % 60, guiIntfStruct.TimeSec % 60);
|
||||
stringreplace(text, "$2", "%.4i:%.2i", guiIntfStruct.TimeSec / 60, guiIntfStruct.TimeSec % 60);
|
||||
stringreplace(text, "$3", "%.2i", guiIntfStruct.TimeSec / 3600);
|
||||
stringreplace(text, "$4", "%.2i", (guiIntfStruct.TimeSec / 60) % 60);
|
||||
stringreplace(text, "$5", "%.2i", guiIntfStruct.TimeSec % 60);
|
||||
stringreplace(text, "$6", "%.2i:%.2i:%.2i", guiIntfStruct.LengthInSec / 3600,
|
||||
(guiIntfStruct.LengthInSec / 60) % 60, guiIntfStruct.LengthInSec % 60);
|
||||
stringreplace(text, "$7", "%.4i:%.2i", guiIntfStruct.LengthInSec / 60, guiIntfStruct.LengthInSec % 60);
|
||||
stringreplace(text, "$8", "%i:%.2i:%.2i", guiIntfStruct.TimeSec / 3600,
|
||||
(guiIntfStruct.TimeSec / 60) % 60, guiIntfStruct.TimeSec % 60);
|
||||
stringreplace(text, "$v", "%3.2f", guiIntfStruct.Volume);
|
||||
stringreplace(text, "$V", "%3.1f", guiIntfStruct.Volume);
|
||||
stringreplace(text, "$b", "%3.2f", guiIntfStruct.Balance);
|
||||
stringreplace(text, "$B", "%3.1f", guiIntfStruct.Balance);
|
||||
stringreplace(text, "$t", "%.2i", guiIntfStruct.Track);
|
||||
stringreplace(text, "$o", "%s", guiIntfStruct.Filename);
|
||||
stringreplace(text, "$x", "%i", guiIntfStruct.MovieWidth);
|
||||
stringreplace(text, "$y", "%i", guiIntfStruct.MovieHeight);
|
||||
stringreplace(text, "$C", "%s", guiIntfStruct.sh_video ? codecname : "");
|
||||
stringreplace(text, "$$", "$");
|
||||
|
||||
if(!strcmp(text, "$p") || !strcmp(text, "$s") || !strcmp(text, "$e"))
|
||||
{
|
||||
if(guiIntfStruct.Playing == 0) stringreplace(text, NULL, "s");
|
||||
else if(guiIntfStruct.Playing == 1) stringreplace(text, NULL, "p");
|
||||
else if(guiIntfStruct.Playing == 2) stringreplace(text, NULL, "e");
|
||||
}
|
||||
|
||||
if(guiIntfStruct.AudioType == 0) stringreplace(text, "$a", "n");
|
||||
else if(guiIntfStruct.AudioType == 1) stringreplace(text, "$a", "m");
|
||||
else stringreplace(text, "$a", "t");
|
||||
|
||||
if(guiIntfStruct.StreamType == 0)
|
||||
stringreplace(text, "$T", "f");
|
||||
#ifdef USE_DVDREAD
|
||||
else if(guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_DVDNAV)
|
||||
stringreplace(text, "$T", "d");
|
||||
#endif
|
||||
else stringreplace(text, "$T", "u");
|
||||
|
||||
if(guiIntfStruct.Filename)
|
||||
{
|
||||
for (i=0; i<strlen(guiIntfStruct.Filename); i++)
|
||||
tmp[i] = tolower(guiIntfStruct.Filename[i]);
|
||||
stringreplace(text, "$f", tmp);
|
||||
|
||||
for (i=0; i<strlen(guiIntfStruct.Filename); i++)
|
||||
tmp[i] = toupper(guiIntfStruct.Filename[i]);
|
||||
stringreplace(text, "$F", tmp);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/* cuts text to buflen scrolling from right to left */
|
||||
static void scrolltext(char *text, unsigned int buflen, float *value)
|
||||
{
|
||||
char *buffer = (char *) malloc(buflen + 1);
|
||||
unsigned int x,i;
|
||||
if(*value < buflen) x = 0;
|
||||
else x = *value - buflen;
|
||||
memset(buffer, ' ', buflen);
|
||||
for (i = (*value>=buflen) ? 0 : buflen - *value; i<buflen; i++)
|
||||
{
|
||||
if(x < strlen(text))
|
||||
buffer[i] = text[x];
|
||||
x++;
|
||||
}
|
||||
buffer[buflen] = 0;
|
||||
*value += 1.0f;
|
||||
if(*value >= strlen(text) + buflen) *value = 0.0f;
|
||||
strcpy(text, buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
/* updates all dlabels and slabels */
|
||||
void renderinfobox(skin_t *skin, window_priv_t *priv)
|
||||
{
|
||||
unsigned int i;
|
||||
if (!priv) return;
|
||||
|
||||
/* repaint the area behind the text*/
|
||||
/* we have to do this for all labels here, because they may overlap in buggy skins ;( */
|
||||
|
||||
for (i=0; i<skin->widgetcount; i++)
|
||||
if((skin->widgets[i]->type == tyDlabel) || (skin->widgets[i]->type == tySlabel))
|
||||
{
|
||||
if(skin->widgets[i]->window == priv->type)
|
||||
render(skin->desktopbpp,
|
||||
&priv->img,
|
||||
find_background(skin, skin->widgets[i]),
|
||||
skin->widgets[i]->x,
|
||||
skin->widgets[i]->y,
|
||||
skin->widgets[i]->x,
|
||||
skin->widgets[i]->y,
|
||||
skin->widgets[i]->length,
|
||||
skin->widgets[i]->font->chars[0]->height,
|
||||
1);
|
||||
}
|
||||
|
||||
/* load all slabels and dlabels */
|
||||
for (i=0; i<skin->widgetcount; i++)
|
||||
{
|
||||
widget *item = skin->widgets[i];
|
||||
if(item->window != priv->type) continue;
|
||||
if((i == skin->widgetcount) || (item->type == tyDlabel) || (item->type == tySlabel))
|
||||
{
|
||||
char *text = generatetextfromlabel(item);
|
||||
unsigned int current, c;
|
||||
int offset = 0;
|
||||
unsigned int textlen;
|
||||
if(!text) continue;
|
||||
textlen = strlen(text);
|
||||
|
||||
/* render(win, win->background, gui->skin->widgets[i]->x, gui->skin->widgets[i]->y,
|
||||
gui->skin->widgets[i]->x, gui->skin->widgets[i]->y,
|
||||
gui->skin->widgets[i]->length, gui->skin->widgets[i]->font->chars[0]->height,1); */
|
||||
|
||||
/* calculate text size */
|
||||
for (current=0; current<textlen; current++)
|
||||
{
|
||||
for (c=0; c<item->font->charcount; c++)
|
||||
if(item->font->chars[c]->c == text[current])
|
||||
{
|
||||
offset += item->font->chars[c]->width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* labels can be scrolled if they are to big */
|
||||
if((item->type == tyDlabel) && (item->length < offset))
|
||||
{
|
||||
int tomuch = (offset - item->length) / (offset /textlen);
|
||||
scrolltext(text, textlen - tomuch - 1, &skin->widgets[i]->value);
|
||||
textlen = strlen(text);
|
||||
}
|
||||
|
||||
/* align the text */
|
||||
if(item->align == 1)
|
||||
offset = (item->length-offset) / 2;
|
||||
else if(item->align == 2)
|
||||
offset = item->length-offset;
|
||||
else
|
||||
offset = 0;
|
||||
|
||||
if(offset < 0) offset = 0;
|
||||
|
||||
/* render the text */
|
||||
for (current=0; current<textlen; current++)
|
||||
{
|
||||
for (c=0; c<item->font->charcount; c++)
|
||||
{
|
||||
char_t *cchar = item->font->chars[c];
|
||||
if(cchar->c == *(text + current))
|
||||
{
|
||||
render(skin->desktopbpp,
|
||||
&priv->img,
|
||||
item->font->image,
|
||||
item->x + offset,
|
||||
item->y,
|
||||
cchar->x,
|
||||
cchar->y,
|
||||
(cchar->width + offset > item->length) ? item->length - offset : cchar->width,
|
||||
cchar->height,
|
||||
1);
|
||||
offset += cchar->width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* WIDGET related functions */
|
||||
/******************************************************************/
|
||||
|
||||
void renderwidget(skin_t *skin, image *dest, widget *item, int state)
|
||||
{
|
||||
if(!dest) return;
|
||||
image *img = NULL;
|
||||
int height;
|
||||
int y;
|
||||
if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyPotmeter))
|
||||
img = item->bitmap[0];
|
||||
|
||||
if(!img) return;
|
||||
|
||||
y = item->y;
|
||||
if(item->type == tyPotmeter)
|
||||
{
|
||||
height = img->height / item->phases;
|
||||
y = height * (int)(item->value * item->phases / 100);
|
||||
if(y > img->height-height)
|
||||
y = img->height - height;
|
||||
}
|
||||
else
|
||||
{
|
||||
height = img->height / 3;
|
||||
y = state * height;
|
||||
}
|
||||
|
||||
/* redraw background */
|
||||
if(item->type == tyButton)
|
||||
render(skin->desktopbpp, dest, find_background(skin,item), item->x, item->y, item->x, item->y, img->width, height, 1);
|
||||
|
||||
if((item->type == tyHpotmeter) || (item->type == tyPotmeter))
|
||||
{
|
||||
/* repaint the area behind the slider */
|
||||
render(skin->desktopbpp, dest, find_background(skin, item), item->wx, item->wy, item->wx, item->wy, item->wwidth, item->height, 1);
|
||||
item->x = item->value * (item->wwidth-item->width) / 100 + item->wx;
|
||||
if((item->x + item->width) > (item->wx + item->wwidth))
|
||||
item->x = item->wx + item->wwidth - item->width;
|
||||
if(item->x < item->wx)
|
||||
item->x = item->wx;
|
||||
/* workaround for blue */
|
||||
if(item->type == tyHpotmeter)
|
||||
height = (item->height < img->height / 3) ? item->height : img->height / 3;
|
||||
}
|
||||
render(skin->desktopbpp, dest, img, item->x, item->y, 0, y, img->width, height, 1);
|
||||
}
|
143
Gui/win32/wincfg.c
Normal file
143
Gui/win32/wincfg.c
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mp_msg.h>
|
||||
#include <help_mp.h>
|
||||
|
||||
#include <m_config.h>
|
||||
#include <m_option.h>
|
||||
#include <libvo/video_out.h>
|
||||
#include <mixer.h>
|
||||
#include "wincfg.h"
|
||||
#include "interface.h"
|
||||
|
||||
/* params */
|
||||
int gtkAONorm = 0;
|
||||
int gtkAOExtraStereo = 0;
|
||||
float gtkAOExtraStereoMul = 1.0;
|
||||
int gtkCacheOn = 0;
|
||||
int gtkCacheSize = 2048;
|
||||
int gtkAutoSyncOn = 0;
|
||||
int gtkAutoSync = 0;
|
||||
|
||||
int sub_window = 0;
|
||||
int console = 0;
|
||||
|
||||
int gui_save_pos = 1;
|
||||
int gui_main_pos_x = -2;
|
||||
int gui_main_pos_y = -2;
|
||||
int gui_sub_pos_x = -1;
|
||||
int gui_sub_pos_y = -1;
|
||||
|
||||
/* External functions */
|
||||
extern int frame_dropping;
|
||||
extern char *proc_priority;
|
||||
extern int m_config_parse_config_file(m_config_t *config, char *conffile);
|
||||
|
||||
static m_config_t *gui_conf;
|
||||
static m_option_t gui_opts[] =
|
||||
{
|
||||
{ "priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{ "vo_driver", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
|
||||
{ "v_framedrop", &frame_dropping, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL },
|
||||
{ "vo_doublebuffering", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "vo_direct_render", &vo_directrendering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "ao_driver", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
|
||||
{ "ao_volnorm", >kAONorm, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "softvol", &soft_vol, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "ao_extra_stereo", >kAOExtraStereo, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "ao_extra_stereo_coefficient", >kAOExtraStereoMul, CONF_TYPE_FLOAT, CONF_RANGE, -10, 10, NULL },
|
||||
{ "delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
|
||||
{ "dvd_device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
|
||||
{ "cdrom_device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
|
||||
{ "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL },
|
||||
{ "cache", >kCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "cache_size", >kCacheSize, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL },
|
||||
{ "autosync", >kAutoSyncOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
|
||||
{ "autosync_size", >kAutoSync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL },
|
||||
{ "gui_skin", &skinName, CONF_TYPE_STRING, 0, 0, 0, NULL },
|
||||
{ "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
|
||||
{ "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
|
||||
{ "gui_sub_pos_x", &gui_sub_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
|
||||
{ "gui_sub_pos_y", &gui_sub_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
|
||||
{ "sub_window", &sub_window, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{ "console", &console, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{ NULL, NULL, 0, 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
char *gfgets(char *str, int size, FILE *f)
|
||||
{
|
||||
char *s = fgets(str, size, f);
|
||||
char c;
|
||||
if(s)
|
||||
{
|
||||
c = s[strlen(s) - 1];
|
||||
if ((c == '\n') || (c == '\r'))
|
||||
s[strlen(s) - 1]=0;
|
||||
c = s[strlen(s) - 1];
|
||||
if ((c == '\n') || (c == '\r'))
|
||||
s[strlen(s) - 1]=0;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int cfg_read(void)
|
||||
{
|
||||
char *cfg = get_path("gui.conf");
|
||||
|
||||
/* read configuration */
|
||||
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] [cfg] reading config file: %s\n", cfg);
|
||||
gui_conf = m_config_new();
|
||||
m_config_register_options(gui_conf, gui_opts);
|
||||
if (m_config_parse_config_file(gui_conf, cfg) < 0)
|
||||
mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_ConfigFileError);
|
||||
free(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cfg_write(void)
|
||||
{
|
||||
char *cfg = get_path("gui.conf");
|
||||
FILE *f;
|
||||
int i;
|
||||
|
||||
/* save configuration */
|
||||
if ((f = fopen(cfg, "wt+")))
|
||||
{
|
||||
for (i=0; gui_opts[i].name; i++)
|
||||
{
|
||||
char *v = m_option_print(&gui_opts[i], gui_opts[i].p);
|
||||
if(v)
|
||||
{
|
||||
fprintf(f, "%s = \"%s\"\n", gui_opts[i].name, v);
|
||||
free(v);
|
||||
}
|
||||
else if((int) v == -1)
|
||||
mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, gui_opts[i].name);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
free(cfg);
|
||||
return 0;
|
||||
}
|
38
Gui/win32/wincfg.h
Normal file
38
Gui/win32/wincfg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
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 program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _WINCFG_H
|
||||
#define _WINCFG_H
|
||||
|
||||
extern char *skinName;
|
||||
extern int sub_window;
|
||||
extern int console;
|
||||
|
||||
extern int gui_save_pos;
|
||||
extern int gui_main_pos_x;
|
||||
extern int gui_main_pos_y;
|
||||
extern int gui_sub_pos_x;
|
||||
extern int gui_sub_pos_y;
|
||||
|
||||
extern int cfg_read(void);
|
||||
extern int cfg_write(void);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user