Commit a7ffa80a authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wince: fixed bunch of bugs and memory leaks.

parent 568476b8
This diff is collapsed.
...@@ -82,7 +82,6 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point ) ...@@ -82,7 +82,6 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point )
vlc_object_t *p_object, *p_input; vlc_object_t *p_object, *p_input;
char *ppsz_varnames[MAX_POPUP_ITEMS]; char *ppsz_varnames[MAX_POPUP_ITEMS];
int pi_objects[MAX_POPUP_ITEMS]; int pi_objects[MAX_POPUP_ITEMS];
vector<MenuItemExt*>::iterator iter;
int i = 0, i_last_separator = 0; int i = 0, i_last_separator = 0;
/* Initializations */ /* Initializations */
...@@ -199,6 +198,8 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point ) ...@@ -199,6 +198,8 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point )
HMENU hmenu = CreatePopupMenu(); HMENU hmenu = CreatePopupMenu();
RefreshMenu( p_intf, &popup_menu, hmenu, i, RefreshMenu( p_intf, &popup_menu, hmenu, i,
ppsz_varnames, pi_objects, PopupMenu_Events ); ppsz_varnames, pi_objects, PopupMenu_Events );
MenuItemExt::ClearList( &popup_menu );
/* Add static entries */ /* Add static entries */
if( p_input != NULL ) if( p_input != NULL )
...@@ -247,7 +248,6 @@ void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -247,7 +248,6 @@ void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu )
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_AUDIO_ITEMS]; char *ppsz_varnames[MAX_AUDIO_ITEMS];
int pi_objects[MAX_AUDIO_ITEMS]; int pi_objects[MAX_AUDIO_ITEMS];
vector<MenuItemExt*>::iterator iter;
int i; int i;
/* Delete old menu */ /* Delete old menu */
...@@ -255,14 +255,10 @@ void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -255,14 +255,10 @@ void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu )
for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
if( p_intf->p_sys->p_audio_menu ) if( p_intf->p_sys->p_audio_menu )
{ MenuItemExt::ClearList( p_intf->p_sys->p_audio_menu );
for( iter = p_intf->p_sys->p_audio_menu->begin();
iter != p_intf->p_sys->p_audio_menu->end(); iter++ )
delete *iter;
p_intf->p_sys->p_audio_menu->clear();
}
else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>; else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>;
/* Initializations */ /* Initializations */
memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) ); memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );
i = 0; i = 0;
...@@ -301,7 +297,6 @@ void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -301,7 +297,6 @@ void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu )
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_VIDEO_ITEMS]; char *ppsz_varnames[MAX_VIDEO_ITEMS];
int pi_objects[MAX_VIDEO_ITEMS]; int pi_objects[MAX_VIDEO_ITEMS];
vector<MenuItemExt*>::iterator iter;
int i; int i;
/* Delete old menu */ /* Delete old menu */
...@@ -309,12 +304,7 @@ void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -309,12 +304,7 @@ void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu )
for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
if( p_intf->p_sys->p_video_menu ) if( p_intf->p_sys->p_video_menu )
{ MenuItemExt::ClearList( p_intf->p_sys->p_video_menu );
for( iter = p_intf->p_sys->p_video_menu->begin();
iter != p_intf->p_sys->p_video_menu->end(); iter++ )
delete *iter;
p_intf->p_sys->p_video_menu->clear();
}
else p_intf->p_sys->p_video_menu = new vector<MenuItemExt*>; else p_intf->p_sys->p_video_menu = new vector<MenuItemExt*>;
/* Initializations */ /* Initializations */
...@@ -379,7 +369,6 @@ void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -379,7 +369,6 @@ void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu )
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_NAVIG_ITEMS]; char *ppsz_varnames[MAX_NAVIG_ITEMS];
int pi_objects[MAX_NAVIG_ITEMS]; int pi_objects[MAX_NAVIG_ITEMS];
vector<MenuItemExt*>::iterator iter;
int i; int i;
/* Delete old menu */ /* Delete old menu */
...@@ -387,12 +376,7 @@ void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -387,12 +376,7 @@ void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu )
for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
if( p_intf->p_sys->p_navig_menu ) if( p_intf->p_sys->p_navig_menu )
{ MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu );
for( iter = p_intf->p_sys->p_navig_menu->begin();
iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
delete *iter;
p_intf->p_sys->p_navig_menu->clear();
}
else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>; else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>;
/* Initializations */ /* Initializations */
...@@ -438,7 +422,6 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -438,7 +422,6 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu )
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[MAX_SETTINGS_ITEMS]; char *ppsz_varnames[MAX_SETTINGS_ITEMS];
int pi_objects[MAX_SETTINGS_ITEMS]; int pi_objects[MAX_SETTINGS_ITEMS];
vector<MenuItemExt*>::iterator iter;
int i; int i;
/* Delete old menu */ /* Delete old menu */
...@@ -446,12 +429,7 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -446,12 +429,7 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu )
for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
if( p_intf->p_sys->p_settings_menu ) if( p_intf->p_sys->p_settings_menu )
{ MenuItemExt::ClearList( p_intf->p_sys->p_settings_menu );
for( iter = p_intf->p_sys->p_settings_menu->begin();
iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
delete(*iter);
p_intf->p_sys->p_settings_menu->clear();
}
else p_intf->p_sys->p_settings_menu = new vector<MenuItemExt*>; else p_intf->p_sys->p_settings_menu = new vector<MenuItemExt*>;
/* Initializations */ /* Initializations */
...@@ -479,7 +457,7 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu ) ...@@ -479,7 +457,7 @@ void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu )
/***************************************************************************** /*****************************************************************************
* Refresh the menu. * Refresh the menu.
*****************************************************************************/ *****************************************************************************/
void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *p_menu_list,
HMENU hMenu , int i_count, char **ppsz_varnames, HMENU hMenu , int i_count, char **ppsz_varnames,
int *pi_objects, int i_start_id ) int *pi_objects, int i_start_id )
{ {
...@@ -518,7 +496,7 @@ void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -518,7 +496,7 @@ void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
if( p_object == NULL ) continue; if( p_object == NULL ) continue;
b_section_empty = VLC_FALSE; b_section_empty = VLC_FALSE;
CreateMenuItem( p_intf, _p_menuList, hMenu, ppsz_varnames[i], CreateMenuItem( p_intf, p_menu_list, hMenu, ppsz_varnames[i],
p_object, &i_item_id ); p_object, &i_item_id );
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -534,7 +512,7 @@ void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -534,7 +512,7 @@ void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
/***************************************************************************** /*****************************************************************************
* Private methods. * Private methods.
*****************************************************************************/ *****************************************************************************/
void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *p_menu_list,
HMENU hMenu, char *psz_var, vlc_object_t *p_object, HMENU hMenu, char *psz_var, vlc_object_t *p_object,
int *pi_item_id ) int *pi_item_id )
{ {
...@@ -576,10 +554,11 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -576,10 +554,11 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
if( i_type & VLC_VAR_HASCHOICE ) if( i_type & VLC_VAR_HASCHOICE )
{ {
hMenuItem = CreateChoicesMenu( p_intf, _p_menuList, psz_var, hMenuItem = CreateChoicesMenu( p_intf, p_menu_list, psz_var,
p_object, pi_item_id ); p_object, pi_item_id );
AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem, AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
_FROMMB(text.psz_string ? text.psz_string : psz_var) ); _FROMMB(text.psz_string ? text.psz_string : psz_var) );
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
if( text.psz_string ) free( text.psz_string ); if( text.psz_string ) free( text.psz_string );
return; return;
} }
...@@ -591,7 +570,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -591,7 +570,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
_FROMMB(text.psz_string ? text.psz_string : psz_var) ); _FROMMB(text.psz_string ? text.psz_string : psz_var) );
pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var, pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
p_object->i_object_id, val, i_type ); p_object->i_object_id, val, i_type );
_p_menuList->push_back( pMenuItemExt ); p_menu_list->push_back( pMenuItemExt );
break; break;
case VLC_VAR_BOOL: case VLC_VAR_BOOL:
...@@ -600,7 +579,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -600,7 +579,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
_FROMMB(text.psz_string ? text.psz_string : psz_var) ); _FROMMB(text.psz_string ? text.psz_string : psz_var) );
pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var, pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
p_object->i_object_id, val, i_type ); p_object->i_object_id, val, i_type );
_p_menuList->push_back( pMenuItemExt ); p_menu_list->push_back( pMenuItemExt );
CheckMenuItem( hMenu, *pi_item_id , CheckMenuItem( hMenu, *pi_item_id ,
( val.b_bool ? MF_UNCHECKED : MF_CHECKED ) | ( val.b_bool ? MF_UNCHECKED : MF_CHECKED ) |
MF_BYCOMMAND ); MF_BYCOMMAND );
...@@ -616,7 +595,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList, ...@@ -616,7 +595,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
} }
HMENU CreateChoicesMenu( intf_thread_t *p_intf, HMENU CreateChoicesMenu( intf_thread_t *p_intf,
vector<MenuItemExt*> *_p_menuList, char *psz_var, vector<MenuItemExt*> *p_menu_list, char *psz_var,
vlc_object_t *p_object, int *pi_item_id ) vlc_object_t *p_object, int *pi_item_id )
{ {
MenuItemExt *pMenuItemExt; MenuItemExt *pMenuItemExt;
...@@ -671,7 +650,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf, ...@@ -671,7 +650,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf,
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_VARIABLE: case VLC_VAR_VARIABLE:
hMenuItem = CreateChoicesMenu( p_intf, _p_menuList, hMenuItem = CreateChoicesMenu( p_intf, p_menu_list,
val_list.p_list->p_values[i].psz_string, p_object, pi_item_id ); val_list.p_list->p_values[i].psz_string, p_object, pi_item_id );
AppendMenu( hSubMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem, AppendMenu( hSubMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
_FROMMB(text_list.p_list->p_values[i].psz_string ? _FROMMB(text_list.p_list->p_values[i].psz_string ?
...@@ -688,7 +667,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf, ...@@ -688,7 +667,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf,
val_list.p_list->p_values[i].psz_string) ); val_list.p_list->p_values[i].psz_string) );
pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var, pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
p_object->i_object_id, another_val, i_type ); p_object->i_object_id, another_val, i_type );
_p_menuList->push_back( pMenuItemExt ); p_menu_list->push_back( pMenuItemExt );
if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string && if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string &&
!strcmp( val.psz_string, !strcmp( val.psz_string,
...@@ -703,7 +682,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf, ...@@ -703,7 +682,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf,
text_list.p_list->p_values[i].psz_string : psz_tmp)); text_list.p_list->p_values[i].psz_string : psz_tmp));
pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var, pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
p_object->i_object_id, val_list.p_list->p_values[i], i_type ); p_object->i_object_id, val_list.p_list->p_values[i], i_type );
_p_menuList->push_back( pMenuItemExt ); p_menu_list->push_back( pMenuItemExt );
if( val_list.p_list->p_values[i].i_int == val.i_int ) if( val_list.p_list->p_values[i].i_int == val.i_int )
CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND); CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND);
...@@ -821,3 +800,15 @@ MenuItemExt::~MenuItemExt() ...@@ -821,3 +800,15 @@ MenuItemExt::~MenuItemExt()
if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING) if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
&& val.psz_string ) free( val.psz_string ); && val.psz_string ) free( val.psz_string );
}; };
void MenuItemExt::ClearList( vector<MenuItemExt*> *p_menu_list )
{
vector<MenuItemExt*>::iterator iter;
if( !p_menu_list ) return;
for( iter = p_menu_list->begin(); iter != p_menu_list->end(); iter++ )
{
delete *iter;
}
p_menu_list->clear();
}
...@@ -82,6 +82,18 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst, ...@@ -82,6 +82,18 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
i_current_access_method = _i_access_method; i_current_access_method = _i_access_method;
i_open_arg = _i_arg; i_open_arg = _i_arg;
i_method = _i_method; i_method = _i_method;
for( int i = 0; i < 4; i++ )
{
net_radios[i] = 0;
net_label[i] = 0;
net_port_label[i] = 0;
net_ports[i] = 0;
hUpdown[i] = 0;
i_net_ports[i] = 0;
net_addrs_label[i] = 0;
net_addrs[i] = 0;
}
} }
/*********************************************************************** /***********************************************************************
......
...@@ -368,14 +368,14 @@ LRESULT Playlist::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -368,14 +368,14 @@ LRESULT Playlist::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
case ID_MANAGE_ADDFILE: case ID_MANAGE_ADDFILE:
SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON );
OnAddFile( VLC_FALSE ); OnAddFile();
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
b_need_update = VLC_TRUE; b_need_update = VLC_TRUE;
break; break;
case ID_MANAGE_ADDDIRECTORY: case ID_MANAGE_ADDDIRECTORY:
SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_SHOWSIPBUTTON );
OnAddFile( VLC_TRUE ); OnAddFile();
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
b_need_update = VLC_TRUE; b_need_update = VLC_TRUE;
break; break;
...@@ -735,7 +735,7 @@ void Playlist::OnOpen() ...@@ -735,7 +735,7 @@ void Playlist::OnOpen()
ofn.lpfnHook = NULL; ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL; ofn.lpTemplateName = NULL;
if( GetOpenFile( &ofn ) ) if( GetOpenFileName((LPOPENFILENAME)&ofn) )
{ {
playlist_Import( p_playlist, _TOMB(ofn.lpstrFile) ); playlist_Import( p_playlist, _TOMB(ofn.lpstrFile) );
} }
...@@ -797,7 +797,7 @@ void Playlist::OnSave() ...@@ -797,7 +797,7 @@ void Playlist::OnSave()
} }
} }
void Playlist::OnAddFile( vlc_bool_t b_directory ) void Playlist::OnAddFile()
{ {
// Same code as in Interface // Same code as in Interface
OPENFILENAME ofn; OPENFILENAME ofn;
...@@ -828,7 +828,7 @@ void Playlist::OnAddFile( vlc_bool_t b_directory ) ...@@ -828,7 +828,7 @@ void Playlist::OnAddFile( vlc_bool_t b_directory )
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
if( GetOpenFile( &ofn ) ) if( GetOpenFileName( (LPOPENFILENAME)&ofn ) )
{ {
playlist_t *p_playlist = (playlist_t *) playlist_t *p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
......
...@@ -87,7 +87,6 @@ private: ...@@ -87,7 +87,6 @@ private:
PrefsDialog *p_prefs_dialog; PrefsDialog *p_prefs_dialog;
vlc_bool_t b_advanced; vlc_bool_t b_advanced;
HTREEITEM root_item;
HTREEITEM general_item; HTREEITEM general_item;
HTREEITEM plugins_item; HTREEITEM plugins_item;
}; };
...@@ -251,10 +250,13 @@ LRESULT PrefsDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -251,10 +250,13 @@ LRESULT PrefsDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
TVITEM tvi = {0}; TVITEM tvi = {0};
tvi.mask = TVIF_PARAM; tvi.mask = TVIF_PARAM;
tvi.hItem = TreeView_GetSelection( prefs_tree->hwndTV ); tvi.hItem = TreeView_GetSelection( prefs_tree->hwndTV );
TreeView_GetItem( prefs_tree->hwndTV, &tvi ); if( !tvi.hItem ) break;
if( !TreeView_GetItem( prefs_tree->hwndTV, &tvi ) ) break;
ConfigTreeData *config_data = ConfigTreeData *config_data =
prefs_tree->FindModuleConfig( (ConfigTreeData *)tvi.lParam ); prefs_tree->FindModuleConfig( (ConfigTreeData *)tvi.lParam );
if ( hwnd == config_data->panel->config_window ) if( config_data && hwnd == config_data->panel->config_window )
{ {
int dy; int dy;
RECT rc; RECT rc;
...@@ -350,16 +352,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -350,16 +352,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
hwnd, NULL, hInst, NULL ); hwnd, NULL, hInst, NULL );
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
tvi.pszText = _T("root");
tvi.cchTextMax = lstrlen(_T("root"));
tvi.lParam = (LPARAM) 1; // root level
tvins.item = tvi;
tvins.hInsertAfter = TVI_FIRST;
tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins );
root_item = hPrev;
/* List the plugins */ /* List the plugins */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
...@@ -374,10 +366,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -374,10 +366,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
config_data->psz_section = strdup( GENERAL_TITLE ); config_data->psz_section = strdup( GENERAL_TITLE );
tvi.pszText = _T("General settings"); tvi.pszText = _T("General settings");
tvi.cchTextMax = lstrlen(_T("General settings")); tvi.cchTextMax = lstrlen(_T("General settings"));
tvi.lParam = (long) config_data; tvi.lParam = (long)config_data;
tvins.item = tvi; tvins.item = tvi;
tvins.hInsertAfter = hPrev; tvins.hInsertAfter = TVI_FIRST;
tvins.hParent = root_item; //level 2 tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control. // Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins); hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
...@@ -444,10 +436,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -444,10 +436,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
config_data->psz_section = strdup("nothing");//strdup( PLUGIN_TITLE ); config_data->psz_section = strdup("nothing");//strdup( PLUGIN_TITLE );
tvi.pszText = _T("Modules"); tvi.pszText = _T("Modules");
tvi.cchTextMax = lstrlen(_T("Modules")); tvi.cchTextMax = lstrlen(_T("Modules"));
tvi.lParam = (long) config_data; tvi.lParam = (long)config_data;
tvins.item = tvi; tvins.item = tvi;
tvins.hInsertAfter = hPrev; tvins.hInsertAfter = TVI_LAST;
tvins.hParent = root_item;// level 2 tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control. // Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins); hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
...@@ -513,7 +505,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -513,7 +505,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
config_data->i_object_id = CAPABILITY_ID; config_data->i_object_id = CAPABILITY_ID;
tvi.pszText = _FROMMB(p_module->psz_capability); tvi.pszText = _FROMMB(p_module->psz_capability);
tvi.cchTextMax = _tcslen(tvi.pszText); tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long) config_data; tvi.lParam = (long)config_data;
tvins.item = tvi; tvins.item = tvi;
tvins.hInsertAfter = plugins_item; tvins.hInsertAfter = plugins_item;
tvins.hParent = plugins_item;// level 3 tvins.hParent = plugins_item;// level 3
...@@ -533,7 +525,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -533,7 +525,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
config_data->psz_help = NULL; config_data->psz_help = NULL;
tvi.pszText = _FROMMB(p_module->psz_object_name); tvi.pszText = _FROMMB(p_module->psz_object_name);
tvi.cchTextMax = _tcslen(tvi.pszText); tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long) config_data; tvi.lParam = (long)config_data;
tvins.item = tvi; tvins.item = tvi;
tvins.hInsertAfter = capability_item; tvins.hInsertAfter = capability_item;
tvins.hParent = capability_item;// level 4 tvins.hParent = capability_item;// level 4
...@@ -555,7 +547,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -555,7 +547,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
/* Clean-up everything */ /* Clean-up everything */
vlc_list_release( p_list ); vlc_list_release( p_list );
TreeView_Expand( hwndTV, root_item, TVE_EXPANDPARTIAL |TVE_EXPAND );
TreeView_Expand( hwndTV, general_item, TVE_EXPANDPARTIAL |TVE_EXPAND ); TreeView_Expand( hwndTV, general_item, TVE_EXPANDPARTIAL |TVE_EXPAND );
} }
...@@ -727,11 +718,10 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -727,11 +718,10 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
/* Find the category if it has been specified */ /* Find the category if it has been specified */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY ) if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY )
{ {
while( !p_item->i_type == CONFIG_HINT_CATEGORY || while( !(p_item->i_type == CONFIG_HINT_CATEGORY) ||
strcmp( psz_section, p_item->psz_text ) ) strcmp( psz_section, p_item->psz_text ) )
{ {
if( p_item->i_type == CONFIG_HINT_END ) if( p_item->i_type == CONFIG_HINT_END ) break;
break;
p_item++; p_item++;
} }
} }
......
...@@ -146,6 +146,15 @@ static void Close( vlc_object_t *p_this ) ...@@ -146,6 +146,15 @@ static void Close( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
} }
MenuItemExt::ClearList( p_intf->p_sys->p_video_menu );
delete p_intf->p_sys->p_video_menu;
MenuItemExt::ClearList( p_intf->p_sys->p_audio_menu );
delete p_intf->p_sys->p_audio_menu;
MenuItemExt::ClearList( p_intf->p_sys->p_settings_menu );
delete p_intf->p_sys->p_settings_menu;
MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu );
delete p_intf->p_sys->p_navig_menu;
// Unsuscribe to messages bank // Unsuscribe to messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub ); msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
...@@ -162,12 +171,12 @@ static void Close( vlc_object_t *p_this ) ...@@ -162,12 +171,12 @@ static void Close( vlc_object_t *p_this )
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
MSG msg; MSG msg;
Interface *pInterface = new Interface(); Interface interface;
p_intf->p_sys->p_main_window = pInterface;
p_intf->p_sys->p_main_window = &interface;
if( !hInstance ) hInstance = GetModuleHandle(NULL); if( !hInstance ) hInstance = GetModuleHandle(NULL);
if( !pInterface->InitInstance( hInstance, p_intf ) ) return; if( !interface.InitInstance( hInstance, p_intf ) ) return;
// Main message loop // Main message loop
while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) while( GetMessage( &msg, NULL, 0, 0 ) > 0 )
......
...@@ -134,11 +134,12 @@ class Interface : public CBaseWindow ...@@ -134,11 +134,12 @@ class Interface : public CBaseWindow
{ {
public: public:
/* Constructor */ /* Constructor */
Interface(){} Interface();
~Interface(){} ~Interface();
BOOL InitInstance( HINSTANCE, intf_thread_t * ); BOOL InitInstance( HINSTANCE, intf_thread_t * );
HWND CreateMenuBar( HWND, HINSTANCE );
void TogglePlayButton( int i_playing_status ); void TogglePlayButton( int i_playing_status );
HWND hwndMain; // Handle to the main window. HWND hwndMain; // Handle to the main window.
...@@ -151,11 +152,12 @@ public: ...@@ -151,11 +152,12 @@ public:
HWND hwndSB; // Handle to the status bar. HWND hwndSB; // Handle to the status bar.
HMENU hPopUpMenu; HMENU hPopUpMenu;
HMENU hMenu; HMENU hMenu;
FileInfo *fi; // pas besoin de la plupart de ses attributs
Messages *hmsg; FileInfo *fileinfo;
PrefsDialog *pref; Messages *messages;
Playlist *pl; PrefsDialog *preferences;
Timer *ti; Playlist *playlist;
Timer *timer;
OpenDialog *open; OpenDialog *open;
CBaseWindow *video; CBaseWindow *video;
...@@ -177,6 +179,12 @@ protected: ...@@ -177,6 +179,12 @@ protected:
void OnFastStream( void ); void OnFastStream( void );
int i_old_playing_status; int i_old_playing_status;
private:
HMENU menu_settings;
HMENU menu_video;
HMENU menu_audio;
HMENU menu_navigation;
}; };
/* File Info */ /* File Info */
...@@ -384,7 +392,7 @@ protected: ...@@ -384,7 +392,7 @@ protected:
void OnOpen(); void OnOpen();
void OnSave(); void OnSave();
void OnAddFile( vlc_bool_t ); void OnAddFile();
void OnAddMRL(); void OnAddMRL();
void OnDeleteSelection(); void OnDeleteSelection();
...@@ -457,6 +465,8 @@ public: ...@@ -457,6 +465,8 @@ public:
virtual ~MenuItemExt(); virtual ~MenuItemExt();
static void ClearList( vector<MenuItemExt*> * );
int id; int id;
intf_thread_t *p_intf; intf_thread_t *p_intf;
char *psz_var; char *psz_var;
......
...@@ -11,10 +11,8 @@ ...@@ -11,10 +11,8 @@
#define _WIN32_WCE UNDER_CE #define _WIN32_WCE UNDER_CE
#endif #endif
#if defined(_WIN32_WCE) #define _WIN32_IE 0x0501
#define _WIN32_IE 0x0500 #include <commctrl.h>
#include <commctrl.h>
#endif // _WIN32_WCE
#ifdef RC_INVOKED #ifdef RC_INVOKED
#ifndef _INC_WINDOWS #ifndef _INC_WINDOWS
...@@ -28,6 +26,7 @@ ...@@ -28,6 +26,7 @@
// Menubar // Menubar
// //
#if defined(UNDER_CE) // Menus are dynamically built on Win32
IDR_MENUBAR MENU DISCARDABLE IDR_MENUBAR MENU DISCARDABLE
BEGIN BEGIN
POPUP "File" POPUP "File"
...@@ -71,7 +70,7 @@ BEGIN ...@@ -71,7 +70,7 @@ BEGIN
MENUITEM "Empty", ID_EMPTY, GRAYED MENUITEM "Empty", ID_EMPTY, GRAYED
END END
END END
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment