mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 17:11:12 +02:00
Rename Meter as MeterPanel, and some DOxygen
This commit is contained in:
@@ -11,30 +11,30 @@
|
||||
|
||||
*******************************************************************//**
|
||||
|
||||
\class Meter
|
||||
\class MeterPanel
|
||||
\brief VU Meter, for displaying recording/playback level
|
||||
|
||||
This is a bunch of common code that can display many different
|
||||
forms of VU meters and other displays.
|
||||
|
||||
But note that a lot of later code here assumes these are
|
||||
MeterToolBar meters, e.g., Meter::StartMonitoring,
|
||||
MeterToolBar meters, e.g., MeterPanel::StartMonitoring,
|
||||
so these are not as generic/common as originally intended.
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class MeterBar
|
||||
\brief A struct used by Meter to hold the position of one bar.
|
||||
\brief A struct used by MeterPanel to hold the position of one bar.
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class MeterUpdateMsg
|
||||
\brief Message used to update the Meter
|
||||
\brief Message used to update the MeterPanel
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class MeterUpdateQueue
|
||||
\brief Queue of MeterUpdateMsg used to feed the Meter.
|
||||
\brief Queue of MeterUpdateMsg used to feed the MeterPanel.
|
||||
|
||||
*//******************************************************************/
|
||||
|
||||
@@ -106,7 +106,7 @@ wxString MeterUpdateMsg::toStringIfClipped()
|
||||
}
|
||||
|
||||
//
|
||||
// The Meter passes itself messages via this queue so that it can
|
||||
// The MeterPanel passes itself messages via this queue so that it can
|
||||
// communicate between the audio thread and the GUI thread.
|
||||
// This class is as simple as possible in order to be thread-safe
|
||||
// without needing mutexes.
|
||||
@@ -166,7 +166,7 @@ bool MeterUpdateQueue::Get(MeterUpdateMsg &msg)
|
||||
}
|
||||
|
||||
//
|
||||
// Meter class
|
||||
// MeterPanel class
|
||||
//
|
||||
|
||||
#include "../../images/SpeakerMenu.xpm"
|
||||
@@ -191,24 +191,24 @@ enum {
|
||||
OnPreferencesID
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(Meter, wxPanelWrapper)
|
||||
EVT_TIMER(OnMeterUpdateID, Meter::OnMeterUpdate)
|
||||
EVT_MOUSE_EVENTS(Meter::OnMouse)
|
||||
EVT_CONTEXT_MENU(Meter::OnContext)
|
||||
EVT_KEY_DOWN(Meter::OnKeyDown)
|
||||
EVT_KEY_UP(Meter::OnKeyUp)
|
||||
EVT_SET_FOCUS(Meter::OnSetFocus)
|
||||
EVT_KILL_FOCUS(Meter::OnKillFocus)
|
||||
EVT_ERASE_BACKGROUND(Meter::OnErase)
|
||||
EVT_PAINT(Meter::OnPaint)
|
||||
EVT_SIZE(Meter::OnSize)
|
||||
EVT_MENU(OnMonitorID, Meter::OnMonitor)
|
||||
EVT_MENU(OnPreferencesID, Meter::OnPreferences)
|
||||
BEGIN_EVENT_TABLE(MeterPanel, wxPanelWrapper)
|
||||
EVT_TIMER(OnMeterUpdateID, MeterPanel::OnMeterUpdate)
|
||||
EVT_MOUSE_EVENTS(MeterPanel::OnMouse)
|
||||
EVT_CONTEXT_MENU(MeterPanel::OnContext)
|
||||
EVT_KEY_DOWN(MeterPanel::OnKeyDown)
|
||||
EVT_KEY_UP(MeterPanel::OnKeyUp)
|
||||
EVT_SET_FOCUS(MeterPanel::OnSetFocus)
|
||||
EVT_KILL_FOCUS(MeterPanel::OnKillFocus)
|
||||
EVT_ERASE_BACKGROUND(MeterPanel::OnErase)
|
||||
EVT_PAINT(MeterPanel::OnPaint)
|
||||
EVT_SIZE(MeterPanel::OnSize)
|
||||
EVT_MENU(OnMonitorID, MeterPanel::OnMonitor)
|
||||
EVT_MENU(OnPreferencesID, MeterPanel::OnPreferences)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_CLASS(Meter, wxPanelWrapper)
|
||||
IMPLEMENT_CLASS(MeterPanel, wxPanelWrapper)
|
||||
|
||||
Meter::Meter(AudacityProject *project,
|
||||
MeterPanel::MeterPanel(AudacityProject *project,
|
||||
wxWindow* parent, wxWindowID id,
|
||||
bool isInput,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
@@ -271,17 +271,17 @@ Meter::Meter(AudacityProject *project,
|
||||
|
||||
// Register for our preference update event
|
||||
wxTheApp->Connect(EVT_METER_PREFERENCES_CHANGED,
|
||||
wxCommandEventHandler(Meter::OnMeterPrefsUpdated),
|
||||
wxCommandEventHandler(MeterPanel::OnMeterPrefsUpdated),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
if (mIsInput) {
|
||||
wxTheApp->Connect(EVT_AUDIOIO_MONITOR,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
wxTheApp->Connect(EVT_AUDIOIO_CAPTURE,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
@@ -295,7 +295,7 @@ Meter::Meter(AudacityProject *project,
|
||||
else {
|
||||
// Register for AudioIO events
|
||||
wxTheApp->Connect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
@@ -335,36 +335,36 @@ Meter::Meter(AudacityProject *project,
|
||||
Reset(44100.0, true);
|
||||
}
|
||||
|
||||
void Meter::Clear()
|
||||
void MeterPanel::Clear()
|
||||
{
|
||||
mQueue.Clear();
|
||||
}
|
||||
|
||||
Meter::~Meter()
|
||||
MeterPanel::~MeterPanel()
|
||||
{
|
||||
if (mIsInput)
|
||||
{
|
||||
// Unregister for AudioIO events
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_MONITOR,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_CAPTURE,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(Meter::OnAudioIOStatus),
|
||||
wxCommandEventHandler(MeterPanel::OnAudioIOStatus),
|
||||
NULL,
|
||||
this);
|
||||
}
|
||||
|
||||
// Unregister for our preference update event
|
||||
wxTheApp->Disconnect(EVT_METER_PREFERENCES_CHANGED,
|
||||
wxCommandEventHandler(Meter::OnMeterPrefsUpdated),
|
||||
wxCommandEventHandler(MeterPanel::OnMeterPrefsUpdated),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
@@ -375,7 +375,7 @@ Meter::~Meter()
|
||||
gAudioIO->StopStream();
|
||||
}
|
||||
|
||||
void Meter::UpdatePrefs()
|
||||
void MeterPanel::UpdatePrefs()
|
||||
{
|
||||
mDBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
||||
|
||||
@@ -419,12 +419,12 @@ void Meter::UpdatePrefs()
|
||||
mLayoutValid = false;
|
||||
}
|
||||
|
||||
void Meter::OnErase(wxEraseEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnErase(wxEraseEvent & WXUNUSED(event))
|
||||
{
|
||||
// Ignore it to prevent flashing
|
||||
}
|
||||
|
||||
void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
{
|
||||
#if defined(__WXMAC__)
|
||||
auto paintDC = std::make_unique<wxPaintDC>(this);
|
||||
@@ -679,20 +679,20 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::OnSize(wxSizeEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnSize(wxSizeEvent & WXUNUSED(event))
|
||||
{
|
||||
GetClientSize(&mWidth, &mHeight);
|
||||
|
||||
mLayoutValid = false;
|
||||
}
|
||||
|
||||
bool Meter::InIcon(wxMouseEvent *pEvent) const
|
||||
bool MeterPanel::InIcon(wxMouseEvent *pEvent) const
|
||||
{
|
||||
auto point = pEvent ? pEvent->GetPosition() : ScreenToClient(::wxGetMousePosition());
|
||||
return mIconRect.Contains(point);
|
||||
}
|
||||
|
||||
void Meter::OnMouse(wxMouseEvent &evt)
|
||||
void MeterPanel::OnMouse(wxMouseEvent &evt)
|
||||
{
|
||||
bool shouldHighlight = InIcon(&evt);
|
||||
if ((evt.GetEventType() == wxEVT_MOTION || evt.Entering() || evt.Leaving()) &&
|
||||
@@ -757,7 +757,7 @@ void Meter::OnMouse(wxMouseEvent &evt)
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::OnContext(wxContextMenuEvent &evt)
|
||||
void MeterPanel::OnContext(wxContextMenuEvent &evt)
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
if (mHadKeyDown)
|
||||
@@ -776,7 +776,7 @@ void Meter::OnContext(wxContextMenuEvent &evt)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Meter::OnKeyDown(wxKeyEvent &evt)
|
||||
void MeterPanel::OnKeyDown(wxKeyEvent &evt)
|
||||
{
|
||||
switch (evt.GetKeyCode())
|
||||
{
|
||||
@@ -813,7 +813,7 @@ void Meter::OnKeyDown(wxKeyEvent &evt)
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::OnKeyUp(wxKeyEvent &evt)
|
||||
void MeterPanel::OnKeyUp(wxKeyEvent &evt)
|
||||
{
|
||||
switch (evt.GetKeyCode())
|
||||
{
|
||||
@@ -836,19 +836,19 @@ void Meter::OnKeyUp(wxKeyEvent &evt)
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::OnSetFocus(wxFocusEvent & WXUNUSED(evt))
|
||||
void MeterPanel::OnSetFocus(wxFocusEvent & WXUNUSED(evt))
|
||||
{
|
||||
mIsFocused = true;
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void Meter::OnKillFocus(wxFocusEvent & WXUNUSED(evt))
|
||||
void MeterPanel::OnKillFocus(wxFocusEvent & WXUNUSED(evt))
|
||||
{
|
||||
mIsFocused = false;
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void Meter::SetStyle(Style newStyle)
|
||||
void MeterPanel::SetStyle(Style newStyle)
|
||||
{
|
||||
if (mStyle != newStyle && mDesiredStyle == AutomaticStereo)
|
||||
{
|
||||
@@ -860,7 +860,7 @@ void Meter::SetStyle(Style newStyle)
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::Reset(double sampleRate, bool resetClipping)
|
||||
void MeterPanel::Reset(double sampleRate, bool resetClipping)
|
||||
{
|
||||
mT = 0;
|
||||
mRate = sampleRate;
|
||||
@@ -920,7 +920,7 @@ static float ToDB(float v, float range)
|
||||
return ClipZeroToOne((db + range) / range);
|
||||
}
|
||||
|
||||
void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData)
|
||||
void MeterPanel::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData)
|
||||
{
|
||||
float *sptr = sampleData;
|
||||
auto num = std::min(numChannels, mNumBars);
|
||||
@@ -957,7 +957,7 @@ void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData
|
||||
}
|
||||
|
||||
// Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter().
|
||||
//void Meter::UpdateDisplay(int numChannels, int numFrames,
|
||||
//void MeterPanel::UpdateDisplay(int numChannels, int numFrames,
|
||||
// // Need to make these double-indexed arrays if we handle more than 2 channels.
|
||||
// float* maxLeft, float* rmsLeft,
|
||||
// float* maxRight, float* rmsRight,
|
||||
@@ -1001,7 +1001,7 @@ void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData
|
||||
// mQueue.Put(msg);
|
||||
//}
|
||||
|
||||
void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
|
||||
{
|
||||
MeterUpdateMsg msg;
|
||||
int numChanges = 0;
|
||||
@@ -1097,7 +1097,7 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
float Meter::GetMaxPeak() const
|
||||
float MeterPanel::GetMaxPeak() const
|
||||
{
|
||||
float maxPeak = 0.;
|
||||
|
||||
@@ -1107,7 +1107,7 @@ float Meter::GetMaxPeak() const
|
||||
return(maxPeak);
|
||||
}
|
||||
|
||||
wxFont Meter::GetFont() const
|
||||
wxFont MeterPanel::GetFont() const
|
||||
{
|
||||
int fontSize = 10;
|
||||
#if defined __WXMSW__
|
||||
@@ -1117,7 +1117,7 @@ wxFont Meter::GetFont() const
|
||||
return wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
}
|
||||
|
||||
void Meter::ResetBar(MeterBar *b, bool resetClipping)
|
||||
void MeterPanel::ResetBar(MeterBar *b, bool resetClipping)
|
||||
{
|
||||
b->peak = 0.0;
|
||||
b->rms = 0.0;
|
||||
@@ -1132,7 +1132,7 @@ void Meter::ResetBar(MeterBar *b, bool resetClipping)
|
||||
b->tailPeakCount = 0;
|
||||
}
|
||||
|
||||
bool Meter::IsClipping() const
|
||||
bool MeterPanel::IsClipping() const
|
||||
{
|
||||
for (int c = 0; c < kMaxMeterBars; c++)
|
||||
if (mBar[c].isclipping)
|
||||
@@ -1140,7 +1140,7 @@ bool Meter::IsClipping() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Meter::SetActiveStyle(Style newStyle)
|
||||
void MeterPanel::SetActiveStyle(Style newStyle)
|
||||
{
|
||||
mStyle = newStyle;
|
||||
|
||||
@@ -1181,7 +1181,7 @@ void Meter::SetActiveStyle(Style newStyle)
|
||||
mRuler.GetMaxSize(&mRulerWidth, &mRulerHeight);
|
||||
}
|
||||
|
||||
void Meter::SetBarAndClip(int iBar, bool vert)
|
||||
void MeterPanel::SetBarAndClip(int iBar, bool vert)
|
||||
{
|
||||
// Save the orientation
|
||||
mBar[iBar].vert = vert;
|
||||
@@ -1224,7 +1224,7 @@ void Meter::SetBarAndClip(int iBar, bool vert)
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::HandleLayout(wxDC &dc)
|
||||
void MeterPanel::HandleLayout(wxDC &dc)
|
||||
{
|
||||
// Refresh to reflect any language changes
|
||||
/* i18n-hint: One-letter abbreviation for Left, in VU Meter */
|
||||
@@ -1530,7 +1530,7 @@ void Meter::HandleLayout(wxDC &dc)
|
||||
mLayoutValid = true;
|
||||
}
|
||||
|
||||
void Meter::RepaintBarsNow()
|
||||
void MeterPanel::RepaintBarsNow()
|
||||
{
|
||||
if (mLayoutValid)
|
||||
{
|
||||
@@ -1547,7 +1547,7 @@ void Meter::RepaintBarsNow()
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::DrawMeterBar(wxDC &dc, MeterBar *bar)
|
||||
void MeterPanel::DrawMeterBar(wxDC &dc, MeterBar *bar)
|
||||
{
|
||||
// Cache some metrics
|
||||
wxCoord x = bar->r.GetLeft();
|
||||
@@ -1807,12 +1807,12 @@ void Meter::DrawMeterBar(wxDC &dc, MeterBar *bar)
|
||||
}
|
||||
}
|
||||
|
||||
bool Meter::IsMeterDisabled() const
|
||||
bool MeterPanel::IsMeterDisabled() const
|
||||
{
|
||||
return mMeterDisabled != 0;
|
||||
}
|
||||
|
||||
void Meter::StartMonitoring()
|
||||
void MeterPanel::StartMonitoring()
|
||||
{
|
||||
bool start = !mMonitoring;
|
||||
|
||||
@@ -1832,14 +1832,14 @@ void Meter::StartMonitoring()
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::StopMonitoring(){
|
||||
void MeterPanel::StopMonitoring(){
|
||||
mMonitoring = false;
|
||||
if (gAudioIO->IsMonitoring()){
|
||||
gAudioIO->StopStream();
|
||||
}
|
||||
}
|
||||
|
||||
void Meter::OnAudioIOStatus(wxCommandEvent &evt)
|
||||
void MeterPanel::OnAudioIOStatus(wxCommandEvent &evt)
|
||||
{
|
||||
evt.Skip();
|
||||
AudacityProject *p = (AudacityProject *) evt.GetEventObject();
|
||||
@@ -1863,12 +1863,12 @@ void Meter::OnAudioIOStatus(wxCommandEvent &evt)
|
||||
// SaveState() and RestoreState() exist solely for purpose of recreating toolbars
|
||||
// They should really be quering the project for current audio I/O state, but there
|
||||
// isn't a clear way of doing that just yet. (It should NOT query AudioIO.)
|
||||
auto Meter::SaveState() -> State
|
||||
auto MeterPanel::SaveState() -> State
|
||||
{
|
||||
return { true, mMonitoring, mActive };
|
||||
}
|
||||
|
||||
void Meter::RestoreState(const State &state)
|
||||
void MeterPanel::RestoreState(const State &state)
|
||||
{
|
||||
if (!state.mSaved)
|
||||
return;
|
||||
@@ -1885,7 +1885,7 @@ void Meter::RestoreState(const State &state)
|
||||
// Pop-up menu
|
||||
//
|
||||
|
||||
void Meter::ShowMenu(const wxPoint & pos)
|
||||
void MeterPanel::ShowMenu(const wxPoint & pos)
|
||||
{
|
||||
wxMenu menu;
|
||||
// Note: these should be kept in the same order as the enum
|
||||
@@ -1917,12 +1917,12 @@ void Meter::ShowMenu(const wxPoint & pos)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Meter::OnMonitor(wxCommandEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnMonitor(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
StartMonitoring();
|
||||
}
|
||||
|
||||
void Meter::OnMeterPrefsUpdated(wxCommandEvent & evt)
|
||||
void MeterPanel::OnMeterPrefsUpdated(wxCommandEvent & evt)
|
||||
{
|
||||
evt.Skip();
|
||||
|
||||
@@ -1931,7 +1931,7 @@ void Meter::OnMeterPrefsUpdated(wxCommandEvent & evt)
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void Meter::OnPreferences(wxCommandEvent & WXUNUSED(event))
|
||||
void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxTextCtrl *rate;
|
||||
wxRadioButton *gradient;
|
||||
@@ -2062,7 +2062,7 @@ void Meter::OnPreferences(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
wxString Meter::Key(const wxString & key) const
|
||||
wxString MeterPanel::Key(const wxString & key) const
|
||||
{
|
||||
if (mStyle == MixerTrackCluster)
|
||||
{
|
||||
@@ -2077,9 +2077,9 @@ wxString Meter::Key(const wxString & key) const
|
||||
return wxT("/Meter/Output/") + key;
|
||||
}
|
||||
|
||||
bool Meter::s_AcceptsFocus{ false };
|
||||
bool MeterPanel::s_AcceptsFocus{ false };
|
||||
|
||||
auto Meter::TemporarilyAllowFocus() -> TempAllowFocus {
|
||||
auto MeterPanel::TemporarilyAllowFocus() -> TempAllowFocus {
|
||||
s_AcceptsFocus = true;
|
||||
return TempAllowFocus{ &s_AcceptsFocus };
|
||||
}
|
||||
@@ -2087,7 +2087,7 @@ auto Meter::TemporarilyAllowFocus() -> TempAllowFocus {
|
||||
// This compensates for a but in wxWidgets 3.0.2 for mac:
|
||||
// Couldn't set focus from keyboard when AcceptsFocus returns false;
|
||||
// this bypasses that limitation
|
||||
void Meter::SetFocusFromKbd()
|
||||
void MeterPanel::SetFocusFromKbd()
|
||||
{
|
||||
auto temp = TemporarilyAllowFocus();
|
||||
SetFocus();
|
||||
@@ -2111,12 +2111,10 @@ MeterAx::~MeterAx()
|
||||
// window (e.g. an edit control).
|
||||
wxAccStatus MeterAx::DoDefaultAction(int WXUNUSED(childId))
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
MeterPanel *m = wxDynamicCast(GetWindow(), MeterPanel);
|
||||
|
||||
if (m && m->mIsInput)
|
||||
{
|
||||
m->StartMonitoring();
|
||||
}
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
@@ -2126,14 +2124,9 @@ wxAccStatus MeterAx::DoDefaultAction(int WXUNUSED(childId))
|
||||
wxAccStatus MeterAx::GetChild(int childId, wxAccessible** child)
|
||||
{
|
||||
if (childId == wxACC_SELF)
|
||||
{
|
||||
*child = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
*child = NULL;
|
||||
}
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
@@ -2141,7 +2134,6 @@ wxAccStatus MeterAx::GetChild(int childId, wxAccessible** child)
|
||||
wxAccStatus MeterAx::GetChildCount(int* childCount)
|
||||
{
|
||||
*childCount = 0;
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
@@ -2155,7 +2147,6 @@ wxAccStatus MeterAx::GetChildCount(int* childCount)
|
||||
wxAccStatus MeterAx::GetDefaultAction(int WXUNUSED(childId), wxString* actionName)
|
||||
{
|
||||
*actionName = _("Press");
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
@@ -2163,7 +2154,6 @@ wxAccStatus MeterAx::GetDefaultAction(int WXUNUSED(childId), wxString* actionNam
|
||||
wxAccStatus MeterAx::GetDescription(int WXUNUSED(childId), wxString *description)
|
||||
{
|
||||
description->Clear();
|
||||
|
||||
return wxACC_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@@ -2175,7 +2165,6 @@ wxAccStatus MeterAx::GetFocus(int* childId, wxAccessible** child)
|
||||
{
|
||||
*childId = 0;
|
||||
*child = this;
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
@@ -2183,7 +2172,6 @@ wxAccStatus MeterAx::GetFocus(int* childId, wxAccessible** child)
|
||||
wxAccStatus MeterAx::GetHelpText(int WXUNUSED(childId), wxString *helpText)
|
||||
{
|
||||
helpText->Clear();
|
||||
|
||||
return wxACC_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@@ -2192,7 +2180,6 @@ wxAccStatus MeterAx::GetHelpText(int WXUNUSED(childId), wxString *helpText)
|
||||
wxAccStatus MeterAx::GetKeyboardShortcut(int WXUNUSED(childId), wxString *shortcut)
|
||||
{
|
||||
shortcut->Clear();
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
@@ -2200,7 +2187,7 @@ wxAccStatus MeterAx::GetKeyboardShortcut(int WXUNUSED(childId), wxString *shortc
|
||||
// rect is in screen coordinates.
|
||||
wxAccStatus MeterAx::GetLocation(wxRect & rect, int WXUNUSED(elementId))
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
MeterPanel *m = wxDynamicCast(GetWindow(), MeterPanel);
|
||||
|
||||
rect = m->mIconRect;
|
||||
rect.SetPosition(m->ClientToScreen(rect.GetPosition()));
|
||||
@@ -2211,7 +2198,7 @@ wxAccStatus MeterAx::GetLocation(wxRect & rect, int WXUNUSED(elementId))
|
||||
// Gets the name of the specified object.
|
||||
wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
MeterPanel *m = wxDynamicCast(GetWindow(), MeterPanel);
|
||||
|
||||
if (m->mAccSilent)
|
||||
{
|
||||
@@ -2219,30 +2206,21 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
*name = m->GetName();
|
||||
if (name->IsEmpty())
|
||||
{
|
||||
*name = m->GetLabel();
|
||||
}
|
||||
|
||||
if (name->IsEmpty())
|
||||
{
|
||||
*name = _("Meter");
|
||||
}
|
||||
|
||||
if (m->mMonitoring)
|
||||
{
|
||||
// translations of strings such as " Monitoring " did not
|
||||
// always retain the leading space. Therefore a space has
|
||||
// been added to ensure at least one space, and stop
|
||||
// words from being merged
|
||||
*name += wxT(" ") + _(" Monitoring ");
|
||||
}
|
||||
else if (m->mActive)
|
||||
{
|
||||
*name += wxT(" ") + _(" Active ");
|
||||
}
|
||||
|
||||
float peak = 0.;
|
||||
bool clipped = false;
|
||||
@@ -2254,18 +2232,12 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
}
|
||||
|
||||
if (m->mDB)
|
||||
{
|
||||
*name += wxT(" ") + wxString::Format(_(" Peak %2.f dB"), (peak * m->mDBRange) - m->mDBRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
*name += wxT(" ") + wxString::Format(_(" Peak %.2f "), peak);
|
||||
}
|
||||
|
||||
if (clipped)
|
||||
{
|
||||
*name += wxT(" ") + _(" Clipped ");
|
||||
}
|
||||
}
|
||||
|
||||
return wxACC_OK;
|
||||
@@ -2274,7 +2246,7 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
// Returns a role constant.
|
||||
wxAccStatus MeterAx::GetRole(int WXUNUSED(childId), wxAccRole* role)
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
MeterPanel *m = wxDynamicCast(GetWindow(), MeterPanel);
|
||||
|
||||
if (m->mAccSilent)
|
||||
*role = wxROLE_NONE; // Jaws and nvda both read nothing
|
||||
@@ -2300,10 +2272,9 @@ wxAccStatus MeterAx::GetSelections(wxVariant * WXUNUSED(selections))
|
||||
// Returns a state constant.
|
||||
wxAccStatus MeterAx::GetState(int WXUNUSED(childId), long* state)
|
||||
{
|
||||
Meter *m = wxDynamicCast( GetWindow(), Meter );
|
||||
MeterPanel *m = wxDynamicCast( GetWindow(), MeterPanel );
|
||||
|
||||
*state = wxACC_STATE_SYSTEM_FOCUSABLE;
|
||||
|
||||
*state |= ( m == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
|
||||
|
||||
return wxACC_OK;
|
||||
|
@@ -85,9 +85,13 @@ class MeterUpdateQueue
|
||||
|
||||
class MeterAx;
|
||||
|
||||
class Meter final : public wxPanelWrapper
|
||||
/********************************************************************//**
|
||||
\brief MeterPanel is a panel that paints the meter used for monitoring
|
||||
or playback.
|
||||
************************************************************************/
|
||||
class MeterPanel final : public wxPanelWrapper
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(Meter)
|
||||
DECLARE_DYNAMIC_CLASS(MeterPanel)
|
||||
|
||||
public:
|
||||
// These should be kept in the same order as they appear
|
||||
@@ -102,7 +106,7 @@ class Meter final : public wxPanelWrapper
|
||||
};
|
||||
|
||||
|
||||
Meter(AudacityProject *,
|
||||
MeterPanel(AudacityProject *,
|
||||
wxWindow* parent, wxWindowID id,
|
||||
bool isInput,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@@ -110,7 +114,7 @@ class Meter final : public wxPanelWrapper
|
||||
Style style = HorizontalStereo,
|
||||
float fDecayRate = 60.0f);
|
||||
|
||||
~Meter();
|
||||
~MeterPanel();
|
||||
|
||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||
bool AcceptsFocusFromKeyboard() const override { return true; }
|
||||
|
Reference in New Issue
Block a user