mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Correcting the layout of EQ freq ruler (borders, off-by-ones).
Avoid an unnecessary alert in Envelope.
This commit is contained in:
parent
69b6d2a0cd
commit
3ee3c168e6
@ -952,7 +952,7 @@ int Envelope::Insert(double when, double value)
|
|||||||
{
|
{
|
||||||
#if defined(__WXDEBUG__)
|
#if defined(__WXDEBUG__)
|
||||||
// in debug builds, do a spot of argument checking
|
// in debug builds, do a spot of argument checking
|
||||||
if(when > mTrackLen)
|
if(when > mTrackLen + 0.0000001)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg = wxString::Format(wxT("when %.20f mTrackLen %.20f diff %.20f"), when, mTrackLen, when-mTrackLen);
|
msg = wxString::Format(wxT("when %.20f mTrackLen %.20f diff %.20f"), when, mTrackLen, when-mTrackLen);
|
||||||
|
@ -824,7 +824,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & evt)
|
|||||||
memDC.DrawRectangle(border);
|
memDC.DrawRectangle(border);
|
||||||
|
|
||||||
mEnvRect = border;
|
mEnvRect = border;
|
||||||
mEnvRect.Deflate(2, 2);
|
mEnvRect.Deflate(PANELBORDER, PANELBORDER);
|
||||||
|
|
||||||
// Pure blue x-axis line
|
// Pure blue x-axis line
|
||||||
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 1, wxSOLID));
|
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 1, wxSOLID));
|
||||||
@ -833,6 +833,13 @@ void EqualizationPanel::OnPaint(wxPaintEvent & evt)
|
|||||||
mEnvRect.GetLeft(), mEnvRect.y + center,
|
mEnvRect.GetLeft(), mEnvRect.y + center,
|
||||||
mEnvRect.GetRight(), mEnvRect.y + center);
|
mEnvRect.GetRight(), mEnvRect.y + center);
|
||||||
|
|
||||||
|
// Draw the grid, if asked for. Do it now so it's underneath the main plots.
|
||||||
|
if( mParent->drawGrid )
|
||||||
|
{
|
||||||
|
mParent->freqRuler->ruler.DrawGrid(memDC, mEnvRect.height, true, true, PANELBORDER, PANELBORDER);
|
||||||
|
mParent->dBRuler->ruler.DrawGrid(memDC, mEnvRect.width, true, true, PANELBORDER, PANELBORDER);
|
||||||
|
}
|
||||||
|
|
||||||
// Med-blue envelope line
|
// Med-blue envelope line
|
||||||
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 3, wxSOLID));
|
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 3, wxSOLID));
|
||||||
|
|
||||||
@ -927,13 +934,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & evt)
|
|||||||
|
|
||||||
memDC.SetPen(*wxBLACK_PEN);
|
memDC.SetPen(*wxBLACK_PEN);
|
||||||
if( mParent->mFaderOrDraw[0]->GetValue() )
|
if( mParent->mFaderOrDraw[0]->GetValue() )
|
||||||
mEnvelope->DrawPoints(memDC, mEnvRect, 0.0, mEnvRect.width, false, dBMin, dBMax);
|
mEnvelope->DrawPoints(memDC, mEnvRect, 0.0, mEnvRect.width-1, false, dBMin, dBMax);
|
||||||
|
|
||||||
if( mParent->drawGrid )
|
|
||||||
{
|
|
||||||
mParent->freqRuler->ruler.DrawGrid(memDC, mEnvRect.height+2, true, true, 0, 1);
|
|
||||||
mParent->dBRuler->ruler.DrawGrid(memDC, mEnvRect.width+2, true, true, 1, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
dc.Blit(0, 0, mWidth, mHeight,
|
dc.Blit(0, 0, mWidth, mHeight,
|
||||||
&memDC, 0, 0, wxCOPY, FALSE);
|
&memDC, 0, 0, wxCOPY, FALSE);
|
||||||
@ -1260,14 +1261,15 @@ void EqualizationDialog::MakeEqualizationDialog()
|
|||||||
dBRuler->ruler.SetFormat(Ruler::LinearDBFormat);
|
dBRuler->ruler.SetFormat(Ruler::LinearDBFormat);
|
||||||
dBRuler->ruler.SetUnits(_("dB"));
|
dBRuler->ruler.SetUnits(_("dB"));
|
||||||
dBRuler->ruler.SetLabelEdges(true);
|
dBRuler->ruler.SetLabelEdges(true);
|
||||||
|
dBRuler->ruler.mbTicksAtExtremes = true;
|
||||||
int w, h;
|
int w, h;
|
||||||
dBRuler->ruler.GetMaxSize(&w, NULL);
|
dBRuler->ruler.GetMaxSize(&w, NULL);
|
||||||
dBRuler->SetSize(wxSize(w, 150)); // height needed for wxGTK
|
dBRuler->SetSize(wxSize(w, 150)); // height needed for wxGTK
|
||||||
|
|
||||||
szr4 = new wxBoxSizer( wxVERTICAL );
|
szr4 = new wxBoxSizer( wxVERTICAL );
|
||||||
szr4->AddSpacer(2); // vertical space for panel border and thickness of line
|
szr4->AddSpacer(PANELBORDER); // vertical space for panel border
|
||||||
szr4->Add( dBRuler, 1, wxEXPAND|wxALIGN_LEFT|wxALL );
|
szr4->Add( dBRuler, 1, wxEXPAND|wxALIGN_LEFT|wxALL );
|
||||||
szr4->AddSpacer(1); // vertical space for thickness of line
|
szr4->AddSpacer(PANELBORDER); // vertical space for panel border
|
||||||
szr1->Add( szr4, 0, wxEXPAND|wxALIGN_LEFT|wxALL );
|
szr1->Add( szr4, 0, wxEXPAND|wxALIGN_LEFT|wxALL );
|
||||||
|
|
||||||
mPanel = new EqualizationPanel( mLoFreq, mHiFreq,
|
mPanel = new EqualizationPanel( mLoFreq, mHiFreq,
|
||||||
@ -1275,7 +1277,7 @@ void EqualizationDialog::MakeEqualizationDialog()
|
|||||||
this,
|
this,
|
||||||
mFilterFuncR, mFilterFuncI, mWindowSize,
|
mFilterFuncR, mFilterFuncI, mWindowSize,
|
||||||
ID_FILTERPANEL);
|
ID_FILTERPANEL);
|
||||||
szr1->Add( mPanel, 1, wxEXPAND|wxALIGN_CENTRE|wxRIGHT, 4);
|
szr1->Add( mPanel, 1, wxEXPAND|wxALIGN_CENTRE);
|
||||||
szr3 = new wxBoxSizer( wxVERTICAL );
|
szr3 = new wxBoxSizer( wxVERTICAL );
|
||||||
szr1->Add( szr3, 0, wxALIGN_CENTRE|wxRIGHT, 0); //spacer for last EQ
|
szr1->Add( szr3, 0, wxALIGN_CENTRE|wxRIGHT, 0); //spacer for last EQ
|
||||||
|
|
||||||
@ -1292,9 +1294,14 @@ void EqualizationDialog::MakeEqualizationDialog()
|
|||||||
freqRuler->ruler.SetUnits(_("Hz"));
|
freqRuler->ruler.SetUnits(_("Hz"));
|
||||||
freqRuler->ruler.SetFlip(true);
|
freqRuler->ruler.SetFlip(true);
|
||||||
freqRuler->ruler.SetLabelEdges(true);
|
freqRuler->ruler.SetLabelEdges(true);
|
||||||
|
freqRuler->ruler.mbTicksAtExtremes = true;
|
||||||
freqRuler->ruler.GetMaxSize(NULL, &h);
|
freqRuler->ruler.GetMaxSize(NULL, &h);
|
||||||
freqRuler->SetMinSize(wxSize(-1, h));
|
freqRuler->SetMinSize(wxSize(-1, h));
|
||||||
szr1->Add( freqRuler, 0, wxEXPAND|wxALIGN_LEFT|wxRIGHT, 4 );
|
szr5 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
szr5->AddSpacer(PANELBORDER); // horizontal space for panel border
|
||||||
|
szr5->Add( freqRuler, 1, wxEXPAND|wxALIGN_LEFT);
|
||||||
|
szr5->AddSpacer(PANELBORDER); // horizontal space for panel border
|
||||||
|
szr1->Add( szr5, 0, wxEXPAND|wxALIGN_LEFT|wxALL );
|
||||||
|
|
||||||
szrV->Add( szr1, 1, wxEXPAND|wxALIGN_CENTER|wxALL, 0 );
|
szrV->Add( szr1, 1, wxEXPAND|wxALIGN_CENTER|wxALL, 0 );
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#define __AUDACITY_EFFECT_EQUALIZATION__
|
#define __AUDACITY_EFFECT_EQUALIZATION__
|
||||||
#define NUMBER_OF_BANDS 31
|
#define NUMBER_OF_BANDS 31
|
||||||
#define NUM_PTS 180
|
#define NUM_PTS 180
|
||||||
|
#define PANELBORDER 1 // only increase from '1' for testing purposes - MJS
|
||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
@ -349,10 +350,11 @@ private:
|
|||||||
wxBoxSizer *szrH;
|
wxBoxSizer *szrH;
|
||||||
wxBoxSizer *szrI;
|
wxBoxSizer *szrI;
|
||||||
wxBoxSizer *szrL;
|
wxBoxSizer *szrL;
|
||||||
|
wxFlexGridSizer *szr1;
|
||||||
|
wxBoxSizer *szr2;
|
||||||
wxBoxSizer *szr3;
|
wxBoxSizer *szr3;
|
||||||
wxBoxSizer *szr4;
|
wxBoxSizer *szr4;
|
||||||
wxBoxSizer *szr2;
|
wxBoxSizer *szr5;
|
||||||
wxFlexGridSizer *szr1;
|
|
||||||
wxSize size;
|
wxSize size;
|
||||||
wxCheckBox *mGridOnOff;
|
wxCheckBox *mGridOnOff;
|
||||||
|
|
||||||
|
@ -1385,7 +1385,7 @@ void Ruler::DrawGrid(wxDC& dc, int length, bool minor, bool major, int xOffset,
|
|||||||
gridPos = mMinorLabels[i].pos;
|
gridPos = mMinorLabels[i].pos;
|
||||||
if(mOrientation == wxHORIZONTAL) {
|
if(mOrientation == wxHORIZONTAL) {
|
||||||
if((gridPos != 0) && (gridPos != mGridLineLength))
|
if((gridPos != 0) && (gridPos != mGridLineLength))
|
||||||
mDC->DrawLine(gridPos+xOffset, yOffset, gridPos+xOffset, mGridLineLength);
|
mDC->DrawLine(gridPos+xOffset, yOffset, gridPos+xOffset, mGridLineLength+yOffset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if((gridPos != 0) && (gridPos != mGridLineLength))
|
if((gridPos != 0) && (gridPos != mGridLineLength))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user