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