Fix deprecation warnings with wxFont, wxPen, wxBrush ctors...

... Replace some enum constants with the equivalent values from the more
special-purpose enums, as the wx header files recommend, so overloading
selects the ctors with non-int arguments.

In a full rebuild of the debug project on Mac, this reduces the count of
warnings from 264 to 274.
This commit is contained in:
Paul Licameli 2018-07-23 13:21:15 -04:00
parent 0ea56874a6
commit e432883dec
14 changed files with 53 additions and 53 deletions

View File

@ -571,12 +571,12 @@ void AColor::MIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
const int *colors = AColor_midicolors[channel - 1];
dc->SetPen(wxPen(wxColour(colors[0],
colors[1], colors[2]), 1, wxSOLID));
colors[1], colors[2]), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(colors[0],
colors[1], colors[2]), wxSOLID));
colors[1], colors[2]), wxBRUSHSTYLE_SOLID));
} else {
dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxSOLID));
dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxSOLID));
dc->SetPen(wxPen(wxColour(153, 153, 153), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(153, 153, 153), wxBRUSHSTYLE_SOLID));
}
}
@ -588,13 +588,13 @@ void AColor::LightMIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
dc->SetPen(wxPen(wxColour(127 + colors[0] / 2,
127 + colors[1] / 2,
127 + colors[2] / 2), 1, wxSOLID));
127 + colors[2] / 2), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(127 + colors[0] / 2,
127 + colors[1] / 2,
127 + colors[2] / 2), wxSOLID));
127 + colors[2] / 2), wxBRUSHSTYLE_SOLID));
} else {
dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxSOLID));
dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxSOLID));
dc->SetPen(wxPen(wxColour(204, 204, 204), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(204, 204, 204), wxBRUSHSTYLE_SOLID));
}
}
@ -606,13 +606,13 @@ void AColor::DarkMIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
dc->SetPen(wxPen(wxColour(colors[0] / 2,
colors[1] / 2,
colors[2] / 2), 1, wxSOLID));
colors[2] / 2), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(colors[0] / 2,
colors[1] / 2,
colors[2] / 2), wxSOLID));
colors[2] / 2), wxBRUSHSTYLE_SOLID));
} else {
dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxSOLID));
dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxSOLID));
dc->SetPen(wxPen(wxColour(102, 102, 102), 1, wxPENSTYLE_SOLID));
dc->SetBrush(wxBrush(wxColour(102, 102, 102), wxBRUSHSTYLE_SOLID));
}
}

View File

@ -764,9 +764,9 @@ void FreqWindow::DrawPlot()
// Draw the plot
if (mAlg == SpectrumAnalyst::Spectrum)
memDC.SetPen(wxPen(theTheme.Colour( clrHzPlot ), 1, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour( clrHzPlot ), 1, wxPENSTYLE_SOLID));
else
memDC.SetPen(wxPen(theTheme.Colour( clrWavelengthPlot), 1, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour( clrWavelengthPlot), 1, wxPENSTYLE_SOLID));
float xPos = xMin;
@ -923,7 +923,7 @@ void FreqWindow::PlotPaint(wxPaintEvent & event)
else
px = (int)((bestpeak - xMin) * width / (xMax - xMin));
dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));
dc.SetPen(wxPen(wxColour(160,160,160), 1, wxPENSTYLE_SOLID));
AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);
// print out info about the cursor location

View File

@ -582,7 +582,7 @@ void LyricsPanel::HandlePaint_BouncingBall(wxDC &dc)
if (mT >= 0.0) {
wxRect ball(ctr - ballRadius, yi - ballRadius, 2 * ballRadius, 2 * ballRadius);
dc.SetBrush(wxBrush(wxColour(238, 0, 102), wxSOLID));
dc.SetBrush(wxBrush(wxColour(238, 0, 102), wxBRUSHSTYLE_SOLID));
dc.DrawEllipse(ball);
}
}

View File

