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
a644825a
Commit
a644825a
authored
Nov 30, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/gui/wxwidgets: massive cleanup and simplification of the main interface code.
parent
70e52acc
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
718 additions
and
948 deletions
+718
-948
modules/gui/wxwidgets/Modules.am
modules/gui/wxwidgets/Modules.am
+2
-4
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp
+77
-9
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp
+9
-3
modules/gui/wxwidgets/extrapanel.cpp
modules/gui/wxwidgets/extrapanel.cpp
+1
-4
modules/gui/wxwidgets/extrapanel.hpp
modules/gui/wxwidgets/extrapanel.hpp
+1
-1
modules/gui/wxwidgets/input_manager.cpp
modules/gui/wxwidgets/input_manager.cpp
+441
-0
modules/gui/wxwidgets/input_manager.hpp
modules/gui/wxwidgets/input_manager.hpp
+90
-0
modules/gui/wxwidgets/interface.cpp
modules/gui/wxwidgets/interface.cpp
+72
-390
modules/gui/wxwidgets/interface.hpp
modules/gui/wxwidgets/interface.hpp
+15
-42
modules/gui/wxwidgets/main_slider_manager.cpp
modules/gui/wxwidgets/main_slider_manager.cpp
+0
-207
modules/gui/wxwidgets/main_slider_manager.hpp
modules/gui/wxwidgets/main_slider_manager.hpp
+0
-62
modules/gui/wxwidgets/slider_manager.cpp
modules/gui/wxwidgets/slider_manager.cpp
+0
-150
modules/gui/wxwidgets/timer.cpp
modules/gui/wxwidgets/timer.cpp
+5
-61
modules/gui/wxwidgets/timer.hpp
modules/gui/wxwidgets/timer.hpp
+3
-6
modules/gui/wxwidgets/video.hpp
modules/gui/wxwidgets/video.hpp
+1
-1
modules/gui/wxwidgets/wxwidgets.cpp
modules/gui/wxwidgets/wxwidgets.cpp
+0
-2
modules/gui/wxwidgets/wxwidgets.hpp
modules/gui/wxwidgets/wxwidgets.hpp
+1
-6
No files found.
modules/gui/wxwidgets/Modules.am
View file @
a644825a
...
...
@@ -8,8 +8,7 @@ SOURCES_wxwidgets = \
menus.cpp \
timer.cpp \
video.cpp \
slider_manager.cpp \
main_slider_manager.cpp \
input_manager.cpp \
dialogs.cpp \
dialogs/open.cpp \
dialogs/streamout.cpp \
...
...
@@ -41,8 +40,7 @@ EXTRA_DIST += \
extrapanel.hpp \
timer.hpp \
video.hpp \
slider_manager.hpp \
main_slider_manager.hpp \
input_manager.hpp \
dialogs/fileinfo.hpp \
dialogs/preferences.hpp \
dialogs/wizard.hpp \
...
...
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.cpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* 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
$
* $Id$
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
...
...
@@ -32,11 +32,13 @@
* Constructor.
*****************************************************************************/
VLMSliderManager
::
VLMSliderManager
(
intf_thread_t
*
_p_intf
,
VLMBroadcastStreamPanel
*
_p_sp
)
:
SliderManager
(
_p_intf
)
VLMBroadcastStreamPanel
*
_p_sp
)
{
p_intf
=
_p_intf
;
p_input
=
NULL
;
p_sp
=
_p_sp
;
_
slider
=
p_sp
->
p_slider
;
slider
=
p_sp
->
p_slider
;
b_slider_free
=
VLC_TRUE
;
time_string
=
wxU
(
"0:00:00 / 0:00:00"
);
...
...
@@ -47,9 +49,75 @@ VLMSliderManager::~VLMSliderManager()
}
/*****************************************************************************
* P
rivate
methods.
* P
ublic
methods.
*****************************************************************************/
void
VLMSliderManager
::
Update
()
{
/* Update the input */
if
(
p_input
==
NULL
)
{
UpdateInput
();
if
(
p_input
)
{
slider
->
SetValue
(
0
);
UpdateButtons
(
VLC_TRUE
);
}
}
else
if
(
p_input
->
b_dead
)
{
HideSlider
();
UpdateButtons
(
VLC_FALSE
);
vlc_object_release
(
p_input
);
p_input
=
NULL
;
}
if
(
p_input
&&
!
p_input
->
b_die
)
{
vlc_value_t
pos
;
/* Really manage the slider */
var_Get
(
p_input
,
"position"
,
&
pos
);
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
);
}
}
}
}
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void
VLMSliderManager
::
UpdateInput
()
{
if
(
p_sp
->
GetStream
()
->
p_media
->
i_instance
==
0
)
...
...
@@ -75,18 +143,18 @@ void VLMSliderManager::UpdateButtons( vlc_bool_t b_play )
vlc_bool_t
VLMSliderManager
::
IsShown
()
{
return
_
slider
->
IsEnabled
();
return
slider
->
IsEnabled
();
}
void
VLMSliderManager
::
ShowSlider
()
{
_
slider
->
Enable
();
slider
->
Enable
();
}
void
VLMSliderManager
::
HideSlider
()
{
_
slider
->
SetValue
(
0
);
_
slider
->
Disable
();
slider
->
SetValue
(
0
);
slider
->
Disable
();
UpdateTime
(
"0:00:00"
,
"0:00:00"
);
}
...
...
modules/gui/wxwidgets/dialogs/vlm/vlm_slider_manager.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* 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
$
* $Id$
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
...
...
@@ -24,7 +24,7 @@
#ifndef _VLM_SLIDER_MANAGER_H_
#define _VLM_SLIDER_MANAGER_H_
#include "
slider_manager
.hpp"
#include "
wxwidgets
.hpp"
namespace
wxvlc
{
...
...
@@ -32,7 +32,7 @@ namespace wxvlc
/**
* This class manages a slider corresponding to the main input
*/
class
VLMSliderManager
:
public
SliderManager
class
VLMSliderManager
{
public:
VLMSliderManager
(
intf_thread_t
*
,
VLMBroadcastStreamPanel
*
);
...
...
@@ -40,6 +40,7 @@ namespace wxvlc
wxString
time_string
;
void
Update
();
void
ProcessUpdate
(
wxScrollEvent
&
);
protected:
...
...
@@ -56,6 +57,11 @@ namespace wxvlc
virtual
void
ShowSlider
();
VLMBroadcastStreamPanel
*
p_sp
;
intf_thread_t
*
p_intf
;
input_thread_t
*
p_input
;
wxSlider
*
slider
;
///< Slider for this input
int
i_slider_pos
;
///< Current slider position
};
};
...
...
modules/gui/wxwidgets/extrapanel.cpp
View file @
a644825a
...
...
@@ -150,7 +150,6 @@ static const struct filter vfilters[] =
{
"clone"
,
N_
(
"Image clone"
),
N_
(
"Creates several clones of the image"
)
},
{
"distort"
,
N_
(
"Distortion"
),
N_
(
"Adds distorsion effects"
)
},
{
"invert"
,
N_
(
"Image inversion"
)
,
N_
(
"Inverts the image colors"
)
},
{
"crop"
,
N_
(
"Image cropping"
),
N_
(
"Crops the image"
)
},
{
"motionblur"
,
N_
(
"Blurring"
),
N_
(
"Creates a motion blurring on the image"
)
},
{
"transform"
,
N_
(
"Transformation"
),
N_
(
"Rotates or flips the image"
)
},
{
"magnify"
,
N_
(
"Magnify"
),
N_
(
"Magnifies part of the image"
)
},
...
...
@@ -311,7 +310,7 @@ wxPanel *ExtraPanel::VideoPanel( wxWindow *parent )
{
wxCheckBox
*
box
=
new
wxCheckBox
(
panel
,
Filter0_Event
+
i
,
wxU
(
_
(
vfilters
[
i
].
psz_name
)
)
);
t_col_sizer
->
Add
(
box
,
0
,
wxALL
,
4
);
t_col_sizer
->
Add
(
box
,
0
,
wxALL
,
2
);
box
->
SetToolTip
(
wxU
(
_
(
vfilters
[
i
].
psz_help
)
)
);
}
...
...
@@ -1215,13 +1214,11 @@ ExtraWindow::ExtraWindow( intf_thread_t *_p_intf, wxWindow *p_parent,
wxFrame( p_parent, -1, wxU(_("Extended controls")), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
fprintf(stderr,"Creating extrawindow\n");
p_intf = _p_intf;
SetIcon( *p_intf->p_sys->p_icon );
wxBoxSizer *window_sizer = new wxBoxSizer( wxVERTICAL );
SetSizer( window_sizer );
// panel = new ExtraPanel( p_intf, this );//_extra_panel;
panel = _extra_panel;
window_sizer->Add( panel );
...
...
modules/gui/wxwidgets/extrapanel.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* 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
$
* $Id$
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
...
...
modules/gui/wxwidgets/input_manager.cpp
0 → 100644
View file @
a644825a
/*****************************************************************************
* slider_manager.cpp : Manage an input slider
*****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* Clment Stenac <zorglub@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.
*****************************************************************************/
#include "input_manager.hpp"
#include "interface.hpp"
#include "video.hpp"
#include <vlc_meta.h>
/* include the toolbar graphics */
#include "bitmaps/prev.xpm"
#include "bitmaps/next.xpm"
#include "bitmaps/playlist.xpm"
/* IDs for the controls */
enum
{
SliderScroll_Event
=
wxID_HIGHEST
,
DiscMenu_Event
,
DiscPrev_Event
,
DiscNext_Event
};
BEGIN_EVENT_TABLE
(
InputManager
,
wxPanel
)
/* Slider events */
EVT_COMMAND_SCROLL
(
SliderScroll_Event
,
InputManager
::
OnSliderUpdate
)
/* Disc Buttons events */
EVT_BUTTON
(
DiscMenu_Event
,
InputManager
::
OnDiscMenu
)
EVT_BUTTON
(
DiscPrev_Event
,
InputManager
::
OnDiscPrev
)
EVT_BUTTON
(
DiscNext_Event
,
InputManager
::
OnDiscNext
)
END_EVENT_TABLE
()
#define STATUS_STOP 0
#define STATUS_PLAYING 1
#define STATUS_PAUSE 2
/*****************************************************************************
* Constructor.
*****************************************************************************/
InputManager
::
InputManager
(
intf_thread_t
*
_p_intf
,
Interface
*
_p_main_intf
,
wxWindow
*
p_parent
)
:
wxPanel
(
p_parent
)
{
p_intf
=
_p_intf
;
p_main_intf
=
_p_main_intf
;
p_input
=
NULL
;
i_old_playing_status
=
STATUS_STOP
;
i_old_rate
=
INPUT_RATE_DEFAULT
;
b_slider_free
=
VLC_TRUE
;
/* Create slider */
slider
=
new
wxSlider
(
this
,
SliderScroll_Event
,
0
,
0
,
SLIDER_MAX_POS
);
/* Create disc buttons */
disc_frame
=
new
wxPanel
(
this
);
disc_menu_button
=
new
wxBitmapButton
(
disc_frame
,
DiscMenu_Event
,
wxBitmap
(
playlist_xpm
)
);
disc_prev_button
=
new
wxBitmapButton
(
disc_frame
,
DiscPrev_Event
,
wxBitmap
(
prev_xpm
)
);
disc_next_button
=
new
wxBitmapButton
(
disc_frame
,
DiscNext_Event
,
wxBitmap
(
next_xpm
)
);
disc_sizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
disc_sizer
->
Add
(
disc_menu_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_sizer
->
Add
(
disc_prev_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_sizer
->
Add
(
disc_next_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_frame
->
SetSizer
(
disc_sizer
);
disc_sizer
->
Layout
();
/* Add everything to the panel */
sizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
SetSizer
(
sizer
);
sizer
->
Add
(
slider
,
1
,
wxEXPAND
|
wxALL
,
5
);
sizer
->
Add
(
disc_frame
,
0
,
wxALL
,
2
);
/* Hide by default */
sizer
->
Hide
(
disc_frame
);
sizer
->
Hide
(
slider
);
sizer
->
Layout
();
Fit
();
}
InputManager
::~
InputManager
()
{
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
);
}
/*****************************************************************************
* Public methods.
*****************************************************************************/
vlc_bool_t
InputManager
::
IsPlaying
()
{
return
(
p_input
&&
!
p_input
->
b_die
);
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void
InputManager
::
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
InputManager
::
UpdateNowPlaying
()
{
char
*
psz_now_playing
=
vlc_input_item_GetInfo
(
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_input
->
input
.
p_item
->
psz_name
),
2
);
}
else
{
p_main_intf
->
statusbar
->
SetStatusText
(
wxU
(
p_input
->
input
.
p_item
->
psz_name
),
2
);
}
free
(
psz_now_playing
);
}
void
InputManager
::
UpdateButtons
(
vlc_bool_t
b_play
)
{
if
(
!
b_play
)
{
if
(
i_old_playing_status
==
STATUS_STOP
)
return
;
i_old_playing_status
=
STATUS_STOP
;
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
return
;
}
/* Manage Playing status */
vlc_value_t
val
;
var_Get
(
p_input
,
"state"
,
&
val
);
val
.
i_int
=
val
.
i_int
==
PAUSE_S
?
STATUS_PAUSE
:
STATUS_PLAYING
;
if
(
i_old_playing_status
!=
val
.
i_int
)
{
i_old_playing_status
=
val
.
i_int
;
p_main_intf
->
TogglePlayButton
(
val
.
i_int
==
STATUS_PAUSE
?
PAUSE_S
:
PLAYING_S
);
#ifdef wxHAS_TASK_BAR_ICON
if
(
p_main_intf
->
p_systray
)
{
p_main_intf
->
p_systray
->
UpdateTooltip
(
wxU
(
p_input
->
input
.
p_item
->
psz_name
)
+
wxString
(
wxT
(
" - "
))
+
(
val
.
i_int
==
PAUSE_S
?
wxU
(
_
(
"Paused"
))
:
wxU
(
_
(
"Playing"
))));
}
#endif
}
}
void
InputManager
::
UpdateDiscButtons
()
{
vlc_value_t
val
;
var_Change
(
p_input
,
"title"
,
VLC_VAR_CHOICESCOUNT
,
&
val
,
NULL
);
if
(
val
.
i_int
>
0
&&
!
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
)
{
disc_menu_button
->
Show
();
disc_sizer
->
Show
(
disc_menu_button
);
disc_sizer
->
Layout
();
disc_sizer
->
Fit
(
disc_frame
);
disc_menu_button
->
SetToolTip
(
wxU
(
_
(
HELP_MENU
)
)
);
disc_prev_button
->
SetToolTip
(
wxU
(
_
(
HELP_PCH
)
)
);
disc_next_button
->
SetToolTip
(
wxU
(
_
(
HELP_NCH
)
)
);
}
else
{
disc_menu_button
->
Hide
();
disc_sizer
->
Hide
(
disc_menu_button
);
disc_prev_button
->
SetToolTip
(
wxU
(
_
(
HELP_PTR
)
)
);
disc_next_button
->
SetToolTip
(
wxU
(
_
(
HELP_NTR
)
)
);
}
ShowDiscFrame
();
}
else
if
(
val
.
i_int
==
0
&&
disc_frame
->
IsShown
()
)
{
HideDiscFrame
();
}
}
void
InputManager
::
HideSlider
()
{
ShowSlider
(
false
);
}
void
InputManager
::
HideDiscFrame
()
{
ShowDiscFrame
(
false
);
}
void
InputManager
::
UpdateTime
()
{
char
psz_time
[
MSTRTIME_MAX_SIZE
],
psz_total
[
MSTRTIME_MAX_SIZE
];
mtime_t
i_seconds
;
i_seconds
=
var_GetTime
(
p_intf
->
p_sys
->
p_input
,
"length"
)
/
1000000
;
secstotimestr
(
psz_total
,
i_seconds
);
i_seconds
=
var_GetTime
(
p_intf
->
p_sys
->
p_input
,
"time"
)
/
1000000
;
secstotimestr
(
psz_time
,
i_seconds
);
p_main_intf
->
statusbar
->
SetStatusText
(
wxU
(
psz_time
)
+
wxString
(
wxT
(
" / "
))
+
wxU
(
psz_total
),
0
);
}
void
InputManager
::
Update
()
{
/* Update the input */
if
(
p_input
==
NULL
)
{
UpdateInput
();
if
(
p_input
)
{
slider
->
SetValue
(
0
);
}
else
{
if
(
disc_frame
->
IsShown
()
)
HideDiscFrame
();
if
(
slider
->
IsShown
()
)
HideSlider
();
}
}
else
if
(
p_input
->
b_dead
)
{
UpdateButtons
(
VLC_FALSE
);
vlc_object_release
(
p_input
);
p_input
=
NULL
;
}
if
(
p_input
&&
!
p_input
->
b_die
)
{
vlc_value_t
pos
,
len
;
UpdateTime
();
UpdateButtons
(
VLC_TRUE
);
UpdateNowPlaying
();
UpdateDiscButtons
();
/* Really manage the slider */
var_Get
(
p_input
,
"position"
,
&
pos
);
var_Get
(
p_input
,
"length"
,
&
len
);
if
(
len
.
i_time
>
0
&&
pos
.
f_float
>=
0
&&
!
slider
->
IsShown
()
)
ShowSlider
();
else
if
(
len
.
i_time
<
0
&&
pos
.
f_float
<=
0
&&
slider
->
IsShown
()
)
HideSlider
();
/* Update the slider if the user isn't dragging it. */
if
(
slider
->
IsShown
()
&&
b_slider_free
)
{
i_slider_pos
=
(
int
)(
SLIDER_MAX_POS
*
pos
.
f_float
);
slider
->
SetValue
(
i_slider_pos
);
}
/* Manage Speed status */
vlc_value_t
val
;
var_Get
(
p_input
,
"rate"
,
&
val
);
if
(
i_old_rate
!=
val
.
i_int
)
{
p_main_intf
->
statusbar
->
SetStatusText
(
wxString
::
Format
(
wxT
(
"x%.2f"
),
(
float
)
INPUT_RATE_DEFAULT
/
val
.
i_int
),
1
);
i_old_rate
=
val
.
i_int
;
}
}
}
/*****************************************************************************
* Event Handlers.
*****************************************************************************/
void
InputManager
::
OnDiscMenu
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
vlc_value_t
val
;
val
.
i_int
=
2
;
var_Set
(
p_input
,
"title 0"
,
val
);
vlc_object_release
(
p_input
);
}
}
void
InputManager
::
OnDiscPrev
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
int
i_type
=
var_Type
(
p_input
,
"prev-chapter"
);
vlc_value_t
val
;
val
.
b_bool
=
VLC_TRUE
;
var_Set
(
p_input
,
(
i_type
&
VLC_VAR_TYPE
)
!=
0
?
"prev-chapter"
:
"prev-title"
,
val
);
vlc_object_release
(
p_input
);
}
}
void
InputManager
::
OnDiscNext
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
int
i_type
=
var_Type
(
p_input
,
"next-chapter"
);
vlc_value_t
val
;
val
.
b_bool
=
VLC_TRUE
;
var_Set
(
p_input
,
(
i_type
&
VLC_VAR_TYPE
)
!=
0
?
"next-chapter"
:
"next-title"
,
val
);
vlc_object_release
(
p_input
);
}
}
void
InputManager
::
OnSliderUpdate
(
wxScrollEvent
&
event
)
{
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
#ifdef WIN32
if
(
event
.
GetEventType
()
==
wxEVT_SCROLL_THUMBRELEASE
||
event
.
GetEventType
()
==
wxEVT_SCROLL_ENDSCROLL
)
{
#endif
if
(
i_slider_pos
!=
event
.
GetPosition
()
&&
p_intf
->
p_sys
->
p_input
)
{
vlc_value_t
pos
;
pos
.
f_float
=
(
float
)
event
.
GetPosition
()
/
(
float
)
SLIDER_MAX_POS
;
var_Set
(
p_intf
->
p_sys
->
p_input
,
"position"
,
pos
);
}
#ifdef WIN32
b_slider_free
=
VLC_TRUE
;
}
else
{
b_slider_free
=
VLC_FALSE
;
if
(
p_intf
->
p_sys
->
p_input
)
UpdateTime
();
}
#endif
#undef WIN32
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
}
void
InputManager
::
ShowSlider
(
bool
show
)
{
if
(
!!
show
==
!!
slider
->
IsShown
()
)
return
;
if
(
p_intf
->
p_sys
->
b_video_autosize
)
UpdateVideoWindow
(
p_intf
,
p_main_intf
->
video_window
);
sizer
->
Show
(
slider
,
show
);
sizer
->
Layout
();
wxCommandEvent
intf_event
(
wxEVT_INTF
,
0
);
p_main_intf
->
AddPendingEvent
(
intf_event
);
}
void
InputManager
::
ShowDiscFrame
(
bool
show
)
{
if
(
!!
show
==
!!
disc_frame
->
IsShown
()
)
return
;
if
(
p_intf
->
p_sys
->
b_video_autosize
)
UpdateVideoWindow
(
p_intf
,
p_main_intf
->
video_window
);
sizer
->
Show
(
disc_frame
,
show
);
sizer
->
Layout
();
wxCommandEvent
intf_event
(
wxEVT_INTF
,
0
);
p_main_intf
->
AddPendingEvent
(
intf_event
);
}
modules/gui/wxwidgets/
slider
_manager.hpp
→
modules/gui/wxwidgets/
input
_manager.hpp
View file @
a644825a
/*****************************************************************************
*
slider_manager.hpp: Header for slider
_manager
*
input_manager.hpp: Header for input
_manager
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id
: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin
$
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Gildas Bazin <gbazin@videolan.org>
* Clment Stenac <zorglub@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
...
...
@@ -21,50 +22,67 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _
SLIDER
_MANAGER_H_
#define _
SLIDER
_MANAGER_H_
#ifndef _
INPUT
_MANAGER_H_
#define _
INPUT
_MANAGER_H_
#include "wxwidgets.hpp"
namespace
wxvlc
{
class
Interface
;
/**
* This class manages a slider corresponding to an input
* This class is abstract, it needs to be subclassed
* This class manages all the controls related to the input
*/
class
SliderManager
class
InputManager
:
public
wxPanel
{
public:
SliderManager
(
intf_thread_t
*
p_intf
);
virtual
~
Slider
Manager
();
InputManager
(
intf_thread_t
*
,
Interface
*
,
wxWindow
*
);
virtual
~
Input
Manager
();
void
Update
();
vlc_bool_t
IsPlaying
();
protected:
virtual
void
UpdateInput
()
=
0
;
virtual
void
UpdateNowPlaying
()
{};
virtual
void
UpdateButtons
(
vlc_bool_t
)
{};
virtual
void
UpdateDiscButtons
()
{}
virtual
void
UpdateTime
(
char
*
,
char
*
)
=
0
;
void
UpdateInput
();
void
UpdateNowPlaying
();
void
UpdateButtons
(
vlc_bool_t
);
void
UpdateDiscButtons
();
void
UpdateTime
();
void
HideSlider
();
void
ShowSlider
(
bool
show
=
true
);
virtual
vlc_bool_t
IsShown
()
=
0
;
virtual
vlc_bool_t
IsFree
()
=
0
;
virtual
vlc_bool_t
IsPlaying
()
=
0
;
void
OnSliderUpdate
(
wxScrollEvent
&
event
);
virtual
void
HideSlider
()
{};
virtual
void
ShowSlider
()
{};
void
OnDiscMenu
(
wxCommandEvent
&
event
);
void
OnDiscPrev
(
wxCommandEvent
&
event
);
void
OnDiscNext
(
wxCommandEvent
&
event
);
virtual
void
HideControls
()
{};
virtual
void
DontHide
()
{};
void
HideDiscFrame
();
void
ShowDiscFrame
(
bool
show
=
true
);
wxPanel
*
disc_frame
;
wxBoxSizer
*
disc_sizer
;
wxBitmapButton
*
disc_menu_button
;
wxBitmapButton
*
disc_prev_button
;
wxBitmapButton
*
disc_next_button
;
intf_thread_t
*
p_intf
;
input_thread_t
*
p_input
;
wxSlider
*
_slider
;
///< Slider for this input
Interface
*
p_main_intf
;
wxSlider
*
slider
;
///< Slider for this input
int
i_slider_pos
;
///< Current slider position
vlc_bool_t
b_slider_free
;
///< Slider status
wxBoxSizer
*
sizer
;
private:
int
i_old_playing_status
;
///< Previous playing status
DECLARE_EVENT_TABLE
();
int
i_old_playing_status
;
///< Previous playing status
int
i_old_rate
;
///< Previous playing rate
};
};
...
...
modules/gui/wxwidgets/interface.cpp
View file @
a644825a
...
...
@@ -102,7 +102,7 @@ public:
};
BEGIN_EVENT_TABLE
(
VLCVolCtrl
,
wxControl
)
EVT_PAINT
(
VLCVolCtrl
::
OnPaint
)
EVT_PAINT
(
VLCVolCtrl
::
OnPaint
)
/* Mouse events */
EVT_LEFT_UP
(
VLCVolCtrl
::
OnChange
)
...
...
@@ -139,11 +139,9 @@ enum
Prefs_Event
,
Extended_Event
,
// Undock_Event,
Bookmarks_Event
,
Skins_Event
,
SliderScroll_Event
,
StopStream_Event
,
PlayStream_Event
,
PrevStream_Event
,
...
...
@@ -151,10 +149,6 @@ enum
SlowStream_Event
,
FastStream_Event
,
DiscMenu_Event
,
DiscPrev_Event
,
DiscNext_Event
,
/* it is important for the id corresponding to the "About" command to have
* this standard value as otherwise it won't be handled properly under Mac
* (where it is special and put into the "Apple" menu) */
...
...
@@ -180,7 +174,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU_OPEN
(
Interface
::
OnMenuOpen
)
EVT_MENU
(
Extended_Event
,
Interface
::
OnExtended
)
// EVT_MENU( Undock_Event, Interface::OnUndock )
EVT_MENU
(
Bookmarks_Event
,
Interface
::
OnShowDialog
)
...
...
@@ -206,20 +199,9 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU
(
SlowStream_Event
,
Interface
::
OnSlowStream
)
EVT_MENU
(
FastStream_Event
,
Interface
::
OnFastStream
)
/* Disc Buttons events */
EVT_BUTTON
(
DiscMenu_Event
,
Interface
::
OnDiscMenu
)
EVT_BUTTON
(
DiscPrev_Event
,
Interface
::
OnDiscPrev
)
EVT_BUTTON
(
DiscNext_Event
,
Interface
::
OnDiscNext
)
/* Slider events */
EVT_COMMAND_SCROLL
(
SliderScroll_Event
,
Interface
::
OnSliderUpdate
)
/* Custom events */
EVT_COMMAND
(
0
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_COMMAND
(
1
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_TIMER
(
ID_CONTROLS_TIMER
,
Interface
::
OnControlsTimer
)
EVT_TIMER
(
ID_SLIDER_TIMER
,
Interface
::
OnSliderTimer
)
END_EVENT_TABLE
()
/*****************************************************************************
...
...
@@ -231,43 +213,36 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
{
/* Initializations */
p_intf
=
_p_intf
;
i_old_playing_status
=
PAUSE_S
;
b_extra
=
VLC_FALSE
;
// b_undock = VLC_FALSE;
extra_window
=
NULL
;
extra_frame
=
0
;
/* Give our interface a nice little icon */
SetIcon
(
wxIcon
(
vlc_xpm
)
);
/* Create a sizer for the main frame */
frame_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
SetSizer
(
frame_sizer
);
/* Create a main panel that will fill in the interface window */
main_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
SetSizer
(
main_sizer
);
main_panel
=
new
wxPanel
(
this
);
main_sizer
->
Add
(
main_panel
,
1
,
wxEXPAND
);
main_panel
->
SetFocus
();
/* Create a dummy widget that can get the keyboard focus */
wxWindow
*
p_dummy
=
new
wxWindow
(
this
,
0
,
wxDefaultPosition
,
wxSize
(
0
,
0
)
);
#if defined(__WXGTK20__) && wxCHECK_VERSION(2,5,6)
/* As ugly as your butt! Please remove when wxWidgets 2.6 fixed their
* Accelerators bug. */
p_dummy
->
m_imData
=
0
;
main_panel
->
m_imData
=
0
;
m_imData
=
0
;
#endif
p_dummy
->
SetFocus
();
frame_sizer
->
Add
(
p_dummy
,
0
,
0
);
/* Create a sizer for the main frame */
panel_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
main_panel
->
SetSizer
(
panel_sizer
);
#ifdef wxHAS_TASK_BAR_ICON
/* Systray integration */
p_systray
=
NULL
;
if
(
config_GetInt
(
p_intf
,
"wx-systray"
)
)
if
(
config_GetInt
(
p_intf
,
"wx-systray"
)
)
{
p_systray
=
new
Systray
(
this
,
p_intf
);
p_systray
->
SetIcon
(
wxIcon
(
vlc16x16_xpm
),
wxT
(
"VLC media player"
)
);
if
(
(
!
p_systray
->
IsOk
())
||
(
!
p_systray
->
IsIconInstalled
())
)
{
msg_Warn
(
p_intf
,
"Cannot set systray icon, weird things may happen"
);
}
p_systray
=
new
Systray
(
this
,
p_intf
);
}
#endif
...
...
@@ -277,11 +252,6 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
/* Creation of the tool bar */
CreateOurToolBar
();
/* Create the extra panel */
extra_frame
=
new
ExtraPanel
(
p_intf
,
this
);
frame_sizer
->
Add
(
extra_frame
,
0
,
wxEXPAND
,
0
);
frame_sizer
->
Hide
(
extra_frame
);
/* Creation of the status bar
* Helptext for menu items and toolbar tools will automatically get
* displayed here. */
...
...
@@ -294,21 +264,19 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
video_window
=
0
;
if
(
config_GetInt
(
p_intf
,
"wx-embed"
)
)
{
video_window
=
CreateVideoWindow
(
p_intf
,
this
);
frame
_sizer
->
Add
(
p_intf
->
p_sys
->
p_video_sizer
,
1
,
wxEXPAND
,
0
);
video_window
=
CreateVideoWindow
(
p_intf
,
main_panel
);
panel
_sizer
->
Add
(
p_intf
->
p_sys
->
p_video_sizer
,
1
,
wxEXPAND
,
0
);
}
/* Creation of the slider sub-window */
CreateOurSlider
();
frame_sizer
->
Add
(
slider_frame
,
0
,
wxEXPAND
,
0
);
frame_sizer
->
Hide
(
slider_frame
);
/* Make sure we've got the right background colour */
SetBackgroundColour
(
slider_frame
->
GetBackgroundColour
()
);
/* Creation of the input manager panel */
input_manager
=
new
InputManager
(
p_intf
,
this
,
main_panel
);
panel_sizer
->
Add
(
input_manager
,
0
,
wxEXPAND
,
0
);
/* Layout everything */
frame_sizer
->
Layout
();
frame_sizer
->
Fit
(
this
);
panel_sizer
->
Layout
();
panel_sizer
->
Fit
(
main_panel
);
main_sizer
->
Layout
();
main_sizer
->
Fit
(
this
);
#if wxUSE_DRAG_AND_DROP
/* Associate drop targets with the main interface */
...
...
@@ -317,60 +285,31 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
SetupHotkeys
();
m_controls_timer
.
SetOwner
(
this
,
ID_CONTROLS_TIMER
);
m_slider_timer
.
SetOwner
(
this
,
ID_SLIDER_TIMER
);
/* Start timer */
timer
=
new
Timer
(
p_intf
,
this
);
/* */
/*
Restore previous position / settings
*/
WindowSettings
*
ws
=
p_intf
->
p_sys
->
p_window_settings
;
wxPoint
p
;
wxSize
s
;
bool
b_shown
;
wxSize
s
;
bool
b_shown
;
ws
->
SetScreen
(
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_X
),
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_Y
)
);
if
(
ws
->
GetSettings
(
WindowSettings
::
ID_MAIN
,
b_shown
,
p
,
s
)
)
Move
(
p
);
if
(
ws
->
GetSettings
(
WindowSettings
::
ID_MAIN
,
b_shown
,
p
,
s
)
)
Move
(
p
);
/* Set minimum window size to prevent user from glitching it */
wxSize
s2
;
/* Get minimum window size to prevent user from glitching it */
s
=
GetSize
();
/* save smallest possible default minimum size */
default_size
=
GetSize
();
/* save slider size for height only for MinSizing */
slider_size
=
slider_sizer
->
GetSize
();
/* and save extended gui size for MinSize scheme */
s2
=
extra_frame
->
GetSize
();
s2
.
SetWidth
(
s2
.
GetWidth
()
+
2
*
wxSystemSettings
::
GetMetric
(
wxSYS_FRAMESIZE_X
)
);
extended_size
=
s2
;
/* Set initial minimum window size */
if
(
config_GetInt
(
p_intf
,
"wx-embed"
)
)
{
s2
=
video_window
->
GetSize
();
s
.
SetHeight
(
s
.
GetHeight
()
-
s2
.
GetHeight
()
);
}
if
(
config_GetInt
(
p_intf
,
"wx-extended"
)
)
{
s
.
SetWidth
(
extended_size
.
GetWidth
()
);
s
.
SetHeight
(
s
.
GetHeight
()
+
extended_size
.
GetHeight
()
);
}
#if (wxCHECK_VERSION(2,5,4))
SetMinSize
(
s
);
#else
frame_sizer
->
SetMinSize
(
s
);
#endif
if
(
video_window
&&
video_window
->
IsShown
()
)
s
.
SetHeight
(
s
.
GetHeight
()
-
video_window
->
GetSize
().
GetHeight
()
);
main_min_size
=
s
;
/* Show extended GUI if requested */
if
(
(
b_extra
=
config_GetInt
(
p_intf
,
"wx-extended"
)
)
)
frame_sizer
->
Show
(
extra_frame
);
wxCommandEvent
dummy
;
if
(
config_GetInt
(
p_intf
,
"wx-extended"
)
)
OnExtended
(
dummy
);
SetIntfMinSize
();
}
Interface
::~
Interface
()
...
...
@@ -414,12 +353,10 @@ void Interface::OnControlEvent( wxCommandEvent& event )
switch
(
event
.
GetId
()
)
{
case
0
:
if
(
p_intf
->
p_sys
->
b_video_autosize
)
{
if
(
p_intf
->
p_sys
->
b_video_autosize
)
{
frame_sizer
->
Layout
();
frame_sizer
->
Fit
(
this
);
}
main_sizer
->
Layout
();
main_sizer
->
Fit
(
this
);
}
break
;
...
...
@@ -536,7 +473,7 @@ void Interface::CreateOurMenuBar()
#endif
/* End patch by zcot */
frame
_sizer
->
SetMinSize
(
i_size
,
-
1
);
panel
_sizer
->
SetMinSize
(
i_size
,
-
1
);
/* Intercept all menu events in our custom event handler */
PushEventHandler
(
new
MenuEvtHandler
(
p_intf
,
this
)
);
...
...
@@ -618,53 +555,6 @@ void Interface::CreateOurToolBar()
#endif
}
void
Interface
::
CreateOurSlider
()
{
/* Create a new frame and sizer containing the slider */
slider_frame
=
new
wxPanel
(
this
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
);
slider_frame
->
SetAutoLayout
(
TRUE
);
slider_sizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
//slider_sizer->SetMinSize( -1, 50 );
/* Create slider */
slider
=
new
wxSlider
(
slider_frame
,
SliderScroll_Event
,
0
,
0
,
SLIDER_MAX_POS
,
wxDefaultPosition
,
wxDefaultSize
);
/* Add Disc Buttons */
disc_frame
=
new
wxPanel
(
slider_frame
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
);
disc_frame
->
SetAutoLayout
(
TRUE
);
disc_sizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
disc_menu_button
=
new
wxBitmapButton
(
disc_frame
,
DiscMenu_Event
,
wxBitmap
(
playlist_xpm
)
);
disc_prev_button
=
new
wxBitmapButton
(
disc_frame
,
DiscPrev_Event
,
wxBitmap
(
prev_xpm
)
);
disc_next_button
=
new
wxBitmapButton
(
disc_frame
,
DiscNext_Event
,
wxBitmap
(
next_xpm
)
);
disc_sizer
->
Add
(
disc_menu_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_sizer
->
Add
(
disc_prev_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_sizer
->
Add
(
disc_next_button
,
1
,
wxEXPAND
|
wxLEFT
|
wxRIGHT
,
1
);
disc_frame
->
SetSizer
(
disc_sizer
);
disc_sizer
->
Layout
();
/* Add everything to the frame */
slider_sizer
->
Add
(
slider
,
1
,
wxEXPAND
|
wxALL
,
5
);
slider_sizer
->
Add
(
disc_frame
,
0
,
wxALL
,
2
);
slider_frame
->
SetSizer
(
slider_sizer
);
disc_frame
->
Hide
();
slider_sizer
->
Hide
(
disc_frame
);
slider_sizer
->
Layout
();
slider_sizer
->
Fit
(
slider_frame
);
/* Hide the slider by default */
slider_frame
->
Hide
();
}
static
int
ConvertHotkeyModifiers
(
int
i_hotkey
)
{
int
i_accel_flags
=
0
;
...
...
@@ -758,118 +648,27 @@ void Interface::SetupHotkeys()
delete
[]
p_entries
;
}
void
Interface
::
HideSlider
(
bool
layout
)
void
Interface
::
SetIntfMinSize
(
)
{
ShowSlider
(
false
,
layout
);
}
wxSize
ms
=
main_min_size
;
void
Interface
::
ShowSlider
(
bool
show
,
bool
layout
)
{
if
(
show
)
if
(
extra_frame
&&
extra_frame
->
IsShown
()
)
{
//prevent the hide timers from hiding it now
m_slider_timer
.
Stop
();
m_controls_timer
.
Stop
();
//prevent continuous layout
if
(
slider_frame
->
IsShown
()
)
return
;
wxSize
ms
=
GetMinSize
();
ms
.
SetHeight
(
ms
.
GetHeight
()
+
slider_size
.
GetHeight
()
);
#if ( wxCHECK_VERSION( 2,5,4 ) )
SetMinSize
(
ms
);
#else
frame_sizer
->
SetMinSize
(
ms
);
#endif
ms
.
SetHeight
(
ms
.
GetHeight
()
+
ext_min_size
.
GetHeight
()
);
if
(
ext_min_size
.
GetWidth
()
>
ms
.
GetWidth
()
)
ms
.
SetWidth
(
ext_min_size
.
GetWidth
()
);
}
else
{
//prevent continuous layout
if
(
!
slider_frame
->
IsShown
()
)
return
;
wxSize
ms
=
GetMinSize
();
ms
.
SetHeight
(
ms
.
GetHeight
()
-
slider_size
.
GetHeight
()
);
#if ( wxCHECK_VERSION( 2,5,4 ) )
SetMinSize
(
ms
);
SetMinSize
(
ms
);
#else
frame
_sizer
->
SetMinSize
(
ms
);
main
_sizer
->
SetMinSize
(
ms
);
#endif
}
if
(
layout
&&
p_intf
->
p_sys
->
b_video_autosize
)
UpdateVideoWindow
(
p_intf
,
video_window
);
slider_frame
->
Show
(
show
);
frame_sizer
->
Show
(
slider_frame
,
show
);
if
(
layout
)
{
frame_sizer
->
Layout
();
if
(
p_intf
->
p_sys
->
b_video_autosize
)
frame_sizer
->
Fit
(
this
);
}
}
void
Interface
::
HideDiscFrame
(
bool
layout
)
{
ShowDiscFrame
(
false
,
layout
);
}
void
Interface
::
ShowDiscFrame
(
bool
show
,
bool
layout
)
{
if
(
show
)
{
//prevent the hide timer from hiding it now
m_controls_timer
.
Stop
();
//prevent continuous layout
if
(
disc_frame
->
IsShown
()
)
return
;
}
else
{
//prevent continuous layout
if
(
!
disc_frame
->
IsShown
()
)
return
;
}
if
(
layout
&&
p_intf
->
p_sys
->
b_video_autosize
)
UpdateVideoWindow
(
p_intf
,
video_window
);
disc_frame
->
Show
(
show
);
slider_sizer
->
Show
(
disc_frame
,
show
);
if
(
layout
)
{
slider_sizer
->
Layout
();
if
(
p_intf
->
p_sys
->
b_video_autosize
)
slider_sizer
->
Fit
(
slider_frame
);
}
}
/*****************************************************************************
* Event Handlers.
*****************************************************************************/
void
Interface
::
OnControlsTimer
(
wxTimerEvent
&
WXUNUSED
(
event
)
)
{
if
(
p_intf
->
p_sys
->
b_video_autosize
)
UpdateVideoWindow
(
p_intf
,
video_window
);
/* Hide slider and Disc Buttons */
//postpone layout, we'll do it ourselves
HideDiscFrame
(
false
);
HideSlider
(
false
);
slider_sizer
->
Layout
();
if
(
p_intf
->
p_sys
->
b_video_autosize
)
{
slider_sizer
->
Fit
(
slider_frame
);
frame_sizer
->
Fit
(
this
);
}
}
void
Interface
::
OnSliderTimer
(
wxTimerEvent
&
WXUNUSED
(
event
)
)
{
HideSlider
();
}
void
Interface
::
OnMenuOpen
(
wxMenuEvent
&
event
)
{
#if defined( __WXMSW__ )
...
...
@@ -884,11 +683,6 @@ void Interface::OnMenuOpen( wxMenuEvent& event )
p_settings_menu
->
AppendCheckItem
(
Extended_Event
,
wxU
(
_
(
"Extended &GUI
\t
Ctrl-G"
)
)
);
if
(
b_extra
)
p_settings_menu
->
Check
(
Extended_Event
,
TRUE
);
#if 0
p_settings_menu->AppendCheckItem( Undock_Event,
wxU(_("&Undock Ext. GUI") ) );
if( b_undock ) p_settings_menu->Check( Undock_Event, TRUE );
#endif
p_settings_menu
->
Append
(
Bookmarks_Event
,
wxU
(
_
(
"&Bookmarks...
\t
Ctrl-B"
)
)
);
p_settings_menu
->
Append
(
Prefs_Event
,
...
...
@@ -1028,38 +822,23 @@ void Interface::OnShowDialog( wxCommandEvent& event )
}
}
void
Interface
::
OnExtended
(
wxCommandEvent
&
event
)
void
Interface
::
OnExtended
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
b_extra
=
(
b_extra
==
VLC_TRUE
?
VLC_FALSE
:
VLC_TRUE
);
if
(
b_extra
==
VLC_FALSE
)
if
(
!
extra_frame
)
{
extra_frame
->
Hide
();
frame_sizer
->
Hide
(
extra_frame
);
wxSize
ms
=
GetMinSize
();
ms
.
SetHeight
(
ms
.
GetHeight
()
-
extended_size
.
GetHeight
()
);
ms
.
SetWidth
(
default_size
.
GetWidth
()
);
#if ( wxCHECK_VERSION( 2,5,4 ) )
SetMinSize
(
ms
);
#else
frame_sizer
->
SetMinSize
(
ms
);
#endif
/* Create the extra panel */
extra_frame
=
new
ExtraPanel
(
p_intf
,
main_panel
);
panel_sizer
->
Add
(
extra_frame
,
0
,
wxEXPAND
,
0
);
ext_min_size
=
extra_frame
->
GetBestSize
();
}
else
{
extra_frame
->
Show
();
frame_sizer
->
Show
(
extra_frame
);
wxSize
ms
=
GetMinSize
();
ms
.
SetHeight
(
ms
.
GetHeight
()
+
extended_size
.
GetHeight
()
);
ms
.
SetWidth
(
extended_size
.
GetWidth
()
);
#if ( wxCHECK_VERSION( 2,5,4 ) )
SetMinSize
(
ms
);
#else
frame_sizer
->
SetMinSize
(
ms
);
#endif
}
frame_sizer
->
Layout
();
frame_sizer
->
Fit
(
this
);
b_extra
=
!
b_extra
;
panel_sizer
->
Show
(
extra_frame
,
b_extra
);
SetIntfMinSize
();
main_sizer
->
Layout
();
main_sizer
->
Fit
(
this
);
}
void
Interface
::
OnPlayStream
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
...
...
@@ -1086,13 +865,12 @@ void Interface::PlayStream()
{
/* No stream was playing, start one */
playlist_Play
(
p_playlist
);
TogglePlayButton
(
PLAYING_S
);
vlc_object_release
(
p_playlist
);
input_manager
->
Update
();
return
;
}
var_Get
(
p_input
,
"state"
,
&
state
);
if
(
state
.
i_int
!=
PAUSE_S
)
{
/* A stream is being played, pause it */
...
...
@@ -1105,9 +883,9 @@ void Interface::PlayStream()
}
var_Set
(
p_input
,
"state"
,
state
);
TogglePlayButton
(
state
.
i_int
);
vlc_object_release
(
p_input
);
vlc_object_release
(
p_playlist
);
input_manager
->
Update
();
}
else
{
...
...
@@ -1132,57 +910,8 @@ void Interface::StopStream()
}
playlist_Stop
(
p_playlist
);
TogglePlayButton
(
PAUSE_S
);
vlc_object_release
(
p_playlist
);
}
void
Interface
::
OnSliderUpdate
(
wxScrollEvent
&
event
)
{
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
#ifdef WIN32
if
(
event
.
GetEventType
()
==
wxEVT_SCROLL_THUMBRELEASE
||
event
.
GetEventType
()
==
wxEVT_SCROLL_ENDSCROLL
)
{
#endif
if
(
p_intf
->
p_sys
->
i_slider_pos
!=
event
.
GetPosition
()
&&
p_intf
->
p_sys
->
p_input
)
{
vlc_value_t
pos
;
pos
.
f_float
=
(
float
)
event
.
GetPosition
()
/
(
float
)
SLIDER_MAX_POS
;
var_Set
(
p_intf
->
p_sys
->
p_input
,
"position"
,
pos
);
}
#ifdef WIN32
p_intf
->
p_sys
->
b_slider_free
=
VLC_TRUE
;
}
else
{
p_intf
->
p_sys
->
b_slider_free
=
VLC_FALSE
;
if
(
p_intf
->
p_sys
->
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_intf
->
p_sys
->
p_input
,
"length"
)
/
I64C
(
1000000
);
secstotimestr
(
psz_total
,
i_seconds
);
i_seconds
=
var_GetTime
(
p_intf
->
p_sys
->
p_input
,
"time"
)
/
I64C
(
1000000
);
secstotimestr
(
psz_time
,
i_seconds
);
statusbar
->
SetStatusText
(
wxU
(
psz_time
)
+
wxString
(
wxT
(
" / "
)
)
+
wxU
(
psz_total
),
0
);
}
}
#endif
#undef WIN32
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
input_manager
->
Update
();
}
void
Interface
::
OnPrevStream
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
...
...
@@ -1252,9 +981,6 @@ void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
void
Interface
::
TogglePlayButton
(
int
i_playing_status
)
{
if
(
i_playing_status
==
i_old_playing_status
)
return
;
wxToolBarToolBase
*
p_tool
=
(
wxToolBarToolBase
*
)
GetToolBar
()
->
GetToolClientData
(
PlayStream_Event
);
if
(
!
p_tool
)
return
;
...
...
@@ -1275,56 +1001,6 @@ void Interface::TogglePlayButton( int i_playing_status )
GetToolBar
()
->
Realize
();
GetToolBar
()
->
ToggleTool
(
PlayStream_Event
,
true
);
GetToolBar
()
->
ToggleTool
(
PlayStream_Event
,
false
);
i_old_playing_status
=
i_playing_status
;
}
void
Interface
::
OnDiscMenu
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
vlc_value_t
val
;
val
.
i_int
=
2
;
var_Set
(
p_input
,
"title 0"
,
val
);
vlc_object_release
(
p_input
);
}
}
void
Interface
::
OnDiscPrev
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
int
i_type
=
var_Type
(
p_input
,
"prev-chapter"
);
vlc_value_t
val
;
val
.
b_bool
=
VLC_TRUE
;
var_Set
(
p_input
,
(
i_type
&
VLC_VAR_TYPE
)
!=
0
?
"prev-chapter"
:
"prev-title"
,
val
);
vlc_object_release
(
p_input
);
}
}
void
Interface
::
OnDiscNext
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
int
i_type
=
var_Type
(
p_input
,
"next-chapter"
);
vlc_value_t
val
;
val
.
b_bool
=
VLC_TRUE
;
var_Set
(
p_input
,
(
i_type
&
VLC_VAR_TYPE
)
!=
0
?
"next-chapter"
:
"next-title"
,
val
);
vlc_object_release
(
p_input
);
}
}
#if wxUSE_DRAG_AND_DROP
...
...
@@ -1494,6 +1170,12 @@ Systray::Systray( Interface *_p_main_interface, intf_thread_t *_p_intf )
{
p_main_interface
=
_p_main_interface
;
p_intf
=
_p_intf
;
SetIcon
(
wxIcon
(
vlc16x16_xpm
),
wxT
(
"VLC media player"
)
);
if
(
!
IsOk
()
||
!
IsIconInstalled
()
)
{
msg_Warn
(
p_intf
,
"cannot set systray icon, weird things may happen"
);
}
}
/* Event handlers */
...
...
modules/gui/wxwidgets/interface.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* interface.hpp: Main interface headers
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id
: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub
$
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
...
...
@@ -25,11 +25,11 @@
#define _WXVLC_INTERFACE_H_
#include "wxwidgets.hpp"
#include "input_manager.hpp"
#include <wx/dnd.h>
#include <wx/accel.h>
#include <wx/taskbar.h>
//#include "vlc_keys.h"
namespace
wxvlc
...
...
@@ -91,30 +91,17 @@ namespace wxvlc
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
;
wxBoxSizer
*
main_sizer
;
void
HideDiscFrame
(
bool
layout
=
true
)
;
void
ShowDiscFrame
(
bool
show
=
true
,
bool
layout
=
true
)
;
wxPanel
*
main_panel
;
wxBoxSizer
*
panel_sizer
;
wxPanel
*
disc_frame
;
wxBoxSizer
*
disc_sizer
;
wxBitmapButton
*
disc_menu_button
;
wxBitmapButton
*
disc_prev_button
;
wxBitmapButton
*
disc_next_button
;
wxStatusBar
*
statusbar
;
wxFrame
*
extra_window
;
InputManager
*
input_manager
;
vlc_bool_t
b_extra
;
vlc_bool_t
b_undock
;
vlc_bool_t
b_extra
;
wxPanel
*
extra_frame
;
wxControl
*
volctrl
;
...
...
@@ -122,21 +109,18 @@ namespace wxvlc
Systray
*
p_systray
;
#endif
wxTimer
m_controls_timer
;
wxTimer
m_slider_timer
;
wxWindow
*
video_window
;
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
SetIntfMinSize
();
/* Event handlers (these functions should _not_ be virtual) */
void
OnExit
(
wxCommandEvent
&
event
);
void
OnAbout
(
wxCommandEvent
&
event
);
...
...
@@ -148,22 +132,16 @@ namespace wxvlc
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__ )
...
...
@@ -178,8 +156,6 @@ namespace wxvlc
Timer
*
timer
;
intf_thread_t
*
p_intf
;
wxWindow
*
video_window
;
int
i_old_playing_status
;
/* For auto-generated menus */
...
...
@@ -188,10 +164,9 @@ namespace wxvlc
wxMenu
*
p_video_menu
;
wxMenu
*
p_navig_menu
;
/* utility dimensions */
wxSize
default_size
;
wxSize
extended_size
;
wxSize
slider_size
;
/* Utility dimensions */
wxSize
main_min_size
;
wxSize
ext_min_size
;
};
...
...
@@ -247,12 +222,10 @@ namespace wxvlc
};
};
/// \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
modules/gui/wxwidgets/main_slider_manager.cpp
deleted
100644 → 0
View file @
70e52acc
/*****************************************************************************
* 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: Clment Stenac <zorglub@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.
*****************************************************************************/
#include "main_slider_manager.hpp"
#include "interface.hpp"
#include <vlc_meta.h>
/*****************************************************************************
* 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
);
}
modules/gui/wxwidgets/main_slider_manager.hpp
deleted
100644 → 0
View file @
70e52acc
/*****************************************************************************
* 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 <zorglub@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 _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
modules/gui/wxwidgets/slider_manager.cpp
deleted
100644 → 0
View file @
70e52acc
/*****************************************************************************
* 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: Clment Stenac <zorglub@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/aout.h>
#include <vlc/intf.h>
#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 );
}
}
}
}
}
}
modules/gui/wxwidgets/timer.cpp
View file @
a644825a
...
...
@@ -25,7 +25,7 @@
* Preamble
*****************************************************************************/
#include "timer.hpp"
#include "
main_slider
_manager.hpp"
#include "
input
_manager.hpp"
#include "interface.hpp"
#include "vlc_meta.h"
...
...
@@ -46,11 +46,6 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
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
;
/* Register callback for the intf-popupmenu variable */
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_PLAYLIST
,
...
...
@@ -77,8 +72,6 @@ Timer::~Timer()
var_DelCallback
(
p_playlist
,
"intf-show"
,
IntfShowCB
,
p_intf
);
vlc_object_release
(
p_playlist
);
}
delete
msm
;
}
/*****************************************************************************
...
...
@@ -104,61 +97,12 @@ void Timer::Notify()
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
/* Call update */
msm
->
Update
();
p_main_interface
->
input_manager
->
Update
();
vlc_value_t
val
;
input_thread_t
*
p_input
=
p_intf
->
p_sys
->
p_input
;
if
(
p_intf
->
p_sys
->
p_input
)
{
if
(
!
p_intf
->
p_sys
->
p_input
->
b_die
)
{
/* Take care of the volume, etc... */
p_main_interface
->
Update
();
/* Manage Playing status */
var_Get
(
p_input
,
"state"
,
&
val
);
if
(
i_old_playing_status
!=
val
.
i_int
)
{
if
(
val
.
i_int
==
PAUSE_S
)
{
p_main_interface
->
TogglePlayButton
(
PAUSE_S
);
}
else
{
p_main_interface
->
TogglePlayButton
(
PLAYING_S
);
}
#ifdef wxHAS_TASK_BAR_ICON
if
(
p_main_interface
->
p_systray
)
{
if
(
val
.
i_int
==
PAUSE_S
)
{
p_main_interface
->
p_systray
->
UpdateTooltip
(
wxU
(
p_intf
->
p_sys
->
p_input
->
input
.
p_item
->
psz_name
)
+
wxString
(
wxT
(
" - "
))
+
wxU
(
_
(
"Paused"
)));
}
else
{
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
=
val
.
i_int
;
}
/* Manage Speed status */
var_Get
(
p_input
,
"rate"
,
&
val
);
if
(
i_old_rate
!=
val
.
i_int
)
{
p_main_interface
->
statusbar
->
SetStatusText
(
wxString
::
Format
(
wxT
(
"x%.2f"
),
(
float
)
INPUT_RATE_DEFAULT
/
val
.
i_int
),
1
);
i_old_rate
=
val
.
i_int
;
}
}
}
else
if
(
p_intf
->
p_sys
->
b_playing
&&
!
p_intf
->
b_die
)
if
(
p_main_interface
->
input_manager
->
IsPlaying
()
)
{
p_intf
->
p_sys
->
b_playing
=
0
;
p_main_interface
->
TogglePlayButton
(
PAUSE_S
);
i_old_playing_status
=
PAUSE_S
;
/* Take care of the volume, etc... */
p_main_interface
->
Update
();
}
/* Show the interface, if requested */
...
...
modules/gui/wxwidgets/timer.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* timer.hpp: Timer headers
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id
: wxwidgets.h 12502 2005-09-09 19:38:01Z gbazin
$
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
...
...
@@ -25,7 +25,7 @@
namespace
wxvlc
{
class
MainSlider
Manager
;
class
Input
Manager
;
class
Interface
;
class
Timer
:
public
wxTimer
...
...
@@ -38,16 +38,13 @@ namespace wxvlc
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
;
MainSlider
Manager
*
msm
;
Input
Manager
*
msm
;
};
}
modules/gui/wxwidgets/video.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* video.hpp: Embedded video management
*****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team
* $Id
: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub
$
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
...
...
modules/gui/wxwidgets/wxwidgets.cpp
View file @
a644825a
...
...
@@ -180,8 +180,6 @@ static int Open( vlc_object_t *p_this )
p_intf
->
p_sys
->
p_input
=
NULL
;
p_intf
->
p_sys
->
i_playing
=
-
1
;
p_intf
->
p_sys
->
b_slider_free
=
1
;
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_video_window
=
NULL
;
...
...
modules/gui/wxwidgets/wxwidgets.hpp
View file @
a644825a
...
...
@@ -2,7 +2,7 @@
* 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
$
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
...
...
@@ -137,11 +137,6 @@ struct intf_sys_t
/* 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 */
...
...
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