diff --git a/include/configuration.h b/include/configuration.h index b874af042a..76e61ad4ab 100644 --- a/include/configuration.h +++ b/include/configuration.h @@ -4,7 +4,7 @@ * It includes functions allowing to declare, get or set configuration options. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: configuration.h,v 1.26 2003/03/30 14:24:20 gbazin Exp $ + * $Id: configuration.h,v 1.27 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -70,7 +70,12 @@ struct module_config_t vlc_mutex_t *p_lock; /* Lock to use when modifying the config */ vlc_bool_t b_dirty; /* Dirty flag to indicate a config change */ - vlc_bool_t b_advanced; /* Flag to indicate an advanced option */ + vlc_bool_t b_advanced; /* Flag to indicate an advanced option */ + + /* Original option values */ + char *psz_value_orig; + int i_value_orig; + float f_value_orig; }; /***************************************************************************** @@ -88,6 +93,8 @@ VLC_EXPORT( int, __config_LoadCmdLine, ( vlc_object_t *, int *, char *[], vl VLC_EXPORT( char *, config_GetHomeDir, ( void ) ); VLC_EXPORT( int, __config_LoadConfigFile, ( vlc_object_t *, const char * ) ); VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) ); +VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) ); + VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char *psz_name ) ); VLC_EXPORT( void, config_Duplicate, ( module_t *, module_config_t * ) ); @@ -106,6 +113,7 @@ VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) ); #define config_LoadCmdLine(a,b,c,d) __config_LoadCmdLine(VLC_OBJECT(a),b,c,d) #define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b) #define config_SaveConfigFile(a,b) __config_SaveConfigFile(VLC_OBJECT(a),b) +#define config_ResetAll(a) __config_ResetAll(VLC_OBJECT(a)) /***************************************************************************** * Macros used to build the configuration structure. diff --git a/modules/gui/skins/Modules.am b/modules/gui/skins/Modules.am index ab40a9f2b0..80e1deac1c 100644 --- a/modules/gui/skins/Modules.am +++ b/modules/gui/skins/Modules.am @@ -107,7 +107,7 @@ SOURCES_skins = \ modules/gui/skins/x11/x11_window.cpp \ modules/gui/skins/x11/x11_window.h \ \ - modules/gui/skins/src/wxdialogs.h \ + modules/gui/wxwindows/wxwindows.h \ modules/gui/wxwindows/fileinfo.cpp \ modules/gui/wxwindows/messages.cpp \ modules/gui/wxwindows/open.cpp \ diff --git a/modules/gui/skins/gtk2/gtk2_run.cpp b/modules/gui/skins/gtk2/gtk2_run.cpp index bf39c71c82..dda5ab9753 100644 --- a/modules/gui/skins/gtk2/gtk2_run.cpp +++ b/modules/gui/skins/gtk2/gtk2_run.cpp @@ -2,7 +2,7 @@ * gtk2_run.cpp: ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: gtk2_run.cpp,v 1.23 2003/05/01 13:51:03 ipkiss Exp $ + * $Id: gtk2_run.cpp,v 1.24 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Cyril Deguet * @@ -50,7 +50,7 @@ #include "../src/vlcproc.h" #ifndef BASIC_SKINS -#include "../src/wxdialogs.h" +#include "../../wxwindows/wxwindows.h" #include "share/vlc32x32.xpm" // include the icon graphic #endif diff --git a/modules/gui/skins/src/skin_main.cpp b/modules/gui/skins/src/skin_main.cpp index 83620d89fa..26f50b2dba 100644 --- a/modules/gui/skins/src/skin_main.cpp +++ b/modules/gui/skins/src/skin_main.cpp @@ -2,7 +2,7 @@ * skin-main.cpp: skins plugin for VLC ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: skin_main.cpp,v 1.25 2003/05/05 12:15:25 gbazin Exp $ + * $Id: skin_main.cpp,v 1.26 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Olivier Teulière * Emmanuel Puig @@ -50,7 +50,7 @@ #include "vlcproc.h" #include "skin_common.h" #ifndef BASIC_SKINS -#include "wxdialogs.h" +#include "../../wxwindows/wxwindows.h" #endif #ifdef X11_SKINS diff --git a/modules/gui/skins/src/vlcproc.cpp b/modules/gui/skins/src/vlcproc.cpp index 701045c106..f009a0dbc9 100644 --- a/modules/gui/skins/src/vlcproc.cpp +++ b/modules/gui/skins/src/vlcproc.cpp @@ -2,7 +2,7 @@ * vlcproc.cpp: VlcProc class ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: vlcproc.cpp,v 1.21 2003/05/05 16:29:57 gbazin Exp $ + * $Id: vlcproc.cpp,v 1.22 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Olivier Teulière * Emmanuel Puig @@ -51,7 +51,7 @@ #include "skin_common.h" #ifndef BASIC_SKINS -#include "wxdialogs.h" +#include "../../wxwindows/wxwindows.h" #endif diff --git a/modules/gui/skins/src/wxdialogs.h b/modules/gui/skins/src/wxdialogs.h deleted file mode 100644 index 959b5f9e9d..0000000000 --- a/modules/gui/skins/src/wxdialogs.h +++ /dev/null @@ -1,448 +0,0 @@ -/***************************************************************************** - * wxwindows.h: private wxWindows interface description - ***************************************************************************** - * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxdialogs.h,v 1.2 2003/04/21 16:55:53 anil Exp $ - * - * Authors: Gildas Bazin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -class Playlist; -class Messages; -class FileInfo; - -#define SLIDER_MAX_POS 10000 - -/***************************************************************************** - * Classes declarations. - *****************************************************************************/ -class Interface; - -/* Timer */ -class Timer: public wxTimer -{ -public: - /* Constructor */ - Timer( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~Timer(); - - virtual void Notify(); - -private: - intf_thread_t *p_intf; - Interface *p_main_interface; - int i_old_playing_status; -}; - -/* Main Interface */ -class Interface: public wxFrame -{ -public: - /* Constructor */ - Interface( intf_thread_t *p_intf ); - virtual ~Interface(); - void TogglePlayButton( int i_playing_status ); - - wxBoxSizer *frame_sizer; - wxStatusBar *statusbar; - - wxSlider *slider; - wxWindow *slider_frame; - wxStaticBox *slider_box; - - wxMenu *p_popup_menu; - - wxArrayString mrl_history; - -private: - void CreateOurMenuBar(); - void CreateOurToolBar(); - void CreateOurSlider(); - void Open( int i_access_method ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnExit( wxCommandEvent& event ); - void OnAbout( wxCommandEvent& event ); - void OnMessages( wxCommandEvent& event ); - void OnPlaylist( wxCommandEvent& event ); - void OnLogs( wxCommandEvent& event ); - void OnFileInfo( wxCommandEvent& event ); - void OnPreferences( wxCommandEvent& event ); - - void OnOpenFile( wxCommandEvent& event ); - void OnOpenDisc( wxCommandEvent& event ); - void OnOpenNet( wxCommandEvent& event ); - void OnOpenSat( wxCommandEvent& event ); - - void OnPlayStream( wxCommandEvent& event ); - void OnStopStream( wxCommandEvent& event ); - void OnSliderUpdate( wxScrollEvent& event ); - void OnPrevStream( wxCommandEvent& event ); - void OnNextStream( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - Timer *timer; - intf_thread_t *p_intf; - - wxFrame *p_prefs_dialog; - - int i_old_playing_status; -}; - -/* Open Dialog */ -class OpenDialog: public wxDialog -{ -public: - /* Constructor */ - OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface, - int i_access_method ); - virtual ~OpenDialog(); - void Rebuild(); - void Manage(); - - wxString mrl; - -private: - wxPanel *FilePanel( wxWindow* parent ); - wxPanel *DiscPanel( wxWindow* parent ); - wxPanel *NetPanel( wxWindow* parent ); - wxPanel *SatPanel( wxWindow* parent ); - - void UpdateMRL( int i_access_method ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnOk( wxCommandEvent& event ); - void OnCancel( wxCommandEvent& event ); - - void OnPageChange( wxNotebookEvent& event ); - void OnMRLChange( wxCommandEvent& event ); - - /* Event handlers for the file page */ - void OnFilePanelChange( wxCommandEvent& event ); - void OnFileBrowse( wxCommandEvent& event ); - - /* Event handlers for the disc page */ - void OnDiscPanelChange( wxCommandEvent& event ); - void OnDiscTypeChange( wxCommandEvent& event ); - - /* Event handlers for the net page */ - void OnNetPanelChange( wxCommandEvent& event ); - void OnNetTypeChange( wxCommandEvent& event ); - - /* Event handlers for the stream output */ - void OnSoutEnable( wxCommandEvent& event ); - void OnSoutSettings( wxCommandEvent& WXUNUSED(event) ); - - /* Event handlers for the demux dump */ - void OnDemuxDumpEnable( wxCommandEvent& event ); - void OnDemuxDumpBrowse( wxCommandEvent& event ); - void OnDemuxDumpChange( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - int i_current_access_method; - - wxComboBox *mrl_combo; - - /* Controls for the file panel */ - wxComboBox *file_combo; - - /* Controls for the disc panel */ - wxRadioBox *disc_type; - wxTextCtrl *disc_device; - wxSpinCtrl *disc_title; - wxSpinCtrl *disc_chapter; - - /* Controls for the net panel */ - wxRadioBox *net_type; - int i_net_type; - wxPanel *net_subpanels[4]; - wxRadioButton *net_radios[4]; - wxSpinCtrl *net_ports[4]; - wxTextCtrl *net_addrs[4]; - - /* Controls for the stream output */ - wxButton *sout_button; - wxCheckBox *sout_checkbox; - - /* Controls for the demux dump */ - wxTextCtrl *demuxdump_textctrl; - wxButton *demuxdump_button; - wxCheckBox *demuxdump_checkbox; -}; - -enum -{ - FILE_ACCESS = 0, - DISC_ACCESS, - NET_ACCESS, - SAT_ACCESS -}; - -/* Stream output Dialog */ -class SoutDialog: public wxDialog -{ -public: - /* Constructor */ - SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~SoutDialog(); - - wxString mrl; - -private: - void UpdateMRL(); - wxPanel *AccessPanel( wxWindow* parent ); - wxPanel *EncapsulationPanel( wxWindow* parent ); - void ParseMRL(); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnOk( wxCommandEvent& event ); - void OnCancel( wxCommandEvent& event ); - void OnMRLChange( wxCommandEvent& event ); - void OnAccessTypeChange( wxCommandEvent& event ); - - /* Event handlers for the file access output */ - void OnFileChange( wxCommandEvent& event ); - void OnFileBrowse( wxCommandEvent& event ); - - /* Event handlers for the net access output */ - void OnNetChange( wxCommandEvent& event ); - - /* Event handlers for the encapsulation panel */ - void OnEncapsulationChange( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - - wxComboBox *mrl_combo; - wxPanel *access_panel; - wxPanel *encapsulation_panel; - - /* Controls for the access outputs */ - wxPanel *access_subpanels[4]; - wxRadioButton *access_radios[4]; - - int i_access_type; - - wxComboBox *file_combo; - wxSpinCtrl *net_port; - wxTextCtrl *net_addr; - - /* Controls for the encapsulation */ - wxRadioButton *encapsulation_radios[4]; - int i_encapsulation_type; - -}; - -/* Preferences Dialog */ -class PrefsTreeCtrl; -class PrefsDialog: public wxFrame -{ -public: - /* Constructor */ - PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~PrefsDialog(); - -private: - wxPanel *PrefsPanel( wxWindow* parent ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnOk( wxCommandEvent& event ); - void OnCancel( wxCommandEvent& event ); - void OnSave( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - - PrefsTreeCtrl *prefs_tree; -}; - -/* Messages */ -class Messages: public wxFrame -{ -public: - /* Constructor */ - Messages( intf_thread_t *p_intf, Interface *_p_main_interface ); - virtual ~Messages(); - void UpdateLog(); - -private: - /* Event handlers (these functions should _not_ be virtual) */ - void OnClose( wxCommandEvent& event ); - void OnVerbose( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - wxTextCtrl *textctrl; - wxTextAttr *info_attr; - wxTextAttr *err_attr; - wxTextAttr *warn_attr; - wxTextAttr *dbg_attr; - - vlc_bool_t b_verbose; -}; - -/* Playlist */ -class Playlist: public wxFrame -{ -public: - /* Constructor */ - Playlist( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~Playlist(); - void Rebuild(); - void Manage(); - -private: - void DeleteItem( int item ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnAddUrl( wxCommandEvent& event ); - void OnAddDirectory( wxCommandEvent& event ); - void OnClose( wxCommandEvent& event ); - void OnInvertSelection( wxCommandEvent& event ); - void OnDeleteSelection( wxCommandEvent& event ); - void OnSelectAll( wxCommandEvent& event ); - void OnActivateItem( wxListEvent& event ); - void OnKeyDown( wxListEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - wxListView *listview; - wxButton *ok_button; -}; - -/* File Info */ -class FileInfo: public wxFrame -{ -public: - /* Constructor */ - FileInfo( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~FileInfo(); - void UpdateFileInfo(); - -private: - void OnClose( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxTreeCtrl *fileinfo_tree; - wxTreeItemId fileinfo_root; - wxString fileinfo_root_label; - -}; - -#if !defined(__WXX11__) -/* Drag and Drop class */ -class DragAndDrop: public wxFileDropTarget -{ -public: - DragAndDrop( intf_thread_t *_p_intf ); - - virtual bool OnDropFiles( wxCoord x, wxCoord y, - const wxArrayString& filenames ); - -private: - intf_thread_t *p_intf; -}; -#endif - -/* Popup contextual menu */ -class PopupMenu: public wxMenu -{ -public: - /* Constructor */ - PopupMenu( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~PopupMenu(); - -private: - /* Event handlers (these functions should _not_ be virtual) */ - void OnClose( wxCommandEvent& event ); - void OnEntrySelected( wxCommandEvent& event ); - - wxMenu *PopupMenu::CreateDummyMenu(); - void PopupMenu::CreateMenuEntry( char *, vlc_object_t * ); - wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - Interface *p_main_interface; - - int i_item_id; -}; - -class PopupEvtHandler : public wxEvtHandler -{ -public: - PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~PopupEvtHandler(); - - void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event ); - -private: - - DECLARE_EVENT_TABLE() - - intf_thread_t *p_intf; - Interface *p_main_interface; -}; - -class wxMenuItemExt: public wxMenuItem -{ -public: - /* Constructor */ - wxMenuItemExt( wxMenu* parentMenu, int id, - const wxString& text, - const wxString& helpString, - wxItemKind kind, - char *_psz_var, int _i_object_id, vlc_value_t _val ): - wxMenuItem( parentMenu, id, text, helpString, kind ) - { - /* Initializations */ - psz_var = _psz_var; - i_object_id = _i_object_id; - val = _val; - }; - - virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); }; - - char *psz_var; - int i_object_id; - vlc_value_t val; - -private: - -}; diff --git a/modules/gui/skins/win32/win32_run.cpp b/modules/gui/skins/win32/win32_run.cpp index b6d4c1d84e..5e30a0b422 100644 --- a/modules/gui/skins/win32/win32_run.cpp +++ b/modules/gui/skins/win32/win32_run.cpp @@ -2,7 +2,7 @@ * win32_run.cpp: ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: win32_run.cpp,v 1.15 2003/05/05 12:15:25 gbazin Exp $ + * $Id: win32_run.cpp,v 1.16 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Olivier Teulière * Emmanuel Puig @@ -55,7 +55,7 @@ #include "../src/vlcproc.h" #ifndef BASIC_SKINS -#include "../src/wxdialogs.h" +#include "../../wxwindows/wxwindows.h" #include "share/vlc32x32.xpm" // include the graphic icon #endif diff --git a/modules/gui/skins/x11/x11_run.cpp b/modules/gui/skins/x11/x11_run.cpp index 26760a9bcf..2c1eaa4b31 100644 --- a/modules/gui/skins/x11/x11_run.cpp +++ b/modules/gui/skins/x11/x11_run.cpp @@ -2,7 +2,7 @@ * x11_run.cpp: ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: x11_run.cpp,v 1.1 2003/04/28 14:32:57 asmax Exp $ + * $Id: x11_run.cpp,v 1.2 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Cyril Deguet * @@ -44,7 +44,7 @@ #include "../os_theme.h" #include "../src/skin_common.h" #include "../src/vlcproc.h" -#include "../src/wxdialogs.h" +#include "../../wxwindows/wxwindows.h" // include the icon graphic #include "share/vlc32x32.xpm" diff --git a/modules/gui/wxwindows/fileinfo.cpp b/modules/gui/wxwindows/fileinfo.cpp index 1b85330e84..9679c44123 100644 --- a/modules/gui/wxwindows/fileinfo.cpp +++ b/modules/gui/wxwindows/fileinfo.cpp @@ -2,7 +2,7 @@ * fileinfo.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: fileinfo.cpp,v 1.13 2003/05/11 13:45:21 gbazin Exp $ + * $Id: fileinfo.cpp,v 1.14 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Sigmund Augdal * @@ -47,11 +47,9 @@ #if defined MODULE_NAME_IS_skins # include "../skins/src/skin_common.h" -# include "../skins/src/wxdialogs.h" -#else -# include "wxwindows.h" #endif +#include "wxwindows.h" /***************************************************************************** * Event Table. diff --git a/modules/gui/wxwindows/interface.cpp b/modules/gui/wxwindows/interface.cpp index 7fb68b7f9c..0476ac3cc5 100644 --- a/modules/gui/wxwindows/interface.cpp +++ b/modules/gui/wxwindows/interface.cpp @@ -2,7 +2,7 @@ * interface.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: interface.cpp,v 1.26 2003/05/11 15:55:51 gbazin Exp $ + * $Id: interface.cpp,v 1.27 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -404,9 +404,6 @@ void Interface::Open( int i_access_method ) TogglePlayButton( PLAYING_S ); - /* Rebuild the playlist */ - p_intf->p_sys->p_playlist_window->Rebuild(); - vlc_object_release( p_playlist ); } } @@ -524,10 +521,10 @@ void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) ) void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) ) { /* Show/hide the playlist window */ - wxFrame *p_playlist_window = p_intf->p_sys->p_playlist_window; + Playlist *p_playlist_window = p_intf->p_sys->p_playlist_window; if( p_playlist_window ) { - p_playlist_window->Show( ! p_playlist_window->IsShown() ); + p_playlist_window->ShowPlaylist( ! p_playlist_window->IsShown() ); } } @@ -777,9 +774,6 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord, playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); - /* Rebuild the playlist */ - p_intf->p_sys->p_playlist_window->Rebuild(); - vlc_object_release( p_playlist ); return TRUE; diff --git a/modules/gui/wxwindows/messages.cpp b/modules/gui/wxwindows/messages.cpp index 4ce2795335..4825e07e49 100644 --- a/modules/gui/wxwindows/messages.cpp +++ b/modules/gui/wxwindows/messages.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: messages.cpp,v 1.5 2003/05/11 13:22:23 gbazin Exp $ + * $Id: messages.cpp,v 1.6 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Olivier Teulière * @@ -47,11 +47,10 @@ #if defined MODULE_NAME_IS_skins # include "../skins/src/skin_common.h" -# include "../skins/src/wxdialogs.h" -#else -# include "wxwindows.h" #endif +#include "wxwindows.h" + /***************************************************************************** * Event Table. *****************************************************************************/ diff --git a/modules/gui/wxwindows/open.cpp b/modules/gui/wxwindows/open.cpp index 739502b8fa..217629fa5b 100644 --- a/modules/gui/wxwindows/open.cpp +++ b/modules/gui/wxwindows/open.cpp @@ -2,7 +2,7 @@ * open.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: open.cpp,v 1.18 2003/05/11 13:22:23 gbazin Exp $ + * $Id: open.cpp,v 1.19 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -51,11 +51,10 @@ #if defined MODULE_NAME_IS_skins # include "../skins/src/skin_common.h" -# include "../skins/src/wxdialogs.h" -#else -# include "wxwindows.h" #endif +#include "wxwindows.h" + #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 #endif @@ -139,14 +138,14 @@ END_EVENT_TABLE() /***************************************************************************** * Constructor. *****************************************************************************/ -OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface, +OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, int i_access_method ): - wxDialog( _p_main_interface, -1, wxU(_("Open Target")), wxDefaultPosition, + wxDialog( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ) { /* Initializations */ p_intf = _p_intf; - p_main_interface = _p_main_interface; + p_parent = _p_parent; SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ @@ -657,7 +656,7 @@ void OpenDialog::OnSoutEnable( wxCommandEvent& event ) void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) ) { /* Show/hide the open dialog */ - SoutDialog dialog( p_intf, p_main_interface ); + SoutDialog dialog( p_intf, p_parent ); if( dialog.ShowModal() == wxID_OK ) { diff --git a/modules/gui/wxwindows/playlist.cpp b/modules/gui/wxwindows/playlist.cpp index cb3954b867..51bcd32fbe 100644 --- a/modules/gui/wxwindows/playlist.cpp +++ b/modules/gui/wxwindows/playlist.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: playlist.cpp,v 1.8 2003/05/11 13:22:23 gbazin Exp $ + * $Id: playlist.cpp,v 1.9 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Olivier Teulière * @@ -47,6 +47,10 @@ #include "wxwindows.h" +/* Callback prototype */ +int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, + vlc_value_t old_val, vlc_value_t new_val, void *param ); + /***************************************************************************** * Event Table. *****************************************************************************/ @@ -55,9 +59,10 @@ enum { /* menu items */ - AddUrl_Event = 1, - AddDirectory_Event, + AddMRL_Event = 1, Close_Event, + Open_Event, + Save_Event, InvertSelection_Event, DeleteSelection_Event, @@ -69,9 +74,10 @@ enum BEGIN_EVENT_TABLE(Playlist, wxFrame) /* Menu events */ - EVT_MENU(AddUrl_Event, Playlist::OnAddUrl) - EVT_MENU(AddDirectory_Event, Playlist::OnAddDirectory) + EVT_MENU(AddMRL_Event, Playlist::OnAddMRL) EVT_MENU(Close_Event, Playlist::OnClose) + EVT_MENU(Open_Event, Playlist::OnOpen) + EVT_MENU(Save_Event, Playlist::OnSave) EVT_MENU(InvertSelection_Event, Playlist::OnInvertSelection) EVT_MENU(DeleteSelection_Event, Playlist::OnDeleteSelection) EVT_MENU(SelectAll_Event, Playlist::OnSelectAll) @@ -81,7 +87,8 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame) EVT_LIST_KEY_DOWN(ListView_Event, Playlist::OnKeyDown) /* Button events */ - EVT_BUTTON( wxID_OK, Playlist::OnClose) + EVT_BUTTON( Close_Event, Playlist::OnClose) + EVT_BUTTON( Save_Event, Playlist::OnSave) /* Special events : we don't want to destroy the window when the user * clicks on (X) */ @@ -93,17 +100,21 @@ END_EVENT_TABLE() *****************************************************************************/ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): wxFrame( _p_main_interface, -1, wxU(_("Playlist")), wxDefaultPosition, - wxSize::wxSize( 400, 500 ), wxDEFAULT_FRAME_STYLE ) + wxDefaultSize, wxDEFAULT_FRAME_STYLE ) { /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + i_update_counter = 0; + b_need_update = VLC_FALSE; + vlc_mutex_init( p_intf, &lock ); SetIcon( *p_intf->p_sys->p_icon ); /* Create our "Manage" menu */ wxMenu *manage_menu = new wxMenu; - manage_menu->Append( AddUrl_Event, wxU(_("Add &Url...")) ); - manage_menu->Append( AddDirectory_Event, wxU(_("Add &Directory...")) ); + manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) ); + manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) ); + manage_menu->Append( Save_Event, wxU(_("&Save Playlist...")) ); manage_menu->AppendSeparator(); manage_menu->Append( Close_Event, wxU(_("&Close")) ); @@ -131,25 +142,26 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): * themselves to the size of a listview, and with a wxDefaultSize the * playlist window is ridiculously small */ listview = new wxListView( playlist_panel, ListView_Event, - wxDefaultPosition, wxSize( 350, 300 ), + wxDefaultPosition, wxSize( 355, 300 ), wxLC_REPORT | wxSUNKEN_BORDER ); listview->InsertColumn( 0, wxU(_("Url")) ); listview->InsertColumn( 1, wxU(_("Duration")) ); listview->SetColumnWidth( 0, 250 ); listview->SetColumnWidth( 1, 100 ); - /* Create the OK button */ - ok_button = new wxButton( playlist_panel, wxID_OK, wxU(_("OK")) ); - ok_button->SetDefault(); + /* Create the Close button */ + wxButton *close_button = new wxButton( playlist_panel, Close_Event, + wxU(_("Close")) ); + close_button->SetDefault(); /* Place everything in sizers */ - wxBoxSizer *ok_button_sizer = new wxBoxSizer( wxHORIZONTAL ); - ok_button_sizer->Add( ok_button, 0, wxALL, 5 ); - ok_button_sizer->Layout(); + wxBoxSizer *close_button_sizer = new wxBoxSizer( wxHORIZONTAL ); + close_button_sizer->Add( close_button, 0, wxALL, 5 ); + close_button_sizer->Layout(); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); panel_sizer->Add( listview, 1, wxEXPAND | wxALL, 5 ); - panel_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE ); + panel_sizer->Add( close_button_sizer, 0, wxALIGN_CENTRE ); panel_sizer->Layout(); playlist_panel->SetSizerAndFit( panel_sizer ); main_sizer->Add( playlist_panel, 1, wxGROW, 0 ); @@ -161,13 +173,34 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): SetDropTarget( new DragAndDrop( p_intf ) ); #endif + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) + { + return; + } + + /* We want to be noticed of playlit changes */ + var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this ); + vlc_object_release( p_playlist ); + /* Update the playlist */ Rebuild(); - } Playlist::~Playlist() { + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) + { + return; + } + + var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this ); + vlc_object_release( p_playlist ); } void Playlist::Rebuild() @@ -203,9 +236,33 @@ void Playlist::Rebuild() vlc_object_release( p_playlist ); } -/* Update the colour of items */ -void Playlist::Manage() +void Playlist::ShowPlaylist( bool show ) { + if( show ) Rebuild(); + Show( show ); +} + +void Playlist::UpdatePlaylist() +{ + vlc_bool_t b_need_update = VLC_FALSE; + i_update_counter++; + + /* If the playlist isn't show there's no need to update it */ + if( !IsShown() ) return; + + vlc_mutex_lock( &lock ); + if( this->b_need_update ) + { + b_need_update = VLC_TRUE; + this->b_need_update = VLC_FALSE; + } + vlc_mutex_unlock( &lock ); + + if( b_need_update ) Rebuild(); + + /* Updating the playing status every 0.5s is enough */ + if( i_update_counter % 5 ) return; + playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); @@ -214,6 +271,7 @@ void Playlist::Manage() return; } + /* Update the colour of items */ vlc_mutex_lock( &p_playlist->object_lock ); if( p_intf->p_sys->i_playing != p_playlist->i_index ) { @@ -259,14 +317,70 @@ void Playlist::OnClose( wxCommandEvent& WXUNUSED(event) ) Hide(); } -void Playlist::OnAddUrl( wxCommandEvent& WXUNUSED(event) ) +void Playlist::OnSave( wxCommandEvent& WXUNUSED(event) ) { - /* TODO */ + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) + { + return; + } + + wxFileDialog dialog( this, wxU(_("Save playlist")), + wxT(""), wxT(""), wxT("*.*"), wxSAVE ); + + if( dialog.ShowModal() == wxID_OK ) + { + playlist_SaveFile( p_playlist, dialog.GetPath().mb_str() ); + } + + vlc_object_release( p_playlist ); } -void Playlist::OnAddDirectory( wxCommandEvent& WXUNUSED(event) ) +void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) ) { - /* TODO */ + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) + { + return; + } + + wxFileDialog dialog( this, wxU(_("Open playlist")), + wxT(""), wxT(""), wxT("*.*"), wxOPEN ); + + if( dialog.ShowModal() == wxID_OK ) + { + playlist_LoadFile( p_playlist, dialog.GetPath().mb_str() ); + } + + vlc_object_release( p_playlist ); +} + +void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) ) +{ + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) + { + return; + } + + /* Show/hide the open dialog */ + OpenDialog dialog( p_intf, this, FILE_ACCESS ); + + if( dialog.ShowModal() == wxID_OK ) + { + playlist_Add( p_playlist, (const char *)dialog.mrl.mb_str(), + PLAYLIST_APPEND, PLAYLIST_END ); + } + + vlc_object_release( p_playlist ); + + Rebuild(); } void Playlist::OnInvertSelection( wxCommandEvent& WXUNUSED(event) ) @@ -324,3 +438,18 @@ void Playlist::OnKeyDown( wxListEvent& event ) OnDeleteSelection( event ); } } + +/***************************************************************************** + * PlaylistChanged: callback triggered by the intf-change playlist variable + * We don't rebuild the playlist directly here because we don't want the + * caller to block for a too long time. + *****************************************************************************/ +int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, + vlc_value_t old_val, vlc_value_t new_val, void *param ) +{ + Playlist *p_playlist_dialog = (Playlist *)param; + vlc_mutex_lock( &p_playlist_dialog->lock ); + p_playlist_dialog->b_need_update = VLC_TRUE; + vlc_mutex_unlock( &p_playlist_dialog->lock ); + return VLC_SUCCESS; +} diff --git a/modules/gui/wxwindows/preferences.cpp b/modules/gui/wxwindows/preferences.cpp index 557710e44f..82240ac28d 100644 --- a/modules/gui/wxwindows/preferences.cpp +++ b/modules/gui/wxwindows/preferences.cpp @@ -2,7 +2,7 @@ * preferences.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: preferences.cpp,v 1.12 2003/05/11 13:22:23 gbazin Exp $ + * $Id: preferences.cpp,v 1.13 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -55,11 +55,9 @@ #if defined MODULE_NAME_IS_skins # include "../skins/src/skin_common.h" -# include "../skins/src/wxdialogs.h" -#else -# include "wxwindows.h" #endif +#include "wxwindows.h" #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 @@ -184,7 +182,7 @@ enum { Notebook_Event = wxID_HIGHEST, MRL_Event, - Reset_Event, + ResetAll_Event, Advanced_Event, }; @@ -193,6 +191,7 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxFrame) EVT_BUTTON(wxID_OK, PrefsDialog::OnOk) EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel) EVT_BUTTON(wxID_SAVE, PrefsDialog::OnSave) + EVT_BUTTON(ResetAll_Event, PrefsDialog::OnResetAll) /* Don't destroy the window when the user closes it */ EVT_CLOSE(PrefsDialog::OnCancel) @@ -251,14 +250,15 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface) wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, wxU(_("Cancel")) ); wxButton *save_button = new wxButton( panel, wxID_SAVE, wxU(_("Save")) ); - //wxButton *reset_button = new wxButton( panel, Reset_Event, _("Reset") ); + wxButton *reset_button = new wxButton( panel, ResetAll_Event, + wxU(_("Reset All")) ); /* Place everything in sizers */ wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); button_sizer->Add( ok_button, 0, wxALL, 5 ); button_sizer->Add( cancel_button, 0, wxALL, 5 ); button_sizer->Add( save_button, 0, wxALL, 5 ); - //button_sizer->Add( reset_button, 0, wxALL, 5 ); + button_sizer->Add( reset_button, 0, wxALL, 5 ); button_sizer->Layout(); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); @@ -305,6 +305,21 @@ void PrefsDialog::OnSave( wxCommandEvent& WXUNUSED(event) ) config_SaveConfigFile( p_intf, NULL ); } +void PrefsDialog::OnResetAll( wxCommandEvent& WXUNUSED(event) ) +{ + wxMessageDialog dlg( this, + wxU(_("Beware this will reset your VLC Media Player config file.\n" + "Are you sure you want to continue?")), + wxU(_("Reset config file")), wxYES_NO|wxNO_DEFAULT|wxCENTRE ); + + if ( dlg.ShowModal() == wxID_YES ) + { + /* TODO: need to reset all the controls */ + config_ResetAll( p_intf ); + config_SaveConfigFile( p_intf, NULL ); + } +} + /***************************************************************************** * PrefsTreeCtrl class definition. *****************************************************************************/ diff --git a/modules/gui/wxwindows/streamout.cpp b/modules/gui/wxwindows/streamout.cpp index 9f1c644aa2..64e18b9431 100644 --- a/modules/gui/wxwindows/streamout.cpp +++ b/modules/gui/wxwindows/streamout.cpp @@ -2,7 +2,7 @@ * streamout.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: streamout.cpp,v 1.8 2003/05/11 13:22:23 gbazin Exp $ + * $Id: streamout.cpp,v 1.9 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -51,11 +51,9 @@ #if defined MODULE_NAME_IS_skins # include "../skins/src/skin_common.h" -# include "../skins/src/wxdialogs.h" -#else -# include "wxwindows.h" #endif +#include "wxwindows.h" #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 @@ -131,13 +129,13 @@ END_EVENT_TABLE() /***************************************************************************** * Constructor. *****************************************************************************/ -SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ): - wxDialog( _p_main_interface, -1, wxU(_("Stream output")), +SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ): + wxDialog( _p_parent, -1, wxU(_("Stream output")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ) { /* Initializations */ p_intf = _p_intf; - p_main_interface = _p_main_interface; + p_parent = _p_parent; SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ diff --git a/modules/gui/wxwindows/timer.cpp b/modules/gui/wxwindows/timer.cpp index dc8427432c..c3839ed198 100644 --- a/modules/gui/wxwindows/timer.cpp +++ b/modules/gui/wxwindows/timer.cpp @@ -2,7 +2,7 @@ * timer.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: timer.cpp,v 1.16 2003/05/11 13:22:23 gbazin Exp $ + * $Id: timer.cpp,v 1.17 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -115,7 +115,7 @@ void Timer::Notify() p_intf->p_sys->p_messages_window->UpdateLog(); /* Update the playlist */ - p_intf->p_sys->p_playlist_window->Manage(); + p_intf->p_sys->p_playlist_window->UpdatePlaylist(); /* Update the fileinfo windows */ p_intf->p_sys->p_fileinfo_window->UpdateFileInfo(); diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index 496e5dbca8..857dfa0dc3 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -2,7 +2,7 @@ * wxwindows.h: private wxWindows interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxwindows.h,v 1.22 2003/05/11 13:22:23 gbazin Exp $ + * $Id: wxwindows.h,v 1.23 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -41,6 +41,7 @@ class FileInfo; # define wxU(ansi) ansi #endif +#if !defined(MODULE_NAME_IS_skins) /***************************************************************************** * intf_sys_t: description and status of wxwindows interface *****************************************************************************/ @@ -89,6 +90,7 @@ struct intf_sys_t /* The window labels for DVD mode */ unsigned int i_part; /* current chapter */ }; +#endif /* !defined(MODULE_NAME_IS_skins) */ /***************************************************************************** * Prototypes @@ -190,11 +192,9 @@ class OpenDialog: public wxDialog { public: /* Constructor */ - OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface, + OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, int i_access_method ); virtual ~OpenDialog(); - void Rebuild(); - void Manage(); wxString mrl; @@ -237,7 +237,7 @@ private: DECLARE_EVENT_TABLE(); intf_thread_t *p_intf; - Interface *p_main_interface; + wxWindow *p_parent; int i_current_access_method; wxComboBox *mrl_combo; @@ -282,7 +282,7 @@ class SoutDialog: public wxDialog { public: /* Constructor */ - SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface ); + SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent ); virtual ~SoutDialog(); wxString mrl; @@ -312,7 +312,7 @@ private: DECLARE_EVENT_TABLE(); intf_thread_t *p_intf; - Interface *p_main_interface; + wxWindow *p_parent; wxComboBox *mrl_combo; wxPanel *access_panel; @@ -350,6 +350,7 @@ private: void OnOk( wxCommandEvent& event ); void OnCancel( wxCommandEvent& event ); void OnSave( wxCommandEvent& event ); + void OnResetAll( wxCommandEvent& event ); DECLARE_EVENT_TABLE(); @@ -393,28 +394,34 @@ public: /* Constructor */ Playlist( intf_thread_t *p_intf, Interface *p_main_interface ); virtual ~Playlist(); - void Rebuild(); - void Manage(); + + void UpdatePlaylist(); + void ShowPlaylist( bool show ); + + bool b_need_update; + vlc_mutex_t lock; private: void DeleteItem( int item ); /* Event handlers (these functions should _not_ be virtual) */ - void OnAddUrl( wxCommandEvent& event ); - void OnAddDirectory( wxCommandEvent& event ); + void OnAddMRL( wxCommandEvent& event ); void OnClose( wxCommandEvent& event ); + void OnOpen( wxCommandEvent& event ); + void OnSave( wxCommandEvent& event ); void OnInvertSelection( wxCommandEvent& event ); void OnDeleteSelection( wxCommandEvent& event ); void OnSelectAll( wxCommandEvent& event ); void OnActivateItem( wxListEvent& event ); void OnKeyDown( wxListEvent& event ); + void Rebuild(); DECLARE_EVENT_TABLE(); intf_thread_t *p_intf; Interface *p_main_interface; wxListView *listview; - wxButton *ok_button; + int i_update_counter; }; /* File Info */ diff --git a/modules/video_output/directx/events.c b/modules/video_output/directx/events.c index d9654ebc9b..1558b23efd 100644 --- a/modules/video_output/directx/events.c +++ b/modules/video_output/directx/events.c @@ -2,7 +2,7 @@ * events.c: Windows DirectX video output events handler ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: events.c,v 1.13 2003/05/05 16:09:37 gbazin Exp $ + * $Id: events.c,v 1.14 2003/05/12 17:33:19 gbazin Exp $ * * Authors: Gildas Bazin * @@ -62,7 +62,7 @@ static long FAR PASCAL DirectXEventProc ( HWND hwnd, UINT message, void DirectXEventThread( event_thread_t *p_event ) { MSG msg; - POINT old_mouse_pos; + POINT old_mouse_pos = {0,0}; vlc_value_t val; int i_width, i_height, i_x, i_y; diff --git a/src/misc/configuration.c b/src/misc/configuration.c index ef9c3c7701..5233286e71 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -2,7 +2,7 @@ * configuration.c management of the modules configuration ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: configuration.c,v 1.55 2003/05/09 00:58:25 titer Exp $ + * $Id: configuration.c,v 1.56 2003/05/12 17:33:20 gbazin Exp $ * * Authors: Gildas Bazin * @@ -387,9 +387,11 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) p_module->p_config[i].i_type = p_orig[i].i_type; p_module->p_config[i].i_short = p_orig[i].i_short; p_module->p_config[i].i_value = p_orig[i].i_value; + p_module->p_config[i].i_value_orig = p_orig[i].i_value; p_module->p_config[i].i_min = p_orig[i].i_min; p_module->p_config[i].i_max = p_orig[i].i_max; p_module->p_config[i].f_value = p_orig[i].f_value; + p_module->p_config[i].f_value_orig = p_orig[i].f_value; p_module->p_config[i].f_min = p_orig[i].f_min; p_module->p_config[i].f_max = p_orig[i].f_max; p_module->p_config[i].b_dirty = p_orig[i].b_dirty; @@ -405,6 +407,8 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) strdup( _(p_orig[i].psz_longtext) ) : NULL; p_module->p_config[i].psz_value = p_orig[i].psz_value ? strdup( p_orig[i].psz_value ) : NULL; + p_module->p_config[i].psz_value_orig = p_orig[i].psz_value ? + strdup( p_orig[i].psz_value ) : NULL; p_module->p_config[i].p_lock = &p_module->object_lock; @@ -459,6 +463,9 @@ void config_Free( module_t *p_module ) if( p_item->psz_value ) free( p_item->psz_value ); + if( p_item->psz_value_orig ) + free( p_item->psz_value_orig ); + if( p_item->ppsz_list ) { for( i = 0; p_item->ppsz_list[i]; i++ ) @@ -502,6 +509,41 @@ void config_UnsetCallbacks( module_config_t *p_new ) } } +/***************************************************************************** + * config_ResetAll: reset the configuration data for all the modules. + *****************************************************************************/ +void __config_ResetAll( vlc_object_t *p_this ) +{ + int i_index, i; + vlc_list_t *p_list; + module_t *p_module; + + /* Acquire config file lock */ + vlc_mutex_lock( &p_this->p_vlc->config_lock ); + + p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); + + for( i_index = 0; i_index < p_list->i_count; i_index++ ) + { + p_module = (module_t *)p_list->p_values[i_index].p_object ; + if( p_module->b_submodule ) continue; + + for( i = 0; p_module->p_config[i].i_type != CONFIG_HINT_END; i++ ) + { + p_module->p_config[i].i_value = p_module->p_config[i].i_value_orig; + p_module->p_config[i].f_value = p_module->p_config[i].f_value_orig; + if( p_module->p_config[i].psz_value ) + free( p_module->p_config[i].psz_value ); + p_module->p_config[i].psz_value = + p_module->p_config[i].psz_value_orig ? + strdup( p_module->p_config[i].psz_value_orig ) : NULL; + } + } + + vlc_list_release( p_list ); + vlc_mutex_unlock( &p_this->p_vlc->config_lock ); +} + /***************************************************************************** * config_LoadConfigFile: loads the configuration file. ***************************************************************************** diff --git a/src/playlist/playlist.c b/src/playlist/playlist.c index 2aff1a9e26..207bd15df0 100644 --- a/src/playlist/playlist.c +++ b/src/playlist/playlist.c @@ -2,7 +2,7 @@ * playlist.c : Playlist management functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: playlist.c,v 1.34 2003/03/18 00:49:14 gbazin Exp $ + * $Id: playlist.c,v 1.35 2003/05/12 17:33:20 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -32,11 +32,6 @@ #include "vlc_playlist.h" #define PLAYLIST_FILE_HEADER_0_5 "# vlc playlist file version 0.5" -#ifdef WIN32 -# define PLAYLIST_FILE_EOL "\r\n" -#else -# define PLAYLIST_FILE_EOL "\n" -#endif /***************************************************************************** * Local prototypes @@ -747,12 +742,12 @@ int playlist_SaveFile( playlist_t * p_playlist, const char * psz_filename ) return -1; } - fprintf( file , PLAYLIST_FILE_HEADER_0_5 PLAYLIST_FILE_EOL ); + fprintf( file , PLAYLIST_FILE_HEADER_0_5 "\n" ); for ( i = 0 ; i < p_playlist->i_size ; i++ ) { fprintf( file , p_playlist->pp_items[i]->psz_uri ); - fprintf( file , PLAYLIST_FILE_EOL ); + fprintf( file , "\n" ); } fclose( file );