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
}
if( GetSelection() )
......
......@@ -159,7 +159,7 @@ void ConfigControl::SetUpdateCallback( void (*p_callback)( void * ),
p_update_data = p_data;
}
void ConfigControl::OnUpdate( wxEvent& WXUNUSED(event) )
void ConfigControl::OnUpdate( wxCommandEvent& WXUNUSED(event) )
{
if( pf_update_callback )
{
......@@ -167,6 +167,13 @@ void ConfigControl::OnUpdate( wxEvent& WXUNUSED(event) )
}
}
void ConfigControl::OnUpdateScroll( wxScrollEvent& WXUNUSED(event) )
{
wxCommandEvent cevent;
OnUpdate(cevent);
}
/*****************************************************************************
* KeyConfigControl implementation
*****************************************************************************/
......@@ -708,7 +715,7 @@ wxString FileConfigControl::GetPszValue()
*****************************************************************************/
BEGIN_EVENT_TABLE(IntegerConfigControl, wxPanel)
EVT_TEXT(-1, IntegerConfigControl::OnUpdate)
EVT_COMMAND_SCROLL(-1, IntegerConfigControl::OnUpdate)
EVT_COMMAND_SCROLL(-1, IntegerConfigControl::OnUpdateScroll)
END_EVENT_TABLE()
IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
......@@ -743,11 +750,17 @@ int IntegerConfigControl::GetIntValue()
return i_value; //spin->GetValue();
}
void IntegerConfigControl::OnUpdate( wxScrollEvent &event )
void IntegerConfigControl::OnUpdate( wxCommandEvent &event )
{
i_value = event.GetInt();
ConfigControl::OnUpdate( event );
}
void IntegerConfigControl::OnUpdateScroll( wxScrollEvent &event )
{
wxCommandEvent cevent;
cevent.SetInt(event.GetPosition());
OnUpdate(cevent);
}
/*****************************************************************************
* IntegerListConfigControl implementation
......@@ -851,7 +864,7 @@ int IntegerListConfigControl::GetIntValue()
* RangedIntConfigControl implementation
*****************************************************************************/
BEGIN_EVENT_TABLE(RangedIntConfigControl, wxPanel)
EVT_COMMAND_SCROLL(-1, RangedIntConfigControl::OnUpdate)
EVT_COMMAND_SCROLL(-1, RangedIntConfigControl::OnUpdateScroll)
END_EVENT_TABLE()
RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this,
......@@ -880,6 +893,7 @@ int RangedIntConfigControl::GetIntValue()
return slider->GetValue();
}
/*****************************************************************************
* FloatConfigControl implementation
*****************************************************************************/
......
......@@ -48,7 +48,8 @@ protected:
void (*pf_update_callback)( void * );
void *p_update_data;
void OnUpdate( wxEvent& );
void OnUpdate( wxCommandEvent& event );
void OnUpdateScroll( wxScrollEvent& event );
private:
wxString name;
......@@ -170,7 +171,8 @@ private:
wxSpinCtrl *spin;
int i_value;
void OnUpdate( wxScrollEvent& );
void OnUpdate( wxCommandEvent& event );
void OnUpdateScroll( wxScrollEvent& event );
DECLARE_EVENT_TABLE()
};
......
......@@ -183,7 +183,7 @@ class wizHelloPage : public wxWizardPageSimple
{
public:
wizHelloPage( wxWizard *parent);
void OnActionChange(wxEvent& event);
void OnActionChange( wxCommandEvent& event );
void OnWizardPageChanging(wxWizardEvent& event);
void OnMoreInfo( wxCommandEvent& event );
protected:
......@@ -209,7 +209,7 @@ class wizInputPage : public wxWizardPage
wizInputPage( wxWizard *, wxWizardPage *, intf_thread_t *);
wizInputPage::~wizInputPage();
void OnWizardPageChanging(wxWizardEvent& event);
void OnInputChange(wxEvent& event);
void OnInputChange( wxCommandEvent& event );
void OnEnablePartial(wxCommandEvent& event);
virtual wxWizardPage *GetPrev() const;
virtual wxWizardPage *GetNext() const;
......@@ -316,7 +316,7 @@ protected:
wxStaticText *address_text;
wxTextCtrl *address_txtctrl;
WizardDialog * p_parent;
void OnMethodChange(wxEvent& event);
void OnMethodChange( wxCommandEvent& event );
wxRadioButton *method_radios[4];
wxWizardPage *p_prev;
wxWizardPage *p_next;
......@@ -349,7 +349,7 @@ protected:
int i_encap;
int i_mux;
int i_action;
void OnEncapChange(wxEvent& event);
void OnEncapChange( wxCommandEvent& event );
wxRadioButton *encap_radios[MUXERS_NUMBER];
WizardDialog *p_parent;
wxWizardPage *p_prev;
......@@ -505,7 +505,7 @@ void wizHelloPage::OnMoreInfo(wxCommandEvent& event)
wxOK | wxICON_INFORMATION, this->p_parent );
}
void wizHelloPage::OnActionChange(wxEvent& event)
void wizHelloPage::OnActionChange( wxCommandEvent& event )
{
i_action = event.GetId() - ActionRadio0_Event;
((wizInputPage *)GetNext())->SetAction( i_action );
......@@ -644,7 +644,7 @@ wizInputPage::~wizInputPage()
{
}
void wizInputPage::OnInputChange(wxEvent& event)
void wizInputPage::OnInputChange( wxCommandEvent& event )
{
i_input = event.GetId() - InputRadio0_Event;
if( i_input == 0 )
......@@ -1098,7 +1098,7 @@ wxWizardPage *wizStreamingMethodPage::GetNext() const { return p_next; }
void wizStreamingMethodPage::SetPrev( wxWizardPage *page) {p_prev = page; }
void wizStreamingMethodPage::OnMethodChange(wxEvent& event)
void wizStreamingMethodPage::OnMethodChange( wxCommandEvent& event )
{
i_method = event.GetId() - MethodRadio0_Event;
address_text->SetLabel( wxU(
......@@ -1174,7 +1174,7 @@ void wizEncapPage::OnWizardPageChanging(wxWizardEvent& event)
}
void wizEncapPage::OnEncapChange(wxEvent& event)
void wizEncapPage::OnEncapChange( wxCommandEvent& event )
{
i_mux = event.GetId() - EncapRadio0_Event;
}
......
......@@ -91,6 +91,8 @@ private:
"starts.")
#define TASKBAR_TEXT N_("Show taskbar entry")
#define TASKBAR_LONGTEXT N_("Show taskbar entry")
#define MINIMAL_TEXT N_("Minimal interface")
#define MINIMAL_LONGTEXT N_("Use minimal interface, no toolbar, few menus")
#define SYSTRAY_TEXT N_("Show systray icon")
#define SYSTRAY_LONGTEXT N_("Show systray icon")
......@@ -117,6 +119,8 @@ vlc_module_begin();
BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-taskbar", 1, NULL,
TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-minimal", 0, NULL,
MINIMAL_TEXT, MINIMAL_LONGTEXT, VLC_TRUE );
#ifdef wxHAS_TASK_BAR_ICON
add_bool( "wxwin-systray", 0, NULL,
SYSTRAY_TEXT, SYSTRAY_LONGTEXT, VLC_FALSE );
......@@ -217,6 +221,8 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Run: wxWindows thread
*****************************************************************************/
//when is this called?
#if !defined(__BUILTIN__) && defined( WIN32 )
HINSTANCE hInstance = 0;
extern "C" BOOL WINAPI
......@@ -264,6 +270,11 @@ static void Init( intf_thread_t *p_intf )
#if defined( WIN32 )
#if !defined(__BUILTIN__)
//because no one knows when DllMain is called
if (hInstance == NULL)
hInstance = GetModuleHandle(NULL);
wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW );
#else
wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW );
......@@ -319,6 +330,7 @@ bool Instance::OnInit()
{
style = wxDEFAULT_FRAME_STYLE|wxFRAME_NO_TASKBAR;
}
Interface *MainInterface = new Interface( p_intf, style );
p_intf->p_sys->p_wxwindow = MainInterface;
......
......@@ -45,12 +45,12 @@
#include <wx/taskbar.h>
#include "vlc_keys.h"
/* Hmmm, work-around for newest wxWin */
#ifdef wxStaticCastEvent
# undef wxStaticCastEvent
# define wxStaticCastEvent(type, val) ((type)(val))
//PITA
#if (!wxCHECK_VERSION(2,5,0))
typedef long wxTreeItemIdValue;
#endif
DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
......@@ -294,12 +294,13 @@ private:
class Systray: public wxTaskBarIcon
{
public:
Systray( Interface* p_main_interface );
Systray( Interface* p_main_interface, intf_thread_t *p_intf );
virtual ~Systray() {};
wxMenu* CreatePopupMenu();
void UpdateTooltip( const wxChar* tooltip );
private:
void OnMenuIconize( wxCommandEvent& event );
void OnLeftClick( wxTaskBarIconEvent& event );
void OnPlayStream ( wxCommandEvent& event );
void OnStopStream ( wxCommandEvent& event );
......@@ -307,6 +308,7 @@ private:
void OnNextStream ( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
Interface* p_main_interface;
intf_thread_t *p_intf;
DECLARE_EVENT_TABLE()
};
#endif
......@@ -443,6 +445,7 @@ private:
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnPageChange( wxNotebookEvent& event );
void OnMRLChange( wxCommandEvent& event );
......@@ -452,11 +455,13 @@ private:
void OnFileBrowse( wxCommandEvent& event );
/* Event handlers for the disc page */
void OnDiscPanelChangeSpin( wxSpinEvent& event );
void OnDiscPanelChange( wxCommandEvent& event );
void OnDiscTypeChange( wxCommandEvent& event );
void OnDiscDeviceChange( wxCommandEvent& event );
/* Event handlers for the net page */
void OnNetPanelChangeSpin( wxSpinEvent& event );
void OnNetPanelChange( wxCommandEvent& event );
void OnNetTypeChange( wxCommandEvent& event );
......@@ -471,6 +476,7 @@ private:
/* Event handlers for the caching option */
void OnCachingEnable( wxCommandEvent& event );
void OnCachingChange( wxCommandEvent& event );
void OnCachingChangeSpin( wxSpinEvent& event );
DECLARE_EVENT_TABLE();
......@@ -774,10 +780,11 @@ private:
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxEvent& event );
void OnCancel( wxCommandEvent& event );
void OnSave( wxCommandEvent& event );
void OnResetAll( wxCommandEvent& event );
void OnAdvanced( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
DECLARE_EVENT_TABLE();
......@@ -798,7 +805,8 @@ public:
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxEvent& event );
void OnButtonClose( wxCommandEvent& event );
void OnClose( wxCloseEvent& WXUNUSED(event) );
void OnClear( wxCommandEvent& event );
void OnSaveLog( wxCommandEvent& event );
......@@ -842,7 +850,8 @@ private:
void OnAddFile( wxCommandEvent& event );
void OnAddDir( wxCommandEvent& event );
void OnAddMRL( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnMenuClose( wxCommandEvent& event );
void OnClose( wxCloseEvent& WXUNUSED(event) );
void OnEnableSelection( wxCommandEvent& event );
void OnDisableSelection( wxCommandEvent& event );
......@@ -999,7 +1008,8 @@ public:
vlc_bool_t b_need_update;
private:
void OnClose( wxCloseEvent& event );
void OnButtonClose( wxCommandEvent& event );
void OnClose( wxCloseEvent& WXUNUSED(event) );
DECLARE_EVENT_TABLE();
......
......@@ -245,6 +245,11 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Artist" ) );
}
else if ( i_mode == SORT_GENRE )
{
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Genre" ) );
}
if( psz_search && !strcmp( psz_search, "" ) )
{
......
......@@ -179,13 +179,20 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view)
}
/* Handle update of sorted views here */
if( i_view == VIEW_S_AUTHOR )
if( i_view >= VIEW_FIRST_SORTED )
{
int i_sort_type;
playlist_ViewEmpty( p_playlist, i_view, VLC_FALSE );
switch( i_view )
{
case VIEW_S_AUTHOR: i_sort_type = SORT_AUTHOR;break;
case VIEW_S_GENRE: i_sort_type = SORT_GENRE;break;
default: i_sort_type = SORT_AUTHOR;
}
playlist_NodeGroup( p_playlist, i_view, p_view->p_root,
p_playlist->pp_items,p_playlist->i_size,
SORT_AUTHOR, ORDER_NORMAL );
i_sort_type, ORDER_NORMAL );
}
......
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