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