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

View File

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

View File

@ -17,7 +17,6 @@
#include "xml/XMLWriter.h"
#include <wx/debug.h>
#include <wx/dynarray.h>
#include <wx/ffile.h>
#include <wx/hashmap.h>
#include <wx/mstream.h>
@ -74,7 +73,6 @@ private:
using NameMap = std::unordered_map<wxString, short>;
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.
class AUDACITY_DLL_API AutoSaveFile final : public XMLWriter

View File

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

View File

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

View File

@ -20,9 +20,6 @@
#include "Project.h" // for GetActiveProject
#include "LabelTrack.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(SyllableArray);
BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl)
EVT_MOUSE_EVENTS(HighlightTextCtrl::OnMouseEvent)
@ -120,13 +117,13 @@ LyricsPanel::~LyricsPanel()
void LyricsPanel::Clear()
{
mSyllables.Clear();
mSyllables.clear();
mText = wxT("");
// Add two dummy syllables at the beginning
mSyllables.Add(Syllable());
mSyllables.push_back(Syllable());
mSyllables[0].t = -2.0;
mSyllables.Add(Syllable());
mSyllables.push_back(Syllable());
mSyllables[1].t = -1.0;
mHighlightTextCtrl->Clear();
@ -145,7 +142,7 @@ void LyricsPanel::AddLabels(const LabelTrack *pLT)
void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightText)
{
int i = mSyllables.GetCount();
int i = mSyllables.size();
{
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];
thisSyllable.t = t;
thisSyllable.text = syllable;
@ -190,12 +187,12 @@ void LyricsPanel::Add(double t, const wxString &syllable, wxString &highlightTex
void LyricsPanel::Finish(double finalT)
{
// Add 3 dummy syllables at the end
int i = mSyllables.GetCount();
mSyllables.Add(Syllable());
int i = mSyllables.size();
mSyllables.push_back(Syllable());
mSyllables[i].t = finalT + 1.0;
mSyllables.Add(Syllable());
mSyllables.push_back(Syllable());
mSyllables[i+1].t = finalT + 2.0;
mSyllables.Add(Syllable());
mSyllables.push_back(Syllable());
mSyllables[i+2].t = finalT + 3.0;
// Mark measurements as invalid
@ -210,7 +207,7 @@ int LyricsPanel::FindSyllable(long startChar)
int i1, i2;
i1 = 0;
i2 = mSyllables.GetCount();
i2 = mSyllables.size();
while (i2 > i1+1) {
int pmid = (i1+i2)/2;
if (mSyllables[pmid].char0 > startChar)
@ -221,8 +218,8 @@ int LyricsPanel::FindSyllable(long startChar)
if (i1 < 2)
i1 = 2;
if (i1 > (int)(mSyllables.GetCount()) - 3)
i1 = mSyllables.GetCount() - 3;
if (i1 > (int)(mSyllables.size()) - 3)
i1 = mSyllables.size() - 3;
return i1;
}
@ -267,9 +264,9 @@ void LyricsPanel::Measure(wxDC *dc) // only for drawn text
int x = 2*kIndent;
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.
(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.
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
// extra space.
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 deltaPrev = mSyllables[i].t - mSyllables[i-1].t;
@ -318,7 +315,7 @@ int LyricsPanel::FindSyllable(double t)
int i1, i2;
i1 = 0;
i2 = mSyllables.GetCount();
i2 = mSyllables.size();
while (i2 > i1+1) {
int pmid = (i1+i2)/2;
if (mSyllables[pmid].t > t)
@ -329,8 +326,8 @@ int LyricsPanel::FindSyllable(double t)
if (i1 < 2)
i1 = 2;
if (i1 > (int)(mSyllables.GetCount()) - 3)
i1 = mSyllables.GetCount() - 3;
if (i1 > (int)(mSyllables.size()) - 3)
i1 = mSyllables.size() - 3;
return i1;
}
@ -348,7 +345,7 @@ void LyricsPanel::GetKaraokePosition(double t,
*outX = 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;
int i0, i1, i2, i3;
@ -557,7 +554,7 @@ void LyricsPanel::HandlePaint_BouncingBall(wxDC &dc)
SetDrawnFont(&dc);
unsigned int i;
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))
continue;
if (mSyllables[i].x > x + ctr)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -82,12 +82,6 @@ can't be.
#include "ImageManipulation.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.
// 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 )
{
wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice!
mImages.Add( Image );
mImages.push_back( Image );
#ifdef __APPLE__
// 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.]
wxImage TempImage( Image );
TempImage.ConvertAlphaToMask();
mBitmaps.Add( wxBitmap( TempImage ) );
mBitmaps.push_back( wxBitmap( TempImage ) );
#else
mBitmaps.Add( wxBitmap( Image ) );
mBitmaps.push_back( wxBitmap( Image ) );
#endif
mBitmapNames.Add( Name );
mBitmapFlags.Add( mFlow.mFlags );
mFlow.mFlags &= ~resFlagSkip;
iIndex = mBitmaps.GetCount()-1;
iIndex = mBitmaps.size() - 1;
}
void ThemeBase::RegisterColour( int &iIndex, const wxColour &Clr, const wxString & Name )
{
wxASSERT( iIndex == -1 ); // Don't initialise same colour twice!
mColours.Add( Clr );
mColours.push_back( Clr );
mColourNames.Add( Name );
iIndex = mColours.GetCount()-1;
iIndex = mColours.size() - 1;
}
void FlowPacker::Init(int width)
@ -689,7 +683,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
#endif
// Save the bitmaps
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0;i < (int)mImages.size();i++)
{
wxImage &SrcImage = mImages[i];
mFlow.mFlags = mBitmapFlags[i];
@ -718,7 +712,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave )
mFlow.SetColourGroup();
const int iColSize = 10;
for(i=0;i<(int)mColours.GetCount();i++)
for(i = 0; i < (int)mColours.size(); i++)
{
mFlow.GetNextPosition( iColSize, iColSize );
wxColour c = mColours[i];
@ -839,7 +833,7 @@ void ThemeBase::WriteImageMap( )
File.Write( Temp );
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];
mFlow.mFlags = mBitmapFlags[i];
@ -857,7 +851,7 @@ void ThemeBase::WriteImageMap( )
// Now save the colours.
mFlow.SetColourGroup();
const int iColSize = 10;
for(i=0;i<(int)mColours.GetCount();i++)
for(i = 0; i < (int)mColours.size(); i++)
{
mFlow.GetNextPosition( iColSize, iColSize );
// No href in html. Uses title not alt.
@ -883,7 +877,7 @@ void ThemeBase::WriteImageDefs( )
if( !File.IsOpened() )
return;
teResourceFlags PrevFlags = (teResourceFlags)-1;
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0; i < (int)mImages.size(); i++)
{
wxImage &SrcImage = mImages[i];
// No href in html. Uses title not alt.
@ -1029,7 +1023,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
mFlow.Init(ImageCacheWidth);
mFlow.mBorderWidth = 1;
// Load the bitmaps
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0; i < (int)mImages.size(); i++)
{
wxImage &Image = mImages[i];
mFlow.mFlags = mBitmapFlags[i];
@ -1048,7 +1042,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
mFlow.SetColourGroup();
wxColour TempColour;
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.RectMid( x, y );
@ -1081,7 +1075,7 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound )
int i;
int n=0;
wxString FileName;
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0; i < (int)mImages.size(); i++)
{
if( (mBitmapFlags[i] & resFlagInternal)==0)
@ -1150,7 +1144,7 @@ void ThemeBase::SaveComponents()
int i;
int n=0;
wxString FileName;
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0; i < (int)mImages.size(); i++)
{
if( (mBitmapFlags[i] & resFlagInternal)==0)
{
@ -1176,7 +1170,7 @@ void ThemeBase::SaveComponents()
return;
}
for(i=0;i<(int)mImages.GetCount();i++)
for(i = 0; i < (int)mImages.size(); i++)
{
if( (mBitmapFlags[i] & resFlagInternal)==0)
{

View File

@ -16,11 +16,11 @@
#include "Audacity.h"
#include <vector>
#include <wx/wx.h>
#include <wx/bitmap.h>
#include <wx/colour.h>
#include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/font.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
{
public:
@ -150,12 +142,13 @@ public:
wxImage MakeImageWithAlpha( wxBitmap & Bmp );
protected:
ArrayOfImages mImages;
ArrayOfBitmaps mBitmaps;
// wxImage, wxBitmap copy cheaply using reference counting
std::vector<wxImage> mImages;
std::vector<wxBitmap> mBitmaps;
wxArrayString mBitmapNames;
wxArrayInt mBitmapFlags;
ArrayOfColours mColours;
std::vector<wxColour> mColours;
wxArrayString mColourNames;
FlowPacker mFlow;
};

View File

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

View File

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

View File

@ -65,19 +65,6 @@ struct TrackPanelDrawingContext;
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,
EVT_TRACK_PANEL_TIMER, wxCommandEvent);

View File

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

View File

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

View File

@ -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( 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.
enum kShelfType
{
@ -142,7 +139,7 @@ bool EffectBassTreble::RealtimeInitialize()
{
SetBlockSize(512);
mSlaves.Clear();
mSlaves.clear();
return true;
}
@ -153,14 +150,14 @@ bool EffectBassTreble::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), floa
InstanceInit(slave, sampleRate);
mSlaves.Add(slave);
mSlaves.push_back(slave);
return true;
}
bool EffectBassTreble::RealtimeFinalize()
{
mSlaves.Clear();
mSlaves.clear();
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,6 @@
#include <wx/button.h>
#include <wx/panel.h>
#include <wx/dialog.h>
#include <wx/dynarray.h>
#include <wx/intl.h>
#include <wx/listctrl.h>
#include <wx/stattext.h>
@ -57,15 +56,20 @@ class EQPoint
{
public:
EQPoint( const double f, const double d ) { Freq = f; dB = d; }
bool operator < (const EQPoint &p1) const
{
return Freq < p1.Freq;
}
double Freq;
double dB;
};
WX_DECLARE_OBJARRAY( EQPoint, EQPointArray);
//
// 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
// didn't realize this until after the fact and am too
// lazy to change it. (But, hollar if you want me to.)
@ -75,10 +79,17 @@ class EQCurve
public:
EQCurve( const wxString & name = wxEmptyString ) { Name = name; }
EQCurve( const wxChar * name ) { Name = name; }
bool operator < (const EQCurve &that) const
{
return Name.CmpNoCase(that.Name) < 0;
}
wxString Name;
EQPointArray points;
std::vector<EQPoint> points;
};
WX_DECLARE_OBJARRAY( EQCurve, EQCurveArray );
using EQCurveArray = std::vector<EQCurve>;
#ifdef EXPERIMENTAL_EQ_SSE_THREADED
class EffectEqualization48x;
@ -257,21 +268,6 @@ private:
wxSlider *mdBMaxSlider;
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
wxRadioButton *mMathProcessingType[5]; // default, sse, sse threaded, AVX, AVX threaded (note AVX is not implemented yet
wxBoxSizer *szrM;

View File

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

View File

@ -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
#define lfoskipsamples 20
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectPhaserStateArray);
//
// EffectPhaser
//
@ -165,7 +162,7 @@ bool EffectPhaser::RealtimeInitialize()
{
SetBlockSize(512);
mSlaves.Clear();
mSlaves.clear();
return true;
}
@ -176,14 +173,14 @@ bool EffectPhaser::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sa
InstanceInit(slave, sampleRate);
mSlaves.Add(slave);
mSlaves.push_back(slave);
return true;
}
bool EffectPhaser::RealtimeFinalize()
{
mSlaves.Clear();
mSlaves.clear();
return true;
}

View File

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

View File

@ -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
#define lfoskipsamples 30
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(EffectWahwahStateArray);
//
// EffectWahwah
//
@ -157,7 +154,7 @@ bool EffectWahwah::RealtimeInitialize()
{
SetBlockSize(512);
mSlaves.Clear();
mSlaves.clear();
return true;
}
@ -168,14 +165,14 @@ bool EffectWahwah::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sa
InstanceInit(slave, sampleRate);
mSlaves.Add(slave);
mSlaves.push_back(slave);
return true;
}
bool EffectWahwah::RealtimeFinalize()
{
mSlaves.Clear();
mSlaves.clear();
return true;
}

