Commit b09db111 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*:

   + bookmarks menu.
   + started work on bookmarks dialog.
   + started support for embeddable vout (via vout_RequestWindow()/vout_ReleaseWindow()).   
   + new --wxwin-bookmarks and --wxwin-embed config options.
parent e6b4ae3e
...@@ -16,6 +16,8 @@ SOURCES_wxwindows = \ ...@@ -16,6 +16,8 @@ SOURCES_wxwindows = \
timer.cpp \ timer.cpp \
fileinfo.cpp \ fileinfo.cpp \
subtitles.cpp \ subtitles.cpp \
bookmarks.cpp \
video.cpp \
v4l.cpp \ v4l.cpp \
$(NULL) $(NULL)
......
/*****************************************************************************
* bookmarks.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id: bookmarks.cpp 6961 2004-03-05 17:34:23Z sam $
*
* Authors: 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "wxwindows.h"
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
/* menu items */
ButtonAdd_Event = wxID_HIGHEST + 1,
ButtonDel_Event
};
BEGIN_EVENT_TABLE(BookmarksDialog, wxFrame)
/* Hide the window when the user closes the window */
EVT_CLOSE(BookmarksDialog::OnClose )
EVT_BUTTON( ButtonAdd_Event, BookmarksDialog::OnAdd )
EVT_BUTTON( ButtonDel_Event, BookmarksDialog::OnDel )
EVT_LIST_ITEM_ACTIVATED( -1, BookmarksDialog::OnActivateItem )
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf, wxWindow *p_parent )
: wxFrame( p_parent->GetParent() ? p_parent->GetParent() : p_parent,
-1, wxU(_("Bookmarks")),
!p_parent->GetParent() ? wxDefaultPosition :
wxPoint( p_parent->GetParent()->GetRect().GetX(),
p_parent->GetParent()->GetRect().GetY() +
p_parent->GetParent()->GetRect().GetHeight() + 40 ),
!p_parent->GetParent() ? wxDefaultSize :
wxSize( p_parent->GetParent()->GetRect().GetWidth(), -1 ),
wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT )
{
/* Initializations */
p_intf = _p_intf;
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
wxPanel *panel = new wxPanel( this, -1 );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
wxButton *button_add =
new wxButton( panel, ButtonAdd_Event, wxU(_("Add")) );
wxButton *button_del =
new wxButton( panel, ButtonDel_Event, wxU(_("Remove")) );
panel_sizer->Add( button_add, 0, wxEXPAND );
panel_sizer->Add( button_del, 0, wxEXPAND );
panel->SetSizerAndFit( panel_sizer );
list_ctrl = new wxListView( this, -1, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER |
wxLC_SINGLE_SEL );
list_ctrl->InsertColumn( 0, wxU(_("Description")) );
list_ctrl->SetColumnWidth( 0, 240 );
list_ctrl->InsertColumn( 1, wxU(_("Size offset")) );
list_ctrl->InsertColumn( 2, wxU(_("Time offset")) );
sizer->Add( panel, 0, wxEXPAND | wxALL, 5 );
sizer->Add( list_ctrl, 1, wxEXPAND | wxALL, 5 );
SetSizer( sizer );
}
BookmarksDialog::~BookmarksDialog()
{
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void BookmarksDialog::Update()
{
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( !p_input ) return;
seekpoint_t **pp_bookmarks;
int i_bookmarks;
if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
&i_bookmarks ) != VLC_SUCCESS )
{
vlc_object_release( p_input );
return;
}
list_ctrl->DeleteAllItems();
for( int i = 0; i < i_bookmarks; i++ )
{
list_ctrl->InsertItem( i, wxL2U( pp_bookmarks[i]->psz_name ) );
list_ctrl->SetItem( i, 1, wxString::Format(wxT("%i"),
pp_bookmarks[i]->i_byte_offset ) );
list_ctrl->SetItem( i, 2, wxString::Format(wxT("%i"),
pp_bookmarks[i]->i_time_offset/1000000 ) );
}
vlc_object_release( p_input );
}
bool BookmarksDialog::Show( bool show )
{
Update();
return wxFrame::Show( show );
}
void BookmarksDialog::OnClose( wxCommandEvent& event )
{
Hide();
}
void BookmarksDialog::OnAdd( wxCommandEvent& event )
{
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( !p_input ) return;
seekpoint_t bookmark;
vlc_value_t pos;
var_Get( p_input, "position", &pos );
bookmark.psz_name = NULL;
bookmark.i_byte_offset =
(pos.f_float * p_input->stream.p_selected_area->i_size);
var_Get( p_input, "time", &pos );
bookmark.i_time_offset = pos.i_time;
input_Control( p_input, INPUT_ADD_BOOKMARK, &bookmark );
vlc_object_release( p_input );
Update();
}
void BookmarksDialog::OnDel( wxCommandEvent& event )
{
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( !p_input ) return;
int i_focused = list_ctrl->GetFocusedItem();
if( i_focused >= 0 )
{
input_Control( p_input, INPUT_DEL_BOOKMARK, i_focused );
}
vlc_object_release( p_input );
Update();
}
void BookmarksDialog::OnActivateItem( wxListEvent& event )
{
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( !p_input ) return;
input_Control( p_input, INPUT_SET_BOOKMARK, event.GetIndex() );
vlc_object_release( p_input );
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dialogs.cpp : wxWindows plugin for vlc * dialogs.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id: dialogs.cpp,v 1.16 2004/03/01 18:31:13 gbazin Exp $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -64,6 +64,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -64,6 +64,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnStreamWizardDialog) DialogsProvider::OnStreamWizardDialog)
EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
DialogsProvider::OnFileInfo) DialogsProvider::OnFileInfo)
EVT_COMMAND(INTF_DIALOG_BOOKMARKS, wxEVT_DIALOG,
DialogsProvider::OnBookmarks)
EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnPopupMenu) DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
...@@ -86,6 +88,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -86,6 +88,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
p_prefs_dialog = NULL; p_prefs_dialog = NULL;
p_file_generic_dialog = NULL; p_file_generic_dialog = NULL;
p_streamwizard_dialog = NULL; p_streamwizard_dialog = NULL;
p_bookmarks_dialog = NULL;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
...@@ -93,6 +96,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -93,6 +96,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
/* Create the messages dialog so it can begin storing logs */ /* Create the messages dialog so it can begin storing logs */
p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this ); p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
/* Check if user wants to show the bookmarks dialog by default */
wxCommandEvent dummy_event;
if( config_GetInt( p_intf, "wxwin-bookmarks" ) )
OnBookmarks( dummy_event );
/* Intercept all menu events in our custom event handler */ /* Intercept all menu events in our custom event handler */
PushEventHandler( new MenuEvtHandler( p_intf, NULL ) ); PushEventHandler( new MenuEvtHandler( p_intf, NULL ) );
} }
...@@ -108,6 +116,7 @@ DialogsProvider::~DialogsProvider() ...@@ -108,6 +116,7 @@ DialogsProvider::~DialogsProvider()
if( p_fileinfo_dialog ) delete p_fileinfo_dialog; if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
if( p_file_generic_dialog ) delete p_file_generic_dialog; if( p_file_generic_dialog ) delete p_file_generic_dialog;
if( p_streamwizard_dialog ) delete p_streamwizard_dialog; if( p_streamwizard_dialog ) delete p_streamwizard_dialog;
if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon; if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
...@@ -194,6 +203,18 @@ void DialogsProvider::OnStreamWizardDialog( wxCommandEvent& WXUNUSED(event) ) ...@@ -194,6 +203,18 @@ void DialogsProvider::OnStreamWizardDialog( wxCommandEvent& WXUNUSED(event) )
} }
} }
void DialogsProvider::OnBookmarks( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
if( !p_bookmarks_dialog )
p_bookmarks_dialog = new BookmarksDialog( p_intf, this );
if( p_bookmarks_dialog )
{
p_bookmarks_dialog->Show( !p_bookmarks_dialog->IsShown() );
}
}
void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event ) void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
{ {
intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData(); intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004, 2003 VideoLAN * Copyright (C) 2000-2004, 2003 VideoLAN
* $Id: interface.cpp,v 1.87 2004/03/01 18:31:13 gbazin Exp $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -105,6 +105,8 @@ END_EVENT_TABLE() ...@@ -105,6 +105,8 @@ END_EVENT_TABLE()
* Event Table. * Event Table.
*****************************************************************************/ *****************************************************************************/
DEFINE_LOCAL_EVENT_TYPE( wxEVT_INTF );
/* IDs for the controls and the menu commands */ /* IDs for the controls and the menu commands */
enum enum
{ {
...@@ -127,7 +129,8 @@ enum ...@@ -127,7 +129,8 @@ enum
FileInfo_Event, FileInfo_Event,
Prefs_Event, Prefs_Event,
Extra_Event, Extended_Event,
Bookmarks_Event,
Skins_Event, Skins_Event,
SliderScroll_Event, SliderScroll_Event,
...@@ -166,9 +169,10 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -166,9 +169,10 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU_OPEN(Interface::OnMenuOpen) EVT_MENU_OPEN(Interface::OnMenuOpen)
EVT_MENU( Extra_Event, Interface::OnExtra) EVT_MENU( Extended_Event, Interface::OnExtended)
EVT_CHECKBOX( Adjust_Event, Interface::OnEnableAdjust) EVT_MENU( Bookmarks_Event, Interface::OnShowDialog)
EVT_CHECKBOX( Adjust_Event, Interface::OnEnableAdjust)
EVT_TEXT( Ratio_Event, Interface::OnRatio) EVT_TEXT( Ratio_Event, Interface::OnRatio)
EVT_CHECKBOX( Visual_Event, Interface::OnEnableVisual) EVT_CHECKBOX( Visual_Event, Interface::OnEnableVisual)
...@@ -201,6 +205,9 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -201,6 +205,9 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_COMMAND_SCROLL(Saturation_Event, Interface::OnSaturationUpdate) EVT_COMMAND_SCROLL(Saturation_Event, Interface::OnSaturationUpdate)
EVT_COMMAND_SCROLL(Gamma_Event, Interface::OnGammaUpdate) EVT_COMMAND_SCROLL(Gamma_Event, Interface::OnGammaUpdate)
/* Custom events */
EVT_COMMAND(0, wxEVT_INTF, Interface::UpdateSizeEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
...@@ -240,7 +247,7 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -240,7 +247,7 @@ Interface::Interface( intf_thread_t *_p_intf ):
frame_sizer->Hide( slider_frame ); frame_sizer->Hide( slider_frame );
/* Create the extra panel */ /* Create the extra panel */
CreateOurExtraPanel(); CreateOurExtendedPanel();
frame_sizer->Add( extra_frame, 0, wxEXPAND , 0 ); frame_sizer->Add( extra_frame, 0, wxEXPAND , 0 );
frame_sizer->Hide( extra_frame ); frame_sizer->Hide( extra_frame );
...@@ -255,6 +262,13 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -255,6 +262,13 @@ Interface::Interface( intf_thread_t *_p_intf ):
/* Make sure we've got the right background colour */ /* Make sure we've got the right background colour */
SetBackgroundColour( slider_frame->GetBackgroundColour() ); SetBackgroundColour( slider_frame->GetBackgroundColour() );
/* Video window */
if( config_GetInt( p_intf, "wxwin-embed" ) )
{
VideoWindow( p_intf, this );
frame_sizer->Add( p_intf->p_sys->p_video_sizer, 1, wxEXPAND , 0 );
}
/* Layout everything */ /* Layout everything */
frame_sizer->Layout(); frame_sizer->Layout();
frame_sizer->Fit(this); frame_sizer->Fit(this);
...@@ -281,6 +295,12 @@ Interface::~Interface() ...@@ -281,6 +295,12 @@ Interface::~Interface()
delete timer; delete timer;
} }
void Interface::UpdateSizeEvent( wxCommandEvent& event )
{
frame_sizer->Layout();
frame_sizer->Fit(this);
}
/***************************************************************************** /*****************************************************************************
* Private methods. * Private methods.
*****************************************************************************/ *****************************************************************************/
...@@ -296,14 +316,14 @@ void Interface::CreateOurMenuBar() ...@@ -296,14 +316,14 @@ void Interface::CreateOurMenuBar()
#define HELP_EXIT N_("Exit this program") #define HELP_EXIT N_("Exit this program")
#define HELP_STREAMWIZARD N_("Open the streaming wizard") #define HELP_STREAMWIZARD N_("Open the streaming wizard")
#define HELP_OTHER N_("Open other types of inputs")
#define HELP_PLAYLIST N_("Open the playlist") #define HELP_PLAYLIST N_("Open the playlist")
#define HELP_LOGS N_("Show the program logs") #define HELP_LOGS N_("Show the program logs")
#define HELP_FILEINFO N_("Show information about the file being played") #define HELP_FILEINFO N_("Show information about the file being played")
#define HELP_PREFS N_("Go to the preferences menu") #define HELP_PREFS N_("Go to the preferences menu")
#define EXTRA_PREFS N_("Shows the extended GUI") #define HELP_EXTENDED N_("Shows the extended GUI")
#define HELP_BOOKMARKS N_("Shows the bookmarks window")
#define HELP_ABOUT N_("About this program") #define HELP_ABOUT N_("About this program")
...@@ -485,7 +505,7 @@ void Interface::CreateOurSlider() ...@@ -485,7 +505,7 @@ void Interface::CreateOurSlider()
} }
void Interface::CreateOurExtraPanel() void Interface::CreateOurExtendedPanel()
{ {
char *psz_filters; char *psz_filters;
...@@ -752,8 +772,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -752,8 +772,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
p_settings_menu = SettingsMenu( p_intf, this ); p_settings_menu = SettingsMenu( p_intf, this );
/* Add static items */ /* Add static items */
p_settings_menu->AppendCheckItem( Extra_Event, p_settings_menu->AppendCheckItem( Extended_Event,
wxU(_("&Extended GUI") ), wxU(_(EXTRA_PREFS)) ); wxU(_("&Extended GUI") ), wxU(_(HELP_EXTENDED)) );
p_settings_menu->AppendCheckItem( Bookmarks_Event,
wxU(_("&Bookmarks") ), wxU(_(HELP_BOOKMARKS)) );
p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")), p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
wxU(_(HELP_PREFS)) ); wxU(_(HELP_PREFS)) );
...@@ -831,8 +853,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -831,8 +853,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
#else #else
p_settings_menu = SettingsMenu( p_intf, this ); p_settings_menu = SettingsMenu( p_intf, this );
/* Add static items */ /* Add static items */
p_settings_menu->AppendCheckItem( Extra_Event, wxU(_("&Extended GUI") ), p_settings_menu->AppendCheckItem( Extended_Event, wxU(_("&Extended GUI") ),
wxU(_(EXTRA_PREFS)) ); wxU(_(HELP_EXTENDED)) );
p_settings_menu->AppendCheckItem( Bookmarks_Event, wxU(_("&Bookmarks") ),
wxU(_(HELP_BOOKMARKS)) );
p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")), p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
wxU(_(HELP_PREFS)) ); wxU(_(HELP_PREFS)) );
wxMenu *menu = wxMenu *menu =
...@@ -934,6 +958,9 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -934,6 +958,9 @@ void Interface::OnShowDialog( wxCommandEvent& event )
case StreamWizard_Event: case StreamWizard_Event:
i_id = INTF_DIALOG_STREAMWIZARD; i_id = INTF_DIALOG_STREAMWIZARD;
break; break;
case Bookmarks_Event:
i_id = INTF_DIALOG_BOOKMARKS;
break;
default: default:
i_id = INTF_DIALOG_FILE; i_id = INTF_DIALOG_FILE;
break; break;
...@@ -943,7 +970,7 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -943,7 +970,7 @@ void Interface::OnShowDialog( wxCommandEvent& event )
} }
} }
void Interface::OnExtra(wxCommandEvent& event) void Interface::OnExtended(wxCommandEvent& event)
{ {
if( b_extra == VLC_FALSE) if( b_extra == VLC_FALSE)
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id: menus.cpp,v 1.33 2004/02/26 12:04:14 gbazin Exp $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -170,6 +170,8 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, ...@@ -170,6 +170,8 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "bookmark";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "title"; ppsz_varnames[i] = "title";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "chapter"; ppsz_varnames[i] = "chapter";
...@@ -342,6 +344,8 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -342,6 +344,8 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_object != NULL ) if( p_object != NULL )
{ {
ppsz_varnames[i] = "bookmark";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "title"; ppsz_varnames[i] = "title";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "chapter"; ppsz_varnames[i] = "chapter";
......
/*****************************************************************************
* video.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004, 2003 VideoLAN
* $Id: interface.cpp 6961 2004-03-05 17:34:23Z sam $
*
* Authors: 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/intf.h>
#include "stream_control.h"
#include "wxwindows.h"
static void *GetWindow( intf_thread_t *p_intf, int *pi_x_hint, int *pi_y_hint,
unsigned int *pi_width_hint,
unsigned int *pi_height_hint );
static void ReleaseWindow( intf_thread_t *p_intf, void *p_window );
/* IDs for the controls and the menu commands */
enum
{
UpdateSize_Event = wxID_HIGHEST + 1,
UpdateHide_Event
};
class VideoWindow: public wxWindow
{
public:
/* Constructor */
VideoWindow( intf_thread_t *_p_intf, wxWindow *p_parent );
virtual ~VideoWindow();
void *GetWindow( int *, int *, unsigned int *, unsigned int * );
void ReleaseWindow( void * );
private:
intf_thread_t *p_intf;
wxWindow *p_parent;
vlc_mutex_t lock;
vlc_bool_t b_in_use;
wxWindow *p_child_window;
void UpdateSize( wxSizeEvent & );
void UpdateHide( wxSizeEvent & );
DECLARE_EVENT_TABLE();
};
BEGIN_EVENT_TABLE(VideoWindow, wxWindow)
EVT_CUSTOM( wxEVT_SIZE, UpdateSize_Event, VideoWindow::UpdateSize )
EVT_CUSTOM( wxEVT_SIZE, UpdateHide_Event, VideoWindow::UpdateHide )
END_EVENT_TABLE()
/*****************************************************************************
* Public methods.
*****************************************************************************/
wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent )
{
return new VideoWindow::VideoWindow( p_intf, p_parent );
}
/*****************************************************************************
* Constructor.
*****************************************************************************/
VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
wxWindow( _p_parent, -1 )
{
/* Initializations */
p_intf = _p_intf;
p_parent = _p_parent;
vlc_mutex_init( p_intf, &lock );
b_in_use = VLC_FALSE;
p_intf->pf_request_window = ::GetWindow;
p_intf->pf_release_window = ::ReleaseWindow;
p_intf->p_sys->p_video_window = this;
p_child_window = new wxWindow( this, -1, wxDefaultPosition, wxSize(0,0) );
p_child_window->Show();
Show();
p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL );
p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND );
ReleaseWindow( NULL );
}
VideoWindow::~VideoWindow()
{
vlc_mutex_destroy( &lock );
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
static void *GetWindow( intf_thread_t *p_intf, int *pi_x_hint, int *pi_y_hint,
unsigned int *pi_width_hint,
unsigned int *pi_height_hint )
{
return p_intf->p_sys->p_video_window->GetWindow( pi_x_hint, pi_y_hint,
pi_width_hint,
pi_height_hint );
}
/* Part of the hack to get the X11 window handle from the GtkWidget */
#ifdef __WXGTK__
extern "C" {
#ifdef __WXGTK20__
int gdk_x11_drawable_get_xid( void * );
#endif
void *gtk_widget_get_parent_window( void * );
}
#endif
void *VideoWindow::GetWindow( int *pi_x_hint, int *pi_y_hint,
unsigned int *pi_width_hint,
unsigned int *pi_height_hint )
{
#if defined(__WXGTK__) || defined(WIN32)
vlc_mutex_lock( &lock );
if( b_in_use )
{
msg_Dbg( p_intf, "Video window already in use" );
return NULL;
}
b_in_use = VLC_TRUE;
wxSizeEvent event( wxSize(*pi_width_hint, *pi_height_hint),
UpdateSize_Event );
AddPendingEvent( event );
vlc_mutex_unlock( &lock );
#ifdef __WXGTK__
GtkWidget *p_widget = p_child_window->GetHandle();
#ifdef __WXGTK20__
return (void *)gdk_x11_drawable_get_xid(
gtk_widget_get_parent_window( p_widget ) );
#elif defined(__WXGTK__)
return (void *)( (char *)gtk_widget_get_parent_window( p_widget )
+ 2 * sizeof(void *) );
#endif
#elif defined(WIN32)
return GetHandle();
#endif
#else // defined(__WXGTK__) || defined(WIN32)
return NULL;
#endif
}
static void ReleaseWindow( intf_thread_t *p_intf, void *p_window )
{
return p_intf->p_sys->p_video_window->ReleaseWindow( p_window );
}
void VideoWindow::ReleaseWindow( void *p_window )
{
vlc_mutex_lock( &lock );
b_in_use = VLC_FALSE;
#if defined(__WXGTK__) || defined(WIN32)
wxSizeEvent event( wxSize(0, 0), UpdateHide_Event );
AddPendingEvent( event );
#endif
vlc_mutex_unlock( &lock );
}
void VideoWindow::UpdateSize( wxSizeEvent &event )
{
if( !IsShown() )
{
p_intf->p_sys->p_video_sizer->Show( this, TRUE );
p_intf->p_sys->p_video_sizer->Layout();
SetFocus();
}
p_intf->p_sys->p_video_sizer->SetMinSize( event.GetSize() );
wxCommandEvent intf_event( wxEVT_INTF, 0 );
p_parent->AddPendingEvent( intf_event );
}
void VideoWindow::UpdateHide( wxSizeEvent &event )
{
if( IsShown() )
{
p_intf->p_sys->p_video_sizer->Show( this, FALSE );
p_intf->p_sys->p_video_sizer->Layout();
}
p_intf->p_sys->p_video_sizer->SetMinSize( event.GetSize() );
wxCommandEvent intf_event( wxEVT_INTF, 0 );
p_parent->AddPendingEvent( intf_event );
}
...@@ -80,6 +80,13 @@ private: ...@@ -80,6 +80,13 @@ private:
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
#define EMBED_TEXT N_("Embed video in interface")
#define EMBED_LONGTEXT N_("Embed the video window inside the interface. The "\
"default behaviour is to have video windows separate from the interface.")
#define BOOKMARKS_TEXT N_("Show bookmarks dialog")
#define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \
"starts.")
vlc_module_begin(); vlc_module_begin();
#ifdef WIN32 #ifdef WIN32
int i_score = 150; int i_score = 150;
...@@ -94,6 +101,11 @@ vlc_module_begin(); ...@@ -94,6 +101,11 @@ vlc_module_begin();
add_shortcut( "wx" ); add_shortcut( "wx" );
set_program( "wxvlc" ); set_program( "wxvlc" );
add_bool( "wxwin-embed", 0, NULL,
EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-bookmarks", 0, NULL,
BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
add_submodule(); add_submodule();
set_description( _("wxWindows dialogs provider") ); set_description( _("wxWindows dialogs provider") );
set_capability( "dialogs provider", 50 ); set_capability( "dialogs provider", 50 );
...@@ -132,6 +144,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -132,6 +144,7 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0; p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0;
p_intf->p_sys->p_popup_menu = NULL; p_intf->p_sys->p_popup_menu = NULL;
p_intf->p_sys->p_video_window = NULL;
p_intf->pf_show_dialog = NULL; p_intf->pf_show_dialog = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2004 VideoLAN * Copyright (C) 1999-2004 VideoLAN
* $Id: wxwindows.h,v 1.95 2004/03/01 18:31:13 gbazin Exp $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -50,11 +50,13 @@ ...@@ -50,11 +50,13 @@
#endif #endif
DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 ); DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
class OpenDialog; class OpenDialog;
class Playlist; class Playlist;
class Messages; class Messages;
class FileInfo; class FileInfo;
class VideoWindow;
#define SLIDER_MAX_POS 10000 #define SLIDER_MAX_POS 10000
...@@ -130,6 +132,8 @@ struct intf_sys_t ...@@ -130,6 +132,8 @@ struct intf_sys_t
/* Popup menu */ /* Popup menu */
wxMenu *p_popup_menu; wxMenu *p_popup_menu;
VideoWindow *p_video_window;
wxBoxSizer *p_video_sizer;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -194,7 +198,7 @@ private: ...@@ -194,7 +198,7 @@ private:
void UpdateAcceleratorTable(); void UpdateAcceleratorTable();
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
void CreateOurExtraPanel(); void CreateOurExtendedPanel();
void CreateOurSlider(); void CreateOurSlider();
void Open( int i_access_method ); void Open( int i_access_method );
...@@ -208,7 +212,8 @@ private: ...@@ -208,7 +212,8 @@ private:
void OnOpenNet( wxCommandEvent& event ); void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event ); void OnOpenSat( wxCommandEvent& event );
void OnOpenV4L( wxCommandEvent& event ); void OnOpenV4L( wxCommandEvent& event );
void OnExtra( wxCommandEvent& event ); void OnExtended( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event ); void OnShowDialog( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
...@@ -235,6 +240,8 @@ private: ...@@ -235,6 +240,8 @@ private:
#endif #endif
void OnContextMenu(wxMouseEvent& event); void OnContextMenu(wxMouseEvent& event);
void UpdateSizeEvent( wxCommandEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
Timer *timer; Timer *timer;
...@@ -255,6 +262,7 @@ private: ...@@ -255,6 +262,7 @@ private:
}; };
class StreamDialog; class StreamDialog;
class BookmarksDialog;
/* Dialogs Provider */ /* Dialogs Provider */
class DialogsProvider: public wxFrame class DialogsProvider: public wxFrame
...@@ -274,6 +282,7 @@ private: ...@@ -274,6 +282,7 @@ private:
void OnFileInfo( wxCommandEvent& event ); void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event ); void OnPreferences( wxCommandEvent& event );
void OnStreamWizardDialog( wxCommandEvent& event ); void OnStreamWizardDialog( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnOpenFileGeneric( wxCommandEvent& event ); void OnOpenFileGeneric( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event ); void OnOpenFileSimple( wxCommandEvent& event );
...@@ -301,6 +310,7 @@ public: ...@@ -301,6 +310,7 @@ public:
FileInfo *p_fileinfo_dialog; FileInfo *p_fileinfo_dialog;
StreamDialog *p_streamwizard_dialog; StreamDialog *p_streamwizard_dialog;
wxFrame *p_prefs_dialog; wxFrame *p_prefs_dialog;
BookmarksDialog *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog; wxFileDialog *p_file_generic_dialog;
}; };
...@@ -989,6 +999,35 @@ private: ...@@ -989,6 +999,35 @@ private:
int i_item_id; int i_item_id;
}; };
wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
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( wxCommandEvent& event );
void OnAdd( wxCommandEvent& event );
void OnDel( wxCommandEvent& event );
void OnActivateItem( wxListEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
wxWindow *p_parent;
wxListView *list_ctrl;
};
static inline int ConvertHotkeyModifiers( int i_hotkey ) static inline int ConvertHotkeyModifiers( int i_hotkey )
{ {
int i_accel_flags = 0; int i_accel_flags = 0;
......
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