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
ce596a3b
Commit
ce596a3b
authored
Apr 01, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/gui/wxwindows: re-implemented the mute control.
parent
8f467369
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
79 deletions
+83
-79
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/interface.cpp
+81
-77
modules/gui/wxwindows/wxwindows.h
modules/gui/wxwindows/wxwindows.h
+2
-2
No files found.
modules/gui/wxwindows/interface.cpp
View file @
ce596a3b
...
@@ -78,28 +78,31 @@ private:
...
@@ -78,28 +78,31 @@ private:
};
};
class
wxVolCtrl
:
public
wxGauge
class
wxVolCtrl
;
class
VLCVolCtrl
:
public
wxControl
{
{
public:
public:
/* Constructor */
VLCVolCtrl
(
intf_thread_t
*
p_intf
,
wxWindow
*
p_parent
);
wxVolCtrl
(
intf_thread_t
*
_p_intf
,
wxWindow
*
parent
,
wxWindowID
id
,
virtual
~
VLCVolCtrl
()
{};
wxPoint
=
wxDefaultPosition
,
wxSize
=
wxSize
(
20
,
-
1
)
);
virtual
~
wxVolCtrl
()
{};
virtual
void
OnPaint
(
wxPaintEvent
&
event
);
void
OnChange
(
wxMouseEvent
&
event
);
void
UpdateVolume
();
void
UpdateVolume
();
void
OnChange
(
wxMouseEvent
&
event
);
private:
DECLARE_EVENT_TABLE
()
private:
wxVolCtrl
*
gauge
;
int
i_y_offset
;
vlc_bool_t
b_mute
;
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
DECLARE_EVENT_TABLE
();
};
};
BEGIN_EVENT_TABLE
(
wxVolCtrl
,
wxWindow
)
BEGIN_EVENT_TABLE
(
VLCVolCtrl
,
wxControl
)
EVT_PAINT
(
VLCVolCtrl
::
OnPaint
)
/* Mouse events */
/* Mouse events */
EVT_LEFT_DOWN
(
wxVolCtrl
::
OnChange
)
EVT_LEFT_UP
(
VLCVolCtrl
::
OnChange
)
EVT_MOTION
(
wxVolCtrl
::
OnChange
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/*****************************************************************************
/*****************************************************************************
...
@@ -143,7 +146,6 @@ enum
...
@@ -143,7 +146,6 @@ enum
NextStream_Event
,
NextStream_Event
,
SlowStream_Event
,
SlowStream_Event
,
FastStream_Event
,
FastStream_Event
,
Mute_Event
,
DiscMenu_Event
,
DiscMenu_Event
,
DiscPrev_Event
,
DiscPrev_Event
,
...
@@ -194,7 +196,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
...
@@ -194,7 +196,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU
(
NextStream_Event
,
Interface
::
OnNextStream
)
EVT_MENU
(
NextStream_Event
,
Interface
::
OnNextStream
)
EVT_MENU
(
SlowStream_Event
,
Interface
::
OnSlowStream
)
EVT_MENU
(
SlowStream_Event
,
Interface
::
OnSlowStream
)
EVT_MENU
(
FastStream_Event
,
Interface
::
OnFastStream
)
EVT_MENU
(
FastStream_Event
,
Interface
::
OnFastStream
)
EVT_MENU
(
Mute_Event
,
Interface
::
OnMute
)
/* Disc Buttons events */
/* Disc Buttons events */
EVT_BUTTON
(
DiscMenu_Event
,
Interface
::
OnDiscMenu
)
EVT_BUTTON
(
DiscMenu_Event
,
Interface
::
OnDiscMenu
)
...
@@ -328,7 +329,7 @@ void Interface::Init()
...
@@ -328,7 +329,7 @@ void Interface::Init()
void
Interface
::
Update
()
void
Interface
::
Update
()
{
{
/* Misc updates */
/* Misc updates */
((
wx
VolCtrl
*
)
volctrl
)
->
UpdateVolume
();
((
VLC
VolCtrl
*
)
volctrl
)
->
UpdateVolume
();
}
}
void
Interface
::
OnControlEvent
(
wxCommandEvent
&
event
)
void
Interface
::
OnControlEvent
(
wxCommandEvent
&
event
)
...
@@ -430,35 +431,6 @@ void Interface::CreateOurMenuBar()
...
@@ -430,35 +431,6 @@ void Interface::CreateOurMenuBar()
#endif
#endif
}
}
class
VLCVolCtrl
:
public
wxControl
{
public:
VLCVolCtrl
(
intf_thread_t
*
p_intf
,
wxWindow
*
p_parent
,
wxGauge
**
);
virtual
~
VLCVolCtrl
()
{};
private:
DECLARE_EVENT_TABLE
()
int
i_y_offset
;
};
BEGIN_EVENT_TABLE
(
VLCVolCtrl
,
wxControl
)
END_EVENT_TABLE
()
#if defined(__WXGTK__)
#define VLCVOL_HEIGHT p_parent->GetSize().GetHeight()
#else
#define VLCVOL_HEIGHT TOOLBAR_BMP_HEIGHT
#endif
VLCVolCtrl
::
VLCVolCtrl
(
intf_thread_t
*
p_intf
,
wxWindow
*
p_parent
,
wxGauge
**
pp_volctrl
)
:
wxControl
(
p_parent
,
-
1
,
wxDefaultPosition
,
wxSize
(
64
,
VLCVOL_HEIGHT
),
wxBORDER_NONE
),
i_y_offset
((
VLCVOL_HEIGHT
-
TOOLBAR_BMP_HEIGHT
)
/
2
)
{
*
pp_volctrl
=
new
wxVolCtrl
(
p_intf
,
this
,
-
1
,
wxPoint
(
0
,
i_y_offset
),
wxSize
(
44
,
TOOLBAR_BMP_HEIGHT
)
);
}
void
Interface
::
CreateOurToolBar
()
void
Interface
::
CreateOurToolBar
()
{
{
#define HELP_OPEN N_("Open")
#define HELP_OPEN N_("Open")
...
@@ -470,7 +442,6 @@ void Interface::CreateOurToolBar()
...
@@ -470,7 +442,6 @@ void Interface::CreateOurToolBar()
#define HELP_PLN N_("Next playlist item")
#define HELP_PLN N_("Next playlist item")
#define HELP_SLOW N_("Play slower")
#define HELP_SLOW N_("Play slower")
#define HELP_FAST N_("Play faster")
#define HELP_FAST N_("Play faster")
#define HELP_MUTE N_("Toggle mute")
wxLogNull
LogDummy
;
/* Hack to suppress annoying log message on the win32
wxLogNull
LogDummy
;
/* Hack to suppress annoying log message on the win32
* version because we don't include wx.rc */
* version because we don't include wx.rc */
...
@@ -509,12 +480,8 @@ void Interface::CreateOurToolBar()
...
@@ -509,12 +480,8 @@ void Interface::CreateOurToolBar()
toolbar
->
AddControl
(
p_dummy_ctrl
);
toolbar
->
AddControl
(
p_dummy_ctrl
);
wxToolBarToolBase
*
p_tool2
=
toolbar
->
AddTool
(
Mute_Event
,
wxT
(
""
),
volctrl
=
new
VLCVolCtrl
(
p_intf
,
toolbar
);
wxBitmap
(
speaker_xpm
),
wxU
(
_
(
HELP_MUTE
))
);
toolbar
->
AddControl
(
volctrl
);
p_tool2
->
SetClientData
(
p_tool2
);
VLCVolCtrl
*
sound_control
=
new
VLCVolCtrl
(
p_intf
,
toolbar
,
&
volctrl
);
toolbar
->
AddControl
(
sound_control
);
toolbar
->
Realize
();
toolbar
->
Realize
();
...
@@ -1199,31 +1166,6 @@ void Interface::OnDiscNext( wxCommandEvent& WXUNUSED(event) )
...
@@ -1199,31 +1166,6 @@ void Interface::OnDiscNext( wxCommandEvent& WXUNUSED(event) )
}
}
}
}
void
Interface
::
OnMute
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
int
i_volume
=
1
;
aout_VolumeMute
(
p_intf
,
(
audio_volume_t
*
)
&
i_volume
);
wxToolBarToolBase
*
p_tool
=
(
wxToolBarToolBase
*
)
GetToolBar
()
->
GetToolClientData
(
Mute_Event
);
if
(
!
p_tool
)
return
;
if
(
i_volume
!=
0
)
{
p_tool
->
SetNormalBitmap
(
wxBitmap
(
speaker_xpm
)
);
p_tool
->
SetLabel
(
wxU
(
_
(
""
))
);
p_tool
->
SetShortHelp
(
wxU
(
_
(
HELP_MUTE
))
);
}
else
{
p_tool
->
SetNormalBitmap
(
wxBitmap
(
speaker_mute_xpm
)
);
p_tool
->
SetLabel
(
wxU
(
_
(
""
))
);
p_tool
->
SetShortHelp
(
wxU
(
_
(
HELP_MUTE
))
);
}
GetToolBar
()
->
Realize
();
}
#if wxUSE_DRAG_AND_DROP
#if wxUSE_DRAG_AND_DROP
/*****************************************************************************
/*****************************************************************************
* Definition of DragAndDrop class.
* Definition of DragAndDrop class.
...
@@ -1262,6 +1204,30 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
...
@@ -1262,6 +1204,30 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
/*****************************************************************************
/*****************************************************************************
* Definition of VolCtrl class.
* Definition of VolCtrl class.
*****************************************************************************/
*****************************************************************************/
class
wxVolCtrl
:
public
wxGauge
{
public:
/* Constructor */
wxVolCtrl
(
intf_thread_t
*
_p_intf
,
wxWindow
*
parent
,
wxWindowID
id
,
wxPoint
=
wxDefaultPosition
,
wxSize
=
wxSize
(
20
,
-
1
)
);
virtual
~
wxVolCtrl
()
{};
void
UpdateVolume
();
void
OnChange
(
wxMouseEvent
&
event
);
private:
intf_thread_t
*
p_intf
;
DECLARE_EVENT_TABLE
();
};
BEGIN_EVENT_TABLE
(
wxVolCtrl
,
wxWindow
)
/* Mouse events */
EVT_LEFT_DOWN
(
wxVolCtrl
::
OnChange
)
EVT_MOTION
(
wxVolCtrl
::
OnChange
)
END_EVENT_TABLE
()
wxVolCtrl
::
wxVolCtrl
(
intf_thread_t
*
_p_intf
,
wxWindow
*
parent
,
wxWindowID
id
,
wxVolCtrl
::
wxVolCtrl
(
intf_thread_t
*
_p_intf
,
wxWindow
*
parent
,
wxWindowID
id
,
wxPoint
point
,
wxSize
size
)
wxPoint
point
,
wxSize
size
)
:
wxGauge
(
parent
,
id
,
200
,
point
,
size
,
wxGA_HORIZONTAL
|
wxGA_SMOOTH
)
:
wxGauge
(
parent
,
id
,
200
,
point
,
size
,
wxGA_HORIZONTAL
|
wxGA_SMOOTH
)
...
@@ -1292,6 +1258,45 @@ void wxVolCtrl::UpdateVolume()
...
@@ -1292,6 +1258,45 @@ void wxVolCtrl::UpdateVolume()
i_gauge_volume
/
2
)
);
i_gauge_volume
/
2
)
);
}
}
#if defined(__WXGTK__)
#define VLCVOL_HEIGHT p_parent->GetSize().GetHeight()
#else
#define VLCVOL_HEIGHT TOOLBAR_BMP_HEIGHT
#endif
VLCVolCtrl
::
VLCVolCtrl
(
intf_thread_t
*
_p_intf
,
wxWindow
*
p_parent
)
:
wxControl
(
p_parent
,
-
1
,
wxDefaultPosition
,
wxSize
(
64
,
VLCVOL_HEIGHT
),
wxBORDER_NONE
),
i_y_offset
((
VLCVOL_HEIGHT
-
TOOLBAR_BMP_HEIGHT
)
/
2
),
b_mute
(
0
),
p_intf
(
_p_intf
)
{
gauge
=
new
wxVolCtrl
(
p_intf
,
this
,
-
1
,
wxPoint
(
18
,
i_y_offset
),
wxSize
(
44
,
TOOLBAR_BMP_HEIGHT
)
);
}
void
VLCVolCtrl
::
OnPaint
(
wxPaintEvent
&
evt
)
{
wxPaintDC
dc
(
this
);
wxBitmap
mPlayBitmap
(
b_mute
?
speaker_mute_xpm
:
speaker_xpm
);
dc
.
DrawBitmap
(
mPlayBitmap
,
0
,
i_y_offset
,
TRUE
);
}
void
VLCVolCtrl
::
OnChange
(
wxMouseEvent
&
event
)
{
if
(
event
.
GetX
()
<
TOOLBAR_BMP_WIDTH
)
{
int
i_volume
;
aout_VolumeMute
(
p_intf
,
(
audio_volume_t
*
)
&
i_volume
);
b_mute
=
!
b_mute
;
Refresh
();
}
}
void
VLCVolCtrl
::
UpdateVolume
()
{
gauge
->
UpdateVolume
();
}
/*****************************************************************************
/*****************************************************************************
* Systray class.
* Systray class.
*****************************************************************************/
*****************************************************************************/
...
@@ -1371,4 +1376,3 @@ void Systray::UpdateTooltip( const wxChar* tooltip )
...
@@ -1371,4 +1376,3 @@ void Systray::UpdateTooltip( const wxChar* tooltip )
SetIcon
(
wxIcon
(
vlc16x16_xpm
),
tooltip
);
SetIcon
(
wxIcon
(
vlc16x16_xpm
),
tooltip
);
}
}
#endif
#endif
modules/gui/wxwindows/wxwindows.h
View file @
ce596a3b
...
@@ -340,7 +340,8 @@ public:
...
@@ -340,7 +340,8 @@ public:
vlc_bool_t
b_extra
;
vlc_bool_t
b_extra
;
vlc_bool_t
b_undock
;
vlc_bool_t
b_undock
;
wxGauge
*
volctrl
;
wxControl
*
volctrl
;
#ifdef wxHAS_TASK_BAR_ICON
#ifdef wxHAS_TASK_BAR_ICON
Systray
*
p_systray
;
Systray
*
p_systray
;
#endif
#endif
...
@@ -376,7 +377,6 @@ private:
...
@@ -376,7 +377,6 @@ private:
void
OnNextStream
(
wxCommandEvent
&
event
);
void
OnNextStream
(
wxCommandEvent
&
event
);
void
OnSlowStream
(
wxCommandEvent
&
event
);
void
OnSlowStream
(
wxCommandEvent
&
event
);
void
OnFastStream
(
wxCommandEvent
&
event
);
void
OnFastStream
(
wxCommandEvent
&
event
);
void
OnMute
(
wxCommandEvent
&
event
);
void
OnDiscMenu
(
wxCommandEvent
&
event
);
void
OnDiscMenu
(
wxCommandEvent
&
event
);
void
OnDiscPrev
(
wxCommandEvent
&
event
);
void
OnDiscPrev
(
wxCommandEvent
&
event
);
...
...
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