1 /*
2  * MPlayer GUI for Win32
3  * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
4  * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
5  * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
6  *
7  * This file is part of MPlayer.
8  *
9  * MPlayer is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * MPlayer is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with MPlayer; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef MPLAYER_GUI_GUI_H
25 #define MPLAYER_GUI_GUI_H
26 
27 #include "mplayer.h"
28 #include "playtree.h"
29 #include "m_config.h"
30 #include "skinload.h"
31 #include "playlist.h"
32 
33 /* Name of the program the GUI utilizes */
34 #define MPlayer "MPlayer"
35 
36 extern float video_aspect;
37 extern play_tree_t* playtree;
38 extern int video_window;
39 extern int console;
40 extern NOTIFYICONDATA nid;
41 extern const char *codecname;
42 
43 typedef struct window_priv_t window_priv_t;
44 struct window_priv_t
45 {
46     HWND hwnd;
47     image img;
48     image *background;
49     HBITMAP bitmap;
50     int type;
51 };
52 
53 typedef struct gui_t gui_t;
54 struct gui_t
55 {
56     /* screenproperties */
57     int screenw, screenh, screenbpp;
58     /* window related stuff */
59     char *classname;
60     HICON icon;
61     unsigned int window_priv_count;
62     window_priv_t **window_priv;
63 
64     HWND mainwindow;
65     HWND videowindow;
66 
67     /* for event handling */
68     widget *activewidget;
69 
70     int mousewx, mousewy; /* mousepos inside widget */
71     int mousex, mousey;
72 
73     HMENU menu;
74     HMENU diskmenu;
75     HMENU traymenu;
76     HMENU trayplaymenu;
77     HMENU trayplaybackmenu;
78     HMENU videomenu;
79     HMENU subtitlemenu;
80     HMENU aspectmenu;
81     HMENU dvdmenu;
82     HMENU playlistmenu;
83 
84     int skinbrowserwindow;
85     int playlistwindow;
86     int aboutwindow;
87 
88     float default_volume;
89     float default_balance;
90 
91     skin_t *skin;
92     playlist_t *playlist;
93 
94     void (*startplay)(gui_t *gui);
95     void (*updatedisplay)(gui_t *gui, HWND hwnd);
96     void (*playercontrol)(int event);   /* userdefine call back function */
97     void (*uninit)(gui_t *gui);
98 };
99 
100 #define     wsShowWindow    8
101 #define     wsHideWindow    16
102 #define     wsShowFrame     1
103 #define     wsMovable       2
104 #define     wsSizeable      4
105 
106 gui_t *create_gui(char *skindir, void (*playercontrol)(int event));
107 int destroy_window(gui_t *gui);
108 int create_window(gui_t *gui, char *skindir);
109 int create_videowindow(gui_t *gui);
110 int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear);
111 void capitalize(char *fname);
112 LPSTR acp(LPCSTR utf8);
113 double appRadian(widget *item, int x, int y);
114 
115 void renderinfobox(skin_t *skin, window_priv_t *priv);
116 void renderwidget(skin_t *skin, image *dest, widget *item, int state);
117 
118 /* Dialogs */
119 void display_playlistwindow(gui_t *gui);
120 void update_playlistwindow(void);
121 int display_openfilewindow(gui_t *gui, int add);
122 void display_openurlwindow(gui_t *gui, int add);
123 void display_skinbrowser(gui_t *gui);
124 void display_chapterselwindow(gui_t *gui);
125 void display_eqwindow(gui_t *gui);
126 void display_prefswindow(gui_t *gui);
127 void display_opensubtitlewindow(gui_t *gui);
128 
129 #ifdef __WINE__
130 char *unix_name(const char *win_filename);
131 #endif
132 
133 #endif /* MPLAYER_GUI_GUI_H */
134