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