@ -1328,7 +1328,7 @@ void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap),
#ifdef __WXMSW__
fontSize = 8;
#endif
wxFont font(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
GetTextExtent(str, &textWidth, &textHeight, NULL, NULL, &font);
AColor::UseThemeColour( &dc, clrMedium );

View File

@ -1312,7 +1312,7 @@ auStaticText::auStaticText(wxWindow* parent, wxString textIn) :
#ifdef __WXMSW__
fontSize = 9;
#endif
wxFont font(fontSize, wxDEFAULT, wxNORMAL, wxNORMAL);
wxFont font(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
GetTextExtent(textIn, &textWidth, &textHeight, NULL, NULL, &font);
SetFont( font );

View File

@ -492,7 +492,7 @@ void TrackArtist::DrawTrack(TrackPanelDrawingContext &context,
!wt->GetName().IsEmpty()) {
wxBrush Brush;
wxCoord x,y;
wxFont labelFont(12, wxSWISS, wxNORMAL, wxNORMAL);
wxFont labelFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(labelFont);
dc.GetTextExtent( wt->GetName(), &x, &y );
dc.SetTextForeground(theTheme.Colour( clrTrackPanelText ));
@ -624,7 +624,7 @@ void TrackArtist::DrawVRuler
fontSize = 8;
#endif
wxFont labelFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
wxFont labelFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc->SetFont(labelFont);
int octave = 0;
@ -3115,7 +3115,7 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
dc.SetPen(wxPen(wxColour(RED(linecolor),
GREEN(linecolor),
BLUE(linecolor)),
linethick, wxSOLID));
linethick, wxPENSTYLE_SOLID));
}
if (shape != line) {
fillcolor = LookupIntAttribute(note, fillcolori, -1);
@ -3125,7 +3125,7 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
dc.SetBrush(wxBrush(wxColour(RED(fillcolor),
GREEN(fillcolor),
BLUE(fillcolor)),
wxSOLID));
wxBRUSHSTYLE_SOLID));
if (!fillflag) dc.SetBrush(*wxTRANSPARENT_BRUSH);
}
int y1 = track->PitchToY(LookupRealAttribute(note, y1r, note->pitch));
@ -3216,11 +3216,11 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
int size = LookupIntAttribute(note, sizei, 8);
const char *justify = LookupStringAttribute(note, justifys, "ld");
wxFont wxfont;
wxfont.SetFamily(font == roman ? wxROMAN :
(font == swiss ? wxSWISS :
(font == modern ? wxMODERN : wxDEFAULT)));
wxfont.SetStyle(wxNORMAL);
wxfont.SetWeight(weight == bold ? wxBOLD : wxNORMAL);
wxfont.SetFamily(font == roman ? wxFONTFAMILY_ROMAN :
(font == swiss ? wxFONTFAMILY_SWISS :
(font == modern ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT)));
wxfont.SetStyle(wxFONTSTYLE_NORMAL);
wxfont.SetWeight(weight == bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
wxfont.SetPointSize(size);
dc.SetFont(wxfont);
@ -3246,7 +3246,7 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
dc.SetPen(wxPen(wxColour(RED(fillcolor),
GREEN(fillcolor),
BLUE(fillcolor)),
1, wxSOLID));
1, wxPENSTYLE_SOLID));
dc.DrawRectangle(TIME_TO_X(xx) + hoffset, yy + voffset,
textWidth, textHeight);
}

View File

@ -260,7 +260,7 @@ bool ScreenshotCommand::Capture(
wxBitmap back(width + b.width, height + b.height);
fullDC.SelectObject(back);
fullDC.SetBackground(wxBrush(mBackColor, wxSOLID));
fullDC.SetBackground(wxBrush(mBackColor, wxBRUSHSTYLE_SOLID));
fullDC.Clear();
fullDC.DrawBitmap(part, b.x, b.y);

View File

@ -701,7 +701,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
// draw preview
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxSOLID));
dc.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxPENSTYLE_SOLID));
wxPoint points[6];
@ -727,7 +727,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
dc.DrawLines(6, points);
dc.SetPen(wxPen(*wxBLACK, 1, wxDOT));
dc.SetPen(wxPen(*wxBLACK, 1, wxPENSTYLE_DOT));
AColor::Line(dc, FADE_DOWN_START, 10, FADE_DOWN_START, clientHeight - 10);
AColor::Line(dc, FADE_UP_START, 10, FADE_UP_START, clientHeight - 10);

