]> git.sesse.net Git - vlc/blob - modules/gui/wince/menus.cpp
* modules/gui/wince/*: New Windows CE interface by Cedric Marodon <cedric_marodon...
[vlc] / modules / gui / wince / menus.cpp
1 /*****************************************************************************
2  * menus.cpp : WinCE gui plugin for VLC
3  *****************************************************************************
4  * Copyright (C) 2000-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include <stdlib.h>                                      /* malloc(), free() */
29 #include <string.h>                                            /* strerror() */
30 #include <stdio.h>
31
32 #include <string>
33 #include <stdio.h>
34 using namespace std; 
35
36 #include <vlc/vlc.h>
37 #include <vlc/intf.h>
38
39 #include "wince.h"
40
41 /*****************************************************************************
42  * Event Table.
43  *****************************************************************************/
44
45 /* IDs for the controls and the menu commands */
46 enum
47 {
48     /* menu items */
49     MenuDummy_Event = 1000,
50     OpenFileSimple_Event = 1100,
51     OpenFile_Event,
52     OpenDisc_Event,
53     OpenNet_Event,
54     FirstAutoGenerated_Event = 1999,
55     SettingsMenu_Events = 2000,
56     AudioMenu_Events = 3000,
57     VideoMenu_Events = 4000,
58     NavigMenu_Events = 5000,
59     PopupMenu_Events = 6000
60 };
61
62 void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu )
63 {
64 #define MAX_AUDIO_ITEMS 10
65
66     vlc_object_t *p_object;
67     char *ppsz_varnames[MAX_AUDIO_ITEMS];
68     int pi_objects[MAX_AUDIO_ITEMS];
69     vector<MenuItemExt*>::iterator iter;
70     int i;
71
72     /* Delete old menu */
73     int count = wce_GetMenuItemCount( hMenu );
74     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
75         
76     if( p_intf->p_sys->p_audio_menu )
77     {
78         for( iter = p_intf->p_sys->p_audio_menu->begin();
79              iter != p_intf->p_sys->p_audio_menu->end(); iter++ )
80             delete *iter;
81         p_intf->p_sys->p_audio_menu->clear();
82     }
83     else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>;
84
85     /* Initializations */
86     memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );
87     i = 0;
88
89     p_object = (vlc_object_t *)
90         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
91     if( p_object != NULL )
92     {
93         ppsz_varnames[i] = "audio-es";
94         pi_objects[i++] = p_object->i_object_id;
95         vlc_object_release( p_object );
96     }
97
98     p_object = (vlc_object_t *)
99         vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
100     if( p_object != NULL )
101     {
102         ppsz_varnames[i] = "audio-device";
103         pi_objects[i++] = p_object->i_object_id;
104         ppsz_varnames[i] = "audio-channels";
105         pi_objects[i++] = p_object->i_object_id;
106         ppsz_varnames[i] = "visual";
107         pi_objects[i++] = p_object->i_object_id;
108         vlc_object_release( p_object );
109     }
110
111     /* Build menu */
112     RefreshMenu( p_intf, p_intf->p_sys->p_audio_menu,
113                  hMenu, i, ppsz_varnames, pi_objects, AudioMenu_Events );
114 }
115
116 void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu )
117 {
118 #define MAX_VIDEO_ITEMS 15
119
120     vlc_object_t *p_object;
121     char *ppsz_varnames[MAX_VIDEO_ITEMS];
122     int pi_objects[MAX_VIDEO_ITEMS];
123     vector<MenuItemExt*>::iterator iter;
124     int i;
125
126     /* Delete old menu */
127     int count = wce_GetMenuItemCount( hMenu );
128     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
129         
130     if( p_intf->p_sys->p_video_menu )
131     {
132         for( iter = p_intf->p_sys->p_video_menu->begin();
133              iter != p_intf->p_sys->p_video_menu->end(); iter++ )
134             delete *iter;
135         p_intf->p_sys->p_video_menu->clear();
136     }
137     else p_intf->p_sys->p_video_menu = new vector<MenuItemExt*>;
138         
139     /* Initializations */
140     memset( pi_objects, 0, MAX_VIDEO_ITEMS * sizeof(int) );
141     i = 0;
142
143     p_object = (vlc_object_t *)
144         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
145     if( p_object != NULL )
146     {
147         ppsz_varnames[i] = "video-es";
148         pi_objects[i++] = p_object->i_object_id;
149         ppsz_varnames[i] = "spu-es";
150         pi_objects[i++] = p_object->i_object_id;
151         vlc_object_release( p_object );
152     }
153
154     p_object = (vlc_object_t *)
155         vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
156     if( p_object != NULL )
157     {
158         vlc_object_t *p_dec_obj;
159
160         ppsz_varnames[i] = "fullscreen";
161         pi_objects[i++] = p_object->i_object_id;
162 #ifdef WINCE
163         ppsz_varnames[i] = "transform";
164         pi_objects[i++] = p_object->i_object_id;
165 #endif
166         ppsz_varnames[i] = "zoom";
167         pi_objects[i++] = p_object->i_object_id;
168         ppsz_varnames[i] = "deinterlace";
169         pi_objects[i++] = p_object->i_object_id;
170         ppsz_varnames[i] = "aspect-ratio";
171         pi_objects[i++] = p_object->i_object_id;
172         ppsz_varnames[i] = "crop";
173         pi_objects[i++] = p_object->i_object_id;
174         ppsz_varnames[i] = "directx-on-top";
175         pi_objects[i++] = p_object->i_object_id;
176
177         p_dec_obj = (vlc_object_t *)
178             vlc_object_find( p_object, VLC_OBJECT_DECODER, FIND_PARENT );
179         if( p_dec_obj != NULL )
180         {
181             ppsz_varnames[i] = "ffmpeg-pp-q";
182             pi_objects[i++] = p_dec_obj->i_object_id;
183             vlc_object_release( p_dec_obj );
184         }
185
186         vlc_object_release( p_object );
187     }
188
189     /* Build menu */
190     RefreshMenu( p_intf, p_intf->p_sys->p_video_menu, hMenu, i,
191                  ppsz_varnames, pi_objects, VideoMenu_Events );
192 }
193
194 void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu )
195 {
196 #define MAX_NAVIG_ITEMS 10
197
198     vlc_object_t *p_object;
199     char *ppsz_varnames[MAX_NAVIG_ITEMS];
200     int pi_objects[MAX_NAVIG_ITEMS];
201     vector<MenuItemExt*>::iterator iter;
202     int i;
203
204     /* Delete old menu */
205     int count = wce_GetMenuItemCount( hMenu );
206     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
207         
208     if( p_intf->p_sys->p_navig_menu )
209     {
210         for( iter = p_intf->p_sys->p_navig_menu->begin();
211              iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
212             delete *iter;
213         p_intf->p_sys->p_navig_menu->clear();
214     }
215     else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>;
216
217     /* Initializations */
218     memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(int) );
219     i = 0;
220
221     p_object = (vlc_object_t *)
222         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
223     if( p_object != NULL )
224     {
225         ppsz_varnames[i] = "title";
226         pi_objects[i++] = p_object->i_object_id;
227         ppsz_varnames[i] = "chapter";
228         pi_objects[i++] = p_object->i_object_id;
229         ppsz_varnames[i] = "program";
230         pi_objects[i++] = p_object->i_object_id;
231         ppsz_varnames[i] = "navigation";
232         pi_objects[i++] = p_object->i_object_id;
233         ppsz_varnames[i] = "dvd_menus";
234         pi_objects[i++] = p_object->i_object_id;
235
236         ppsz_varnames[i] = "prev-title";
237         pi_objects[i++] = p_object->i_object_id;
238         ppsz_varnames[i] = "next-title";
239         pi_objects[i++] = p_object->i_object_id;
240         ppsz_varnames[i] = "prev-chapter";
241         pi_objects[i++] = p_object->i_object_id;
242         ppsz_varnames[i] = "next-chapter";
243         pi_objects[i++] = p_object->i_object_id;
244
245         vlc_object_release( p_object );
246     }
247
248     /* Build menu */
249     RefreshMenu( p_intf, p_intf->p_sys->p_navig_menu, hMenu, i,
250                  ppsz_varnames, pi_objects, NavigMenu_Events );
251 }
252
253 void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu )
254 {
255 #define MAX_SETTINGS_ITEMS 10
256
257     vlc_object_t *p_object;
258     char *ppsz_varnames[MAX_SETTINGS_ITEMS];
259     int pi_objects[MAX_SETTINGS_ITEMS];
260     vector<MenuItemExt*>::iterator iter;
261     int i;
262
263     /* Delete old menu */
264     int count = wce_GetMenuItemCount( hMenu );
265     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
266
267     if( p_intf->p_sys->p_settings_menu )
268     {
269         for( iter = p_intf->p_sys->p_settings_menu->begin();
270              iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
271             delete(*iter);
272         p_intf->p_sys->p_settings_menu->clear();
273     }
274     else p_intf->p_sys->p_settings_menu = new vector<MenuItemExt*>;
275
276     /* Initializations */
277     memset( pi_objects, 0, MAX_SETTINGS_ITEMS * sizeof(int) );
278     i = 0;
279
280     AppendMenu( hMenu, MF_STRING, ID_SETTINGS_EXTEND, _T("&Extended GUI") );
281     AppendMenu( hMenu, MF_STRING, ID_SETTINGS_PREF, _T("&Preferences...") );
282
283     p_object = (vlc_object_t *)
284         vlc_object_find( p_intf, VLC_OBJECT_INTF, FIND_PARENT );
285     if( p_object != NULL )
286     {
287         ppsz_varnames[i] = "intf-switch";
288         pi_objects[i++] = p_object->i_object_id;
289         ppsz_varnames[i] = "intf-add";
290         pi_objects[i++] = p_object->i_object_id;
291         vlc_object_release( p_object );
292     }
293
294     /* Build menu */
295     RefreshMenu( p_intf, p_intf->p_sys->p_settings_menu, hMenu, i,
296                  ppsz_varnames, pi_objects, SettingsMenu_Events );
297 }
298
299 /*****************************************************************************
300  * Refresh the menu.
301  *****************************************************************************/
302 void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
303                   HMENU hMenu , int i_count, char **ppsz_varnames, 
304                   int *pi_objects, int i_start_id )
305 {
306     vlc_object_t *p_object;
307     vlc_bool_t b_section_empty = VLC_FALSE;
308     int i;
309
310     /* Initializations */
311     int i_item_id = i_start_id;
312
313     for( i = 0; i < i_count; i++ )
314     {
315         if( !ppsz_varnames[i] )
316         {
317             if( b_section_empty )
318             {
319                 AppendMenu( hMenu, MF_GRAYED | MF_STRING,
320                             MenuDummy_Event + i, _T("Empty") );
321             }
322
323             AppendMenu( hMenu, MF_SEPARATOR, 0, _T("") );
324             b_section_empty = VLC_TRUE;
325             continue;
326         }
327
328         if( !pi_objects[i] )
329         {
330             AppendMenu( hMenu, MF_GRAYED | MF_STRING,
331                         MenuDummy_Event, _FROMMB(ppsz_varnames[i]) );
332
333             b_section_empty = VLC_FALSE;
334             continue;
335         }
336
337         p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] );
338         if( p_object == NULL ) continue;
339
340         b_section_empty = VLC_FALSE;
341         CreateMenuItem( p_intf, _p_menuList, hMenu, ppsz_varnames[i],
342                         p_object, &i_item_id );
343         vlc_object_release( p_object );
344     }
345
346     /* Special case for empty menus */
347     if( wce_GetMenuItemCount(hMenu) == 0 || b_section_empty )
348     {
349         AppendMenu( hMenu, MF_GRAYED | MF_STRING,
350                     MenuDummy_Event + i, _T("Empty") );
351     }
352 }
353
354 /*****************************************************************************
355  * Private methods.
356  *****************************************************************************/
357 void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
358                      HMENU hMenu, char *psz_var, vlc_object_t *p_object,
359                      int *pi_item_id )
360 {
361     MenuItemExt *pMenuItemExt;
362     HMENU hMenuItem;
363     vlc_value_t val, text;
364     int i_type;
365
366     /* Check the type of the object variable */
367     i_type = var_Type( p_object, psz_var );
368
369     switch( i_type & VLC_VAR_TYPE )
370     {
371     case VLC_VAR_VOID:
372     case VLC_VAR_BOOL:
373     case VLC_VAR_VARIABLE:
374     case VLC_VAR_STRING:
375     case VLC_VAR_INTEGER:
376     case VLC_VAR_FLOAT:
377         break;
378     default:
379         /* Variable doesn't exist or isn't handled */
380         return;
381     }
382
383     /* Make sure we want to display the variable */
384     if( i_type & VLC_VAR_HASCHOICE )
385     {
386         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
387         if( val.i_int == 0 ) return;
388         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
389             return;
390     }
391
392     /* Get the descriptive name of the variable */
393     var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
394
395     var_Get( p_object, psz_var, &val );
396
397     if( i_type & VLC_VAR_HASCHOICE )
398     {
399         hMenuItem = CreateChoicesMenu( p_intf, _p_menuList, psz_var,
400                                        p_object, pi_item_id );
401         AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
402                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
403         if( text.psz_string ) free( text.psz_string );
404         return;
405     }
406
407     switch( i_type & VLC_VAR_TYPE )
408     {
409     case VLC_VAR_VOID:
410         AppendMenu( hMenu, MF_STRING , ++(*pi_item_id),
411                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
412         pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
413                                         p_object->i_object_id, val, i_type );
414         _p_menuList->push_back( pMenuItemExt );
415         break;
416
417     case VLC_VAR_BOOL:
418         val.b_bool = !val.b_bool;
419         AppendMenu( hMenu, MF_STRING | MF_CHECKED, ++(*pi_item_id),
420                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
421         pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
422                                         p_object->i_object_id, val, i_type );
423         _p_menuList->push_back( pMenuItemExt );
424         CheckMenuItem( hMenu, *pi_item_id ,
425                        ( val.b_bool ? MF_UNCHECKED : MF_CHECKED ) |
426                        MF_BYCOMMAND ); 
427         break;
428
429     default:
430         if( text.psz_string ) free( text.psz_string );
431         return;
432     }
433
434     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
435     if( text.psz_string ) free( text.psz_string );
436 }
437
438 HMENU CreateChoicesMenu( intf_thread_t *p_intf,
439                          vector<MenuItemExt*> *_p_menuList, char *psz_var, 
440                          vlc_object_t *p_object, int *pi_item_id )
441 {
442     MenuItemExt *pMenuItemExt;
443     vlc_value_t val, val_list, text_list;
444     int i_type, i;
445     HMENU hSubMenu = CreatePopupMenu();
446
447     /* Check the type of the object variable */
448     i_type = var_Type( p_object, psz_var );
449
450     /* Make sure we want to display the variable */
451     if( i_type & VLC_VAR_HASCHOICE )
452     {
453         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
454         if( val.i_int == 0 ) return NULL;
455         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
456             return NULL;
457     }
458     else
459     {
460         return NULL;
461     }
462
463     switch( i_type & VLC_VAR_TYPE )
464     {
465     case VLC_VAR_VOID:
466     case VLC_VAR_BOOL:
467     case VLC_VAR_VARIABLE:
468     case VLC_VAR_STRING:
469     case VLC_VAR_INTEGER:
470         break;
471     default:
472         /* Variable doesn't exist or isn't handled */
473         return NULL;
474     }
475
476     if( var_Get( p_object, psz_var, &val ) < 0 ) return NULL;
477
478     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
479                     &val_list, &text_list ) < 0 )
480     {
481         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
482         return NULL;
483     }
484
485     for( i = 0; i < val_list.p_list->i_count; i++ )
486     {
487         vlc_value_t another_val;
488         HMENU hMenuItem;
489         char *psz_tmp;
490
491         switch( i_type & VLC_VAR_TYPE )
492         {
493         case VLC_VAR_VARIABLE:
494             hMenuItem = CreateChoicesMenu( p_intf, _p_menuList,
495               val_list.p_list->p_values[i].psz_string, p_object, pi_item_id );
496             AppendMenu( hSubMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
497                         _FROMMB(text_list.p_list->p_values[i].psz_string ?
498                           text_list.p_list->p_values[i].psz_string :
499                           val_list.p_list->p_values[i].psz_string) );
500             break;
501
502         case VLC_VAR_STRING:
503             another_val.psz_string =
504                 strdup(val_list.p_list->p_values[i].psz_string);
505             AppendMenu( hSubMenu, MF_STRING, ++(*pi_item_id),
506                         _FROMMB(text_list.p_list->p_values[i].psz_string ?
507                           text_list.p_list->p_values[i].psz_string :
508                           val_list.p_list->p_values[i].psz_string) );
509             pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
510                           p_object->i_object_id, another_val, i_type );
511             _p_menuList->push_back( pMenuItemExt );
512
513             if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string &&
514                 !strcmp( val.psz_string,
515                          val_list.p_list->p_values[i].psz_string ) )
516               CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND);
517             break;
518
519         case VLC_VAR_INTEGER:
520             asprintf( &psz_tmp, "%d", val_list.p_list->p_values[i].i_int );
521             AppendMenu( hSubMenu, MF_STRING, ++(*pi_item_id),
522                         _FROMMB(text_list.p_list->p_values[i].psz_string ?
523                           text_list.p_list->p_values[i].psz_string : psz_tmp));
524             pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
525                 p_object->i_object_id, val_list.p_list->p_values[i], i_type );
526             _p_menuList->push_back( pMenuItemExt );
527
528             if( val_list.p_list->p_values[i].i_int == val.i_int )
529               CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND);
530             break;
531
532         default:
533             break;
534         }
535     }
536
537     /* Clean up everything */
538     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
539     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
540
541     return hSubMenu;
542 }
543
544 int wce_GetMenuItemCount(HMENU hMenu)
545 {
546     const int MAX_NUM_ITEMS = 256;
547     int iPos, iCount;
548
549     MENUITEMINFO mii;
550     memset( (char *)&mii, 0, sizeof(MENUITEMINFO) );
551     mii.cbSize = sizeof(MENUITEMINFO);
552
553     iCount = 0;
554     for( iPos = 0; iPos < MAX_NUM_ITEMS; iPos++ )
555     {
556         if( !GetMenuItemInfo(hMenu, (UINT)iPos, TRUE, &mii) ) break;
557         iCount++;
558     }
559
560     return iCount;
561 }
562
563 void OnMenuEvent( intf_thread_t *p_intf, int id )
564 {
565     MenuItemExt *p_menuitemext = NULL;
566     vector<MenuItemExt*>::iterator iter;
567
568     for( iter = p_intf->p_sys->p_settings_menu->begin();
569          iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
570         if( (*iter)->id == id )
571         {
572             p_menuitemext = *iter;
573             break;
574         }
575     for( iter = p_intf->p_sys->p_audio_menu->begin();
576          iter != p_intf->p_sys->p_audio_menu->end(); iter++ ) 
577         if( (*iter)->id == id )
578         {
579             p_menuitemext = *iter;
580             break;
581         }
582     for( iter = p_intf->p_sys->p_video_menu->begin();
583          iter != p_intf->p_sys->p_video_menu->end(); iter++ )
584         if( (*iter)->id == id )
585         {
586             p_menuitemext = *iter;
587             break;
588         }
589     for( iter = p_intf->p_sys->p_navig_menu->begin();
590          iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
591         if( (*iter)->id == id )
592         {
593             p_menuitemext = *iter;
594             break;
595         }
596
597     if( p_menuitemext )
598     {
599         vlc_object_t *p_object = (vlc_object_t *)
600             vlc_object_get( p_intf, p_menuitemext->i_object_id );
601         if( p_object == NULL ) return;
602
603         var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
604         int i_type = var_Type( p_object, p_menuitemext->psz_var );
605         switch( i_type & VLC_VAR_TYPE )
606         {
607         case VLC_VAR_VOID:
608         case VLC_VAR_BOOL:
609         case VLC_VAR_VARIABLE:
610         case VLC_VAR_STRING:
611         case VLC_VAR_INTEGER:
612             break;
613         default:
614             /* Variable doesn't exist or isn't handled */
615             return;
616         }
617
618         vlc_object_release( p_object );
619     }
620 }
621
622 /*****************************************************************************
623  * A small helper class which encapsulate wxMenuitem with some other useful
624  * things.
625  *****************************************************************************/
626 MenuItemExt::MenuItemExt( intf_thread_t *p_intf, int _id, char *_psz_var,
627                           int _i_object_id, vlc_value_t _val, int _i_val_type )
628 {
629     /* Initializations */
630     id = _id;
631     p_intf = p_intf;
632     psz_var = strdup( _psz_var );
633     i_val_type = _i_val_type;
634     i_object_id = _i_object_id;
635     val = _val;
636 };
637
638 MenuItemExt::~MenuItemExt()
639 {
640     if( psz_var ) free( psz_var );
641     if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
642         && val.psz_string ) free( val.psz_string );
643 };