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