View File

@ -2937,7 +2937,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
mEnvRect.Deflate(PANELBORDER, PANELBORDER);
// Pure blue x-axis line
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 1, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour( clrGraphLines ), 1, wxPENSTYLE_SOLID));
int center = (int) (mEnvRect.height * mEffect->mdBMax/(mEffect->mdBMax-mEffect->mdBMin) + .5);
AColor::Line(memDC,
mEnvRect.GetLeft(), mEnvRect.y + center,
@ -2951,7 +2951,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
}
// Med-blue envelope line
memDC.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxPENSTYLE_SOLID));
// Draw envelope
int x, y, xlast = 0, ylast = 0;
@ -2986,7 +2986,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
//Now draw the actual response that you will get.
//mFilterFunc has a linear scale, window has a log one so we have to fiddle about
memDC.SetPen(wxPen(theTheme.Colour( clrResponseLines ), 1, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour( clrResponseLines ), 1, wxPENSTYLE_SOLID));
double scale = (double)mEnvRect.height/(mEffect->mdBMax-mEffect->mdBMin); //pixels per dB
double yF; //gain at this freq
double delta = mEffect->mHiFreq / (((double)mEffect->mWindowSize / 2.)); //size of each freq bin

View File

@ -1108,7 +1108,7 @@ void EffectScienFilterPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
mEnvRect.Deflate(2, 2);
// Pure blue x-axis line
memDC.SetPen(wxPen(theTheme.Colour(clrGraphLines), 1, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour(clrGraphLines), 1, wxPENSTYLE_SOLID));
int center = (int) (mEnvRect.height * mDbMax / (mDbMax - mDbMin) + 0.5);
AColor::Line(memDC,
mEnvRect.GetLeft(), mEnvRect.y + center,
@ -1116,7 +1116,7 @@ void EffectScienFilterPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
//Now draw the actual response that you will get.
//mFilterFunc has a linear scale, window has a log one so we have to fiddle about
memDC.SetPen(wxPen(theTheme.Colour(clrResponseLines), 3, wxSOLID));
memDC.SetPen(wxPen(theTheme.Colour(clrResponseLines), 3, wxPENSTYLE_SOLID));
double scale = (double) mEnvRect.height / (mDbMax - mDbMin); // pixels per dB
double yF; // gain at this freq

View File

@ -1072,7 +1072,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
}
wxColour bkgnd = GetBackgroundColour();
wxBrush bkgndBrush( bkgnd, wxSOLID );
wxBrush bkgndBrush( bkgnd, wxBRUSHSTYLE_SOLID );
wxMemoryDC memDC;
memDC.SelectObject( *mBitmap );

View File

