1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Get rid of wx object arrays, use std::vector

This commit is contained in:
Paul Licameli 2018-02-02 13:24:53 -05:00
parent 89d8f0df63
commit 080dd34e61
56 changed files with 350 additions and 497 deletions

@ -480,9 +480,6 @@ enum FieldTypes
FT_Name // type, name length, name FT_Name // type, name length, name
}; };
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(IdMapArray);
AutoSaveFile::AutoSaveFile(size_t allocSize) AutoSaveFile::AutoSaveFile(size_t allocSize)
{ {
mAllocSize = allocSize; mAllocSize = allocSize;
@ -762,7 +759,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
XMLFileWriter out{ fileName, _("Error Decoding File") }; XMLFileWriter out{ fileName, _("Error Decoding File") };
IdMap mIds; IdMap mIds;
IdMapArray mIdStack; std::vector<IdMap> mIdStack;
mIds.clear(); mIds.clear();
@ -774,15 +771,15 @@ bool AutoSaveFile::Decode(const wxString & fileName)
{ {
case FT_Push: case FT_Push:
{ {
mIdStack.Add(mIds); mIdStack.push_back(mIds);
mIds.clear(); mIds.clear();
} }
break; break;
case FT_Pop: case FT_Pop:
{ {
mIds = mIdStack[mIdStack.GetCount() - 1]; mIds = mIdStack.back();
mIdStack.RemoveAt(mIdStack.GetCount() - 1); mIdStack.pop_back();
} }
break; break;

@ -17,7 +17,6 @@
#include "xml/XMLWriter.h" #include "xml/XMLWriter.h"
#include <wx/debug.h> #include <wx/debug.h>
#include <wx/dynarray.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#include <wx/hashmap.h> #include <wx/hashmap.h>
#include <wx/mstream.h> #include <wx/mstream.h>
@ -74,7 +73,6 @@ private:
using NameMap = std::unordered_map<wxString, short>; using NameMap = std::unordered_map<wxString, short>;
using IdMap = std::unordered_map<short, wxString>; using IdMap = std::unordered_map<short, wxString>;
WX_DECLARE_OBJARRAY_WITH_DECL(IdMap, IdMapArray, class AUDACITY_DLL_API);
// This class's overrides do NOT throw AudacityException. // This class's overrides do NOT throw AudacityException.
class AUDACITY_DLL_API AutoSaveFile final : public XMLWriter class AUDACITY_DLL_API AutoSaveFile final : public XMLWriter

@ -15,7 +15,6 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <wx/dynarray.h>
#include <wx/brush.h> #include <wx/brush.h>
#include <wx/pen.h> #include <wx/pen.h>

@ -20,7 +20,6 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/pen.h> #include <wx/pen.h>
#include <wx/dynarray.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>

@ -20,9 +20,6 @@
#include "Project.h" // for GetActiveProject #include "Project.h" // for GetActiveProject
#include "LabelTrack.h" #include "LabelTrack.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(SyllableArray);
BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl) BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl)
EVT_MOUSE_EVENTS(HighlightTextCtrl::OnMouseEvent) EVT_MOUSE_EVENTS(HighlightTextCtrl::OnMouseEvent)
@ -120,13 +117,13 @@ LyricsPanel::~LyricsPanel()
void LyricsPanel::Clear() void LyricsPanel::Clear()
{ {
mSyllables.Clear(); mSyllables.clear();
mText = wxT(""); mText = wxT("");
// Add two dummy syllables at the beginning // Add two dummy syllables at the beginning
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
mSyllables[0].t = -2.0; mSyllables[0].t = -2.0;
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
mSyllables[1].t = -1.0; mSyllables[1].t = -1.0;
mHighlightTextCtrl->Clear(); mHighlightTextCtrl->Clear();
@ -145,7 +142,7 @@ void LyricsPanel::AddLabels(const LabelTrack *pLT)
void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightText) void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightText)
{ {
int i = mSyllables.GetCount(); int i = mSyllables.size();
{ {
Syllable &prevSyllable = mSyllables[i - 1]; Syllable &prevSyllable = mSyllables[i - 1];
@ -161,7 +158,7 @@ void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightTex
} }
} }
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
Syllable &thisSyllable = mSyllables[i]; Syllable &thisSyllable = mSyllables[i];
thisSyllable.t = t; thisSyllable.t = t;
thisSyllable.text = syllable; thisSyllable.text = syllable;
@ -190,12 +187,12 @@ void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightTex
void LyricsPanel::Finish(double finalT) void LyricsPanel::Finish(double finalT)
{ {
// Add 3 dummy syllables at the end // Add 3 dummy syllables at the end
int i = mSyllables.GetCount(); int i = mSyllables.size();
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
mSyllables[i].t = finalT + 1.0; mSyllables[i].t = finalT + 1.0;
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
mSyllables[i+1].t = finalT + 2.0; mSyllables[i+1].t = finalT + 2.0;
mSyllables.Add(Syllable()); mSyllables.push_back(Syllable());
mSyllables[i+2].t = finalT + 3.0; mSyllables[i+2].t = finalT + 3.0;
// Mark measurements as invalid // Mark measurements as invalid
@ -210,7 +207,7 @@ int LyricsPanel::FindSyllable(long startChar)
int i1, i2; int i1, i2;
i1 = 0; i1 = 0;
i2 = mSyllables.GetCount(); i2 = mSyllables.size();
while (i2 > i1+1) { while (i2 > i1+1) {
int pmid = (i1+i2)/2; int pmid = (i1+i2)/2;
if (mSyllables[pmid].char0 > startChar) if (mSyllables[pmid].char0 > startChar)
@ -221,8 +218,8 @@ int LyricsPanel::FindSyllable(long startChar)
if (i1 < 2) if (i1 < 2)
i1 = 2; i1 = 2;
if (i1 > (int)(mSyllables.GetCount()) - 3) if (i1 > (int)(mSyllables.size()) - 3)
i1 = mSyllables.GetCount() - 3; i1 = mSyllables.size() - 3;
return i1; return i1;
} }
@ -267,9 +264,9 @@ void LyricsPanel::Measure(wxDC *dc) // only for drawn text
int x = 2*kIndent; int x = 2*kIndent;
unsigned int i; unsigned int i;
for(i=0; i<mSyllables.GetCount(); i++) { for(i = 0; i < mSyllables.size(); i++) {
if ((i < I_FIRST_REAL_SYLLABLE) || // Clear() starts the list with I_FIRST_REAL_SYLLABLE dummies. if ((i < I_FIRST_REAL_SYLLABLE) || // Clear() starts the list with I_FIRST_REAL_SYLLABLE dummies.
(i >= mSyllables.GetCount()-3)) // Finish() ends with 3 dummies. (i >= mSyllables.size() - 3)) // Finish() ends with 3 dummies.
{ {
dc->GetTextExtent(wxT("DUMMY"), &width, &height); // Get the correct height even if we're at i=0. dc->GetTextExtent(wxT("DUMMY"), &width, &height); // Get the correct height even if we're at i=0.
width = 0; width = 0;
@ -282,7 +279,7 @@ void LyricsPanel::Measure(wxDC *dc) // only for drawn text
// when there's a long pause relative to the previous word, insert // when there's a long pause relative to the previous word, insert
// extra space. // extra space.
int extraWidth; int extraWidth;
if (i >= I_FIRST_REAL_SYLLABLE && i < mSyllables.GetCount()-2) if (i >= I_FIRST_REAL_SYLLABLE && i < mSyllables.size() - 2)
{ {
double deltaThis = mSyllables[i+1].t - mSyllables[i].t; double deltaThis = mSyllables[i+1].t - mSyllables[i].t;
double deltaPrev = mSyllables[i].t - mSyllables[i-1].t; double deltaPrev = mSyllables[i].t - mSyllables[i-1].t;
@ -318,7 +315,7 @@ int LyricsPanel::FindSyllable(double t)
int i1, i2; int i1, i2;
i1 = 0; i1 = 0;
i2 = mSyllables.GetCount(); i2 = mSyllables.size();
while (i2 > i1+1) { while (i2 > i1+1) {
int pmid = (i1+i2)/2; int pmid = (i1+i2)/2;
if (mSyllables[pmid].t > t) if (mSyllables[pmid].t > t)
@ -329,8 +326,8 @@ int LyricsPanel::FindSyllable(double t)
if (i1 < 2) if (i1 < 2)
i1 = 2; i1 = 2;
if (i1 > (int)(mSyllables.GetCount()) - 3) if (i1 > (int)(mSyllables.size()) - 3)
i1 = mSyllables.GetCount() - 3; i1 = mSyllables.size() - 3;
return i1; return i1;
} }
@ -348,7 +345,7 @@ void LyricsPanel::GetKaraokePosition(double t,
*outX = 0; *outX = 0;
*outY = 0; *outY = 0;
if (t < mSyllables[I_FIRST_REAL_SYLLABLE].t || t > mSyllables[mSyllables.GetCount()-3].t) if (t < mSyllables[I_FIRST_REAL_SYLLABLE].t || t > mSyllables[mSyllables.size() - 3].t)
return; return;
int i0, i1, i2, i3; int i0, i1, i2, i3;
@ -557,7 +554,7 @@ void LyricsPanel::HandlePaint_BouncingBall(wxDC &dc)
SetDrawnFont(&dc); SetDrawnFont(&dc);
unsigned int i; unsigned int i;
wxCoord yTextTop = mKaraokeHeight - mTextHeight - 4; wxCoord yTextTop = mKaraokeHeight - mTextHeight - 4;
for(i=0; i<mSyllables.GetCount(); i++) { for(i = 0; i < mSyllables.size(); i++) {
if (mSyllables[i].x + mSyllables[i].width < (x - ctr)) if (mSyllables[i].x + mSyllables[i].width < (x - ctr))
continue; continue;
if (mSyllables[i].x > x + ctr) if (mSyllables[i].x > x + ctr)

@ -14,7 +14,7 @@
#include "Audacity.h" #include "Audacity.h"
#include <wx/dynarray.h> #include <vector>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include "widgets/wxPanelWrapper.h" #include "widgets/wxPanelWrapper.h"
@ -25,6 +25,12 @@ class LabelTrack;
#define LYRICS_DEFAULT_HEIGHT 280 #define LYRICS_DEFAULT_HEIGHT 280
struct Syllable { struct Syllable {
Syllable() = default;
Syllable( const Syllable& ) = default;
Syllable& operator= ( const Syllable& ) = default;
Syllable( Syllable && ) = default;
Syllable& operator= ( Syllable&& ) = default;
double t; double t;
wxString text; wxString text;
wxString textWithSpace; wxString textWithSpace;
@ -35,8 +41,6 @@ struct Syllable {
int x; // centerX, used only for kBouncingBallLyrics int x; // centerX, used only for kBouncingBallLyrics
}; };
WX_DECLARE_OBJARRAY(Syllable, SyllableArray);
class LyricsPanel; class LyricsPanel;
// Override wxTextCtrl to handle selection events, which the parent ignores if the control is read-only. // Override wxTextCtrl to handle selection events, which the parent ignores if the control is read-only.
@ -136,7 +140,7 @@ private:
double mT; double mT;
int mCurrentSyllable; int mCurrentSyllable;
SyllableArray mSyllables; std::vector<Syllable> mSyllables;
wxString mText; wxString mText;
int mTextHeight; // only for drawn text int mTextHeight; // only for drawn text

@ -15,7 +15,6 @@
#include <math.h> #include <math.h>
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
#include <wx/arrimpl.cpp>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/settings.h> // for wxSystemSettings::GetColour and wxSystemSettings::GetMetric #include <wx/settings.h> // for wxSystemSettings::GetColour and wxSystemSettings::GetMetric

@ -18,7 +18,6 @@ i.e. an alternative to the usual interface, for Audacity.
*//*******************************************************************/ *//*******************************************************************/
#include <wx/dynarray.h>
#include <wx/dynlib.h> #include <wx/dynlib.h>
#include <wx/list.h> #include <wx/list.h>
#include <wx/log.h> #include <wx/log.h>
@ -44,8 +43,6 @@ i.e. an alternative to the usual interface, for Audacity.
#include "ModuleManager.h" #include "ModuleManager.h"
#include "widgets/MultiDialog.h" #include "widgets/MultiDialog.h"
#include <wx/arrimpl.cpp>
#include "Experimental.h" #include "Experimental.h"
#include "widgets/ErrorDialog.h" #include "widgets/ErrorDialog.h"

@ -20,7 +20,6 @@
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dir.h> #include <wx/dir.h>
#include <wx/dynarray.h>
#include <wx/dynlib.h> #include <wx/dynlib.h>
#include <wx/hashmap.h> #include <wx/hashmap.h>
#include <wx/filename.h> #include <wx/filename.h>
@ -46,8 +45,6 @@
#include "PluginManager.h" #include "PluginManager.h"
#include <wx/arrimpl.cpp>
#include "Experimental.h" #include "Experimental.h"
#ifndef __AUDACITY_OLD_STD__ #ifndef __AUDACITY_OLD_STD__

@ -12,7 +12,6 @@
#define __AUDACITY_PLUGINMANAGER_H__ #define __AUDACITY_PLUGINMANAGER_H__
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/fileconf.h> #include <wx/fileconf.h>
#include <wx/string.h> #include <wx/string.h>

@ -81,8 +81,6 @@ scroll information. It also has some status flags.
#include <wx/timer.h> #include <wx/timer.h>
#include <wx/display.h> #include <wx/display.h>
#include <wx/arrimpl.cpp> // this allows for creation of wxObjArray
#if defined(__WXMAC__) #if defined(__WXMAC__)
#if !wxCHECK_VERSION(3, 0, 0) #if !wxCHECK_VERSION(3, 0, 0)
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>

@ -35,7 +35,6 @@
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include <wx/dynarray.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/filefn.h> #include <wx/filefn.h>
#include <wx/ffile.h> #include <wx/ffile.h>
@ -1799,7 +1798,7 @@ void Sequence::Delete(sampleCount start, sampleCount len)
Read(scratch.ptr() + prepreLen*sampleSize, mSampleFormat, Read(scratch.ptr() + prepreLen*sampleSize, mSampleFormat,
preBlock, 0, preBufferLen, true); preBlock, 0, preBufferLen, true);
newBlock.erase(newBlock.end() - 1); newBlock.pop_back();
Blockify(*mDirManager, mMaxSamples, mSampleFormat, Blockify(*mDirManager, mMaxSamples, mSampleFormat,
newBlock, prepreBlock.start, scratch.ptr(), sum); newBlock, prepreBlock.start, scratch.ptr(), sum);
} }

@ -14,7 +14,6 @@
#include "MemoryX.h" #include "MemoryX.h"
#include <vector> #include <vector>
#include <wx/string.h> #include <wx/string.h>
#include <wx/dynarray.h>
#include "SampleFormat.h" #include "SampleFormat.h"
#include "xml/XMLTagHandler.h" #include "xml/XMLTagHandler.h"

@ -18,8 +18,6 @@
#include "LabelTrack.h" #include "LabelTrack.h"
#include "WaveTrack.h" #include "WaveTrack.h"
#include <wx/arrimpl.cpp>
inline bool operator < (SnapPoint s1, SnapPoint s2) inline bool operator < (SnapPoint s1, SnapPoint s2)
{ {
return s1.t < s2.t; return s1.t < s2.t;

@ -73,6 +73,8 @@ class AUDACITY_DLL_API Tags final : public XMLTagHandler {
public: public:
Tags(); // constructor Tags(); // constructor
Tags( const Tags& ) = default;
Tags( Tags && ) = default;
virtual ~Tags(); virtual ~Tags();
std::shared_ptr<Tags> Duplicate() const; std::shared_ptr<Tags> Duplicate() const;

@ -82,12 +82,6 @@ can't be.
#include "ImageManipulation.h" #include "ImageManipulation.h"
#include "widgets/ErrorDialog.h" #include "widgets/ErrorDialog.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfImages )
WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfBitmaps )
WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfColours )
// JKC: First get the MAC specific images. // JKC: First get the MAC specific images.
// As we've disabled USE_AQUA_THEME, we need to name each file we use. // As we've disabled USE_AQUA_THEME, we need to name each file we use.
// //
@ -477,7 +471,7 @@ void ThemeBase::RegisterImage( int &iIndex, char const ** pXpm, const wxString &
void ThemeBase::RegisterImage( int &iIndex, const wxImage &Image, const wxString & Name ) void ThemeBase::RegisterImage( int &iIndex, const wxImage &Image, const wxString & Name )
{ {
wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice! wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice!
mImages.Add( Image ); mImages.push_back( Image );
#ifdef __APPLE__ #ifdef __APPLE__
// On Mac, bitmaps with alpha don't work. // On Mac, bitmaps with alpha don't work.
@ -487,23 +481,23 @@ void ThemeBase::RegisterImage( int &iIndex, const wxImage &Image, const wxString
// the blending ourselves anyway.] // the blending ourselves anyway.]
wxImage TempImage( Image ); wxImage TempImage( Image );
TempImage.ConvertAlphaToMask(); TempImage.ConvertAlphaToMask();
mBitmaps.Add( wxBitmap( TempImage ) ); mBitmaps.push_back( wxBitmap( TempImage ) );
#else #else
mBitmaps.Add( wxBitmap( Image ) ); mBitmaps.push_back( wxBitmap( Image ) );
#endif #endif
mBitmapNames.Add( Name ); mBitmapNames.Add( Name );
mBitmapFlags.Add( mFlow.mFlags ); mBitmapFlags.Add( mFlow.mFlags );
mFlow.mFlags &= ~resFlagSkip; mFlow.mFlags &= ~resFlagSkip;
iIndex = mBitmaps.GetCount()-1; iIndex = mBitmaps.size() - 1;
} }
void ThemeBase::RegisterColour( int &iIndex, const wxColour &Clr, const wxString & Name ) void ThemeBase::RegisterColour( int &iIndex, const wxColour &Clr, const wxString & Name )
{ {
wxASSERT( iIndex == -1 ); // Don't initialise same colour twice! wxASSERT( iIndex == -1 ); // Don't initialise same colour twice!
mColours.Add( Clr ); mColours.push_back( Clr );
mColourNames.Add( Name ); mColourNames.Add( Name );
iIndex = mColours.GetCount()-1; iIndex = mColours.size() - 1;
} }
void FlowPacker::Init(int width) void FlowPacker::Init(int width)
@ -689,7 +683,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
#endif #endif
// Save the bitmaps // Save the bitmaps
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0;i < (int)mImages.size();i++)
{ {
wxImage &SrcImage = mImages[i]; wxImage &SrcImage = mImages[i];
mFlow.mFlags = mBitmapFlags[i]; mFlow.mFlags = mBitmapFlags[i];
@ -718,7 +712,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
mFlow.SetColourGroup(); mFlow.SetColourGroup();
const int iColSize = 10; const int iColSize = 10;
for(i=0;i<(int)mColours.GetCount();i++) for(i = 0; i < (int)mColours.size(); i++)
{ {
mFlow.GetNextPosition( iColSize, iColSize ); mFlow.GetNextPosition( iColSize, iColSize );
wxColour c = mColours[i]; wxColour c = mColours[i];
@ -839,7 +833,7 @@ void ThemeBase::WriteImageMap( )
File.Write( Temp ); File.Write( Temp );
File.Write( wxT("<map name=\"map1\">\r\n") ); File.Write( wxT("<map name=\"map1\">\r\n") );
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
wxImage &SrcImage = mImages[i]; wxImage &SrcImage = mImages[i];
mFlow.mFlags = mBitmapFlags[i]; mFlow.mFlags = mBitmapFlags[i];
@ -857,7 +851,7 @@ void ThemeBase::WriteImageMap( )
// Now save the colours. // Now save the colours.
mFlow.SetColourGroup(); mFlow.SetColourGroup();
const int iColSize = 10; const int iColSize = 10;
for(i=0;i<(int)mColours.GetCount();i++) for(i = 0; i < (int)mColours.size(); i++)
{ {
mFlow.GetNextPosition( iColSize, iColSize ); mFlow.GetNextPosition( iColSize, iColSize );
// No href in html. Uses title not alt. // No href in html. Uses title not alt.
@ -883,7 +877,7 @@ void ThemeBase::WriteImageDefs( )
if( !File.IsOpened() ) if( !File.IsOpened() )
return; return;
teResourceFlags PrevFlags = (teResourceFlags)-1; teResourceFlags PrevFlags = (teResourceFlags)-1;
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
wxImage &SrcImage = mImages[i]; wxImage &SrcImage = mImages[i];
// No href in html. Uses title not alt. // No href in html. Uses title not alt.
@ -1029,7 +1023,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
mFlow.Init(ImageCacheWidth); mFlow.Init(ImageCacheWidth);
mFlow.mBorderWidth = 1; mFlow.mBorderWidth = 1;
// Load the bitmaps // Load the bitmaps
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
wxImage &Image = mImages[i]; wxImage &Image = mImages[i];
mFlow.mFlags = mBitmapFlags[i]; mFlow.mFlags = mBitmapFlags[i];
@ -1048,7 +1042,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
mFlow.SetColourGroup(); mFlow.SetColourGroup();
wxColour TempColour; wxColour TempColour;
const int iColSize=10; const int iColSize=10;
for(i=0;i<(int)mColours.GetCount();i++) for(i = 0; i < (int)mColours.size(); i++)
{ {
mFlow.GetNextPosition( iColSize, iColSize ); mFlow.GetNextPosition( iColSize, iColSize );
mFlow.RectMid( x, y ); mFlow.RectMid( x, y );
@ -1081,7 +1075,7 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound )
int i; int i;
int n=0; int n=0;
wxString FileName; wxString FileName;
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
if( (mBitmapFlags[i] & resFlagInternal)==0) if( (mBitmapFlags[i] & resFlagInternal)==0)
@ -1150,7 +1144,7 @@ void ThemeBase::SaveComponents()
int i; int i;
int n=0; int n=0;
wxString FileName; wxString FileName;
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
if( (mBitmapFlags[i] & resFlagInternal)==0) if( (mBitmapFlags[i] & resFlagInternal)==0)
{ {
@ -1176,7 +1170,7 @@ void ThemeBase::SaveComponents()
return; return;
} }
for(i=0;i<(int)mImages.GetCount();i++) for(i = 0; i < (int)mImages.size(); i++)
{ {
if( (mBitmapFlags[i] & resFlagInternal)==0) if( (mBitmapFlags[i] & resFlagInternal)==0)
{ {

@ -16,11 +16,11 @@
#include "Audacity.h" #include "Audacity.h"
#include <vector>
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/image.h> #include <wx/image.h>
@ -57,14 +57,6 @@ enum teThemeType
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxImage, ArrayOfImages, AUDACITY_DLL_API);
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxBitmap, ArrayOfBitmaps, AUDACITY_DLL_API);
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxColour, ArrayOfColours, AUDACITY_DLL_API);
//WX_DECLARE_OBJARRAY(wxImage, ArrayOfImages);
//WX_DECLARE_OBJARRAY(wxBitmap, ArrayOfBitmaps);
//WX_DECLARE_OBJARRAY(wxColour, ArrayOfColours);
class AUDACITY_DLL_API FlowPacker class AUDACITY_DLL_API FlowPacker
{ {
public: public:
@ -150,12 +142,13 @@ public:
wxImage MakeImageWithAlpha( wxBitmap & Bmp ); wxImage MakeImageWithAlpha( wxBitmap & Bmp );
protected: protected:
ArrayOfImages mImages; // wxImage, wxBitmap copy cheaply using reference counting
ArrayOfBitmaps mBitmaps; std::vector<wxImage> mImages;
std::vector<wxBitmap> mBitmaps;
wxArrayString mBitmapNames; wxArrayString mBitmapNames;
wxArrayInt mBitmapFlags; wxArrayInt mBitmapFlags;
ArrayOfColours mColours; std::vector<wxColour> mColours;
wxArrayString mColourNames; wxArrayString mColourNames;
FlowPacker mFlow; FlowPacker mFlow;
}; };

@ -16,7 +16,6 @@
#include "Audacity.h" #include "Audacity.h"
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/string.h> #include <wx/string.h>

@ -17,7 +17,6 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <functional> #include <functional>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/longlong.h> #include <wx/longlong.h>

@ -65,19 +65,6 @@ struct TrackPanelDrawingContext;
enum class UndoPush : unsigned char; enum class UndoPush : unsigned char;
// JKC Nov 2011: Disabled warning C4251 which is to do with DLL linkage
// and only a worry when there are DLLs using the structures.
// Array classes are private in TrackInfo, so we will not
// access them directly from the DLL.
// TrackClipArray in TrackPanel needs to be handled with care in the derived
// class, but the C4251 warning is no worry in core Audacity.
// wxWidgets doesn't cater to the exact details we need in
// WX_DECLARE_EXPORTED_OBJARRAY to be able to use that for these two arrays.
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API,
EVT_TRACK_PANEL_TIMER, wxCommandEvent); EVT_TRACK_PANEL_TIMER, wxCommandEvent);

@ -20,7 +20,6 @@
#include "../MemoryX.h" #include "../MemoryX.h"
#include <vector> #include <vector>
#include <wx/string.h> #include <wx/string.h>
#include <wx/dynarray.h>
#include <wx/menu.h> #include <wx/menu.h>
#include <wx/hashmap.h> #include <wx/hashmap.h>

@ -24,7 +24,6 @@
#include <wx/dcclient.h> #include <wx/dcclient.h>
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
#include <wx/dynarray.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "../AColor.h" #include "../AColor.h"
@ -72,11 +71,6 @@ struct AutoDuckRegion
double t1; double t1;
}; };
#include <wx/arrimpl.cpp>
WX_DECLARE_OBJARRAY(AutoDuckRegion, AutoDuckRegionArray);
WX_DEFINE_OBJARRAY(AutoDuckRegionArray);
/* /*
* Effect implementation * Effect implementation
*/ */
@ -296,7 +290,7 @@ bool EffectAutoDuck::Process()
float rmsSum = 0; float rmsSum = 0;
// to make the progress bar appear more natural, we first look for all // to make the progress bar appear more natural, we first look for all
// duck regions and apply them all at once afterwards // duck regions and apply them all at once afterwards
AutoDuckRegionArray regions; std::vector<AutoDuckRegion> regions;
bool inDuckRegion = false; bool inDuckRegion = false;
{ {
Floats rmsWindow{ kRMSWindowSize, true }; Floats rmsWindow{ kRMSWindowSize, true };
@ -354,7 +348,7 @@ bool EffectAutoDuck::Process()
double duckRegionEnd = double duckRegionEnd =
mControlTrack->LongSamplesToTime(i - curSamplesPause); mControlTrack->LongSamplesToTime(i - curSamplesPause);
regions.Add(AutoDuckRegion( regions.push_back(AutoDuckRegion(
duckRegionStart - mOuterFadeDownLen, duckRegionStart - mOuterFadeDownLen,
duckRegionEnd + mOuterFadeUpLen)); duckRegionEnd + mOuterFadeUpLen));
@ -381,7 +375,7 @@ bool EffectAutoDuck::Process()
{ {
double duckRegionEnd = double duckRegionEnd =
mControlTrack->LongSamplesToTime(end - curSamplesPause); mControlTrack->LongSamplesToTime(end - curSamplesPause);
regions.Add(AutoDuckRegion( regions.push_back(AutoDuckRegion(
duckRegionStart - mOuterFadeDownLen, duckRegionStart - mOuterFadeDownLen,
duckRegionEnd + mOuterFadeUpLen)); duckRegionEnd + mOuterFadeUpLen));
} }
@ -399,7 +393,7 @@ bool EffectAutoDuck::Process()
{ {
WaveTrack* t = (WaveTrack*)iterTrack; WaveTrack* t = (WaveTrack*)iterTrack;
for (size_t i = 0; i < regions.GetCount(); i++) for (size_t i = 0; i < regions.size(); i++)
{ {
const AutoDuckRegion& region = regions[i]; const AutoDuckRegion& region = regions[i];
if (ApplyDuckFade(trackNumber, t, region.t0, region.t1)) if (ApplyDuckFade(trackNumber, t, region.t0, region.t1))

@ -46,9 +46,6 @@ Param( Treble, double, wxT("Treble"), 0.0, -30.0, 30.0, 1 )
Param( Gain, double, wxT("Gain"), 0.0, -30.0, 30.0, 1 ); Param( Gain, double, wxT("Gain"), 0.0, -30.0, 30.0, 1 );
Param( Link, bool, wxT("Link Sliders"), false, false, true, 1 ); Param( Link, bool, wxT("Link Sliders"), false, false, true, 1 );
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectBassTrebleStateArray);
// Used to communicate the type of the filter. // Used to communicate the type of the filter.
enum kShelfType enum kShelfType
{ {
@ -142,7 +139,7 @@ bool EffectBassTreble::RealtimeInitialize()
{ {
SetBlockSize(512); SetBlockSize(512);
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }
@ -153,14 +150,14 @@ bool EffectBassTreble::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), floa
InstanceInit(slave, sampleRate); InstanceInit(slave, sampleRate);
mSlaves.Add(slave); mSlaves.push_back(slave);
return true; return true;
} }
bool EffectBassTreble::RealtimeFinalize() bool EffectBassTreble::RealtimeFinalize()
{ {
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }

@ -39,8 +39,6 @@ public:
double xn1Treble, xn2Treble, yn1Treble, yn2Treble; double xn1Treble, xn2Treble, yn1Treble, yn2Treble;
}; };
WX_DECLARE_OBJARRAY(EffectBassTrebleState, EffectBassTrebleStateArray);
class EffectBassTreble final : public Effect class EffectBassTreble final : public Effect
{ {
public: public:
@ -106,7 +104,7 @@ private:
private: private:
EffectBassTrebleState mMaster; EffectBassTrebleState mMaster;
EffectBassTrebleStateArray mSlaves; std::vector<EffectBassTrebleState> mSlaves;
double mBass; double mBass;
double mTreble; double mTreble;

@ -147,9 +147,6 @@ wxString defaultLabel(int index)
return theArray.Get()[ index ]; return theArray.Get()[ index ];
} }
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectDistortionStateArray);
// //
// EffectDistortion // EffectDistortion
// //
@ -251,7 +248,7 @@ bool EffectDistortion::RealtimeInitialize()
{ {
SetBlockSize(512); SetBlockSize(512);
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }
@ -262,14 +259,14 @@ bool EffectDistortion::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), floa
InstanceInit(slave, sampleRate); InstanceInit(slave, sampleRate);
mSlaves.Add(slave); mSlaves.push_back(slave);
return true; return true;
} }
bool EffectDistortion::RealtimeFinalize() bool EffectDistortion::RealtimeFinalize()
{ {
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }

@ -45,8 +45,6 @@ public:
double queuetotal; double queuetotal;
}; };
WX_DECLARE_OBJARRAY(EffectDistortionState, EffectDistortionStateArray);
class EffectDistortion final : public Effect class EffectDistortion final : public Effect
{ {
public: public:
@ -171,7 +169,7 @@ private:
private: private:
EffectDistortionState mMaster; EffectDistortionState mMaster;
EffectDistortionStateArray mSlaves; std::vector<EffectDistortionState> mSlaves;
double mTable[TABLESIZE]; double mTable[TABLESIZE];
double mThreshold; double mThreshold;

@ -19,7 +19,6 @@
#include "../MemoryX.h" #include "../MemoryX.h"
#include <wx/bmpbuttn.h> #include <wx/bmpbuttn.h>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/tglbtn.h> #include <wx/tglbtn.h>

@ -171,10 +171,6 @@ Param( DrawGrid, bool, wxT(""), true, false, true,
Param( dBMin, float, wxT(""), -30.0, -120.0, -10.0, 0 ); Param( dBMin, float, wxT(""), -30.0, -120.0, -10.0, 0 );
Param( dBMax, float, wxT(""), 30.0, 0.0, 60.0, 0 ); Param( dBMax, float, wxT(""), 30.0, 0.0, 60.0, 0 );
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY( EQPointArray );
WX_DEFINE_OBJARRAY( EQCurveArray );
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
// EffectEqualization // EffectEqualization
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -398,7 +394,7 @@ bool EffectEqualization::ValidateUI()
j--; j--;
} }
} }
Select((int) mCurves.GetCount() - 1); Select((int) mCurves.size() - 1);
} }
SaveCurves(); SaveCurves();
@ -842,7 +838,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
{ {
wxArrayString curves; wxArrayString curves;
for (size_t i = 0, cnt = mCurves.GetCount(); i < cnt; i++) for (size_t i = 0, cnt = mCurves.size(); i < cnt; i++)
{ {
curves.Add(mCurves[ i ].Name); curves.Add(mCurves[ i ].Name);
} }
@ -1372,18 +1368,18 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
// If requested file doesn't exist... // If requested file doesn't exist...
if( !fn.FileExists() && !GetDefaultFileName(fn) ) { if( !fn.FileExists() && !GetDefaultFileName(fn) ) {
mCurves.Clear(); mCurves.clear();
mCurves.Add( _("unnamed") ); // we still need a default curve to use mCurves.push_back( _("unnamed") ); // we still need a default curve to use
return; return;
} }
EQCurve tempCustom(wxT("temp")); EQCurve tempCustom(wxT("temp"));
if( append == false ) // Start from scratch if( append == false ) // Start from scratch
mCurves.Clear(); mCurves.clear();
else // appending so copy and remove 'unnamed', to replace later else // appending so copy and remove 'unnamed', to replace later
{ {
tempCustom.points = mCurves.Last().points; tempCustom.points = mCurves.back().points;
mCurves.RemoveAt(mCurves.Count()-1); mCurves.pop_back();
} }
// Load the curves // Load the curves
@ -1398,12 +1394,12 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
Effect::MessageBox( msg, Effect::MessageBox( msg,
wxOK | wxCENTRE, wxOK | wxCENTRE,
_("Error Loading EQ Curves")); _("Error Loading EQ Curves"));
mCurves.Add( _("unnamed") ); // we always need a default curve to use mCurves.push_back( _("unnamed") ); // we always need a default curve to use
return; return;
} }
// Move "unnamed" to end, if it exists in current language. // Move "unnamed" to end, if it exists in current language.
int numCurves = mCurves.GetCount(); int numCurves = mCurves.size();
int curve; int curve;
EQCurve tempUnnamed(wxT("tempUnnamed")); EQCurve tempUnnamed(wxT("tempUnnamed"));
for( curve = 0; curve < numCurves-1; curve++ ) for( curve = 0; curve < numCurves-1; curve++ )
@ -1411,17 +1407,17 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
if( mCurves[curve].Name == _("unnamed") ) if( mCurves[curve].Name == _("unnamed") )
{ {
tempUnnamed.points = mCurves[curve].points; tempUnnamed.points = mCurves[curve].points;
mCurves.RemoveAt(curve); mCurves.erase(mCurves.begin() + curve);
mCurves.Add( _("unnamed") ); // add 'unnamed' back at the end mCurves.push_back( _("unnamed") ); // add 'unnamed' back at the end
mCurves.Last().points = tempUnnamed.points; mCurves.back().points = tempUnnamed.points;
} }
} }
if( mCurves.Last().Name != _("unnamed") ) if( mCurves.back().Name != _("unnamed") )
mCurves.Add( _("unnamed") ); // we always need a default curve to use mCurves.push_back( _("unnamed") ); // we always need a default curve to use
if( append == true ) if( append == true )
{ {
mCurves.Last().points = tempCustom.points; mCurves.back().points = tempCustom.points;
} }
return; return;
@ -1432,7 +1428,7 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
// //
void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */) void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
{ {
if (mCurves.GetCount() == 0) if (mCurves.size() == 0)
return; return;
/* i18n-hint: name of the 'unnamed' custom curve */ /* i18n-hint: name of the 'unnamed' custom curve */
@ -1440,11 +1436,11 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
// Save the "unnamed" curve and remove it so we can add it back as the final curve. // Save the "unnamed" curve and remove it so we can add it back as the final curve.
EQCurve userUnnamed(wxT("temp")); EQCurve userUnnamed(wxT("temp"));
userUnnamed = mCurves.Last(); userUnnamed = mCurves.back();
mCurves.RemoveAt(mCurves.Count()-1); mCurves.pop_back();
EQCurveArray userCurves = mCurves; EQCurveArray userCurves = mCurves;
mCurves.Clear(); mCurves.clear();
// We only wamt to look for the shipped EQDefaultCurves.xml // We only wamt to look for the shipped EQDefaultCurves.xml
wxFileName fn = wxFileName(FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml")); wxFileName fn = wxFileName(FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml"));
wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),fn.GetFullPath()); wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),fn.GetFullPath());
@ -1459,25 +1455,25 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
} }
EQCurveArray defaultCurves = mCurves; EQCurveArray defaultCurves = mCurves;
mCurves.Clear(); // clear now so that we can sort then add back. mCurves.clear(); // clear now so that we can sort then add back.
// Remove "unnamed" if it exists. // Remove "unnamed" if it exists.
if (defaultCurves.Last().Name == unnamed) { if (defaultCurves.back().Name == unnamed) {
defaultCurves.RemoveAt(defaultCurves.Count()-1); defaultCurves.pop_back();
} }
else { else {
wxLogError(wxT("Error in EQDefaultCurves.xml")); wxLogError(wxT("Error in EQDefaultCurves.xml"));
} }
int numUserCurves = userCurves.GetCount(); int numUserCurves = userCurves.size();
int numDefaultCurves = defaultCurves.GetCount(); int numDefaultCurves = defaultCurves.size();
EQCurve tempCurve(wxT("test")); EQCurve tempCurve(wxT("test"));
if (updateAll) { if (updateAll) {
// Update all factory preset curves. // Update all factory preset curves.
// Sort and add factory defaults first; // Sort and add factory defaults first;
mCurves = defaultCurves; mCurves = defaultCurves;
mCurves.Sort(SortCurvesByName); std::sort(mCurves.begin(), mCurves.end());
// then add remaining user curves: // then add remaining user curves:
for (int curveCount = 0; curveCount < numUserCurves; curveCount++) { for (int curveCount = 0; curveCount < numUserCurves; curveCount++) {
bool isCustom = true; bool isCustom = true;
@ -1491,7 +1487,7 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
} }
// if tempCurve is not in the default set, add it to mCurves. // if tempCurve is not in the default set, add it to mCurves.
if (isCustom) { if (isCustom) {
mCurves.Add(tempCurve); mCurves.push_back(tempCurve);
} }
} }
} }
@ -1503,15 +1499,15 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) { for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) {
if (userCurves[userCurveCount].Name == defaultCurves[defCurveCount].Name) { if (userCurves[userCurveCount].Name == defaultCurves[defCurveCount].Name) {
isUserCurve = true; isUserCurve = true;
mCurves.Add(userCurves[userCurveCount]); mCurves.push_back(userCurves[userCurveCount]);
break; break;
} }
} }
if (!isUserCurve) { if (!isUserCurve) {
mCurves.Add(defaultCurves[defCurveCount]); mCurves.push_back(defaultCurves[defCurveCount]);
} }
} }
mCurves.Sort(SortCurvesByName); std::sort(mCurves.begin(), mCurves.end());
// now add the rest of the user's curves. // now add the rest of the user's curves.
for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) { for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) {
bool isDefaultCurve = false; bool isDefaultCurve = false;
@ -1523,16 +1519,16 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
} }
} }
if (!isDefaultCurve) { if (!isDefaultCurve) {
mCurves.Add(tempCurve); mCurves.push_back(tempCurve);
} }
} }
} }
defaultCurves.Clear(); defaultCurves.clear();
userCurves.Clear(); userCurves.clear();
// Add back old "unnamed" // Add back old "unnamed"
if(userUnnamed.Name == unnamed) { if(userUnnamed.Name == unnamed) {
mCurves.Add( userUnnamed ); // we always need a default curve to use mCurves.push_back( userUnnamed ); // we always need a default curve to use
} }
SaveCurves(); SaveCurves();
@ -1621,11 +1617,11 @@ void EffectEqualization::SaveCurves(const wxString &fileName)
void EffectEqualization::setCurve(int currentCurve) void EffectEqualization::setCurve(int currentCurve)
{ {
// Set current choice // Set current choice
wxASSERT( currentCurve < (int) mCurves.GetCount() ); wxASSERT( currentCurve < (int) mCurves.size() );
Select(currentCurve); Select(currentCurve);
Envelope *env; Envelope *env;
int numPoints = (int) mCurves[currentCurve].points.GetCount(); int numPoints = (int) mCurves[currentCurve].points.size();
if (mLin) { // linear freq mode if (mLin) { // linear freq mode
env = mLinEnvelope.get(); env = mLinEnvelope.get();
@ -1665,7 +1661,8 @@ void EffectEqualization::setCurve(int currentCurve)
} }
// We have at least two points, so ensure they are in frequency order. // We have at least two points, so ensure they are in frequency order.
mCurves[currentCurve].points.Sort(SortCurvePoints); std::sort(mCurves[currentCurve].points.begin(),
mCurves[currentCurve].points.end());
if (mCurves[currentCurve].points[0].Freq < 0) { if (mCurves[currentCurve].points[0].Freq < 0) {
// Corrupt or invalid curve, so bail. // Corrupt or invalid curve, so bail.
@ -1780,21 +1777,21 @@ void EffectEqualization::setCurve(int currentCurve)
void EffectEqualization::setCurve() void EffectEqualization::setCurve()
{ {
setCurve((int) mCurves.GetCount()-1); setCurve((int) mCurves.size() - 1);
} }
void EffectEqualization::setCurve(const wxString &curveName) void EffectEqualization::setCurve(const wxString &curveName)
{ {
unsigned i = 0; unsigned i = 0;
for( i = 0; i < mCurves.GetCount(); i++ ) for( i = 0; i < mCurves.size(); i++ )
if( curveName == mCurves[ i ].Name ) if( curveName == mCurves[ i ].Name )
break; break;
if( i == mCurves.GetCount()) if( i == mCurves.size())
{ {
Effect::MessageBox( _("Requested curve not found, using 'unnamed'"), Effect::MessageBox( _("Requested curve not found, using 'unnamed'"),
wxOK|wxICON_ERROR, wxOK|wxICON_ERROR,
_("Curve not found") ); _("Curve not found") );
setCurve((int) mCurves.GetCount()-1); setCurve((int) mCurves.size() - 1);
} }
else else
setCurve( i ); setCurve( i );
@ -1848,8 +1845,8 @@ void EffectEqualization::EnvelopeUpdated(Envelope *env, bool lin)
env->GetPoints( when.get(), value.get(), numPoints ); env->GetPoints( when.get(), value.get(), numPoints );
// Clear the unnamed curve // Clear the unnamed curve
int curve = mCurves.GetCount()-1; int curve = mCurves.size() - 1;
mCurves[ curve ].points.Clear(); mCurves[ curve ].points.clear();
if(lin) if(lin)
{ {
@ -1860,7 +1857,7 @@ void EffectEqualization::EnvelopeUpdated(Envelope *env, bool lin)
double db = value[ point ]; double db = value[ point ];
// Add it to the curve // Add it to the curve
mCurves[ curve ].points.Add( EQPoint( freq, db ) ); mCurves[ curve ].points.push_back( EQPoint( freq, db ) );
} }
} }
else else
@ -1876,14 +1873,14 @@ void EffectEqualization::EnvelopeUpdated(Envelope *env, bool lin)
double db = value[ point ]; double db = value[ point ];
// Add it to the curve // Add it to the curve
mCurves[ curve ].points.Add( EQPoint( freq, db ) ); mCurves[ curve ].points.push_back( EQPoint( freq, db ) );
} }
} }
// Remember that we've updated the unnamed curve // Remember that we've updated the unnamed curve
mDirty = true; mDirty = true;
// set 'unnamed' as the selected curve // set 'unnamed' as the selected curve
Select( (int) mCurves.GetCount()-1 ); Select( (int) mCurves.size() - 1 );
} }
// //
@ -1957,7 +1954,7 @@ bool EffectEqualization::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
do do
{ {
exists = false; exists = false;
for(size_t i=0;i<mCurves.GetCount();i++) for(size_t i = 0; i < mCurves.size(); i++)
{ {
if(n>0) if(n>0)
strValueTemp.Printf(wxT("%s (%d)"),strValue,n); strValueTemp.Printf(wxT("%s (%d)"),strValue,n);
@ -1971,7 +1968,7 @@ bool EffectEqualization::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
} }
while(exists == true); while(exists == true);
mCurves.Add( EQCurve( strValueTemp ) ); mCurves.push_back( EQCurve( strValueTemp ) );
} }
} }
@ -2014,7 +2011,7 @@ bool EffectEqualization::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
} }
// Create a NEW point // Create a NEW point
mCurves[ mCurves.GetCount() - 1 ].points.Add( EQPoint( f, d ) ); mCurves[ mCurves.size() - 1 ].points.push_back( EQPoint( f, d ) );
// Tell caller it was processed // Tell caller it was processed
return true; return true;
@ -2057,7 +2054,7 @@ void EffectEqualization::WriteXML(XMLWriter &xmlFile) const
xmlFile.StartTag( wxT( "equalizationeffect" ) ); xmlFile.StartTag( wxT( "equalizationeffect" ) );
// Write all curves // Write all curves
int numCurves = mCurves.GetCount(); int numCurves = mCurves.size();
int curve; int curve;
for( curve = 0; curve < numCurves; curve++ ) for( curve = 0; curve < numCurves; curve++ )
{ {
@ -2066,7 +2063,7 @@ void EffectEqualization::WriteXML(XMLWriter &xmlFile) const
xmlFile.WriteAttr( wxT( "name" ), mCurves[ curve ].Name ); xmlFile.WriteAttr( wxT( "name" ), mCurves[ curve ].Name );
// Write all points // Write all points
int numPoints = mCurves[ curve ].points.GetCount(); int numPoints = mCurves[ curve ].points.size();
int point; int point;
for( point = 0; point < numPoints; point++ ) for( point = 0; point < numPoints; point++ )
{ {
@ -2121,7 +2118,7 @@ void EffectEqualization::UpdateCurves()
{ {
// Reload the curve names // Reload the curve names
mCurve->Clear(); mCurve->Clear();
for (size_t i = 0, cnt = mCurves.GetCount(); i < cnt; i++) for (size_t i = 0, cnt = mCurves.size(); i < cnt; i++)
{ {
mCurve->Append(mCurves[ i ].Name); mCurve->Append(mCurves[ i ].Name);
} }
@ -2396,7 +2393,7 @@ void EffectEqualization::ErrMin(void)
} }
if( error > .0025 * mBandsInUse ) // not within 0.05dB on each slider, on average if( error > .0025 * mBandsInUse ) // not within 0.05dB on each slider, on average
{ {
Select( (int) mCurves.GetCount()-1 ); Select( (int) mCurves.size() - 1 );
EnvelopeUpdated(&testEnvelope, false); EnvelopeUpdated(&testEnvelope, false);
} }
} }
@ -3132,10 +3129,10 @@ wxDialogWrapper(parent, wxID_ANY, _("Manage Curves List"),
mEffect = effect; mEffect = effect;
mPosition = position; mPosition = position;
// make a copy of mEffect->mCurves here to muck about with. // make a copy of mEffect->mCurves here to muck about with.
mEditCurves.Clear(); mEditCurves.clear();
for (unsigned int i = 0; i < mEffect->mCurves.GetCount(); i++) for (unsigned int i = 0; i < mEffect->mCurves.size(); i++)
{ {
mEditCurves.Add(mEffect->mCurves[i].Name); mEditCurves.push_back(mEffect->mCurves[i].Name);
mEditCurves[i].points = mEffect->mCurves[i].points; mEditCurves[i].points = mEffect->mCurves[i].points;
} }
@ -3195,7 +3192,7 @@ void EditCurvesDialog::PopulateOrExchange(ShuttleGui & S)
void EditCurvesDialog::PopulateList(int position) void EditCurvesDialog::PopulateList(int position)
{ {
mList->DeleteAllItems(); mList->DeleteAllItems();
for (unsigned int i = 0; i < mEditCurves.GetCount(); i++) for (unsigned int i = 0; i < mEditCurves.size(); i++)
mList->InsertItem(i, mEditCurves[i].Name); mList->InsertItem(i, mEditCurves[i].Name);
mList->SetColumnWidth(0, wxLIST_AUTOSIZE); mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
int curvesWidth = mList->GetColumnWidth(0); int curvesWidth = mList->GetColumnWidth(0);
@ -3292,7 +3289,7 @@ long EditCurvesDialog::GetPreviousItem(long item) // wx doesn't have this
void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event))
{ {
wxString name; wxString name;
int numCurves = mEditCurves.GetCount(); int numCurves = mEditCurves.size();
int curve = 0; int curve = 0;
// Setup list of characters that aren't allowed // Setup list of characters that aren't allowed
@ -3372,13 +3369,13 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event))
mList->SetItem(curve, 0, name); mList->SetItem(curve, 0, name);
else else
{ {
mEditCurves.RemoveAt( item ); mEditCurves.erase( mEditCurves.begin() + item );
numCurves--; numCurves--;
} }
} }
else if( item == (numCurves-1) ) // renaming 'unnamed' else if( item == (numCurves-1) ) // renaming 'unnamed'
{ // Create a NEW entry { // Create a NEW entry
mEditCurves.Add( EQCurve( wxT("unnamed") ) ); mEditCurves.push_back( EQCurve( wxT("unnamed") ) );
// Copy over the points // Copy over the points
mEditCurves[ numCurves ].points = mEditCurves[ numCurves - 1 ].points; mEditCurves[ numCurves ].points = mEditCurves[ numCurves - 1 ].points;
// Give the original unnamed entry the NEW name // Give the original unnamed entry the NEW name
@ -3470,12 +3467,12 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event))
} }
else else
{ {
mEditCurves.RemoveAt( item-deleted ); mEditCurves.erase( mEditCurves.begin() + item - deleted );
deleted++; deleted++;
} }
item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
} }
PopulateList(mEditCurves.GetCount()-1); // set 'unnamed' as the selected curve PopulateList(mEditCurves.size() - 1); // set 'unnamed' as the selected curve
} }
#endif #endif
} }
@ -3512,14 +3509,14 @@ void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event))
EQCurveArray temp; EQCurveArray temp;
temp = mEffect->mCurves; // backup the parent's curves temp = mEffect->mCurves; // backup the parent's curves
EQCurveArray exportCurves; // Copy selected curves to export EQCurveArray exportCurves; // Copy selected curves to export
exportCurves.Clear(); exportCurves.clear();
long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
int i=0; int i=0;
while(item >= 0) while(item >= 0)
{ {
if(item != mList->GetItemCount()-1) // not 'unnamed' if(item != mList->GetItemCount()-1) // not 'unnamed'
{ {
exportCurves.Add(mEditCurves[item].Name); exportCurves.push_back(mEditCurves[item].Name);
exportCurves[i].points = mEditCurves[item].points; exportCurves[i].points = mEditCurves[item].points;
i++; i++;
} }
@ -3570,10 +3567,10 @@ void EditCurvesDialog::OnOK(wxCommandEvent & WXUNUSED(event))
wxString backupPlace = wxFileName( FileNames::DataDir(), wxT("EQBackup.xml") ).GetFullPath(); wxString backupPlace = wxFileName( FileNames::DataDir(), wxT("EQBackup.xml") ).GetFullPath();
mEffect->SaveCurves(backupPlace); mEffect->SaveCurves(backupPlace);
// Load back into the main dialog // Load back into the main dialog
mEffect->mCurves.Clear(); mEffect->mCurves.clear();
for (unsigned int i = 0; i < mEditCurves.GetCount(); i++) for (unsigned int i = 0; i < mEditCurves.size(); i++)
{ {
mEffect->mCurves.Add(mEditCurves[i].Name); mEffect->mCurves.push_back(mEditCurves[i].Name);
mEffect->mCurves[i].points = mEditCurves[i].points; mEffect->mCurves[i].points = mEditCurves[i].points;
} }
mEffect->SaveCurves(); mEffect->SaveCurves();

@ -20,7 +20,6 @@
#include <wx/button.h> #include <wx/button.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dynarray.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -57,15 +56,20 @@ class EQPoint
{ {
public: public:
EQPoint( const double f, const double d ) { Freq = f; dB = d; } EQPoint( const double f, const double d ) { Freq = f; dB = d; }
bool operator < (const EQPoint &p1) const
{
return Freq < p1.Freq;
}
double Freq; double Freq;
double dB; double dB;
}; };
WX_DECLARE_OBJARRAY( EQPoint, EQPointArray);
// //
// One curve in a list // One curve in a list
// //
// LLL: This "really" isn't needed as the EQPointArray could be // LLL: This "really" isn't needed as the array of points could be
// attached as wxClientData to the wxChoice entries. I // attached as wxClientData to the wxChoice entries. I
// didn't realize this until after the fact and am too // didn't realize this until after the fact and am too
// lazy to change it. (But, hollar if you want me to.) // lazy to change it. (But, hollar if you want me to.)
@ -75,10 +79,17 @@ class EQCurve
public: public:
EQCurve( const wxString & name = wxEmptyString ) { Name = name; } EQCurve( const wxString & name = wxEmptyString ) { Name = name; }
EQCurve( const wxChar * name ) { Name = name; } EQCurve( const wxChar * name ) { Name = name; }
bool operator < (const EQCurve &that) const
{
return Name.CmpNoCase(that.Name) < 0;
}
wxString Name; wxString Name;
EQPointArray points; std::vector<EQPoint> points;
}; };
WX_DECLARE_OBJARRAY( EQCurve, EQCurveArray );
using EQCurveArray = std::vector<EQCurve>;
#ifdef EXPERIMENTAL_EQ_SSE_THREADED #ifdef EXPERIMENTAL_EQ_SSE_THREADED
class EffectEqualization48x; class EffectEqualization48x;
@ -257,21 +268,6 @@ private:
wxSlider *mdBMaxSlider; wxSlider *mdBMaxSlider;
wxSlider *mSliders[NUMBER_OF_BANDS]; wxSlider *mSliders[NUMBER_OF_BANDS];
static int wxCMPFUNC_CONV SortCurvesByName (EQCurve **first, EQCurve **second)
{
return (*first)->Name.CmpNoCase((*second)->Name);
}
static int wxCMPFUNC_CONV SortCurvePoints (EQPoint **p0, EQPoint **p1)
{
auto diff = (*p0)->Freq - (*p1)->Freq;
if (diff < 0)
return -1;
if (diff > 0)
return 1;
return 0;
}
#ifdef EXPERIMENTAL_EQ_SSE_THREADED #ifdef EXPERIMENTAL_EQ_SSE_THREADED
wxRadioButton *mMathProcessingType[5]; // default, sse, sse threaded, AVX, AVX threaded (note AVX is not implemented yet wxRadioButton *mMathProcessingType[5]; // default, sse, sse threaded, AVX, AVX threaded (note AVX is not implemented yet
wxBoxSizer *szrM; wxBoxSizer *szrM;

