33572
|
1 /*
|
|
2 * This file is part of MPlayer.
|
|
3 *
|
|
4 * MPlayer is free software; you can redistribute it and/or modify
|
|
5 * it under the terms of the GNU General Public License as published by
|
|
6 * the Free Software Foundation; either version 2 of the License, or
|
|
7 * (at your option) any later version.
|
|
8 *
|
|
9 * MPlayer is distributed in the hope that it will be useful,
|
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 * GNU General Public License for more details.
|
|
13 *
|
|
14 * You should have received a copy of the GNU General Public License along
|
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
17 */
|
|
18
|
|
19 #include <stdio.h>
|
|
20 #include <stdlib.h>
|
|
21 #include <string.h>
|
|
22
|
|
23 #include "config.h"
|
|
24 #include "help_mp.h"
|
|
25 #include "access_mpcontext.h"
|
|
26 #include "mixer.h"
|
|
27 #include "mpcommon.h"
|
|
28
|
|
29 #include "menu.h"
|
|
30 #include "gui/ui/widgets.h"
|
|
31 #include "gui/ui/gmplayer.h"
|
|
32 #include "gui/app.h"
|
33738
|
33 #include "gui/interface.h"
|
33572
|
34
|
|
35 #include "stream/stream.h"
|
|
36 #include "libmpdemux/demuxer.h"
|
|
37 #include "libmpdemux/stheader.h"
|
|
38 #include "libavutil/avstring.h"
|
|
39
|
|
40 #include "gui/ui/pixmaps/about.xpm"
|
|
41 #include "gui/ui/pixmaps/half.xpm"
|
|
42 #include "gui/ui/pixmaps/normal.xpm"
|
|
43 #include "gui/ui/pixmaps/double.xpm"
|
|
44 #include "gui/ui/pixmaps/full.xpm"
|
|
45 #include "gui/ui/pixmaps/exit.xpm"
|
|
46 #include "gui/ui/pixmaps/prefs.xpm"
|
|
47 #include "gui/ui/pixmaps/equalizer.xpm"
|
|
48 #include "gui/ui/pixmaps/playlist.xpm"
|
|
49 #include "gui/ui/pixmaps/skin.xpm"
|
|
50 #include "gui/ui/pixmaps/sound.xpm"
|
|
51 #include "gui/ui/pixmaps/open.xpm"
|
|
52 #include "gui/ui/pixmaps/play.xpm"
|
|
53 #include "gui/ui/pixmaps/stop.xpm"
|
|
54 #include "gui/ui/pixmaps/pause.xpm"
|
|
55 #include "gui/ui/pixmaps/prev.xpm"
|
|
56 #include "gui/ui/pixmaps/next.xpm"
|
|
57 #include "gui/ui/pixmaps/aspect.xpm"
|
|
58 #include "gui/ui/pixmaps/aspect11.xpm"
|
|
59 #include "gui/ui/pixmaps/aspect169.xpm"
|
|
60 #include "gui/ui/pixmaps/aspect235.xpm"
|
|
61 #include "gui/ui/pixmaps/aspect43.xpm"
|
|
62 #include "gui/ui/pixmaps/file2.xpm"
|
|
63 #include "gui/ui/pixmaps/url.xpm"
|
|
64 #include "gui/ui/pixmaps/sub.xpm"
|
|
65 #include "gui/ui/pixmaps/nosub.xpm"
|
|
66 #include "gui/ui/pixmaps/empty.xpm"
|
|
67 #include "gui/ui/pixmaps/loadeaf.xpm"
|
|
68 #include "gui/ui/pixmaps/title.xpm"
|
|
69 #ifdef CONFIG_DVDREAD
|
|
70 #include "gui/ui/pixmaps/dvd.xpm"
|
|
71 #include "gui/ui/pixmaps/playdvd.xpm"
|
|
72 #include "gui/ui/pixmaps/chapter.xpm"
|
|
73 #include "gui/ui/pixmaps/dolby.xpm"
|
|
74 #include "gui/ui/pixmaps/audiolang.xpm"
|
|
75 #include "gui/ui/pixmaps/sublang.xpm"
|
|
76 #include "gui/ui/pixmaps/empty1px.xpm"
|
|
77 #endif
|
|
78 #ifdef CONFIG_VCD
|
|
79 #include "gui/ui/pixmaps/vcd.xpm"
|
|
80 #include "gui/ui/pixmaps/playvcd.xpm"
|
|
81 #endif
|
|
82
|
|
83 static void ActivateMenuItem( int Item )
|
|
84 {
|
|
85 // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 );
|
|
86 gtkPopupMenu=Item & 0x0000ffff;
|
|
87 gtkPopupMenuParam=Item >> 16;
|
|
88 uiEventHandling( Item & 0x0000ffff,Item >> 16 );
|
|
89 }
|
|
90
|
|
91 static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number)
|
|
92 {
|
|
93 GtkWidget * Label = NULL;
|
|
94 GtkWidget * Pixmap = NULL;
|
|
95 GtkWidget * hbox = NULL;
|
|
96 GtkWidget * Item = NULL;
|
|
97
|
|
98 GdkPixmap *PixmapIcon = NULL;
|
|
99 GdkColor transparent;
|
|
100 GdkBitmap *MaskIcon = NULL;
|
|
101
|
|
102 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm );
|
|
103 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
|
|
104 gdk_pixmap_unref (PixmapIcon);
|
|
105
|
|
106 Item=gtk_check_menu_item_new();
|
|
107 Label = gtk_label_new (label);
|
|
108
|
|
109 hbox = gtk_hbox_new (FALSE, 8);
|
|
110 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
|
|
111 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
|
|
112 gtk_container_add (GTK_CONTAINER (Item), hbox);
|
|
113
|
|
114 gtk_menu_append( GTK_MENU( Menu ),Item );
|
|
115
|
|
116 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state);
|
|
117 gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
|
|
118 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
|
|
119 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
|
|
120 gtk_widget_show_all(Item);
|
|
121
|
|
122 return Item;
|
|
123 }
|
|
124 GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,const char * label,int Number )
|
|
125 {
|
|
126 GtkWidget * Label = NULL;
|
|
127 GtkWidget * Pixmap = NULL;
|
|
128 GtkWidget * hbox = NULL;
|
|
129 GtkWidget * Item = NULL;
|
|
130 GdkPixmap * PixmapIcon = NULL;
|
|
131 GdkColor transparent;
|
|
132 GdkBitmap * MaskIcon = NULL;
|
|
133
|
|
134 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm );
|
|
135 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
|
|
136 gdk_pixmap_unref (PixmapIcon);
|
|
137
|
|
138 Item=gtk_menu_item_new();
|
|
139 Label = gtk_label_new (label);
|
|
140
|
|
141 hbox = gtk_hbox_new (FALSE, 8);
|
|
142 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
|
|
143 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
|
|
144 gtk_container_add (GTK_CONTAINER (Item), hbox);
|
|
145
|
|
146
|
|
147 gtk_menu_append( GTK_MENU( SubMenu ),Item );
|
|
148 gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
|
|
149 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
|
|
150
|
|
151 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
|
|
152 gtk_widget_show_all(Item);
|
|
153 return Item;
|
|
154 }
|
|
155
|
|
156
|
|
157 GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label )
|
|
158 {
|
|
159 GtkWidget * Label = NULL;
|
|
160 GtkWidget * Pixmap = NULL;
|
|
161 GtkWidget * hbox = NULL;
|
|
162 GtkWidget * Item = NULL;
|
|
163 GtkWidget * SubItem = NULL;
|
|
164 GdkPixmap * PixmapIcon = NULL;
|
|
165 GdkColor transparent;
|
|
166 GdkBitmap * MaskIcon = NULL;
|
|
167
|
|
168 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm);
|
|
169 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
|
|
170 gdk_pixmap_unref (PixmapIcon);
|
|
171
|
|
172 SubItem=gtk_menu_item_new();
|
|
173 Item=gtk_menu_new();
|
|
174 Label = gtk_label_new (label);
|
|
175
|
|
176 hbox = gtk_hbox_new (FALSE, 8);
|
|
177 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
|
|
178 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
|
|
179 gtk_container_add (GTK_CONTAINER (SubItem), hbox);
|
|
180
|
|
181 gtk_menu_append( GTK_MENU( Menu ),SubItem );
|
|
182 gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item );
|
|
183
|
|
184 gtk_widget_show_all( SubItem );
|
|
185 return Item;
|
|
186 }
|
|
187
|
|
188 GtkWidget * AddSeparator( GtkWidget * Menu )
|
|
189 {
|
|
190 GtkWidget * Item = NULL;
|
|
191
|
|
192 Item=gtk_menu_item_new ();
|
|
193 gtk_widget_show( Item );
|
|
194 gtk_container_add( GTK_CONTAINER( Menu ),Item );
|
|
195 gtk_widget_set_sensitive( Item,FALSE );
|
|
196
|
|
197 return Item;
|
|
198 }
|
|
199
|
|
200 typedef struct
|
|
201 {
|
|
202 int id;
|
|
203 const char * name;
|
|
204 } Languages_t;
|
|
205
|
|
206 #define lng( a,b ) ( (int)(a) * 256 + b )
|
|
207 static Languages_t Languages[] =
|
|
208 {
|
|
209 { lng( 'a','b' ), "Abkhazian" },
|
|
210 { lng( 'a','a' ), "Afar" },
|
|
211 { lng( 'a','f' ), "Afrikaans" },
|
|
212 { lng( 's','q' ), "Albanian" },
|
|
213 { lng( 'a','m' ), "Amharic" },
|
|
214 { lng( 'a','r' ), "Arabic" },
|
|
215 { lng( 'h','y' ), "Armenian" },
|
|
216 { lng( 'a','s' ), "Assamese" },
|
|
217 { lng( 'a','e' ), "Avestan" },
|
|
218 { lng( 'a','y' ), "Aymara" },
|
|
219 { lng( 'a','z' ), "Azerbaijani" },
|
|
220 { lng( 'b','a' ), "Bashkir" },
|
|
221 { lng( 'e','u' ), "Basque" },
|
|
222 { lng( 'b','e' ), "Belarusian" },
|
|
223 { lng( 'b','n' ), "Bengali" },
|
|
224 { lng( 'b','h' ), "Bihari" },
|
|
225 { lng( 'b','i' ), "Bislama" },
|
|
226 { lng( 'b','s' ), "Bosnian" },
|
|
227 { lng( 'b','r' ), "Breton" },
|
|
228 { lng( 'b','g' ), "Bulgarian" },
|
|
229 { lng( 'm','y' ), "Burmese" },
|
|
230 { lng( 'c','a' ), "Catalan" },
|
|
231 { lng( 'c','h' ), "Chamorro" },
|
|
232 { lng( 'c','e' ), "Chechen" },
|
|
233 { lng( 'n','y' ), "Chichewa;Nyanja" },
|
|
234 { lng( 'z','h' ), "Chinese" },
|
|
235 { lng( 'c','u' ), "ChurchSlavic" },
|
|
236 { lng( 'c','v' ), "Chuvash" },
|
|
237 { lng( 'k','w' ), "Cornish" },
|
|
238 { lng( 'c','o' ), "Corsican" },
|
|
239 { lng( 'h','r' ), "Croatian" },
|
|
240 { lng( 'c','s' ), "Czech" },
|
|
241 { lng( 'd','a' ), "Danish" },
|
|
242 { lng( 'n','l' ), "Dutch" },
|
|
243 { lng( 'd','z' ), "Dzongkha" },
|
|
244 { lng( 'e','n' ), "English" },
|
|
245 { lng( 'e','o' ), "Esperanto" },
|
|
246 { lng( 'e','t' ), "Estonian" },
|
|
247 { lng( 'f','o' ), "Faroese" },
|
|
248 { lng( 'f','j' ), "Fijian" },
|
|
249 { lng( 'f','i' ), "Finnish" },
|
|
250 { lng( 'f','r' ), "French" },
|
|
251 { lng( 'f','y' ), "Frisian" },
|
|
252 { lng( 'g','d' ), "Gaelic(Scots" },
|
|
253 { lng( 'g','l' ), "Gallegan" },
|
|
254 { lng( 'k','a' ), "Georgian" },
|
|
255 { lng( 'd','e' ), "German" },
|
|
256 { lng( 'e','l' ), "Greek" },
|
|
257 { lng( 'g','n' ), "Guarani" },
|
|
258 { lng( 'g','u' ), "Gujarati" },
|
|
259 { lng( 'h','a' ), "Hausa" },
|
|
260 { lng( 'h','e' ), "Hebrew" },
|
|
261 { lng( 'i','w' ), "Hebrew" },
|
|
262 { lng( 'h','z' ), "Herero" },
|
|
263 { lng( 'h','i' ), "Hindi" },
|
|
264 { lng( 'h','o' ), "HiriMotu" },
|
|
265 { lng( 'h','u' ), "Hungarian" },
|
|
266 { lng( 'i','s' ), "Icelandic" },
|
|
267 { lng( 'i','d' ), "Indonesian" },
|
|
268 { lng( 'i','n' ), "Indonesian" },
|
|
269 { lng( 'i','a' ), "Interlingua" },
|
|
270 { lng( 'i','e' ), "Interlingue" },
|
|
271 { lng( 'i','u' ), "Inuktitut" },
|
|
272 { lng( 'i','k' ), "Inupiaq" },
|
|
273 { lng( 'g','a' ), "Irish" },
|
|
274 { lng( 'i','t' ), "Italian" },
|
|
275 { lng( 'j','a' ), "Japanese" },
|
|
276 { lng( 'j','v' ), "Javanese" },
|
|
277 { lng( 'j','w' ), "Javanese" },
|
|
278 { lng( 'k','l' ), "Kalaallisut" },
|
|
279 { lng( 'k','n' ), "Kannada" },
|
|
280 { lng( 'k','s' ), "Kashmiri" },
|
|
281 { lng( 'k','k' ), "Kazakh" },
|
|
282 { lng( 'k','m' ), "Khmer" },
|
|
283 { lng( 'k','i' ), "Kikuyu" },
|
|
284 { lng( 'r','w' ), "Kinyarwanda" },
|
|
285 { lng( 'k','y' ), "Kirghiz" },
|
|
286 { lng( 'k','v' ), "Komi" },
|
|
287 { lng( 'k','o' ), "Korean" },
|
|
288 { lng( 'k','j' ), "Kuanyama" },
|
|
289 { lng( 'k','u' ), "Kurdish" },
|
|
290 { lng( 'l','o' ), "Lao" },
|
|
291 { lng( 'l','a' ), "Latin" },
|
|
292 { lng( 'l','v' ), "Latvian" },
|
|
293 { lng( 'l','b' ), "Letzeburgesch" },
|
|
294 { lng( 'l','n' ), "Lingala" },
|
|
295 { lng( 'l','t' ), "Lithuanian" },
|
|
296 { lng( 'm','k' ), "Macedonian" },
|
|
297 { lng( 'm','g' ), "Malagasy" },
|
|
298 { lng( 'm','s' ), "Malay" },
|
|
299 { lng( 'm','l' ), "Malayalam" },
|
|
300 { lng( 'm','t' ), "Maltese" },
|
|
301 { lng( 'g','v' ), "Manx" },
|
|
302 { lng( 'm','i' ), "Maori" },
|
|
303 { lng( 'm','r' ), "Marathi" },
|
|
304 { lng( 'm','h' ), "Marshall" },
|
|
305 { lng( 'm','o' ), "Moldavian" },
|
|
306 { lng( 'm','n' ), "Mongolian" },
|
|
307 { lng( 'n','a' ), "Nauru" },
|
|
308 { lng( 'n','v' ), "Navajo" },
|
|
309 { lng( 'n','d' ), "North Ndebele" },
|
|
310 { lng( 'n','r' ), "South Ndebele" },
|
|
311 { lng( 'n','g' ), "Ndonga" },
|
|
312 { lng( 'n','e' ), "Nepali" },
|
|
313 { lng( 's','e' ), "NorthernSami" },
|
|
314 { lng( 'n','o' ), "Norwegian" },
|
|
315 { lng( 'n','b' ), "NorwegianBokmål" },
|
|
316 { lng( 'n','n' ), "NorwegianNynorsk" },
|
|
317 { lng( 'n','y' ), "Nyanja;Chichewa" },
|
|
318 { lng( 'o','c' ), "Occitan(post1500;Provençal" },
|
|
319 { lng( 'o','r' ), "Oriya" },
|
|
320 { lng( 'o','m' ), "Oromo" },
|
|
321 { lng( 'o','s' ), "Ossetian;Ossetic" },
|
|
322 { lng( 'p','i' ), "Pali" },
|
|
323 { lng( 'p','a' ), "Panjabi" },
|
|
324 { lng( 'f','a' ), "Persian" },
|
|
325 { lng( 'p','l' ), "Polish" },
|
|
326 { lng( 'p','t' ), "Portuguese" },
|
|
327 { lng( 'o','c' ), "Provençal;Occitan(post1500" },
|
|
328 { lng( 'p','s' ), "Pushto" },
|
|
329 { lng( 'q','u' ), "Quechua" },
|
|
330 { lng( 'r','m' ), "Raeto-Romance" },
|
|
331 { lng( 'r','o' ), "Romanian" },
|
|
332 { lng( 'r','n' ), "Rundi" },
|
|
333 { lng( 'r','u' ), "Russian" },
|
|
334 { lng( 's','m' ), "Samoan" },
|
|
335 { lng( 's','g' ), "Sango" },
|
|
336 { lng( 's','a' ), "Sanskrit" },
|
|
337 { lng( 's','c' ), "Sardinian" },
|
|
338 { lng( 's','r' ), "Serbian" },
|
|
339 { lng( 's','n' ), "Shona" },
|
|
340 { lng( 's','d' ), "Sindhi" },
|
|
341 { lng( 's','i' ), "Sinhalese" },
|
|
342 { lng( 's','k' ), "Slovak" },
|
|
343 { lng( 's','l' ), "Slovenian" },
|
|
344 { lng( 's','o' ), "Somali" },
|
|
345 { lng( 's','t' ), "Sotho" },
|
|
346 { lng( 'e','s' ), "Spanish" },
|
|
347 { lng( 's','u' ), "Sundanese" },
|
|
348 { lng( 's','w' ), "Swahili" },
|
|
349 { lng( 's','s' ), "Swati" },
|
|
350 { lng( 's','v' ), "Swedish" },
|
|
351 { lng( 't','l' ), "Tagalog" },
|
|
352 { lng( 't','y' ), "Tahitian" },
|
|
353 { lng( 't','g' ), "Tajik" },
|
|
354 { lng( 't','a' ), "Tamil" },
|
|
355 { lng( 't','t' ), "Tatar" },
|
|
356 { lng( 't','e' ), "Telugu" },
|
|
357 { lng( 't','h' ), "Thai" },
|
|
358 { lng( 'b','o' ), "Tibetan" },
|
|
359 { lng( 't','i' ), "Tigrinya" },
|
|
360 { lng( 't','o' ), "Tonga" },
|
|
361 { lng( 't','s' ), "Tsonga" },
|
|
362 { lng( 't','n' ), "Tswana" },
|
|
363 { lng( 't','r' ), "Turkish" },
|
|
364 { lng( 't','k' ), "Turkmen" },
|
|
365 { lng( 't','w' ), "Twi" },
|
|
366 { lng( 'u','g' ), "Uighur" },
|
|
367 { lng( 'u','k' ), "Ukrainian" },
|
|
368 { lng( 'u','r' ), "Urdu" },
|
|
369 { lng( 'u','z' ), "Uzbek" },
|
|
370 { lng( 'v','i' ), "Vietnamese" },
|
|
371 { lng( 'v','o' ), "Volapük" },
|
|
372 { lng( 'c','y' ), "Welsh" },
|
|
373 { lng( 'w','o' ), "Wolof" },
|
|
374 { lng( 'x','h' ), "Xhosa" },
|
|
375 { lng( 'y','i' ), "Yiddish" },
|
|
376 { lng( 'j','i' ), "Yiddish" },
|
|
377 { lng( 'y','o' ), "Yoruba" },
|
|
378 { lng( 'z','a' ), "Zhuang" },
|
|
379 { lng( 'z','u' ), "Zulu" },
|
|
380 };
|
|
381 #undef lng
|
|
382
|
|
383 #ifdef CONFIG_DVDREAD
|
|
384 static char * ChannelTypes[] =
|
|
385 { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" };
|
|
386 static char * ChannelNumbers[] =
|
|
387 { "","Stereo","","","","5.1" };
|
|
388 #endif
|
|
389
|
|
390 static const char * GetLanguage( int language )
|
|
391 {
|
|
392 unsigned int i;
|
|
393 for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ )
|
|
394 if ( Languages[i].id == language ) return Languages[i].name;
|
|
395 return NULL;
|
|
396 }
|
|
397
|
|
398
|
|
399 GtkWidget * DVDSubMenu;
|
|
400 GtkWidget * DVDTitleMenu;
|
|
401 GtkWidget * DVDChapterMenu;
|
|
402 GtkWidget * DVDAudioLanguageMenu;
|
|
403 GtkWidget * DVDSubtitleLanguageMenu;
|
|
404 GtkWidget * AspectMenu;
|
|
405 GtkWidget * VCDSubMenu;
|
|
406 GtkWidget * VCDTitleMenu;
|
|
407
|
|
408 GtkWidget * create_PopUpMenu( void )
|
|
409 {
|
|
410 GtkWidget * window1;
|
|
411 GtkWidget * Menu = NULL;
|
|
412 GtkWidget * SubMenu = NULL;
|
|
413 GtkWidget * MenuItem = NULL;
|
|
414 GtkWidget * H, * N, * D, * F;
|
33657
|
415 demuxer_t *demuxer = mpctx_get_demuxer(guiInfo.mpcontext);
|
33572
|
416 mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
|
|
417 int global_sub_size = mpctx_get_global_sub_size(guiInfo.mpcontext);
|
|
418
|
|
419 Menu=gtk_menu_new();
|
|
420 gtk_widget_realize (Menu);
|
|
421 window1 = gtk_widget_get_toplevel(Menu);
|
|
422
|
|
423
|
|
424 AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout );
|
|
425 AddSeparator( Menu );
|
|
426 SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open );
|
|
427 AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay );
|
|
428 #ifdef CONFIG_VCD
|
|
429 AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
|
|
430 #endif
|
|
431 #ifdef CONFIG_DVDREAD
|
|
432 AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
|
|
433 #endif
|
|
434 AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL );
|
|
435 AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle );
|
|
436 AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
|
|
437 AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
|
|
438 SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing );
|
|
439 AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay );
|
|
440 AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause );
|
|
441 AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_MENU_Stop, evStop );
|
|
442 AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext );
|
|
443 AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev );
|
|
444 // AddSeparator( SubMenu );
|
|
445 // AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
|
|
446 // AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
|
|
447 // AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
|
|
448 // AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
|
|
449 // SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
|
|
450 // AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize );
|
|
451 // AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
|
|
452 // AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
|
|
453 #ifdef CONFIG_VCD
|
|
454 VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD );
|
|
455 AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
|
|
456 AddSeparator( VCDSubMenu );
|
|
457 VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
|
|
458 if ( guiInfo.VCDTracks )
|
|
459 {
|
|
460 char tmp[32]; int i;
|
|
461 for ( i=1;i < guiInfo.VCDTracks;i++ )
|
|
462 {
|
|
463 snprintf( tmp,32,MSGTR_MENU_Title,i );
|
|
464 //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack );
|
33874
|
465 AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( ( i + 1 ) << 16 ) + evSetVCDTrack );
|
33572
|
466 }
|
|
467 }
|
|
468 else
|
|
469 {
|
|
470 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone );
|
|
471 gtk_widget_set_sensitive( MenuItem,FALSE );
|
|
472 }
|
|
473 #endif
|
|
474 #ifdef CONFIG_DVDREAD
|
|
475 DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD );
|
|
476 AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD );
|
|
477 // AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
|
|
478 AddSeparator( DVDSubMenu );
|
|
479 DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
|
|
480 if ( guiInfo.DVD.titles )
|
|
481 {
|
|
482 char tmp[32]; int i;
|
|
483 for ( i=1 ; i<= guiInfo.DVD.titles;i++ )
|
|
484 {
|
|
485 snprintf( tmp,32,MSGTR_MENU_Title,i);
|
|
486 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
|
|
487 guiInfo.DVD.current_title == i,
|
|
488 (i << 16) + evSetDVDTitle );
|
|
489 }
|
|
490 }
|
|
491 else
|
|
492 {
|
|
493 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone );
|
|
494 gtk_widget_set_sensitive( MenuItem,FALSE );
|
|
495 }
|
|
496 DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
|
|
497 if ( guiInfo.DVD.chapters )
|
|
498 {
|
|
499 char tmp[32]; int i;
|
|
500 for ( i=1;i <= guiInfo.DVD.chapters;i++ )
|
|
501 {
|
|
502 snprintf( tmp,32,MSGTR_MENU_Chapter,i );
|
|
503 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.DVD.current_chapter == i,
|
|
504 ( i << 16 ) + evSetDVDChapter );
|
|
505 }
|
|
506 }
|
|
507 else
|
|
508 {
|
|
509 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone );
|
|
510 gtk_widget_set_sensitive( MenuItem,FALSE );
|
|
511 }
|
|
512 DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)audiolang_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages );
|
|
513 if ( guiInfo.DVD.nr_of_audio_channels )
|
|
514 {
|
33657
|
515 char tmp[64]; int i, id = demuxer ? demuxer->audio->id : audio_id;
|
33572
|
516 for ( i=0;i < guiInfo.DVD.nr_of_audio_channels;i++ )
|
|
517 {
|
|
518 snprintf( tmp,64,"%s - %s %s",GetLanguage( guiInfo.DVD.audio_streams[i].language ),
|
|
519 ChannelTypes[ guiInfo.DVD.audio_streams[i].type ],
|
|
520 ChannelNumbers[ guiInfo.DVD.audio_streams[i].channels ] );
|
|
521 // if ( id == -1 ) id=audio_id; //guiInfo.DVD.audio_streams[i].id;
|
|
522 AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp,
|
|
523 id == guiInfo.DVD.audio_streams[i].id,
|
|
524 ( guiInfo.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
|
|
525 }
|
|
526 }
|
|
527 else
|
|
528 {
|
|
529 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone );
|
|
530 gtk_widget_set_sensitive( MenuItem,FALSE );
|
|
531 }
|
|
532 DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)sublang_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages );
|
|
533 if ( guiInfo.DVD.nr_of_subtitles )
|
|
534 {
|
|
535 char tmp[64]; int i;
|
|
536 AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle );
|
|
537 for ( i=0;i < guiInfo.DVD.nr_of_subtitles;i++ )
|
|
538 {
|
|
539 av_strlcpy( tmp,GetLanguage( guiInfo.DVD.subtitles[i].language ),sizeof(tmp) );
|
|
540 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp,
|
|
541 dvdsub_id == guiInfo.DVD.subtitles[i].id,
|
|
542 ( guiInfo.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle );
|
|
543 }
|
|
544 }
|
|
545 else
|
|
546 {
|
|
547 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone );
|
|
548 gtk_widget_set_sensitive( MenuItem,FALSE );
|
|
549 }
|
|
550 #endif
|
|
551
|
|
552 // if ( guiInfo.Playing )
|
|
553 {
|
|
554 AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio );
|
|
555 AddMenuItem( window1, (const char*)aspect11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect );
|
|
556 AddMenuItem( window1, (const char*)aspect169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect );
|
|
557 AddMenuItem( window1, (const char*)aspect43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect );
|
|
558 AddMenuItem( window1, (const char*)aspect235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
|
|
559 }
|
|
560
|
33657
|
561 if ( guiInfo.Playing && demuxer && guiInfo.StreamType != STREAMTYPE_DVD )
|
33572
|
562 {
|
|
563 int i,c = 0;
|
|
564
|
|
565 for ( i=0;i < MAX_A_STREAMS;i++ )
|
33657
|
566 if ( demuxer->a_streams[i] ) c++;
|
33572
|
567
|
|
568 if ( c > 1 )
|
|
569 {
|
|
570 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack );
|
|
571 for ( i=0;i < MAX_A_STREAMS;i++ )
|
33657
|
572 if ( demuxer->a_streams[i] )
|
33572
|
573 {
|
33657
|
574 int aid = ((sh_audio_t *)demuxer->a_streams[i])->aid;
|
33572
|
575 char tmp[32];
|
|
576 snprintf( tmp,32,MSGTR_MENU_Track,aid );
|
|
577 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio );
|
|
578 }
|
|
579 }
|
|
580
|
|
581 for ( c=0,i=0;i < MAX_V_STREAMS;i++ )
|
33657
|
582 if ( demuxer->v_streams[i] ) c++;
|
33572
|
583
|
|
584 if ( c > 1 )
|
|
585 {
|
|
586 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack );
|
|
587 for ( i=0;i < MAX_V_STREAMS;i++ )
|
33657
|
588 if ( demuxer->v_streams[i] )
|
33572
|
589 {
|
33657
|
590 int vid = ((sh_video_t *)demuxer->v_streams[i])->vid;
|
33572
|
591 char tmp[32];
|
|
592 snprintf( tmp,32,MSGTR_MENU_Track,vid );
|
|
593 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo );
|
|
594 }
|
|
595 }
|
|
596 }
|
|
597
|
|
598 /* cheap subtitle switching for non-DVD streams */
|
|
599 if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD )
|
|
600 {
|
|
601 int i;
|
|
602 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles );
|
|
603 AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle );
|
|
604 for ( i=0;i < global_sub_size;i++ )
|
|
605 {
|
|
606 char tmp[32];
|
|
607 snprintf( tmp, 32, MSGTR_MENU_Track, i );
|
|
608 AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle );
|
|
609 }
|
|
610 }
|
|
611
|
|
612 AddSeparator( Menu );
|
|
613 MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute );
|
33646
|
614 if ( !guiInfo.AudioChannels ) gtk_widget_set_sensitive( MenuItem,FALSE );
|
33572
|
615 AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlayList );
|
|
616 AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
|
|
617 AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences );
|
|
618 AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_Equalizer, evEqualizer );
|
|
619
|
33655
|
620 if ( guiInfo.MovieWindow )
|
33572
|
621 {
|
|
622 int b1 = 0, b2 = 0, b_half = 0;
|
|
623 AddSeparator( Menu );
|
|
624 if ( !guiApp.subWindow.isFullScreen && guiInfo.Playing )
|
|
625 {
|
|
626 if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth * 2 )&&
|
|
627 ( guiApp.subWindow.Height == guiInfo.MovieHeight * 2 ) ) b2=1;
|
|
628 else if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth / 2 ) &&
|
|
629 ( guiApp.subWindow.Height == guiInfo.MovieHeight / 2 ) ) b_half=1;
|
|
630 else b1=1;
|
|
631 } else b1=!guiApp.subWindow.isFullScreen;
|
|
632 H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize );
|
|
633 N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize );
|
|
634 D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
|
|
635 F=AddMenuCheckItem( window1, (const char*)full_xpm, Menu,MSGTR_MENU_FullScreen,guiApp.subWindow.isFullScreen,evFullScreen );
|
|
636 if ( !gtkShowVideoWindow && !guiInfo.Playing )
|
|
637 {
|
|
638 gtk_widget_set_sensitive( H,FALSE );
|
|
639 gtk_widget_set_sensitive( N,FALSE );
|
|
640 gtk_widget_set_sensitive( D,FALSE );
|
|
641 gtk_widget_set_sensitive( F,FALSE );
|
|
642 }
|
|
643 }
|
|
644
|
|
645 AddSeparator( Menu );
|
|
646 AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit );
|
|
647
|
|
648 return Menu;
|
|
649 }
|