Commit 437957ac authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: Fixed the open dialog on win32.
    Better slider management in the main interface. Misc other small fixes.
parent 543e3529
......@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.13 2003/01/23 23:57:50 gbazin Exp $
* $Id: interface.cpp,v 1.14 2003/01/26 10:36:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -122,6 +122,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
EVT_MENU(NextStream_Event, Interface::OnNextStream)
/* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
END_EVENT_TABLE()
......@@ -511,7 +512,42 @@ void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
void Interface::OnSliderUpdate( wxScrollEvent& event )
{
vlc_mutex_lock( &p_intf->change_lock );
if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
|| event.GetEventType() == wxEVT_SCROLL_ENDSCROLL )
{
if( p_intf->p_sys->i_slider_pos != event.GetPosition()
&& p_intf->p_sys->p_input )
{
p_intf->p_sys->i_slider_pos = event.GetPosition();
input_Seek( p_intf->p_sys->p_input, p_intf->p_sys->i_slider_pos *
100 / SLIDER_MAX_POS,
INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
}
p_intf->p_sys->b_slider_free = VLC_TRUE;
}
else
{
p_intf->p_sys->b_slider_free = VLC_FALSE;
if( p_intf->p_sys->p_input )
{
/* Update stream date */
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
char psz_time[ OFFSETTOTIME_MAX_SIZE ];
slider_box->SetLabel(
input_OffsetToTime( p_intf->p_sys->p_input,
psz_time,
p_area->i_size * event.GetPosition()
/ SLIDER_MAX_POS ) );
#undef p_area
}
}
vlc_mutex_unlock( &p_intf->change_lock );
}
void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
......
......@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: open.cpp,v 1.1 2003/01/23 23:57:50 gbazin Exp $
* $Id: open.cpp,v 1.2 2003/01/26 10:36:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -150,9 +150,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
"following predefined targets:") );
/* Create notebook */
wxNotebook *notebook = new wxNotebook( panel, Notebook_Event,
wxDefaultPosition,
wxSize( 300, 250 ) );
wxNotebook *notebook = new wxNotebook( panel, Notebook_Event );
wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
notebook->AddPage( FilePanel( notebook ), _("File"),
i_access_method == FILE_ACCESS );
notebook->AddPage( DiscPanel( notebook ), _("Disc"),
......@@ -181,7 +181,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT );
panel_sizer->Layout();
panel->SetSizerAndFit( panel_sizer );
......@@ -238,12 +238,9 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
sizer_row->Add( disc_type, 0, wxEXPAND | wxALL, 5 );
wxStaticText *label = new wxStaticText( panel, -1, _("Device Name") );
char *psz_device = config_GetPsz( p_intf, "dvd" );
disc_device = new wxTextCtrl( panel, DiscDevice_Event,
psz_device ? psz_device : "",
disc_device = new wxTextCtrl( panel, DiscDevice_Event, "",
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
if( psz_device ) free( psz_device );
sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
......@@ -271,6 +268,10 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
panel->SetSizerAndFit( sizer_row );
/* Update Disc panel */
wxCommandEvent dummy_event;
OnDiscTypeChange( dummy_event );
return panel;
}
......@@ -318,6 +319,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
subpanel_sizer->Add( net_ports[0], 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
net_subpanels[0]->SetSizerAndFit( subpanel_sizer );
net_radios[0]->SetValue( TRUE );
/* UDP/RTP Multicast row */
subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
......@@ -366,7 +368,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
/* HTTP row */
subpanel_sizer = new wxFlexGridSizer( 2, 1, 20 );
label = new wxStaticText( net_subpanels[3], -1, _("URL") );
net_addrs[3] = new wxTextCtrl( net_subpanels[3], NetAddr4_Event, "http://",
net_addrs[3] = new wxTextCtrl( net_subpanels[3], NetAddr4_Event, "",
wxDefaultPosition, wxSize( 200, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
......@@ -387,6 +389,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
panel->SetSizerAndFit( sizer_row );
/* Update Net panel */
net_addrs[3]->SetValue( "http://" );
wxCommandEvent dummy_event;
dummy_event.SetId( NetRadio1_Event );
OnNetTypeChange( dummy_event );
......@@ -452,7 +455,6 @@ void OpenDialog::UpdateMRL( int i_access_method )
break;
}
break;
case SAT_ACCESS:
mrl = "satellite://";
break;
......@@ -525,7 +527,6 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
disc_device->SetValue( psz_device ? psz_device : "" );
break;
case 2:
default:
psz_device = config_GetPsz( p_intf, "dvd" );
disc_device->SetValue( psz_device ? psz_device : "" );
......@@ -533,6 +534,8 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
}
if( psz_device ) free( psz_device );
UpdateMRL( DISC_ACCESS );
}
/*****************************************************************************
......@@ -551,6 +554,7 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
for(i=0; i<4; i++)
{
net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) );
net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) );
}
......
......@@ -2,7 +2,7 @@
* popup.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: popup.cpp,v 1.2 2003/01/23 23:57:50 gbazin Exp $
* $Id: popup.cpp,v 1.3 2003/01/26 10:36:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -55,8 +55,9 @@
enum
{
/* menu items */
Close_Event = wxID_HIGHEST,
Close_Event = wxID_HIGHEST + 1000,
MenuDummy_Event,
MenuLast_Event,
};
BEGIN_EVENT_TABLE(PopupMenu, wxMenu)
......@@ -81,7 +82,7 @@ PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ):
/* Initializations */
p_intf = _p_intf;
p_main_interface = _p_main_interface;
i_item_id = 0;
i_item_id = MenuLast_Event;
/* Audio menu */
Append( MenuDummy_Event, _("Audio menu") );
......
......@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.8 2003/01/23 23:57:50 gbazin Exp $
* $Id: timer.cpp,v 1.9 2003/01/26 10:36:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -173,23 +173,15 @@ void Timer::Notify()
stream_position_t position;
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( p_intf->p_sys->i_slider_pos ==
p_intf->p_sys->i_slider_oldpos )
/* Update the slider if the user isn't dragging it. */
if( p_intf->p_sys->b_slider_free )
{
/* Update the value */
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_Tell( p_input, &position );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_intf->p_sys->i_slider_oldpos =
( SLIDER_MAX_POS * position.i_tell ) / position.i_size;
if( p_intf->p_sys->i_slider_pos !=
p_intf->p_sys->i_slider_oldpos )
{
p_intf->p_sys->i_slider_pos =
p_intf->p_sys->i_slider_oldpos;
( SLIDER_MAX_POS * position.i_tell ) / position.i_size;
p_main_interface->slider->SetValue(
p_intf->p_sys->i_slider_pos );
......@@ -200,23 +192,6 @@ void Timer::Notify()
}
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_Seek( p_input, p_intf->p_sys->i_slider_pos *
100 / SLIDER_MAX_POS,
INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->i_slider_oldpos =
p_intf->p_sys->i_slider_pos;
}
}
if( p_intf->p_sys->i_part !=
p_input->stream.p_selected_area->i_part )
{
......
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