@ -858,7 +858,7 @@ void ScrubbingOverlay::Draw(OverlayPanel &, wxDC &dc)
if (!scrubber.ShouldDrawScrubSpeed())
return;
static const wxFont labelFont(24, wxSWISS, wxNORMAL, wxNORMAL);
static const wxFont labelFont(24, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(labelFont);
// These two colors were previously saturated red and green. However
@ -940,7 +940,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
wxCoord width, height;
{
wxClientDC dc(trackPanel);
static const wxFont labelFont(24, wxSWISS, wxNORMAL, wxNORMAL);
static const wxFont labelFont(24, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(labelFont);
dc.GetTextExtent(mNextScrubSpeedText, &width, &height);
}

View File

@ -116,7 +116,7 @@ TipPanel::TipPanel(wxWindow *parent, const wxArrayString & labels)
{
SetBackgroundStyle(wxBG_STYLE_PAINT);
wxFont labelFont(sliderFontSize, wxSWISS, wxNORMAL, wxNORMAL);
wxFont labelFont(sliderFontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
mWidth = mHeight = 0;
for ( const auto &label : labels ) {
int width, height;
@ -158,7 +158,7 @@ void TipPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
dc.SetBrush(AColor::tooltipBrush);
dc.DrawRoundedRectangle(0, 0, mWidth, mHeight, 5);
dc.SetFont(wxFont(sliderFontSize, wxSWISS, wxNORMAL, wxNORMAL));
dc.SetFont(wxFont(sliderFontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
dc.SetTextForeground(AColor::tooltipPen.GetColour());
int textWidth, textHeight;
@ -666,7 +666,7 @@ void LWSlider::DrawToBitmap(wxDC & paintDC)
// sliderFontSize is for the tooltip.
// we need something smaller here...
int fontSize = 7;
wxFont labelFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
wxFont labelFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(labelFont);
// Colors

View File

@ -264,11 +264,11 @@ MeterPanel::MeterPanel(AudacityProject *project,
UpdatePrefs();
wxColour backgroundColour = theTheme.Colour( clrMedium);
mBkgndBrush = wxBrush(backgroundColour, wxSOLID);
mBkgndBrush = wxBrush(backgroundColour, wxBRUSHSTYLE_SOLID);
SetBackgroundColour( backgroundColour );
mPeakPeakPen = wxPen(theTheme.Colour( clrMeterPeak), 1, wxSOLID);
mDisabledPen = wxPen(theTheme.Colour( clrMeterDisabledPen), 1, wxSOLID);
mPeakPeakPen = wxPen(theTheme.Colour( clrMeterPeak), 1, wxPENSTYLE_SOLID);
mDisabledPen = wxPen(theTheme.Colour( clrMeterDisabledPen), 1, wxPENSTYLE_SOLID);
// Register for our preference update event
wxTheApp->Bind(EVT_METER_PREFERENCES_CHANGED,
@ -283,10 +283,10 @@ MeterPanel::MeterPanel(AudacityProject *project,
&MeterPanel::OnAudioIOStatus,
this);
mPen = wxPen( theTheme.Colour( clrMeterInputPen ), 1, wxSOLID);
mBrush = wxBrush( theTheme.Colour( clrMeterInputBrush ), wxSOLID);
mRMSBrush = wxBrush( theTheme.Colour( clrMeterInputRMSBrush ), wxSOLID);
mClipBrush = wxBrush( theTheme.Colour( clrMeterInputClipBrush ), wxSOLID);
mPen = wxPen( theTheme.Colour( clrMeterInputPen ), 1, wxPENSTYLE_SOLID);
mBrush = wxBrush( theTheme.Colour( clrMeterInputBrush ), wxBRUSHSTYLE_SOLID);
mRMSBrush = wxBrush( theTheme.Colour( clrMeterInputRMSBrush ), wxBRUSHSTYLE_SOLID);
mClipBrush = wxBrush( theTheme.Colour( clrMeterInputClipBrush ), wxBRUSHSTYLE_SOLID);
// mLightPen = wxPen( theTheme.Colour( clrMeterInputLightPen ), 1, wxSOLID);
// mDarkPen = wxPen( theTheme.Colour( clrMeterInputDarkPen ), 1, wxSOLID);
}
@ -296,10 +296,10 @@ MeterPanel::MeterPanel(AudacityProject *project,
&MeterPanel::OnAudioIOStatus,
this);
mPen = wxPen( theTheme.Colour( clrMeterOutputPen ), 1, wxSOLID);
mBrush = wxBrush( theTheme.Colour( clrMeterOutputBrush ), wxSOLID);
mRMSBrush = wxBrush( theTheme.Colour( clrMeterOutputRMSBrush ), wxSOLID);
mClipBrush = wxBrush( theTheme.Colour( clrMeterOutputClipBrush ), wxSOLID);
mPen = wxPen( theTheme.Colour( clrMeterOutputPen ), 1, wxPENSTYLE_SOLID);
mBrush = wxBrush( theTheme.Colour( clrMeterOutputBrush ), wxBRUSHSTYLE_SOLID);
mRMSBrush = wxBrush( theTheme.Colour( clrMeterOutputRMSBrush ), wxBRUSHSTYLE_SOLID);
mClipBrush = wxBrush( theTheme.Colour( clrMeterOutputClipBrush ), wxBRUSHSTYLE_SOLID);
// mLightPen = wxPen( theTheme.Colour( clrMeterOutputLightPen ), 1, wxSOLID);
// mDarkPen = wxPen( theTheme.Colour( clrMeterOutputDarkPen ), 1, wxSOLID);
}