@ -34,8 +34,6 @@
#include <math.h> #include <math.h>
#include <wx/arrimpl.cpp>
#include "Equalization48x.h" #include "Equalization48x.h"
#include "../RealFFTf.h" #include "../RealFFTf.h"
#include "../RealFFTf48x.h" #include "../RealFFTf48x.h"

@ -59,9 +59,6 @@ Param( OutGain, double, wxT("Gain"), -6.0, -30.0, 30.0, 1 );
// How many samples are processed before recomputing the lfo value again // How many samples are processed before recomputing the lfo value again
#define lfoskipsamples 20 #define lfoskipsamples 20
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectPhaserStateArray);
// //
// EffectPhaser // EffectPhaser
// //
@ -165,7 +162,7 @@ bool EffectPhaser::RealtimeInitialize()
{ {
SetBlockSize(512); SetBlockSize(512);
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }
@ -176,14 +173,14 @@ bool EffectPhaser::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sa
InstanceInit(slave, sampleRate); InstanceInit(slave, sampleRate);
mSlaves.Add(slave); mSlaves.push_back(slave);
return true; return true;
} }
bool EffectPhaser::RealtimeFinalize() bool EffectPhaser::RealtimeFinalize()
{ {
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }

@ -44,8 +44,6 @@ public:
int laststages; int laststages;
}; };
WX_DECLARE_OBJARRAY(EffectPhaserState, EffectPhaserStateArray);
class EffectPhaser final : public Effect class EffectPhaser final : public Effect
{ {
public: public:
@ -120,7 +118,7 @@ private:
private: private:
EffectPhaserState mMaster; EffectPhaserState mMaster;
EffectPhaserStateArray mSlaves; std::vector<EffectPhaserState> mSlaves;
// parameters // parameters
int mStages; int mStages;

@ -53,9 +53,6 @@ Param( OutGain, double, wxT("Gain"), -6.0, -30.0, 30.0, 1 );
// How many samples are processed before recomputing the lfo value again // How many samples are processed before recomputing the lfo value again
#define lfoskipsamples 30 #define lfoskipsamples 30
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectWahwahStateArray);
// //
// EffectWahwah // EffectWahwah
// //
@ -157,7 +154,7 @@ bool EffectWahwah::RealtimeInitialize()
{ {
SetBlockSize(512); SetBlockSize(512);
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }
@ -168,14 +165,14 @@ bool EffectWahwah::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sa
InstanceInit(slave, sampleRate); InstanceInit(slave, sampleRate);
mSlaves.Add(slave); mSlaves.push_back(slave);
return true; return true;
} }
bool EffectWahwah::RealtimeFinalize() bool EffectWahwah::RealtimeFinalize()
{ {
mSlaves.Clear(); mSlaves.clear();
return true; return true;
} }

