Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
632a9c55
Commit
632a9c55
authored
Nov 23, 2002
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./modules/gui/wxwindows/playlist.cpp: added a playlist to the wxwindows interface
parent
7af58f03
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
390 additions
and
16 deletions
+390
-16
modules/gui/wxwindows/Modules.am
modules/gui/wxwindows/Modules.am
+1
-0
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/interface.cpp
+29
-6
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/playlist.cpp
+306
-0
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/timer.cpp
+4
-1
modules/gui/wxwindows/wxwindows.cpp
modules/gui/wxwindows/wxwindows.cpp
+4
-1
modules/gui/wxwindows/wxwindows.h
modules/gui/wxwindows/wxwindows.h
+46
-8
No files found.
modules/gui/wxwindows/Modules.am
View file @
632a9c55
...
...
@@ -2,6 +2,7 @@ SOURCES_wxwindows = \
modules/gui/wxwindows/wxwindows.cpp \
modules/gui/wxwindows/wxwindows.h \
modules/gui/wxwindows/interface.cpp \
modules/gui/wxwindows/playlist.cpp \
modules/gui/wxwindows/timer.cpp \
$(NULL)
...
...
modules/gui/wxwindows/interface.cpp
View file @
632a9c55
...
...
@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.
5 2002/11/20 14:24:00 gbazin
Exp $
* $Id: interface.cpp,v 1.
6 2002/11/23 01:32:40 ipkiss
Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
...
...
@@ -74,6 +74,7 @@ enum
OpenSat_Event
,
EjectDisc_Event
,
Playlist_Event
,
Logs_Event
,
Audio_Event
,
...
...
@@ -97,6 +98,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Menu events */
EVT_MENU
(
Exit_Event
,
Interface
::
OnExit
)
EVT_MENU
(
About_Event
,
Interface
::
OnAbout
)
EVT_MENU
(
Playlist_Event
,
Interface
::
OnPlaylist
)
EVT_MENU
(
OpenFile_Event
,
Interface
::
OnOpenFile
)
/* Toolbar events */
EVT_MENU
(
OpenFile_Event
,
Interface
::
OnOpenFile
)
...
...
@@ -143,8 +145,10 @@ Interface::Interface( intf_thread_t *_p_intf ):
file_menu
->
Append
(
Exit_Event
,
_
(
"E&xit"
),
HELP_EXIT
);
/* Create our "View" menu */
#define HELP_PLAYLIST N_("Open the playlist")
#define HELP_LOGS N_("Show the program logs")
wxMenu
*
view_menu
=
new
wxMenu
;
view_menu
->
Append
(
Playlist_Event
,
_
(
"&Playlist..."
),
HELP_PLAYLIST
);
view_menu
->
Append
(
Logs_Event
,
_
(
"&Logs..."
),
HELP_LOGS
);
/* Create our "Settings" menu */
...
...
@@ -203,12 +207,19 @@ Interface::Interface( intf_thread_t *_p_intf ):
toolbar
->
AddTool
(
PlayStream_Event
,
_
(
"Play"
),
*
p_bmp_play
,
HELP_PLAY
);
toolbar
->
AddTool
(
PauseStream_Event
,
_
(
"Pause"
),
*
p_bmp_pause
,
HELP_PAUSE
);
toolbar
->
AddSeparator
();
toolbar
->
AddTool
(
wxID_OPEN
,
_
(
"Playlist"
),
*
p_bmp_playlist
,
HELP_PLO
);
toolbar
->
AddTool
(
Playlist_Event
,
_
(
"Playlist"
),
*
p_bmp_playlist
,
HELP_PLO
);
toolbar
->
AddTool
(
PrevStream_Event
,
_
(
"Prev"
),
*
p_bmp_prev
,
HELP_PLP
);
toolbar
->
AddTool
(
NextStream_Event
,
_
(
"Next"
),
*
p_bmp_next
,
HELP_PLN
);
toolbar
->
Realize
();
/* Place the toolbar in a sizer, so that the window will stretch
* to get its size */
wxBoxSizer
*
toolbar_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
toolbar_sizer
->
Add
(
toolbar
,
0
);
toolbar_sizer
->
SetSizeHints
(
this
);
/* Create slider */
wxBoxSizer
*
slider_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
slider
=
new
wxSlider
(
this
,
SliderScroll_Event
,
0
,
0
,
100
,
...
...
@@ -253,14 +264,23 @@ void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
wxString
msg
;
msg
.
Printf
(
_
(
"This is the about dialog of the VideoLAN Client.
\n
"
)
);
wxMessageBox
(
msg
,
"About VideoLAN Client"
,
wxMessageBox
(
msg
,
_
(
"About VideoLAN Client"
)
,
wxOK
|
wxICON_INFORMATION
,
this
);
}
void
Interface
::
OnPlaylist
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
/* Show/hide the playlist window */
wxFrame
*
p_playlist_window
=
p_intf
->
p_sys
->
p_playlist_window
;
if
(
p_playlist_window
)
{
p_playlist_window
->
Show
(
!
p_playlist_window
->
IsShown
()
);
}
}
void
Interface
::
OnOpenFile
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
wxFileDialog
dialog
(
this
,
_
(
"Open file"
),
_
(
""
),
_
(
""
),
_
(
"*.*"
)
);
wxFileDialog
dialog
(
this
,
_
(
"Open file"
),
_
(
""
),
_
(
""
),
_
(
"*.*"
)
);
if
(
dialog
.
ShowModal
()
==
wxID_OK
)
{
...
...
@@ -276,6 +296,9 @@ void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
playlist_Add
(
p_playlist
,
(
char
*
)
dialog
.
GetPath
().
c_str
(),
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
);
/* Rebuild the playlist */
p_intf
->
p_sys
->
p_playlist_window
->
Rebuild
();
vlc_object_release
(
p_playlist
);
}
}
...
...
modules/gui/wxwindows/playlist.cpp
0 → 100644
View file @
632a9c55
/*****************************************************************************
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $$
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
* 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>
/* Let wxWindows take care of the i18n stuff */
#undef _
#ifdef WIN32
/* mingw32 hack */
#undef Yield()
#undef CreateDialog()
#endif
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/listctrl.h>
#include "wxwindows.h"
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
/* menu items */
AddUrl_Event
=
1
,
AddDirectory_Event
,
Close_Event
,
InvertSelection_Event
,
DeleteSelection_Event
,
SelectAll_Event
,
/* controls */
ListView_Event
};
BEGIN_EVENT_TABLE
(
Playlist
,
wxFrame
)
/* Menu events */
EVT_MENU
(
AddUrl_Event
,
Playlist
::
OnAddUrl
)
EVT_MENU
(
AddDirectory_Event
,
Playlist
::
OnAddDirectory
)
EVT_MENU
(
Close_Event
,
Playlist
::
OnClose
)
EVT_MENU
(
InvertSelection_Event
,
Playlist
::
OnInvertSelection
)
EVT_MENU
(
DeleteSelection_Event
,
Playlist
::
OnDeleteSelection
)
EVT_MENU
(
SelectAll_Event
,
Playlist
::
OnSelectAll
)
/* Listview events */
EVT_LIST_ITEM_ACTIVATED
(
ListView_Event
,
Playlist
::
OnActivateItem
)
EVT_LIST_KEY_DOWN
(
ListView_Event
,
Playlist
::
OnKeyDown
)
/* Button events */
EVT_BUTTON
(
wxID_OK
,
Playlist
::
OnClose
)
/* Special events : we don't want to destroy the window when the user
* clicks on (X) */
EVT_CLOSE
(
Playlist
::
OnClose
)
END_EVENT_TABLE
()
/*****************************************************************************
* Constructor.
*****************************************************************************/
Playlist
::
Playlist
(
intf_thread_t
*
_p_intf
,
Interface
*
_p_main_interface
)
:
wxFrame
(
_p_main_interface
,
-
1
,
"Playlist"
,
wxDefaultPosition
,
wxSize
::
wxSize
(
400
,
500
),
wxDEFAULT_FRAME_STYLE
)
{
/* Initializations */
p_intf
=
_p_intf
;
p_main_interface
=
_p_main_interface
;
/* Create our "Manage" menu */
wxMenu
*
manage_menu
=
new
wxMenu
;
manage_menu
->
Append
(
AddUrl_Event
,
_
(
"Add &Url..."
)
);
manage_menu
->
Append
(
AddDirectory_Event
,
_
(
"Add &Directory..."
)
);
manage_menu
->
AppendSeparator
();
manage_menu
->
Append
(
Close_Event
,
_
(
"&Close"
)
);
/* Create our "Selection" menu */
wxMenu
*
selection_menu
=
new
wxMenu
;
selection_menu
->
Append
(
InvertSelection_Event
,
_
(
"&Invert"
)
);
selection_menu
->
Append
(
DeleteSelection_Event
,
_
(
"&Delete"
)
);
selection_menu
->
Append
(
SelectAll_Event
,
_
(
"&Select All"
)
);
/* Append the freshly created menus to the menu bar */
wxMenuBar
*
menubar
=
new
wxMenuBar
(
wxMB_DOCKABLE
);
menubar
->
Append
(
manage_menu
,
_
(
"&Manage"
)
);
menubar
->
Append
(
selection_menu
,
_
(
"&Selection"
)
);
/* Attach the menu bar to the frame */
SetMenuBar
(
menubar
);
/* Create the listview */
/* FIXME: the given size is arbitrary, and prevents us from resizing
* the window to smaller dimensions. But the sizers don't seem to adjust
* themselves to the size of a listview, and with a wxDefaultSize the
* playlist window is ridiculously small */
listview
=
new
wxListView
(
this
,
ListView_Event
,
wxDefaultPosition
,
wxSize
(
350
,
300
),
wxLC_REPORT
);
listview
->
InsertColumn
(
0
,
_
(
"Url"
)
);
listview
->
InsertColumn
(
1
,
_
(
"Duration"
)
);
listview
->
SetColumnWidth
(
0
,
250
);
listview
->
SetColumnWidth
(
1
,
100
);
/* Create the OK button */
ok_button
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"OK"
)
);
ok_button
->
SetDefault
();
/* Place everything in sizers */
wxBoxSizer
*
ok_button_sizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
ok_button_sizer
->
Add
(
ok_button
,
0
,
wxALL
,
5
);
wxBoxSizer
*
main_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
main_sizer
->
Add
(
listview
,
1
,
wxEXPAND
|
wxALL
,
5
);
main_sizer
->
Add
(
ok_button_sizer
,
0
,
wxALIGN_CENTRE
);
SetSizerAndFit
(
main_sizer
);
}
Playlist
::~
Playlist
()
{
}
void
Playlist
::
Rebuild
()
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
p_playlist
==
NULL
)
{
return
;
}
/* Clear the list... */
listview
->
DeleteAllItems
();
/* ...and rebuild it */
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
for
(
int
i
=
0
;
i
<
p_playlist
->
i_size
;
i
++
)
{
wxString
filename
=
p_playlist
->
pp_items
[
i
]
->
psz_name
;
listview
->
InsertItem
(
i
,
filename
);
/* FIXME: we should try to find the actual duration... */
listview
->
SetItem
(
i
,
1
,
_
(
"no info"
)
);
}
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
/* Change the colour for the currenty played stream */
wxListItem
listitem
;
listitem
.
m_itemId
=
p_playlist
->
i_index
;
listitem
.
SetTextColour
(
*
wxRED
);
listview
->
SetItem
(
listitem
);
vlc_object_release
(
p_playlist
);
}
/* Update the colour of items */
void
Playlist
::
Manage
()
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
p_playlist
==
NULL
)
{
return
;
}
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
if
(
p_intf
->
p_sys
->
i_playing
!=
p_playlist
->
i_index
)
{
wxListItem
listitem
;
listitem
.
m_itemId
=
p_playlist
->
i_index
;
listitem
.
SetTextColour
(
*
wxRED
);
listview
->
SetItem
(
listitem
);
if
(
p_intf
->
p_sys
->
i_playing
!=
-
1
)
{
listitem
.
m_itemId
=
p_intf
->
p_sys
->
i_playing
;
listitem
.
SetTextColour
(
*
wxBLACK
);
listview
->
SetItem
(
listitem
);
}
p_intf
->
p_sys
->
i_playing
=
p_playlist
->
i_index
;
}
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
vlc_object_release
(
p_playlist
);
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void
Playlist
::
DeleteItem
(
int
item
)
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
p_playlist
==
NULL
)
{
return
;
}
playlist_Delete
(
p_playlist
,
item
);
listview
->
DeleteItem
(
item
);
vlc_object_release
(
p_playlist
);
}
void
Playlist
::
OnClose
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
Hide
();
}
void
Playlist
::
OnAddUrl
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
/* TODO */
}
void
Playlist
::
OnAddDirectory
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
/* TODO */
}
void
Playlist
::
OnInvertSelection
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
for
(
long
item
=
0
;
item
<
listview
->
GetItemCount
();
item
++
)
{
listview
->
Select
(
item
,
!
listview
->
IsSelected
(
item
)
);
}
}
void
Playlist
::
OnDeleteSelection
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
/* Delete from the end to the beginning, to avoid a shift of indices */
for
(
long
item
=
listview
->
GetItemCount
()
-
1
;
item
>=
0
;
item
--
)
{
if
(
listview
->
IsSelected
(
item
)
)
{
DeleteItem
(
item
);
}
}
Rebuild
();
}
void
Playlist
::
OnSelectAll
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
for
(
long
item
=
0
;
item
<
listview
->
GetItemCount
();
item
++
)
{
listview
->
Select
(
item
,
TRUE
);
}
}
void
Playlist
::
OnActivateItem
(
wxListEvent
&
event
)
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
p_playlist
==
NULL
)
{
return
;
}
playlist_Goto
(
p_playlist
,
event
.
GetIndex
()
);
vlc_object_release
(
p_playlist
);
}
void
Playlist
::
OnKeyDown
(
wxListEvent
&
event
)
{
long
keycode
=
event
.
GetKeyCode
();
/* Delete selected items */
if
(
keycode
==
WXK_BACK
||
keycode
==
WXK_DELETE
)
{
/* We send a dummy event */
OnDeleteSelection
(
event
);
}
}
modules/gui/wxwindows/timer.cpp
View file @
632a9c55
...
...
@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.
2 2002/11/20 14:24:00 gbazin
Exp $
* $Id: timer.cpp,v 1.
3 2002/11/23 01:32:40 ipkiss
Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
...
...
@@ -113,6 +113,9 @@ void Timer::Notify()
{
}
/* Update the playlist */
p_intf
->
p_sys
->
p_playlist_window
->
Manage
();
/* Update the input */
if
(
p_intf
->
p_sys
->
p_input
==
NULL
)
{
...
...
modules/gui/wxwindows/wxwindows.cpp
View file @
632a9c55
...
...
@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.
3 2002/11/20 15:58:15 gbazin
Exp $
* $Id: wxwindows.cpp,v 1.
4 2002/11/23 01:32:40 ipkiss
Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
...
...
@@ -180,6 +180,9 @@ bool Instance::OnInit()
* since it is the first window */
Interface
*
MainInterface
=
new
Interface
(
p_intf
);
/* Create the playlist window */
p_intf
->
p_sys
->
p_playlist_window
=
new
Playlist
(
p_intf
,
MainInterface
);
/* Show the interface */
MainInterface
->
Show
(
TRUE
);
...
...
modules/gui/wxwindows/wxwindows.h
View file @
632a9c55
...
...
@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.
1 2002/11/18 13:02:16 gbazin
Exp $
* $Id: wxwindows.h,v 1.
2 2002/11/23 01:32:40 ipkiss
Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
...
...
@@ -21,6 +21,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <wx/listctrl.h>
class
Playlist
;
/*****************************************************************************
* intf_sys_t: description and status of Gtk+ interface
*****************************************************************************/
...
...
@@ -29,6 +33,9 @@ struct intf_sys_t
/* the wx parent window */
wxWindow
*
p_wxwindow
;
/* secondary windows */
Playlist
*
p_playlist_window
;
/* special actions */
vlc_bool_t
b_playing
;
vlc_bool_t
b_popup_changed
;
/* display menu ? */
...
...
@@ -100,13 +107,14 @@ public:
private:
/* Event handlers (these functions should _not_ be virtual) */
void
OnExit
(
wxCommandEvent
&
event
);
void
OnAbout
(
wxCommandEvent
&
event
);
void
OnOpenFile
(
wxCommandEvent
&
event
);
void
OnPlayStream
(
wxCommandEvent
&
event
);
void
OnStopStream
(
wxCommandEvent
&
event
);
void
OnPauseStream
(
wxCommandEvent
&
event
);
void
OnSliderUpdate
(
wxScrollEvent
&
event
);
void
OnExit
(
wxCommandEvent
&
event
);
void
OnAbout
(
wxCommandEvent
&
event
);
void
OnPlaylist
(
wxCommandEvent
&
event
);
void
OnOpenFile
(
wxCommandEvent
&
event
);
void
OnPlayStream
(
wxCommandEvent
&
event
);
void
OnStopStream
(
wxCommandEvent
&
event
);
void
OnPauseStream
(
wxCommandEvent
&
event
);
void
OnSliderUpdate
(
wxScrollEvent
&
event
);
void
OnPrevStream
(
wxCommandEvent
&
event
);
void
OnNextStream
(
wxCommandEvent
&
event
);
...
...
@@ -115,3 +123,33 @@ private:
Timer
*
timer
;
intf_thread_t
*
p_intf
;
};
/* Playlist */
class
Playlist
:
public
wxFrame
{
public:
/* Constructor */
Playlist
(
intf_thread_t
*
p_intf
,
Interface
*
p_main_interface
);
virtual
~
Playlist
();
void
Rebuild
();
void
Manage
();
private:
/* Event handlers (these functions should _not_ be virtual) */
void
OnAddUrl
(
wxCommandEvent
&
event
);
void
OnAddDirectory
(
wxCommandEvent
&
event
);
void
OnClose
(
wxCommandEvent
&
event
);
void
OnInvertSelection
(
wxCommandEvent
&
event
);
void
OnDeleteSelection
(
wxCommandEvent
&
event
);
void
OnSelectAll
(
wxCommandEvent
&
event
);
void
OnActivateItem
(
wxListEvent
&
event
);
void
OnKeyDown
(
wxListEvent
&
event
);
DECLARE_EVENT_TABLE
();
void
DeleteItem
(
int
item
);
intf_thread_t
*
p_intf
;
Interface
*
p_main_interface
;
wxListView
*
listview
;
wxButton
*
ok_button
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment