From: Clément Stenac Date: Wed, 2 Nov 2005 19:20:34 +0000 (+0000) Subject: p( vlc.getInterfaces().getInterface( "wxwidgets" ).isBroken() ) = 1/2 X-Git-Tag: 0.9.0-test0~13408 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=7e39490ef6e92153bb5761fd6edcf01a101cfc61;p=vlc p( vlc.getInterfaces().getInterface( "wxwidgets" ).isBroken() ) = 1/2 aka : merge the big wx changes from branch --- diff --git a/include/vlc_interface.h b/include/vlc_interface.h index 556c1719e0..1ca13920d0 100644 --- a/include/vlc_interface.h +++ b/include/vlc_interface.h @@ -158,6 +158,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); #define INTF_DIALOG_FILE_GENERIC 30 #define INTF_DIALOG_UPDATEVLC 90 +#define INTF_DIALOG_VLM 91 #define INTF_DIALOG_EXIT 99 diff --git a/modules/gui/wxwidgets/Modules.am b/modules/gui/wxwidgets/Modules.am index 7b4fb96c24..285f55db3b 100644 --- a/modules/gui/wxwidgets/Modules.am +++ b/modules/gui/wxwidgets/Modules.am @@ -1,27 +1,33 @@ SOURCES_wxwidgets = \ wxwidgets.cpp \ - wxwidgets.h \ - interface.cpp \ - extrapanel.cpp \ - dialogs.cpp \ - open.cpp \ - streamout.cpp \ - wizard.cpp \ streamdata.h \ streamdata.cpp \ - messages.cpp \ - playlist.cpp \ - iteminfo.cpp \ + interface.cpp \ + extrapanel.cpp \ menus.cpp \ - preferences.cpp \ - preferences_widgets.cpp \ - preferences_widgets.h \ timer.cpp \ - fileinfo.cpp \ - updatevlc.cpp \ - subtitles.cpp \ - bookmarks.cpp \ video.cpp \ + slider_manager.cpp \ + main_slider_manager.cpp \ + dialogs.cpp \ + dialogs/open.cpp \ + dialogs/streamout.cpp \ + dialogs/wizard.cpp \ + dialogs/messages.cpp \ + dialogs/playlist.cpp \ + dialogs/iteminfo.cpp \ + dialogs/preferences.cpp \ + dialogs/preferences_widgets.cpp \ + dialogs/preferences_widgets.h \ + dialogs/fileinfo.cpp \ + dialogs/updatevlc.cpp \ + dialogs/subtitles.cpp \ + dialogs/bookmarks.cpp \ + dialogs/vlm/vlm_slider_manager.cpp \ + dialogs/vlm/vlm_stream.cpp \ + dialogs/vlm/vlm_wrapper.cpp \ + dialogs/vlm/vlm_streampanel.cpp \ + dialogs/vlm/vlm_panel.cpp \ $(NULL) EXTRA_DIST += \ @@ -53,4 +59,9 @@ EXTRA_DIST += \ bitmaps/type_playlist.xpm \ bitmaps/type_unknown.xpm \ bitmaps/type_vfile.xpm \ - bitmaps/video.xpm + bitmaps/video.xpm \ + vlm/vlm_slider_manager.hpp \ + vlm/vlm_stream.hpp \ + vlm/vlm_wrapper.hpp \ + vlm/vlm_streampanel.hpp \ + vlm/vlm_panel.hpp diff --git a/modules/gui/wxwidgets/bitmaps/trash.xpm b/modules/gui/wxwidgets/bitmaps/trash.xpm new file mode 100644 index 0000000000..a5377024f5 --- /dev/null +++ b/modules/gui/wxwidgets/bitmaps/trash.xpm @@ -0,0 +1,107 @@ +/* XPM */ +static char * trash_xpm[] = { +"16 16 88 1", +" c None", +". c #2C2C2C", +"+ c #6E6E6E", +"@ c #555555", +"# c #161616", +"$ c #626154", +"% c #6B6A5A", +"& c #A1A095", +"* c #9B9B98", +"= c #A4A49D", +"- c #A5A495", +"; c #5C5C50", +"> c #575649", +", c #616057", +"' c #D0CEBA", +") c #CCCBBD", +"! c #85847F", +"~ c #4C4C48", +"{ c #3D3C34", +"] c #7E7C6B", +"^ c #B2B09E", +"/ c #B2B097", +"( c #4D4C41", +"_ c #616059", +": c #E0E0DB", +"< c #EBEBE4", +"[ c #D8D7CD", +"} c #CCCBBC", +"| c #C0BEA8", +"1 c #B8B69D", +"2 c #C5C4AF", +"3 c #AAA996", +"4 c #414037", +"5 c #4D4D42", +"6 c #AAA99B", +"7 c #D6D5CE", +"8 c #EAE9E5", +"9 c #E2E1DE", +"0 c #D8D8CF", +"a c #BCBBAE", +"b c #9C9A89", +"c c #737262", +"d c #34332D", +"e c #000000", +"f c #41413C", +"g c #888882", +"h c #B3B2A8", +"i c #BCBCAE", +"j c #A3A18A", +"k c #8F8D7A", +"l c #606056", +"m c #353530", +"n c #676758", +"o c #59594F", +"p c #52524D", +"q c #3D3D38", +"r c #2A2A23", +"s c #2E2E26", +"t c #35352C", +"u c #3D3D32", +"v c #707060", +"w c #919184", +"x c #A0A098", +"y c #707066", +"z c #646458", +"A c #606051", +"B c #4D4D40", +"C c #4E4E40", +"D c #959587", +"E c #B9B9AC", +"F c #8E8E80", +"G c #787868", +"H c #7A7A67", +"I c #565648", +"J c #6E6E5D", +"K c #939385", +"L c #545445", +"M c #46463C", +"N c #868678", +"O c #B2B2A5", +"P c #8F8F82", +"Q c #787865", +"R c #515143", +"S c #39392F", +"T c #2F2F29", +"U c #30302A", +"V c #2C2C25", +"W c #272720", +" ", +" ", +" .+@# ", +" $%&*=-;> ", +" ,')!~{]^/( ", +" _:<[}|1234 ", +" 567890abcd ", +" efghijklme ", +" enopqrstue ", +" evwxyzABCe ", +" evDEFGHIIe ", +" eJKEFGHILe ", +" eMNOPGQRSe ", +" eTUVWe ", +" ", +" "}; diff --git a/modules/gui/wxwidgets/dialogs.cpp b/modules/gui/wxwidgets/dialogs.cpp index 23e9c1b74e..e9c602d14b 100644 --- a/modules/gui/wxwidgets/dialogs.cpp +++ b/modules/gui/wxwidgets/dialogs.cpp @@ -32,9 +32,20 @@ #include #include #include + #include "charset.h" -#include "wxwidgets.h" +#include "dialogs/vlm/vlm_panel.hpp" +#include "dialogs/bookmarks.hpp" +#include "dialogs/wizard.hpp" +#include "dialogs/playlist.hpp" +#include "dialogs/open.hpp" +#include "dialogs/updatevlc.hpp" +#include "dialogs/fileinfo.hpp" +#include "dialogs/iteminfo.hpp" +#include "dialogs/preferences.hpp" +#include "dialogs/messages.hpp" +#include "interface.hpp" /* include the icon graphic */ #include "../../../share/vlc32x32.xpm" @@ -52,6 +63,7 @@ private: /* Event handlers (these functions should _not_ be virtual) */ void OnUpdateVLC( wxCommandEvent& event ); + void OnVLM( wxCommandEvent& event ); void OnExit( wxCommandEvent& event ); void OnPlaylist( wxCommandEvent& event ); void OnMessages( wxCommandEvent& event ); @@ -92,6 +104,7 @@ public: wxFrame *p_bookmarks_dialog; wxFileDialog *p_file_generic_dialog; UpdateVLC *p_updatevlc_dialog; + VLMFrame *p_vlm_dialog; }; DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG ); @@ -131,6 +144,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) DialogsProvider::OnExitThread) EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG, DialogsProvider::OnUpdateVLC) + EVT_COMMAND(INTF_DIALOG_VLM, wxEVT_DIALOG, + DialogsProvider::OnVLM) END_EVENT_TABLE() wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent ) @@ -157,6 +172,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) p_bookmarks_dialog = NULL; p_dir_dialog = NULL; p_updatevlc_dialog = NULL; + p_vlm_dialog = NULL; /* Give our interface a nice little icon */ p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); @@ -191,7 +207,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) INIT( ID_PLAYLIST, p_playlist_dialog, new Playlist(p_intf,this), ShowPlaylist ); INIT( ID_MESSAGES, p_messages_dialog, new Messages(p_intf,this), Show ); INIT( ID_FILE_INFO, p_fileinfo_dialog, new FileInfo(p_intf,this), Show ); - INIT( ID_BOOKMARKS, p_bookmarks_dialog, BookmarksDialog(p_intf,this), Show); + INIT( ID_BOOKMARKS, p_bookmarks_dialog, new BookmarksDialog(p_intf,this), Show); #undef INIT } @@ -215,7 +231,7 @@ DialogsProvider::~DialogsProvider() #undef UPDATE - PopEventHandler(true); + PopEventHandler(true); /* Clean up */ if( p_open_dialog ) delete p_open_dialog; @@ -228,6 +244,7 @@ DialogsProvider::~DialogsProvider() if( p_wizard_dialog ) delete p_wizard_dialog; if( p_bookmarks_dialog ) delete p_bookmarks_dialog; if( p_updatevlc_dialog ) delete p_updatevlc_dialog; + if( p_vlm_dialog ) delete p_vlm_dialog; if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon; @@ -319,7 +336,7 @@ void DialogsProvider::OnBookmarks( wxCommandEvent& WXUNUSED(event) ) { /* Show/hide the open dialog */ if( !p_bookmarks_dialog ) - p_bookmarks_dialog = BookmarksDialog( p_intf, this ); + p_bookmarks_dialog = new BookmarksDialog( p_intf, this ); if( p_bookmarks_dialog ) { @@ -502,3 +519,15 @@ void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) ) p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() ); } } + +void DialogsProvider::OnVLM( wxCommandEvent& WXUNUSED(event) ) +{ + /* Show/hide the file info window */ + if( !p_vlm_dialog ) + p_vlm_dialog = new VLMFrame( p_intf, this ); + + if( p_vlm_dialog ) + { + p_vlm_dialog->Show( !p_vlm_dialog->IsShown() ); + } +} diff --git a/modules/gui/wxwidgets/bookmarks.cpp b/modules/gui/wxwidgets/dialogs/bookmarks.cpp similarity index 89% rename from modules/gui/wxwidgets/bookmarks.cpp rename to modules/gui/wxwidgets/dialogs/bookmarks.cpp index 721bc4b042..8e91d3e986 100644 --- a/modules/gui/wxwidgets/bookmarks.cpp +++ b/modules/gui/wxwidgets/dialogs/bookmarks.cpp @@ -24,23 +24,16 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include +#include "dialogs/bookmarks.hpp" -#include -#include - -#include "wxwidgets.h" -#include +#include "wizard.hpp" /* Callback prototype */ static int PlaylistChanged( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ); /***************************************************************************** - * Class declaration. + * Event Table. *****************************************************************************/ /* IDs for the controls and the menu commands */ @@ -54,41 +47,6 @@ enum ButtonEdit_Event }; -class BookmarksDialog: public wxFrame -{ -public: - /* Constructor */ - BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~BookmarksDialog(); - - bool Show( bool ); - -private: - - void Update(); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnClose( wxCloseEvent& event ); - void OnAdd( wxCommandEvent& event ); - void OnDel( wxCommandEvent& event ); - void OnClear( wxCommandEvent& event ); - void OnActivateItem( wxListEvent& event ); - void OnUpdate( wxCommandEvent &event ); - void OnEdit( wxCommandEvent& event ); - void OnExtract( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxWindow *p_parent; - - wxListView *list_ctrl; -}; - -/***************************************************************************** - * Event Table. - *****************************************************************************/ - DEFINE_LOCAL_EVENT_TYPE( wxEVT_BOOKMARKS ); BEGIN_EVENT_TABLE(BookmarksDialog, wxFrame) @@ -105,30 +63,10 @@ BEGIN_EVENT_TABLE(BookmarksDialog, wxFrame) EVT_COMMAND( -1, wxEVT_BOOKMARKS, BookmarksDialog::OnUpdate ) END_EVENT_TABLE() -/* Declaration of class BookmarkEditDialog */ -class BookmarkEditDialog : public wxDialog -{ -public: - /* Constructor */ - BookmarkEditDialog( intf_thread_t *p_intf, wxWindow *p_parent, - seekpoint_t *p_seekpoint ); - virtual ~BookmarkEditDialog(); - seekpoint_t *p_seekpoint; -private: - - wxTextCtrl *name_text, *time_text, *bytes_text; - - void OnOK( wxCommandEvent& event); - void OnCancel( wxCommandEvent& event); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; -}; - BEGIN_EVENT_TABLE( BookmarkEditDialog, wxDialog) - EVT_BUTTON( wxID_OK, BookmarkEditDialog::OnOK) + EVT_BUTTON( wxID_OK, BookmarkEditDialog::OnOK) END_EVENT_TABLE() + /**************************************************************************** * BookmarkEditDialog ***************************************************************************/ @@ -294,10 +232,10 @@ BookmarksDialog::~BookmarksDialog() /***************************************************************************** * Private methods. *****************************************************************************/ -wxFrame *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ) -{ - return new class BookmarksDialog( p_intf, p_parent ); -} +//wxFrame *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ) +//{ +// return new class BookmarksDialog( p_intf, p_parent ); +//} void BookmarksDialog::Update() { diff --git a/modules/gui/wxwidgets/dialogs/bookmarks.hpp b/modules/gui/wxwidgets/dialogs/bookmarks.hpp new file mode 100644 index 0000000000..e65820b4b0 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/bookmarks.hpp @@ -0,0 +1,81 @@ +/***************************************************************************** + * bookmarks.hpp: Headers for the bookmarks window + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_BOOKMARKS_H_ +#define _WXVLC_BOOKMARKS_H_ + +#include "wxwidgets.hpp" + +namespace wxvlc +{ + class BookmarksDialog: public wxFrame + { + public: + /* Constructor */ + BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~BookmarksDialog(); + + bool Show( bool ); + + private: + void Update(); + + /* Event handlers (these functions should _not_ be virtual) */ + void OnClose( wxCloseEvent& event ); + void OnAdd( wxCommandEvent& event ); + void OnDel( wxCommandEvent& event ); + void OnClear( wxCommandEvent& event ); + void OnActivateItem( wxListEvent& event ); + void OnUpdate( wxCommandEvent &event ); + void OnEdit( wxCommandEvent& event ); + void OnExtract( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxWindow *p_parent; + + wxListView *list_ctrl; + }; + + class BookmarkEditDialog : public wxDialog + { + public: + /* Constructor */ + BookmarkEditDialog( intf_thread_t *p_intf, wxWindow *p_parent, + seekpoint_t *p_seekpoint ); + virtual ~BookmarkEditDialog(); + seekpoint_t *p_seekpoint; + private: + wxTextCtrl *name_text, *time_text, *bytes_text; + + void OnOK( wxCommandEvent& event); + void OnCancel( wxCommandEvent& event); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/fileinfo.cpp b/modules/gui/wxwidgets/dialogs/fileinfo.cpp similarity index 96% rename from modules/gui/wxwidgets/fileinfo.cpp rename to modules/gui/wxwidgets/dialogs/fileinfo.cpp index bd33825acc..dca9de9b9d 100644 --- a/modules/gui/wxwidgets/fileinfo.cpp +++ b/modules/gui/wxwidgets/dialogs/fileinfo.cpp @@ -21,13 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include "wxwidgets.h" +#include "dialogs/fileinfo.hpp" /***************************************************************************** * Event Table. diff --git a/modules/gui/wxwidgets/dialogs/fileinfo.hpp b/modules/gui/wxwidgets/dialogs/fileinfo.hpp new file mode 100644 index 0000000000..8f6feb115c --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/fileinfo.hpp @@ -0,0 +1,56 @@ +/***************************************************************************** + * fileinfo.hpp: private wxWindows interface description + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_FILEINFO_H_ +#define _WXVLC_FILEINFO_H_ + +#include "wxwidgets.hpp" + +#include + +namespace wxvlc +{ + class FileInfo: public wxFrame + { + public: + /* Constructor */ + FileInfo( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~FileInfo(); + void UpdateFileInfo(); + + vlc_bool_t b_need_update; + + private: + void OnButtonClose( wxCommandEvent& event ); + void OnClose( wxCloseEvent& WXUNUSED(event) ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxTreeCtrl *fileinfo_tree; + wxTreeItemId fileinfo_root; + wxString fileinfo_root_label; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/iteminfo.cpp b/modules/gui/wxwidgets/dialogs/iteminfo.cpp similarity index 93% rename from modules/gui/wxwidgets/iteminfo.cpp rename to modules/gui/wxwidgets/dialogs/iteminfo.cpp index 981764ddca..3e410eb71d 100644 --- a/modules/gui/wxwidgets/iteminfo.cpp +++ b/modules/gui/wxwidgets/dialogs/iteminfo.cpp @@ -21,23 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include - +#include "dialogs/iteminfo.hpp" #include #include -#include - -#include "wxwidgets.h" - #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 #endif diff --git a/modules/gui/wxwidgets/dialogs/iteminfo.hpp b/modules/gui/wxwidgets/dialogs/iteminfo.hpp new file mode 100644 index 0000000000..ca453a1309 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/iteminfo.hpp @@ -0,0 +1,75 @@ +/***************************************************************************** + * iteminfo.hpp: private wxWindows interface description + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_ITEMINFO_H_ +#define _WXVLC_ITEMINFO_H_ + +#include "wxwidgets.hpp" + +#include + +namespace wxvlc +{ +class ItemInfoDialog: public wxDialog +{ +public: + /* Constructor */ + ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item, + wxWindow *p_parent ); + virtual ~ItemInfoDialog(); + + wxArrayString GetOptions(); + +private: + wxPanel *InfoPanel( wxWindow* parent ); + wxPanel *GroupPanel( wxWindow* parent ); + + /* Event handlers (these functions should _not_ be virtual) */ + void OnOk( wxCommandEvent& event ); + void OnCancel( wxCommandEvent& event ); + + void UpdateInfo(); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + playlist_item_t *p_item; + wxWindow *p_parent; + + /* Controls for the iteminfo dialog box */ + wxPanel *info_subpanel; + wxPanel *info_panel; + + wxPanel *group_subpanel; + wxPanel *group_panel; + + wxTextCtrl *uri_text; + wxTextCtrl *name_text; + + wxTreeCtrl *info_tree; + wxTreeItemId info_root; + +}; + +}; +#endif diff --git a/modules/gui/wxwidgets/messages.cpp b/modules/gui/wxwidgets/dialogs/messages.cpp similarity index 93% rename from modules/gui/wxwidgets/messages.cpp rename to modules/gui/wxwidgets/dialogs/messages.cpp index eb935973ab..5b0b12b05a 100644 --- a/modules/gui/wxwidgets/messages.cpp +++ b/modules/gui/wxwidgets/dialogs/messages.cpp @@ -21,18 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include - -#include "wxwidgets.h" +#include "dialogs/messages.hpp" /***************************************************************************** * Event Table. @@ -143,6 +132,7 @@ void Messages::UpdateLog() int i_stop = *p_sub->pi_stop; vlc_mutex_unlock( p_sub->p_lock ); + if( p_sub->i_start != i_stop ) { textctrl->SetInsertionPointEnd(); diff --git a/modules/gui/wxwidgets/dialogs/messages.hpp b/modules/gui/wxwidgets/dialogs/messages.hpp new file mode 100644 index 0000000000..7aa0be7f4a --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/messages.hpp @@ -0,0 +1,62 @@ +/***************************************************************************** + * messages.hpp: Messages dialog + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_MESSAGES_H_ +#define _WXVLC_MESSAGES_H_ + +#include "wxwidgets.hpp" + +namespace wxvlc +{ + class Messages: public wxFrame + { + public: + /* Constructor */ + Messages( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~Messages(); + bool Show( bool show = TRUE ); + void UpdateLog(); + + private: + /* Event handlers (these functions should _not_ be virtual) */ + void OnButtonClose( wxCommandEvent& event ); + void OnClose( wxCloseEvent& WXUNUSED(event) ); + void OnClear( wxCommandEvent& event ); + void OnSaveLog( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxTextCtrl *textctrl; + wxTextAttr *info_attr; + wxTextAttr *err_attr; + wxTextAttr *warn_attr; + wxTextAttr *dbg_attr; + + wxFileDialog *save_log_dialog; + + vlc_bool_t b_verbose; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/open.cpp b/modules/gui/wxwidgets/dialogs/open.cpp similarity index 99% rename from modules/gui/wxwidgets/open.cpp rename to modules/gui/wxwidgets/dialogs/open.cpp index 42adea124e..6a75bba7a2 100644 --- a/modules/gui/wxwidgets/open.cpp +++ b/modules/gui/wxwidgets/dialogs/open.cpp @@ -1,5 +1,5 @@ /***************************************************************************** - * open.cpp : wxWindows plugin for vlc + * open.cpp : Open dialog box ***************************************************************************** * Copyright (C) 2000-2005 the VideoLAN team * $Id$ @@ -24,13 +24,11 @@ /***************************************************************************** * Preamble *****************************************************************************/ +#include "dialogs/open.hpp" +#include "dialogs/streamout.hpp" +#include "dialogs/preferences_widgets.h" +#include "dialogs/subtitles.hpp" -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include #include "charset.h" #ifdef HAVE_LIBCDIO @@ -51,12 +49,8 @@ #include #include -#include - #include -#include "wxwidgets.h" -#include "preferences_widgets.h" #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 @@ -1332,9 +1326,10 @@ static bool IsDVD(const char *psz_drive) */ static char * ProbeDVD(const wxChar *device) { + /* char **ppsz_cd_drives; const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device); - char *psz_device = const_cast(tmp_buf.data()); + char *psz_device = (char *) tmp_buf; if( IsDVD(psz_device) ) { @@ -1355,7 +1350,7 @@ static char * ProbeDVD(const wxChar *device) } } cdio_free_device_list(ppsz_cd_drives); - } + }*/ return NULL; } @@ -1402,27 +1397,30 @@ static char * ProbeDevice(char **ppsz_search_devices, cdio_fs_anal_t mask, */ static char * ProbeCDDA(const wxChar *device) { + /* char *ppsz_device[2]; const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device); - char *psz_device = const_cast(tmp_buf.data()); + char *psz_device = (char *) tmp_buf; ppsz_device[0] = (device && *device) ? psz_device : NULL; ppsz_device[1] = NULL; return ProbeDevice(ppsz_device, CDIO_FS_AUDIO, false); + */ return NULL; } /* Return a device that has a VCD in it. The caller needs to free the returned string. */ static char * ProbeVCD(const wxChar *device) -{ +{/* char *ppsz_device[2]; const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device); - char *psz_device = const_cast(tmp_buf.data()); + char *psz_device = (char *) tmp_buf; ppsz_device[0] = (device && *device) ? psz_device : NULL; ppsz_device[1] = NULL; return ProbeDevice(ppsz_device, (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD |CDIO_FS_UNKNOWN), true); + */ return NULL; } diff --git a/modules/gui/wxwidgets/dialogs/open.hpp b/modules/gui/wxwidgets/dialogs/open.hpp new file mode 100644 index 0000000000..14b02e6f60 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/open.hpp @@ -0,0 +1,184 @@ +/***************************************************************************** + * open.hpp: Headers for the Open dialog + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_OPEN_H_ +#define _WXVLC_OPEN_H_ + +#include "wxwidgets.hpp" + +#include + +class AutoBuiltPanel; +namespace wxvlc +{ + class SubsFileDialog; + class SoutDialog; + WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel); + + class OpenDialog: public wxDialog + { + +public: + /* Constructor */ + OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, + int i_access_method, int i_arg = 0 ); + + /* Extended Contructor */ + OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, + int i_access_method, int i_arg = 0 , int _i_method = 0 ); + virtual ~OpenDialog(); + + int Show(); + int Show( int i_access_method, int i_arg = 0 ); + + void UpdateMRL(); + void UpdateMRL( int i_access_method ); + + wxArrayString mrl; + +private: + wxPanel *FilePanel( wxWindow* parent ); + wxPanel *DiscPanel( wxWindow* parent ); + wxPanel *NetPanel( wxWindow* parent ); + + ArrayOfAutoBuiltPanel input_tab_array; + + /* 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 ); + + /* Event handlers for the file page */ + void OnFilePanelChange( wxCommandEvent& event ); + void OnFileBrowse( wxCommandEvent& event ); + + /* Event handlers for the disc page */ + void OnDiscPanelChangeSpin( wxSpinEvent& event ); + void OnDiscPanelChange( wxCommandEvent& event ); + void OnDiscTypeChange( wxCommandEvent& event ); +#ifdef HAVE_LIBCDIO + void OnDiscProbe( wxCommandEvent& event ); +#endif + void OnDiscDeviceChange( wxCommandEvent& event ); + + /* Event handlers for the net page */ + void OnNetPanelChangeSpin( wxSpinEvent& event ); + void OnNetPanelChange( wxCommandEvent& event ); + void OnNetTypeChange( wxCommandEvent& event ); + + /* Event handlers for the stream output */ + void OnSubsFileEnable( wxCommandEvent& event ); + void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ); + + /* Event handlers for the stream output */ + void OnSoutEnable( wxCommandEvent& event ); + void OnSoutSettings( wxCommandEvent& WXUNUSED(event) ); + + /* Event handlers for the caching option */ + void OnCachingEnable( wxCommandEvent& event ); + void OnCachingChange( wxCommandEvent& event ); + void OnCachingChangeSpin( wxSpinEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxWindow *p_parent; + int i_current_access_method; + int i_disc_type_selection; + + int i_method; /* Normal or for the stream dialog ? */ + int i_open_arg; + + wxComboBox *mrl_combo; + wxNotebook *notebook; + + /* Controls for the file panel */ + wxComboBox *file_combo; + wxFileDialog *file_dialog; + + /* Controls for the disc panel */ + wxRadioBox *disc_type; + wxCheckBox *disc_probe; + wxTextCtrl *disc_device; + wxSpinCtrl *disc_title; int i_disc_title; + wxSpinCtrl *disc_chapter; int i_disc_chapter; + wxSpinCtrl *disc_sub; int i_disc_sub; + wxSpinCtrl *disc_audio; int i_disc_audio; + + /* The media equivalent name for a DVD names. For example, + * "Title", is "Track" for a CD-DA */ + wxStaticText *disc_title_label; + wxStaticText *disc_chapter_label; + wxStaticText *disc_sub_label; + wxStaticText *disc_audio_label; + + /* Indicates if the disc device control was modified */ + bool b_disc_device_changed; + + /* Controls for the net panel */ + wxRadioBox *net_type; + int i_net_type; + wxPanel *net_subpanels[4]; + wxRadioButton *net_radios[4]; + wxSpinCtrl *net_ports[4]; + int i_net_ports[4]; + wxTextCtrl *net_addrs[4]; + wxCheckBox *net_timeshift; + wxCheckBox *net_ipv6; + + /* Controls for the subtitles file */ + wxButton *subsfile_button; + wxCheckBox *subsfile_checkbox; + SubsFileDialog *subsfile_dialog; + wxArrayString subsfile_mrl; + + /* Controls for the stream output */ + wxButton *sout_button; + wxCheckBox *sout_checkbox; + SoutDialog *sout_dialog; + wxArrayString sout_mrl; + + /* Controls for the caching options */ + wxCheckBox *caching_checkbox; + wxSpinCtrl *caching_value; + int i_caching; +}; + +}; + +enum +{ + FILE_ACCESS = 0, + DISC_ACCESS, + NET_ACCESS, + + /* Auto-built panels */ + CAPTURE_ACCESS +}; +#define MAX_ACCESS CAPTURE_ACCESS + + +#endif diff --git a/modules/gui/wxwidgets/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp similarity index 99% rename from modules/gui/wxwidgets/playlist.cpp rename to modules/gui/wxwidgets/dialogs/playlist.cpp index e6256c0bcf..c0bc2521f0 100644 --- a/modules/gui/wxwidgets/playlist.cpp +++ b/modules/gui/wxwidgets/dialogs/playlist.cpp @@ -25,10 +25,9 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include -#include - -#include "wxwidgets.h" +#include "dialogs/playlist.hpp" +#include "dialogs/iteminfo.hpp" +#include "interface.hpp" // Needed for D&D - TODO: Split #include "bitmaps/shuffle.xpm" #include "bitmaps/repeat.xpm" diff --git a/modules/gui/wxwidgets/dialogs/playlist.hpp b/modules/gui/wxwidgets/dialogs/playlist.hpp new file mode 100644 index 0000000000..81a6555385 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/playlist.hpp @@ -0,0 +1,176 @@ +/***************************************************************************** + * playlist.hpp: Header for the playlist + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_PLAYLIST_H_ +#define _WXVLC_PLAYLIST_H_ + +#include "wxwidgets.hpp" + +#include + +#define MODE_NONE 0 +#define MODE_GROUP 1 +#define MODE_AUTHOR 2 +#define MODE_TITLE 3 + +#define OPEN_NORMAL 0 +#define OPEN_STREAM 1 + +namespace wxvlc +{ +class ItemInfoDialog; +class NewGroup; +class ExportPlaylist; + +/* Playlist */ +class Playlist: public wxFrame +{ +public: + /* Constructor */ + Playlist( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~Playlist(); + + void UpdatePlaylist(); + void ShowPlaylist( bool show ); + void UpdateItem( int ); + void AppendItem( wxCommandEvent& ); + + bool b_need_update; + int i_items_to_append; + +private: + void RemoveItem( int ); + void DeleteTreeItem( wxTreeItemId ); + void DeleteItem( int item ); + void DeleteNode( playlist_item_t *node ); + + void RecursiveDeleteSelection( wxTreeItemId ); + + /* Event handlers (these functions should _not_ be virtual) */ + + /* Menu Handlers */ + void OnAddFile( wxCommandEvent& event ); + void OnAddDir( wxCommandEvent& event ); + void OnAddMRL( wxCommandEvent& event ); + void OnMenuClose( wxCommandEvent& event ); + void OnClose( wxCloseEvent& WXUNUSED(event) ); + + void OnDeleteSelection( wxCommandEvent& event ); + + void OnOpen( wxCommandEvent& event ); + void OnSave( wxCommandEvent& event ); + + /* Search (user) */ + void OnSearch( wxCommandEvent& event ); + /*void OnSearchTextChange( wxCommandEvent& event );*/ + wxTextCtrl *search_text; + wxButton *search_button; + wxTreeItemId search_current; + + void OnEnDis( wxCommandEvent& event ); + + /* Sort */ + int i_sort_mode; + void OnSort( wxCommandEvent& event ); + int i_title_sorted; + int i_group_sorted; + int i_duration_sorted; + + /* Dynamic menus */ + void OnMenuEvent( wxCommandEvent& event ); + void OnMenuOpen( wxMenuEvent& event ); + wxMenu *p_view_menu; + wxMenu *p_sd_menu; + wxMenu *ViewMenu(); + wxMenu *SDMenu(); + + void OnUp( wxCommandEvent& event); + void OnDown( wxCommandEvent& event); + + void OnRandom( wxCommandEvent& event ); + void OnRepeat( wxCommandEvent& event ); + void OnLoop ( wxCommandEvent& event ); + + void OnActivateItem( wxTreeEvent& event ); + void OnKeyDown( wxTreeEvent& event ); + void OnNewGroup( wxCommandEvent& event ); + + /* Popup */ + wxMenu *item_popup; + wxMenu *node_popup; + wxTreeItemId i_wx_popup_item; + int i_popup_item; + int i_popup_parent; + void OnPopup( wxContextMenuEvent& event ); + void OnPopupPlay( wxCommandEvent& event ); + void OnPopupPreparse( wxCommandEvent& event ); + void OnPopupSort( wxCommandEvent& event ); + void OnPopupDel( wxCommandEvent& event ); + void OnPopupEna( wxCommandEvent& event ); + void OnPopupInfo( wxCommandEvent& event ); + void Rebuild( vlc_bool_t ); + + void Preparse(); + + /* Update */ + void UpdateNode( playlist_item_t*, wxTreeItemId ); + void UpdateNodeChildren( playlist_item_t*, wxTreeItemId ); + void CreateNode( playlist_item_t*, wxTreeItemId ); + void UpdateTreeItem( wxTreeItemId ); + + /* Search (internal) */ + int CountItems( wxTreeItemId); + wxTreeItemId FindItem( wxTreeItemId, int ); + wxTreeItemId FindItemByName( wxTreeItemId, wxString, + wxTreeItemId, vlc_bool_t *); + + wxTreeItemId saved_tree_item; + int i_saved_id; + + playlist_t *p_playlist; + + + /* Custom events */ + void OnPlaylistEvent( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + + /* Global widgets */ + wxStatusBar *statusbar; + ItemInfoDialog *iteminfo_dialog; + + int i_update_counter; + + intf_thread_t *p_intf; + wxTreeCtrl *treectrl; + int i_current_view; + vlc_bool_t b_changed_view; + char **pp_sds; + + +}; + +} // end of wxvlc namespace + +#endif diff --git a/modules/gui/wxwidgets/preferences.cpp b/modules/gui/wxwidgets/dialogs/preferences.cpp similarity index 98% rename from modules/gui/wxwidgets/preferences.cpp rename to modules/gui/wxwidgets/dialogs/preferences.cpp index 05a9a241c1..e723eeddac 100644 --- a/modules/gui/wxwidgets/preferences.cpp +++ b/modules/gui/wxwidgets/dialogs/preferences.cpp @@ -24,24 +24,17 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include +#include "dialogs/preferences.hpp" #include - -#include "wxwidgets.h" -#include "preferences_widgets.h" +#include "dialogs/preferences_widgets.h" #include #include #include #include #include +#include #include "bitmaps/type_net.xpm" #include "bitmaps/codec.xpm" @@ -1082,7 +1075,7 @@ void PrefsPanel::SwitchAdvanced( vlc_bool_t b_new_advanced ) { bool hidden = false; - if( b_advanced == b_new_advanced ) + if( b_advanced == b_new_advanced ) { goto hide; } diff --git a/modules/gui/wxwidgets/dialogs/preferences.hpp b/modules/gui/wxwidgets/dialogs/preferences.hpp new file mode 100644 index 0000000000..a7f6a156b0 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/preferences.hpp @@ -0,0 +1,66 @@ +/***************************************************************************** + * preferences.hpp : Headers for the preference dialog + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_PREFERENCES_H_ +#define _WXVLC_PREFERENCES_H_ + +#include "wxwidgets.hpp" + +class PrefsTreeCtrl; +class PrefsPanel; + +namespace wxvlc +{ + /** This class is the preferences window + * It includes a preferences panel (right part) + * and the PrefsTreeCtrl (left part) + */ + class PrefsDialog: public wxFrame + { + public: + /** Constructor */ + PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent ); + 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 ); + void OnResetAll( wxCommandEvent& event ); + void OnAdvanced( wxCommandEvent& event ); + void OnClose( wxCloseEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + + PrefsTreeCtrl *prefs_tree; + }; + +}; + +#endif + diff --git a/modules/gui/wxwidgets/preferences_widgets.cpp b/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp similarity index 98% rename from modules/gui/wxwidgets/preferences_widgets.cpp rename to modules/gui/wxwidgets/dialogs/preferences_widgets.cpp index 629c51ba17..aea63522c7 100644 --- a/modules/gui/wxwidgets/preferences_widgets.cpp +++ b/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp @@ -22,23 +22,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include - -#include - -#include "wxwidgets.h" +#include "wxwidgets.hpp" #include "preferences_widgets.h" +#include +#include #include +#include /***************************************************************************** * CreateConfigControl wrapper diff --git a/modules/gui/wxwidgets/preferences_widgets.h b/modules/gui/wxwidgets/dialogs/preferences_widgets.h similarity index 100% rename from modules/gui/wxwidgets/preferences_widgets.h rename to modules/gui/wxwidgets/dialogs/preferences_widgets.h diff --git a/modules/gui/wxwidgets/streamout.cpp b/modules/gui/wxwidgets/dialogs/streamout.cpp similarity index 99% rename from modules/gui/wxwidgets/streamout.cpp rename to modules/gui/wxwidgets/dialogs/streamout.cpp index 3f8168e588..891875d9bd 100644 --- a/modules/gui/wxwidgets/streamout.cpp +++ b/modules/gui/wxwidgets/dialogs/streamout.cpp @@ -24,15 +24,9 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include +#include "dialogs/streamout.hpp" -#include -#include - -#include "wxwidgets.h" +#include #include #include diff --git a/modules/gui/wxwidgets/dialogs/streamout.hpp b/modules/gui/wxwidgets/dialogs/streamout.hpp new file mode 100644 index 0000000000..a4098c165e --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/streamout.hpp @@ -0,0 +1,161 @@ +/***************************************************************************** + * streamout.hpp: Stream output dialog + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_STREAMOUT_H_ +#define _WXVLC_STREAMOUT_H_ + +#include "wxwidgets.hpp" + +namespace wxvlc +{ + enum + { + PLAY_ACCESS_OUT = 0, + FILE_ACCESS_OUT, + HTTP_ACCESS_OUT, + MMSH_ACCESS_OUT, + RTP_ACCESS_OUT, + UDP_ACCESS_OUT, + ACCESS_OUT_NUM + }; + + enum + { + TS_ENCAPSULATION = 0, + PS_ENCAPSULATION, + MPEG1_ENCAPSULATION, + OGG_ENCAPSULATION, + ASF_ENCAPSULATION, + MP4_ENCAPSULATION, + MOV_ENCAPSULATION, + WAV_ENCAPSULATION, + RAW_ENCAPSULATION, + AVI_ENCAPSULATION, + ENCAPS_NUM + }; + + enum + { + ANN_MISC_SOUT = 0, + TTL_MISC_SOUT, + MISC_SOUT_NUM + }; + + class SoutDialog: public wxDialog + { + public: + /* Constructor */ + SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~SoutDialog(); + + wxArrayString GetOptions(); + + private: + void UpdateMRL(); + wxPanel *AccessPanel( wxWindow* parent ); + wxPanel *MiscPanel( wxWindow* parent ); + wxPanel *EncapsulationPanel( wxWindow* parent ); + wxPanel *TranscodingPanel( 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 ); + void OnFileDump( wxCommandEvent& event ); + + /* Event handlers for the net access output */ + void OnNetChange( wxCommandEvent& event ); + + /* Event specific to the announce address */ + void OnAnnounceGroupChange( wxCommandEvent& event ); + void OnAnnounceAddrChange( wxCommandEvent& event ); + + /* Event handlers for the encapsulation panel */ + void OnEncapsulationChange( wxCommandEvent& event ); + + /* Event handlers for the transcoding panel */ + void OnTranscodingEnable( wxCommandEvent& event ); + void OnTranscodingChange( wxCommandEvent& event ); + + /* Event handlers for the misc panel */ + void OnSAPMiscChange( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxWindow *p_parent; + + wxComboBox *mrl_combo; + + /* Controls for the access outputs */ + wxPanel *access_panel; + wxPanel *access_subpanels[ACCESS_OUT_NUM]; + wxCheckBox *access_checkboxes[ACCESS_OUT_NUM]; + + int i_access_type; + + wxComboBox *file_combo; + wxCheckBox *dump_checkbox; + wxSpinCtrl *net_ports[ACCESS_OUT_NUM]; + wxTextCtrl *net_addrs[ACCESS_OUT_NUM]; + + /* Controls for the SAP announces and TTL setting */ + wxPanel *misc_panel; + wxPanel *misc_subpanels[MISC_SOUT_NUM]; + wxCheckBox *sap_checkbox; + wxTextCtrl *announce_group; + wxTextCtrl *announce_addr; + wxSpinCtrl *ttl_spin; + + /* Controls for the encapsulation */ + wxPanel *encapsulation_panel; + wxRadioButton *encapsulation_radios[ENCAPS_NUM]; + int i_encapsulation_type; + + /* Controls for transcoding */ + wxPanel *transcoding_panel; + wxCheckBox *video_transc_checkbox; + wxComboBox *video_codec_combo; + wxComboBox *audio_codec_combo; + wxCheckBox *audio_transc_checkbox; + wxComboBox *video_bitrate_combo; + wxComboBox *audio_bitrate_combo; + wxComboBox *audio_channels_combo; + wxComboBox *video_scale_combo; + wxComboBox *subtitles_codec_combo; + wxCheckBox *subtitles_transc_checkbox; + wxCheckBox *subtitles_overlay_checkbox; + + /* Misc controls */ + wxCheckBox *sout_all_checkbox; + }; + +}; + +#endif diff --git a/modules/gui/wxwidgets/subtitles.cpp b/modules/gui/wxwidgets/dialogs/subtitles.cpp similarity index 95% rename from modules/gui/wxwidgets/subtitles.cpp rename to modules/gui/wxwidgets/dialogs/subtitles.cpp index ea6fdbaa4f..3975b07633 100644 --- a/modules/gui/wxwidgets/subtitles.cpp +++ b/modules/gui/wxwidgets/dialogs/subtitles.cpp @@ -21,20 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include - -#include "wxwidgets.h" +#include "dialogs/subtitles.hpp" #include #include +#include #ifndef wxRB_SINGLE # define wxRB_SINGLE 0 diff --git a/modules/gui/wxwidgets/dialogs/subtitles.hpp b/modules/gui/wxwidgets/dialogs/subtitles.hpp new file mode 100644 index 0000000000..87899e61ed --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/subtitles.hpp @@ -0,0 +1,62 @@ +/***************************************************************************** + * subtitles.hpp: private wxWindows interface description + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_SUBTITLES_H_ +#define _WXVLC_SUBTITLES_H_ + +#include "wxwidgets.hpp" + + +namespace wxvlc +{ +/* Subtitles File Dialog */ +class SubsFileDialog: public wxDialog +{ +public: + /* Constructor */ + SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~SubsFileDialog(); + + wxComboBox *file_combo; + wxComboBox *encoding_combo; + wxComboBox *size_combo; + wxComboBox *align_combo; + wxSpinCtrl *fps_spinctrl; + wxSpinCtrl *delay_spinctrl; + +private: + /* Event handlers (these functions should _not_ be virtual) */ + void OnOk( wxCommandEvent& event ); + void OnCancel( wxCommandEvent& event ); + void OnFileBrowse( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxWindow *p_parent; +}; + +}; + +#endif + diff --git a/modules/gui/wxwidgets/updatevlc.cpp b/modules/gui/wxwidgets/dialogs/updatevlc.cpp similarity index 99% rename from modules/gui/wxwidgets/updatevlc.cpp rename to modules/gui/wxwidgets/dialogs/updatevlc.cpp index 8ff37f1601..c3b58538f3 100644 --- a/modules/gui/wxwidgets/updatevlc.cpp +++ b/modules/gui/wxwidgets/dialogs/updatevlc.cpp @@ -1,5 +1,5 @@ /***************************************************************************** - * updatevlc.cpp : Check for VLC updates dialog + * updatevlc.cpp : VLC Update checker ***************************************************************************** * Copyright (C) 2000-2004 the VideoLAN team * $Id$ @@ -24,12 +24,9 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include -#include - +#include "updatevlc.hpp" #include - -#include "wxwidgets.h" +#include #include "vlc_block.h" #include "vlc_stream.h" @@ -158,6 +155,7 @@ UpdateVLC::UpdateVLC( intf_thread_t *_p_intf, wxWindow *p_parent ): UpdateVLC::~UpdateVLC() { + fprintf( stderr, "Fooing\n"); } /* this function gets all the info from the xml files hosted on diff --git a/modules/gui/wxwidgets/dialogs/updatevlc.hpp b/modules/gui/wxwidgets/dialogs/updatevlc.hpp new file mode 100644 index 0000000000..405656f8ff --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/updatevlc.hpp @@ -0,0 +1,94 @@ +/***************************************************************************** + * updatevlc.hpp: VLC Update checker + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * Authors: Antoine Cellerier + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_UPDATEVLC_H_ +#define _WXVLC_UPDATEVLC_H_ + +#include "wxwidgets.hpp" +#include + +class wxTreeCtrl; + +namespace wxvlc +{ + class UpdateVLC: public wxFrame + { + public: + /** Constructor */ + UpdateVLC( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~UpdateVLC(); + + private: + void OnButtonClose( wxCommandEvent& event ); + void OnClose( wxCloseEvent& WXUNUSED(event) ); + void GetData(); + void OnCheckForUpdate( wxCommandEvent& event ); + void OnMirrorChoice( wxCommandEvent& event ); + void UpdateUpdatesTree(); + void UpdateMirrorsChoice(); + void OnUpdatesTreeActivate( wxTreeEvent& event ); + void DownloadFile( wxString url, wxString dst ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + wxTreeCtrl *updates_tree; + + wxChoice *mirrors_choice; + + wxString release_type; /* could be "stable", "test", "nightly" ... */ + + struct update_file_t + { + wxString type; + wxString md5; + wxString size; + wxString url; + wxString description; + }; + + struct update_version_t + { + wxString type; + wxString major; + wxString minor; + wxString revision; + wxString extra; + std::list m_files; + }; + + std::list m_versions; + + struct update_mirror_t + { + wxString name; + wxString location; + wxString type; + wxString base_url; + }; + + std::list m_mirrors; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp new file mode 100644 index 0000000000..c955ce02c3 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp @@ -0,0 +1,482 @@ +/***************************************************************************** + * vlm_panel.cpp: VLM Panel + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: playlist.cpp 12582 2005-09-17 14:15:32Z zorglub $ + * + * Authors: Clément Stenac + * + * 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 "dialogs/vlm/vlm_panel.hpp" +#include "dialogs/vlm/vlm_wrapper.hpp" +#include "dialogs/vlm/vlm_stream.hpp" +#include "dialogs/vlm/vlm_streampanel.hpp" + +enum +{ + Notebook_Event, + Timer_Event, +}; + +BEGIN_EVENT_TABLE( VLMPanel, wxPanel) + EVT_TIMER( Timer_Event, VLMPanel::OnTimer ) +END_EVENT_TABLE() + + +VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) : + wxPanel( _p_parent, -1, wxDefaultPosition, wxDefaultSize ), + timer( this, Timer_Event ) +{ + p_intf = _p_intf; + + p_vlm = new VLMWrapper( p_intf ); + p_vlm->AttachVLM(); + + SetAutoLayout( TRUE ); + + wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); + + p_notebook = new wxNotebook( this, Notebook_Event ); +#if (!wxCHECK_VERSION(2,5,0)) + wxNotebookSizer *notebook_sizer = new wxNotebookSizer( p_notebook ); +#endif + p_notebook->AddPage( BroadcastPanel( p_notebook ), wxU( _("Broadcasts") ) ); + p_notebook->AddPage( VODPanel( p_notebook ), wxU( _("VOD") ) ); +#if (!wxCHECK_VERSION(2,5,0)) + panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 ); +#else + panel_sizer->Add( p_notebook, 1 , wxEXPAND | wxALL, 5 ); +#endif + + panel_sizer->Layout(); + SetSizerAndFit( panel_sizer ); + + Update(); + + timer.Start( 300 ); +} + +VLMPanel::~VLMPanel() +{ + delete p_vlm; +} + +void VLMPanel::OnTimer( wxTimerEvent& event ) +{ + Update(); +} + +void VLMPanel::Update() +{ + unsigned int i; + for( i = 0 ; i < broadcasts.size(); i++ ) + { + ((VLMBroadcastStreamPanel *)broadcasts[i])->b_found = VLC_FALSE; + } + for( i = 0 ; i < vods.size(); i++ ) + { + ((VLMVODStreamPanel *)vods[i])->b_found = VLC_FALSE; + } + + p_vlm->LockVLM(); + /* Iterate over the media, to find the panels to add / remove */ + /* FIXME: This code should be better wrapped */ + for( i = 0; i < p_vlm->NbMedia(); i++ ) + { + vlm_media_t *p_media = p_vlm->GetMedia( i ); + + if( p_media->i_type == BROADCAST_TYPE ) + { + vlc_bool_t b_foundthis = VLC_FALSE; + for( unsigned int j = 0 ; j < broadcasts.size(); j++ ) + { + VLMBroadcastStreamPanel *p_streamp = + (VLMBroadcastStreamPanel *)(broadcasts[j]); + /* FIXME: dangerous .. */ + if( p_streamp->GetStream()->p_media == p_media ) + { + p_streamp->b_found = VLC_TRUE; + b_foundthis = VLC_TRUE; + break; + } + } + /* Create the stream */ + if( !b_foundthis ) + { + VLMBroadcastStream *p_broadcast = + new VLMBroadcastStream( p_intf, p_media, p_vlm ); + AppendBroadcast( p_broadcast ); + } + } + else if( p_media->i_type == VOD_TYPE ) + { + vlc_bool_t b_foundthis = VLC_FALSE; + for( unsigned int j = 0 ; i < vods.size(); i++ ) + { + VLMVODStreamPanel *p_streamp = (VLMVODStreamPanel *)( vods[j] ); + if( p_streamp->GetStream()->p_media == p_media ) + { + p_streamp->b_found = VLC_TRUE; + b_foundthis = VLC_TRUE; + break; + } + } + /* Create it */ + if( !b_foundthis ) + { + VLMVODStream *p_vod = new VLMVODStream(p_intf, p_media, p_vlm ); + AppendVOD( p_vod ); + } + } + } + + /* Those not marked as found must be removed */ + vector::iterator it = broadcasts.begin(); + while( it < broadcasts.end() ) + { + if( (*it)->b_found == VLC_FALSE ) + { + vector::iterator rem = it; + it++; + VLMBroadcastStreamPanel *p_remove = *rem; + broadcasts.erase( rem ); + RemoveBroadcast( p_remove ); + delete p_remove; + } + else + it++; + } + vector::iterator it2 = vods.begin(); + while( it2 < vods.end() ) + { + if( (*it2)->b_found == VLC_FALSE ) + { + vector::iterator rem = it2; + it2++; + VLMVODStreamPanel *p_remove = *rem; + vods.erase( rem ); + RemoveVOD( p_remove ); + delete p_remove; + } + else + it2++; + } + + /* Update sliders*/ + for( unsigned int j = 0 ; j < broadcasts.size(); j++ ) + { + VLMBroadcastStreamPanel *p_streamp = + (VLMBroadcastStreamPanel *)( broadcasts[j] ); + p_streamp->Update(); + } + p_vlm->UnlockVLM(); +} + +/************************* + * Broadcasts management + *************************/ +wxPanel * VLMPanel::BroadcastPanel( wxWindow *parent ) +{ + broadcasts_panel = new wxPanel( parent, -1, wxDefaultPosition, wxSize( 500, 350 ) ); + broadcasts_sizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBox *add_box = new wxStaticBox( broadcasts_panel, -1, + wxU( _( "New broadcast") ) ); + wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( add_box, wxHORIZONTAL ); + box_sizer->Add( AddBroadcastPanel( broadcasts_panel), 0, wxEXPAND|wxALL, 5 ); + box_sizer->Layout(); + + broadcasts_sizer->Add( box_sizer, 0, wxEXPAND|wxALL, 5 ); + + scrolled_broadcasts = new wxScrolledWindow( broadcasts_panel, -1, + wxDefaultPosition, wxDefaultSize, + wxBORDER_NONE | wxVSCROLL ); + + scrolled_broadcasts_sizer = new wxBoxSizer( wxVERTICAL ); + scrolled_broadcasts->SetAutoLayout( TRUE ); + scrolled_broadcasts->SetScrollRate( 5,5 ); + scrolled_broadcasts->SetSizerAndFit( scrolled_broadcasts_sizer ); + + broadcasts_sizer->Add( scrolled_broadcasts, 1, wxEXPAND| wxALL, 5 ); + broadcasts_sizer->Layout(); + + broadcasts_panel->SetSizerAndFit( broadcasts_sizer ); + + return broadcasts_panel; +} + +wxPanel * VLMPanel::AddBroadcastPanel( wxPanel *panel ) +{ + return new VLMAddStreamPanel( p_intf, panel, p_vlm, VLC_FALSE, + VLC_TRUE ); +} + +void VLMPanel::AppendBroadcast( VLMBroadcastStream *p_broadcast ) +{ + VLMBroadcastStreamPanel *p_new = + new VLMBroadcastStreamPanel( p_intf, scrolled_broadcasts, + p_broadcast ); + p_new->b_found = VLC_TRUE; + scrolled_broadcasts_sizer->Add( p_new, 0, wxEXPAND | wxALL, 5 ); + scrolled_broadcasts_sizer->Layout(); + scrolled_broadcasts->FitInside(); + broadcasts.push_back( p_new ); +} + +void VLMPanel::RemoveBroadcast( VLMBroadcastStreamPanel *p_streamp ) +{ + scrolled_broadcasts_sizer->Remove( p_streamp ); + scrolled_broadcasts_sizer->Layout(); + scrolled_broadcasts->FitInside(); +} + +/************************* + * VODS management + *************************/ +wxPanel * VLMPanel::VODPanel( wxWindow *parent ) +{ + vods_panel = new wxPanel( parent, -1, wxDefaultPosition, wxSize( 500, 350 ) ); + return vods_panel; +} + +wxPanel * VLMPanel::AddVODPanel( wxPanel *panel ) +{ + return new VLMAddStreamPanel( p_intf, panel, p_vlm, VLC_FALSE, + VLC_FALSE ); +} + +void VLMPanel::AppendVOD( VLMVODStream *p_vod ) +{ + VLMVODStreamPanel *p_new = + new VLMVODStreamPanel( p_intf, scrolled_vods, p_vod ); + p_new->b_found = VLC_TRUE; + scrolled_vods_sizer->Add( p_new, 0, wxEXPAND | wxALL, 5 ); + scrolled_vods_sizer->Layout(); + scrolled_vods->FitInside(); + vods.push_back( p_new ); +} + +void VLMPanel::RemoveVOD( VLMVODStreamPanel *p_streamp ) +{ + scrolled_vods_sizer->Remove( p_streamp ); + scrolled_vods_sizer->Layout(); + scrolled_vods->FitInside(); +} + +/**************************************************************************** + * VLM Add Broadcast panel implementation + *****************************************************************************/ +enum +{ + Create_Event, + Clear_Event, + ChooseInput_Event, + ChooseOutput_Event, +}; + +BEGIN_EVENT_TABLE( VLMAddStreamPanel, wxPanel) + EVT_BUTTON( Create_Event, VLMAddStreamPanel::OnCreate ) + EVT_BUTTON( Clear_Event, VLMAddStreamPanel::OnClear ) +END_EVENT_TABLE() + +VLMAddStreamPanel::VLMAddStreamPanel( intf_thread_t *_p_intf, + wxWindow *_p_parent, VLMWrapper *_p_vlm, + vlc_bool_t _b_edit, vlc_bool_t _b_broadcast ): + wxPanel( _p_parent, -1, wxDefaultPosition, wxDefaultSize ) +{ + p_intf = _p_intf; + p_vlm = _p_vlm; + b_edit = _b_edit; + b_broadcast = _b_broadcast; + + SetAutoLayout( TRUE ); + + wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); + + wxFlexGridSizer *upper_sizer = new wxFlexGridSizer( 5,2 ); + + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Name") ) ) ); + name_text = new wxTextCtrl( this, -1, wxU( _("") ), wxDefaultPosition, + wxSize( 150, -1 ) ); + upper_sizer->Add( name_text , 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); + + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Input") ) ) ); + input_text = new wxTextCtrl( this, -1, wxU( _("") ) , + wxDefaultPosition, wxSize( 150, -1 ) ); + upper_sizer->Add( input_text , 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); + upper_sizer->Add( new wxButton( this, ChooseInput_Event, wxU( _("Choose") ) ) ); + + upper_sizer->Add( 0,0 ); + upper_sizer->Add( 0,0 ); + + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Output") ) ) ); + output_text = new wxTextCtrl( this, -1, wxU( _("") ) , + wxDefaultPosition, wxSize( 150, -1 ) ); + upper_sizer->Add( output_text, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); + upper_sizer->Add( new wxButton( this, ChooseOutput_Event, + wxU( _("Choose") ) ) ); + + panel_sizer->Add( upper_sizer, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer *lower_sizer = new wxBoxSizer( wxHORIZONTAL ); + lower_sizer->Add( new wxButton( this, Create_Event, + wxU( _( b_edit ? "Edit" : "Create" ) ) ), + 0 , wxEXPAND | wxALL , 5 ); + lower_sizer->Add( new wxButton( this, Clear_Event, wxU( _( "Clear" ) ) ), + 0 , wxEXPAND | wxALL , 5 ); + + enabled_checkbox = new wxCheckBox( this, -1, wxU( _("Enabled" ) ) ); + enabled_checkbox->SetValue( true ); + lower_sizer->Add( enabled_checkbox, 1 , wxEXPAND | wxALL , 5 ); + if( b_broadcast ) + { + loop_checkbox = new wxCheckBox( this, -1, wxU( _("Loop" ) ) ); + lower_sizer->Add( loop_checkbox, 1 , wxEXPAND | wxALL , 5 ); + } + + panel_sizer->Add( lower_sizer, 0 , wxEXPAND| wxALL, 5 ); + panel_sizer->Layout(); + SetSizerAndFit( panel_sizer ); +} + +VLMAddStreamPanel::~VLMAddStreamPanel() +{ +} + +void VLMAddStreamPanel::Load( VLMStream *p_stream ) +{ + name_text->SetValue( wxU( p_stream->p_media->psz_name ) ); + name_text->SetEditable( false ); + if( p_stream->p_media->i_input > 0 ) + { + input_text->SetValue( wxU( p_stream->p_media->input[0] ) ); + } + output_text->SetValue( wxU( p_stream->p_media->psz_output ) ); + enabled_checkbox->SetValue( p_stream->p_media->b_enabled ); + if( b_broadcast) + loop_checkbox->SetValue( p_stream->p_media->b_loop ); +} + +void VLMAddStreamPanel::OnCreate( wxCommandEvent &event ) +{ + char *psz_name = FromLocale( name_text->GetValue().mb_str() ); + char *psz_input = FromLocale( input_text->GetValue().mb_str() ); + char *psz_output = FromLocale( output_text->GetValue().mb_str() ); + if( b_broadcast && ! b_edit ) + { + p_vlm->AddBroadcast( psz_name, psz_input, psz_output, + enabled_checkbox->IsChecked() ? VLC_TRUE: VLC_FALSE, + loop_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ); + } + else if( b_broadcast && b_edit ) + { + p_vlm->EditBroadcast( psz_name, psz_input, psz_output, + enabled_checkbox->IsChecked() ? VLC_TRUE: VLC_FALSE, + loop_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ); + } + else if( !b_broadcast && !b_edit ) + { + p_vlm->AddVod( psz_name, psz_input, psz_output, + enabled_checkbox->IsChecked() ? VLC_TRUE: VLC_FALSE, + loop_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ); + } + else + { + p_vlm->EditVod( psz_name, psz_input, psz_output, + enabled_checkbox->IsChecked() ? VLC_TRUE: VLC_FALSE, + loop_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ); + } + LocaleFree( psz_name) ; LocaleFree( psz_input ) ; + LocaleFree( psz_output); + if( !b_edit ) + OnClear( event ); +} + +void VLMAddStreamPanel::OnClear( wxCommandEvent &event ) +{ + name_text->SetValue( wxU("") ); + input_text->SetValue( wxU("") ); + output_text->SetValue( wxU("") ); +} + + +/**************************************************************************** + * VLM Frame implementation + ****************************************************************************/ +enum +{ + Close_Event, +}; + +BEGIN_EVENT_TABLE( VLMFrame, wxFrame ) + EVT_CLOSE( VLMFrame::OnClose ) +END_EVENT_TABLE() + +VLMFrame::VLMFrame( intf_thread_t *_p_intf, wxWindow *_p_parent ) : + wxFrame( _p_parent, -1, wxU( _("VLM configuration") ), + wxDefaultPosition, wxSize( 640,480 ), wxDEFAULT_FRAME_STYLE ) +{ + SetIcon( *_p_intf->p_sys->p_icon ); + + wxBoxSizer *main_sizer = new wxBoxSizer( wxHORIZONTAL ); + vlm_panel = new VLMPanel( _p_intf, this ); + + main_sizer->Add( vlm_panel, 1, wxEXPAND | wxALL, 5 ); + main_sizer->Layout(); + SetSizerAndFit( main_sizer ); +} + +void VLMFrame::OnClose( wxCloseEvent& WXUNUSED(event) ) +{ + Hide(); +} + +void VLMFrame::Update() +{ + vlm_panel->Update(); +} + +VLMFrame::~VLMFrame() +{ + delete vlm_panel; +} + +/**************************************************************************** + * VLM Add stream Frame implementation + ****************************************************************************/ +VLMEditStreamFrame::VLMEditStreamFrame( intf_thread_t *_p_intf, + wxWindow *_p_parent, VLMWrapper *_p_vlm, vlc_bool_t _b_broadcast, + VLMStream *p_stream ) : + wxFrame( _p_parent, -1, wxU( _("VLM stream") ), + wxDefaultPosition, wxSize( 640,480 ), wxDEFAULT_FRAME_STYLE ) +{ + SetIcon( *_p_intf->p_sys->p_icon ); + + wxBoxSizer *main_sizer = new wxBoxSizer( wxHORIZONTAL ); + vlm_panel = new VLMAddStreamPanel( _p_intf, this, _p_vlm , + VLC_TRUE, _b_broadcast ); + + vlm_panel->Load( p_stream ); + + main_sizer->Add( vlm_panel, 1, wxEXPAND | wxALL, 5 ); + main_sizer->Layout(); + SetSizerAndFit( main_sizer ); +} + +VLMEditStreamFrame::~VLMEditStreamFrame() +{ +} diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.hpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.hpp new file mode 100644 index 0000000000..07cab08262 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.hpp @@ -0,0 +1,152 @@ +/***************************************************************************** + * vlm_panel.hpp: Header for the VLM panel + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_VLMPANEL_H_ +#define _WXVLC_VLMPANEL_H_ + +#include "wxwidgets.hpp" + +#include +using namespace std; + + +class VLMWrapper; +class VLMStream; +class VLMBroadcastStream; +class VLMVODStream; + +namespace wxvlc +{ + class VLMStreamPanel; + class VLMBroadcastStreamPanel; + class VLMVODStreamPanel; + + /** This class is the panel to add or edit a VLM stream + * It can be embedded in the main VLM panel or on a separate frame + */ + class VLMAddStreamPanel : public wxPanel + { + public: + VLMAddStreamPanel( intf_thread_t *, wxWindow *, VLMWrapper *, + vlc_bool_t, vlc_bool_t ); + virtual ~VLMAddStreamPanel(); + void Load( VLMStream *); + private: + void OnCreate( wxCommandEvent& ); + void OnClear( wxCommandEvent& ); + + wxTextCtrl *name_text; + wxTextCtrl *input_text; + wxTextCtrl *output_text; + + wxCheckBox *enabled_checkbox; + wxCheckBox *loop_checkbox; + + intf_thread_t *p_intf; + VLMWrapper *p_vlm; + + + vlc_bool_t b_edit, b_broadcast; + + DECLARE_EVENT_TABLE(); + }; + + /** + * This class is the main VLM Manager panel + */ + class VLMPanel : public wxPanel + { + public: + VLMPanel( intf_thread_t *p_intf, wxWindow * ); + virtual ~VLMPanel(); + + void Update(); + + protected: + + private: + VLMWrapper *p_vlm; + intf_thread_t *p_intf; + + wxTimer timer; + void OnTimer( wxTimerEvent &); + /** Notebook */ + wxNotebook *p_notebook; + DECLARE_EVENT_TABLE(); + + /* Broadcast stuff */ + vector broadcasts; + wxPanel *broadcasts_panel; + wxBoxSizer *broadcasts_sizer; + wxScrolledWindow *scrolled_broadcasts; + wxBoxSizer *scrolled_broadcasts_sizer; + wxPanel *BroadcastPanel( wxWindow *); + wxPanel *AddBroadcastPanel( wxPanel *); + void AppendBroadcast( VLMBroadcastStream *); + void RemoveBroadcast( VLMBroadcastStreamPanel *); + + /* VOD stuff */ + vector vods; + wxPanel *vods_panel; + wxBoxSizer *vods_sizer; + wxScrolledWindow *scrolled_vods; + wxBoxSizer *scrolled_vods_sizer; + wxPanel *VODPanel( wxWindow *); + wxPanel *AddVODPanel( wxPanel *); + void AppendVOD( VLMVODStream *); + void RemoveVOD( VLMVODStreamPanel *); + + }; + + /** This class is the standard VLM frame + * It only consists of the VLM panel + */ + class VLMFrame: public wxFrame + { + public: + VLMFrame( intf_thread_t *p_intf, wxWindow * ); + virtual ~VLMFrame(); + + void Update(); + private: + VLMPanel *vlm_panel; + DECLARE_EVENT_TABLE(); + void OnClose( wxCloseEvent& ); + }; + + /** This class is the edit dialog for a stream + * It only consists of the VLM edit panel + */ + class VLMEditStreamFrame: public wxFrame + { + public: + VLMEditStreamFrame( intf_thread_t *p_intf, wxWindow *, + VLMWrapper * , vlc_bool_t, VLMStream * ); + virtual ~VLMEditStreamFrame(); + + private: + VLMAddStreamPanel *vlm_panel; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp new file mode 100644 index 0000000000..c0a0ec9a93 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp @@ -0,0 +1,150 @@ +/***************************************************************************** + * vlm_slider_manager.cpp : Manage an input slider for a VLM stream + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: timer.cpp 11981 2005-08-03 15:03:23Z xtophe $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "dialogs/vlm/vlm_slider_manager.hpp" +#include "dialogs/vlm/vlm_stream.hpp" +#include "dialogs/vlm/vlm_streampanel.hpp" + +/***************************************************************************** + * Constructor. + *****************************************************************************/ +VLMSliderManager::VLMSliderManager( intf_thread_t *_p_intf, + VLMBroadcastStreamPanel *_p_sp ) : + SliderManager( _p_intf ) +{ + p_sp = _p_sp; + _slider = p_sp->p_slider; + + b_slider_free = VLC_TRUE; + time_string = wxU( "0:00:00 / 0:00:00"); +} + +VLMSliderManager::~VLMSliderManager() +{ +} + +/***************************************************************************** + * Private methods. + *****************************************************************************/ + +void VLMSliderManager::UpdateInput() +{ + if( p_sp->GetStream()->p_media->i_instance == 0 ) + { + p_input = NULL; + return; + } + /** FIXME !! */ + p_input = p_sp->GetStream()->p_media->instance[0]->p_input; +} + +void VLMSliderManager::UpdateButtons( vlc_bool_t b_play ) +{ + if( b_play ) + { + p_sp->TogglePlayButton( PLAYING_S ); + } + else + { + p_sp->TogglePlayButton( PAUSE_S ); + } +} + +vlc_bool_t VLMSliderManager::IsShown() +{ + return _slider->IsEnabled(); +} + +void VLMSliderManager::ShowSlider() +{ + _slider->Enable(); +} + +void VLMSliderManager::HideSlider() +{ + _slider->SetValue( 0 ); + _slider->Disable(); + UpdateTime( "0:00:00", "0:00:00" ); +} + +vlc_bool_t VLMSliderManager::IsFree() +{ + return b_slider_free; +} + +vlc_bool_t VLMSliderManager::IsPlaying() +{ + return VLC_TRUE; /* Is it really useful ? */ +} + +void VLMSliderManager::UpdateTime( char *psz_time, char *psz_total ) +{ + time_string = wxU(psz_time) + wxString(wxT(" / ") ) +wxU(psz_total) ; +} + + +void VLMSliderManager::ProcessUpdate( wxScrollEvent &event ) +{ + +#ifdef WIN32 + if( event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE + || event.GetEventType() == wxEVT_SCROLL_ENDSCROLL ) + { +#endif + if( i_slider_pos != event.GetPosition() && p_input ) + { + vlc_value_t pos; + pos.f_float = (float)event.GetPosition() / (float)SLIDER_MAX_POS; + + var_Set( p_input, "position", pos ); + } + +#ifdef WIN32 + b_slider_free = VLC_TRUE; + } + else + { + b_slider_free = VLC_FALSE; + + if( p_input ) + { + /* Update stream date */ + char psz_time[ MSTRTIME_MAX_SIZE ], psz_total[ MSTRTIME_MAX_SIZE ]; + mtime_t i_seconds; + + i_seconds = var_GetTime( p_input, "length" ) / I64C(1000000 ); + secstotimestr( psz_total, i_seconds ); + + i_seconds = var_GetTime( p_input, "time" ) / I64C(1000000 ); + secstotimestr( psz_time, i_seconds ); + + time_string = wxU(psz_time) + wxString(wxT(" / ") ) +wxU(psz_total) ; + } + } +#endif + +#undef WIN32 +} diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp new file mode 100644 index 0000000000..4ec0671293 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp @@ -0,0 +1,62 @@ +/***************************************************************************** + * vlm_slider_manager.hpp: Header for slider_manager + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _VLM_SLIDER_MANAGER_H_ +#define _VLM_SLIDER_MANAGER_H_ + +#include "slider_manager.hpp" + +namespace wxvlc +{ + class VLMBroadcastStreamPanel; + /** + * This class manages a slider corresponding to the main input + */ + class VLMSliderManager: public SliderManager + { + public: + VLMSliderManager( intf_thread_t *, VLMBroadcastStreamPanel * ); + virtual ~VLMSliderManager(); + + wxString time_string; + + void ProcessUpdate( wxScrollEvent & ); + + protected: + vlc_bool_t b_slider_free; + virtual void UpdateInput(); + virtual void UpdateButtons( vlc_bool_t ); + virtual void UpdateTime( char *, char *); + + virtual vlc_bool_t IsShown(); + virtual vlc_bool_t IsFree(); + virtual vlc_bool_t IsPlaying(); + + virtual void HideSlider(); + virtual void ShowSlider(); + + VLMBroadcastStreamPanel * p_sp; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.cpp new file mode 100644 index 0000000000..2c5163071f --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.cpp @@ -0,0 +1,110 @@ +/***************************************************************************** + * vlm_stream.cpp : Implementation of the VLMStream class hierarchy + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: timer.cpp 11981 2005-08-03 15:03:23Z xtophe $ + * + * Authors: Clément Stenac + * + * 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 "dialogs/vlm/vlm_stream.hpp" +#include "dialogs/vlm/vlm_wrapper.hpp" + +/***************************************************************************** + * VLMStream class + *****************************************************************************/ +VLMStream::VLMStream( intf_thread_t *_p_intf, vlm_media_t *_p_media, + VLMWrapper * _p_vlm ) +{ + p_intf = _p_intf; + p_vlm = _p_vlm; + p_media = _p_media; +} + +VLMStream::~VLMStream() +{ +} + +void VLMStream::Enable() +{ + p_media->b_enabled = VLC_TRUE; +} + +void VLMStream::Disable() +{ + p_media->b_enabled = VLC_FALSE; +} + +void VLMStream::Delete() +{ + vlm_message_t *message; + string command = "del " + string( p_media->psz_name ); + /* FIXME: Should be moved to vlm_Wrapper */ + vlm_ExecuteCommand( p_vlm->GetVLM(), (char*)command.c_str(), & message ); + vlm_MessageDelete( message ); +} + +/***************************************************************************** + * VLMBroadcastStream class + *****************************************************************************/ +VLMBroadcastStream::VLMBroadcastStream( intf_thread_t *_p_intf, + vlm_media_t *_p_media, VLMWrapper *_p_vlm ): VLMStream( _p_intf, _p_media, _p_vlm ) +{ + +} + +VLMBroadcastStream::~VLMBroadcastStream() +{ +} + +void VLMBroadcastStream::Play() +{ + vlm_message_t *message; + string command = "control " + string( p_media->psz_name ) + " play"; + /* FIXME: Should be moved to vlm_Wrapper */ + vlm_ExecuteCommand( p_vlm->GetVLM(), (char*)command.c_str(), & message ); + vlm_MessageDelete( message ); +} + +void VLMBroadcastStream::Stop() +{ + vlm_message_t *message; + string command = "control " + string( p_media->psz_name ) + " stop"; + vlm_ExecuteCommand( p_vlm->GetVLM(), (char*)command.c_str(), & message ); + vlm_MessageDelete( message ); +} + +void VLMBroadcastStream::Pause() +{ + vlm_message_t *message; + string command = "control " + string( p_media->psz_name ) + " pause"; + vlm_ExecuteCommand( p_vlm->GetVLM(), (char*)command.c_str(), & message ); + vlm_MessageDelete( message ); +} + +/***************************************************************************** + * VLMVODStream class + *****************************************************************************/ +VLMVODStream::VLMVODStream( intf_thread_t *_p_intf, vlm_media_t *_p_media, + VLMWrapper *_p_vlm ): VLMStream( _p_intf, _p_media, _p_vlm ) +{ + +} + +VLMVODStream::~VLMVODStream() +{ +} diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.hpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.hpp new file mode 100644 index 0000000000..4ddbe74c4f --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_stream.hpp @@ -0,0 +1,86 @@ +/***************************************************************************** + * vlm_stream.hpp: Representation of a VLM Stream + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: vlm_stream.hpp 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +/* FIXME : This is not WX-specific and should be moved to core */ +#ifndef _VLM_STREAM_H_ +#define _VLM_STREAM_H_ + +#include +#include +#include + +#include +using namespace std; + +class VLMWrapper; + +/** + * This class encapsulates a VLM Stream and provides additional services + */ +class VLMStream +{ +public: + VLMStream( intf_thread_t *, vlm_media_t * , VLMWrapper *); + virtual ~VLMStream(); + + vlm_media_t *p_media; + + + void Delete(); + virtual void Disable(); + virtual void Enable(); + + /* FIXME: provide accessor */ + VLMWrapper *p_vlm; +protected: + intf_thread_t *p_intf; + friend class VLMWrapper; +private: +}; + +/** + * This class encapsulates a VLM Broadcast stream + */ +class VLMBroadcastStream : public VLMStream +{ +public: + VLMBroadcastStream( intf_thread_t *, vlm_media_t *, VLMWrapper *); + virtual ~VLMBroadcastStream(); + + void Play(); + void Pause(); + void Stop(); + +}; + +/** + * This class encapsulates a VLM VOD Stream + */ +class VLMVODStream : public VLMStream +{ +public: + VLMVODStream( intf_thread_t *, vlm_media_t *, VLMWrapper *); + virtual ~VLMVODStream(); +}; + +#endif diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.cpp new file mode 100644 index 0000000000..61c7e2c337 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.cpp @@ -0,0 +1,202 @@ +/***************************************************************************** + * vlm_streampanel:cpp + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: playlist.cpp 12582 2005-09-17 14:15:32Z zorglub $ + * + * Authors: Clément Stenac + * + * 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 "dialogs/vlm/vlm_streampanel.hpp" +#include "dialogs/vlm/vlm_stream.hpp" +#include "dialogs/vlm/vlm_slider_manager.hpp" + +#include "dialogs/vlm/vlm_panel.hpp" + +#include "bitmaps/play.xpm" +#include "bitmaps/pause.xpm" +#include "bitmaps/stop.xpm" +#include "bitmaps/trash.xpm" + +enum +{ + BPlay_Event, + BStop_Event, + BSlider_Event, + BEdit_Event, + BTrash_Event, +}; + +BEGIN_EVENT_TABLE( VLMBroadcastStreamPanel, wxPanel ) + EVT_BUTTON( BPlay_Event, VLMBroadcastStreamPanel::OnPlay ) + EVT_BUTTON( BStop_Event, VLMBroadcastStreamPanel::OnStop ) + EVT_BUTTON( BEdit_Event, VLMBroadcastStreamPanel::OnEdit ) + EVT_BUTTON( BTrash_Event, VLMBroadcastStreamPanel::OnTrash ) + EVT_COMMAND_SCROLL( BSlider_Event, VLMBroadcastStreamPanel::OnSliderUpdate ) +END_EVENT_TABLE() + +/*********************************************************************** + * VLMStream + ***********************************************************************/ +VLMStreamPanel::VLMStreamPanel( intf_thread_t * _p_intf, wxWindow * _p_parent ): + wxPanel( _p_parent, -1, wxDefaultPosition, wxDefaultSize ) +{ + p_intf = _p_intf; + p_slider = NULL; +} + +VLMStreamPanel::~VLMStreamPanel() +{ +} + +/*********************************************************************** + * VLMBroadcastStream + ***********************************************************************/ +VLMBroadcastStreamPanel::VLMBroadcastStreamPanel( intf_thread_t* _p_intf, + wxWindow *_p_parent , VLMBroadcastStream *_stream ): + VLMStreamPanel( _p_intf, _p_parent ), + p_stream( _stream ) +{ + wxStaticBox *box = new wxStaticBox( this, -1, + wxU( p_stream->p_media->psz_name ) ); + + wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( box, wxHORIZONTAL ); + + play_button = new wxBitmapButton( this, BPlay_Event, + wxBitmap( play_xpm ) ); + play_button->SetToolTip( wxU(_("Play/Pause") ) ); + box_sizer->Add( play_button, 0, wxEXPAND | wxALL, 5 ); + + wxBitmapButton *stop_button = new wxBitmapButton( this, BStop_Event, + wxBitmap( stop_xpm ) ); + stop_button->SetToolTip( wxU(_("Stop") ) ); + box_sizer->Add( stop_button, 0, wxEXPAND | wxALL, 5 ); + + p_slider = new wxSlider( this, BSlider_Event, 0, 0, + SLIDER_MAX_POS, wxDefaultPosition, wxDefaultSize ); + p_slider->Disable(); + box_sizer->Add( p_slider, 1, wxEXPAND | wxALL, 5 ); + + p_time = new wxStaticText( this, -1, wxU( "0:00:00 / 0:00:00") ); + box_sizer->Add( p_time , 0, wxEXPAND | wxALL, 5 ); + + wxBitmapButton *edit_button = new wxBitmapButton( this, BEdit_Event, + wxBitmap( trash_xpm ) ); + edit_button->SetToolTip( wxU( _("Edit") ) ); + box_sizer->Add( edit_button, 0, wxEXPAND | wxALL , 5 ); + + wxBitmapButton *trash_button = new wxBitmapButton( this, BTrash_Event, + wxBitmap( trash_xpm ) ); + trash_button->SetToolTip( wxU( _("Delete" ) ) ); + box_sizer->Add( trash_button, 0, wxEXPAND | wxALL , 5 ); + + box_sizer->Layout(); + SetSizerAndFit( box_sizer ); + + p_sm = new VLMSliderManager( p_intf, this ); +} + +VLMBroadcastStreamPanel::~VLMBroadcastStreamPanel() +{ +} + +void VLMBroadcastStreamPanel::TogglePlayButton( int state ) +{ + if( state == PLAYING_S ) + { + play_button->SetBitmapLabel( wxBitmap( pause_xpm ) ); + } + if( state == PAUSE_S ) + { + play_button->SetBitmapLabel( wxBitmap( play_xpm ) ); + } +} + +void VLMBroadcastStreamPanel::Update() +{ + /* Update managed slider */ + p_sm->Update(); + p_time->SetLabel( p_sm->time_string ); +} + +void VLMBroadcastStreamPanel::OnPlay( wxCommandEvent &event ) +{ + /* FIXME: Factorize input / VLM code here */ + /* Handle multiple instance */ + if( p_stream->p_media->i_instance > 0 && + p_stream->p_media->instance[0]->p_input ) + { + vlc_value_t val; + vlc_object_yield( p_stream->p_media->instance[0]->p_input ); + var_Get( p_stream->p_media->instance[0]->p_input, "state", &val ); + if( val.i_int != PAUSE_S ) + { + /* Pause */ + val.i_int = PAUSE_S; + } + else + { + /* Resume */ + val.i_int = PLAYING_S; + } + var_Set( p_stream->p_media->instance[0]->p_input, "state", val ); + TogglePlayButton( val.i_int ); + vlc_object_release( p_stream->p_media->instance[0]->p_input ); + } + else + { + p_stream->Play(); + TogglePlayButton( PLAYING_S ); + } +} + +void VLMBroadcastStreamPanel::OnStop( wxCommandEvent &event ) +{ + p_stream->Stop(); +} + +void VLMBroadcastStreamPanel::OnEdit( wxCommandEvent &event ) +{ + VLMEditStreamFrame *p_frame = + new VLMEditStreamFrame( p_intf, this, p_stream->p_vlm, VLC_TRUE, + p_stream ); + p_frame->Show(); +} + +void VLMBroadcastStreamPanel::OnTrash( wxCommandEvent &event ) +{ + p_stream->Delete(); +} + +void VLMBroadcastStreamPanel::OnSliderUpdate( wxScrollEvent& event ) +{ + p_sm->ProcessUpdate( event ); +} + +/*********************************************************************** + * VLMVODStream + ***********************************************************************/ +VLMVODStreamPanel::VLMVODStreamPanel( intf_thread_t* _p_intf, + wxWindow *_p_parent , VLMVODStream *_stream ): + VLMStreamPanel( _p_intf, _p_parent ), + p_stream( _stream ) +{ +} + +VLMVODStreamPanel::~VLMVODStreamPanel() +{ +} diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.hpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.hpp new file mode 100644 index 0000000000..a8a0433e3c --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_streampanel.hpp @@ -0,0 +1,118 @@ +/***************************************************************************** + * vlm_streampanel.hpp: Panel for a VLM stream + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _VLM_STREAMPANEL_H_ +#define _VLM_STREAMPANEL_H_ + +#include "wxwidgets.hpp" + +class VLMStream; +class VLMBroadcastStream; +class VLMVODStream; + +namespace wxvlc +{ + class VLMSliderManager; + + /** + * This class represents the panel for a VLM Stream + * This class is abstract, it needs to be subclassed + */ + class VLMStreamPanel : public wxPanel + { + public: + VLMStreamPanel( intf_thread_t *, wxWindow * ); + virtual ~VLMStreamPanel(); + + virtual void TogglePlayButton( int ) {}; + wxSlider *p_slider; + + virtual void Update() = 0; + protected: + intf_thread_t *p_intf; + vlc_bool_t b_free; + vlc_bool_t b_new; ///< Is it a new stream ? + vlc_bool_t b_found; ///< Have we found the stream here ? + friend class VLMPanel; + + + private: + }; + + /** + * This class represents the panel for a Broadcast VLM Stream + */ + class VLMBroadcastStreamPanel : public VLMStreamPanel + { + public: + VLMBroadcastStreamPanel( intf_thread_t *, wxWindow *, + VLMBroadcastStream * ); + virtual ~VLMBroadcastStreamPanel(); + VLMBroadcastStream *GetStream() { return p_stream; } + + vlc_bool_t b_slider_free; + + VLMSliderManager *p_sm; + + virtual void Update(); + + virtual void TogglePlayButton( int ); + protected: + + private: + VLMBroadcastStream *p_stream; + DECLARE_EVENT_TABLE(); + + void OnPlay( wxCommandEvent &); + void OnStop( wxCommandEvent &); + void OnEdit( wxCommandEvent &); + void OnTrash( wxCommandEvent &); + void OnSliderUpdate( wxScrollEvent &); + + + wxBitmapButton *play_button; + + wxStaticText *p_time; + }; + + /** + * This class represents the panel for a VOD VLM Stream + */ + class VLMVODStreamPanel : public VLMStreamPanel + { + public: + VLMVODStreamPanel( intf_thread_t *, wxWindow *, + VLMVODStream * ); + virtual ~VLMVODStreamPanel(); + + VLMVODStream *GetStream() { return p_stream; } + + virtual void Update() {} + protected: + + private: + VLMVODStream *p_stream; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.cpp new file mode 100644 index 0000000000..5f84411722 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.cpp @@ -0,0 +1,133 @@ +/***************************************************************************** + * vlm_wrapper.cpp : Wrapper around VLM + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: timer.cpp 11981 2005-08-03 15:03:23Z xtophe $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +/* FIXME: This is not wx-specific */ + +#include "dialogs/vlm/vlm_wrapper.hpp" + +VLMWrapper::VLMWrapper( intf_thread_t *_p_intf ) +{ + p_intf = _p_intf; + p_vlm = NULL; +} + +VLMWrapper::~VLMWrapper() +{ + /* FIXME :you have to destroy vlm here to close + * but we shouldn't destroy vlm here in case somebody else wants it */ + if( p_vlm ) + vlm_Delete( p_vlm ); +} + +vlc_bool_t VLMWrapper::AttachVLM() +{ + p_vlm = vlm_New( p_intf ); + return p_vlm ? VLC_TRUE: VLC_FALSE ; +} + +void VLMWrapper::LockVLM() +{ + vlc_mutex_lock( &p_vlm->object_lock ); +} + +void VLMWrapper::UnlockVLM() +{ + vlc_mutex_unlock( &p_vlm->object_lock ); +} + +void VLMWrapper::AddBroadcast( const char* name, const char* input, + const char* output, + vlc_bool_t b_enabled, vlc_bool_t b_loop ) +{ + vlm_message_t *message; + string command = "new " + string(name) + " broadcast"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + EditBroadcast( name, input, output, b_enabled, b_loop ); +} + +void VLMWrapper::EditBroadcast( const char* name, const char* input, + const char* output, + vlc_bool_t b_enabled, vlc_bool_t b_loop ) +{ + vlm_message_t *message; + string command; + command = "setup " + string(name) + " inputdel all"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + command = "setup " + string(name) + " input " + string(input); + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + if( strlen(output) > 0 ) + { + command = "setup " + string(name) + " output " + string(output); + vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message ); + vlm_MessageDelete( message ); + } + if( b_enabled ) + { + command = "setup " + string(name) + " enabled"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + } + if( b_loop ) + { + command = "setup " + string(name) + " loop"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + } +} + +void VLMWrapper::AddVod( const char* name, const char* input, + const char* output, + vlc_bool_t b_enabled, vlc_bool_t b_loop ) +{ + vlm_message_t *message; + string command = "new " + string(name) + " vod"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + EditVod( name, input, output, b_enabled, b_loop ); +} + +void VLMWrapper::EditVod( const char* name, const char* input, + const char* output, + vlc_bool_t b_enabled, vlc_bool_t b_loop ) +{ + vlm_message_t *message; + string command; + command = "setup " + string(name) + " input " + string(input); + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + if( strlen(output) > 0 ) + { + command = "setup " + string(name) + " output " + string(output); + vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message ); + vlm_MessageDelete( message ); + } + if( b_enabled ) + { + command = "setup " + string(name) + " enabled"; + vlm_ExecuteCommand( p_vlm, command.c_str(), &message ); + vlm_MessageDelete( message ); + } +} diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.hpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.hpp new file mode 100644 index 0000000000..b4c784cb57 --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.hpp @@ -0,0 +1,70 @@ +/***************************************************************************** + * vlm_wrapper.hpp: Wrapper for VLM + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +/* This is not WX-specific */ + +#include +#include +#include +#include "dialogs/vlm/vlm_stream.hpp" + +#include +#include +using namespace std; + +class VLMWrapper +{ +public: + VLMWrapper( intf_thread_t * ); + virtual ~VLMWrapper(); + + vlc_bool_t AttachVLM(); + void LockVLM(); + void UnlockVLM(); + + void AddBroadcast( const char*, const char*, const char*, + vlc_bool_t b_enabled = VLC_TRUE, + vlc_bool_t b_loop = VLC_TRUE ); + void EditBroadcast( const char*, const char*, const char*, + vlc_bool_t b_enabled = VLC_TRUE, + vlc_bool_t b_loop = VLC_TRUE ); + void AddVod( const char*, const char*, const char*, + vlc_bool_t b_enabled = VLC_TRUE, + vlc_bool_t b_loop = VLC_TRUE ); + void EditVod( const char*, const char*, const char*, + vlc_bool_t b_enabled = VLC_TRUE, + vlc_bool_t b_loop = VLC_TRUE ); + + unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; } + vlm_media_t *GetMedia( int i ) + { if( p_vlm ) return p_vlm->media[i]; return NULL; } + + vlm_t* GetVLM() { return p_vlm; } + +protected: + +private: + vlm_t *p_vlm; + intf_thread_t *p_intf; + +}; diff --git a/modules/gui/wxwidgets/wizard.cpp b/modules/gui/wxwidgets/dialogs/wizard.cpp similarity index 99% rename from modules/gui/wxwidgets/wizard.cpp rename to modules/gui/wxwidgets/dialogs/wizard.cpp index 77590c8ca9..b3121b13cb 100644 --- a/modules/gui/wxwidgets/wizard.cpp +++ b/modules/gui/wxwidgets/dialogs/wizard.cpp @@ -24,20 +24,12 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include -#include "network.h" - -#include "wxwidgets.h" - +#include "dialogs/wizard.hpp" #include "streamdata.h" +#include "dialogs/open.hpp" #include +#include class wizHelloPage; class wizInputPage; diff --git a/modules/gui/wxwidgets/dialogs/wizard.hpp b/modules/gui/wxwidgets/dialogs/wizard.hpp new file mode 100644 index 0000000000..a2245720eb --- /dev/null +++ b/modules/gui/wxwidgets/dialogs/wizard.hpp @@ -0,0 +1,66 @@ +/***************************************************************************** + * wizard.hpp: Stream wizard headers + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_WIZARD_H_ +#define _WXVLC_WIZARD_H_ + +#include "wxwidgets.hpp" +#include + +namespace wxvlc +{ + /* Wizard */ + class WizardDialog : public wxWizard + { + public: + /* Constructor */ + WizardDialog( intf_thread_t *, wxWindow *p_parent, char *, int, int ); + virtual ~WizardDialog(); + void SetTranscode( char const *vcodec, int vb, char const *acodec, + int ab); + void SetMrl( const char *mrl ); + void SetTTL( int i_ttl ); + void SetPartial( int, int ); + void SetStream( char const *method, char const *address ); + void SetTranscodeOut( char const *address ); + void SetAction( int i_action ); + int GetAction(); + void SetSAP( bool b_enabled, const char *psz_name ); + void SetMux( char const *mux ); + void Run(); + int i_action; + char *method; + + protected: + int vb,ab; + int i_from, i_to, i_ttl; + char *vcodec , *acodec , *address , *mrl , *mux ; + char *psz_sap_name; + bool b_sap; + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/extrapanel.cpp b/modules/gui/wxwidgets/extrapanel.cpp index 84fb202c58..232a1384bd 100644 --- a/modules/gui/wxwidgets/extrapanel.cpp +++ b/modules/gui/wxwidgets/extrapanel.cpp @@ -32,7 +32,7 @@ #include -#include "wxwidgets.h" +#include "extrapanel.hpp" /***************************************************************************** * Local class declarations. diff --git a/modules/gui/wxwidgets/extrapanel.hpp b/modules/gui/wxwidgets/extrapanel.hpp new file mode 100644 index 0000000000..96fd04bd22 --- /dev/null +++ b/modules/gui/wxwidgets/extrapanel.hpp @@ -0,0 +1,124 @@ +/***************************************************************************** + * extrapanel.hpp: Headers for the extra panel window + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_EXTRAPANEL_H_ +#define _WXVLC_EXTRAPANEL_H_ + +#include "wxwidgets.hpp" + + +namespace wxvlc +{ + /* Extended panel */ + class ExtraPanel: public wxPanel + { + public: + /* Constructor */ + ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent ); + virtual ~ExtraPanel(); + + /// \todo Check access level for these + wxStaticBox *adjust_box; + wxButton *restoredefaults_button; + wxSlider *brightness_slider; + wxSlider *contrast_slider; + wxSlider *saturation_slider; + wxSlider *hue_slider; + wxSlider *gamma_slider; + + wxStaticBox *other_box; + wxComboBox *ratio_combo; + + char *psz_bands; + float f_preamp; + vlc_bool_t b_update; + private: + /* General layout */ + wxPanel *VideoPanel( wxWindow * ); + wxPanel *EqzPanel( wxWindow * ); + wxPanel *AudioPanel( wxWindow * ); + wxNotebook *notebook; + + /* Equalizer */ + wxCheckBox *eq_chkbox; + wxCheckBox *eq_2p_chkbox; + wxButton *eq_restoredefaults_button; + wxSlider *smooth_slider; + wxStaticText *smooth_text; + wxSlider *preamp_slider; + wxStaticText * preamp_text; + int i_smooth; + wxSlider *band_sliders[10]; + wxStaticText *band_texts[10]; + int i_values[10]; + + void OnEnableEqualizer( wxCommandEvent& ); + void OnRestoreDefaults( wxCommandEvent& ); + void OnChangeEqualizer( wxScrollEvent& ); + void OnEqSmooth( wxScrollEvent& ); + void OnPreamp( wxScrollEvent& ); + void OnEq2Pass( wxCommandEvent& ); + void OnEqRestore( wxCommandEvent& ); + + /* Video */ + void OnEnableAdjust( wxCommandEvent& ); + void OnAdjustUpdate( wxScrollEvent& ); + void OnRatio( wxCommandEvent& ); + void OnFiltersInfo( wxCommandEvent& ); + void OnSelectFilter( wxCommandEvent& ); + + /* Audio */ + void OnHeadphone( wxCommandEvent& ); + void OnNormvol( wxCommandEvent& ); + void OnNormvolSlider( wxScrollEvent& ); + + void CheckAout(); + void OnIdle( wxIdleEvent& ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + vlc_bool_t b_my_update; + wxWindow *p_parent; + }; +}; +#if 0 +/* Extended Window */ +class ExtraWindow: public wxFrame +{ +public: + /* Constructor */ + ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel ); + virtual ~ExtraWindow(); + +private: + + wxPanel *panel; + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; +}; +#endif + +#endif diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp index 29961f520a..37356263e4 100644 --- a/modules/gui/wxwidgets/interface.cpp +++ b/modules/gui/wxwidgets/interface.cpp @@ -24,14 +24,16 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include -#include -#include -#include -#include +#include "interface.hpp" +#include "extrapanel.hpp" +#include "timer.hpp" +#include "video.hpp" +#include + #include "charset.h" -#include "wxwidgets.h" +#include +#include "charset.h" /* include the toolbar graphics */ #include "bitmaps/play.xpm" @@ -158,6 +160,7 @@ enum * (where it is special and put into the "Apple" menu) */ About_Event = wxID_ABOUT, UpdateVLC_Event, + VLM_Event, Iconize_Event }; @@ -167,6 +170,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) EVT_MENU(Exit_Event, Interface::OnExit) EVT_MENU(About_Event, Interface::OnAbout) EVT_MENU(UpdateVLC_Event, Interface::OnShowDialog) + EVT_MENU(VLM_Event, Interface::OnShowDialog) EVT_MENU(Playlist_Event, Interface::OnShowDialog) EVT_MENU(Logs_Event, Interface::OnShowDialog) @@ -356,7 +360,7 @@ Interface::~Interface() GetPosition(), GetSize() ); } - PopEventHandler(true); + PopEventHandler(true); if( video_window ) delete video_window; @@ -444,6 +448,8 @@ void Interface::CreateOurMenuBar() view_menu->Append( Logs_Event, wxU(_("&Messages...\tCtrl-M")) ); view_menu->Append( FileInfo_Event, wxU(_("Stream and Media &info...\tCtrl-I")) ); + view_menu->Append( VLM_Event, + wxU(_("VLM Control...\tCtrl-I")) ); /* Create the "Auto-generated" menus */ p_settings_menu = SettingsMenu( p_intf, this ); @@ -739,6 +745,7 @@ void Interface::SetupHotkeys() void Interface::HideSlider( bool layout ) { + fprintf( stderr, "Hiding slider\n"); ShowSlider( false, layout ); } @@ -939,6 +946,7 @@ void Interface::OnShowDialog( wxCommandEvent& event ) break; case OpenAdv_Event: i_id = INTF_DIALOG_FILE; + break; case OpenFile_Event: i_id = INTF_DIALOG_FILE; break; @@ -978,6 +986,9 @@ void Interface::OnShowDialog( wxCommandEvent& event ) case UpdateVLC_Event: i_id = INTF_DIALOG_UPDATEVLC; break; + case VLM_Event: + i_id = INTF_DIALOG_VLM; + break; default: i_id = INTF_DIALOG_FILE; break; @@ -1005,93 +1016,6 @@ void Interface::OnExtended(wxCommandEvent& event) frame_sizer->Fit(this); } -#if 0 - if( b_undock == VLC_TRUE ) - { - fprintf(stderr,"Deleting window\n"); - if( extra_window ) - { - delete extra_window; - extra_window = NULL; - } - } - else - { - extra_frame->Hide(); - frame_sizer->Hide( extra_frame ); - frame_sizer->Layout(); - frame_sizer->Fit(this); - } - } - else - { - if( b_undock == VLC_TRUE ) - { - 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 ); - } - else - { - fprintf(stderr,"Deleting window\n"); - if( extra_window ) - { - delete extra_window; - } - extra_frame->Show(); - frame_sizer->Show( extra_frame ); - frame_sizer->Layout(); - frame_sizer->Fit(this); - } - } -} - -void Interface::OnUndock(wxCommandEvent& event) -{ - b_undock = (b_undock == VLC_TRUE ? VLC_FALSE : VLC_TRUE ); - - if( b_extra == VLC_TRUE ) - { - if( b_undock == VLC_FALSE ) - { - fprintf(stderr,"Deleting window\n"); - if( extra_window ) - { - delete extra_window; - extra_window = NULL; - } - extra_frame->Show(); - frame_sizer->Show( extra_frame ); - frame_sizer->Layout(); - frame_sizer->Fit(this); - } - else - { - 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 ); - } - } -} -#endif - - void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) { PlayStream(); @@ -1230,22 +1154,6 @@ void Interface::PrevStream() return; } - /* FIXME --fenrir */ -#if 0 - if( p_playlist->p_input != NULL ) - { - vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock ); - if( p_playlist->p_input->stream.p_selected_area->i_id > 1 ) - { - vlc_value_t val; val.b_bool = VLC_TRUE; - vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); - var_Set( p_playlist->p_input, "prev-title", val ); - } else - vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); - } - vlc_mutex_unlock( &p_playlist->object_lock ); -#endif - playlist_Prev( p_playlist ); vlc_object_release( p_playlist ); } @@ -1264,26 +1172,6 @@ void Interface::NextStream() { return; } - - /* FIXME --fenrir */ -#if 0 - var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); - vlc_mutex_lock( &p_playlist->object_lock ); - if( p_playlist->p_input != NULL ) - { - vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock ); - if( p_playlist->p_input->stream.i_area_nb > 1 && - p_playlist->p_input->stream.p_selected_area->i_id < - p_playlist->p_input->stream.i_area_nb - 1 ) - { - vlc_value_t val; val.b_bool = VLC_TRUE; - vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); - var_Set( p_playlist->p_input, "next-title", val ); - } else - vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); - } - vlc_mutex_unlock( &p_playlist->object_lock ); -#endif playlist_Next( p_playlist ); vlc_object_release( p_playlist ); } @@ -1419,6 +1307,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord, for( size_t i = 0; i < filenames.GetCount(); i++ ) { char *psz_utf8 = wxFromLocale( filenames[i] ); + playlist_Add( p_playlist, psz_utf8, psz_utf8, PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO), PLAYLIST_END ); diff --git a/modules/gui/wxwidgets/interface.hpp b/modules/gui/wxwidgets/interface.hpp new file mode 100644 index 0000000000..f1f58fbff2 --- /dev/null +++ b/modules/gui/wxwidgets/interface.hpp @@ -0,0 +1,253 @@ +/***************************************************************************** + * interface.hpp: Main interface headers + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_INTERFACE_H_ +#define _WXVLC_INTERFACE_H_ + +#include "wxwidgets.hpp" + +#include +#include +#include +//#include "vlc_keys.h" + + +namespace wxvlc +{ + class Timer; + class Interface; + +#if wxUSE_DRAG_AND_DROP + /* Drag and Drop class */ + class DragAndDrop: public wxFileDropTarget + { + public: + DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE ); + virtual bool OnDropFiles( wxCoord x, wxCoord y, + const wxArrayString& filenames ); + + private: + intf_thread_t *p_intf; + vlc_bool_t b_enqueue; + }; +#endif + + /* Systray integration */ +#ifdef wxHAS_TASK_BAR_ICON + class Systray: public wxTaskBarIcon + { + public: + 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 ); + void OnPrevStream ( wxCommandEvent& event ); + void OnNextStream ( wxCommandEvent& event ); + void OnExit( wxCommandEvent& event ); + Interface* p_main_interface; + intf_thread_t *p_intf; + DECLARE_EVENT_TABLE() + }; +#endif + + /* Main Interface */ + class Interface: public wxFrame + { + public: + /* Constructor */ + Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE ); + virtual ~Interface(); + void Init(); + void TogglePlayButton( int i_playing_status ); + void Update(); + void PlayStream(); + void StopStream(); + void PrevStream(); + void NextStream(); + + wxBoxSizer *frame_sizer; + wxStatusBar *statusbar; + + void HideSlider(bool layout = true); + void ShowSlider(bool show = true, bool layout = true); + + wxSlider *slider; + wxWindow *slider_frame; + wxBoxSizer *slider_sizer; + wxPanel *extra_frame; + + void HideDiscFrame(bool layout = true); + void ShowDiscFrame(bool show = true, bool layout = true); + + wxPanel *disc_frame; + wxBoxSizer *disc_sizer; + wxBitmapButton *disc_menu_button; + wxBitmapButton *disc_prev_button; + wxBitmapButton *disc_next_button; + + wxFrame *extra_window; + + vlc_bool_t b_extra; + vlc_bool_t b_undock; + + wxControl *volctrl; + + #ifdef wxHAS_TASK_BAR_ICON + Systray *p_systray; + #endif + + wxTimer m_controls_timer; + wxTimer m_slider_timer; + + private: + void SetupHotkeys(); + void CreateOurMenuBar(); + void CreateOurToolBar(); + void CreateOurExtendedPanel(); + void CreateOurSlider(); + void Open( int i_access_method ); + + /* Event handlers (these functions should _not_ be virtual) */ + void OnControlsTimer(wxTimerEvent& WXUNUSED(event)); + void OnSliderTimer(wxTimerEvent& WXUNUSED(event)); + + void OnExit( wxCommandEvent& event ); + void OnAbout( wxCommandEvent& event ); + + void OnOpenFileSimple( wxCommandEvent& event ); + void OnOpenDir( wxCommandEvent& event ); + void OnOpenFile( wxCommandEvent& event ); + void OnOpenDisc( wxCommandEvent& event ); + void OnOpenNet( wxCommandEvent& event ); + void OnOpenSat( wxCommandEvent& event ); + + void OnExtended( wxCommandEvent& event ); + //void OnUndock( wxCommandEvent& event ); + + void OnBookmarks( wxCommandEvent& event ); + void OnShowDialog( wxCommandEvent& event ); + void OnPlayStream( wxCommandEvent& event ); + void OnStopStream( wxCommandEvent& event ); + void OnSliderUpdate( wxScrollEvent& event ); + void OnPrevStream( wxCommandEvent& event ); + void OnNextStream( wxCommandEvent& event ); + void OnSlowStream( wxCommandEvent& event ); + void OnFastStream( wxCommandEvent& event ); + + void OnDiscMenu( wxCommandEvent& event ); + void OnDiscPrev( wxCommandEvent& event ); + void OnDiscNext( wxCommandEvent& event ); + + void OnMenuOpen( wxMenuEvent& event ); + + #if defined( __WXMSW__ ) || defined( __WXMAC__ ) + void OnContextMenu2(wxContextMenuEvent& event); + #endif + void OnContextMenu(wxMouseEvent& event); + + void OnControlEvent( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + Timer *timer; + intf_thread_t *p_intf; + + wxWindow *video_window; + + int i_old_playing_status; + + /* For auto-generated menus */ + wxMenu *p_settings_menu; + wxMenu *p_audio_menu; + wxMenu *p_video_menu; + wxMenu *p_navig_menu; + }; + + + class WindowSettings + { + public: + WindowSettings( intf_thread_t *_p_intf ); + virtual ~WindowSettings(); + enum + { + ID_SCREEN = -1, + ID_MAIN, + ID_PLAYLIST, + ID_MESSAGES, + ID_FILE_INFO, + ID_BOOKMARKS, + ID_VIDEO, + ID_MAX, + }; + + void SetSettings( int id, bool _b_shown, + wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize ); + bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s ); + + void SetScreen( int i_screen_w, int i_screen_h ); + + private: + intf_thread_t *p_intf; + + int i_screen_w; + int i_screen_h; + bool b_valid[ID_MAX]; + bool b_shown[ID_MAX]; + wxPoint position[ID_MAX]; + wxSize size[ID_MAX]; + }; + + + class MenuEvtHandler : public wxEvtHandler + { + public: + MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface ); + virtual ~MenuEvtHandler(); + + void OnMenuEvent( wxCommandEvent& event ); + void OnShowDialog( wxCommandEvent& event ); + + private: + DECLARE_EVENT_TABLE() + + intf_thread_t *p_intf; + Interface *p_main_interface; + }; +}; + +/// \todo Move this to class +void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& ); +wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); +wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); +wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); +wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); + + +#endif diff --git a/modules/gui/wxwidgets/main_slider_manager.cpp b/modules/gui/wxwidgets/main_slider_manager.cpp new file mode 100644 index 0000000000..27fcbec608 --- /dev/null +++ b/modules/gui/wxwidgets/main_slider_manager.cpp @@ -0,0 +1,207 @@ +/***************************************************************************** + * slider_manager.cpp : Manage an input slider + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: timer.cpp 11981 2005-08-03 15:03:23Z xtophe $ + * + * Authors: Clément Stenac + * + * 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 "main_slider_manager.hpp" +#include "interface.hpp" + +#include + +/***************************************************************************** + * Constructor. + *****************************************************************************/ +MainSliderManager::MainSliderManager( intf_thread_t *_p_intf, + Interface *_p_main_intf ) : + SliderManager( _p_intf ) +{ + p_main_intf = _p_main_intf; + _slider = p_main_intf->slider; +} + +MainSliderManager::~MainSliderManager() +{ + vlc_mutex_lock( &p_intf->change_lock ); + if( p_intf->p_sys->p_input ) vlc_object_release( p_intf->p_sys->p_input ); + p_intf->p_sys->p_input = NULL; + vlc_mutex_unlock( &p_intf->change_lock ); +} + +/***************************************************************************** + * Private methods. + *****************************************************************************/ + +void MainSliderManager::UpdateInput() +{ + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist != NULL ) + { + LockPlaylist( p_intf->p_sys, p_playlist ); + p_input = p_intf->p_sys->p_input = p_playlist->p_input; + if( p_intf->p_sys->p_input ) + vlc_object_yield( p_intf->p_sys->p_input ); + UnlockPlaylist( p_intf->p_sys, p_playlist ); + vlc_object_release( p_playlist ); + } +} + +void MainSliderManager::UpdateNowPlaying() +{ + char *psz_now_playing = vlc_input_item_GetInfo( + p_intf->p_sys->p_input->input.p_item, + _("Meta-information"), _(VLC_META_NOW_PLAYING) ); + if( psz_now_playing && *psz_now_playing ) + { + p_main_intf->statusbar->SetStatusText( + wxString(wxU(psz_now_playing)) + wxT( " - " ) + + wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); + } + else + { + p_main_intf->statusbar->SetStatusText( + wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); + } + free( psz_now_playing ); +} + +void MainSliderManager::UpdateButtons( vlc_bool_t b_play ) +{ + if( b_play ) + { + p_main_intf->TogglePlayButton( PLAYING_S ); +#ifdef wxHAS_TASK_BAR_ICON + if( p_main_intf->p_systray ) + { + p_main_intf->p_systray->UpdateTooltip( + wxU( p_intf->p_sys->p_input->input.p_item->psz_name ) + + wxString(wxT(" - ")) + wxU(_("Playing"))); + } +#endif + } + else + { + p_main_intf->TogglePlayButton( PAUSE_S ); + p_main_intf->statusbar->SetStatusText( wxT(""), 0 ); + p_main_intf->statusbar->SetStatusText( wxT(""), 2 ); +#ifdef wxHAS_TASK_BAR_ICON + if( p_main_intf->p_systray ) + { + p_main_intf->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) ); + } +#endif + } +} + +void MainSliderManager::HideControls() +{ + p_main_intf->m_controls_timer.Start(200, wxTIMER_ONE_SHOT); +} + +void MainSliderManager::DontHide() +{ + p_main_intf->m_controls_timer.Stop(); + + /* New input or stream map change */ + p_intf->p_sys->b_playing = VLC_TRUE; +} + +void MainSliderManager::UpdateDiscButtons() +{ + vlc_value_t val; + var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); + if( val.i_int > 0 && !p_main_intf->disc_frame->IsShown() ) + { + vlc_value_t val; + + #define HELP_MENU N_("Menu") + #define HELP_PCH N_("Previous chapter") + #define HELP_NCH N_("Next chapter") + #define HELP_PTR N_("Previous track") + #define HELP_NTR N_("Next track") + + var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); + + if( val.i_int > 0 ) + { + p_main_intf->disc_menu_button->Show(); + p_main_intf->disc_sizer->Show( + p_main_intf->disc_menu_button ); + p_main_intf->disc_sizer->Layout(); + p_main_intf->disc_sizer->Fit( + p_main_intf->disc_frame ); + p_main_intf->disc_menu_button->SetToolTip( + wxU(_( HELP_MENU ) ) ); + p_main_intf->disc_prev_button->SetToolTip( + wxU(_( HELP_PCH ) ) ); + p_main_intf->disc_next_button->SetToolTip( + wxU(_( HELP_NCH ) ) ); + } + else + { + p_main_intf->disc_menu_button->Hide(); + p_main_intf->disc_sizer->Hide( + p_main_intf->disc_menu_button ); + p_main_intf->disc_prev_button->SetToolTip( + wxU(_( HELP_PTR ) ) ); + p_main_intf->disc_next_button->SetToolTip( + wxU(_( HELP_NTR ) ) ); + } + + p_main_intf->ShowDiscFrame(); + } + else if( val.i_int == 0 && p_main_intf->disc_frame->IsShown() ) + { + p_main_intf->HideDiscFrame(); + } +} + +vlc_bool_t MainSliderManager::IsShown() +{ + return p_main_intf->slider_frame->IsShown(); +} + +void MainSliderManager::ShowSlider() +{ + p_main_intf->ShowSlider(); +} + +void MainSliderManager::HideSlider() +{ + p_main_intf->m_slider_timer.Start( 200, wxTIMER_ONE_SHOT ); +} + +vlc_bool_t MainSliderManager::IsFree() +{ + return p_intf->p_sys->b_slider_free; +} + +vlc_bool_t MainSliderManager::IsPlaying() +{ + return p_intf->p_sys->b_playing; +} + +void MainSliderManager::UpdateTime( char *psz_time, char *psz_total ) +{ + p_main_intf->statusbar->SetStatusText( + wxU(psz_time) + wxString(wxT(" / ")) +wxU(psz_total), 0 ); +} diff --git a/modules/gui/wxwidgets/main_slider_manager.hpp b/modules/gui/wxwidgets/main_slider_manager.hpp new file mode 100644 index 0000000000..bbb59e1e6e --- /dev/null +++ b/modules/gui/wxwidgets/main_slider_manager.hpp @@ -0,0 +1,62 @@ +/***************************************************************************** + * slider_manager.hpp: Header for slider_manager + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _MAIN_SLIDER_MANAGER_H_ +#define _MAIN_SLIDER_MANAGER_H_ + +#include "slider_manager.hpp" + +namespace wxvlc +{ + class Interface; + /** + * This class manages a slider corresponding to the main input + */ + class MainSliderManager: public SliderManager + { + public: + MainSliderManager( intf_thread_t *p_intf, Interface * ); + virtual ~MainSliderManager(); + + protected: + virtual void UpdateInput(); + virtual void UpdateNowPlaying(); + virtual void UpdateButtons( vlc_bool_t ); + virtual void UpdateDiscButtons(); + virtual void UpdateTime( char *, char *); + + virtual vlc_bool_t IsShown(); + virtual vlc_bool_t IsFree(); + virtual vlc_bool_t IsPlaying(); + + virtual void HideSlider(); + virtual void ShowSlider(); + + virtual void HideControls(); + virtual void DontHide(); + + Interface * p_main_intf; + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/menus.cpp b/modules/gui/wxwidgets/menus.cpp index 3e6ec89e34..d189d0bf01 100644 --- a/modules/gui/wxwidgets/menus.cpp +++ b/modules/gui/wxwidgets/menus.cpp @@ -32,7 +32,8 @@ #include #include -#include "wxwidgets.h" +#include "wxwidgets.hpp" +#include "interface.hpp" class wxMenuItemExt: public wxMenuItem { diff --git a/modules/gui/wxwidgets/slider_manager.cpp b/modules/gui/wxwidgets/slider_manager.cpp new file mode 100644 index 0000000000..785540810a --- /dev/null +++ b/modules/gui/wxwidgets/slider_manager.cpp @@ -0,0 +1,150 @@ +/***************************************************************************** + * slider_manager.cpp : Manage an input slider + ***************************************************************************** + * Copyright (C) 2000-2005 the VideoLAN team + * $Id: timer.cpp 11981 2005-08-03 15:03:23Z xtophe $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include /* malloc(), free() */ +#include /* ENOMEM */ +#include /* strerror() */ +#include + +#include +#include +#include + +#include "vlc_meta.h" + +#include "wxwidgets.hpp" + +#include "slider_manager.hpp" + +/***************************************************************************** + * Constructor. + *****************************************************************************/ +SliderManager::SliderManager( intf_thread_t *_p_intf ) +{ + p_intf = _p_intf; + p_input = NULL; + i_old_playing_status = PAUSE_S; +} + +SliderManager::~SliderManager() +{ + vlc_mutex_lock( &p_intf->change_lock ); + if( p_intf->p_sys->p_input ) vlc_object_release( p_intf->p_sys->p_input ); + p_intf->p_sys->p_input = NULL; + vlc_mutex_unlock( &p_intf->change_lock ); +} + +/***************************************************************************** + * Private methods. + *****************************************************************************/ +void SliderManager::Update() +{ + /* Update the input */ + if( p_input == NULL ) + { + UpdateInput(); + if( p_input ) + { + _slider->SetValue( 0 ); + UpdateNowPlaying(); + + UpdateButtons( VLC_TRUE ); + + i_old_playing_status = PLAYING_S; + } + } + else if( p_input->b_dead ) + { + HideControls(); + HideSlider(); + + UpdateButtons( VLC_FALSE ); + + i_old_playing_status = PAUSE_S; + + vlc_object_release( p_input ); + p_input = NULL; + } + + if( p_input ) + { + if( !p_input->b_die ) + { + vlc_value_t pos; + + DontHide(); + + UpdateNowPlaying(); + + /* Really manage the slider */ + var_Get( p_input, "position", &pos ); + + UpdateDiscButtons(); + + if( pos.f_float > 0.0 && ! IsShown() ) + { + ShowSlider(); + } + else if( pos.f_float <= 0.0 ) + { + HideSlider(); + } + + if( IsPlaying() && IsShown() ) + { + /* Update the slider if the user isn't dragging it. */ + if( IsFree() ) + { + char psz_time[ MSTRTIME_MAX_SIZE ]; + char psz_total[ MSTRTIME_MAX_SIZE ]; + vlc_value_t time; + mtime_t i_seconds; + + /* Update the value */ + if( pos.f_float >= 0.0 ) + { + i_slider_pos = (int)(SLIDER_MAX_POS * pos.f_float); + + _slider->SetValue( i_slider_pos ); + + var_Get( p_input, "time", &time ); + i_seconds = time.i_time / 1000000; + secstotimestr ( psz_time, i_seconds ); + + var_Get( p_input, "length", &time ); + i_seconds = time.i_time / 1000000; + secstotimestr ( psz_total, i_seconds ); + + UpdateTime( psz_time, psz_total ); +// p_main_interface->statusbar->SetStatusText( +// wxU(psz_time) + wxString(wxT(" / ")) + +// wxU(psz_total), 0 ); + } + } + } + } + } +} diff --git a/modules/gui/wxwidgets/slider_manager.hpp b/modules/gui/wxwidgets/slider_manager.hpp new file mode 100644 index 0000000000..16647e921b --- /dev/null +++ b/modules/gui/wxwidgets/slider_manager.hpp @@ -0,0 +1,72 @@ +/***************************************************************************** + * slider_manager.hpp: Header for slider_manager + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * Authors: Clément Stenac + * + * 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. + *****************************************************************************/ + +#ifndef _SLIDER_MANAGER_H_ +#define _SLIDER_MANAGER_H_ + +#include "wxwidgets.hpp" + +namespace wxvlc +{ + /** + * This class manages a slider corresponding to an input + * This class is abstract, it needs to be subclassed + */ + class SliderManager + { + public: + SliderManager( intf_thread_t *p_intf ); + virtual ~SliderManager(); + + void Update(); + + protected: + virtual void UpdateInput() = 0; + virtual void UpdateNowPlaying() {}; + virtual void UpdateButtons( vlc_bool_t ) {}; + virtual void UpdateDiscButtons() {} + virtual void UpdateTime( char *, char *) = 0; + + virtual vlc_bool_t IsShown() = 0; + virtual vlc_bool_t IsFree() = 0; + virtual vlc_bool_t IsPlaying() = 0; + + virtual void HideSlider() {}; + virtual void ShowSlider() {}; + + virtual void HideControls() {}; + virtual void DontHide() {}; + + intf_thread_t * p_intf; + input_thread_t *p_input; + wxSlider *_slider; ///< Slider for this input + int i_slider_pos; ///< Current slider position + + private: + int i_old_playing_status; ///< Previous playing status + + + }; +}; + +#endif diff --git a/modules/gui/wxwidgets/timer.cpp b/modules/gui/wxwidgets/timer.cpp index 230a637173..2544fb9ad5 100644 --- a/modules/gui/wxwidgets/timer.cpp +++ b/modules/gui/wxwidgets/timer.cpp @@ -24,20 +24,11 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* ENOMEM */ -#include /* strerror() */ -#include - -#include -#include -#include - +#include "timer.hpp" +#include "main_slider_manager.hpp" +#include "interface.hpp" #include "vlc_meta.h" -#include "wxwidgets.h" -#include - //void DisplayStreamDate( wxControl *, intf_thread_t *, int ); /* Callback prototypes */ @@ -54,6 +45,9 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface ) p_intf = _p_intf; p_main_interface = _p_main_interface; b_init = 0; + + msm = new MainSliderManager( p_intf, p_main_interface ); + i_old_playing_status = PAUSE_S; i_old_rate = INPUT_RATE_DEFAULT; @@ -84,10 +78,7 @@ Timer::~Timer() vlc_object_release( p_playlist ); } - vlc_mutex_lock( &p_intf->change_lock ); - if( p_intf->p_sys->p_input ) vlc_object_release( p_intf->p_sys->p_input ); - p_intf->p_sys->p_input = NULL; - vlc_mutex_unlock( &p_intf->change_lock ); + delete msm; } /***************************************************************************** @@ -112,204 +103,15 @@ void Timer::Notify() vlc_mutex_lock( &p_intf->change_lock ); - /* Update the input */ - if( p_intf->p_sys->p_input == NULL ) - { - playlist_t *p_playlist = - (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - if( p_playlist != NULL ) - { - LockPlaylist( p_intf->p_sys, p_playlist ); - p_intf->p_sys->p_input = p_playlist->p_input; - if( p_intf->p_sys->p_input ) - vlc_object_yield( p_intf->p_sys->p_input ); - UnlockPlaylist( p_intf->p_sys, p_playlist ); - vlc_object_release( p_playlist ); - } - - /* Refresh interface */ - if( p_intf->p_sys->p_input ) - { - p_main_interface->slider->SetValue( 0 ); - - char *psz_now_playing = vlc_input_item_GetInfo( - p_intf->p_sys->p_input->input.p_item, - _("Meta-information"), _(VLC_META_NOW_PLAYING) ); - if( psz_now_playing && *psz_now_playing ) - { - p_main_interface->statusbar->SetStatusText( - wxString(wxU(psz_now_playing)) + wxT( " - " ) + - wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); - } - else - { - p_main_interface->statusbar->SetStatusText( - wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); - } - free( psz_now_playing ); - - p_main_interface->TogglePlayButton( PLAYING_S ); -#ifdef wxHAS_TASK_BAR_ICON - if( p_main_interface->p_systray ) - { - p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing"))); - } -#endif - i_old_playing_status = PLAYING_S; - } - } - else if( p_intf->p_sys->p_input->b_dead ) - { - //controls auto-hide after a timer - p_main_interface->m_controls_timer.Start(200, wxTIMER_ONE_SHOT); - - p_main_interface->TogglePlayButton( PAUSE_S ); - i_old_playing_status = PAUSE_S; - - p_main_interface->statusbar->SetStatusText( wxT(""), 0 ); - p_main_interface->statusbar->SetStatusText( wxT(""), 2 ); - -#ifdef wxHAS_TASK_BAR_ICON - if( p_main_interface->p_systray ) - { - p_main_interface->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) ); - } -#endif - vlc_object_release( p_intf->p_sys->p_input ); - p_intf->p_sys->p_input = NULL; - } + /* Call update */ + msm->Update(); + vlc_value_t val; + input_thread_t *p_input = p_intf->p_sys->p_input; if( p_intf->p_sys->p_input ) { - input_thread_t *p_input = p_intf->p_sys->p_input; - vlc_value_t val; - - if( !p_input->b_die ) + if( !p_intf->p_sys->p_input->b_die ) { - 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; - - /* Update the item name */ - char *psz_now_playing = vlc_input_item_GetInfo( - p_intf->p_sys->p_input->input.p_item, - _("Meta-information"), _(VLC_META_NOW_PLAYING) ); - if( psz_now_playing && *psz_now_playing ) - { - p_main_interface->statusbar->SetStatusText( - wxString(wxU(psz_now_playing)) + wxT( " - " ) + - wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); - } - else - { - p_main_interface->statusbar->SetStatusText( - wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); - } - free( psz_now_playing ); - - /* Manage the slider */ - var_Get( p_input, "position", &pos ); - - var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); - if( val.i_int > 0 && !p_main_interface->disc_frame->IsShown() ) - { - vlc_value_t val; - - #define HELP_MENU N_("Menu") - #define HELP_PCH N_("Previous chapter") - #define HELP_NCH N_("Next chapter") - #define HELP_PTR N_("Previous track") - #define HELP_NTR N_("Next track") - - var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, - NULL ); - - if( val.i_int > 0 ) - { - p_main_interface->disc_menu_button->Show(); - p_main_interface->disc_sizer->Show( - p_main_interface->disc_menu_button ); - 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( - wxU(_( HELP_PCH ) ) ); - p_main_interface->disc_next_button->SetToolTip( - wxU(_( HELP_NCH ) ) ); - } - else - { - p_main_interface->disc_menu_button->Hide(); - p_main_interface->disc_sizer->Hide( - p_main_interface->disc_menu_button ); - - p_main_interface->disc_prev_button->SetToolTip( - wxU(_( HELP_PTR ) ) ); - p_main_interface->disc_next_button->SetToolTip( - wxU(_( HELP_NTR ) ) ); - } - - p_main_interface->ShowDiscFrame(); - } - else if( val.i_int == 0 && p_main_interface->disc_frame->IsShown() ) - { - p_main_interface->HideDiscFrame(); - } - - - if( pos.f_float > 0.0 && - !p_main_interface->slider_frame->IsShown() ) - { - /* Show the slider if it's position is significant */ - p_main_interface->ShowSlider(); - } - else if( pos.f_float <= 0.0 ) - { - p_main_interface->m_slider_timer.Start(200, wxTIMER_ONE_SHOT); - } - - if( p_intf->p_sys->b_playing && - p_main_interface->slider_frame->IsShown() ) - { - /* Update the slider if the user isn't dragging it. */ - if( p_intf->p_sys->b_slider_free ) - { - char psz_time[ MSTRTIME_MAX_SIZE ]; - char psz_total[ MSTRTIME_MAX_SIZE ]; - vlc_value_t time; - mtime_t i_seconds; - - /* Update the value */ - if( pos.f_float >= 0.0 ) - { - p_intf->p_sys->i_slider_pos = - (int)(SLIDER_MAX_POS * pos.f_float); - - p_main_interface->slider->SetValue( - p_intf->p_sys->i_slider_pos ); - - var_Get( p_intf->p_sys->p_input, "time", &time ); - i_seconds = time.i_time / 1000000; - secstotimestr ( psz_time, i_seconds ); - - var_Get( p_intf->p_sys->p_input, "length", &time ); - i_seconds = time.i_time / 1000000; - secstotimestr ( psz_total, i_seconds ); - - p_main_interface->statusbar->SetStatusText( - wxU(psz_time) + wxString(wxT(" / ")) + - wxU(psz_total), 0 ); - } - } - } - /* Take care of the volume, etc... */ p_main_interface->Update(); diff --git a/modules/gui/wxwidgets/timer.hpp b/modules/gui/wxwidgets/timer.hpp new file mode 100644 index 0000000000..19fe7d8e00 --- /dev/null +++ b/modules/gui/wxwidgets/timer.hpp @@ -0,0 +1,53 @@ +/***************************************************************************** + * timer.hpp: Timer headers + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * 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 "wxwidgets.hpp" + +namespace wxvlc +{ + class MainSliderManager; + class Interface; + + class Timer: public wxTimer + { + public: + /* Constructor */ + Timer( intf_thread_t *p_intf, Interface *p_main_interface ); + virtual ~Timer(); + + virtual void Notify(); + + private: + //use wxWindow::IsShown instead + //vlc_bool_t b_slider_shown; + //vlc_bool_t b_disc_shown; + intf_thread_t *p_intf; + Interface *p_main_interface; + vlc_bool_t b_init; + int i_old_playing_status; + int i_old_rate; + + MainSliderManager *msm; + }; + +} diff --git a/modules/gui/wxwidgets/video.cpp b/modules/gui/wxwidgets/video.cpp index d2e4f1c3a4..5ad983ce62 100644 --- a/modules/gui/wxwidgets/video.cpp +++ b/modules/gui/wxwidgets/video.cpp @@ -28,7 +28,8 @@ #include #include -#include "wxwidgets.h" +#include "video.hpp" +#include "interface.hpp" static void *GetWindow( intf_thread_t *p_intf, vout_thread_t *, int *pi_x_hint, int *pi_y_hint, @@ -49,40 +50,6 @@ enum ID_HIDE_TIMER }; -class VideoWindow: public wxWindow -{ -public: - /* Constructor */ - VideoWindow( intf_thread_t *_p_intf, wxWindow *p_parent ); - virtual ~VideoWindow(); - - void *GetWindow( vout_thread_t *p_vout, int *, int *, - unsigned int *, unsigned int * ); - void ReleaseWindow( void * ); - int ControlWindow( void *, int, va_list ); - - mtime_t i_creation_date; - -private: - intf_thread_t *p_intf; - vout_thread_t *p_vout; - wxWindow *p_parent; - vlc_mutex_t lock; - vlc_bool_t b_shown; - vlc_bool_t b_auto_size; - - wxWindow *p_child_window; - - wxTimer m_hide_timer; - - void UpdateSize( wxEvent& event ); - void UpdateHide( wxEvent& event ); - void OnControlEvent( wxCommandEvent& event ); - void OnHideTimer( wxTimerEvent& WXUNUSED(event)); - - DECLARE_EVENT_TABLE(); -}; - DEFINE_LOCAL_EVENT_TYPE( wxEVT_VLC_VIDEO ); BEGIN_EVENT_TABLE(VideoWindow, wxWindow) diff --git a/modules/gui/wxwidgets/video.hpp b/modules/gui/wxwidgets/video.hpp new file mode 100644 index 0000000000..09b64c48b1 --- /dev/null +++ b/modules/gui/wxwidgets/video.hpp @@ -0,0 +1,70 @@ +/***************************************************************************** + * video.hpp: Embedded video management + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_VIDEO_H_ +#define _WXVLC_VIDEO_H_ + +#include "wxwidgets.hpp" + +namespace wxvlc +{ + class VideoWindow: public wxWindow + { + public: + /* Constructor */ + VideoWindow( intf_thread_t *_p_intf, wxWindow *p_parent ); + virtual ~VideoWindow(); + + void *GetWindow( vout_thread_t *p_vout, int *, int *, + unsigned int *, unsigned int * ); + void ReleaseWindow( void * ); + int ControlWindow( void *, int, va_list ); + + mtime_t i_creation_date; + + private: + intf_thread_t *p_intf; + vout_thread_t *p_vout; + wxWindow *p_parent; + vlc_mutex_t lock; + vlc_bool_t b_shown; + vlc_bool_t b_auto_size; + + wxWindow *p_child_window; + + wxTimer m_hide_timer; + + void UpdateSize( wxEvent& event ); + void UpdateHide( wxEvent& event ); + void OnControlEvent( wxCommandEvent& event ); + void OnHideTimer( wxTimerEvent& WXUNUSED(event)); + + DECLARE_EVENT_TABLE(); + }; +}; + +/* Delegates - Todo: fix this (remove 1st, make 2nd method) */ +wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent ); +void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window ); + +#endif diff --git a/modules/gui/wxwidgets/wxwidgets.cpp b/modules/gui/wxwidgets/wxwidgets.cpp index ef9a718619..b901568027 100644 --- a/modules/gui/wxwidgets/wxwidgets.cpp +++ b/modules/gui/wxwidgets/wxwidgets.cpp @@ -36,7 +36,7 @@ # include #endif -#include "wxwidgets.h" +#include "interface.hpp" /* Temporary hack */ #if defined(WIN32) && defined(_WX_INIT_H_) diff --git a/modules/gui/wxwidgets/wxwidgets.h b/modules/gui/wxwidgets/wxwidgets.h deleted file mode 100644 index e97463f85d..0000000000 --- a/modules/gui/wxwidgets/wxwidgets.h +++ /dev/null @@ -1,1224 +0,0 @@ -/***************************************************************************** - * wxwidgets.h: private wxWindows interface description - ***************************************************************************** - * Copyright (C) 1999-2005 the VideoLAN team - * $Id$ - * - * 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. - *****************************************************************************/ - -#ifdef WIN32 /* mingw32 hack */ -#undef Yield -#undef CreateDialog -#endif - -#ifdef _MSC_VER -// turn off 'identifier was truncated to '255' characters in the debug info' -# pragma warning( disable:4786 ) -#endif - -/* Let vlc take care of the i18n stuff */ -#define WXINTL_NO_GETTEXT_MACRO - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vlc_keys.h" - -#if (!wxCHECK_VERSION(2,5,0)) -typedef long wxTreeItemIdValue; -#endif - -DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 ); -DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 ); - -#define SLIDER_MAX_POS 10000 - -/* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */ -#if defined( ENABLE_NLS ) -#if wxUSE_UNICODE -# define wxU(utf8) wxString(utf8, wxConvUTF8) -#else -# define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent) -#endif -#else // ENABLE_NLS -#if wxUSE_UNICODE -# define wxU(ansi) wxString(ansi, wxConvLocal) -#else -# define wxU(ansi) (ansi) -#endif -#endif - -/* wxL2U (locale to unicode) is used to convert ansi strings to unicode - * strings (wchar_t) */ -#define wxL2U(ansi) wxU(ansi) - -#if wxUSE_UNICODE -# define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str()) -# define wxLocaleFree(string) free(string) -#else -# define wxFromLocale(wxstring) FromLocale(wxstring.mb_str()) -# define wxLocaleFree(string) LocaleFree(string) -#endif - -#define WRAPCOUNT 80 - -#define OPEN_NORMAL 0 -#define OPEN_STREAM 1 - -#define MODE_NONE 0 -#define MODE_GROUP 1 -#define MODE_AUTHOR 2 -#define MODE_TITLE 3 - -enum{ - ID_CONTROLS_TIMER, - ID_SLIDER_TIMER, -}; - -class DialogsProvider; -class PrefsTreeCtrl; -class AutoBuiltPanel; -class VideoWindow; -class WindowSettings; - -/***************************************************************************** - * intf_sys_t: description and status of wxwindows interface - *****************************************************************************/ -struct intf_sys_t -{ - /* the wx parent window */ - wxWindow *p_wxwindow; - wxIcon *p_icon; - - /* window settings */ - WindowSettings *p_window_settings; - - /* special actions */ - vlc_bool_t b_playing; - vlc_bool_t b_intf_show; /* interface to be shown */ - - /* The input thread */ - input_thread_t * p_input; - - /* The slider */ - int i_slider_pos; /* slider position */ - int i_slider_oldpos; /* previous position */ - vlc_bool_t b_slider_free; /* slider status */ - - /* The messages window */ - msg_subscription_t* p_sub; /* message bank subscription */ - - /* Playlist management */ - int i_playing; /* playlist selected item */ - unsigned i_playlist_usage; - - /* Send an event to show a dialog */ - void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg, - intf_dialog_args_t *p_arg ); - - /* Popup menu */ - wxMenu *p_popup_menu; - - /* Hotkeys */ - int i_first_hotkey_event; - int i_hotkeys; - - /* Embedded vout */ - VideoWindow *p_video_window; - wxBoxSizer *p_video_sizer; - vlc_bool_t b_video_autosize; - - /* Aout */ - aout_instance_t *p_aout; -}; - -/***************************************************************************** - * Prototypes - *****************************************************************************/ -wxArrayString SeparateEntries( wxString ); -wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent ); -void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window ); -wxFrame *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ); -wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent ); - -namespace wxvlc -{ -class Interface; -class OpenDialog; -class SoutDialog; -class SubsFileDialog; -class Playlist; -class Messages; -class FileInfo; -class StreamDialog; -class WizardDialog; -class ItemInfoDialog; -class NewGroup; -class ExportPlaylist; - -/***************************************************************************** - * Classes declarations. - *****************************************************************************/ -/* Timer */ -class Timer: public wxTimer -{ -public: - /* Constructor */ - Timer( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~Timer(); - - virtual void Notify(); - -private: - //use wxWindow::IsShown instead - //vlc_bool_t b_slider_shown; - //vlc_bool_t b_disc_shown; - intf_thread_t *p_intf; - Interface *p_main_interface; - vlc_bool_t b_init; - int i_old_playing_status; - int i_old_rate; -}; - - -/* Extended panel */ -class ExtraPanel: public wxPanel -{ -public: - /* Constructor */ - ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~ExtraPanel(); - - wxStaticBox *adjust_box; - wxButton *restoredefaults_button; - wxSlider *brightness_slider; - wxSlider *contrast_slider; - wxSlider *saturation_slider; - wxSlider *hue_slider; - wxSlider *gamma_slider; - - wxStaticBox *other_box; - wxComboBox *ratio_combo; - - char *psz_bands; - float f_preamp; - vlc_bool_t b_update; - -private: - - wxPanel *VideoPanel( wxWindow * ); - wxPanel *EqzPanel( wxWindow * ); - wxPanel *AudioPanel( wxWindow * ); - - wxNotebook *notebook; - - wxCheckBox *eq_chkbox; - - wxCheckBox *eq_2p_chkbox; - - wxButton *eq_restoredefaults_button; - - wxSlider *smooth_slider; - wxStaticText *smooth_text; - - wxSlider *preamp_slider; - wxStaticText * preamp_text; - - int i_smooth; - wxWindow *p_parent; - - wxSlider *band_sliders[10]; - wxStaticText *band_texts[10]; - - int i_values[10]; - - void CheckAout(); - - /* Event handlers (these functions should _not_ be virtual) */ - - void OnEnableAdjust( wxCommandEvent& ); - void OnEnableEqualizer( wxCommandEvent& ); - void OnRestoreDefaults( wxCommandEvent& ); - void OnChangeEqualizer( wxScrollEvent& ); - void OnAdjustUpdate( wxScrollEvent& ); - void OnRatio( wxCommandEvent& ); - void OnFiltersInfo( wxCommandEvent& ); - void OnSelectFilter( wxCommandEvent& ); - - void OnEqSmooth( wxScrollEvent& ); - void OnPreamp( wxScrollEvent& ); - void OnEq2Pass( wxCommandEvent& ); - void OnEqRestore( wxCommandEvent& ); - - void OnHeadphone( wxCommandEvent& ); - void OnNormvol( wxCommandEvent& ); - void OnNormvolSlider( wxScrollEvent& ); - - void OnIdle( wxIdleEvent& ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - vlc_bool_t b_my_update; -}; - -#if 0 -/* Extended Window */ -class ExtraWindow: public wxFrame -{ -public: - /* Constructor */ - ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel ); - virtual ~ExtraWindow(); - -private: - - wxPanel *panel; - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; -}; -#endif - -/* Systray integration */ -#ifdef wxHAS_TASK_BAR_ICON -class Systray: public wxTaskBarIcon -{ -public: - 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 ); - void OnPrevStream ( wxCommandEvent& event ); - void OnNextStream ( wxCommandEvent& event ); - void OnExit( wxCommandEvent& event ); - Interface* p_main_interface; - intf_thread_t *p_intf; - DECLARE_EVENT_TABLE() -}; -#endif - -/* Main Interface */ -class Interface: public wxFrame -{ -public: - /* Constructor */ - Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE ); - virtual ~Interface(); - void Init(); - void TogglePlayButton( int i_playing_status ); - void Update(); - void PlayStream(); - void StopStream(); - void PrevStream(); - void NextStream(); - - wxBoxSizer *frame_sizer; - wxStatusBar *statusbar; - - void HideSlider(bool layout = true); - void ShowSlider(bool show = true, bool layout = true); - - wxSlider *slider; - wxWindow *slider_frame; - wxBoxSizer *slider_sizer; - wxPanel *extra_frame; - - void HideDiscFrame(bool layout = true); - void ShowDiscFrame(bool show = true, bool layout = true); - - wxPanel *disc_frame; - wxBoxSizer *disc_sizer; - wxBitmapButton *disc_menu_button; - wxBitmapButton *disc_prev_button; - wxBitmapButton *disc_next_button; - - wxFrame *extra_window; - - vlc_bool_t b_extra; - vlc_bool_t b_undock; - - wxControl *volctrl; - -#ifdef wxHAS_TASK_BAR_ICON - Systray *p_systray; -#endif - - wxTimer m_controls_timer; - wxTimer m_slider_timer; - -private: - void SetupHotkeys(); - void CreateOurMenuBar(); - void CreateOurToolBar(); - void CreateOurExtendedPanel(); - void CreateOurSlider(); - void Open( int i_access_method ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnControlsTimer(wxTimerEvent& WXUNUSED(event)); - void OnSliderTimer(wxTimerEvent& WXUNUSED(event)); - - void OnExit( wxCommandEvent& event ); - void OnAbout( wxCommandEvent& event ); - - void OnOpenFileSimple( wxCommandEvent& event ); - void OnOpenDir( wxCommandEvent& event ); - void OnOpenFile( wxCommandEvent& event ); - void OnOpenDisc( wxCommandEvent& event ); - void OnOpenNet( wxCommandEvent& event ); - void OnOpenSat( wxCommandEvent& event ); - - void OnExtended( wxCommandEvent& event ); - //void OnUndock( wxCommandEvent& event ); - - void OnBookmarks( wxCommandEvent& event ); - void OnShowDialog( wxCommandEvent& event ); - void OnPlayStream( wxCommandEvent& event ); - void OnStopStream( wxCommandEvent& event ); - void OnSliderUpdate( wxScrollEvent& event ); - void OnPrevStream( wxCommandEvent& event ); - void OnNextStream( wxCommandEvent& event ); - void OnSlowStream( wxCommandEvent& event ); - void OnFastStream( wxCommandEvent& event ); - - void OnDiscMenu( wxCommandEvent& event ); - void OnDiscPrev( wxCommandEvent& event ); - void OnDiscNext( wxCommandEvent& event ); - - void OnMenuOpen( wxMenuEvent& event ); - -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - void OnContextMenu2(wxContextMenuEvent& event); -#endif - void OnContextMenu(wxMouseEvent& event); - - void OnControlEvent( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - Timer *timer; - intf_thread_t *p_intf; - - wxWindow *video_window; - - int i_old_playing_status; - - /* For auto-generated menus */ - wxMenu *p_settings_menu; - wxMenu *p_audio_menu; - wxMenu *p_video_menu; - wxMenu *p_navig_menu; -}; - -/* Open Dialog */ -WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel); -class OpenDialog: public wxDialog -{ -public: - /* Constructor */ - OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, - int i_access_method, int i_arg = 0 ); - - /* Extended Contructor */ - OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, - int i_access_method, int i_arg = 0 , int _i_method = 0 ); - virtual ~OpenDialog(); - - int Show(); - int Show( int i_access_method, int i_arg = 0 ); - - void UpdateMRL(); - void UpdateMRL( int i_access_method ); - - wxArrayString mrl; - -private: - wxPanel *FilePanel( wxWindow* parent ); - wxPanel *DiscPanel( wxWindow* parent ); - wxPanel *NetPanel( wxWindow* parent ); - - ArrayOfAutoBuiltPanel input_tab_array; - - /* 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 ); - - /* Event handlers for the file page */ - void OnFilePanelChange( wxCommandEvent& event ); - void OnFileBrowse( wxCommandEvent& event ); - - /* Event handlers for the disc page */ - void OnDiscPanelChangeSpin( wxSpinEvent& event ); - void OnDiscPanelChange( wxCommandEvent& event ); - void OnDiscTypeChange( wxCommandEvent& event ); -#ifdef HAVE_LIBCDIO - void OnDiscProbe( wxCommandEvent& event ); -#endif - void OnDiscDeviceChange( wxCommandEvent& event ); - - /* Event handlers for the net page */ - void OnNetPanelChangeSpin( wxSpinEvent& event ); - void OnNetPanelChange( wxCommandEvent& event ); - void OnNetTypeChange( wxCommandEvent& event ); - - /* Event handlers for the stream output */ - void OnSubsFileEnable( wxCommandEvent& event ); - void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ); - - /* Event handlers for the stream output */ - void OnSoutEnable( wxCommandEvent& event ); - void OnSoutSettings( wxCommandEvent& WXUNUSED(event) ); - - /* Event handlers for the caching option */ - void OnCachingEnable( wxCommandEvent& event ); - void OnCachingChange( wxCommandEvent& event ); - void OnCachingChangeSpin( wxSpinEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxWindow *p_parent; - int i_current_access_method; - int i_disc_type_selection; - - int i_method; /* Normal or for the stream dialog ? */ - int i_open_arg; - - wxComboBox *mrl_combo; - wxNotebook *notebook; - - /* Controls for the file panel */ - wxComboBox *file_combo; - wxFileDialog *file_dialog; - - /* Controls for the disc panel */ - wxRadioBox *disc_type; - wxCheckBox *disc_probe; - wxTextCtrl *disc_device; - wxSpinCtrl *disc_title; int i_disc_title; - wxSpinCtrl *disc_chapter; int i_disc_chapter; - wxSpinCtrl *disc_sub; int i_disc_sub; - wxSpinCtrl *disc_audio; int i_disc_audio; - - /* The media equivalent name for a DVD names. For example, - * "Title", is "Track" for a CD-DA */ - wxStaticText *disc_title_label; - wxStaticText *disc_chapter_label; - wxStaticText *disc_sub_label; - wxStaticText *disc_audio_label; - - /* Indicates if the disc device control was modified */ - bool b_disc_device_changed; - - /* Controls for the net panel */ - wxRadioBox *net_type; - int i_net_type; - wxPanel *net_subpanels[4]; - wxRadioButton *net_radios[4]; - wxSpinCtrl *net_ports[4]; - int i_net_ports[4]; - wxTextCtrl *net_addrs[4]; - wxCheckBox *net_timeshift; - wxCheckBox *net_ipv6; - - /* Controls for the subtitles file */ - wxButton *subsfile_button; - wxCheckBox *subsfile_checkbox; - SubsFileDialog *subsfile_dialog; - wxArrayString subsfile_mrl; - - /* Controls for the stream output */ - wxButton *sout_button; - wxCheckBox *sout_checkbox; - SoutDialog *sout_dialog; - wxArrayString sout_mrl; - - /* Controls for the caching options */ - wxCheckBox *caching_checkbox; - wxSpinCtrl *caching_value; - int i_caching; -}; - -enum -{ - FILE_ACCESS = 0, - DISC_ACCESS, - NET_ACCESS, - - /* Auto-built panels */ - CAPTURE_ACCESS -}; -#define MAX_ACCESS CAPTURE_ACCESS - -/* Stream output Dialog */ -enum -{ - PLAY_ACCESS_OUT = 0, - FILE_ACCESS_OUT, - HTTP_ACCESS_OUT, - MMSH_ACCESS_OUT, - RTP_ACCESS_OUT, - UDP_ACCESS_OUT, - ACCESS_OUT_NUM -}; - -enum -{ - TS_ENCAPSULATION = 0, - PS_ENCAPSULATION, - MPEG1_ENCAPSULATION, - OGG_ENCAPSULATION, - ASF_ENCAPSULATION, - MP4_ENCAPSULATION, - MOV_ENCAPSULATION, - WAV_ENCAPSULATION, - RAW_ENCAPSULATION, - AVI_ENCAPSULATION, - ENCAPS_NUM -}; - -enum -{ - ANN_MISC_SOUT = 0, - TTL_MISC_SOUT, - MISC_SOUT_NUM -}; - -class SoutDialog: public wxDialog -{ -public: - /* Constructor */ - SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~SoutDialog(); - - wxArrayString GetOptions(); - -private: - void UpdateMRL(); - wxPanel *AccessPanel( wxWindow* parent ); - wxPanel *MiscPanel( wxWindow* parent ); - wxPanel *EncapsulationPanel( wxWindow* parent ); - wxPanel *TranscodingPanel( 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 ); - void OnFileDump( wxCommandEvent& event ); - - /* Event handlers for the net access output */ - void OnNetChange( wxCommandEvent& event ); - - /* Event specific to the announce address */ - void OnAnnounceGroupChange( wxCommandEvent& event ); - void OnAnnounceAddrChange( wxCommandEvent& event ); - - /* Event handlers for the encapsulation panel */ - void OnEncapsulationChange( wxCommandEvent& event ); - - /* Event handlers for the transcoding panel */ - void OnTranscodingEnable( wxCommandEvent& event ); - void OnTranscodingChange( wxCommandEvent& event ); - - /* Event handlers for the misc panel */ - void OnSAPMiscChange( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxWindow *p_parent; - - wxComboBox *mrl_combo; - - /* Controls for the access outputs */ - wxPanel *access_panel; - wxPanel *access_subpanels[ACCESS_OUT_NUM]; - wxCheckBox *access_checkboxes[ACCESS_OUT_NUM]; - - int i_access_type; - - wxComboBox *file_combo; - wxCheckBox *dump_checkbox; - wxSpinCtrl *net_ports[ACCESS_OUT_NUM]; - wxTextCtrl *net_addrs[ACCESS_OUT_NUM]; - - /* Controls for the SAP announces and TTL setting */ - wxPanel *misc_panel; - wxPanel *misc_subpanels[MISC_SOUT_NUM]; - wxCheckBox *sap_checkbox; - wxTextCtrl *announce_group; - wxTextCtrl *announce_addr; - wxSpinCtrl *ttl_spin; - - /* Controls for the encapsulation */ - wxPanel *encapsulation_panel; - wxRadioButton *encapsulation_radios[ENCAPS_NUM]; - int i_encapsulation_type; - - /* Controls for transcoding */ - wxPanel *transcoding_panel; - wxCheckBox *video_transc_checkbox; - wxComboBox *video_codec_combo; - wxComboBox *audio_codec_combo; - wxCheckBox *audio_transc_checkbox; - wxComboBox *video_bitrate_combo; - wxComboBox *audio_bitrate_combo; - wxComboBox *audio_channels_combo; - wxComboBox *video_scale_combo; - wxComboBox *subtitles_codec_combo; - wxCheckBox *subtitles_transc_checkbox; - wxCheckBox *subtitles_overlay_checkbox; - - /* Misc controls */ - wxCheckBox *sout_all_checkbox; -}; - -/* Subtitles File Dialog */ -class SubsFileDialog: public wxDialog -{ -public: - /* Constructor */ - SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~SubsFileDialog(); - - wxComboBox *file_combo; - wxComboBox *encoding_combo; - wxComboBox *size_combo; - wxComboBox *align_combo; - wxSpinCtrl *fps_spinctrl; - wxSpinCtrl *delay_spinctrl; - -private: - /* Event handlers (these functions should _not_ be virtual) */ - void OnOk( wxCommandEvent& event ); - void OnCancel( wxCommandEvent& event ); - void OnFileBrowse( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxWindow *p_parent; -}; - -/* Stream */ -class StreamDialog: public wxFrame -{ -public: - /* Constructor */ - StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~StreamDialog(); - -private: - void OnClose( wxCommandEvent& event ); - void OnOpen( wxCommandEvent& event ); - void OnSout( wxCommandEvent& event ); - void OnStart( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - - wxStaticText *step2_label; - wxStaticText *step3_label; - wxButton *sout_button; - wxButton *start_button; - wxArrayString mrl; - wxArrayString sout_mrl; - OpenDialog *p_open_dialog; - SoutDialog *p_sout_dialog; -}; - -/* Wizard */ -class WizardDialog : public wxWizard -{ -public: - /* Constructor */ - WizardDialog( intf_thread_t *, wxWindow *p_parent, char *, int, int ); - virtual ~WizardDialog(); - void SetTranscode( char const *vcodec, int vb, char const *acodec, int ab); - void SetMrl( const char *mrl ); - void SetTTL( int i_ttl ); - void SetPartial( int, int ); - void SetStream( char const *method, char const *address ); - void SetTranscodeOut( char const *address ); - void SetAction( int i_action ); - int GetAction(); - void SetSAP( bool b_enabled, const char *psz_name ); - void SetMux( char const *mux ); - void Run(); - int i_action; - char *method; - -protected: - int vb,ab; - int i_from, i_to, i_ttl; - char *vcodec , *acodec , *address , *mrl , *mux ; - char *psz_sap_name; - bool b_sap; - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; -}; - - -/* Preferences Dialog */ -class PrefsDialog: public wxFrame -{ -public: - /* Constructor */ - PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent ); - 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 ); - void OnResetAll( wxCommandEvent& event ); - void OnAdvanced( wxCommandEvent& event ); - void OnClose( wxCloseEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - - PrefsTreeCtrl *prefs_tree; -}; - -/* Messages */ -class Messages: public wxFrame -{ -public: - /* Constructor */ - Messages( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~Messages(); - bool Show( bool show = TRUE ); - void UpdateLog(); - -private: - /* Event handlers (these functions should _not_ be virtual) */ - void OnButtonClose( wxCommandEvent& event ); - void OnClose( wxCloseEvent& WXUNUSED(event) ); - void OnClear( wxCommandEvent& event ); - void OnSaveLog( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxTextCtrl *textctrl; - wxTextAttr *info_attr; - wxTextAttr *err_attr; - wxTextAttr *warn_attr; - wxTextAttr *dbg_attr; - - wxFileDialog *save_log_dialog; - - vlc_bool_t b_verbose; -}; - -/* Playlist */ -class Playlist: public wxFrame -{ -public: - /* Constructor */ - Playlist( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~Playlist(); - - void UpdatePlaylist(); - void ShowPlaylist( bool show ); - void UpdateItem( int ); - void AppendItem( wxCommandEvent& ); - - bool b_need_update; - int i_items_to_append; - -private: - void RemoveItem( int ); - void DeleteTreeItem( wxTreeItemId ); - void DeleteItem( int item ); - void DeleteNode( playlist_item_t *node ); - - void RecursiveDeleteSelection( wxTreeItemId ); - - /* Event handlers (these functions should _not_ be virtual) */ - - /* Menu Handlers */ - void OnAddFile( wxCommandEvent& event ); - void OnAddDir( wxCommandEvent& event ); - void OnAddMRL( wxCommandEvent& event ); - void OnMenuClose( wxCommandEvent& event ); - void OnClose( wxCloseEvent& WXUNUSED(event) ); - - void OnDeleteSelection( wxCommandEvent& event ); - - void OnOpen( wxCommandEvent& event ); - void OnSave( wxCommandEvent& event ); - - /* Search (user) */ - void OnSearch( wxCommandEvent& event ); - /*void OnSearchTextChange( wxCommandEvent& event );*/ - wxTextCtrl *search_text; - wxButton *search_button; - wxTreeItemId search_current; - - void OnEnDis( wxCommandEvent& event ); - - /* Sort */ - int i_sort_mode; - void OnSort( wxCommandEvent& event ); - int i_title_sorted; - int i_group_sorted; - int i_duration_sorted; - - /* Dynamic menus */ - void OnMenuEvent( wxCommandEvent& event ); - void OnMenuOpen( wxMenuEvent& event ); - wxMenu *p_view_menu; - wxMenu *p_sd_menu; - wxMenu *ViewMenu(); - wxMenu *SDMenu(); - - void OnUp( wxCommandEvent& event); - void OnDown( wxCommandEvent& event); - - void OnRandom( wxCommandEvent& event ); - void OnRepeat( wxCommandEvent& event ); - void OnLoop ( wxCommandEvent& event ); - - void OnActivateItem( wxTreeEvent& event ); - void OnKeyDown( wxTreeEvent& event ); - void OnNewGroup( wxCommandEvent& event ); - - /* Popup */ - wxMenu *item_popup; - wxMenu *node_popup; - wxTreeItemId i_wx_popup_item; - int i_popup_item; - int i_popup_parent; - void OnPopup( wxContextMenuEvent& event ); - void OnPopupPlay( wxCommandEvent& event ); - void OnPopupPreparse( wxCommandEvent& event ); - void OnPopupSort( wxCommandEvent& event ); - void OnPopupDel( wxCommandEvent& event ); - void OnPopupEna( wxCommandEvent& event ); - void OnPopupInfo( wxCommandEvent& event ); - void Rebuild( vlc_bool_t ); - - void Preparse(); - - /* Update */ - void UpdateNode( playlist_item_t*, wxTreeItemId ); - void UpdateNodeChildren( playlist_item_t*, wxTreeItemId ); - void CreateNode( playlist_item_t*, wxTreeItemId ); - void UpdateTreeItem( wxTreeItemId ); - - /* Search (internal) */ - int CountItems( wxTreeItemId); - wxTreeItemId FindItem( wxTreeItemId, int ); - wxTreeItemId FindItemByName( wxTreeItemId, wxString, - wxTreeItemId, vlc_bool_t *); - - wxTreeItemId saved_tree_item; - int i_saved_id; - - playlist_t *p_playlist; - - - /* Custom events */ - void OnPlaylistEvent( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); - - - /* Global widgets */ - wxStatusBar *statusbar; - ItemInfoDialog *iteminfo_dialog; - - int i_update_counter; - - intf_thread_t *p_intf; - wxTreeCtrl *treectrl; - int i_current_view; - vlc_bool_t b_changed_view; - char **pp_sds; - - -}; - -/* ItemInfo Dialog */ -class ItemInfoDialog: public wxDialog -{ -public: - /* Constructor */ - ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item, - wxWindow *p_parent ); - virtual ~ItemInfoDialog(); - - wxArrayString GetOptions(); - -private: - wxPanel *InfoPanel( wxWindow* parent ); - wxPanel *GroupPanel( wxWindow* parent ); - - /* Event handlers (these functions should _not_ be virtual) */ - void OnOk( wxCommandEvent& event ); - void OnCancel( wxCommandEvent& event ); - - void UpdateInfo(); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - playlist_item_t *p_item; - wxWindow *p_parent; - - /* Controls for the iteminfo dialog box */ - wxPanel *info_subpanel; - wxPanel *info_panel; - - wxPanel *group_subpanel; - wxPanel *group_panel; - - wxTextCtrl *uri_text; - wxTextCtrl *name_text; - - wxTreeCtrl *info_tree; - wxTreeItemId info_root; - -}; - - -/* File Info */ -class FileInfo: public wxFrame -{ -public: - /* Constructor */ - FileInfo( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~FileInfo(); - void UpdateFileInfo(); - - vlc_bool_t b_need_update; - -private: - void OnButtonClose( wxCommandEvent& event ); - void OnClose( wxCloseEvent& WXUNUSED(event) ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxTreeCtrl *fileinfo_tree; - wxTreeItemId fileinfo_root; - wxString fileinfo_root_label; - -}; - -/* Update VLC */ -class UpdateVLC: public wxFrame -{ -public: - /* Constructor */ - UpdateVLC( intf_thread_t *p_intf, wxWindow *p_parent ); - virtual ~UpdateVLC(); - -private: - void OnButtonClose( wxCommandEvent& event ); - void OnClose( wxCloseEvent& WXUNUSED(event) ); - void GetData(); - void OnCheckForUpdate( wxCommandEvent& event ); - void OnMirrorChoice( wxCommandEvent& event ); - void UpdateUpdatesTree(); - void UpdateMirrorsChoice(); - void OnUpdatesTreeActivate( wxTreeEvent& event ); - void DownloadFile( wxString url, wxString dst ); - - DECLARE_EVENT_TABLE(); - - intf_thread_t *p_intf; - wxTreeCtrl *updates_tree; - wxTreeItemId updates_root; - - wxChoice *mirrors_choice; - - wxString release_type; /* could be "stable", "test", "nightly" ... */ - - struct update_file_t - { - wxString type; - wxString md5; - wxString size; - wxString url; - wxString description; - }; - - struct update_version_t - { - wxString type; - wxString major; - wxString minor; - wxString revision; - wxString extra; - std::list m_files; - }; - - std::list m_versions; - - struct update_mirror_t - { - wxString name; - wxString location; - wxString type; - wxString base_url; - }; - - std::list m_mirrors; -}; - -#if wxUSE_DRAG_AND_DROP -/* Drag and Drop class */ -class DragAndDrop: public wxFileDropTarget -{ -public: - DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE ); - - virtual bool OnDropFiles( wxCoord x, wxCoord y, - const wxArrayString& filenames ); - -private: - intf_thread_t *p_intf; - vlc_bool_t b_enqueue; -}; -#endif -} // end of wxvlc namespace - -/* */ -class WindowSettings -{ -public: - WindowSettings( intf_thread_t *_p_intf ); - virtual ~WindowSettings(); - enum - { - ID_SCREEN = -1, - ID_MAIN, - ID_PLAYLIST, - ID_MESSAGES, - ID_FILE_INFO, - ID_BOOKMARKS, - ID_VIDEO, - - ID_MAX, - }; - - void SetSettings( int id, bool _b_shown, - wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize ); - bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s ); - - void SetScreen( int i_screen_w, int i_screen_h ); - -private: - intf_thread_t *p_intf; - - int i_screen_w; - int i_screen_h; - bool b_valid[ID_MAX]; - bool b_shown[ID_MAX]; - wxPoint position[ID_MAX]; - wxSize size[ID_MAX]; -}; - -/* Menus */ -void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& ); -wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); -wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); -wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); -wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL ); - -namespace wxvlc -{ -class MenuEvtHandler : public wxEvtHandler -{ -public: - MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface ); - virtual ~MenuEvtHandler(); - - void OnMenuEvent( wxCommandEvent& event ); - void OnShowDialog( wxCommandEvent& event ); - -private: - - DECLARE_EVENT_TABLE() - - intf_thread_t *p_intf; - Interface *p_main_interface; -}; - -} // end of wxvlc namespace - - -/* - * wxWindows keeps dead locking because the timer tries to lock the playlist - * when it's already locked somewhere else in the very wxWindows interface - * module. Unless someone implements a "vlc_mutex_trylock", we need that. - */ -inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl ) -{ - if( p_sys->i_playlist_usage++ == 0) - vlc_mutex_lock( &p_pl->object_lock ); -} - -inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl ) -{ - if( --p_sys->i_playlist_usage == 0) - vlc_mutex_unlock( &p_pl->object_lock ); -} - -using namespace wxvlc; - diff --git a/modules/gui/wxwidgets/wxwidgets.hpp b/modules/gui/wxwidgets/wxwidgets.hpp new file mode 100644 index 0000000000..4040cc9a01 --- /dev/null +++ b/modules/gui/wxwidgets/wxwidgets.hpp @@ -0,0 +1,194 @@ +/***************************************************************************** + * wxwidgets.hpp: Common headers for the wxwidges interface + ***************************************************************************** + * Copyright (C) 1999-2005 the VideoLAN team + * $Id: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin $ + * + * 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. + *****************************************************************************/ + +#ifndef _WXVLC_WIDGETS_H_ +#define _WXVLC_WIDGETS_H_ + +#ifdef WIN32 /* mingw32 hack */ +#undef Yield +#undef CreateDialog +#endif + +#ifdef _MSC_VER +// turn off 'identifier was truncated to '255' characters in the debug info' +# pragma warning( disable:4786 ) +#endif + +/* Let vlc take care of the i18n stuff */ +#define WXINTL_NO_GETTEXT_MACRO + +#include +#include + +#include +#define SLIDER_MAX_POS 10000 + +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vlc_keys.h" +*/ +#if (!wxCHECK_VERSION(2,5,0)) +typedef long wxTreeItemIdValue; +#endif + +DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 ); +DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 ); + +/*************************************************************************** + * I18N macros + ***************************************************************************/ + +/* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */ +#if defined( ENABLE_NLS ) +#if wxUSE_UNICODE +# define wxU(utf8) wxString(utf8, wxConvUTF8) +#else +# define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent) +#endif +#else // ENABLE_NLS +#if wxUSE_UNICODE +# define wxU(ansi) wxString(ansi, wxConvLocal) +#else +# define wxU(ansi) (ansi) +#endif +#endif + +/* wxL2U (locale to unicode) is used to convert ansi strings to unicode + * strings (wchar_t) */ +#define wxL2U(ansi) wxU(ansi) + +#if wxUSE_UNICODE +# define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str()) +# define wxLocaleFree(string) free(string) +#else +# define wxFromLocale(wxstring) FromLocale(wxstring.mb_str()) +# define wxLocaleFree(string) LocaleFree(string) +#endif + + +#define WRAPCOUNT 80 + +#define OPEN_NORMAL 0 +#define OPEN_STREAM 1 + +enum +{ + ID_CONTROLS_TIMER, + ID_SLIDER_TIMER, +}; + +namespace wxvlc { + class WindowSettings; + class VideoWindow; +}; + +using namespace wxvlc; + +class DialogsProvider; +class PrefsTreeCtrl; +class AutoBuiltPanel; + +/***************************************************************************** + * intf_sys_t: description and status of wxwindows interface + *****************************************************************************/ +struct intf_sys_t +{ + /* the wx parent window */ + wxWindow *p_wxwindow; + wxIcon *p_icon; + + /* window settings */ + WindowSettings *p_window_settings; + + /* special actions */ + vlc_bool_t b_playing; + vlc_bool_t b_intf_show; /* interface to be shown */ + + /* The input thread */ + input_thread_t * p_input; + + /* The slider */ + int i_slider_pos; /* slider position */ + int i_slider_oldpos; /* previous position */ + vlc_bool_t b_slider_free; /* slider status */ + + /* The messages window */ + msg_subscription_t* p_sub; /* message bank subscription */ + + /* Playlist management */ + int i_playing; /* playlist selected item */ + unsigned i_playlist_usage; + + /* Send an event to show a dialog */ + void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg, + intf_dialog_args_t *p_arg ); + + /* Popup menu */ + wxMenu *p_popup_menu; + + /* Hotkeys */ + int i_first_hotkey_event; + int i_hotkeys; + + /* Embedded vout */ + VideoWindow *p_video_window; + wxBoxSizer *p_video_sizer; + vlc_bool_t b_video_autosize; + + /* Aout */ + aout_instance_t *p_aout; +}; + + + +wxArrayString SeparateEntries( wxString ); +wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent ); + +/* + * wxWindows keeps dead locking because the timer tries to lock the playlist + * when it's already locked somewhere else in the very wxWindows interface + * module. Unless someone implements a "vlc_mutex_trylock", we need that. + */ +inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl ) +{ + if( p_sys->i_playlist_usage++ == 0) + vlc_mutex_lock( &p_pl->object_lock ); +} + +inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl ) +{ + if( --p_sys->i_playlist_usage == 0) + vlc_mutex_unlock( &p_pl->object_lock ); +} + +#endif