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