mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-11 17:41:15 +02:00
Remove wxArrays of pointers
This commit is contained in:
parent
8be1e8fdad
commit
3b32d39b54
129
src/Menus.cpp
129
src/Menus.cpp
@ -168,22 +168,21 @@ enum {
|
|||||||
//
|
//
|
||||||
// Effects menu arrays
|
// Effects menu arrays
|
||||||
//
|
//
|
||||||
WX_DEFINE_ARRAY_PTR(const PluginDescriptor *, EffectPlugs);
|
static bool SortEffectsByName(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||||
static int SortEffectsByName(const PluginDescriptor **a, const PluginDescriptor **b)
|
|
||||||
{
|
{
|
||||||
wxString akey = (*a)->GetTranslatedName();
|
wxString akey = a->GetTranslatedName();
|
||||||
wxString bkey = (*b)->GetTranslatedName();
|
wxString bkey = b->GetTranslatedName();
|
||||||
|
|
||||||
akey += (*a)->GetPath();
|
akey += a->GetPath();
|
||||||
bkey += (*b)->GetPath();
|
bkey += b->GetPath();
|
||||||
|
|
||||||
return akey.CmpNoCase(bkey);
|
return akey.CmpNoCase(bkey) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescriptor **b)
|
static bool SortEffectsByPublisher(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||||
{
|
{
|
||||||
wxString akey = (*a)->GetTranslatedVendor();
|
wxString akey = a->GetTranslatedVendor();
|
||||||
wxString bkey = (*b)->GetTranslatedVendor();
|
wxString bkey = b->GetTranslatedVendor();
|
||||||
|
|
||||||
if (akey.IsEmpty())
|
if (akey.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -194,42 +193,42 @@ static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescri
|
|||||||
bkey = _("Uncategorized");
|
bkey = _("Uncategorized");
|
||||||
}
|
}
|
||||||
|
|
||||||
akey += (*a)->GetTranslatedName();
|
akey += a->GetTranslatedName();
|
||||||
bkey += (*b)->GetTranslatedName();
|
bkey += b->GetTranslatedName();
|
||||||
|
|
||||||
akey += (*a)->GetPath();
|
akey += a->GetPath();
|
||||||
bkey += (*b)->GetPath();
|
bkey += b->GetPath();
|
||||||
|
|
||||||
return akey.CmpNoCase(bkey);
|
return akey.CmpNoCase(bkey) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SortEffectsByPublisherAndName(const PluginDescriptor **a, const PluginDescriptor **b)
|
static bool SortEffectsByPublisherAndName(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||||
{
|
{
|
||||||
wxString akey = (*a)->GetTranslatedVendor();
|
wxString akey = a->GetTranslatedVendor();
|
||||||
wxString bkey = (*b)->GetTranslatedVendor();
|
wxString bkey = b->GetTranslatedVendor();
|
||||||
|
|
||||||
if ((*a)->IsEffectDefault())
|
if (a->IsEffectDefault())
|
||||||
{
|
{
|
||||||
akey = wxEmptyString;
|
akey = wxEmptyString;
|
||||||
}
|
}
|
||||||
if ((*b)->IsEffectDefault())
|
if (b->IsEffectDefault())
|
||||||
{
|
{
|
||||||
bkey = wxEmptyString;
|
bkey = wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
akey += (*a)->GetTranslatedName();
|
akey += a->GetTranslatedName();
|
||||||
bkey += (*b)->GetTranslatedName();
|
bkey += b->GetTranslatedName();
|
||||||
|
|
||||||
akey += (*a)->GetPath();
|
akey += a->GetPath();
|
||||||
bkey += (*b)->GetPath();
|
bkey += b->GetPath();
|
||||||
|
|
||||||
return akey.CmpNoCase(bkey);
|
return akey.CmpNoCase(bkey) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDescriptor **b)
|
static bool SortEffectsByTypeAndName(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||||
{
|
{
|
||||||
wxString akey = (*a)->GetTranslatedEffectFamily();
|
wxString akey = a->GetTranslatedEffectFamily();
|
||||||
wxString bkey = (*b)->GetTranslatedEffectFamily();
|
wxString bkey = b->GetTranslatedEffectFamily();
|
||||||
|
|
||||||
if (akey.IsEmpty())
|
if (akey.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -240,28 +239,28 @@ static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDesc
|
|||||||
bkey = _("Uncategorized");
|
bkey = _("Uncategorized");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*a)->IsEffectDefault())
|
if (a->IsEffectDefault())
|
||||||
{
|
{
|
||||||
akey = wxEmptyString;
|
akey = wxEmptyString;
|
||||||
}
|
}
|
||||||
if ((*b)->IsEffectDefault())
|
if (b->IsEffectDefault())
|
||||||
{
|
{
|
||||||
bkey = wxEmptyString;
|
bkey = wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
akey += (*a)->GetTranslatedName();
|
akey += a->GetTranslatedName();
|
||||||
bkey += (*b)->GetTranslatedName();
|
bkey += b->GetTranslatedName();
|
||||||
|
|
||||||
akey += (*a)->GetPath();
|
akey += a->GetPath();
|
||||||
bkey += (*b)->GetPath();
|
bkey += b->GetPath();
|
||||||
|
|
||||||
return akey.CmpNoCase(bkey);
|
return akey.CmpNoCase(bkey) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SortEffectsByType(const PluginDescriptor **a, const PluginDescriptor **b)
|
static bool SortEffectsByType(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||||
{
|
{
|
||||||
wxString akey = (*a)->GetTranslatedEffectFamily();
|
wxString akey = a->GetTranslatedEffectFamily();
|
||||||
wxString bkey = (*b)->GetTranslatedEffectFamily();
|
wxString bkey = b->GetTranslatedEffectFamily();
|
||||||
|
|
||||||
if (akey.IsEmpty())
|
if (akey.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -272,13 +271,13 @@ static int SortEffectsByType(const PluginDescriptor **a, const PluginDescriptor
|
|||||||
bkey = _("Uncategorized");
|
bkey = _("Uncategorized");
|
||||||
}
|
}
|
||||||
|
|
||||||
akey += (*a)->GetTranslatedName();
|
akey += a->GetTranslatedName();
|
||||||
bkey += (*b)->GetTranslatedName();
|
bkey += b->GetTranslatedName();
|
||||||
|
|
||||||
akey += (*a)->GetPath();
|
akey += a->GetPath();
|
||||||
bkey += (*b)->GetPath();
|
bkey += b->GetPath();
|
||||||
|
|
||||||
return akey.CmpNoCase(bkey);
|
return akey.CmpNoCase(bkey) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateMenusAndCommands builds the menus, and also rebuilds them after
|
/// CreateMenusAndCommands builds the menus, and also rebuilds them after
|
||||||
@ -1633,8 +1632,8 @@ void AudacityProject::PopulateEffectsMenu(CommandManager* c,
|
|||||||
{
|
{
|
||||||
PluginManager & pm = PluginManager::Get();
|
PluginManager & pm = PluginManager::Get();
|
||||||
|
|
||||||
EffectPlugs defplugs;
|
std::vector<const PluginDescriptor*> defplugs;
|
||||||
EffectPlugs optplugs;
|
std::vector<const PluginDescriptor*> optplugs;
|
||||||
|
|
||||||
const PluginDescriptor *plug = pm.GetFirstPluginForEffectType(type);
|
const PluginDescriptor *plug = pm.GetFirstPluginForEffectType(type);
|
||||||
while (plug)
|
while (plug)
|
||||||
@ -1649,11 +1648,11 @@ void AudacityProject::PopulateEffectsMenu(CommandManager* c,
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defplugs.Add(plug);
|
defplugs.push_back(plug);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
optplugs.Add(plug);
|
optplugs.push_back(plug);
|
||||||
}
|
}
|
||||||
plug = pm.GetNextPluginForEffectType(type);
|
plug = pm.GetNextPluginForEffectType(type);
|
||||||
}
|
}
|
||||||
@ -1662,38 +1661,38 @@ void AudacityProject::PopulateEffectsMenu(CommandManager* c,
|
|||||||
|
|
||||||
if (groupby == wxT("sortby:name"))
|
if (groupby == wxT("sortby:name"))
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByName);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByName);
|
||||||
optplugs.Sort(SortEffectsByName);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByName);
|
||||||
}
|
}
|
||||||
else if (groupby == wxT("sortby:publisher:name"))
|
else if (groupby == wxT("sortby:publisher:name"))
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByName);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByName);
|
||||||
optplugs.Sort(SortEffectsByPublisherAndName);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByPublisherAndName);
|
||||||
}
|
}
|
||||||
else if (groupby == wxT("sortby:type:name"))
|
else if (groupby == wxT("sortby:type:name"))
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByName);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByName);
|
||||||
optplugs.Sort(SortEffectsByTypeAndName);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByTypeAndName);
|
||||||
}
|
}
|
||||||
else if (groupby == wxT("groupby:publisher"))
|
else if (groupby == wxT("groupby:publisher"))
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByPublisher);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByPublisher);
|
||||||
optplugs.Sort(SortEffectsByPublisher);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByPublisher);
|
||||||
}
|
}
|
||||||
else if (groupby == wxT("groupby:type"))
|
else if (groupby == wxT("groupby:type"))
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByType);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByType);
|
||||||
optplugs.Sort(SortEffectsByType);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByType);
|
||||||
}
|
}
|
||||||
else // name
|
else // name
|
||||||
{
|
{
|
||||||
defplugs.Sort(SortEffectsByName);
|
std::sort(defplugs.begin(), defplugs.end(), SortEffectsByName);
|
||||||
optplugs.Sort(SortEffectsByName);
|
std::sort(optplugs.begin(), optplugs.end(), SortEffectsByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddEffectMenuItems(c, defplugs, batchflags, realflags, true);
|
AddEffectMenuItems(c, defplugs, batchflags, realflags, true);
|
||||||
|
|
||||||
if (defplugs.GetCount() && optplugs.GetCount())
|
if (defplugs.size() && optplugs.size())
|
||||||
{
|
{
|
||||||
c->AddSeparator();
|
c->AddSeparator();
|
||||||
}
|
}
|
||||||
@ -1704,12 +1703,12 @@ void AudacityProject::PopulateEffectsMenu(CommandManager* c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::AddEffectMenuItems(CommandManager *c,
|
void AudacityProject::AddEffectMenuItems(CommandManager *c,
|
||||||
EffectPlugs & plugs,
|
std::vector<const PluginDescriptor*> & plugs,
|
||||||
CommandFlag batchflags,
|
CommandFlag batchflags,
|
||||||
CommandFlag realflags,
|
CommandFlag realflags,
|
||||||
bool isDefault)
|
bool isDefault)
|
||||||
{
|
{
|
||||||
size_t pluginCnt = plugs.GetCount();
|
size_t pluginCnt = plugs.size();
|
||||||
|
|
||||||
wxString groupBy = gPrefs->Read(wxT("/Effects/GroupBy"), wxT("name"));
|
wxString groupBy = gPrefs->Read(wxT("/Effects/GroupBy"), wxT("name"));
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ void CreateMenusAndCommands();
|
|||||||
|
|
||||||
void PopulateEffectsMenu(CommandManager *c, EffectType type,
|
void PopulateEffectsMenu(CommandManager *c, EffectType type,
|
||||||
CommandFlag batchflags, CommandFlag realflags);
|
CommandFlag batchflags, CommandFlag realflags);
|
||||||
void AddEffectMenuItems(CommandManager *c, EffectPlugs & plugs,
|
void AddEffectMenuItems(CommandManager *c,
|
||||||
|
std::vector<const PluginDescriptor*> & plugs,
|
||||||
CommandFlag batchflags, CommandFlag realflags, bool isDefault);
|
CommandFlag batchflags, CommandFlag realflags, bool isDefault);
|
||||||
void AddEffectMenuItemGroup(CommandManager *c, const wxArrayString & names,
|
void AddEffectMenuItemGroup(CommandManager *c, const wxArrayString & names,
|
||||||
const PluginIDList & plugs,
|
const PluginIDList & plugs,
|
||||||
|
@ -974,7 +974,7 @@ void MixerBoard::UpdateTrackClusters()
|
|||||||
this->CreateMuteSoloImages();
|
this->CreateMuteSoloImages();
|
||||||
|
|
||||||
const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
|
const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
|
||||||
size_t nClusterCount = mMixerTrackClusters.GetCount();
|
size_t nClusterCount = mMixerTrackClusters.size();
|
||||||
unsigned int nClusterIndex = 0;
|
unsigned int nClusterIndex = 0;
|
||||||
TrackListIterator iterTracks(mTracks);
|
TrackListIterator iterTracks(mTracks);
|
||||||
MixerTrackCluster* pMixerTrackCluster = NULL;
|
MixerTrackCluster* pMixerTrackCluster = NULL;
|
||||||
@ -1010,7 +1010,7 @@ void MixerBoard::UpdateTrackClusters()
|
|||||||
spTrack,
|
spTrack,
|
||||||
clusterPos, clusterSize);
|
clusterPos, clusterSize);
|
||||||
if (pMixerTrackCluster)
|
if (pMixerTrackCluster)
|
||||||
mMixerTrackClusters.Add(pMixerTrackCluster);
|
mMixerTrackClusters.push_back(pMixerTrackCluster);
|
||||||
}
|
}
|
||||||
nClusterIndex++;
|
nClusterIndex++;
|
||||||
}
|
}
|
||||||
@ -1038,7 +1038,7 @@ int MixerBoard::GetTrackClustersWidth()
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
kInset + // extra margin at left for first one
|
kInset + // extra margin at left for first one
|
||||||
(mMixerTrackClusters.GetCount() * // number of tracks times
|
(mMixerTrackClusters.size() * // number of tracks times
|
||||||
(kInset + kMixerTrackClusterWidth)) + // left margin and width for each
|
(kInset + kMixerTrackClusterWidth)) + // left margin and width for each
|
||||||
kDoubleInset; // plus final right margin
|
kDoubleInset; // plus final right margin
|
||||||
}
|
}
|
||||||
@ -1066,7 +1066,7 @@ void MixerBoard::MoveTrackCluster(const PlayableTrack* pTrack,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Move it down (right).
|
{ // Move it down (right).
|
||||||
if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.GetCount())
|
if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.size())
|
||||||
return; // It's already last.
|
return; // It's already last.
|
||||||
|
|
||||||
pos = pMixerTrackCluster->GetPosition();
|
pos = pMixerTrackCluster->GetPosition();
|
||||||
@ -1093,13 +1093,13 @@ void MixerBoard::RemoveTrackCluster(const PlayableTrack* pTrack)
|
|||||||
void MixerBoard::RemoveTrackCluster(size_t nIndex)
|
void MixerBoard::RemoveTrackCluster(size_t nIndex)
|
||||||
{
|
{
|
||||||
auto pMixerTrackCluster = mMixerTrackClusters[nIndex];
|
auto pMixerTrackCluster = mMixerTrackClusters[nIndex];
|
||||||
mMixerTrackClusters.RemoveAt(nIndex);
|
mMixerTrackClusters.erase(mMixerTrackClusters.begin() + nIndex);
|
||||||
pMixerTrackCluster->Destroy(); // DELETE is unsafe on wxWindow.
|
pMixerTrackCluster->Destroy(); // DELETE is unsafe on wxWindow.
|
||||||
|
|
||||||
// Close the gap, if any.
|
// Close the gap, if any.
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
int targetX;
|
int targetX;
|
||||||
for (unsigned int i = nIndex; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = nIndex; i < mMixerTrackClusters.size(); i++)
|
||||||
{
|
{
|
||||||
pos = mMixerTrackClusters[i]->GetPosition();
|
pos = mMixerTrackClusters[i]->GetPosition();
|
||||||
targetX =
|
targetX =
|
||||||
@ -1180,13 +1180,13 @@ void MixerBoard::RefreshTrackCluster(const PlayableTrack* pTrack, bool bEraseBac
|
|||||||
|
|
||||||
void MixerBoard::RefreshTrackClusters(bool bEraseBackground /*= true*/)
|
void MixerBoard::RefreshTrackClusters(bool bEraseBackground /*= true*/)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->Refresh(bEraseBackground);
|
mMixerTrackClusters[i]->Refresh(bEraseBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixerBoard::ResizeTrackClusters()
|
void MixerBoard::ResizeTrackClusters()
|
||||||
{
|
{
|
||||||
for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.GetCount(); nClusterIndex++)
|
for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
|
||||||
mMixerTrackClusters[nClusterIndex]->HandleResize();
|
mMixerTrackClusters[nClusterIndex]->HandleResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,7 +1197,7 @@ void MixerBoard::ResetMeters(const bool bResetClipping)
|
|||||||
if (!this->IsShown())
|
if (!this->IsShown())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->ResetMeter(bResetClipping);
|
mMixerTrackClusters[i]->ResetMeter(bResetClipping);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,7 +1213,7 @@ void MixerBoard::UpdateMute(const PlayableTrack* pTrack /*= NULL*/) // NULL mean
|
|||||||
{
|
{
|
||||||
if (pTrack == NULL)
|
if (pTrack == NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->UpdateMute();
|
mMixerTrackClusters[i]->UpdateMute();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1229,7 +1229,7 @@ void MixerBoard::UpdateSolo(const PlayableTrack* pTrack /*= NULL*/) // NULL mean
|
|||||||
{
|
{
|
||||||
if (pTrack == NULL)
|
if (pTrack == NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->UpdateSolo();
|
mMixerTrackClusters[i]->UpdateSolo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1245,7 +1245,7 @@ void MixerBoard::UpdatePan(const PlayableTrack* pTrack)
|
|||||||
{
|
{
|
||||||
if (pTrack == NULL)
|
if (pTrack == NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->UpdatePan();
|
mMixerTrackClusters[i]->UpdatePan();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1296,7 +1296,7 @@ void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
mMixerTrackClusters[i]->UpdateMeter(mPrevT1, t1);
|
mMixerTrackClusters[i]->UpdateMeter(mPrevT1, t1);
|
||||||
|
|
||||||
mPrevT1 = t1;
|
mPrevT1 = t1;
|
||||||
@ -1391,7 +1391,7 @@ int MixerBoard::FindMixerTrackCluster(const PlayableTrack* pTrack,
|
|||||||
MixerTrackCluster** hMixerTrackCluster) const
|
MixerTrackCluster** hMixerTrackCluster) const
|
||||||
{
|
{
|
||||||
*hMixerTrackCluster = NULL;
|
*hMixerTrackCluster = NULL;
|
||||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
|
||||||
{
|
{
|
||||||
if (mMixerTrackClusters[i]->mTrack.get() == pTrack)
|
if (mMixerTrackClusters[i]->mTrack.get() == pTrack)
|
||||||
{
|
{
|
||||||
|
@ -152,8 +152,6 @@ public:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DEFINE_ARRAY(MixerTrackCluster*, MixerTrackClusterArray);
|
|
||||||
|
|
||||||
|
|
||||||
class MusicalInstrument
|
class MusicalInstrument
|
||||||
{
|
{
|
||||||
@ -265,7 +263,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Track clusters are maintained in the same order as the WaveTracks.
|
// Track clusters are maintained in the same order as the WaveTracks.
|
||||||
MixerTrackClusterArray mMixerTrackClusters;
|
std::vector<MixerTrackCluster*> mMixerTrackClusters;
|
||||||
|
|
||||||
MusicalInstrumentArray mMusicalInstruments;
|
MusicalInstrumentArray mMusicalInstruments;
|
||||||
AudacityProject* mProject;
|
AudacityProject* mProject;
|
||||||
|
@ -377,11 +377,9 @@ enum
|
|||||||
STATE_COUNT
|
STATE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DEFINE_ARRAY(PluginDescriptor *, DescriptorArray);
|
|
||||||
|
|
||||||
struct ItemData
|
struct ItemData
|
||||||
{
|
{
|
||||||
DescriptorArray plugs;
|
std::vector<PluginDescriptor*> plugs;
|
||||||
wxString name;
|
wxString name;
|
||||||
wxString path;
|
wxString path;
|
||||||
int state;
|
int state;
|
||||||
@ -612,7 +610,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S)
|
|||||||
|
|
||||||
const wxString &path = plug.GetPath();
|
const wxString &path = plug.GetPath();
|
||||||
ItemData & item = mItems[path]; // will create NEW entry
|
ItemData & item = mItems[path]; // will create NEW entry
|
||||||
item.plugs.Add(&plug);
|
item.plugs.push_back(&plug);
|
||||||
item.path = path;
|
item.path = path;
|
||||||
item.state = plug.IsEnabled() ? STATE_Enabled : STATE_Disabled;
|
item.state = plug.IsEnabled() ? STATE_Enabled : STATE_Disabled;
|
||||||
item.valid = plug.IsValid();
|
item.valid = plug.IsValid();
|
||||||
@ -981,13 +979,13 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
|
|||||||
wxString errMsgs;
|
wxString errMsgs;
|
||||||
|
|
||||||
// Try to register the plugin via each provider until one succeeds
|
// Try to register the plugin via each provider until one succeeds
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
|
||||||
{
|
{
|
||||||
wxString errMsg;
|
wxString errMsg;
|
||||||
if (mm.RegisterPlugin(item.plugs[j]->GetProviderID(), path,
|
if (mm.RegisterPlugin(item.plugs[j]->GetProviderID(), path,
|
||||||
errMsg))
|
errMsg))
|
||||||
{
|
{
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
|
||||||
{
|
{
|
||||||
pm.mPlugins.erase(item.plugs[j]->GetProviderID() + wxT("_") + path);
|
pm.mPlugins.erase(item.plugs[j]->GetProviderID() + wxT("_") + path);
|
||||||
}
|
}
|
||||||
@ -1008,14 +1006,14 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
|
|||||||
}
|
}
|
||||||
else if (item.state == STATE_New)
|
else if (item.state == STATE_New)
|
||||||
{
|
{
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
|
||||||
{
|
{
|
||||||
item.plugs[j]->SetValid(false);
|
item.plugs[j]->SetValid(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (item.state != STATE_New)
|
else if (item.state != STATE_New)
|
||||||
{
|
{
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
|
||||||
{
|
{
|
||||||
item.plugs[j]->SetEnabled(item.state == STATE_Enabled);
|
item.plugs[j]->SetEnabled(item.state == STATE_Enabled);
|
||||||
item.plugs[j]->SetValid(item.valid);
|
item.plugs[j]->SetValid(item.valid);
|
||||||
|
@ -63,7 +63,6 @@ class ODLock;
|
|||||||
class RecordingRecoveryHandler;
|
class RecordingRecoveryHandler;
|
||||||
class TrackList;
|
class TrackList;
|
||||||
class Tags;
|
class Tags;
|
||||||
class EffectPlugs;
|
|
||||||
|
|
||||||
class TrackPanel;
|
class TrackPanel;
|
||||||
class FreqWindow;
|
class FreqWindow;
|
||||||
@ -121,8 +120,6 @@ using AProjectArray = std::vector< AProjectHolder >;
|
|||||||
extern AProjectArray gAudacityProjects;
|
extern AProjectArray gAudacityProjects;
|
||||||
|
|
||||||
|
|
||||||
WX_DEFINE_ARRAY(wxMenu *, MenuArray);
|
|
||||||
|
|
||||||
enum class PlayMode : int {
|
enum class PlayMode : int {
|
||||||
normalPlay,
|
normalPlay,
|
||||||
oneSecondPlay, // Disables auto-scrolling
|
oneSecondPlay, // Disables auto-scrolling
|
||||||
|
@ -980,18 +980,18 @@ bool LadspaEffect::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSlaves.Add(slave);
|
mSlaves.push_back(slave);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LadspaEffect::RealtimeFinalize()
|
bool LadspaEffect::RealtimeFinalize()
|
||||||
{
|
{
|
||||||
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
|
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
FreeInstance(mSlaves[i]);
|
FreeInstance(mSlaves[i]);
|
||||||
}
|
}
|
||||||
mSlaves.Clear();
|
mSlaves.clear();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ class wxCheckBox;
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
WX_DEFINE_ARRAY_PTR(LADSPA_Handle, LadspaSlaveArray);
|
|
||||||
|
|
||||||
class LadspaEffectMeter;
|
class LadspaEffectMeter;
|
||||||
|
|
||||||
class LadspaEffect final : public wxEvtHandler,
|
class LadspaEffect final : public wxEvtHandler,
|
||||||
@ -179,7 +177,7 @@ private:
|
|||||||
bool mLatencyDone;
|
bool mLatencyDone;
|
||||||
|
|
||||||
// Realtime processing
|
// Realtime processing
|
||||||
LadspaSlaveArray mSlaves;
|
std::vector<LADSPA_Handle> mSlaves;
|
||||||
|
|
||||||
EffectUIHostInterface *mUIHost;
|
EffectUIHostInterface *mUIHost;
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ void LV2Effect::SetSampleRate(double rate)
|
|||||||
mOptionsInterface->set(lilv_instance_get_handle(mMaster), options);
|
mOptionsInterface->set(lilv_instance_get_handle(mMaster), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
|
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
mOptionsInterface->set(lilv_instance_get_handle(mSlaves[i]), options);
|
mOptionsInterface->set(lilv_instance_get_handle(mSlaves[i]), options);
|
||||||
}
|
}
|
||||||
@ -722,7 +722,7 @@ size_t LV2Effect::SetBlockSize(size_t maxBlockSize)
|
|||||||
mOptionsInterface->set(lilv_instance_get_handle(mMaster), options);
|
mOptionsInterface->set(lilv_instance_get_handle(mMaster), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
|
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
mOptionsInterface->set(lilv_instance_get_handle(mSlaves[i]), options);
|
mOptionsInterface->set(lilv_instance_get_handle(mSlaves[i]), options);
|
||||||
}
|
}
|
||||||
@ -814,13 +814,13 @@ bool LV2Effect::RealtimeInitialize()
|
|||||||
|
|
||||||
bool LV2Effect::RealtimeFinalize()
|
bool LV2Effect::RealtimeFinalize()
|
||||||
{
|
{
|
||||||
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
|
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
lilv_instance_deactivate(mSlaves[i]);
|
lilv_instance_deactivate(mSlaves[i]);
|
||||||
|
|
||||||
FreeInstance(mSlaves[i]);
|
FreeInstance(mSlaves[i]);
|
||||||
}
|
}
|
||||||
mSlaves.Clear();
|
mSlaves.clear();
|
||||||
|
|
||||||
lilv_instance_deactivate(mMaster);
|
lilv_instance_deactivate(mMaster);
|
||||||
|
|
||||||
@ -856,10 +856,10 @@ size_t LV2Effect::RealtimeProcess(int group,
|
|||||||
float **outbuf,
|
float **outbuf,
|
||||||
size_t numSamples)
|
size_t numSamples)
|
||||||
{
|
{
|
||||||
wxASSERT(group >= 0 && group < (int) mSlaves.GetCount());
|
wxASSERT(group >= 0 && group < (int) mSlaves.size());
|
||||||
wxASSERT(numSamples <= mBlockSize);
|
wxASSERT(numSamples <= mBlockSize);
|
||||||
|
|
||||||
if (group < 0 || group >= (int) mSlaves.GetCount())
|
if (group < 0 || group >= (int) mSlaves.size())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -900,7 +900,7 @@ bool LV2Effect::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampl
|
|||||||
|
|
||||||
lilv_instance_activate(slave);
|
lilv_instance_activate(slave);
|
||||||
|
|
||||||
mSlaves.Add(slave);
|
mSlaves.push_back(slave);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
using LV2GroupMap = std::unordered_map<wxString, std::vector<int>>;
|
using LV2GroupMap = std::unordered_map<wxString, std::vector<int>>;
|
||||||
WX_DEFINE_ARRAY_PTR(LilvInstance *, LV2SlaveArray);
|
|
||||||
|
|
||||||
class LV2EffectSettingsDialog;
|
class LV2EffectSettingsDialog;
|
||||||
|
|
||||||
@ -281,7 +280,7 @@ private:
|
|||||||
|
|
||||||
LilvInstance *mMaster;
|
LilvInstance *mMaster;
|
||||||
LilvInstance *mProcess;
|
LilvInstance *mProcess;
|
||||||
LV2SlaveArray mSlaves;
|
std::vector<LilvInstance*> mSlaves;
|
||||||
|
|
||||||
FloatBuffers mMasterIn, mMasterOut;
|
FloatBuffers mMasterIn, mMasterOut;
|
||||||
size_t mNumSamples;
|
size_t mNumSamples;
|
||||||
|
@ -213,20 +213,20 @@ void Importer::ReadImportItems()
|
|||||||
{
|
{
|
||||||
if (importPlugin->GetPluginStringID().Cmp(new_item->filters[i]) == 0)
|
if (importPlugin->GetPluginStringID().Cmp(new_item->filters[i]) == 0)
|
||||||
{
|
{
|
||||||
new_item->filter_objects.Add (importPlugin.get());
|
new_item->filter_objects.push_back(importPlugin.get());
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* IDs that do not have corresponding filters, will be shown as-is */
|
/* IDs that do not have corresponding filters, will be shown as-is */
|
||||||
if (!found)
|
if (!found)
|
||||||
new_item->filter_objects.Add (NULL);
|
new_item->filter_objects.push_back(nullptr);
|
||||||
}
|
}
|
||||||
/* Find all filter objects that are not present in the filter list */
|
/* Find all filter objects that are not present in the filter list */
|
||||||
for (const auto &importPlugin : mImportPluginList)
|
for (const auto &importPlugin : mImportPluginList)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (size_t i = 0; i < new_item->filter_objects.Count(); i++)
|
for (size_t i = 0; i < new_item->filter_objects.size(); i++)
|
||||||
{
|
{
|
||||||
if (importPlugin.get() == new_item->filter_objects[i])
|
if (importPlugin.get() == new_item->filter_objects[i])
|
||||||
{
|
{
|
||||||
@ -241,7 +241,8 @@ void Importer::ReadImportItems()
|
|||||||
if (new_item->divider < 0)
|
if (new_item->divider < 0)
|
||||||
index = new_item->filters.Count();
|
index = new_item->filters.Count();
|
||||||
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
||||||
new_item->filter_objects.Insert (importPlugin.get(), index);
|
new_item->filter_objects.insert(
|
||||||
|
new_item->filter_objects.begin() + index, importPlugin.get());
|
||||||
if (new_item->divider >= 0)
|
if (new_item->divider >= 0)
|
||||||
new_item->divider++;
|
new_item->divider++;
|
||||||
}
|
}
|
||||||
@ -320,7 +321,7 @@ movable_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
|||||||
for (const auto &importPlugin : mImportPluginList)
|
for (const auto &importPlugin : mImportPluginList)
|
||||||
{
|
{
|
||||||
new_item->filters.Add (importPlugin->GetPluginStringID());
|
new_item->filters.Add (importPlugin->GetPluginStringID());
|
||||||
new_item->filter_objects.Add (importPlugin.get());
|
new_item->filter_objects.push_back(importPlugin.get());
|
||||||
}
|
}
|
||||||
new_item->divider = -1;
|
new_item->divider = -1;
|
||||||
return new_item;
|
return new_item;
|
||||||
@ -435,7 +436,7 @@ bool Importer::Import(const wxString &fName,
|
|||||||
if (matches_ext && matches_mime)
|
if (matches_ext && matches_mime)
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("Complete match!"));
|
wxLogDebug(wxT("Complete match!"));
|
||||||
for (size_t j = 0; j < item->filter_objects.Count() && (item->divider < 0 || (int) j < item->divider); j++)
|
for (size_t j = 0; j < item->filter_objects.size() && (item->divider < 0 || (int) j < item->divider); j++)
|
||||||
{
|
{
|
||||||
// the filter_object can be NULL if a suitable importer was not found
|
// the filter_object can be NULL if a suitable importer was not found
|
||||||
// this happens when we recompile with --without-ffmpeg and there
|
// this happens when we recompile with --without-ffmpeg and there
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
class ExtImportItem;
|
class ExtImportItem;
|
||||||
|
|
||||||
using FormatList = std::vector<Format> ;
|
using FormatList = std::vector<Format> ;
|
||||||
WX_DEFINE_ARRAY_PTR(ImportPlugin *, ImportPluginPtrArray);
|
|
||||||
using ExtImportItems = std::vector< movable_ptr<ExtImportItem> >;
|
using ExtImportItems = std::vector< movable_ptr<ExtImportItem> >;
|
||||||
|
|
||||||
class ExtImportItem
|
class ExtImportItem
|
||||||
@ -71,7 +70,7 @@ class ExtImportItem
|
|||||||
/**
|
/**
|
||||||
* Array of pointers to import plugins (members of FormatList)
|
* Array of pointers to import plugins (members of FormatList)
|
||||||
*/
|
*/
|
||||||
ImportPluginPtrArray filter_objects;
|
std::vector<ImportPlugin*> filter_objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File extensions. Each one is a string with simple wildcards,
|
* File extensions. Each one is a string with simple wildcards,
|
||||||
|
@ -298,13 +298,13 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
|||||||
PluginList->SetItemState (itemIndex, 0, wxLIST_STATE_SELECTED);
|
PluginList->SetItemState (itemIndex, 0, wxLIST_STATE_SELECTED);
|
||||||
PluginList->SetItemState (itemIndex2, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
PluginList->SetItemState (itemIndex2, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
||||||
}
|
}
|
||||||
int fcount = item->filter_objects.Count();
|
int fcount = item->filter_objects.size();
|
||||||
if (item->divider >= fcount)
|
if (item->divider >= fcount)
|
||||||
{
|
{
|
||||||
item->divider = -1;
|
item->divider = -1;
|
||||||
}
|
}
|
||||||
if (item->divider < -1)
|
if (item->divider < -1)
|
||||||
item->divider = item->filter_objects.Count() - 1;
|
item->divider = item->filter_objects.size() - 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ enum {
|
|||||||
class ToolBarArrangement
|
class ToolBarArrangement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ExpandingToolBarArray childArray;
|
std::vector<ExpandingToolBar*> childArray;
|
||||||
std::vector<wxRect> rectArray;
|
std::vector<wxRect> rectArray;
|
||||||
std::vector<int> rowArray;
|
std::vector<int> rowArray;
|
||||||
};
|
};
|
||||||
@ -864,7 +864,7 @@ void ToolBarArea::ContractRow(int rowIndex)
|
|||||||
int i;
|
int i;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
if (mRowArray[i] == rowIndex) {
|
if (mRowArray[i] == rowIndex) {
|
||||||
wxPoint childPos = mChildArray[i]->GetPosition();
|
wxPoint childPos = mChildArray[i]->GetPosition();
|
||||||
wxSize childMin = mChildArray[i]->GetMinSize();
|
wxSize childMin = mChildArray[i]->GetMinSize();
|
||||||
@ -890,7 +890,7 @@ bool ToolBarArea::ExpandRow(int rowIndex)
|
|||||||
int expandableCount = 0;
|
int expandableCount = 0;
|
||||||
int toolbarCount = 0;
|
int toolbarCount = 0;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
if (mRowArray[i] == rowIndex) {
|
if (mRowArray[i] == rowIndex) {
|
||||||
ExpandingToolBar *child = mChildArray[i];
|
ExpandingToolBar *child = mChildArray[i];
|
||||||
wxSize childMin = child->GetMinSize();
|
wxSize childMin = child->GetMinSize();
|
||||||
@ -914,7 +914,7 @@ bool ToolBarArea::ExpandRow(int rowIndex)
|
|||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
if (mRowArray[i] == rowIndex) {
|
if (mRowArray[i] == rowIndex) {
|
||||||
ExpandingToolBar *child = mChildArray[i];
|
ExpandingToolBar *child = mChildArray[i];
|
||||||
wxPoint childPos = child->GetPosition();
|
wxPoint childPos = child->GetPosition();
|
||||||
@ -1017,10 +1017,10 @@ bool ToolBarArea::Layout()
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
mRowArray[i] = -1;
|
mRowArray[i] = -1;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
LayoutOne(i);
|
LayoutOne(i);
|
||||||
|
|
||||||
Refresh(true);
|
Refresh(true);
|
||||||
@ -1036,13 +1036,13 @@ void ToolBarArea::AdjustLayout()
|
|||||||
int row = -1;
|
int row = -1;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++) {
|
for(i = 0; i < (int)mChildArray.size(); i++) {
|
||||||
if (mRowArray[i] > row) {
|
if (mRowArray[i] > row) {
|
||||||
row = mRowArray[i];
|
row = mRowArray[i];
|
||||||
bool success = ExpandRow(row);
|
bool success = ExpandRow(row);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
// Re-layout all toolbars from this row on
|
// Re-layout all toolbars from this row on
|
||||||
for(j=i; j<(int)mChildArray.GetCount(); j++)
|
for(j = i; j < (int)mChildArray.size(); j++)
|
||||||
LayoutOne(j);
|
LayoutOne(j);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1067,7 +1067,7 @@ void ToolBarArea::Fit(bool horizontal, bool vertical)
|
|||||||
minSize.y = 0;
|
minSize.y = 0;
|
||||||
maxSize.x = 9999;
|
maxSize.x = 9999;
|
||||||
maxSize.y = 0;
|
maxSize.y = 0;
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++) {
|
for(i = 0; i < (int)mChildArray.size(); i++) {
|
||||||
wxPoint childPos = mChildArray[i]->GetPosition();
|
wxPoint childPos = mChildArray[i]->GetPosition();
|
||||||
wxSize childSize = mChildArray[i]->GetSize();
|
wxSize childSize = mChildArray[i]->GetSize();
|
||||||
|
|
||||||
@ -1147,15 +1147,15 @@ void ToolBarArea::CollapseAll(bool now)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
mChildArray[i]->Collapse(now);
|
mChildArray[i]->Collapse(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBarArea::AddChild(ExpandingToolBar *child)
|
void ToolBarArea::AddChild(ExpandingToolBar *child)
|
||||||
{
|
{
|
||||||
mChildArray.Add(child);
|
mChildArray.push_back(child);
|
||||||
mRowArray.push_back(-1); // unknown row
|
mRowArray.push_back(-1); // unknown row
|
||||||
LayoutOne(mChildArray.GetCount()-1);
|
LayoutOne(mChildArray.size() - 1);
|
||||||
Fit(false, true);
|
Fit(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,17 +1163,17 @@ void ToolBarArea::RemoveChild(ExpandingToolBar *child)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++) {
|
for(i = 0; i < (int)mChildArray.size(); i++) {
|
||||||
if (mChildArray[i] == child) {
|
if (mChildArray[i] == child) {
|
||||||
child->Hide();
|
child->Hide();
|
||||||
|
|
||||||
mChildArray.RemoveAt(i);
|
mChildArray.erase(mChildArray.begin() + i);
|
||||||
mRowArray.erase(mRowArray.begin() + i);
|
mRowArray.erase(mRowArray.begin() + i);
|
||||||
|
|
||||||
for(j=i; j<(int)mChildArray.GetCount(); j++)
|
for(j = i; j < (int)mChildArray.size(); j++)
|
||||||
mRowArray[j] = -1;
|
mRowArray[j] = -1;
|
||||||
|
|
||||||
for(j=i; j<(int)mChildArray.GetCount(); j++)
|
for(j = i; j < (int)mChildArray.size(); j++)
|
||||||
LayoutOne(j);
|
LayoutOne(j);
|
||||||
|
|
||||||
Fit(false, true);
|
Fit(false, true);
|
||||||
@ -1189,7 +1189,7 @@ std::unique_ptr<ToolBarArrangement> ToolBarArea::SaveArrangement()
|
|||||||
arrangement->childArray = mChildArray;
|
arrangement->childArray = mChildArray;
|
||||||
arrangement->rowArray = mRowArray;
|
arrangement->rowArray = mRowArray;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++)
|
for(i = 0; i < (int)mChildArray.size(); i++)
|
||||||
arrangement->rectArray.push_back(mChildArray[i]->GetRect());
|
arrangement->rectArray.push_back(mChildArray[i]->GetRect());
|
||||||
|
|
||||||
return arrangement;
|
return arrangement;
|
||||||
@ -1202,7 +1202,7 @@ void ToolBarArea::RestoreArrangement(std::unique_ptr<ToolBarArrangement>&& arran
|
|||||||
mChildArray = arrangement->childArray;
|
mChildArray = arrangement->childArray;
|
||||||
mRowArray = arrangement->rowArray;
|
mRowArray = arrangement->rowArray;
|
||||||
|
|
||||||
for(i=0; i<(int)mChildArray.GetCount(); i++) {
|
for(i = 0; i < (int)mChildArray.size(); i++) {
|
||||||
mChildArray[i]->SetSize(arrangement->rectArray[i]);
|
mChildArray[i]->SetSize(arrangement->rectArray[i]);
|
||||||
mChildArray[i]->Show();
|
mChildArray[i]->Show();
|
||||||
}
|
}
|
||||||
@ -1218,7 +1218,7 @@ std::vector<wxRect> ToolBarArea::GetDropTargets()
|
|||||||
mDropTargetIndices.clear();
|
mDropTargetIndices.clear();
|
||||||
mDropTargetRows.clear();
|
mDropTargetRows.clear();
|
||||||
|
|
||||||
int numChildren = (int)mChildArray.GetCount();
|
int numChildren = (int)mChildArray.size();
|
||||||
int i;
|
int i;
|
||||||
int row = -1;
|
int row = -1;
|
||||||
|
|
||||||
@ -1257,17 +1257,17 @@ void ToolBarArea::MoveChild(ExpandingToolBar *toolBar, wxRect dropTarget)
|
|||||||
int newIndex = mDropTargetIndices[i];
|
int newIndex = mDropTargetIndices[i];
|
||||||
int newRow = mDropTargetRows[i];
|
int newRow = mDropTargetRows[i];
|
||||||
|
|
||||||
mChildArray.Insert(toolBar, newIndex);
|
mChildArray.insert(mChildArray.begin() + newIndex, toolBar);
|
||||||
mRowArray.insert(mRowArray.begin() + newIndex, newRow);
|
mRowArray.insert(mRowArray.begin() + newIndex, newRow);
|
||||||
|
|
||||||
for(j=newIndex+1; j<(int)mChildArray.GetCount(); j++)
|
for(j = newIndex+1; j < (int)mChildArray.size(); j++)
|
||||||
mRowArray[j] = -1;
|
mRowArray[j] = -1;
|
||||||
|
|
||||||
ContractRow(newRow);
|
ContractRow(newRow);
|
||||||
|
|
||||||
mChildArray[newIndex]->Show();
|
mChildArray[newIndex]->Show();
|
||||||
|
|
||||||
for(j=newIndex; j<(int)mChildArray.GetCount(); j++)
|
for(j = newIndex; j < (int)mChildArray.size(); j++)
|
||||||
LayoutOne(j);
|
LayoutOne(j);
|
||||||
|
|
||||||
Fit(false, true);
|
Fit(false, true);
|
||||||
|
@ -40,7 +40,6 @@ class ToolBarGrabber;
|
|||||||
class ToolBarArrangement;
|
class ToolBarArrangement;
|
||||||
|
|
||||||
using WindowHash = std::unordered_map<void*, int>;
|
using WindowHash = std::unordered_map<void*, int>;
|
||||||
WX_DEFINE_ARRAY(ExpandingToolBar *, ExpandingToolBarArray);
|
|
||||||
|
|
||||||
class ExpandingToolBarEvtHandler;
|
class ExpandingToolBarEvtHandler;
|
||||||
|
|
||||||
@ -239,7 +238,7 @@ class ToolBarArea final : public wxPanelWrapper
|
|||||||
void AdjustLayout();
|
void AdjustLayout();
|
||||||
void Fit(bool horizontal, bool vertical);
|
void Fit(bool horizontal, bool vertical);
|
||||||
|
|
||||||
ExpandingToolBarArray mChildArray;
|
std::vector<ExpandingToolBar*> mChildArray;
|
||||||
std::vector<int> mRowArray;
|
std::vector<int> mRowArray;
|
||||||
wxSize mLastLayoutSize;
|
wxSize mLastLayoutSize;
|
||||||
bool mInOnSize;
|
bool mInOnSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user