@ -41,8 +41,6 @@ public:
double b0, b1, b2, a0, a1, a2; double b0, b1, b2, a0, a1, a2;
}; };
WX_DECLARE_OBJARRAY(EffectWahwahState, EffectWahwahStateArray);
class EffectWahwah final : public Effect class EffectWahwah final : public Effect
{ {
public: public:
@ -104,7 +102,7 @@ private:
private: private:
EffectWahwahState mMaster; EffectWahwahState mMaster;
EffectWahwahStateArray mSlaves; std::vector<EffectWahwahState> mSlaves;
/* Parameters: /* Parameters:
mFreq - LFO frequency mFreq - LFO frequency

@ -19,7 +19,6 @@
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dynarray.h>
#ifdef __WXMAC__ #ifdef __WXMAC__
#include <wx/evtloop.h> #include <wx/evtloop.h>
@ -294,10 +293,6 @@ BEGIN_EVENT_TABLE(LV2Effect, wxEvtHandler)
EVT_IDLE(LV2Effect::OnIdle) EVT_IDLE(LV2Effect::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(LV2PortArray);
LV2Effect::LV2Effect(const LilvPlugin *plug) LV2Effect::LV2Effect(const LilvPlugin *plug)
{ {
mPlug = plug; mPlug = plug;
@ -398,7 +393,7 @@ wxString LV2Effect::GetFamily()
bool LV2Effect::IsInteractive() bool LV2Effect::IsInteractive()
{ {
return mControls.GetCount() != 0; return mControls.size() != 0;
} }
bool LV2Effect::IsDefault() bool LV2Effect::IsDefault()
@ -587,9 +582,9 @@ bool LV2Effect::SetHost(EffectHostInterface *host)
ctrl.mEnumeration = true; ctrl.mEnumeration = true;
} }
mControlsMap[ctrl.mIndex] = mControls.GetCount(); mControlsMap[ctrl.mIndex] = mControls.size();
mGroupMap[ctrl.mGroup].Add(mControls.GetCount()); mGroupMap[ctrl.mGroup].push_back(mControls.size());
mControls.Add(ctrl); mControls.push_back(ctrl);
} }
else if (lilv_port_is_a(mPlug, port, gOutput)) else if (lilv_port_is_a(mPlug, port, gOutput))
{ {
@ -600,8 +595,8 @@ bool LV2Effect::SetHost(EffectHostInterface *host)
} }
else else
{ {
mGroupMap[ctrl.mGroup].Add(mControls.GetCount()); mGroupMap[ctrl.mGroup].Add(mControls.size());
mControls.Add(ctrl); mControls.push_back(ctrl);
} }
} }
else else
@ -955,7 +950,7 @@ bool LV2Effect::ShowInterface(wxWindow *parent, bool forceModal)
bool LV2Effect::GetAutomationParameters(EffectAutomationParameters & parms) bool LV2Effect::GetAutomationParameters(EffectAutomationParameters & parms)
{ {
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
if (mControls[p].mInput) if (mControls[p].mInput)
{ {
@ -972,7 +967,7 @@ bool LV2Effect::GetAutomationParameters(EffectAutomationParameters & parms)
bool LV2Effect::SetAutomationParameters(EffectAutomationParameters & parms) bool LV2Effect::SetAutomationParameters(EffectAutomationParameters & parms)
{ {
// First pass validates values // First pass validates values
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
LV2Port & ctrl = mControls[p]; LV2Port & ctrl = mControls[p];
@ -993,7 +988,7 @@ bool LV2Effect::SetAutomationParameters(EffectAutomationParameters & parms)
} }
// Second pass actually sets the values // Second pass actually sets the values
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
LV2Port & ctrl = mControls[p]; LV2Port & ctrl = mControls[p];
@ -1338,7 +1333,7 @@ LilvInstance *LV2Effect::InitInstance(float sampleRate)
SetBlockSize(mBlockSize); SetBlockSize(mBlockSize);
SetSampleRate(sampleRate); SetSampleRate(sampleRate);
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
lilv_instance_connect_port(handle, lilv_instance_connect_port(handle,
mControls[p].mIndex, mControls[p].mIndex,
@ -1529,7 +1524,7 @@ bool LV2Effect::BuildPlain()
int numCols = 5; int numCols = 5;
// Allocate memory for the user parameter controls // Allocate memory for the user parameter controls
auto ctrlcnt = mControls.GetCount(); auto ctrlcnt = mControls.size();
mSliders.reinit(ctrlcnt); mSliders.reinit(ctrlcnt);
mFields.reinit(ctrlcnt); mFields.reinit(ctrlcnt);
@ -1833,7 +1828,7 @@ bool LV2Effect::TransferDataToWindow()
{ {
if (mSuilInstance) if (mSuilInstance)
{ {
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
if (mControls[p].mInput) if (mControls[p].mInput)
{ {
@ -2112,7 +2107,7 @@ void LV2Effect::SetPortValue(const char *port_symbol,
LV2_URID Int = URID_Map(lilv_node_as_string(gInt)); LV2_URID Int = URID_Map(lilv_node_as_string(gInt));
LV2_URID Long = URID_Map(lilv_node_as_string(gLong)); LV2_URID Long = URID_Map(lilv_node_as_string(gLong));
for (size_t p = 0, cnt = mControls.GetCount(); p < cnt; p++) for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
{ {
if (mControls[p].mSymbol.IsSameAs(symbol)) if (mControls[p].mSymbol.IsSameAs(symbol))
{ {

@ -17,7 +17,6 @@
#include <vector> #include <vector>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/slider.h> #include <wx/slider.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -62,6 +61,10 @@ public:
mHasLo = false; mHasLo = false;
mHasHi = false; mHasHi = false;
} }
LV2Port( const LV2Port & ) = default;
LV2Port& operator = ( const LV2Port & ) = default;
LV2Port( LV2Port && ) = default;
LV2Port& operator = ( LV2Port && ) = default;
uint32_t mIndex; uint32_t mIndex;
wxString mSymbol; wxString mSymbol;
@ -92,7 +95,6 @@ public:
wxArrayString mScaleLabels; wxArrayString mScaleLabels;
}; };
WX_DECLARE_OBJARRAY(LV2Port, LV2PortArray);
using LV2GroupMap = std::unordered_map<wxString, wxArrayInt>; using LV2GroupMap = std::unordered_map<wxString, wxArrayInt>;
WX_DEFINE_ARRAY_PTR(LilvInstance *, LV2SlaveArray); WX_DEFINE_ARRAY_PTR(LilvInstance *, LV2SlaveArray);
@ -265,7 +267,7 @@ private:
double mSampleRate; double mSampleRate;
wxLongToLongHashMap mControlsMap; wxLongToLongHashMap mControlsMap;
LV2PortArray mControls; std::vector<LV2Port> mControls;
wxArrayInt mAudioInputs; wxArrayInt mAudioInputs;
wxArrayInt mAudioOutputs; wxArrayInt mAudioOutputs;

@ -100,9 +100,6 @@ static const wxChar *KEY_Command = wxT("Command");
// //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(NyqControlArray);
BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler) BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
EVT_BUTTON(ID_Load, NyquistEffect::OnLoad) EVT_BUTTON(ID_Load, NyquistEffect::OnLoad)
EVT_BUTTON(ID_Save, NyquistEffect::OnSave) EVT_BUTTON(ID_Save, NyquistEffect::OnSave)
@ -267,7 +264,7 @@ bool NyquistEffect::IsInteractive()
return true; return true;
} }
return mControls.GetCount() != 0; return mControls.size() != 0;
} }
bool NyquistEffect::IsDefault() bool NyquistEffect::IsDefault()
@ -292,7 +289,7 @@ bool NyquistEffect::GetAutomationParameters(EffectAutomationParameters & parms)
return true; return true;
} }
for (size_t c = 0, cnt = mControls.GetCount(); c < cnt; c++) for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
{ {
NyqControl & ctrl = mControls[c]; NyqControl & ctrl = mControls[c];
double d = ctrl.val; double d = ctrl.val;
@ -340,7 +337,7 @@ bool NyquistEffect::SetAutomationParameters(EffectAutomationParameters & parms)
} }
// First pass verifies values // First pass verifies values
for (size_t c = 0, cnt = mControls.GetCount(); c < cnt; c++) for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
{ {
NyqControl & ctrl = mControls[c]; NyqControl & ctrl = mControls[c];
bool good = false; bool good = false;
@ -379,7 +376,7 @@ bool NyquistEffect::SetAutomationParameters(EffectAutomationParameters & parms)
} }
// Second pass sets the variables // Second pass sets the variables
for (size_t c = 0, cnt = mControls.GetCount(); c < cnt; c++) for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
{ {
NyqControl & ctrl = mControls[c]; NyqControl & ctrl = mControls[c];
@ -485,7 +482,7 @@ bool NyquistEffect::CheckWhetherSkipEffect()
{ {
// If we're a prompt and we have controls, then we've already processed // If we're a prompt and we have controls, then we've already processed
// the audio, so skip further processing. // the audio, so skip further processing.
return (mIsPrompt && mControls.GetCount() > 0); return (mIsPrompt && mControls.size() > 0);
} }
bool NyquistEffect::Process() bool NyquistEffect::Process()
@ -811,7 +808,7 @@ bool NyquistEffect::ShowInterface(wxWindow *parent, bool forceModal)
// We're done if the user clicked "Close", we are not the Nyquist Prompt, // We're done if the user clicked "Close", we are not the Nyquist Prompt,
// or the program currently loaded into the prompt doesn't have a UI. // or the program currently loaded into the prompt doesn't have a UI.
if (!res || !mIsPrompt || mControls.GetCount() == 0) if (!res || !mIsPrompt || mControls.size() == 0)
{ {
return res; return res;
} }
@ -1091,7 +1088,7 @@ bool NyquistEffect::ProcessOne()
cmd += wxT("(setf *tracenable* NIL)\n"); cmd += wxT("(setf *tracenable* NIL)\n");
} }
for (unsigned int j = 0; j < mControls.GetCount(); j++) { for (unsigned int j = 0; j < mControls.size(); j++) {
if (mControls[j].type == NYQ_CTRL_REAL || mControls[j].type == NYQ_CTRL_FLOAT_TEXT) { if (mControls[j].type == NYQ_CTRL_REAL || mControls[j].type == NYQ_CTRL_FLOAT_TEXT) {
// We use Internat::ToString() rather than "%f" here because we // We use Internat::ToString() rather than "%f" here because we
// always have to use the dot as decimal separator when giving // always have to use the dot as decimal separator when giving
@ -1775,7 +1772,7 @@ void NyquistEffect::Parse(const wxString &line)
if( mPresetNames.Index( ctrl.var ) == wxNOT_FOUND ) if( mPresetNames.Index( ctrl.var ) == wxNOT_FOUND )
{ {
mControls.Add(ctrl); mControls.push_back(ctrl);
} }
} }
@ -1798,7 +1795,7 @@ bool NyquistEffect::ParseProgram(wxInputStream & stream)
mCmd = wxT(""); mCmd = wxT("");
mIsSal = false; mIsSal = false;
mControls.Clear(); mControls.clear();
mCategories.Clear(); mCategories.Clear();
mIsSpectral = false; mIsSpectral = false;
mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the Audacity manual. mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the Audacity manual.
@ -2047,7 +2044,7 @@ bool NyquistEffect::TransferDataToPromptWindow()
bool NyquistEffect::TransferDataToEffectWindow() bool NyquistEffect::TransferDataToEffectWindow()
{ {
for (size_t i = 0, cnt = mControls.GetCount(); i < cnt; i++) for (size_t i = 0, cnt = mControls.size(); i < cnt; i++)
{ {
NyqControl & ctrl = mControls[i]; NyqControl & ctrl = mControls[i];
@ -2087,12 +2084,12 @@ bool NyquistEffect::TransferDataFromPromptWindow()
bool NyquistEffect::TransferDataFromEffectWindow() bool NyquistEffect::TransferDataFromEffectWindow()
{ {
if (mControls.GetCount() == 0) if (mControls.size() == 0)
{ {
return true; return true;
} }
for (unsigned int i = 0; i < mControls.GetCount(); i++) for (unsigned int i = 0; i < mControls.size(); i++)
{ {
NyqControl *ctrl = &mControls[i]; NyqControl *ctrl = &mControls[i];
@ -2200,7 +2197,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
{ {
S.StartMultiColumn(4); S.StartMultiColumn(4);
{ {
for (size_t i = 0; i < mControls.GetCount(); i++) for (size_t i = 0; i < mControls.size(); i++)
{ {
NyqControl & ctrl = mControls[i]; NyqControl & ctrl = mControls[i];

@ -46,6 +46,12 @@ enum NyqControlType
class NyqControl class NyqControl
{ {
public: public:
NyqControl() = default;
NyqControl( const NyqControl& ) = default;
NyqControl &operator = ( const NyqControl & ) = default;
NyqControl( NyqControl && ) = default;
NyqControl &operator = ( NyqControl && ) = default;
int type; int type;
wxString var; wxString var;
wxString name; wxString name;
@ -59,8 +65,6 @@ public:
int ticks; int ticks;
}; };
WX_DECLARE_USER_EXPORTED_OBJARRAY(NyqControl, NyqControlArray, AUDACITY_DLL_API);
class AUDACITY_DLL_API NyquistEffect final : public Effect class AUDACITY_DLL_API NyquistEffect final : public Effect
{ {
public: public:
@ -214,7 +218,7 @@ private:
wxString mDebugOutput; wxString mDebugOutput;
int mVersion; int mVersion;
NyqControlArray mControls; std::vector<NyqControl> mControls;
unsigned mCurNumChannels; unsigned mCurNumChannels;
WaveTrack *mCurTrack[2]; WaveTrack *mCurTrack[2];

@ -31,7 +31,6 @@
#include "../Audacity.h" #include "../Audacity.h"
#include "Export.h" #include "Export.h"
#include <wx/dynarray.h>
#include <wx/file.h> #include <wx/file.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/progdlg.h> #include <wx/progdlg.h>
@ -74,18 +73,13 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// ExportPlugin // ExportPlugin
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#include <wx/arrimpl.cpp>
WX_DEFINE_USER_EXPORTED_OBJARRAY(FormatInfoArray);
ExportPlugin::ExportPlugin() ExportPlugin::ExportPlugin()
{ {
mFormatInfos.Empty();
} }
ExportPlugin::~ExportPlugin() ExportPlugin::~ExportPlugin()
{ {
mFormatInfos.Clear();
} }
bool ExportPlugin::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(format)) bool ExportPlugin::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(format))
@ -103,13 +97,13 @@ bool ExportPlugin::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(f
int ExportPlugin::AddFormat() int ExportPlugin::AddFormat()
{ {
FormatInfo nf; FormatInfo nf;
mFormatInfos.Add(nf); mFormatInfos.push_back(nf);
return mFormatInfos.Count(); return mFormatInfos.size();
} }
int ExportPlugin::GetFormatCount() int ExportPlugin::GetFormatCount()
{ {
return mFormatInfos.Count(); return mFormatInfos.size();
} }
/** /**

@ -14,7 +14,6 @@
#include "../MemoryX.h" #include "../MemoryX.h"
#include <vector> #include <vector>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dynarray.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/simplebook.h> #include <wx/simplebook.h>
#include "../Tags.h" #include "../Tags.h"
@ -39,8 +38,13 @@ enum class ProgressResult : unsigned;
class AUDACITY_DLL_API FormatInfo class AUDACITY_DLL_API FormatInfo
{ {
public: public:
FormatInfo(){}; FormatInfo() {}
~FormatInfo(){}; FormatInfo( const FormatInfo & ) = default;
FormatInfo &operator = ( const FormatInfo & ) = default;
FormatInfo( FormatInfo && ) = default;
FormatInfo &operator = ( FormatInfo && ) = default;
~FormatInfo() {}
wxString mFormat; wxString mFormat;
wxString mDescription; wxString mDescription;
// wxString mExtension; // wxString mExtension;
@ -50,8 +54,6 @@ class AUDACITY_DLL_API FormatInfo
bool mCanMetaData; bool mCanMetaData;
}; };
WX_DECLARE_USER_EXPORTED_OBJARRAY(FormatInfo, FormatInfoArray, AUDACITY_DLL_API);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// ExportPlugin // ExportPlugin
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -141,7 +143,7 @@ protected:
const wxString &title, const wxString &message); const wxString &title, const wxString &message);
private: private:
FormatInfoArray mFormatInfos; std::vector<FormatInfo> mFormatInfos;
}; };
using ExportPluginArray = std::vector < movable_ptr< ExportPlugin > > ; using ExportPluginArray = std::vector < movable_ptr< ExportPlugin > > ;

@ -24,7 +24,6 @@
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/filedlg.h> #include <wx/filedlg.h>
#include <wx/filefn.h> #include <wx/filefn.h>
@ -53,8 +52,6 @@
/* define our dynamic array of export settings */ /* define our dynamic array of export settings */
#include <wx/arrimpl.cpp> // much hackery
WX_DEFINE_OBJARRAY( ExportKitArray )
enum { enum {
FormatID = 10001, FormatID = 10001,
@ -647,8 +644,8 @@ ProgressResult ExportMultiple::ExportMultipleByLabel(bool byName,
bool tagsPrompt = mProject->GetShowId3Dialog(); bool tagsPrompt = mProject->GetShowId3Dialog();
int numFiles = mNumLabels; int numFiles = mNumLabels;
int l = 0; // counter for files done int l = 0; // counter for files done
ExportKitArray exportSettings; // dynamic array for settings. std::vector<ExportKit> exportSettings; // dynamic array for settings.
exportSettings.Alloc(numFiles); // Allocate some guessed space to use. exportSettings.reserve(numFiles); // Allocate some guessed space to use.
// Account for exporting before first label // Account for exporting before first label
if( mFirst->GetValue() ) { if( mFirst->GetValue() ) {
@ -739,7 +736,7 @@ ProgressResult ExportMultiple::ExportMultipleByLabel(bool byName,
} }
/* add the settings to the array of settings to be used for export */ /* add the settings to the array of settings to be used for export */
exportSettings.Add(setting); exportSettings.push_back(setting);
l++; // next label, count up one l++; // next label, count up one
} }
@ -777,9 +774,9 @@ ProgressResult ExportMultiple::ExportMultipleByTrack(bool byName,
int l = 0; // track counter int l = 0; // track counter
auto ok = ProgressResult::Success; auto ok = ProgressResult::Success;
wxArrayString otherNames; wxArrayString otherNames;
ExportKitArray exportSettings; // dynamic array we will use to store the std::vector<ExportKit> exportSettings; // dynamic array we will use to store the
// settings needed to do the exports with in // settings needed to do the exports with in
exportSettings.Alloc(mNumWaveTracks); // Allocate some guessed space to use. exportSettings.reserve(mNumWaveTracks); // Allocate some guessed space to use.
ExportKit setting; // the current batch of settings ExportKit setting; // the current batch of settings
setting.destfile.SetPath(mDir->GetValue()); setting.destfile.SetPath(mDir->GetValue());
setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex)); setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex));
@ -881,7 +878,7 @@ ProgressResult ExportMultiple::ExportMultipleByTrack(bool byName,
return ProgressResult::Cancelled; return ProgressResult::Cancelled;
} }
/* add the settings to the array of settings to be used for export */ /* add the settings to the array of settings to be used for export */
exportSettings.Add(setting); exportSettings.push_back(setting);
l++; // next track, count up one l++; // next track, count up one
} }

@ -13,12 +13,12 @@
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/dynarray.h> // sadly we are using wx dynamic arrays
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/simplebook.h> #include <wx/simplebook.h>
#include "Export.h" #include "Export.h"
#include "../Tags.h" // we need to know about the Tags class for metadata #include "../Tags.h" // we need to know about the Tags class for metadata
#include "../wxFileNameWrapper.h"
class wxButton; class wxButton;
class wxCheckBox; class wxCheckBox;
@ -198,7 +198,7 @@ private:
{ {
public: public:
Tags filetags; /**< The set of metadata to use for the export */ Tags filetags; /**< The set of metadata to use for the export */
wxFileName destfile; /**< The file to export to */ wxFileNameWrapper destfile; /**< The file to export to */
double t0; /**< Start time for the export */ double t0; /**< Start time for the export */
double t1; /**< End time for the export */ double t1; /**< End time for the export */
unsigned channels; /**< Number of channels for ExportMultipleByTrack */ unsigned channels; /**< Number of channels for ExportMultipleByTrack */
@ -208,7 +208,6 @@ private:
* this isn't done anywhere else in Audacity, presumably for a reason?, so * this isn't done anywhere else in Audacity, presumably for a reason?, so
* I'm stuck with wxArrays, which are much harder, as well as non-standard. * I'm stuck with wxArrays, which are much harder, as well as non-standard.
*/ */
WX_DECLARE_OBJARRAY(ExportKit, ExportKitArray);
#endif #endif

@ -46,7 +46,6 @@ and ImportLOF.cpp.
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/sizer.h> //for wxBoxSizer #include <wx/sizer.h> //for wxBoxSizer
#include <wx/arrimpl.cpp>
#include <wx/listimpl.cpp> #include <wx/listimpl.cpp>
#include "../ShuttleGui.h" #include "../ShuttleGui.h"
#include "../Project.h" #include "../Project.h"

@ -17,7 +17,6 @@
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/window.h> #include <wx/window.h>
#include <wx/dynarray.h>
#include "PrefsPanel.h" #include "PrefsPanel.h"

@ -16,7 +16,6 @@
#include <wx/arrstr.h> #include <wx/arrstr.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/dynarray.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include "PrefsPanel.h" #include "PrefsPanel.h"

@ -76,7 +76,6 @@ ExpandingToolBar.
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/dragimag.h> #include <wx/dragimag.h>
#include <wx/arrimpl.cpp>
#include <wx/dialog.h> #include <wx/dialog.h>
#include "ExpandingToolBar.h" #include "ExpandingToolBar.h"
@ -93,13 +92,11 @@ enum {
kTimerID kTimerID
}; };
WX_DEFINE_OBJARRAY(wxArrayRect);
class ToolBarArrangement class ToolBarArrangement
{ {
public: public:
ExpandingToolBarArray childArray; ExpandingToolBarArray childArray;
wxArrayRect rectArray; std::vector<wxRect> rectArray;
wxArrayInt rowArray; wxArrayInt rowArray;
}; };
@ -576,7 +573,7 @@ void ExpandingToolBar::UpdateMoving()
int best_dist_sq = 99999; int best_dist_sq = 99999;
int i; int i;
for(i=0; i<(int)mDropTargets.GetCount(); i++) { for(i = 0; i < (int)mDropTargets.size(); i++) {
int x = (mDropTargets[i].x + (mDropTargets[i].width/2))-cursorPos.x; int x = (mDropTargets[i].x + (mDropTargets[i].width/2))-cursorPos.x;
int y = (mDropTargets[i].y + (mDropTargets[i].height/2))-cursorPos.y; int y = (mDropTargets[i].y + (mDropTargets[i].height/2))-cursorPos.y;
int dist_sq = (x*x) + (y*y); int dist_sq = (x*x) + (y*y);
@ -1193,7 +1190,7 @@ std::unique_ptr<ToolBarArrangement> ToolBarArea::SaveArrangement()
arrangement->rowArray = mRowArray; arrangement->rowArray = mRowArray;
for(i=0; i<(int)mChildArray.GetCount(); i++) for(i=0; i<(int)mChildArray.GetCount(); i++)
arrangement->rectArray.Add(mChildArray[i]->GetRect()); arrangement->rectArray.push_back(mChildArray[i]->GetRect());
return arrangement; return arrangement;
} }
@ -1215,9 +1212,9 @@ void ToolBarArea::RestoreArrangement(std::unique_ptr<ToolBarArrangement>&& arran
arrangement.reset(); arrangement.reset();
} }
wxArrayRect ToolBarArea::GetDropTargets() std::vector<wxRect> ToolBarArea::GetDropTargets()
{ {
mDropTargets.Clear(); mDropTargets.clear();
mDropTargetIndices.Clear(); mDropTargetIndices.Clear();
mDropTargetRows.Clear(); mDropTargetRows.Clear();
@ -1237,14 +1234,14 @@ wxArrayRect ToolBarArea::GetDropTargets()
row = childRow; row = childRow;
mDropTargetIndices.Add(i); mDropTargetIndices.Add(i);
mDropTargetRows.Add(row); mDropTargetRows.Add(row);
mDropTargets.Add(wxRect(childRect.x, childRect.y, mDropTargets.push_back(wxRect(childRect.x, childRect.y,
0, childRect.height)); 0, childRect.height));
} }
// Add a target after this child (always) // Add a target after this child (always)
mDropTargetIndices.Add(i+1); mDropTargetIndices.Add(i+1);
mDropTargetRows.Add(row); mDropTargetRows.Add(row);
mDropTargets.Add(wxRect(childRect.x+childRect.width, childRect.y, mDropTargets.push_back(wxRect(childRect.x+childRect.width, childRect.y,
0, childRect.height)); 0, childRect.height));
} }
@ -1255,7 +1252,7 @@ void ToolBarArea::MoveChild(ExpandingToolBar *toolBar, wxRect dropTarget)
{ {
int i, j; int i, j;
for(i=0; i<(int)mDropTargets.GetCount(); i++) { for(i = 0; i < (int)mDropTargets.size(); i++) {
if (dropTarget == mDropTargets[i]) { if (dropTarget == mDropTargets[i]) {
int newIndex = mDropTargetIndices[i]; int newIndex = mDropTargetIndices[i];
int newRow = mDropTargetRows[i]; int newRow = mDropTargetRows[i];

@ -15,7 +15,6 @@
#include <vector> #include <vector>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/dynarray.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/hashmap.h> #include <wx/hashmap.h>
#include <wx/timer.h> #include <wx/timer.h>
@ -42,7 +41,6 @@ class ToolBarArrangement;
using WindowHash = std::unordered_map<void*, int>; using WindowHash = std::unordered_map<void*, int>;
WX_DEFINE_ARRAY(ExpandingToolBar *, ExpandingToolBarArray); WX_DEFINE_ARRAY(ExpandingToolBar *, ExpandingToolBarArray);
WX_DECLARE_OBJARRAY(wxRect, wxArrayRect);
class ExpandingToolBarEvtHandler; class ExpandingToolBarEvtHandler;
@ -120,7 +118,7 @@ class ExpandingToolBar final : public wxPanelWrapper
ImageRollPanel *mTargetPanel; ImageRollPanel *mTargetPanel;
std::unique_ptr<wxDragImage> mDragImage; std::unique_ptr<wxDragImage> mDragImage;
wxWindow *mTopLevelParent; wxWindow *mTopLevelParent;
wxArrayRect mDropTargets; std::vector<wxRect> mDropTargets;
wxRect mDropTarget; wxRect mDropTarget;
static int msNoAutoExpandStack; static int msNoAutoExpandStack;
@ -229,7 +227,7 @@ class ToolBarArea final : public wxPanelWrapper
std::unique_ptr<ToolBarArrangement> SaveArrangement(); std::unique_ptr<ToolBarArrangement> SaveArrangement();
void RestoreArrangement(std::unique_ptr<ToolBarArrangement>&& arrangement); void RestoreArrangement(std::unique_ptr<ToolBarArrangement>&& arrangement);
wxArrayRect GetDropTargets(); std::vector<wxRect> GetDropTargets();
void MoveChild(ExpandingToolBar *child, wxRect dropTarget); void MoveChild(ExpandingToolBar *child, wxRect dropTarget);
void SetCapturedChild(ExpandingToolBar *child); void SetCapturedChild(ExpandingToolBar *child);
@ -252,7 +250,7 @@ class ToolBarArea final : public wxPanelWrapper
wxSize mMaxSize; wxSize mMaxSize;
wxSize mActualSize; wxSize mActualSize;
wxArrayRect mDropTargets; std::vector<wxRect> mDropTargets;
wxArrayInt mDropTargetIndices; wxArrayInt mDropTargetIndices;
wxArrayInt mDropTargetRows; wxArrayInt mDropTargetRows;

@ -15,7 +15,6 @@
#include <algorithm> #include <algorithm>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/string.h> #include <wx/string.h>

@ -15,7 +15,6 @@
#include <vector> #include <vector>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/string.h> #include <wx/string.h>

@ -98,14 +98,10 @@
#include "ImageRoll.h" #include "ImageRoll.h"
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/arrimpl.cpp>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
#include <wx/image.h> #include <wx/image.h>
WX_DEFINE_OBJARRAY(BitmapArray);
WX_DEFINE_OBJARRAY(ImageArray);
// static // static
ImageArray ImageRoll::SplitH(const wxImage &src, wxColour magicColor) ImageArray ImageRoll::SplitH(const wxImage &src, wxColour magicColor)
{ {
@ -149,7 +145,7 @@ ImageArray ImageRoll::SplitH(const wxImage &src, wxColour magicColor)
subImage = src.GetSubImage(subRect); subImage = src.GetSubImage(subRect);
else else
subImage = wxImage(subRect.width, subRect.height); subImage = wxImage(subRect.width, subRect.height);
result.Add(subImage); result.push_back(subImage);
} }
else if (!cur && prev) { else if (!cur && prev) {
start = i; start = i;
@ -204,7 +200,7 @@ ImageArray ImageRoll::SplitV(const wxImage &src, wxColour magicColor)
subImage = src.GetSubImage(subRect); subImage = src.GetSubImage(subRect);
else else
subImage = wxImage(subRect.width, subRect.height); subImage = wxImage(subRect.width, subRect.height);
result.Add(subImage); result.push_back(subImage);
} }
else if (!cur && prev) { else if (!cur && prev) {
start = i; start = i;
@ -233,13 +229,13 @@ void ImageRoll::Init(RollType type, const wxImage &src, wxColour magicColor)
mMaxSize.x = 9999; mMaxSize.x = 9999;
mMaxSize.y = src.GetHeight(); mMaxSize.y = src.GetHeight();
for(i=0; i<(int)images.GetCount(); i++) { for(i = 0; i < (int)images.size(); i++) {
if (images[i].Ok()) { if (images[i].Ok()) {
mPieces.Add(wxBitmap(images[i])); mPieces.push_back(wxBitmap(images[i]));
mMinSize.x += mPieces[i].GetWidth(); mMinSize.x += mPieces[i].GetWidth();
} }
else else
mPieces.Add(wxBitmap()); mPieces.push_back(wxBitmap());
} }
break; break;
@ -251,18 +247,18 @@ void ImageRoll::Init(RollType type, const wxImage &src, wxColour magicColor)
mMaxSize.x = src.GetWidth(); mMaxSize.x = src.GetWidth();
mMaxSize.y = 9999; mMaxSize.y = 9999;
for(i=0; i<(int)images.GetCount(); i++) { for(i = 0; i < (int)images.size(); i++) {
if (images[i].Ok()) { if (images[i].Ok()) {
mPieces.Add(wxBitmap(images[i])); mPieces.push_back(wxBitmap(images[i]));
mMinSize.y += mPieces[i].GetHeight(); mMinSize.y += mPieces[i].GetHeight();
} }
else else
mPieces.Add(wxBitmap()); mPieces.push_back(wxBitmap());
} }
break; break;
case FixedImage: case FixedImage:
mPieces.Add(wxBitmap(src)); mPieces.push_back(wxBitmap(src));
mMinSize.x = src.GetWidth(); mMinSize.x = src.GetWidth();
mMinSize.y = src.GetHeight(); mMinSize.y = src.GetHeight();
mMaxSize.x = src.GetWidth(); mMaxSize.x = src.GetWidth();
@ -317,7 +313,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
{ {
int width = rect.width; int width = rect.width;
int height = rect.height; int height = rect.height;
int num = (int)mPieces.GetCount(); int num = (int)mPieces.size();
int i, j; int i, j;
switch(mType) { switch(mType) {

@ -12,10 +12,10 @@
#ifndef __AUDACITY_IMAGE_ROLL__ #ifndef __AUDACITY_IMAGE_ROLL__
#define __AUDACITY_IMAGE_ROLL__ #define __AUDACITY_IMAGE_ROLL__
#include <vector>
#include <wx/dc.h> #include <wx/dc.h>
#include <wx/dcclient.h> #include <wx/dcclient.h>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/version.h> #include <wx/version.h>
#include "wxPanelWrapper.h" #include "wxPanelWrapper.h"
@ -23,8 +23,8 @@
#define wxRasterOperationMode int #define wxRasterOperationMode int
#endif #endif
WX_DECLARE_OBJARRAY(wxBitmap, BitmapArray); // wxImage copies cheaply with reference counting
WX_DECLARE_OBJARRAY(wxImage, ImageArray); using ImageArray = std::vector<wxImage>;
class ImageRoll class ImageRoll
{ {
@ -60,7 +60,8 @@ class ImageRoll
void Init(RollType type, const wxImage &src, wxColour magicColor); void Init(RollType type, const wxImage &src, wxColour magicColor);
RollType mType; RollType mType;
BitmapArray mPieces; // wxBitmap copies cheaply with reference counting
std::vector<wxBitmap> mPieces;
wxSize mMinSize; wxSize mMinSize;
wxSize mMaxSize; wxSize mMaxSize;
}; };

@ -23,7 +23,6 @@
#include "../commands/Keyboard.h" #include "../commands/Keyboard.h"
#include "KeyView.h" #include "KeyView.h"
#include <wx/arrimpl.cpp>
#include <wx/dc.h> #include <wx/dc.h>
#include "../Internat.h" #include "../Internat.h"
@ -34,8 +33,6 @@
#define KV_VSCROLL_WIDTH 16 /* figure this out automatically? */ #define KV_VSCROLL_WIDTH 16 /* figure this out automatically? */
// Define the KeyNode arrays // Define the KeyNode arrays
WX_DEFINE_OBJARRAY(KeyNodeArray);
WX_DEFINE_OBJARRAY(KeyNodeArrayPtr);
// Define the event table // Define the event table
BEGIN_EVENT_TABLE(KeyView, wxVListBox) BEGIN_EVENT_TABLE(KeyView, wxVListBox)
@ -106,7 +103,7 @@ wxString
KeyView::GetLabel(int index) const KeyView::GetLabel(int index) const
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return wxEmptyString; return wxEmptyString;
@ -122,14 +119,14 @@ wxString
KeyView::GetFullLabel(int index) const KeyView::GetFullLabel(int index) const
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return wxEmptyString; return wxEmptyString;
} }
// Cache the node and label // Cache the node and label
KeyNode & node = mNodes[index]; const KeyNode & node = mNodes[index];
wxString label = node.label; wxString label = node.label;
// Prepend the prefix if available // Prepend the prefix if available
@ -147,7 +144,7 @@ KeyView::GetFullLabel(int index) const
int int
KeyView::GetIndexByName(const wxString & name) const KeyView::GetIndexByName(const wxString & name) const
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
// Search the nodes for the key // Search the nodes for the key
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
@ -168,7 +165,7 @@ wxString
KeyView::GetName(int index) const KeyView::GetName(int index) const
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return wxEmptyString; return wxEmptyString;
@ -183,7 +180,7 @@ KeyView::GetName(int index) const
wxString wxString
KeyView::GetNameByKey(const wxString & key) const KeyView::GetNameByKey(const wxString & key) const
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
// Search the nodes for the key // Search the nodes for the key
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
@ -203,7 +200,7 @@ KeyView::GetNameByKey(const wxString & key) const
int int
KeyView::GetIndexByKey(const wxString & key) const KeyView::GetIndexByKey(const wxString & key) const
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
// Search the nodes for the key // Search the nodes for the key
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
@ -224,7 +221,7 @@ wxString
KeyView::GetKey(int index) const KeyView::GetKey(int index) const
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return wxEmptyString; return wxEmptyString;
@ -240,7 +237,7 @@ bool
KeyView::CanSetKey(int index) const KeyView::CanSetKey(int index) const
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return false; return false;
@ -257,7 +254,7 @@ bool
KeyView::SetKey(int index, const wxString & key) KeyView::SetKey(int index, const wxString & key)
{ {
// Make sure index is valid // Make sure index is valid
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
wxASSERT(false); wxASSERT(false);
return false; return false;
@ -399,7 +396,7 @@ KeyView::SetFilter(const wxString & filter)
void void
KeyView::ExpandAll() KeyView::ExpandAll()
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
// Set all parent nodes to open // Set all parent nodes to open
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
@ -421,7 +418,7 @@ KeyView::ExpandAll()
void void
KeyView::CollapseAll() KeyView::CollapseAll()
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
// Set all parent nodes to closed // Set all parent nodes to closed
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
@ -449,7 +446,7 @@ KeyView::RecalcExtents()
mKeyWidth = 0; mKeyWidth = 0;
// Examine all nodes // Examine all nodes
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
{ {
KeyNode & node = mNodes[i]; KeyNode & node = mNodes[i];
@ -539,7 +536,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
) )
{ {
// Start clean // Start clean
mNodes.Clear(); mNodes.clear();
// Same as in RecalcExtents() but do it inline // Same as in RecalcExtents() but do it inline
mLineHeight = 0; mLineHeight = 0;
@ -610,7 +607,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
node.isopen = true; node.isopen = true;
// Add it to the tree // Add it to the tree
mNodes.Add(node); mNodes.push_back(node);
incat = true; incat = true;
// Measure category // Measure category
@ -650,7 +647,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
node.isopen = true; node.isopen = true;
// Add it to the tree // Add it to the tree
mNodes.Add(node); mNodes.push_back(node);
inpfx = true; inpfx = true;
} }
} }
@ -684,7 +681,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
node.depth = depth; node.depth = depth;
// Add it to the tree // Add it to the tree
mNodes.Add(node); mNodes.push_back(node);
// Measure key // Measure key
GetTextExtent(node.key, &x, &y); GetTextExtent(node.key, &x, &y);
@ -744,9 +741,9 @@ KeyView::RefreshBindings(const wxArrayString & names,
void void
KeyView::RefreshLines(bool bSort) KeyView::RefreshLines(bool bSort)
{ {
int cnt = (int) mNodes.GetCount(); int cnt = (int) mNodes.size();
int linecnt = 0; int linecnt = 0;
mLines.Empty(); mLines.clear();
// Process a filter if one is set // Process a filter if one is set
if (!mFilter.IsEmpty()) if (!mFilter.IsEmpty())
@ -804,7 +801,7 @@ KeyView::RefreshLines(bool bSort)
// whether they match the filter or not. // whether they match the filter or not.
if (mViewType == ViewByTree) if (mViewType == ViewByTree)
{ {
KeyNodeArrayPtr queue; std::vector<KeyNode*> queue;
int depth = node.depth; int depth = node.depth;
// This node is a category or prefix node, so always mark them // This node is a category or prefix node, so always mark them
@ -827,7 +824,7 @@ KeyView::RefreshLines(bool bSort)
// Examine all previously added nodes to see if this nodes // Examine all previously added nodes to see if this nodes
// ancestors need to be added prior to adding this node. // ancestors need to be added prior to adding this node.
bool found = false; bool found = false;
for (int k = (int) mLines.GetCount() - 1; k >= 0; k--) for (int k = (int) mLines.size() - 1; k >= 0; k--)
{ {
// The node indexes match, so we've found the parent of the // The node indexes match, so we've found the parent of the
// child node. // child node.
@ -843,7 +840,7 @@ KeyView::RefreshLines(bool bSort)
// they will wind up in reverse order. // they will wind up in reverse order.
if (!found) if (!found)
{ {
queue.Add(&mNodes[j]); queue.push_back(&mNodes[j]);
} }
// Traverse up the tree // Traverse up the tree
@ -853,17 +850,17 @@ KeyView::RefreshLines(bool bSort)
// Add any queues nodes to list. This will all be // Add any queues nodes to list. This will all be
// parent nodes, so mark them as open. // parent nodes, so mark them as open.
for (int j = (int) queue.GetCount() - 1; j >= 0; j--) for (int j = (int) queue.size() - 1; j >= 0; j--)
{ {
queue[j]->isopen = true; queue[j]->isopen = true;
queue[j]->line = linecnt++; queue[j]->line = linecnt++;
mLines.Add(queue[j]); mLines.push_back(queue[j]);
} }
} }
// Finally add the child node // Finally add the child node
node.line = linecnt++; node.line = linecnt++;
mLines.Add(&node); mLines.push_back(&node);
} }
} }
else else
@ -887,7 +884,7 @@ KeyView::RefreshLines(bool bSort)
// Add the node // Add the node
node.line = linecnt++; node.line = linecnt++;
mLines.Add(&node); mLines.push_back(&node);
// If this node is not open, then skip all of it's decendants // If this node is not open, then skip all of it's decendants
if (!node.isopen) if (!node.isopen)
@ -920,7 +917,7 @@ KeyView::RefreshLines(bool bSort)
// Add child node to list // Add child node to list
node.line = linecnt++; node.line = linecnt++;
mLines.Add(&node); mLines.push_back(&node);
} }
} }
@ -940,21 +937,21 @@ KeyView::RefreshLines(bool bSort)
switch (mViewType) switch (mViewType)
{ {
case ViewByTree: case ViewByTree:
mLines.Sort(CmpKeyNodeByTree); std::sort(mLines.begin(), mLines.end(), CmpKeyNodeByTree);
break; break;
case ViewByName: case ViewByName:
mLines.Sort(CmpKeyNodeByName); std::sort(mLines.begin(), mLines.end(), CmpKeyNodeByName);
break; break;
case ViewByKey: case ViewByKey:
mLines.Sort(CmpKeyNodeByKey); std::sort(mLines.begin(), mLines.end(), CmpKeyNodeByKey);
break; break;
} }
} }
// Now, reassign the line numbers // Now, reassign the line numbers
for (int i = 0; i < (int) mLines.GetCount(); i++) for (int i = 0; i < (int) mLines.size(); i++)
{ {
mLines[i]->line = i; mLines[i]->line = i;
} }
@ -980,7 +977,7 @@ KeyView::RefreshLines(bool bSort)
#endif #endif
// Tell listbox the NEW count and refresh the entire view // Tell listbox the NEW count and refresh the entire view
SetItemCount(mLines.GetCount()); SetItemCount(mLines.size());
RefreshAll(); RefreshAll();
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
@ -1025,7 +1022,7 @@ KeyView::SelectNode(int index)
int int
KeyView::LineToIndex(int line) const KeyView::LineToIndex(int line) const
{ {
if (line < 0 || line >= (int) mLines.GetCount()) if (line < 0 || line >= (int) mLines.size())
{ {
return wxNOT_FOUND; return wxNOT_FOUND;
} }
@ -1039,7 +1036,7 @@ KeyView::LineToIndex(int line) const
int int
KeyView::IndexToLine(int index) const KeyView::IndexToLine(int index) const
{ {
if (index < 0 || index >= (int) mNodes.GetCount()) if (index < 0 || index >= (int) mNodes.size())
{ {
return wxNOT_FOUND; return wxNOT_FOUND;
} }
@ -1389,7 +1386,7 @@ KeyView::OnKeyDown(wxKeyEvent & event)
if (node->isopen) if (node->isopen)
{ {
// But only if there is one // But only if there is one
if (line < (int) mLines.GetCount() - 1) if (line < (int) mLines.size() - 1)
{ {
SelectNode(LineToIndex(line + 1)); SelectNode(LineToIndex(line + 1));
} }
@ -1423,7 +1420,7 @@ KeyView::OnKeyDown(wxKeyEvent & event)
// the keycode // the keycode
default: default:
{ {
int cnt = (int) mLines.GetCount(); int cnt = (int) mLines.size();
bool found = false; bool found = false;
// Search the entire list if none is currently selected // Search the entire list if none is currently selected
@ -1574,12 +1571,9 @@ KeyView::OnLeftDown(wxMouseEvent & event)
// We prefix all "command" nodes with "ffffffff" (highest hex value) // We prefix all "command" nodes with "ffffffff" (highest hex value)
// to allow the sort to reorder them as needed. // to allow the sort to reorder them as needed.
// //
int bool
KeyView::CmpKeyNodeByTree(KeyNode ***n1, KeyNode ***n2) KeyView::CmpKeyNodeByTree(KeyNode *t1, KeyNode *t2)
{ {
KeyNode *t1 = (**n1);
KeyNode *t2 = (**n2);
unsigned int k1UInt= 0xffffffff; unsigned int k1UInt= 0xffffffff;
unsigned int k2UInt= 0xffffffff; unsigned int k2UInt= 0xffffffff;
@ -1595,15 +1589,11 @@ KeyView::CmpKeyNodeByTree(KeyNode ***n1, KeyNode ***n2)
k2UInt = (unsigned int) t2->line; k2UInt = (unsigned int) t2->line;
if( k1UInt < k2UInt ) if( k1UInt < k2UInt )
return -1; return true;
if( k1UInt > k2UInt ) if( k1UInt > k2UInt )
return +1; return false;
if( t1->label < t2->label ) return ( t1->label < t2->label );
return -1;
if( t1->label > t2->label )
return 1;
return 0;
} }
// //
@ -1611,11 +1601,9 @@ KeyView::CmpKeyNodeByTree(KeyNode ***n1, KeyNode ***n2)
// //
// Nothing special here, just a standard ascending sort. // Nothing special here, just a standard ascending sort.
// //
int bool
KeyView::CmpKeyNodeByName(KeyNode ***n1, KeyNode ***n2) KeyView::CmpKeyNodeByName(KeyNode *t1, KeyNode *t2)
{ {
KeyNode *t1 = (**n1);
KeyNode *t2 = (**n2);
wxString k1 = t1->label; wxString k1 = t1->label;
wxString k2 = t2->label; wxString k2 = t2->label;
@ -1631,19 +1619,7 @@ KeyView::CmpKeyNodeByName(KeyNode ***n1, KeyNode ***n2)
k2 = t2->prefix + wxT(" - ") + k2; k2 = t2->prefix + wxT(" - ") + k2;
} }
// See wxWidgets documentation for explanation of comparison results. return (k1 < k2);
// These will produce an ascending order.
if (k1 < k2)
{
return -1;
}
if (k1 > k2)
{
return 1;
}
return 0;
} }
// //
@ -1659,11 +1635,9 @@ KeyView::CmpKeyNodeByName(KeyNode ***n1, KeyNode ***n2)
// //
// The assigned entries simply get sorted as normal. // The assigned entries simply get sorted as normal.
// //
int bool
KeyView::CmpKeyNodeByKey(KeyNode ***n1, KeyNode ***n2) KeyView::CmpKeyNodeByKey(KeyNode *t1, KeyNode *t2)
{ {
KeyNode *t1 = (**n1);
KeyNode *t2 = (**n2);
wxString k1 = t1->key; wxString k1 = t1->key;
wxString k2 = t2->key; wxString k2 = t2->key;
@ -1695,19 +1669,7 @@ KeyView::CmpKeyNodeByKey(KeyNode ***n1, KeyNode ***n2)
k1 += t1->label; k1 += t1->label;
k2 += t2->label; k2 += t2->label;
// See wxWidgets documentation for explanation of comparison results. return (k1 < k2);
// These will produce an ascending order.
if (k1 < k2)
{
return -1;
}
if (k1 > k2)
{
return 1;
}
return 0;
} }
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
@ -1719,7 +1681,7 @@ bool
KeyView::HasChildren(int line) KeyView::HasChildren(int line)
{ {
// Make sure line is valid // Make sure line is valid
if (line < 0 || line >= (int) mLines.GetCount()) if (line < 0 || line >= (int) mLines.size())
{ {
wxASSERT(false); wxASSERT(false);
return false; return false;
@ -1735,7 +1697,7 @@ bool
KeyView::IsExpanded(int line) KeyView::IsExpanded(int line)
{ {
// Make sure line is valid // Make sure line is valid
if (line < 0 || line >= (int) mLines.GetCount()) if (line < 0 || line >= (int) mLines.size())
{ {
wxASSERT(false); wxASSERT(false);
return false; return false;
@ -1751,7 +1713,7 @@ wxCoord
KeyView::GetLineHeight(int line) KeyView::GetLineHeight(int line)
{ {
// Make sure line is valid // Make sure line is valid
if (line < 0 || line >= (int) mLines.GetCount()) if (line < 0 || line >= (int) mLines.size())
{ {
wxASSERT(false); wxASSERT(false);
return 0; return 0;
@ -1769,7 +1731,7 @@ wxString
KeyView::GetValue(int line) KeyView::GetValue(int line)
{ {
// Make sure line is valid // Make sure line is valid
if (line < 0 || line >= (int) mLines.GetCount()) if (line < 0 || line >= (int) mLines.size())
{ {
wxASSERT(false); wxASSERT(false);
return wxEmptyString; return wxEmptyString;

@ -13,7 +13,6 @@
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/arrstr.h> #include <wx/arrstr.h>
#include <wx/dynarray.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/vlbox.h> #include <wx/vlbox.h>
@ -32,6 +31,10 @@ public:
isparent = false; isparent = false;
isopen = false; isopen = false;
} }
KeyNode( const KeyNode & ) = default;
KeyNode &operator = ( const KeyNode & ) = default;
KeyNode( KeyNode && ) = default;
KeyNode &operator = ( KeyNode && ) = default;
public: public:
wxString name; wxString name;
@ -49,8 +52,6 @@ public:
}; };
// Declare the KeyNode arrays // Declare the KeyNode arrays
WX_DECLARE_OBJARRAY(KeyNode, KeyNodeArray);
WX_DECLARE_OBJARRAY(KeyNode *, KeyNodeArrayPtr);
// Types of view currently supported // Types of view currently supported
enum ViewByType enum ViewByType
@ -131,9 +132,9 @@ private:
static wxString CommandTranslated; static wxString CommandTranslated;
static int CmpKeyNodeByTree(KeyNode ***n1, KeyNode ***n2); static bool CmpKeyNodeByTree(KeyNode *n1, KeyNode *n2);
static int CmpKeyNodeByName(KeyNode ***n1, KeyNode ***n2); static bool CmpKeyNodeByName(KeyNode *n1, KeyNode *n2);
static int CmpKeyNodeByKey(KeyNode ***n1, KeyNode ***n2); static bool CmpKeyNodeByKey(KeyNode *n1, KeyNode *n2);
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
friend class KeyViewAx; friend class KeyViewAx;
@ -146,8 +147,8 @@ private:
#endif #endif
private: private:
KeyNodeArray mNodes; std::vector<KeyNode> mNodes;
KeyNodeArrayPtr mLines; std::vector<KeyNode*> mLines;
ViewByType mViewType; ViewByType mViewType;
wxString mFilter; wxString mFilter;

@ -237,6 +237,10 @@ public:
zeropad = _zeropad; zeropad = _zeropad;
digits = 0; digits = 0;
} }
NumericField( const NumericField & ) = default;
NumericField &operator = ( const NumericField & ) = default;
NumericField( NumericField && ) = default;
NumericField &operator = ( NumericField && ) = default;
void CreateDigitFormatStr() void CreateDigitFormatStr()
{ {
if (range > 1) if (range > 1)
@ -284,10 +288,6 @@ public:
wxRect digitBox; wxRect digitBox;
}; };
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(NumericFieldArray);
WX_DEFINE_OBJARRAY(DigitInfoArray);
namespace { namespace {
const std::vector<BuiltinFormatString> &TimeConverterFormats() { const std::vector<BuiltinFormatString> &TimeConverterFormats() {
@ -652,8 +652,8 @@ NumericConverter::NumericConverter(Type type,
void NumericConverter::ParseFormatString( const wxString & format) void NumericConverter::ParseFormatString( const wxString & format)
{ {
mPrefix = wxT(""); mPrefix = wxT("");
mFields.Clear(); mFields.clear();
mDigits.Clear(); mDigits.clear();
mScalingFactor = 1.0; mScalingFactor = 1.0;
bool inFrac = false; bool inFrac = false;
@ -721,15 +721,15 @@ void NumericConverter::ParseFormatString( const wxString & format)
if (inFrac) { if (inFrac) {
int base = fracMult * range; int base = fracMult * range;
mFields.Add(NumericField(inFrac, base, range, zeropad)); mFields.push_back(NumericField(inFrac, base, range, zeropad));
fracMult *= range; fracMult *= range;
numFracFields++; numFracFields++;
} }
else { else {
unsigned int j; unsigned int j;
for(j=0; j<mFields.GetCount(); j++) for(j=0; j<mFields.size(); j++)
mFields[j].base *= range; mFields[j].base *= range;
mFields.Add(NumericField(inFrac, 1, range, zeropad)); mFields.push_back(NumericField(inFrac, 1, range, zeropad));
numWholeFields++; numWholeFields++;
} }
numStr = wxT(""); numStr = wxT("");
@ -750,9 +750,9 @@ void NumericConverter::ParseFormatString( const wxString & format)
return; return;
} }
if (handleNum && numFracFields > 1) if (handleNum && numFracFields > 1)
mFields[mFields.GetCount()-2].label = delimStr; mFields[mFields.size()-2].label = delimStr;
else else
mFields[mFields.GetCount()-1].label = delimStr; mFields[mFields.size()-1].label = delimStr;
} }
else { else {
if (numWholeFields == 0) if (numWholeFields == 0)
@ -768,7 +768,7 @@ void NumericConverter::ParseFormatString( const wxString & format)
} }
} }
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
mFields[i].CreateDigitFormatStr(); mFields[i].CreateDigitFormatStr();
} }
@ -782,11 +782,11 @@ void NumericConverter::ParseFormatString( const wxString & format)
mValueMask += wxT("."); mValueMask += wxT(".");
pos += mPrefix.Length(); pos += mPrefix.Length();
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
mFields[i].pos = pos; mFields[i].pos = pos;
for(j=0; j<mFields[i].digits; j++) { for(j=0; j<mFields[i].digits; j++) {
mDigits.Add(DigitInfo(i, j, pos, wxRect())); mDigits.push_back(DigitInfo(i, j, pos, wxRect()));
mValueTemplate += wxT("0"); mValueTemplate += wxT("0");
mValueMask += wxT("0"); mValueMask += wxT("0");
pos++; pos++;
@ -805,7 +805,7 @@ void NumericConverter::PrintDebugInfo()
wxPrintf("%s", (const char *)mPrefix.mb_str()); wxPrintf("%s", (const char *)mPrefix.mb_str());
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
if (mFields[i].frac) { if (mFields[i].frac) {
wxPrintf("(t * %d) %% %d '%s' ", wxPrintf("(t * %d) %% %d '%s' ",
mFields[i].base, mFields[i].base,
@ -849,7 +849,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
bool round = true; bool round = true;
// We round on the last field. If we have a fractional field we round using it. // We round on the last field. If we have a fractional field we round using it.
// Otherwise we round to nearest integer. // Otherwise we round to nearest integer.
for(unsigned int i=0; i<mFields.GetCount(); i++) { for(unsigned int i = 0; i < mFields.size(); i++) {
if (mFields[i].frac) if (mFields[i].frac)
round = false; round = false;
} }
@ -859,8 +859,8 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
t_int = sampleCount(theValue + (nearest ? 0.5f : 0.0f)); t_int = sampleCount(theValue + (nearest ? 0.5f : 0.0f));
else else
{ {
wxASSERT( mFields[mFields.GetCount()-1].frac ); wxASSERT( mFields.back().frac );
theValue += (nearest ? 0.5f : 0.0f) / mFields[mFields.GetCount()-1].base; theValue += (nearest ? 0.5f : 0.0f) / mFields.back().base;
t_int = sampleCount(theValue); t_int = sampleCount(theValue);
} }
double t_frac; double t_frac;
@ -904,7 +904,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
t_frac = frames / 30.; t_frac = frames / 30.;
} }
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
int value = -1; int value = -1;
if (mFields[i].frac) { if (mFields[i].frac) {
@ -946,13 +946,13 @@ void NumericConverter::ControlsToValue()
unsigned int i; unsigned int i;
double t = 0.0; double t = 0.0;
if (mFields.GetCount() > 0 && if (mFields.size() > 0 &&
mValueString.Mid(mFields[0].pos, 1) == wxChar('-')) { mValueString.Mid(mFields[0].pos, 1) == wxChar('-')) {
mValue = mInvalidValue; mValue = mInvalidValue;
return; return;
} }
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
long val; long val;
mFields[i].str = mValueString.Mid(mFields[i].pos, mFields[i].str = mValueString.Mid(mFields[i].pos,
mFields[i].digits); mFields[i].digits);
@ -1121,13 +1121,13 @@ wxString NumericConverter::GetString()
void NumericConverter::Increment() void NumericConverter::Increment()
{ {
mFocusedDigit = mDigits.GetCount() - 1; mFocusedDigit = mDigits.size() - 1;
Adjust(1, 1); Adjust(1, 1);
} }
void NumericConverter::Decrement() void NumericConverter::Decrement()
{ {
mFocusedDigit = mDigits.GetCount() - 1; mFocusedDigit = mDigits.size() - 1;
Adjust(1, -1); Adjust(1, -1);
} }
@ -1146,7 +1146,7 @@ void NumericConverter::Adjust(int steps, int dir)
while (steps != 0) while (steps != 0)
{ {
for (size_t i = 0; i < mFields.GetCount(); i++) for (size_t i = 0; i < mFields.size(); i++)
{ {
if ((mDigits[mFocusedDigit].pos >= mFields[i].pos) && if ((mDigits[mFocusedDigit].pos >= mFields[i].pos) &&
(mDigits[mFocusedDigit].pos < mFields[i].pos + mFields[i].digits)) (mDigits[mFocusedDigit].pos < mFields[i].pos + mFields[i].digits))
@ -1305,7 +1305,7 @@ void NumericTextCtrl::UpdateAutoFocus()
return; return;
mFocusedDigit = 0; mFocusedDigit = 0;
while (mFocusedDigit < ((int)mDigits.GetCount() - 1)) { while (mFocusedDigit < ((int)mDigits.size() - 1)) {
wxChar dgt = mValueString[mDigits[mFocusedDigit].pos]; wxChar dgt = mValueString[mDigits[mFocusedDigit].pos];
if (dgt != '0') { if (dgt != '0') {
break; break;
@ -1388,7 +1388,7 @@ bool NumericTextCtrl::Layout()
mBackgroundBitmap = std::make_unique<wxBitmap>(1, 1); mBackgroundBitmap = std::make_unique<wxBitmap>(1, 1);
memDC.SelectObject(*mBackgroundBitmap); memDC.SelectObject(*mBackgroundBitmap);
mDigits.Clear(); mDigits.clear();
mBorderLeft = 1; mBorderLeft = 1;
mBorderTop = 1; mBorderTop = 1;
@ -1428,10 +1428,10 @@ bool NumericTextCtrl::Layout()
x += strW; x += strW;
pos += mPrefix.Length(); pos += mPrefix.Length();
for(i=0; i<mFields.GetCount(); i++) { for(i = 0; i < mFields.size(); i++) {
mFields[i].fieldX = x; mFields[i].fieldX = x;
for(j=0; j<(unsigned int)mFields[i].digits; j++) { for(j=0; j<(unsigned int)mFields[i].digits; j++) {
mDigits.Add(DigitInfo(i, j, pos, wxRect(x, mBorderTop, mDigits.push_back(DigitInfo(i, j, pos, wxRect(x, mBorderTop,
mDigitBoxW, mDigitBoxH))); mDigitBoxW, mDigitBoxH)));
x += mDigitBoxW; x += mDigitBoxW;
pos++; pos++;
@ -1472,11 +1472,11 @@ bool NumericTextCtrl::Layout()
theTheme.SetBrushColour( Brush, clrTimeBack ); theTheme.SetBrushColour( Brush, clrTimeBack );
memDC.SetBrush(Brush); memDC.SetBrush(Brush);
//memDC.SetBrush(*wxLIGHT_GREY_BRUSH); //memDC.SetBrush(*wxLIGHT_GREY_BRUSH);
for(i=0; i<mDigits.GetCount(); i++) for(i = 0; i < mDigits.size(); i++)
memDC.DrawRectangle(mDigits[i].digitBox); memDC.DrawRectangle(mDigits[i].digitBox);
memDC.SetBrush( wxNullBrush ); memDC.SetBrush( wxNullBrush );
for(i=0; i<mFields.GetCount(); i++) for(i = 0; i < mFields.size(); i++)
memDC.DrawText(mFields[i].label, memDC.DrawText(mFields[i].label,
mFields[i].labelX, labelTop); mFields[i].labelX, labelTop);
@ -1535,7 +1535,7 @@ void NumericTextCtrl::OnPaint(wxPaintEvent & WXUNUSED(event))
dc.SetBrush( Brush ); dc.SetBrush( Brush );
int i; int i;
for(i=0; i<(int)mDigits.GetCount(); i++) { for(i = 0; i < (int)mDigits.size(); i++) {
wxRect box = mDigits[i].digitBox; wxRect box = mDigits[i].digitBox;
if (focused && mFocusedDigit == i) { if (focused && mFocusedDigit == i) {
dc.DrawRectangle(box); dc.DrawRectangle(box);
@ -1626,7 +1626,7 @@ void NumericTextCtrl::OnMouse(wxMouseEvent &event)
unsigned int i; unsigned int i;
mFocusedDigit = 0; mFocusedDigit = 0;
for(i=0; i<mDigits.GetCount(); i++) { for(i = 0; i < mDigits.size(); i++) {
int dist = abs(event.m_x - (mDigits[i].digitBox.x + int dist = abs(event.m_x - (mDigits[i].digitBox.x +
mDigits[i].digitBox.width/2)); mDigits[i].digitBox.width/2));
if (dist < bestDist) { if (dist < bestDist) {
@ -1719,7 +1719,7 @@ void NumericTextCtrl::OnKeyUp(wxKeyEvent &event)
void NumericTextCtrl::OnKeyDown(wxKeyEvent &event) void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
{ {
if (mDigits.GetCount() == 0) if (mDigits.size() == 0)
{ {
mFocusedDigit = 0; mFocusedDigit = 0;
return; return;
@ -1732,8 +1732,8 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
if (mFocusedDigit < 0) if (mFocusedDigit < 0)
mFocusedDigit = 0; mFocusedDigit = 0;
if (mFocusedDigit >= (int)mDigits.GetCount()) if (mFocusedDigit >= (int)mDigits.size())
mFocusedDigit = mDigits.GetCount()-1; mFocusedDigit = mDigits.size() - 1;
// Convert numeric keypad entries. // Convert numeric keypad entries.
if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9)) if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
@ -1751,7 +1751,7 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
ControlsToValue(); ControlsToValue();
Refresh();// Force an update of the control. [Bug 1497] Refresh();// Force an update of the control. [Bug 1497]
ValueToControls(); ValueToControls();
mFocusedDigit = (mFocusedDigit + 1) % (mDigits.GetCount()); mFocusedDigit = (mFocusedDigit + 1) % (mDigits.size());
Updated(); Updated();
} }
@ -1763,8 +1763,8 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
else if (!mReadOnly && keyCode == WXK_BACK) { else if (!mReadOnly && keyCode == WXK_BACK) {
// Moves left, replaces that char with '0', stays there... // Moves left, replaces that char with '0', stays there...
mFocusedDigit--; mFocusedDigit--;
mFocusedDigit += mDigits.GetCount(); mFocusedDigit += mDigits.size();
mFocusedDigit %= mDigits.GetCount(); mFocusedDigit %= mDigits.size();
wxString::reference theDigit = mValueString[mDigits[mFocusedDigit].pos]; wxString::reference theDigit = mValueString[mDigits[mFocusedDigit].pos];
if (theDigit != wxChar('-')) if (theDigit != wxChar('-'))
theDigit = '0'; theDigit = '0';
@ -1776,14 +1776,14 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
else if (keyCode == WXK_LEFT) { else if (keyCode == WXK_LEFT) {
mFocusedDigit--; mFocusedDigit--;
mFocusedDigit += mDigits.GetCount(); mFocusedDigit += mDigits.size();
mFocusedDigit %= mDigits.GetCount(); mFocusedDigit %= mDigits.size();
Refresh(); Refresh();
} }
else if (keyCode == WXK_RIGHT) { else if (keyCode == WXK_RIGHT) {
mFocusedDigit++; mFocusedDigit++;
mFocusedDigit %= mDigits.GetCount(); mFocusedDigit %= mDigits.size();
Refresh(); Refresh();
} }
@ -1793,7 +1793,7 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
} }
else if (keyCode == WXK_END) { else if (keyCode == WXK_END) {
mFocusedDigit = mDigits.GetCount() - 1; mFocusedDigit = mDigits.size() - 1;
Refresh(); Refresh();
} }
@ -1848,7 +1848,7 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
void NumericTextCtrl::SetFieldFocus(int digit) void NumericTextCtrl::SetFieldFocus(int digit)
{ {
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
if (mDigits.GetCount() == 0) if (mDigits.size() == 0)
{ {
mFocusedDigit = 0; mFocusedDigit = 0;
return; return;
@ -1959,7 +1959,7 @@ wxAccStatus NumericTextCtrlAx::GetChild(int childId, wxAccessible **child)
// Gets the number of children. // Gets the number of children.
wxAccStatus NumericTextCtrlAx::GetChildCount(int *childCount) wxAccStatus NumericTextCtrlAx::GetChildCount(int *childCount)
{ {
*childCount = mCtrl->mDigits.GetCount(); *childCount = mCtrl->mDigits.size();
return wxACC_OK; return wxACC_OK;
} }
@ -2051,7 +2051,7 @@ wxAccStatus NumericTextCtrlAx::GetLocation(wxRect & rect, int elementId)
wxAccStatus NumericTextCtrlAx::GetName(int childId, wxString *name) wxAccStatus NumericTextCtrlAx::GetName(int childId, wxString *name)
{ {
// Slightly messy trick to save us some prefixing. // Slightly messy trick to save us some prefixing.
NumericFieldArray & mFields = mCtrl->mFields; std::vector<NumericField> & mFields = mCtrl->mFields;
wxString value = mCtrl->GetString(); wxString value = mCtrl->GetString();
int field = mCtrl->GetFocusedField(); int field = mCtrl->GetFocusedField();
@ -2076,7 +2076,7 @@ wxAccStatus NumericTextCtrlAx::GetName(int childId, wxString *name)
// report the value of the field and the field's label. // report the value of the field and the field's label.
else if (mLastField != field) { else if (mLastField != field) {
wxString label = mFields[field - 1].label; wxString label = mFields[field - 1].label;
int cnt = mFields.GetCount(); int cnt = mFields.size();
wxString decimal = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER); wxString decimal = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
// If the NEW field is the last field, then check it to see if // If the NEW field is the last field, then check it to see if

@ -18,7 +18,6 @@
#include "../MemoryX.h" #include "../MemoryX.h"
#include <vector> #include <vector>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -45,10 +44,8 @@ DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_BANDWIDTHTEXTCTRL_UPDATED,
struct BuiltinFormatString; struct BuiltinFormatString;
class NumericField; class NumericField;
WX_DECLARE_OBJARRAY(NumericField, NumericFieldArray);
class DigitInfo; class DigitInfo;
WX_DECLARE_OBJARRAY(DigitInfo, DigitInfoArray);
class NumericConverter /* not final */ class NumericConverter /* not final */
{ {
@ -119,7 +116,7 @@ protected:
wxString mFormatString; wxString mFormatString;
NumericFieldArray mFields; std::vector<NumericField> mFields;
wxString mPrefix; wxString mPrefix;
wxString mValueTemplate; wxString mValueTemplate;
wxString mValueMask; wxString mValueMask;
@ -131,7 +128,7 @@ protected:
bool mNtscDrop; bool mNtscDrop;
int mFocusedDigit; int mFocusedDigit;
DigitInfoArray mDigits; std::vector<DigitInfo> mDigits;
const std::vector<BuiltinFormatString> &mBuiltinFormatStrings; const std::vector<BuiltinFormatString> &mBuiltinFormatStrings;
int mNBuiltins; int mNBuiltins;

@ -11,7 +11,6 @@
#define __AUDACITY_XML_XML_FILE_WRITER__ #define __AUDACITY_XML_XML_FILE_WRITER__
#include <wx/arrstr.h> #include <wx/arrstr.h>
#include <wx/dynarray.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#include "../FileException.h" #include "../FileException.h"