Commit 3aa0d431 authored by Anil Daoud's avatar Anil Daoud

* We now use hide/show for the file info window

parent 9759f89b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* fileinfo.cpp : wxWindows plugin for vlc * fileinfo.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: fileinfo.cpp,v 1.7 2003/04/06 13:18:26 sigmunau Exp $ * $Id: fileinfo.cpp,v 1.8 2003/04/17 14:00:44 anil Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -61,7 +61,7 @@ BEGIN_EVENT_TABLE(FileInfo, wxFrame) ...@@ -61,7 +61,7 @@ BEGIN_EVENT_TABLE(FileInfo, wxFrame)
/* Button events */ /* Button events */
EVT_BUTTON(wxID_OK, FileInfo::OnClose) EVT_BUTTON(wxID_OK, FileInfo::OnClose)
/* Destroy the window when the user closes the window */ /* Hide the window when the user closes the window */
EVT_CLOSE(FileInfo::OnClose) EVT_CLOSE(FileInfo::OnClose)
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -74,8 +74,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -74,8 +74,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxDefaultSize, wxDEFAULT_FRAME_STYLE ) wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{ {
/* Initializations */ /* Initializations */
intf_thread_t *p_intf = _p_intf; p_intf = _p_intf;
input_thread_t *p_input = p_intf->p_sys->p_input;
SetIcon( *p_intf->p_sys->p_icon ); SetIcon( *p_intf->p_sys->p_icon );
SetAutoLayout(TRUE); SetAutoLayout(TRUE);
...@@ -83,8 +82,8 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -83,8 +82,8 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxPanel *panel = new wxPanel( this, -1 ); wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE ); panel->SetAutoLayout( TRUE );
wxTreeCtrl *tree = fileinfo_tree =
new wxTreeCtrl( panel, -1, wxDefaultPosition, wxSize(350,350), new wxTreeCtrl( panel, -1, wxDefaultPosition, wxSize( 350, 350 ),
wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxSUNKEN_BORDER ); wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxSUNKEN_BORDER );
/* Create the OK button */ /* Create the OK button */
...@@ -97,7 +96,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -97,7 +96,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ):
ok_button_sizer->Layout(); ok_button_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( tree, 1, wxEXPAND | wxALL, 5 ); panel_sizer->Add( fileinfo_tree, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE ); panel_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE );
panel_sizer->Layout(); panel_sizer->Layout();
panel->SetSizerAndFit( panel_sizer ); panel->SetSizerAndFit( panel_sizer );
...@@ -105,31 +104,57 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -105,31 +104,57 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ):
main_sizer->Layout(); main_sizer->Layout();
SetSizerAndFit( main_sizer ); SetSizerAndFit( main_sizer );
if ( !p_intf->p_sys->p_input ) UpdateFileInfo();
}
void FileInfo::UpdateFileInfo()
{
if( !p_intf->p_sys->p_input || p_intf->p_sys->p_input->b_dead )
{
if( fileinfo_root )
{
fileinfo_tree->SetItemText ( fileinfo_root , "");
fileinfo_tree->DeleteChildren ( fileinfo_root );
}
return;
}
input_thread_t *p_input = p_intf->p_sys->p_input;
if( !fileinfo_root )
{
fileinfo_root = fileinfo_tree->AddRoot( p_input->psz_name );
}
else if( fileinfo_tree->GetItemText( fileinfo_root ) == p_input->psz_name )
{ {
/* Nothing to show, but hey... */
Show( true );
return; return;
} }
fileinfo_tree->DeleteChildren( fileinfo_root );
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
wxTreeItemId root = tree->AddRoot( p_input->psz_name );
input_info_category_t *p_cat = p_input->stream.p_info;
while ( p_cat ) { fileinfo_tree->SetItemText( fileinfo_root , p_input->psz_name );
wxTreeItemId cat = tree->AppendItem( root, p_cat->psz_name ); input_info_category_t *p_cat = p_input->stream.p_info;
while ( p_cat )
{
wxTreeItemId cat = fileinfo_tree->AppendItem( fileinfo_root,
p_cat->psz_name );
input_info_t *p_info = p_cat->p_info; input_info_t *p_info = p_cat->p_info;
while ( p_info ) { while ( p_info )
tree->AppendItem( cat, wxString(p_info->psz_name) + ": " {
+ p_info->psz_value ); fileinfo_tree->AppendItem( cat, wxString(p_info->psz_name) + ": "
+ p_info->psz_value );
p_info = p_info->p_next; p_info = p_info->p_next;
} }
p_cat = p_cat->p_next; p_cat = p_cat->p_next;
tree->Expand( cat ); fileinfo_tree->Expand( cat );
} }
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
Show( true ); return;
} }
FileInfo::~FileInfo() FileInfo::~FileInfo()
...@@ -138,5 +163,5 @@ FileInfo::~FileInfo() ...@@ -138,5 +163,5 @@ FileInfo::~FileInfo()
void FileInfo::OnClose( wxCommandEvent& event ) void FileInfo::OnClose( wxCommandEvent& event )
{ {
Destroy(); Hide();
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.12 2003/03/30 19:56:11 gbazin Exp $ * $Id: timer.cpp,v 1.13 2003/04/17 14:00:44 anil Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -116,6 +116,9 @@ void Timer::Notify() ...@@ -116,6 +116,9 @@ void Timer::Notify()
/* Update the playlist */ /* Update the playlist */
p_intf->p_sys->p_playlist_window->Manage(); p_intf->p_sys->p_playlist_window->Manage();
/* Update the fileinfo windows */
p_intf->p_sys->p_fileinfo_window->UpdateFileInfo();
/* Update the input */ /* Update the input */
if( p_intf->p_sys->p_input == NULL ) if( p_intf->p_sys->p_input == NULL )
{ {
...@@ -167,6 +170,8 @@ void Timer::Notify() ...@@ -167,6 +170,8 @@ void Timer::Notify()
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
} }
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
input_thread_t *p_input = p_intf->p_sys->p_input; input_thread_t *p_input = p_intf->p_sys->p_input;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.14 2003/03/30 13:23:28 gbazin Exp $ * $Id: wxwindows.cpp,v 1.15 2003/04/17 14:00:44 anil Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -215,6 +215,9 @@ bool Instance::OnInit() ...@@ -215,6 +215,9 @@ bool Instance::OnInit()
/* Create the log window */ /* Create the log window */
p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface ); p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface );
/* Create the fileinfo window */
p_intf->p_sys->p_fileinfo_window = new FileInfo ( p_intf, MainInterface );
/* Show the interface */ /* Show the interface */
MainInterface->Show( TRUE ); MainInterface->Show( TRUE );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.16 2003/04/06 16:30:43 gbazin Exp $ * $Id: wxwindows.h,v 1.17 2003/04/17 14:00:44 anil Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -26,14 +26,16 @@ ...@@ -26,14 +26,16 @@
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/dnd.h> #include <wx/dnd.h>
#include <wx/treectrl.h>
class Playlist; class Playlist;
class Messages; class Messages;
class FileInfo;
#define SLIDER_MAX_POS 10000 #define SLIDER_MAX_POS 10000
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of Gtk+ interface * intf_sys_t: description and status of wxwindows interface
*****************************************************************************/ *****************************************************************************/
struct intf_sys_t struct intf_sys_t
{ {
...@@ -44,6 +46,7 @@ struct intf_sys_t ...@@ -44,6 +46,7 @@ struct intf_sys_t
/* secondary windows */ /* secondary windows */
Playlist *p_playlist_window; Playlist *p_playlist_window;
Messages *p_messages_window; Messages *p_messages_window;
FileInfo *p_fileinfo_window;
/* special actions */ /* special actions */
vlc_bool_t b_playing; vlc_bool_t b_playing;
...@@ -400,11 +403,17 @@ public: ...@@ -400,11 +403,17 @@ public:
/* Constructor */ /* Constructor */
FileInfo( intf_thread_t *p_intf, Interface *p_main_interface ); FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~FileInfo(); virtual ~FileInfo();
void UpdateFileInfo();
private: private:
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
wxTreeCtrl *fileinfo_tree;
wxTreeItemId fileinfo_root;
}; };
#if !defined(__WXX11__) #if !defined(__WXX11__)
......
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