Commit d63b9e39 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwidgets: start of a playlist_manager widget.

   This is based on code from the current playlist dialog but this dialog should eventually make use of the widget as well (when enough features have been implemented).
parent 2c366250
......@@ -9,6 +9,7 @@ SOURCES_wxwidgets = \
timer.cpp \
video.cpp \
input_manager.cpp \
playlist_manager.cpp \
dialogs.cpp \
dialogs/open.cpp \
dialogs/streamout.cpp \
......@@ -41,6 +42,7 @@ EXTRA_DIST += \
timer.hpp \
video.hpp \
input_manager.hpp \
playlist_manager.hpp \
dialogs/fileinfo.hpp \
dialogs/preferences.hpp \
dialogs/wizard.hpp \
......@@ -67,6 +69,7 @@ EXTRA_DIST += \
bitmaps/next.xpm \
bitmaps/pause.xpm \
bitmaps/playlist.xpm \
bitmaps/playlist_small.xpm \
bitmaps/play.xpm \
bitmaps/prev.xpm \
bitmaps/repeat.xpm \
......
/* XPM */
static char * playlist_small_xpm[] = {
"16 16 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" .. ....... ",
" ",
" .. ....... ",
" ",
" .. ....... ",
" ",
" .. ....... ",
" ",
" ",
" "};
......@@ -25,6 +25,7 @@
* Preamble
*****************************************************************************/
#include "interface.hpp"
#include "playlist_manager.hpp"
#include "extrapanel.hpp"
#include "timer.hpp"
#include "video.hpp"
......@@ -45,6 +46,7 @@
#include "bitmaps/slow.xpm"
#include "bitmaps/fast.xpm"
#include "bitmaps/playlist.xpm"
#include "bitmaps/playlist_small.xpm"
#include "bitmaps/speaker.xpm"
#include "bitmaps/speaker_mute.xpm"
......@@ -134,6 +136,7 @@ enum
Wizard_Event,
Playlist_Event,
PlaylistSmall_Event,
Logs_Event,
FileInfo_Event,
......@@ -167,6 +170,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU(VLM_Event, Interface::OnShowDialog)
EVT_MENU(Playlist_Event, Interface::OnShowDialog)
EVT_MENU(PlaylistSmall_Event, Interface::OnSmallPlaylist)
EVT_MENU(Logs_Event, Interface::OnShowDialog)
EVT_MENU(FileInfo_Event, Interface::OnShowDialog)
EVT_MENU(Prefs_Event, Interface::OnShowDialog)
......@@ -215,6 +219,8 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
p_intf = _p_intf;
b_extra = VLC_FALSE;
extra_frame = 0;
b_playlist_manager = VLC_FALSE;
playlist_manager = 0;
/* Give our interface a nice little icon */
SetIcon( wxIcon( vlc_xpm ) );
......@@ -348,6 +354,8 @@ void Interface::Update()
{
/* Misc updates */
((VLCVolCtrl *)volctrl)->UpdateVolume();
if( playlist_manager ) playlist_manager->Update();
}
void Interface::OnControlEvent( wxCommandEvent& event )
......@@ -490,6 +498,7 @@ void Interface::CreateOurToolBar()
#define HELP_PLAY N_("Play")
#define HELP_PAUSE N_("Pause")
#define HELP_PLO N_("Playlist")
#define HELP_SPLO N_("Small playlist")
#define HELP_PLP N_("Previous playlist item")
#define HELP_PLN N_("Next playlist item")
#define HELP_SLOW N_("Play slower")
......@@ -533,15 +542,15 @@ void Interface::CreateOurToolBar()
toolbar->AddSeparator();
toolbar->AddTool( Playlist_Event, wxT(""), wxBitmap( playlist_xpm ),
wxU(_(HELP_PLO)) );
toolbar->AddTool( PlaylistSmall_Event, wxT(""),
wxBitmap( playlist_small_xpm ), wxU(_(HELP_SPLO)) );
}
#if !( (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 6) && (wxRELEASE_NUMBER < 2) )
wxControl *p_dummy_ctrl =
new wxControl( toolbar, -1, wxDefaultPosition,
wxSize(35, 16 ), wxBORDER_NONE );
wxSize(16, 16 ), wxBORDER_NONE );
toolbar->AddControl( p_dummy_ctrl );
#endif
volctrl = new VLCVolCtrl( p_intf, toolbar );
toolbar->AddControl( volctrl );
......@@ -658,6 +667,13 @@ void Interface::SetIntfMinSize()
ms.SetWidth( ext_min_size.GetWidth() );
}
if( playlist_manager && playlist_manager->IsShown() )
{
ms.SetHeight( ms.GetHeight() + playlist_min_size.GetHeight() );
if( playlist_min_size.GetWidth() > ms.GetWidth() )
ms.SetWidth( playlist_min_size.GetWidth() );
}
SetSizeHints( ms );
}
......@@ -837,6 +853,26 @@ void Interface::OnExtended( wxCommandEvent& WXUNUSED(event) )
main_sizer->Fit( this );
}
void Interface::OnSmallPlaylist( wxCommandEvent& WXUNUSED(event) )
{
UpdateVideoWindow( p_intf, video_window );
if( !playlist_manager )
{
/* Create the extra panel */
playlist_manager = new PlaylistManager( p_intf, main_panel );
panel_sizer->Add( playlist_manager, 0, wxEXPAND , 0 );
playlist_min_size = playlist_manager->GetBestSize();
}
b_playlist_manager = !b_playlist_manager;
panel_sizer->Show( playlist_manager, b_playlist_manager );
SetIntfMinSize();
main_sizer->Layout();
main_sizer->Fit( this );
}
void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{
PlayStream();
......
......@@ -100,9 +100,6 @@ namespace wxvlc
InputManager *input_manager;
vlc_bool_t b_extra;
wxPanel *extra_frame;
wxControl *volctrl;
#ifdef wxHAS_TASK_BAR_ICON
......@@ -132,6 +129,7 @@ namespace wxvlc
void OnOpenSat( wxCommandEvent& event );
void OnExtended( wxCommandEvent& event );
void OnSmallPlaylist( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
......@@ -164,8 +162,17 @@ namespace wxvlc
wxMenu *p_video_menu;
wxMenu *p_navig_menu;
/* Extended panel */
vlc_bool_t b_extra;
wxPanel *extra_frame;
/* Playlist panel */
vlc_bool_t b_playlist_manager;
wxPanel *playlist_manager;
/* Utility dimensions */
wxSize main_min_size;
wxSize playlist_min_size;
wxSize ext_min_size;
};
......
This diff is collapsed.
/*****************************************************************************
* playlist_manager.hpp: Header for the playlist manager
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id$
*
* Authors: Clment Stenac <zorglub@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
*
* 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_MANAGER_H_
#define _WXVLC_PLAYLIST_MANAGER_H_
#include "wxwidgets.hpp"
#include <wx/treectrl.h>
namespace wxvlc
{
/* PlaylistManager */
class PlaylistManager: public wxPanel
{
public:
/* Constructor */
PlaylistManager( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~PlaylistManager();
void Update();
bool b_need_update;
int i_items_to_append;
private:
DECLARE_EVENT_TABLE();
/* Update */
void Rebuild( vlc_bool_t );
void CreateNode( playlist_item_t*, wxTreeItemId );
void UpdateNode( playlist_item_t*, wxTreeItemId );
void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
void UpdateTreeItem( wxTreeItemId );
void UpdateItem( int );
void AppendItem( wxCommandEvent& );
void RemoveItem( int );
wxTreeItemId FindItem( wxTreeItemId, int );
/* Events */
void OnActivateItem( wxTreeEvent& event );
/* Custom events */
void OnPlaylistEvent( wxCommandEvent& event );
/* Simple cache for FindItem() */
int i_cached_item_id;
wxTreeItemId cached_item;
intf_thread_t *p_intf;
playlist_t *p_playlist;
wxTreeCtrl *treectrl;
wxSizer *sizer;
int i_update_counter;
};
} // end of wxvlc namespace
#endif
......@@ -98,12 +98,7 @@ void Timer::Notify()
/* Call update */
p_main_interface->input_manager->Update();
if( p_main_interface->input_manager->IsPlaying() )
{
/* Take care of the volume, etc... */
p_main_interface->Update();
}
p_main_interface->Update();
/* Show the interface, if requested */
if( p_intf->p_sys->b_intf_show )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment