mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Independent meters with combined menu/icon
Many other changes including: 1) Independent preferences 2) Automatic layout separated from vertical/horizontal orientation choices 3) Combined menu and icon which saves space 4) Click to start monitoring label no longer covers peak hold line completely 5) Click to start monitoring label now adjusts label based on available width 6) Click to start monitoring label now appears on vertical meter (not sure about this one...) 7) Reduced width of vertical meter by moving icon to left of meters 8) Includes a compact vertical meter now 9) Clipping indicator is easier to see 10) All 1-off drawing issues resolved (99.9% sure...I challenge you to find some ;-)) 11) Bevels around meters are no longer overlaid by meter updates 12) "Old" menu handling code removed 13) Though not perfect since some non-English characters are taller/wider than the meters, non-English text is now handled better 14) Clicking play meter resets indicators as appropriate 15) Indicators on meters now stick around until the meter is clicked 16) Ugly flashing while resizing is now gone 17) There should be NO magic numbers in the code. Every +1 or -2 is explained in comments... 18) Size of L/R labels are recalculated now when preferences are updated (to pull in locale changes)
This commit is contained in:
parent
7c1535fdfd
commit
6a3ef5565c
40
images/MicMenu.xpm
Normal file
40
images/MicMenu.xpm
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/* XPM */
|
||||||
|
static const char * MicMenu_xpm[] = {
|
||||||
|
"24 19 18 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #DCDCDC",
|
||||||
|
"@ c #B5B5B5",
|
||||||
|
"# c #8C8C8C",
|
||||||
|
"$ c #D6D6D6",
|
||||||
|
"% c #9C9C9C",
|
||||||
|
"& c #6B6B6B",
|
||||||
|
"* c #EFEFEF",
|
||||||
|
"= c #C6C6C6",
|
||||||
|
"- c #737373",
|
||||||
|
"; c #4A4A4A",
|
||||||
|
"> c #DEDEDE",
|
||||||
|
", c #424242",
|
||||||
|
"' c #212121",
|
||||||
|
") c #ADADAD",
|
||||||
|
"! c #848484",
|
||||||
|
"~ c #636363",
|
||||||
|
" .... ",
|
||||||
|
" .+@+#. ",
|
||||||
|
" ..$+%+&. ",
|
||||||
|
" .+*.=+-+;. ",
|
||||||
|
" .>+*.%+,+. ",
|
||||||
|
" .+=+=.'+'. ",
|
||||||
|
" ..+)+;.... ",
|
||||||
|
" ..%+-+'.. ",
|
||||||
|
" .+..!~;.. ",
|
||||||
|
" .+....... ",
|
||||||
|
" .+... ",
|
||||||
|
" .+... ",
|
||||||
|
" .+... ",
|
||||||
|
" .+... ",
|
||||||
|
" .... .....",
|
||||||
|
" .... ",
|
||||||
|
" .. .....",
|
||||||
|
" . ... ",
|
||||||
|
". . "};
|
36
images/SpeakerMenu.xpm
Normal file
36
images/SpeakerMenu.xpm
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/* XPM */
|
||||||
|
static const char * SpeakerMenu_xpm[] = {
|
||||||
|
"24 19 14 1",
|
||||||
|
" c None",
|
||||||
|
". c #C1C1C1",
|
||||||
|
"+ c #2F2F2F",
|
||||||
|
"@ c #707070",
|
||||||
|
"# c #4B4B4B",
|
||||||
|
"$ c #000000",
|
||||||
|
"% c #090909",
|
||||||
|
"& c #383838",
|
||||||
|
"* c #838383",
|
||||||
|
"= c #7A7A7A",
|
||||||
|
"- c #414141",
|
||||||
|
"; c #8C8C8C",
|
||||||
|
"> c #131313",
|
||||||
|
", c #676767",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" . ",
|
||||||
|
" + ",
|
||||||
|
" @ #@ ",
|
||||||
|
" $ % ",
|
||||||
|
" &$ & *& ",
|
||||||
|
" ===$$ -= $ ",
|
||||||
|
" $$$$$ $ $ ",
|
||||||
|
" $$$$$ $ $ ",
|
||||||
|
" &&&$$ *& $ ",
|
||||||
|
" $$ % $ ",
|
||||||
|
" @$ @ #@ ",
|
||||||
|
" + ;+ ",
|
||||||
|
" . >. $$$$$",
|
||||||
|
" , ",
|
||||||
|
" $$$$$",
|
||||||
|
" $$$ ",
|
||||||
|
" $ "};
|
@ -44,7 +44,6 @@ IMPLEMENT_CLASS(MeterToolBar, ToolBar);
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE( MeterToolBar, ToolBar )
|
BEGIN_EVENT_TABLE( MeterToolBar, ToolBar )
|
||||||
EVT_SIZE( MeterToolBar::OnSize )
|
EVT_SIZE( MeterToolBar::OnSize )
|
||||||
EVT_COMMAND(wxID_ANY, EVT_METER_PREFERENCES_CHANGED, MeterToolBar::OnMeterPrefsUpdated)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
@ -127,9 +126,16 @@ void MeterToolBar::Populate()
|
|||||||
void MeterToolBar::UpdatePrefs()
|
void MeterToolBar::UpdatePrefs()
|
||||||
{
|
{
|
||||||
if( mPlayMeter )
|
if( mPlayMeter )
|
||||||
|
{
|
||||||
mPlayMeter->UpdatePrefs();
|
mPlayMeter->UpdatePrefs();
|
||||||
|
mPlayMeter->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
if( mRecordMeter )
|
if( mRecordMeter )
|
||||||
|
{
|
||||||
mRecordMeter->UpdatePrefs();
|
mRecordMeter->UpdatePrefs();
|
||||||
|
mRecordMeter->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
RegenerateTooltips();
|
RegenerateTooltips();
|
||||||
|
|
||||||
@ -150,13 +156,9 @@ void MeterToolBar::RegenerateTooltips()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterToolBar::OnMeterPrefsUpdated(wxCommandEvent & WXUNUSED(evt))
|
void MeterToolBar::OnSize( wxSizeEvent & event) //WXUNUSED(event) )
|
||||||
{
|
|
||||||
UpdatePrefs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MeterToolBar::OnSize( wxSizeEvent & WXUNUSED(event) )
|
|
||||||
{
|
{
|
||||||
|
event.Skip();
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
// We can be resized before populating...protect against it
|
// We can be resized before populating...protect against it
|
||||||
@ -192,20 +194,10 @@ void MeterToolBar::OnSize( wxSizeEvent & WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( mRecordMeter ) {
|
if( mRecordMeter ) {
|
||||||
mRecordMeter->SetStyle(bHorizontal ? Meter::HorizontalStereo : Meter::VerticalStereo);
|
|
||||||
mRecordMeter->SetMinSize( wxSize( width, height ));
|
mRecordMeter->SetMinSize( wxSize( width, height ));
|
||||||
Meter *play = mProject->GetPlaybackMeter();
|
|
||||||
if( play ) {
|
|
||||||
play->SetStyle(bHorizontal ? Meter::HorizontalStereo : Meter::VerticalStereo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if( mPlayMeter ) {
|
if( mPlayMeter ) {
|
||||||
mPlayMeter->SetStyle(bHorizontal ? Meter::HorizontalStereo : Meter::VerticalStereo);
|
|
||||||
mPlayMeter->SetMinSize( wxSize( width, height ));
|
mPlayMeter->SetMinSize( wxSize( width, height ));
|
||||||
Meter *record = mProject->GetCaptureMeter();
|
|
||||||
if( record ) {
|
|
||||||
record->SetStyle(bHorizontal ? Meter::HorizontalStereo : Meter::VerticalStereo);
|
|
||||||
}
|
|
||||||
mSizer->SetItemPosition( mPlayMeter, pos );
|
mSizer->SetItemPosition( mPlayMeter, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,18 +212,10 @@ bool MeterToolBar::Expose( bool show )
|
|||||||
Meter *meter;
|
Meter *meter;
|
||||||
if( mPlayMeter ) {
|
if( mPlayMeter ) {
|
||||||
mProject->SetPlaybackMeter( mPlayMeter );
|
mProject->SetPlaybackMeter( mPlayMeter );
|
||||||
meter = mProject->GetCaptureMeter();
|
|
||||||
if( meter ) {
|
|
||||||
meter->SetStyle( mPlayMeter->GetStyle() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mRecordMeter ) {
|
if( mRecordMeter ) {
|
||||||
mProject->SetCaptureMeter( mRecordMeter );
|
mProject->SetCaptureMeter( mRecordMeter );
|
||||||
meter = mProject->GetPlaybackMeter();
|
|
||||||
if( meter ) {
|
|
||||||
meter->SetStyle( mRecordMeter->GetStyle() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( mPlayMeter && mProject->GetPlaybackMeter() == mPlayMeter ) {
|
if( mPlayMeter && mProject->GetPlaybackMeter() == mPlayMeter ) {
|
||||||
|
@ -48,11 +48,10 @@ class MeterToolBar:public ToolBar {
|
|||||||
|
|
||||||
int GetInitialWidth() {return (mWhichMeters ==
|
int GetInitialWidth() {return (mWhichMeters ==
|
||||||
(kWithRecordMeter + kWithPlayMeter)) ? 338 : 460;} // Separate bars used to be smaller.
|
(kWithRecordMeter + kWithPlayMeter)) ? 338 : 460;} // Separate bars used to be smaller.
|
||||||
int GetMinToolbarWidth() { return 100; }
|
int GetMinToolbarWidth() { return 50; }
|
||||||
wxSize GetDockedSize();
|
wxSize GetDockedSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMeterPrefsUpdated(wxCommandEvent & evt);
|
|
||||||
void RegenerateTooltips();
|
void RegenerateTooltips();
|
||||||
|
|
||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -33,7 +33,8 @@ const int kMaxMeterBars = 2;
|
|||||||
|
|
||||||
struct MeterBar {
|
struct MeterBar {
|
||||||
bool vert;
|
bool vert;
|
||||||
wxRect r;
|
wxRect b; // Bevel around bar
|
||||||
|
wxRect r; // True bar drawing area
|
||||||
float peak;
|
float peak;
|
||||||
float rms;
|
float rms;
|
||||||
float peakHold;
|
float peakHold;
|
||||||
@ -92,13 +93,12 @@ class Meter : public wxPanel
|
|||||||
// These should be kept in the same order as they appear
|
// These should be kept in the same order as they appear
|
||||||
// in the menu
|
// in the menu
|
||||||
enum Style {
|
enum Style {
|
||||||
|
AutomaticStereo,
|
||||||
HorizontalStereo,
|
HorizontalStereo,
|
||||||
VerticalStereo,
|
VerticalStereo,
|
||||||
VerticalMulti,
|
|
||||||
Equalizer,
|
|
||||||
Waveform,
|
|
||||||
MixerTrackCluster, // Doesn't show menu, icon, or L/R labels, but otherwise like VerticalStereo.
|
MixerTrackCluster, // Doesn't show menu, icon, or L/R labels, but otherwise like VerticalStereo.
|
||||||
HorizontalStereoCompact // Thinner.
|
HorizontalStereoCompact, // Thinner.
|
||||||
|
VerticalStereoCompact, // Narrower.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,8 @@ class Meter : public wxPanel
|
|||||||
void UpdatePrefs();
|
void UpdatePrefs();
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
Style GetStyle() { return mStyle; }
|
Style GetStyle() const { return mStyle; }
|
||||||
|
Style GetDesiredStyle() const { return mDesiredStyle; }
|
||||||
void SetStyle(Style newStyle);
|
void SetStyle(Style newStyle);
|
||||||
|
|
||||||
/** \brief
|
/** \brief
|
||||||
@ -149,6 +150,7 @@ class Meter : public wxPanel
|
|||||||
*/
|
*/
|
||||||
void UpdateDisplay(int numChannels,
|
void UpdateDisplay(int numChannels,
|
||||||
int numFrames, float *sampleData);
|
int numFrames, float *sampleData);
|
||||||
|
|
||||||
// Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter().
|
// Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter().
|
||||||
//void UpdateDisplay(int numChannels, int numFrames,
|
//void UpdateDisplay(int numChannels, int numFrames,
|
||||||
// // Need to make these double-indexed max and min arrays if we handle more than 2 channels.
|
// // Need to make these double-indexed max and min arrays if we handle more than 2 channels.
|
||||||
@ -161,13 +163,11 @@ class Meter : public wxPanel
|
|||||||
* This method is thread-safe! Feel free to call from a
|
* This method is thread-safe! Feel free to call from a
|
||||||
* different thread (like from an audio I/O callback).
|
* different thread (like from an audio I/O callback).
|
||||||
*/
|
*/
|
||||||
bool IsMeterDisabled();
|
bool IsMeterDisabled() const;
|
||||||
|
|
||||||
float GetMaxPeak();
|
float GetMaxPeak() const;
|
||||||
|
|
||||||
double ToLinearIfDB(double value);
|
bool IsClipping() const;
|
||||||
|
|
||||||
bool IsClipping();
|
|
||||||
|
|
||||||
void StartMonitoring();
|
void StartMonitoring();
|
||||||
|
|
||||||
@ -184,34 +184,23 @@ class Meter : public wxPanel
|
|||||||
|
|
||||||
void OnMeterUpdate(wxTimerEvent &evt);
|
void OnMeterUpdate(wxTimerEvent &evt);
|
||||||
|
|
||||||
void HandlePaint(wxDC &dc);
|
|
||||||
void HandleLayout(wxDC &dc);
|
void HandleLayout(wxDC &dc);
|
||||||
|
void SetActiveStyle(Style style);
|
||||||
|
void SetBarAndClip(int iBar, bool vert);
|
||||||
|
void DrawMeterBar(wxDC &dc, MeterBar *meterBar);
|
||||||
|
void ResetBar(MeterBar *bar, bool resetClipping);
|
||||||
|
void RepaintBarsNow();
|
||||||
|
wxFont GetFont() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pop-up menu handlers
|
// Pop-up menu handlers
|
||||||
//
|
//
|
||||||
|
|
||||||
void OnDisableMeter(wxCommandEvent &evt);
|
|
||||||
void OnHorizontal(wxCommandEvent &evt);
|
|
||||||
void OnVertical(wxCommandEvent &evt);
|
|
||||||
void OnMulti(wxCommandEvent &evt);
|
|
||||||
void OnEqualizer(wxCommandEvent &evt);
|
|
||||||
void OnWaveform(wxCommandEvent &evt);
|
|
||||||
void OnLinear(wxCommandEvent &evt);
|
|
||||||
void OnDB(wxCommandEvent &evt);
|
|
||||||
void OnClip(wxCommandEvent &evt);
|
|
||||||
void OnMonitor(wxCommandEvent &evt);
|
void OnMonitor(wxCommandEvent &evt);
|
||||||
#ifdef AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
|
||||||
void OnAutomatedInputLevelAdjustment(wxCommandEvent &evt);
|
|
||||||
#endif
|
|
||||||
void OnFloat(wxCommandEvent &evt);
|
|
||||||
void OnPreferences(wxCommandEvent &evt);
|
void OnPreferences(wxCommandEvent &evt);
|
||||||
void SetBarClip( int iBar );
|
void OnMeterPrefsUpdated(wxCommandEvent &evt);
|
||||||
void DrawMeterBar(wxDC &dc, MeterBar *meterBar);
|
|
||||||
void ResetBar(MeterBar *bar, bool resetClipping);
|
wxString Key(const wxString & key) const;
|
||||||
void RepaintBarsNow();
|
|
||||||
void CreateIcon(int aquaOffset);
|
|
||||||
wxFont GetFont();
|
|
||||||
|
|
||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
MeterUpdateQueue mQueue;
|
MeterUpdateQueue mQueue;
|
||||||
@ -220,9 +209,13 @@ class Meter : public wxPanel
|
|||||||
int mWidth;
|
int mWidth;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
|
|
||||||
|
int mRulerWidth;
|
||||||
|
int mRulerHeight;
|
||||||
|
|
||||||
bool mIsInput;
|
bool mIsInput;
|
||||||
|
|
||||||
Style mStyle, mSavedStyle;
|
Style mStyle;
|
||||||
|
Style mDesiredStyle;
|
||||||
bool mGradient;
|
bool mGradient;
|
||||||
bool mDB;
|
bool mDB;
|
||||||
int mDBRange;
|
int mDBRange;
|
||||||
@ -246,8 +239,7 @@ class Meter : public wxPanel
|
|||||||
bool mLayoutValid;
|
bool mLayoutValid;
|
||||||
|
|
||||||
wxBitmap *mBitmap;
|
wxBitmap *mBitmap;
|
||||||
wxRect mMenuRect;
|
wxRect mIconRect;
|
||||||
wxPoint mIconPos;
|
|
||||||
wxPoint mLeftTextPos;
|
wxPoint mLeftTextPos;
|
||||||
wxPoint mRightTextPos;
|
wxPoint mRightTextPos;
|
||||||
wxSize mLeftSize;
|
wxSize mLeftSize;
|
||||||
@ -261,7 +253,6 @@ class Meter : public wxPanel
|
|||||||
wxBrush mClipBrush;
|
wxBrush mClipBrush;
|
||||||
wxBrush mBkgndBrush;
|
wxBrush mBkgndBrush;
|
||||||
wxBrush mDisabledBkgndBrush;
|
wxBrush mDisabledBkgndBrush;
|
||||||
wxRect mAllBarsRect;
|
|
||||||
Ruler mRuler;
|
Ruler mRuler;
|
||||||
wxString mLeftText;
|
wxString mLeftText;
|
||||||
wxString mRightText;
|
wxString mRightText;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user