2901
|
1
|
|
2 #include <stdio.h>
|
|
3 #include <stdlib.h>
|
3054
|
4 #include <string.h>
|
|
5
|
|
6 #include "../../../config.h"
|
2901
|
7
|
|
8 #include "../../events.h"
|
3054
|
9
|
2901
|
10 #include "menu.h"
|
|
11 #include "../widgets.h"
|
|
12
|
|
13 void ActivateMenuItem( int Item )
|
|
14 {
|
2940
|
15 // fprintf( stderr,"[menu] item: %d\n",Item );
|
3054
|
16 gtkShMem->popupmenu=Item & 0x0000ffff;
|
|
17 gtkShMem->popupmenuparam=Item >> 16;
|
|
18 gtkShMem->visiblepopupmenu=0;
|
2940
|
19 gtkSendMessage( evShowPopUpMenu );
|
2901
|
20 }
|
|
21
|
|
22 GtkWidget * AddMenuItem( GtkWidget * Menu,char * label,int Number )
|
|
23 {
|
|
24 GtkWidget * Item = NULL;
|
|
25 Item=gtk_menu_item_new_with_label( label );
|
|
26 gtk_menu_append( GTK_MENU( Menu ),Item );
|
|
27 gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
|
|
28 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
|
|
29 gtk_widget_show( Item );
|
|
30 return Item;
|
|
31 }
|
|
32
|
|
33 GtkWidget * AddSubMenu( GtkWidget * Menu,char * label )
|
|
34 {
|
|
35 GtkWidget * Item = NULL;
|
|
36 GtkWidget * SubItem = NULL;
|
|
37
|
|
38 SubItem=gtk_menu_item_new_with_label( label );
|
|
39 gtk_menu_append( GTK_MENU( Menu ),SubItem );
|
|
40 gtk_widget_show( SubItem );
|
|
41
|
|
42 Item=gtk_menu_new();
|
|
43 gtk_widget_show( Item );
|
|
44 gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item );
|
|
45 return Item;
|
|
46 }
|
|
47
|
|
48 GtkWidget * AddSeparator( GtkWidget * Menu )
|
|
49 {
|
|
50 GtkWidget * Item = NULL;
|
|
51
|
|
52 Item=gtk_menu_item_new ();
|
|
53 gtk_widget_show( Item );
|
|
54 gtk_container_add( GTK_CONTAINER( Menu ),Item );
|
|
55 gtk_widget_set_sensitive( Item,FALSE );
|
|
56
|
|
57 return Item;
|
|
58 }
|
|
59
|
3054
|
60 typedef struct
|
|
61 {
|
|
62 int id;
|
|
63 char * name;
|
|
64 } Languages_t;
|
|
65
|
|
66 #define lng( a,b ) ( (int)(a) * 256 + b )
|
|
67 Languages_t Languages[] =
|
|
68 {
|
|
69 { lng( 'a','b' ), "Abkhazian" },
|
|
70 { lng( 'a','a' ), "Afar" },
|
|
71 { lng( 'a','f' ), "Afrikaans" },
|
|
72 { lng( 's','q' ), "Albanian" },
|
|
73 { lng( 'a','m' ), "Amharic" },
|
|
74 { lng( 'a','r' ), "Arabic" },
|
|
75 { lng( 'h','y' ), "Armenian" },
|
|
76 { lng( 'a','s' ), "Assamese" },
|
|
77 { lng( 'a','e' ), "Avestan" },
|
|
78 { lng( 'a','y' ), "Aymara" },
|
|
79 { lng( 'a','z' ), "Azerbaijani" },
|
|
80 { lng( 'b','a' ), "Bashkir" },
|
|
81 { lng( 'e','u' ), "Basque" },
|
|
82 { lng( 'b','e' ), "Belarusian" },
|
|
83 { lng( 'b','n' ), "Bengali" },
|
|
84 { lng( 'b','h' ), "Bihari" },
|
|
85 { lng( 'b','i' ), "Bislama" },
|
|
86 { lng( 'b','s' ), "Bosnian" },
|
|
87 { lng( 'b','r' ), "Breton" },
|
|
88 { lng( 'b','g' ), "Bulgarian" },
|
|
89 { lng( 'm','y' ), "Burmese" },
|
|
90 { lng( 'c','a' ), "Catalan" },
|
|
91 { lng( 'c','h' ), "Chamorro" },
|
|
92 { lng( 'c','e' ), "Chechen" },
|
|
93 { lng( 'n','y' ), "Chichewa;Nyanja" },
|
|
94 { lng( 'z','h' ), "Chinese" },
|
|
95 { lng( 'c','u' ), "ChurchSlavic" },
|
|
96 { lng( 'c','v' ), "Chuvash" },
|
|
97 { lng( 'k','w' ), "Cornish" },
|
|
98 { lng( 'c','o' ), "Corsican" },
|
|
99 { lng( 'h','r' ), "Croatian" },
|
|
100 { lng( 'c','s' ), "Czech" },
|
|
101 { lng( 'd','a' ), "Danish" },
|
|
102 { lng( 'n','l' ), "Dutch" },
|
|
103 { lng( 'd','z' ), "Dzongkha" },
|
|
104 { lng( 'e','n' ), "English" },
|
|
105 { lng( 'e','o' ), "Esperanto" },
|
|
106 { lng( 'e','t' ), "Estonian" },
|
|
107 { lng( 'f','o' ), "Faroese" },
|
|
108 { lng( 'f','j' ), "Fijian" },
|
|
109 { lng( 'f','i' ), "Finnish" },
|
|
110 { lng( 'f','r' ), "French" },
|
|
111 { lng( 'f','y' ), "Frisian" },
|
|
112 { lng( 'g','d' ), "Gaelic(Scots" },
|
|
113 { lng( 'g','l' ), "Gallegan" },
|
|
114 { lng( 'k','a' ), "Georgian" },
|
|
115 { lng( 'd','e' ), "German" },
|
|
116 { lng( 'e','l' ), "Greek" },
|
|
117 { lng( 'g','n' ), "Guarani" },
|
|
118 { lng( 'g','u' ), "Gujarati" },
|
|
119 { lng( 'h','a' ), "Hausa" },
|
|
120 { lng( 'h','e' ), "Hebrew" },
|
|
121 { lng( 'i','w' ), "Hebrew" },
|
|
122 { lng( 'h','z' ), "Herero" },
|
|
123 { lng( 'h','i' ), "Hindi" },
|
|
124 { lng( 'h','o' ), "HiriMotu" },
|
|
125 { lng( 'h','u' ), "Hungarian" },
|
|
126 { lng( 'i','s' ), "Icelandic" },
|
|
127 { lng( 'i','d' ), "Indonesian" },
|
|
128 { lng( 'i','n' ), "Indonesian" },
|
|
129 { lng( 'i','a' ), "Interlingua" },
|
|
130 { lng( 'i','e' ), "Interlingue" },
|
|
131 { lng( 'i','u' ), "Inuktitut" },
|
|
132 { lng( 'i','k' ), "Inupiaq" },
|
|
133 { lng( 'g','a' ), "Irish" },
|
|
134 { lng( 'i','t' ), "Italian" },
|
|
135 { lng( 'j','a' ), "Japanese" },
|
|
136 { lng( 'j','v' ), "Javanese" },
|
|
137 { lng( 'j','w' ), "Javanese" },
|
|
138 { lng( 'k','l' ), "Kalaallisut" },
|
|
139 { lng( 'k','n' ), "Kannada" },
|
|
140 { lng( 'k','s' ), "Kashmiri" },
|
|
141 { lng( 'k','k' ), "Kazakh" },
|
|
142 { lng( 'k','m' ), "Khmer" },
|
|
143 { lng( 'k','i' ), "Kikuyu" },
|
|
144 { lng( 'r','w' ), "Kinyarwanda" },
|
|
145 { lng( 'k','y' ), "Kirghiz" },
|
|
146 { lng( 'k','v' ), "Komi" },
|
|
147 { lng( 'k','o' ), "Korean" },
|
|
148 { lng( 'k','j' ), "Kuanyama" },
|
|
149 { lng( 'k','u' ), "Kurdish" },
|
|
150 { lng( 'l','o' ), "Lao" },
|
|
151 { lng( 'l','a' ), "Latin" },
|
|
152 { lng( 'l','v' ), "Latvian" },
|
|
153 { lng( 'l','b' ), "Letzeburgesch" },
|
|
154 { lng( 'l','n' ), "Lingala" },
|
|
155 { lng( 'l','t' ), "Lithuanian" },
|
|
156 { lng( 'm','k' ), "Macedonian" },
|
|
157 { lng( 'm','g' ), "Malagasy" },
|
|
158 { lng( 'm','s' ), "Malay" },
|
|
159 { lng( 'm','l' ), "Malayalam" },
|
|
160 { lng( 'm','t' ), "Maltese" },
|
|
161 { lng( 'g','v' ), "Manx" },
|
|
162 { lng( 'm','i' ), "Maori" },
|
|
163 { lng( 'm','r' ), "Marathi" },
|
|
164 { lng( 'm','h' ), "Marshall" },
|
|
165 { lng( 'm','o' ), "Moldavian" },
|
|
166 { lng( 'm','n' ), "Mongolian" },
|
|
167 { lng( 'n','a' ), "Nauru" },
|
|
168 { lng( 'n','v' ), "Navajo" },
|
|
169 { lng( 'n','d' ), "North Ndebele" },
|
|
170 { lng( 'n','r' ), "South Ndebele" },
|
|
171 { lng( 'n','g' ), "Ndonga" },
|
|
172 { lng( 'n','e' ), "Nepali" },
|
|
173 { lng( 's','e' ), "NorthernSami" },
|
|
174 { lng( 'n','o' ), "Norwegian" },
|
|
175 { lng( 'n','b' ), "NorwegianBokmål" },
|
|
176 { lng( 'n','n' ), "NorwegianNynorsk" },
|
|
177 { lng( 'n','y' ), "Nyanja;Chichewa" },
|
|
178 { lng( 'o','c' ), "Occitan(post1500;Provençal" },
|
|
179 { lng( 'o','r' ), "Oriya" },
|
|
180 { lng( 'o','m' ), "Oromo" },
|
|
181 { lng( 'o','s' ), "Ossetian;Ossetic" },
|
|
182 { lng( 'p','i' ), "Pali" },
|
|
183 { lng( 'p','a' ), "Panjabi" },
|
|
184 { lng( 'f','a' ), "Persian" },
|
|
185 { lng( 'p','l' ), "Polish" },
|
|
186 { lng( 'p','t' ), "Portuguese" },
|
|
187 { lng( 'o','c' ), "Provençal;Occitan(post1500" },
|
|
188 { lng( 'p','s' ), "Pushto" },
|
|
189 { lng( 'q','u' ), "Quechua" },
|
|
190 { lng( 'r','m' ), "Raeto-Romance" },
|
|
191 { lng( 'r','o' ), "Romanian" },
|
|
192 { lng( 'r','n' ), "Rundi" },
|
|
193 { lng( 'r','u' ), "Russian" },
|
|
194 { lng( 's','m' ), "Samoan" },
|
|
195 { lng( 's','g' ), "Sango" },
|
|
196 { lng( 's','a' ), "Sanskrit" },
|
|
197 { lng( 's','c' ), "Sardinian" },
|
|
198 { lng( 's','r' ), "Serbian" },
|
|
199 { lng( 's','n' ), "Shona" },
|
|
200 { lng( 's','d' ), "Sindhi" },
|
|
201 { lng( 's','i' ), "Sinhalese" },
|
|
202 { lng( 's','k' ), "Slovak" },
|
|
203 { lng( 's','l' ), "Slovenian" },
|
|
204 { lng( 's','o' ), "Somali" },
|
|
205 { lng( 's','t' ), "Sotho" },
|
|
206 { lng( 'e','s' ), "Spanish" },
|
|
207 { lng( 's','u' ), "Sundanese" },
|
|
208 { lng( 's','w' ), "Swahili" },
|
|
209 { lng( 's','s' ), "Swati" },
|
|
210 { lng( 's','v' ), "Swedish" },
|
|
211 { lng( 't','l' ), "Tagalog" },
|
|
212 { lng( 't','y' ), "Tahitian" },
|
|
213 { lng( 't','g' ), "Tajik" },
|
|
214 { lng( 't','a' ), "Tamil" },
|
|
215 { lng( 't','t' ), "Tatar" },
|
|
216 { lng( 't','e' ), "Telugu" },
|
|
217 { lng( 't','h' ), "Thai" },
|
|
218 { lng( 'b','o' ), "Tibetan" },
|
|
219 { lng( 't','i' ), "Tigrinya" },
|
|
220 { lng( 't','o' ), "Tonga" },
|
|
221 { lng( 't','s' ), "Tsonga" },
|
|
222 { lng( 't','n' ), "Tswana" },
|
|
223 { lng( 't','r' ), "Turkish" },
|
|
224 { lng( 't','k' ), "Turkmen" },
|
|
225 { lng( 't','w' ), "Twi" },
|
|
226 { lng( 'u','g' ), "Uighur" },
|
|
227 { lng( 'u','k' ), "Ukrainian" },
|
|
228 { lng( 'u','r' ), "Urdu" },
|
|
229 { lng( 'u','z' ), "Uzbek" },
|
|
230 { lng( 'v','i' ), "Vietnamese" },
|
|
231 { lng( 'v','o' ), "Volapük" },
|
|
232 { lng( 'c','y' ), "Welsh" },
|
|
233 { lng( 'w','o' ), "Wolof" },
|
|
234 { lng( 'x','h' ), "Xhosa" },
|
|
235 { lng( 'y','i' ), "Yiddish" },
|
|
236 { lng( 'j','i' ), "Yiddish" },
|
|
237 { lng( 'y','o' ), "Yoruba" },
|
|
238 { lng( 'z','a' ), "Zhuang" },
|
|
239 { lng( 'z','u' ), "Zulu" },
|
|
240 };
|
|
241 #undef lng
|
|
242
|
|
243 char * GetLanguage( int language )
|
|
244 {
|
|
245 int i;
|
|
246 for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ )
|
|
247 if ( Languages[i].id == language ) return Languages[i].name;
|
|
248 }
|
|
249
|
2901
|
250 GtkWidget * DVDSubMenu;
|
2980
|
251 GtkWidget * DVDTitleMenu;
|
3054
|
252 GtkWidget * DVDChapterMenu;
|
2940
|
253 GtkWidget * DVDAudioLanguageMenu;
|
|
254 GtkWidget * DVDSubtitleLanguageMenu;
|
2901
|
255
|
|
256 GtkWidget * create_PopUpMenu( void )
|
|
257 {
|
|
258 GtkWidget * Menu = NULL;
|
|
259 GtkWidget * SubMenu = NULL;
|
|
260
|
|
261 Menu=gtk_menu_new();
|
|
262
|
|
263 AddMenuItem( Menu,"About MPlayer"" ", evAbout );
|
|
264 AddSeparator( Menu );
|
|
265 SubMenu=AddSubMenu( Menu,"Open ..." );
|
2940
|
266 AddMenuItem( SubMenu,"Play file ..."" ", evLoadPlay );
|
2901
|
267 AddMenuItem( SubMenu,"Play VCD ...", evNone );
|
3054
|
268 #ifdef USE_DVDREAD
|
2980
|
269 AddMenuItem( SubMenu,"Play DVD ...", evPlayDVD );
|
3054
|
270 #endif
|
2901
|
271 AddMenuItem( SubMenu,"Play URL ...", evNone );
|
|
272 AddMenuItem( SubMenu,"Load subtitle ... ", evLoadSubtitle );
|
|
273 SubMenu=AddSubMenu( Menu,"Playing" );
|
|
274 AddMenuItem( SubMenu,"Play"" ", evPlay );
|
|
275 AddMenuItem( SubMenu,"Pause", evPause );
|
|
276 AddMenuItem( SubMenu,"Stop", evStop );
|
|
277 AddMenuItem( SubMenu,"Prev stream", evPrev );
|
|
278 AddMenuItem( SubMenu,"Next stream", evNext );
|
3054
|
279 // AddSeparator( SubMenu );
|
|
280 // AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
|
|
281 // AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
|
|
282 // AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
|
|
283 // AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
|
2901
|
284 SubMenu=AddSubMenu( Menu,"Size" );
|
|
285 AddMenuItem( SubMenu,"Normal size"" ", evNormalSize );
|
|
286 AddMenuItem( SubMenu,"Double size", evDoubleSize );
|
|
287 AddMenuItem( SubMenu,"Fullscreen", evFullScreen );
|
3054
|
288 #ifdef USE_DVDREAD
|
2901
|
289 DVDSubMenu=AddSubMenu( Menu,"DVD" );
|
2980
|
290 AddMenuItem( DVDSubMenu,"Play disc ..."" ", evPlayDVD );
|
2901
|
291 AddMenuItem( DVDSubMenu,"Show DVD Menu", evNone );
|
|
292 AddSeparator( DVDSubMenu );
|
2980
|
293 DVDTitleMenu=AddSubMenu( DVDSubMenu,"Titles" );
|
3054
|
294 if ( gtkShMem->DVD.titles )
|
|
295 {
|
|
296 char tmp[32]; int i;
|
|
297 for ( i=0;i<gtkShMem->DVD.titles;i++ )
|
|
298 {
|
|
299 sprintf( tmp,"Title %2d",i+1 );
|
|
300 AddMenuItem( DVDTitleMenu,tmp,( (i+1) << 16 ) + evSetDVDTitle );
|
|
301 }
|
|
302 }
|
|
303 else AddMenuItem( DVDTitleMenu,"(none)",evNone );
|
|
304 DVDChapterMenu=AddSubMenu( DVDSubMenu,"Chapter" );
|
|
305 if ( gtkShMem->DVD.chapters )
|
|
306 {
|
|
307 char tmp[32]; int i;
|
|
308 for ( i=0;i<gtkShMem->DVD.chapters;i++ )
|
|
309 {
|
|
310 sprintf( tmp,"Chapter %2d",i+1 );
|
|
311 AddMenuItem( DVDChapterMenu,tmp,( (i+1) << 16 ) + evSetDVDChapter );
|
|
312 }
|
|
313 }
|
|
314 else DVDChapterMenu=AddMenuItem( DVDChapterMenu,"(none)",evNone );
|
2940
|
315 DVDAudioLanguageMenu=AddSubMenu( DVDSubMenu,"Audio language" );
|
3054
|
316 if ( gtkShMem->DVD.nr_of_audio_channels )
|
|
317 {
|
|
318 char tmp[64]; int i;
|
|
319 for ( i=0;i<gtkShMem->DVD.nr_of_audio_channels;i++ )
|
|
320 {
|
|
321 strcpy( tmp,GetLanguage( gtkShMem->DVD.audio_streams[i].language ) );
|
|
322 AddMenuItem( DVDAudioLanguageMenu,tmp,( gtkShMem->DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
|
|
323 }
|
|
324 }
|
|
325 else DVDChapterMenu=AddMenuItem( DVDAudioLanguageMenu,"(none)",evNone );
|
2940
|
326 DVDSubtitleLanguageMenu=AddSubMenu( DVDSubMenu,"Subtitle language" );
|
3054
|
327 if ( gtkShMem->DVD.nr_of_subtitles )
|
|
328 {
|
|
329 char tmp[64]; int i;
|
|
330 for ( i=0;i<gtkShMem->DVD.nr_of_subtitles;i++ )
|
|
331 {
|
|
332 strcpy( tmp,GetLanguage( gtkShMem->DVD.subtitles[i].language ) );
|
|
333 AddMenuItem( DVDSubtitleLanguageMenu,tmp,( gtkShMem->DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle );
|
|
334 }
|
|
335 }
|
|
336 else DVDChapterMenu=AddMenuItem( DVDSubtitleLanguageMenu,"(none)",evNone );
|
|
337 #endif
|
2901
|
338 AddSeparator( Menu );
|
|
339 AddMenuItem( Menu,"Playlist", evPlayList );
|
|
340 AddMenuItem( Menu,"Skin browser", evSkinBrowser );
|
|
341 AddMenuItem( Menu,"Preferences", evPreferences );
|
|
342 AddSeparator( Menu );
|
|
343 AddMenuItem( Menu,"Exit ...", evExit );
|
|
344
|
|
345 return Menu;
|
|
346 }
|