View File

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

View File

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

View File

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

View File

@ -100,9 +100,6 @@ static const wxChar *KEY_Command = wxT("Command");
//
///////////////////////////////////////////////////////////////////////////////
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(NyqControlArray);
BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
EVT_BUTTON(ID_Load, NyquistEffect::OnLoad)
EVT_BUTTON(ID_Save, NyquistEffect::OnSave)
@ -267,7 +264,7 @@ bool NyquistEffect::IsInteractive()
return true;
}
return mControls.GetCount() != 0;
return mControls.size() != 0;
}
bool NyquistEffect::IsDefault()
@ -292,7 +289,7 @@ bool NyquistEffect::GetAutomationParameters(EffectAutomationParameters & parms)
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];
double d = ctrl.val;
@ -340,7 +337,7 @@ bool NyquistEffect::SetAutomationParameters(EffectAutomationParameters & parms)
}
// 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];
bool good = false;
@ -379,7 +376,7 @@ bool NyquistEffect::SetAutomationParameters(EffectAutomationParameters & parms)
}
// 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];
@ -485,7 +482,7 @@ bool NyquistEffect::CheckWhetherSkipEffect()
{
// If we're a prompt and we have controls, then we've already processed
// the audio, so skip further processing.
return (mIsPrompt && mControls.GetCount() > 0);
return (mIsPrompt && mControls.size() > 0);
}
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,
// 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;
}
@ -1091,7 +1088,7 @@ bool NyquistEffect::ProcessOne()
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) {
// We use Internat::ToString() rather than "%f" here because we
// 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 )
{
mControls.Add(ctrl);
mControls.push_back(ctrl);
}
}
@ -1798,7 +1795,7 @@ bool NyquistEffect::ParseProgram(wxInputStream & stream)
mCmd = wxT("");
mIsSal = false;
mControls.Clear();
mControls.clear();
mCategories.Clear();
mIsSpectral = false;
mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the Audacity manual.
@ -2047,7 +2044,7 @@ bool NyquistEffect::TransferDataToPromptWindow()
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];
@ -2087,12 +2084,12 @@ bool NyquistEffect::TransferDataFromPromptWindow()
bool NyquistEffect::TransferDataFromEffectWindow()
{
if (mControls.GetCount() == 0)
if (mControls.size() == 0)
{
return true;
}
for (unsigned int i = 0; i < mControls.GetCount(); i++)
for (unsigned int i = 0; i < mControls.size(); i++)
{
NyqControl *ctrl = &mControls[i];
@ -2200,7 +2197,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
{
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];

View File

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

View File

@ -31,7 +31,6 @@
#include "../Audacity.h"
#include "Export.h"
#include <wx/dynarray.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/progdlg.h>
@ -74,18 +73,13 @@
//----------------------------------------------------------------------------
// ExportPlugin
//----------------------------------------------------------------------------
#include <wx/arrimpl.cpp>
WX_DEFINE_USER_EXPORTED_OBJARRAY(FormatInfoArray);
ExportPlugin::ExportPlugin()
{
mFormatInfos.Empty();
}
ExportPlugin::~ExportPlugin()
{
mFormatInfos.Clear();
}
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()
{
FormatInfo nf;
mFormatInfos.Add(nf);
return mFormatInfos.Count();
mFormatInfos.push_back(nf);
return mFormatInfos.size();
}
int ExportPlugin::GetFormatCount()
{
return mFormatInfos.Count();
return mFormatInfos.size();
}
/**

View File

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

View File

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

View File

@ -13,12 +13,12 @@
#include <wx/dialog.h>
#include <wx/string.h>
#include <wx/dynarray.h> // sadly we are using wx dynamic arrays
#include <wx/listctrl.h>
#include <wx/simplebook.h>
#include "Export.h"
#include "../Tags.h" // we need to know about the Tags class for metadata
#include "../wxFileNameWrapper.h"
class wxButton;
class wxCheckBox;
@ -198,7 +198,7 @@ private:
{
public:
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 t1; /**< End time for the export */
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
* I'm stuck with wxArrays, which are much harder, as well as non-standard.
*/
WX_DECLARE_OBJARRAY(ExportKit, ExportKitArray);
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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