Commit d41216c0 authored by Clément Stenac's avatar Clément Stenac

* Fixes for wx2.5.5, patch by Greg Hazel <ghazel at gmail dot com>

I only changed two things in the patch 
* added a check for wx2.4 that does not seem to have sizer->Detach
* commented out the wxCheckVersion in open.cpp, which broke layouting under wx2.5.3
  (what was the intended behaviour ?)

* Added core support for a sorted by genre view
parent 6a46b2e3
......@@ -957,15 +957,17 @@ typedef _off_t off_t;
# endif
# endif
# if defined( _MSC_VER )
/*
# if (defined( _MSC_VER ) && (!defined(__WXMSW__)))
# if !defined( _OFF_T_DEFINED )
typedef __int64 off_t;
# define _OFF_T_DEFINED
# else
# define off_t __int64
/* for wx compatibility typedef long off_t; */
// for wx compatibility typedef long off_t;
# endif
# endif
*/
# if defined( __BORLANDC__ )
# undef off_t
......
......@@ -106,8 +106,9 @@ struct playlist_view_t
#define VIEW_ALL 3
#define VIEW_FIRST_SORTED 4
#define VIEW_S_AUTHOR 4
#define VIEW_S_GENRE 5
#define VIEW_LAST_SORTED 4
#define VIEW_LAST_SORTED 10
#define VIEW_FIRST_CUSTOM 100
......@@ -224,9 +225,10 @@ struct playlist_add_t
#define SORT_TITLE 1
#define SORT_TITLE_NODES_FIRST 2
#define SORT_AUTHOR 3
#define SORT_RANDOM 4
#define SORT_DURATION 5
#define SORT_TITLE_NUMERIC 6
#define SORT_GENRE 4
#define SORT_RANDOM 5
#define SORT_DURATION 6
#define SORT_TITLE_NUMERIC 7
#define ORDER_NORMAL 0
#define ORDER_REVERSE 1
......
......@@ -68,7 +68,7 @@ private:
void Update();
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnAdd( wxCommandEvent& event );
void OnDel( wxCommandEvent& event );
void OnClear( wxCommandEvent& event );
......@@ -336,7 +336,7 @@ bool BookmarksDialog::Show( bool show )
return wxFrame::Show( show );
}
void BookmarksDialog::OnClose( wxCommandEvent& event )
void BookmarksDialog::OnClose( wxCloseEvent& event )
{
Hide();
}
......
......@@ -171,13 +171,19 @@ ExtraPanel::ExtraPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ):
notebook = new wxNotebook( this, Notebook_Event );
#if (!wxCHECK_VERSION(2,5,0))
wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
#endif
notebook->AddPage( VideoPanel( notebook ), wxU(_("Video")) );
notebook->AddPage( EqzPanel( notebook ), wxU(_("Equalizer")) );
notebook->AddPage( AudioPanel( notebook ), wxU(_("Audio")) );
#if (!wxCHECK_VERSION(2,5,0))
extra_sizer->Add( notebook_sizer, 1, wxEXPAND, 0 );
#else
extra_sizer->Add( notebook, 1, wxEXPAND, 0 );
#endif
SetSizerAndFit( extra_sizer );
extra_sizer->Layout();
......
......@@ -45,7 +45,7 @@ enum
BEGIN_EVENT_TABLE(FileInfo, wxFrame)
/* Button events */
EVT_BUTTON(wxID_OK, FileInfo::OnClose)
EVT_BUTTON(wxID_OK, FileInfo::OnButtonClose)
/* Hide the window when the user closes the window */
EVT_CLOSE(FileInfo::OnClose)
......@@ -160,7 +160,13 @@ FileInfo::~FileInfo()
{
}
void FileInfo::OnClose( wxCloseEvent& event )
void FileInfo::OnButtonClose( wxCommandEvent& event )
{
wxCloseEvent cevent;
OnClose(cevent);
}
void FileInfo::OnClose( wxCloseEvent& WXUNUSED(event) )
{
Hide();
}
......
......@@ -210,7 +210,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Custom events */
EVT_COMMAND(0, wxEVT_INTF, Interface::OnControlEvent)
EVT_COMMAND(1, wxEVT_INTF, Interface::OnControlEvent)
END_EVENT_TABLE()
/*****************************************************************************
......@@ -226,6 +225,7 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
b_extra = VLC_FALSE;
// b_undock = VLC_FALSE;
extra_window = NULL;
/* Give our interface a nice little icon */
......@@ -246,7 +246,7 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
p_systray = NULL;
if ( config_GetInt( p_intf, "wxwin-systray" ) )
{
p_systray = new Systray(this);
p_systray = new Systray(this, p_intf);
p_systray->SetIcon( wxIcon( vlc16x16_xpm ), wxT("VLC media player") );
if ( (! p_systray->IsOk()) || (! p_systray->IsIconInstalled()) )
{
......@@ -374,8 +374,13 @@ void Interface::OnControlEvent( wxCommandEvent& event )
*****************************************************************************/
void Interface::CreateOurMenuBar()
{
int minimal = config_GetInt( p_intf, "wxwin-minimal" );
/* Create the "File" menu */
wxMenu *file_menu = new wxMenu;
if (!minimal)
{
file_menu->Append( OpenFileSimple_Event,
wxU(_("Quick &Open File...\tCtrl-O")) );
......@@ -391,11 +396,15 @@ void Interface::CreateOurMenuBar()
file_menu->AppendSeparator();
file_menu->Append( Wizard_Event, wxU(_("&Wizard...\tCtrl-W")) );
file_menu->AppendSeparator();
}
file_menu->Append( Exit_Event, wxU(_("E&xit\tCtrl-X")) );
/* Create the "View" menu */
wxMenu *view_menu = new wxMenu;
if (!minimal)
{
view_menu->Append( Playlist_Event, wxU(_("&Playlist...\tCtrl-P")) );
}
view_menu->Append( Logs_Event, wxU(_("&Messages...\tCtrl-M")) );
view_menu->Append( FileInfo_Event,
wxU(_("Stream and Media &info...\tCtrl-I")) );
......@@ -463,6 +472,8 @@ void Interface::CreateOurToolBar()
#define HELP_SLOW N_("Play slower")
#define HELP_FAST N_("Play faster")
int minimal = config_GetInt( p_intf, "wxwin-minimal" );
wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
* version because we don't include wx.rc */
......@@ -471,17 +482,23 @@ void Interface::CreateOurToolBar()
toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
if (!minimal)
{
toolbar->AddTool( OpenFile_Event, wxT(""),
wxBitmap( eject_xpm ), wxU(_(HELP_OPEN)) );
toolbar->AddSeparator();
}
wxToolBarToolBase *p_tool = toolbar->AddTool( PlayStream_Event, wxT(""),
wxBitmap( play_xpm ), wxU(_(HELP_PLAY)) );
p_tool->SetClientData( p_tool );
if (!minimal)
{
toolbar->AddTool( StopStream_Event, wxT(""), wxBitmap( stop_xpm ),
wxU(_(HELP_STOP)) );
toolbar->AddSeparator();
toolbar->AddTool( PrevStream_Event, wxT(""),
wxBitmap( prev_xpm ), wxU(_(HELP_PLP)) );
toolbar->AddTool( SlowStream_Event, wxT(""),
......@@ -493,6 +510,7 @@ void Interface::CreateOurToolBar()
toolbar->AddSeparator();
toolbar->AddTool( Playlist_Event, wxT(""), wxBitmap( playlist_xpm ),
wxU(_(HELP_PLO)) );
}
wxControl *p_dummy_ctrl =
new wxControl( toolbar, -1, wxDefaultPosition,
......@@ -1334,7 +1352,7 @@ BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
#endif
/* Menu events */
EVT_MENU(Iconize_Event, Systray::OnLeftClick)
EVT_MENU(Iconize_Event, Systray::OnMenuIconize)
EVT_MENU(Exit_Event, Systray::OnExit)
EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
EVT_MENU(NextStream_Event, Systray::OnNextStream)
......@@ -1342,18 +1360,25 @@ BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
EVT_MENU(StopStream_Event, Systray::OnStopStream)
END_EVENT_TABLE()
Systray::Systray( Interface *_p_main_interface )
Systray::Systray( Interface *_p_main_interface, intf_thread_t *_p_intf )
{
p_main_interface = _p_main_interface;
p_intf = _p_intf;
}
/* Event handlers */
void Systray::OnLeftClick( wxTaskBarIconEvent& event )
void Systray::OnMenuIconize( wxCommandEvent& event )
{
p_main_interface->Show( ! p_main_interface->IsShown() );
if ( p_main_interface->IsShown() ) p_main_interface->Raise();
}
void Systray::OnLeftClick( wxTaskBarIconEvent& event )
{
wxCommandEvent cevent;
OnMenuIconize(cevent);
}
void Systray::OnExit( wxCommandEvent& event )
{
p_main_interface->Close(TRUE);
......@@ -1382,13 +1407,19 @@ void Systray::OnStopStream( wxCommandEvent& event )
/* Systray popup menu */
wxMenu* Systray::CreatePopupMenu()
{
int minimal = config_GetInt( p_intf, "wxwin-minimal" );
wxMenu* systray_menu = new wxMenu;
systray_menu->Append( Exit_Event, wxU(_("Quit VLC")) );
systray_menu->AppendSeparator();
systray_menu->Append( PlayStream_Event, wxU(_("Play/Pause")) );
if (!minimal)
{
systray_menu->Append( PrevStream_Event, wxU(_("Previous")) );
systray_menu->Append( NextStream_Event, wxU(_("Next")) );
systray_menu->Append( StopStream_Event, wxU(_("Stop")) );
}
systray_menu->AppendSeparator();
systray_menu->Append( Iconize_Event, wxU(_("Show/Hide interface")) );
return systray_menu;
......
......@@ -148,6 +148,8 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
{
#define MAX_POPUP_ITEMS 45
int minimal = config_GetInt( p_intf, "wxwin-minimal" );
vlc_object_t *p_object, *p_input;
char *ppsz_varnames[MAX_POPUP_ITEMS];
int pi_objects[MAX_POPUP_ITEMS];
......@@ -274,9 +276,12 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
{
vlc_value_t val;
popupmenu.InsertSeparator( 0 );
if (!minimal)
{
popupmenu.Insert( 0, Stop_Event, wxU(_("Stop")) );
popupmenu.Insert( 0, Previous_Event, wxU(_("Previous")) );
popupmenu.Insert( 0, Next_Event, wxU(_("Next")) );
}
var_Get( p_input, "state", &val );
if( val.i_int == PAUSE_S )
......@@ -301,8 +306,11 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")),
MiscMenu( p_intf ), wxT("") );
if (!minimal)
{
popupmenu.Append( MenuDummy_Event, wxU(_("Open")),
OpenStreamMenu( p_intf ), wxT("") );
}
p_intf->p_sys->p_popup_menu = &popupmenu;
p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
......@@ -1001,7 +1009,7 @@ void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
wxMutexGuiLeave(); // We don't want deadlocks
var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
wxMutexGuiEnter();
//wxMutexGuiEnter();
vlc_object_release( p_object );
}
......
......@@ -48,7 +48,7 @@ enum
BEGIN_EVENT_TABLE(Messages, wxFrame)
/* Button events */
EVT_BUTTON(wxID_OK, Messages::OnClose)
EVT_BUTTON(wxID_OK, Messages::OnButtonClose)
EVT_BUTTON(wxID_CLEAR, Messages::OnClear)
EVT_BUTTON(wxID_SAVEAS, Messages::OnSaveLog)
......@@ -193,7 +193,13 @@ void Messages::UpdateLog()
/*****************************************************************************
* Private methods.
*****************************************************************************/
void Messages::OnClose( wxEvent& WXUNUSED(event) )
void Messages::OnButtonClose( wxCommandEvent& WXUNUSED(event) )
{
wxCloseEvent cevent;
OnClose(cevent);
}
void Messages::OnClose( wxCloseEvent& WXUNUSED(event) )
{
Hide();
}
......
......@@ -101,11 +101,11 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscDeviceChange)
EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscPanelChange)
EVT_TEXT(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChangeSpin)
EVT_TEXT(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChangeSpin)
EVT_TEXT(DiscSub_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscSub_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscSub_Event, OpenDialog::OnDiscPanelChangeSpin)
/* Events generated by the net panel */
EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
......@@ -113,11 +113,11 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_RADIOBUTTON(NetRadio3_Event, OpenDialog::OnNetTypeChange)
EVT_RADIOBUTTON(NetRadio4_Event, OpenDialog::OnNetTypeChange)
EVT_TEXT(NetPort1_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort1_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort1_Event, OpenDialog::OnNetPanelChangeSpin)
EVT_TEXT(NetPort2_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort2_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort2_Event, OpenDialog::OnNetPanelChangeSpin)
EVT_TEXT(NetPort3_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort3_Event, OpenDialog::OnNetPanelChange)
EVT_SPINCTRL(NetPort3_Event, OpenDialog::OnNetPanelChangeSpin)
EVT_TEXT(NetAddr2_Event, OpenDialog::OnNetPanelChange)
EVT_TEXT(NetAddr3_Event, OpenDialog::OnNetPanelChange)
EVT_TEXT(NetAddr4_Event, OpenDialog::OnNetPanelChange)
......@@ -135,10 +135,10 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
/* Events generated by the caching button */
EVT_CHECKBOX(CachingEnable_Event, OpenDialog::OnCachingEnable)
EVT_TEXT(CachingChange_Event, OpenDialog::OnCachingChange)
EVT_SPINCTRL(CachingChange_Event, OpenDialog::OnCachingChange)
EVT_SPINCTRL(CachingChange_Event, OpenDialog::OnCachingChangeSpin)
/* Hide the window when the user closes the window */
EVT_CLOSE(OpenDialog::OnCancel)
EVT_CLOSE(OpenDialog::OnClose)
END_EVENT_TABLE()
......@@ -463,7 +463,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
/* Create notebook */
notebook = new wxNotebook( panel, Notebook_Event );
//#if (!wxCHECK_VERSION(2,5,0))
wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
//#endif
notebook->AddPage( FilePanel( notebook ), wxU(_("File")),
i_access_method == FILE_ACCESS );
......@@ -537,7 +540,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
//#if (!wxCHECK_VERSION(2,5,0))
panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
//#endif
panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
......@@ -1083,6 +1088,12 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
}
void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{
wxCloseEvent cevent;
OnClose(cevent);
}
void OpenDialog::OnClose( wxCloseEvent& WXUNUSED(event) )
{
Hide();
......@@ -1138,6 +1149,14 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
/*****************************************************************************
* Disc panel event methods.
*****************************************************************************/
void OpenDialog::OnDiscPanelChangeSpin( wxSpinEvent& event )
{
wxCommandEvent cevent;
cevent.SetId(event.GetId());
cevent.SetInt(event.GetPosition());
OnDiscPanelChange(cevent);
}
void OpenDialog::OnDiscPanelChange( wxCommandEvent& event )
{
if( event.GetId() == DiscTitle_Event ) i_disc_title = event.GetInt();
......@@ -1249,6 +1268,14 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
/*****************************************************************************
* Net panel event methods.
*****************************************************************************/
void OpenDialog::OnNetPanelChangeSpin( wxSpinEvent& event )
{
wxCommandEvent cevent;
cevent.SetId(event.GetId());
cevent.SetInt(event.GetPosition());
OnNetPanelChange(cevent);
}
void OpenDialog::OnNetPanelChange( wxCommandEvent& event )
{
if( event.GetId() >= NetPort1_Event && event.GetId() <= NetPort3_Event )
......@@ -1345,6 +1372,12 @@ void OpenDialog::OnCachingEnable( wxCommandEvent& event )
UpdateMRL();
}
void OpenDialog::OnCachingChangeSpin( wxSpinEvent& event )
{
wxCommandEvent cevent;
OnCachingChange(cevent);
}
void OpenDialog::OnCachingChange( wxCommandEvent& event )
{
i_caching = event.GetInt();
......
......@@ -128,7 +128,7 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_MENU(AddFile_Event, Playlist::OnAddFile)
EVT_MENU(AddDir_Event, Playlist::OnAddDir)
EVT_MENU(AddMRL_Event, Playlist::OnAddMRL)
EVT_MENU(Close_Event, Playlist::OnClose)
EVT_MENU(Close_Event, Playlist::OnMenuClose)
EVT_MENU(Open_Event, Playlist::OnOpen)
EVT_MENU(Save_Event, Playlist::OnSave)
......@@ -421,7 +421,7 @@ Playlist::~Playlist()
/* Update a node */
void Playlist::UpdateNode( playlist_item_t *p_node, wxTreeItemId node )
{
long cookie;
wxTreeItemIdValue cookie;
wxTreeItemId child;
for( int i = 0; i< p_node->i_children ; i++ )
{
......@@ -622,7 +622,7 @@ void Playlist::RemoveItem( int i )
/* Find a wxItem from a playlist id */
wxTreeItemId Playlist::FindItem( wxTreeItemId root, int i_id )
{
long cookie;
wxTreeItemIdValue cookie;
PlaylistItem *p_wxcurrent;
wxTreeItemId search;
wxTreeItemId item = treectrl->GetFirstChild( root, cookie );
......@@ -681,7 +681,7 @@ wxTreeItemId Playlist::FindItem( wxTreeItemId root, int i_id )
int Playlist::CountItems( wxTreeItemId root )
{
long cookie;
wxTreeItemIdValue cookie;
int count = 0;
wxTreeItemId item = treectrl->GetFirstChild( root, cookie );
......@@ -708,7 +708,7 @@ int Playlist::CountItems( wxTreeItemId root )
/* Find a wxItem from a name (from current) */
wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current, vlc_bool_t *pb_current_found )
{
long cookie;
wxTreeItemIdValue cookie;
wxTreeItemId search;
wxTreeItemId item = treectrl->GetFirstChild( root, cookie );
wxTreeItemId child;
......@@ -848,6 +848,11 @@ void Playlist::DeleteNode( playlist_item_t *p_item )
playlist_NodeDelete( p_playlist, p_item, VLC_TRUE , VLC_FALSE );
}
void Playlist::OnMenuClose( wxCommandEvent& event )
{
wxCloseEvent cevent;
OnClose(cevent);
}
void Playlist::OnClose( wxCloseEvent& WXUNUSED(event) )
{
......@@ -1146,7 +1151,7 @@ void Playlist::OnMenuEvent( wxCommandEvent& event )
wxMutexGuiLeave();
playlist_ServicesDiscoveryRemove( p_playlist,
pp_sds[event.GetId() - FirstSD_Event] );
wxMutexGuiEnter();
//wxMutexGuiEnter();
}
}
}
......
......@@ -168,7 +168,7 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxFrame)
EVT_CHECKBOX(Advanced_Event, PrefsDialog::OnAdvanced)
/* Don't destroy the window when the user closes it */
EVT_CLOSE(PrefsDialog::OnCancel)
EVT_CLOSE(PrefsDialog::OnClose)
END_EVENT_TABLE()
// menu and control ids
......@@ -269,7 +269,13 @@ void PrefsDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
prefs_tree->CleanChanges();
}
void PrefsDialog::OnCancel( wxEvent& WXUNUSED(event) )
void PrefsDialog::OnClose( wxCloseEvent& WXUNUSED(event) )
{
wxCommandEvent cevent;
OnCancel(cevent);
}
void PrefsDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{
this->Hide();
prefs_tree->CleanChanges();
......@@ -330,6 +336,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
b_advanced = VLC_FALSE;
root_item = AddRoot( wxT("") );
wxASSERT_MSG(root_item.IsOk(), "Could not add root item");
wxImageList *p_images = new wxImageList( 16,16,TRUE );
p_images->Add( wxIcon( audio_xpm ) );
......@@ -505,8 +512,9 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
if( !i_options ) continue;
/* Find the right category item */
long cookie;
wxTreeItemIdValue cookie;
vlc_bool_t b_found = VLC_FALSE;
wxTreeItemId category_item = GetFirstChild( root_item , cookie);
while( category_item.IsOk() )
{
......@@ -524,7 +532,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
/* Find subcategory item */
b_found = VLC_FALSE;
cookie = -1;
//cookie = -1;
wxTreeItemId subcategory_item = GetFirstChild( category_item, cookie );
while( subcategory_item.IsOk() )
{
......@@ -558,14 +566,18 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
}
/* Sort all this mess */
long cookie; size_t i_child_index;
wxTreeItemIdValue cookie;
size_t i_child_index;
wxTreeItemId capability_item = GetFirstChild( root_item, cookie);
for( i_child_index = 0;
i_child_index < GetChildrenCount( plugins_item, FALSE );
(capability_item.IsOk() &&
//(i_child_index < GetChildrenCount( plugins_item, FALSE )));
(i_child_index < GetChildrenCount( root_item, FALSE )));
i_child_index++ )
{
SortChildren( capability_item );
capability_item = GetNextChild( plugins_item, cookie );
//capability_item = GetNextChild( plugins_item, cookie );
capability_item = GetNextChild( root_item, cookie );
}
/* Clean-up everything */
......@@ -579,16 +591,16 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
SelectItem( GetFirstChild( root_item, cookie ) );
#endif
Expand( root_item );
//cannot expand hidden root item
//Expand( root_item );
}
PrefsTreeCtrl::~PrefsTreeCtrl()
{
PrefsTreeCtrl::~PrefsTreeCtrl(){
}
void PrefsTreeCtrl::ApplyChanges()
{
long cookie, cookie2, cookie3;
wxTreeItemIdValue cookie, cookie2, cookie3;
ConfigTreeData *config_data;
wxTreeItemId category = GetFirstChild( root_item, cookie );
......@@ -625,7 +637,7 @@ void PrefsTreeCtrl::ApplyChanges()
void PrefsTreeCtrl::CleanChanges()
{
long cookie, cookie2, cookie3;
wxTreeItemIdValue cookie, cookie2, cookie3;
ConfigTreeData *config_data;
config_data = !GetSelection() ? NULL :
......@@ -633,7 +645,11 @@ void PrefsTreeCtrl::CleanChanges()
if( config_data )
{
config_data->panel->Hide();
#if (wxMAJOR_VERSION >= 2) && (wxMINOR_VERSION < 5 )
p_sizer->Remove( config_data->panel );
#else
p_sizer->Detach( config_data->panel );
#endif
}
wxTreeItemId category = GetFirstChild( root_item, cookie );
......@@ -687,7 +703,7 @@ ConfigTreeData *PrefsTreeCtrl::FindModuleConfig( ConfigTreeData *config_data )
return config_data;
}
long cookie, cookie2, cookie3;
wxTreeItemIdValue cookie, cookie2, cookie3;
ConfigTreeData *config_new;
wxTreeItemId category = GetFirstChild( root_item, cookie );
while( category.IsOk() )
......@@ -725,7 +741,11 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
if( config_data && config_data->panel )
{
config_data->panel->Hide();
#if (wxMAJOR_VERSION >= 2) && (xwMINOR_VERSION < 5 )
p_sizer->Remove( config_data->panel );
#else
p_sizer->Detach( config_data->panel );
#endif
}
/* Don't use event.GetItem() because we also send fake events */
......@@ -761,7 +781,12 @@ void PrefsTreeCtrl::OnAdvanced( wxCommandEvent& event )
if( config_data )
{
config_data->panel->Hide();
#if (wxMAJOR_VERSION >= 2) && (xwMINOR_VERSION < 5 )
p_sizer->Remove( config_data->panel );
#else
p_sizer->Detach( config_data->panel );
#endif
}