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

* Patch by Gregory Hazel :

  - Fix gui flickering on video size change
  - provide a no-auto-resize mode 

* Patch by Christophe Mutricy : fix M3U export

Thanks to both !
parent 57f7ae15
......@@ -25,6 +25,7 @@ Bruno Vella <allevb at tin.it> - Italian localization
Carlo Calabr <murray at via.ecp.fr> - Italian localization
Carsten Gottbeht <gottbehuet at active-elements dot de> - v4l hotplug fix
Christof Baumgaertner - dbox web intf
Christophe Mutricy <xtophe at nxtelevision dot com>- many fixes (preferences, M3U, ...)
Christopher Johnson <cjohnson at mint.net> - Qt fix in vlc.spec
Colin Simmonds <colin_simmonds at Mac.lover.org> - compile fix for Mac OS X
Damian Ivereigh <damian at cisco.com> - ac3dec uninitialized data structure fix
......@@ -39,6 +40,7 @@ Ethan C. Baldridge <BaldridgeE at cadmus.com> - directory browsing code
Felix Khne <fkuehne at users.sf.net> - German translation
Frank Chao <frank0624 at gmail.com> - Chinese Traditional translation
Fumio Nakayama <endymion at ca2.so-net.ne.jp> - Japanese translation
Gregory Hazel <ghazel et gmail dot com> - wxWidgets fixes and improvements
Goetz Waschk <waschk at informatik.uni-rostock dot de> - Mandrake packages
Haakon Meland Eriksen - Norwegian translation
Hans-Peter Jansen <hpj at urpla.net> - patch for module options handling
......
......@@ -210,6 +210,8 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Custom events */
EVT_COMMAND(0, wxEVT_INTF, Interface::OnControlEvent)
EVT_COMMAND(1, wxEVT_INTF, Interface::OnControlEvent)
EVT_TIMER(ID_CONTROLS_TIMER, Interface::OnControlsTimer)
END_EVENT_TABLE()
/*****************************************************************************
......@@ -300,6 +302,8 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
SetupHotkeys();
m_controls_timer.SetOwner(this, ID_CONTROLS_TIMER);
/* Start timer */
timer = new Timer( p_intf, this );
......@@ -356,8 +360,15 @@ void Interface::OnControlEvent( wxCommandEvent& event )
switch( event.GetId() )
{
case 0:
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (size_to_video)
{
frame_sizer->Layout();
frame_sizer->Fit(this);
}
}
break;
case 1:
......@@ -670,6 +681,28 @@ void Interface::SetupHotkeys()
* Event Handlers.
*****************************************************************************/
void Interface::OnControlsTimer(wxTimerEvent& WXUNUSED(event))
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
/* Hide slider and Disc Buttons */
disc_frame->Hide();
slider_sizer->Hide( disc_frame );
slider_sizer->Layout();
if (size_to_video)
{
slider_sizer->Fit( slider_frame );
}
slider_frame->Hide();
frame_sizer->Hide( slider_frame );
frame_sizer->Layout();
if (size_to_video)
{
frame_sizer->Fit( this );
}
}
void Interface::OnMenuOpen(wxMenuEvent& event)
{
#if defined( __WXMSW__ )
......@@ -854,7 +887,11 @@ void Interface::OnExtended(wxCommandEvent& event)
fprintf(stderr,"Creating window\n");
extra_frame->Hide();
frame_sizer->Hide( extra_frame );
#if (wxCHECK_VERSION(2,5,0))
frame_sizer->Detach( extra_frame );
#else
frame_sizer->Remove( extra_frame );
#endif
frame_sizer->Layout();
frame_sizer->Fit(this);
extra_window = new ExtraWindow( p_intf, this, extra_frame );
......@@ -898,7 +935,11 @@ void Interface::OnUndock(wxCommandEvent& event)
fprintf(stderr,"Creating window\n");
extra_frame->Hide();
frame_sizer->Hide( extra_frame );
#if (wxCHECK_VERSION(2,5,0))
frame_sizer->Detach( extra_frame );
#else
frame_sizer->Remove( extra_frame );
#endif
frame_sizer->Layout();
frame_sizer->Fit(this);
extra_window = new ExtraWindow( p_intf, this, extra_frame );
......
......@@ -464,9 +464,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
/* Create notebook */
notebook = new wxNotebook( panel, Notebook_Event );
//#if (!wxCHECK_VERSION(2,5,0))
#if (!wxCHECK_VERSION(2,5,0))
wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
//#endif
#endif
notebook->AddPage( FilePanel( notebook ), wxU(_("File")),
i_access_method == FILE_ACCESS );
......@@ -540,9 +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))
#if (!wxCHECK_VERSION(2,5,0))
panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
//#endif
#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 );
......
......@@ -865,8 +865,7 @@ void Playlist::OnSave( wxCommandEvent& WXUNUSED(event) )
char *psz_desc;
char *psz_filter;
char *psz_module;
} formats[] = {{ _("M3U file"), "*.m3u", "export-m3u" },
{ _("PLS file"), "*.pls", "export-pls" }};
} formats[] = {{ _("M3U file"), "*.m3u", "export-m3u" }};
wxString filter = wxT("");
......
......@@ -645,10 +645,10 @@ void PrefsTreeCtrl::CleanChanges()
if( config_data )
{
config_data->panel->Hide();
#if (wxMAJOR_VERSION >= 2) && (wxMINOR_VERSION < 5 )
p_sizer->Remove( config_data->panel );
#else
#if (wxCHECK_VERSION(2,5,0))
p_sizer->Detach( config_data->panel );
#else
p_sizer->Remove( config_data->panel );
#endif
}
......@@ -741,10 +741,10 @@ 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
#if (wxCHECK_VERSION(2,5,0))
p_sizer->Detach( config_data->panel );
#else
p_sizer->Remove( config_data->panel );
#endif
}
......@@ -781,11 +781,10 @@ 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
#if (wxCHECK_VERSION(2,5,0))
p_sizer->Detach( config_data->panel );
#else
p_sizer->Remove( config_data->panel );
#endif
}
......
......@@ -132,7 +132,7 @@ void Timer::Notify()
if( p_intf->p_sys->p_input )
{
p_main_interface->slider->SetValue( 0 );
b_old_seekable = VLC_FALSE;
b_slider_shown = VLC_FALSE;
b_disc_shown = VLC_FALSE;
char *psz_now_playing = vlc_input_item_GetInfo(
......@@ -163,18 +163,10 @@ void Timer::Notify()
}
else if( p_intf->p_sys->p_input->b_dead )
{
/* Hide slider and Disc Buttons */
p_main_interface->disc_frame->Hide();
p_main_interface->slider_sizer->Hide(
p_main_interface->disc_frame );
p_main_interface->slider_sizer->Layout();
p_main_interface->slider_sizer->Fit( p_main_interface->slider_frame );
p_main_interface->slider_frame->Hide();
p_main_interface->frame_sizer->Hide(
p_main_interface->slider_frame );
p_main_interface->frame_sizer->Layout();
p_main_interface->frame_sizer->Fit( p_main_interface );
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
//controls auto-hide after a timer
p_main_interface->m_controls_timer.Start(1000, wxTIMER_ONE_SHOT);
p_main_interface->TogglePlayButton( PAUSE_S );
i_old_playing_status = PAUSE_S;
......@@ -194,6 +186,7 @@ void Timer::Notify()
if( p_intf->p_sys->p_input )
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
input_thread_t *p_input = p_intf->p_sys->p_input;
vlc_value_t val;
......@@ -201,6 +194,9 @@ void Timer::Notify()
{
vlc_value_t pos;
//prevent the controls from auto-hiding
p_main_interface->m_controls_timer.Stop();
/* New input or stream map change */
p_intf->p_sys->b_playing = 1;
......@@ -222,8 +218,6 @@ void Timer::Notify()
free( psz_now_playing );
/* Manage the slider */
/* FIXME --fenrir */
/* Change the name of b_old_seekable into b_show_bar or something like that */
var_Get( p_input, "position", &pos );
var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
......@@ -249,7 +243,6 @@ void Timer::Notify()
p_main_interface->disc_sizer->Layout();
p_main_interface->disc_sizer->Fit(
p_main_interface->disc_frame );
p_main_interface->disc_menu_button->SetToolTip(
wxU(_( HELP_MENU ) ) );
p_main_interface->disc_prev_button->SetToolTip(
......@@ -274,22 +267,42 @@ void Timer::Notify()
p_main_interface->disc_frame );
}
if( ! b_old_seekable )
{
if( pos.f_float > 0.0 )
{
/* Done like this, as it's the only way to know if the */
/* slider has to be displayed */
b_old_seekable = VLC_TRUE;
if( !b_slider_shown )
{
b_slider_shown = VLC_TRUE;
p_main_interface->slider_frame->Show();
p_main_interface->frame_sizer->Show(
p_main_interface->slider_frame );
p_main_interface->frame_sizer->Layout();
if (size_to_video)
{
p_main_interface->frame_sizer->Fit( p_main_interface );
}
}
}
else
{
if( b_slider_shown )
{
p_main_interface->slider_frame->Hide();
p_main_interface->frame_sizer->Hide(
p_main_interface->slider_frame );
p_main_interface->frame_sizer->Layout();
if (size_to_video)
{
p_main_interface->frame_sizer->Fit( p_main_interface );
}
}
}
if( p_intf->p_sys->b_playing && b_old_seekable )
if( p_intf->p_sys->b_playing && b_slider_shown )
{
/* Update the slider if the user isn't dragging it. */
if( p_intf->p_sys->b_slider_free )
......@@ -324,11 +337,11 @@ void Timer::Notify()
}
#if 0
vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_intf->p_sys->p_input->stream.b_seekable && !b_old_seekable )
if( p_intf->p_sys->p_input->stream.b_seekable && !b_slider_shown )
{
/* Done like this because b_seekable is set slightly after
* the new input object is available. */
b_old_seekable = VLC_TRUE;
b_slider_shown = VLC_TRUE;
p_main_interface->slider_frame->Show();
p_main_interface->frame_sizer->Show(
p_main_interface->slider_frame );
......@@ -413,7 +426,6 @@ void Timer::Notify()
i_old_rate = val.i_int;
}
}
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
......@@ -460,6 +472,7 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
return VLC_SUCCESS;
}
/*****************************************************************************
* IntfShowCB: callback triggered by the intf-show playlist variable.
*****************************************************************************/
......
......@@ -46,6 +46,7 @@ enum
UpdateSize_Event = wxID_HIGHEST + 1,
UpdateHide_Event,
SetStayOnTop_Event,
ID_HIDE_TIMER
};
class VideoWindow: public wxWindow
......@@ -69,9 +70,12 @@ private:
wxWindow *p_child_window;
void UpdateSize( wxEvent & );
void UpdateHide( wxEvent & );
void OnControlEvent( wxCommandEvent & );
wxTimer m_hide_timer;
void UpdateSize( wxEvent& event );
void UpdateHide( wxEvent& event );
void OnControlEvent( wxCommandEvent& event );
void OnHideTimer( wxTimerEvent& WXUNUSED(event));
DECLARE_EVENT_TABLE();
};
......@@ -83,6 +87,7 @@ BEGIN_EVENT_TABLE(VideoWindow, wxWindow)
EVT_CUSTOM( wxEVT_SIZE, UpdateHide_Event, VideoWindow::UpdateHide )
EVT_COMMAND( SetStayOnTop_Event, wxEVT_VLC_VIDEO,
VideoWindow::OnControlEvent )
EVT_TIMER( ID_HIDE_TIMER, VideoWindow::OnHideTimer )
END_EVENT_TABLE()
/*****************************************************************************
......@@ -105,17 +110,49 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
vlc_mutex_init( p_intf, &lock );
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
p_vout = NULL;
m_hide_timer.SetOwner(this, ID_HIDE_TIMER);
p_intf->pf_request_window = ::GetWindow;
p_intf->pf_release_window = ::ReleaseWindow;
p_intf->pf_control_window = ::ControlWindow;
p_intf->p_sys->p_video_window = this;
p_child_window = new wxWindow( this, -1, wxDefaultPosition, wxSize(0,0) );
wxSize child_size = wxSize(0,0);
if (!size_to_video)
{
//maybe this size should be an option
child_size = wxSize( wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) / 2,
wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ) / 2);
SetSize(child_size);
}
p_child_window = new wxWindow( this, -1, wxDefaultPosition, child_size );
if (!size_to_video)
{
//show the window so we can see the background where the video will be
p_child_window->Show();
Show();
b_shown = VLC_TRUE;
}
else
{
//othewise the video window is shown when a video starts
//but hide it now, so we can set the background color without it showing
p_child_window->Hide();
Hide();
b_shown = VLC_FALSE;
}
p_child_window->SetBackgroundColour(*wxBLACK);
SetBackgroundColour(*wxBLACK);
p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL );
p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND );
......@@ -227,16 +264,27 @@ void VideoWindow::ReleaseWindow( void *p_window )
p_vout = NULL;
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (size_to_video)
{
#if defined(__WXGTK__) || defined(WIN32)
wxSizeEvent event( wxSize(0, 0), UpdateHide_Event );
AddPendingEvent( event );
#endif
}
vlc_mutex_unlock( &lock );
}
void VideoWindow::UpdateSize( wxEvent &_event )
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
m_hide_timer.Stop();
if (size_to_video)
{
wxSizeEvent * event = (wxSizeEvent*)(&_event);
if( !b_shown )
{
......@@ -250,10 +298,43 @@ void VideoWindow::UpdateSize( wxEvent &_event )
wxCommandEvent intf_event( wxEVT_INTF, 0 );
p_parent->AddPendingEvent( intf_event );
}
else
{
//this is a very hackish way to show in case the user switched
//size-to-video off while no video was playing, which would leave
//the window hidden and of 0 size
if( !b_shown )
{
p_intf->p_sys->p_video_sizer->Show( this, TRUE );
SetFocus();
b_shown = VLC_TRUE;
wxSize child_size = wxSize( wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) / 2,
wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ) / 2);
SetSize(child_size);
p_child_window->SetSize(child_size);
Interface * intf = (Interface *)p_parent;
intf->frame_sizer->Layout();
intf->frame_sizer->Fit(intf);
}
}
}
void VideoWindow::UpdateHide( wxEvent &_event )
{
wxSizeEvent * event = (wxSizeEvent*)(&_event);
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (size_to_video)
{
m_hide_timer.Start(1000, wxTIMER_ONE_SHOT);
}
}
void VideoWindow::OnHideTimer( wxTimerEvent& WXUNUSED(event))
{
//wxSizeEvent * event = (wxSizeEvent*)(&_event);
if( b_shown )
{
p_intf->p_sys->p_video_sizer->Show( this, FALSE );
......@@ -261,9 +342,10 @@ void VideoWindow::UpdateHide( wxEvent &_event )
b_shown = VLC_FALSE;
SetSize(0,0);
Show();
Hide();
}
p_intf->p_sys->p_video_sizer->SetMinSize( event->GetSize() );
//ok I cheat here, but is it ever not 0,0?
p_intf->p_sys->p_video_sizer->SetMinSize( wxSize(0,0) );
wxCommandEvent intf_event( wxEVT_INTF, 0 );
p_parent->AddPendingEvent( intf_event );
......@@ -298,13 +380,20 @@ int VideoWindow::ControlWindow( void *p_window, int i_query, va_list args )
{
case VOUT_SET_ZOOM:
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (size_to_video)
{
double f_arg = va_arg( args, double );
/* Update dimensions */
wxSizeEvent event( wxSize((int)(p_vout->i_window_width * f_arg),
(int)(p_vout->i_window_height * f_arg)),
UpdateSize_Event );
AddPendingEvent( event );
}
i_ret = VLC_SUCCESS;
}
......
......@@ -93,6 +93,8 @@ private:
#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 SIZE_TO_VIDEO_TEXT N_("Size to video")
#define SIZE_TO_VIDEO_LONGTEXT N_("Resize VLC to match the video resolution")
#define SYSTRAY_TEXT N_("Show systray icon")
#define SYSTRAY_LONGTEXT N_("Show systray icon")
......@@ -121,6 +123,8 @@ vlc_module_begin();
TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-minimal", 0, NULL,
MINIMAL_TEXT, MINIMAL_LONGTEXT, VLC_TRUE );
add_bool( "wxwin-size-to-video", 1, NULL,
SIZE_TO_VIDEO_TEXT, SIZE_TO_VIDEO_LONGTEXT, VLC_TRUE );
#ifdef wxHAS_TASK_BAR_ICON
add_bool( "wxwin-systray", 0, NULL,
SYSTRAY_TEXT, SYSTRAY_LONGTEXT, VLC_FALSE );
......
......@@ -45,12 +45,10 @@
#include <wx/taskbar.h>
#include "vlc_keys.h"
//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 );
......@@ -89,6 +87,10 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
#define MODE_AUTHOR 2
#define MODE_TITLE 3
enum{
ID_CONTROLS_TIMER,
};
class DialogsProvider;
class PrefsTreeCtrl;
class AutoBuiltPanel;
......@@ -187,7 +189,7 @@ private:
vlc_bool_t b_init;
int i_old_playing_status;
int i_old_rate;
vlc_bool_t b_old_seekable;
vlc_bool_t b_slider_shown;
vlc_bool_t b_disc_shown;
};
......@@ -353,6 +355,8 @@ public:
Systray *p_systray;
#endif
wxTimer m_controls_timer;
private:
void SetupHotkeys();
void CreateOurMenuBar();
......@@ -362,6 +366,8 @@ private:
void Open( int i_access_method );
/* Event handlers (these functions should _not_ be virtual) */
void OnControlsTimer(wxTimerEvent& WXUNUSED(event));
void OnExit( wxCommandEvent& event );
void OnAbout( wxCommandEvent& event );
......
......@@ -65,12 +65,20 @@ int Export_M3U( vlc_object_t *p_this )
{
char *psz_author =
vlc_input_item_GetInfo( &p_playlist->pp_items[i]->input,
_("General"), _("Author") );
fprintf( p_export->p_file, "#EXTINF:%i,%s,%s\n",
_("Meta-information"), _("Artist") );
if( psz_author && *psz_author )
{
fprintf( p_export->p_file, "#EXTINF:%i,%s - %s\n",
(int)(p_playlist->pp_items[i]->input.i_duration/1000000),
psz_author ? psz_author : "",
p_playlist->pp_items[i]->input.psz_name );
psz_author, p_playlist->pp_items[i]->input.psz_name );
}
else
{
fprintf( p_export->p_file, "#EXTINF:%i,%s\n",
(int)(p_playlist->pp_items[i]->input.i_duration/1000000),
p_playlist->pp_items[i]->input.psz_name );
}
free(psz_author);
}
/* VLC specific options */
......
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