Mercurial > mplayer.hg
annotate Gui/mplayer/gtk/menu.c @ 13948:8f2f26ef46e2
warning fix
author | diego |
---|---|
date | Mon, 15 Nov 2004 10:00:58 +0000 |
parents | be3261b2bcf4 |
children | 9635dcba8f29 |
rev | line source |
---|---|
2901 | 1 |
2 #include <stdio.h> | |
3 #include <stdlib.h> | |
3054 | 4 #include <string.h> |
5 | |
6 #include "../../../config.h" | |
3587 | 7 #include "../../../help_mp.h" |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
8 #include "../../../mplayer.h" |
8299 | 9 #include "../../../mixer.h" |
2901 | 10 |
8043 | 11 #include "../../app.h" |
3054 | 12 |
2901 | 13 #include "menu.h" |
14 #include "../widgets.h" | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
15 #include "../app.h" |
2901 | 16 |
8378 | 17 #include "../../../libmpdemux/stream.h" |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
18 #include "../../../libmpdemux/demuxer.h" |
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
19 |
13852 | 20 #include "../pixmaps/ab.xpm" |
21 #include "../pixmaps/normal.xpm" | |
22 #include "../pixmaps/double.xpm" | |
23 #include "../pixmaps/fs.xpm" | |
24 #include "../pixmaps/exit.xpm" | |
25 #include "../pixmaps/prefs.xpm" | |
26 #include "../pixmaps/eq.xpm" | |
27 #include "../pixmaps/pl.xpm" | |
28 #include "../pixmaps/skin.xpm" | |
29 #include "../pixmaps/sound.xpm" | |
30 #include "../pixmaps/open.xpm" | |
31 #include "../pixmaps/play.xpm" | |
32 #include "../pixmaps/stop2.xpm" | |
33 #include "../pixmaps/pause.xpm" | |
34 #include "../pixmaps/prev.xpm" | |
35 #include "../pixmaps/next.xpm" | |
36 #include "../pixmaps/aspect.xpm" | |
37 #include "../pixmaps/a11.xpm" | |
38 #include "../pixmaps/a169.xpm" | |
39 #include "../pixmaps/a235.xpm" | |
40 #include "../pixmaps/a43.xpm" | |
41 #include "../pixmaps/file2.xpm" | |
42 #include "../pixmaps/url.xpm" | |
43 #include "../pixmaps/sub.xpm" | |
44 #include "../pixmaps/delsub.xpm" | |
45 #include "../pixmaps/empty.xpm" | |
13948 | 46 #include "../pixmaps/loadeaf.xpm" |
47 #include "../pixmaps/title.xpm" | |
48 #ifdef USE_DVDREAD | |
49 #include "../pixmaps/dvd.xpm" | |
50 #include "../pixmaps/playdvd.xpm" | |
51 #include "../pixmaps/chapter.xpm" | |
52 #include "../pixmaps/dolby.xpm" | |
13852 | 53 #include "../pixmaps/tongue.xpm" |
54 #include "../pixmaps/tonguebla.xpm" | |
13948 | 55 #include "../pixmaps/empty1px.xpm" |
56 #endif | |
57 #ifdef HAVE_VCD | |
58 #include "../pixmaps/vcd.xpm" | |
59 #include "../pixmaps/playvcd.xpm" | |
60 #endif | |
13852 | 61 |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar D¸«Óffinger and Alexander Strasser.
diego
parents:
11760
diff
changeset
|
62 extern mixer_t mixer; // mixer from mplayer.c |
0230544f52a1
Fix GUI compilation, patch by Reimar D¸«Óffinger and Alexander Strasser.
diego
parents:
11760
diff
changeset
|
63 |
2901 | 64 void ActivateMenuItem( int Item ) |
65 { | |
3618 | 66 // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
67 gtkPopupMenu=Item & 0x0000ffff; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
68 gtkPopupMenuParam=Item >> 16; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
69 mplEventHandling( Item & 0x0000ffff,Item >> 16 ); |
2901 | 70 } |
71 | |
13852 | 72 GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,char* label, gboolean state, int Number) |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
73 { |
13852 | 74 GtkWidget * Label = NULL; |
75 GtkWidget * Pixmap = NULL; | |
76 GtkWidget * hbox = NULL; | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
77 GtkWidget * Item = NULL; |
13852 | 78 |
79 GdkPixmap *PixmapIcon = NULL; | |
80 GdkColor transparent; | |
81 GdkBitmap *MaskIcon = NULL; | |
82 | |
83 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); | |
84 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
85 gdk_pixmap_unref (PixmapIcon); | |
86 | |
87 Item=gtk_check_menu_item_new(); | |
88 Label = gtk_label_new (label); | |
89 | |
90 hbox = gtk_hbox_new (FALSE, 8); | |
91 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
92 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
93 gtk_container_add (GTK_CONTAINER (Item), hbox); | |
94 | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
95 gtk_menu_append( GTK_MENU( Menu ),Item ); |
13852 | 96 |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
97 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state); |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
98 gtk_signal_connect_object( GTK_OBJECT(Item),"activate", |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
99 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); |
13852 | 100 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); |
101 gtk_widget_show_all(Item); | |
102 | |
103 return Item; | |
104 } | |
105 GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,char * label,int Number ) | |
106 { | |
107 GtkWidget * Label = NULL; | |
108 GtkWidget * Pixmap = NULL; | |
109 GtkWidget * hbox = NULL; | |
110 GtkWidget * Item = NULL; | |
111 GdkPixmap * PixmapIcon = NULL; | |
112 GdkColor transparent; | |
113 GdkBitmap * MaskIcon = NULL; | |
114 | |
115 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); | |
116 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
117 gdk_pixmap_unref (PixmapIcon); | |
118 | |
119 Item=gtk_menu_item_new(); | |
120 Label = gtk_label_new (label); | |
121 | |
122 hbox = gtk_hbox_new (FALSE, 8); | |
123 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
124 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
125 gtk_container_add (GTK_CONTAINER (Item), hbox); | |
126 | |
127 | |
128 gtk_menu_append( GTK_MENU( SubMenu ),Item ); | |
129 gtk_signal_connect_object( GTK_OBJECT(Item),"activate", | |
130 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); | |
131 | |
132 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); | |
133 gtk_widget_show_all(Item); | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
134 return Item; |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
135 } |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
136 |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
137 |
13852 | 138 GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,char * label ) |
2901 | 139 { |
13852 | 140 GtkWidget * Label = NULL; |
141 GtkWidget * Pixmap = NULL; | |
142 GtkWidget * hbox = NULL; | |
2901 | 143 GtkWidget * Item = NULL; |
144 GtkWidget * SubItem = NULL; | |
13852 | 145 GdkPixmap * PixmapIcon = NULL; |
146 GdkColor transparent; | |
147 GdkBitmap * MaskIcon = NULL; | |
2901 | 148 |
13852 | 149 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm); |
150 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
151 gdk_pixmap_unref (PixmapIcon); | |
152 | |
153 SubItem=gtk_menu_item_new(); | |
154 Item=gtk_menu_new(); | |
155 Label = gtk_label_new (label); | |
156 | |
157 hbox = gtk_hbox_new (FALSE, 8); | |
158 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
159 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
160 gtk_container_add (GTK_CONTAINER (SubItem), hbox); | |
161 | |
2901 | 162 gtk_menu_append( GTK_MENU( Menu ),SubItem ); |
163 gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item ); | |
13852 | 164 |
165 gtk_widget_show_all( SubItem ); | |
2901 | 166 return Item; |
167 } | |
168 | |
169 GtkWidget * AddSeparator( GtkWidget * Menu ) | |
170 { | |
171 GtkWidget * Item = NULL; | |
172 | |
173 Item=gtk_menu_item_new (); | |
174 gtk_widget_show( Item ); | |
175 gtk_container_add( GTK_CONTAINER( Menu ),Item ); | |
176 gtk_widget_set_sensitive( Item,FALSE ); | |
177 | |
178 return Item; | |
179 } | |
180 | |
3054 | 181 typedef struct |
182 { | |
183 int id; | |
184 char * name; | |
185 } Languages_t; | |
186 | |
187 #define lng( a,b ) ( (int)(a) * 256 + b ) | |
6651 | 188 static Languages_t Languages[] = |
3054 | 189 { |
190 { lng( 'a','b' ), "Abkhazian" }, | |
191 { lng( 'a','a' ), "Afar" }, | |
192 { lng( 'a','f' ), "Afrikaans" }, | |
193 { lng( 's','q' ), "Albanian" }, | |
194 { lng( 'a','m' ), "Amharic" }, | |
195 { lng( 'a','r' ), "Arabic" }, | |
196 { lng( 'h','y' ), "Armenian" }, | |
197 { lng( 'a','s' ), "Assamese" }, | |
198 { lng( 'a','e' ), "Avestan" }, | |
199 { lng( 'a','y' ), "Aymara" }, | |
200 { lng( 'a','z' ), "Azerbaijani" }, | |
201 { lng( 'b','a' ), "Bashkir" }, | |
202 { lng( 'e','u' ), "Basque" }, | |
203 { lng( 'b','e' ), "Belarusian" }, | |
204 { lng( 'b','n' ), "Bengali" }, | |
205 { lng( 'b','h' ), "Bihari" }, | |
206 { lng( 'b','i' ), "Bislama" }, | |
207 { lng( 'b','s' ), "Bosnian" }, | |
208 { lng( 'b','r' ), "Breton" }, | |
209 { lng( 'b','g' ), "Bulgarian" }, | |
210 { lng( 'm','y' ), "Burmese" }, | |
211 { lng( 'c','a' ), "Catalan" }, | |
212 { lng( 'c','h' ), "Chamorro" }, | |
213 { lng( 'c','e' ), "Chechen" }, | |
214 { lng( 'n','y' ), "Chichewa;Nyanja" }, | |
215 { lng( 'z','h' ), "Chinese" }, | |
216 { lng( 'c','u' ), "ChurchSlavic" }, | |
217 { lng( 'c','v' ), "Chuvash" }, | |
218 { lng( 'k','w' ), "Cornish" }, | |
219 { lng( 'c','o' ), "Corsican" }, | |
220 { lng( 'h','r' ), "Croatian" }, | |
221 { lng( 'c','s' ), "Czech" }, | |
222 { lng( 'd','a' ), "Danish" }, | |
223 { lng( 'n','l' ), "Dutch" }, | |
224 { lng( 'd','z' ), "Dzongkha" }, | |
225 { lng( 'e','n' ), "English" }, | |
226 { lng( 'e','o' ), "Esperanto" }, | |
227 { lng( 'e','t' ), "Estonian" }, | |
228 { lng( 'f','o' ), "Faroese" }, | |
229 { lng( 'f','j' ), "Fijian" }, | |
230 { lng( 'f','i' ), "Finnish" }, | |
231 { lng( 'f','r' ), "French" }, | |
232 { lng( 'f','y' ), "Frisian" }, | |
233 { lng( 'g','d' ), "Gaelic(Scots" }, | |
234 { lng( 'g','l' ), "Gallegan" }, | |
235 { lng( 'k','a' ), "Georgian" }, | |
236 { lng( 'd','e' ), "German" }, | |
237 { lng( 'e','l' ), "Greek" }, | |
238 { lng( 'g','n' ), "Guarani" }, | |
239 { lng( 'g','u' ), "Gujarati" }, | |
240 { lng( 'h','a' ), "Hausa" }, | |
241 { lng( 'h','e' ), "Hebrew" }, | |
242 { lng( 'i','w' ), "Hebrew" }, | |
243 { lng( 'h','z' ), "Herero" }, | |
244 { lng( 'h','i' ), "Hindi" }, | |
245 { lng( 'h','o' ), "HiriMotu" }, | |
246 { lng( 'h','u' ), "Hungarian" }, | |
247 { lng( 'i','s' ), "Icelandic" }, | |
248 { lng( 'i','d' ), "Indonesian" }, | |
249 { lng( 'i','n' ), "Indonesian" }, | |
250 { lng( 'i','a' ), "Interlingua" }, | |
251 { lng( 'i','e' ), "Interlingue" }, | |
252 { lng( 'i','u' ), "Inuktitut" }, | |
253 { lng( 'i','k' ), "Inupiaq" }, | |
254 { lng( 'g','a' ), "Irish" }, | |
255 { lng( 'i','t' ), "Italian" }, | |
256 { lng( 'j','a' ), "Japanese" }, | |
257 { lng( 'j','v' ), "Javanese" }, | |
258 { lng( 'j','w' ), "Javanese" }, | |
259 { lng( 'k','l' ), "Kalaallisut" }, | |
260 { lng( 'k','n' ), "Kannada" }, | |
261 { lng( 'k','s' ), "Kashmiri" }, | |
262 { lng( 'k','k' ), "Kazakh" }, | |
263 { lng( 'k','m' ), "Khmer" }, | |
264 { lng( 'k','i' ), "Kikuyu" }, | |
265 { lng( 'r','w' ), "Kinyarwanda" }, | |
266 { lng( 'k','y' ), "Kirghiz" }, | |
267 { lng( 'k','v' ), "Komi" }, | |
268 { lng( 'k','o' ), "Korean" }, | |
269 { lng( 'k','j' ), "Kuanyama" }, | |
270 { lng( 'k','u' ), "Kurdish" }, | |
271 { lng( 'l','o' ), "Lao" }, | |
272 { lng( 'l','a' ), "Latin" }, | |
273 { lng( 'l','v' ), "Latvian" }, | |
274 { lng( 'l','b' ), "Letzeburgesch" }, | |
275 { lng( 'l','n' ), "Lingala" }, | |
276 { lng( 'l','t' ), "Lithuanian" }, | |
277 { lng( 'm','k' ), "Macedonian" }, | |
278 { lng( 'm','g' ), "Malagasy" }, | |
279 { lng( 'm','s' ), "Malay" }, | |
280 { lng( 'm','l' ), "Malayalam" }, | |
281 { lng( 'm','t' ), "Maltese" }, | |
282 { lng( 'g','v' ), "Manx" }, | |
283 { lng( 'm','i' ), "Maori" }, | |
284 { lng( 'm','r' ), "Marathi" }, | |
285 { lng( 'm','h' ), "Marshall" }, | |
286 { lng( 'm','o' ), "Moldavian" }, | |
287 { lng( 'm','n' ), "Mongolian" }, | |
288 { lng( 'n','a' ), "Nauru" }, | |
289 { lng( 'n','v' ), "Navajo" }, | |
290 { lng( 'n','d' ), "North Ndebele" }, | |
291 { lng( 'n','r' ), "South Ndebele" }, | |
292 { lng( 'n','g' ), "Ndonga" }, | |
293 { lng( 'n','e' ), "Nepali" }, | |
294 { lng( 's','e' ), "NorthernSami" }, | |
295 { lng( 'n','o' ), "Norwegian" }, | |
296 { lng( 'n','b' ), "NorwegianBokmål" }, | |
297 { lng( 'n','n' ), "NorwegianNynorsk" }, | |
298 { lng( 'n','y' ), "Nyanja;Chichewa" }, | |
299 { lng( 'o','c' ), "Occitan(post1500;Provenēal" }, | |
300 { lng( 'o','r' ), "Oriya" }, | |
301 { lng( 'o','m' ), "Oromo" }, | |
302 { lng( 'o','s' ), "Ossetian;Ossetic" }, | |
303 { lng( 'p','i' ), "Pali" }, | |
304 { lng( 'p','a' ), "Panjabi" }, | |
305 { lng( 'f','a' ), "Persian" }, | |
306 { lng( 'p','l' ), "Polish" }, | |
307 { lng( 'p','t' ), "Portuguese" }, | |
308 { lng( 'o','c' ), "Provenēal;Occitan(post1500" }, | |
309 { lng( 'p','s' ), "Pushto" }, | |
310 { lng( 'q','u' ), "Quechua" }, | |
311 { lng( 'r','m' ), "Raeto-Romance" }, | |
312 { lng( 'r','o' ), "Romanian" }, | |
313 { lng( 'r','n' ), "Rundi" }, | |
314 { lng( 'r','u' ), "Russian" }, | |
315 { lng( 's','m' ), "Samoan" }, | |
316 { lng( 's','g' ), "Sango" }, | |
317 { lng( 's','a' ), "Sanskrit" }, | |
318 { lng( 's','c' ), "Sardinian" }, | |
319 { lng( 's','r' ), "Serbian" }, | |
320 { lng( 's','n' ), "Shona" }, | |
321 { lng( 's','d' ), "Sindhi" }, | |
322 { lng( 's','i' ), "Sinhalese" }, | |
323 { lng( 's','k' ), "Slovak" }, | |
324 { lng( 's','l' ), "Slovenian" }, | |
325 { lng( 's','o' ), "Somali" }, | |
326 { lng( 's','t' ), "Sotho" }, | |
327 { lng( 'e','s' ), "Spanish" }, | |
328 { lng( 's','u' ), "Sundanese" }, | |
329 { lng( 's','w' ), "Swahili" }, | |
330 { lng( 's','s' ), "Swati" }, | |
331 { lng( 's','v' ), "Swedish" }, | |
332 { lng( 't','l' ), "Tagalog" }, | |
333 { lng( 't','y' ), "Tahitian" }, | |
334 { lng( 't','g' ), "Tajik" }, | |
335 { lng( 't','a' ), "Tamil" }, | |
336 { lng( 't','t' ), "Tatar" }, | |
337 { lng( 't','e' ), "Telugu" }, | |
338 { lng( 't','h' ), "Thai" }, | |
339 { lng( 'b','o' ), "Tibetan" }, | |
340 { lng( 't','i' ), "Tigrinya" }, | |
341 { lng( 't','o' ), "Tonga" }, | |
342 { lng( 't','s' ), "Tsonga" }, | |
343 { lng( 't','n' ), "Tswana" }, | |
344 { lng( 't','r' ), "Turkish" }, | |
345 { lng( 't','k' ), "Turkmen" }, | |
346 { lng( 't','w' ), "Twi" }, | |
347 { lng( 'u','g' ), "Uighur" }, | |
348 { lng( 'u','k' ), "Ukrainian" }, | |
349 { lng( 'u','r' ), "Urdu" }, | |
350 { lng( 'u','z' ), "Uzbek" }, | |
351 { lng( 'v','i' ), "Vietnamese" }, | |
352 { lng( 'v','o' ), "Volapük" }, | |
353 { lng( 'c','y' ), "Welsh" }, | |
354 { lng( 'w','o' ), "Wolof" }, | |
355 { lng( 'x','h' ), "Xhosa" }, | |
356 { lng( 'y','i' ), "Yiddish" }, | |
357 { lng( 'j','i' ), "Yiddish" }, | |
358 { lng( 'y','o' ), "Yoruba" }, | |
359 { lng( 'z','a' ), "Zhuang" }, | |
360 { lng( 'z','u' ), "Zulu" }, | |
361 }; | |
362 #undef lng | |
363 | |
13948 | 364 #ifdef USE_DVDREAD |
6651 | 365 static char * ChannelTypes[] = |
366 { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" }; | |
367 static char * ChannelNumbers[] = | |
368 { "","Stereo","","","","5.1" }; | |
13948 | 369 #endif |
6651 | 370 |
3054 | 371 char * GetLanguage( int language ) |
372 { | |
6651 | 373 unsigned int i; |
3054 | 374 for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ ) |
375 if ( Languages[i].id == language ) return Languages[i].name; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
376 return NULL; |
3054 | 377 } |
378 | |
2901 | 379 GtkWidget * DVDSubMenu; |
2980 | 380 GtkWidget * DVDTitleMenu; |
3054 | 381 GtkWidget * DVDChapterMenu; |
2940 | 382 GtkWidget * DVDAudioLanguageMenu; |
383 GtkWidget * DVDSubtitleLanguageMenu; | |
7541 | 384 GtkWidget * AspectMenu; |
6280 | 385 GtkWidget * VCDSubMenu; |
386 GtkWidget * VCDTitleMenu; | |
387 | |
2901 | 388 GtkWidget * create_PopUpMenu( void ) |
389 { | |
13852 | 390 GtkWidget * window1; |
2901 | 391 GtkWidget * Menu = NULL; |
392 GtkWidget * SubMenu = NULL; | |
3590 | 393 GtkWidget * MenuItem = NULL; |
9202 | 394 GtkWidget * N, * D, * F; |
2901 | 395 |
396 Menu=gtk_menu_new(); | |
13852 | 397 gtk_widget_realize (Menu); |
398 window1 = gtk_widget_get_toplevel(Menu); | |
2901 | 399 |
13852 | 400 AddMenuItem( window1, (const char*)ab_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout ); |
2901 | 401 AddSeparator( Menu ); |
13852 | 402 SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open ); |
403 AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay ); | |
6280 | 404 #ifdef HAVE_VCD |
13852 | 405 AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD ); |
6280 | 406 #endif |
3054 | 407 #ifdef USE_DVDREAD |
13852 | 408 AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD ); |
3054 | 409 #endif |
13852 | 410 AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL ); |
411 AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle ); | |
412 AddMenuItem( window1, (const char*)delsub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle ); | |
413 AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile ); | |
414 SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing ); | |
415 AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay ); | |
416 AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause ); | |
417 AddMenuItem( window1, (const char*)stop2_xpm, SubMenu,MSGTR_MENU_Stop, evStop ); | |
418 AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext ); | |
419 AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev ); | |
3054 | 420 // AddSeparator( SubMenu ); |
421 // AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec ); | |
422 // AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec ); | |
423 // AddMenuItem( SubMenu,"Back 1 min", evBackward1min ); | |
424 // AddMenuItem( SubMenu,"Fwd 1 min", evForward1min ); | |
6903 | 425 // SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size ); |
426 // AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize ); | |
427 // AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize ); | |
428 // AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen ); | |
6280 | 429 #ifdef HAVE_VCD |
13852 | 430 VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD ); |
431 AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD ); | |
6280 | 432 AddSeparator( VCDSubMenu ); |
13852 | 433 VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles ); |
6280 | 434 if ( guiIntfStruct.VCDTracks ) |
435 { | |
436 char tmp[32]; int i; | |
437 for ( i=0;i < guiIntfStruct.VCDTracks;i++ ) | |
438 { | |
7583 | 439 snprintf( tmp,32,MSGTR_MENU_Title,i+1 ); |
13852 | 440 //AddMenuItem( VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack ); |
441 AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack ); | |
6280 | 442 } |
443 } | |
444 else | |
445 { | |
13852 | 446 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone ); |
6280 | 447 gtk_widget_set_sensitive( MenuItem,FALSE ); |
448 } | |
449 #endif | |
3054 | 450 #ifdef USE_DVDREAD |
13852 | 451 DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD ); |
452 AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD ); | |
6794 | 453 // AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone ); |
2901 | 454 AddSeparator( DVDSubMenu ); |
13852 | 455 DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
456 if ( guiIntfStruct.DVD.titles ) |
3054 | 457 { |
458 char tmp[32]; int i; | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
459 for ( i=1 ; i<= guiIntfStruct.DVD.titles;i++ ) |
3054 | 460 { |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
461 snprintf( tmp,32,MSGTR_MENU_Title,i); |
13852 | 462 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp, |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
463 guiIntfStruct.DVD.current_title == i, |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
464 (i << 16) + evSetDVDTitle ); |
3054 | 465 } |
466 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
467 else |
3590 | 468 { |
13852 | 469 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone ); |
3590 | 470 gtk_widget_set_sensitive( MenuItem,FALSE ); |
471 } | |
13852 | 472 DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
473 if ( guiIntfStruct.DVD.chapters ) |
3054 | 474 { |
475 char tmp[32]; int i; | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
476 for ( i=1;i <= guiIntfStruct.DVD.chapters;i++ ) |
3054 | 477 { |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
478 snprintf( tmp,32,MSGTR_MENU_Chapter,i ); |
13852 | 479 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiIntfStruct.DVD.current_chapter == i, |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
480 ( i << 16 ) + evSetDVDChapter ); |
3054 | 481 } |
482 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
483 else |
3590 | 484 { |
13852 | 485 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone ); |
3590 | 486 gtk_widget_set_sensitive( MenuItem,FALSE ); |
487 } | |
13852 | 488 DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)tongue_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
489 if ( guiIntfStruct.DVD.nr_of_audio_channels ) |
3054 | 490 { |
9038 | 491 char tmp[64]; int i, id = guiIntfStruct.demuxer ? ((demuxer_t *)guiIntfStruct.demuxer)->audio->id : audio_id; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
492 for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ ) |
3054 | 493 { |
6651 | 494 snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ), |
495 ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ], | |
496 ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] ); | |
9038 | 497 // if ( id == -1 ) id=audio_id; //guiIntfStruct.DVD.audio_streams[i].id; |
13852 | 498 AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp, |
8423 | 499 id == guiIntfStruct.DVD.audio_streams[i].id, |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
500 ( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); |
3054 | 501 } |
502 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
503 else |
3590 | 504 { |
13852 | 505 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone ); |
3590 | 506 gtk_widget_set_sensitive( MenuItem,FALSE ); |
507 } | |
13852 | 508 DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)tonguebla_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
509 if ( guiIntfStruct.DVD.nr_of_subtitles ) |
3054 | 510 { |
511 char tmp[64]; int i; | |
13852 | 512 AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
513 for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ ) |
3054 | 514 { |
7583 | 515 snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) ); |
13852 | 516 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp, |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
517 dvdsub_id == guiIntfStruct.DVD.subtitles[i].id, |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
518 ( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); |
3054 | 519 } |
520 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3618
diff
changeset
|
521 else |
3590 | 522 { |
13852 | 523 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone ); |
3590 | 524 gtk_widget_set_sensitive( MenuItem,FALSE ); |
525 } | |
3054 | 526 #endif |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
527 |
8378 | 528 // if ( guiIntfStruct.Playing ) |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
529 { |
13852 | 530 AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio ); |
531 AddMenuItem( window1, (const char*)a11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); | |
532 AddMenuItem( window1, (const char*)a169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); | |
533 AddMenuItem( window1, (const char*)a43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); | |
534 AddMenuItem( window1, (const char*)a235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); | |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
535 } |
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
536 |
8423 | 537 if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD ) |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
538 { |
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
539 int i,c = 0; |
8378 | 540 |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
541 for ( i=0;i < MAX_A_STREAMS;i++ ) |
8378 | 542 if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) c++; |
543 | |
544 if ( c > 1 ) | |
545 { | |
13852 | 546 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack ); |
8378 | 547 for ( i=0;i < MAX_A_STREAMS;i++ ) |
548 if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) | |
549 { | |
550 char tmp[32]; | |
551 snprintf( tmp,32,MSGTR_MENU_Track,i ); | |
13852 | 552 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( i << 16 ) + evSetAudio ); |
8378 | 553 } |
554 } | |
555 | |
556 for ( c=0,i=0;i < MAX_V_STREAMS;i++ ) | |
557 if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) c++; | |
558 | |
559 if ( c > 1 ) | |
560 { | |
13852 | 561 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack ); |
8378 | 562 for ( i=0;i < MAX_V_STREAMS;i++ ) |
563 if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) | |
564 { | |
565 char tmp[32]; | |
566 snprintf( tmp,32,MSGTR_MENU_Track,i ); | |
13852 | 567 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( i << 16 ) + evSetVideo ); |
8378 | 568 } |
569 } | |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
570 } |
7541 | 571 |
2901 | 572 AddSeparator( Menu ); |
13852 | 573 MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer.muted,evMute ); |
8299 | 574 if ( !guiIntfStruct.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE ); |
13852 | 575 AddMenuItem( window1, (const char*)pl_xpm, Menu,MSGTR_MENU_PlayList, evPlayList ); |
576 AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); | |
577 AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences ); | |
578 AddMenuItem( window1, (const char*)eq_xpm, Menu,MSGTR_Equalizer, evEqualizer ); | |
8278
1cbee32a0627
if no have subwindow ... some menupoint is disabled:)
pontscho
parents:
8043
diff
changeset
|
579 |
1cbee32a0627
if no have subwindow ... some menupoint is disabled:)
pontscho
parents:
8043
diff
changeset
|
580 if ( guiIntfStruct.NoWindow == False ) |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
581 { |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
582 int b1 = 0, b2 = 0; |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8299
diff
changeset
|
583 AddSeparator( Menu ); |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
584 if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing ) |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
585 { |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
586 if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&& |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
587 ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight * 2 ) ) b2=1; |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
588 else b1=1; |
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
589 } else b1=!appMPlayer.subWindow.isFullScreen; |
13852 | 590 N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize ); |
591 D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); | |
592 F=AddMenuCheckItem( window1, (const char*)fs_xpm, Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen ); | |
9202 | 593 } |
594 | |
595 if ( !gtkShowVideoWindow && !guiIntfStruct.Playing ) | |
596 { | |
597 gtk_widget_set_sensitive( N,FALSE ); | |
598 gtk_widget_set_sensitive( D,FALSE ); | |
599 gtk_widget_set_sensitive( F,FALSE ); | |
7821
1efdf16883a0
add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch
pontscho
parents:
7583
diff
changeset
|
600 } |
8278
1cbee32a0627
if no have subwindow ... some menupoint is disabled:)
pontscho
parents:
8043
diff
changeset
|
601 |
6903 | 602 AddSeparator( Menu ); |
13852 | 603 AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit ); |
2901 | 604 |
605 return Menu; | |
606 } |