mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 09:01:15 +02:00
Use standard library style members of wxArrayString (and wxString) ...
... which will make it easier to change the types of those containers to std::vectors of other string-like classes for wxString, IsEmpty => empty Clear => clear Alloc => reserve for wxArrayString, Count => size GetCount => size IsEmpty => empty Add => push_back Clear => clear Empty => clear Sort => std::sort (only with default comparator) SetCount => resize Last => back Item => operator [] Alloc => reserve
This commit is contained in:
@@ -34,8 +34,8 @@ void DoExport
|
||||
|
||||
// Prompt for file name and/or extension?
|
||||
bool bPromptingRequired =
|
||||
(project.mBatchMode == 0) || project.GetFileName().IsEmpty() ||
|
||||
Format.IsEmpty();
|
||||
(project.mBatchMode == 0) || project.GetFileName().empty() ||
|
||||
Format.empty();
|
||||
wxString filename;
|
||||
|
||||
if (!bPromptingRequired) {
|
||||
@@ -394,7 +394,7 @@ void OnImport(const CommandContext &context)
|
||||
wxGetApp().SetMissingAliasedFileWarningShouldShow(true);
|
||||
|
||||
wxArrayString selectedFiles = project.ShowOpenDialog(wxT(""));
|
||||
if (selectedFiles.GetCount() == 0) {
|
||||
if (selectedFiles.size() == 0) {
|
||||
gPrefs->Write(wxT("/LastOpenType"),wxT(""));
|
||||
gPrefs->Flush();
|
||||
return;
|
||||
@@ -418,7 +418,7 @@ void OnImport(const CommandContext &context)
|
||||
project.HandleResize(); // Adjust scrollers for NEW track sizes.
|
||||
} );
|
||||
|
||||
for (size_t ff = 0; ff < selectedFiles.GetCount(); ff++) {
|
||||
for (size_t ff = 0; ff < selectedFiles.size(); ff++) {
|
||||
wxString fileName = selectedFiles[ff];
|
||||
|
||||
FileNames::UpdateDefaultPath(FileNames::Operation::Open, fileName);
|
||||
|
@@ -96,7 +96,7 @@ void OnAudioDeviceInfo(const CommandContext &context)
|
||||
wxT("*.txt"),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
||||
&project);
|
||||
if (!fName.IsEmpty())
|
||||
if (!fName.empty())
|
||||
{
|
||||
if (!text->SaveFile(fName))
|
||||
{
|
||||
@@ -140,7 +140,7 @@ void OnMidiDeviceInfo(const CommandContext &context)
|
||||
wxT("*.txt"),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
||||
&project);
|
||||
if (!fName.IsEmpty())
|
||||
if (!fName.empty())
|
||||
{
|
||||
if (!text->SaveFile(fName))
|
||||
{
|
||||
|
@@ -44,11 +44,11 @@ bool CompareEffectsByPublisher(
|
||||
auto akey = em.GetVendorName(a->GetID());
|
||||
auto bkey = em.GetVendorName(b->GetID());
|
||||
|
||||
if (akey.IsEmpty())
|
||||
if (akey.empty())
|
||||
{
|
||||
akey = _("Uncategorized");
|
||||
}
|
||||
if (bkey.IsEmpty())
|
||||
if (bkey.empty())
|
||||
{
|
||||
bkey = _("Uncategorized");
|
||||
}
|
||||
@@ -94,11 +94,11 @@ bool CompareEffectsByTypeAndName(
|
||||
auto akey = em.GetEffectFamilyName(a->GetID());
|
||||
auto bkey = em.GetEffectFamilyName(b->GetID());
|
||||
|
||||
if (akey.IsEmpty())
|
||||
if (akey.empty())
|
||||
{
|
||||
akey = _("Uncategorized");
|
||||
}
|
||||
if (bkey.IsEmpty())
|
||||
if (bkey.empty())
|
||||
{
|
||||
bkey = _("Uncategorized");
|
||||
}
|
||||
@@ -127,11 +127,11 @@ bool CompareEffectsByType(const PluginDescriptor *a, const PluginDescriptor *b)
|
||||
auto akey = em.GetEffectFamilyName(a->GetID());
|
||||
auto bkey = em.GetEffectFamilyName(b->GetID());
|
||||
|
||||
if (akey.IsEmpty())
|
||||
if (akey.empty())
|
||||
{
|
||||
akey = _("Uncategorized");
|
||||
}
|
||||
if (bkey.IsEmpty())
|
||||
if (bkey.empty())
|
||||
{
|
||||
bkey = _("Uncategorized");
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void AddEffectMenuItems(
|
||||
if (groupBy == wxT("groupby:publisher"))
|
||||
{
|
||||
current = EffectManager::Get().GetVendorName(plug->GetID());
|
||||
if (current.IsEmpty())
|
||||
if (current.empty())
|
||||
{
|
||||
current = _("Unknown");
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void AddEffectMenuItems(
|
||||
else if (groupBy == wxT("groupby:type"))
|
||||
{
|
||||
current = EffectManager::Get().GetEffectFamilyName(plug->GetID());
|
||||
if (current.IsEmpty())
|
||||
if (current.empty())
|
||||
{
|
||||
current = _("Unknown");
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void AddEffectMenuItems(
|
||||
{
|
||||
using namespace MenuTable;
|
||||
BaseItemPtrs temp;
|
||||
bool bInSubmenu = !last.IsEmpty() && (groupNames.Count() > 1);
|
||||
bool bInSubmenu = !last.empty() && (groupNames.size() > 1);
|
||||
|
||||
AddEffectMenuItemGroup(temp,
|
||||
groupNames, vHasDialog,
|
||||
@@ -223,25 +223,25 @@ void AddEffectMenuItems(
|
||||
( bInSubmenu ? last : wxString{} ), std::move( temp )
|
||||
) );
|
||||
|
||||
groupNames.Clear();
|
||||
groupNames.clear();
|
||||
vHasDialog.clear();
|
||||
groupPlugs.Clear();
|
||||
groupPlugs.clear();
|
||||
groupFlags.clear();
|
||||
last = current;
|
||||
}
|
||||
|
||||
groupNames.Add(name);
|
||||
groupNames.push_back(name);
|
||||
vHasDialog.push_back(hasDialog);
|
||||
groupPlugs.Add(plug->GetID());
|
||||
groupPlugs.push_back(plug->GetID());
|
||||
groupFlags.push_back(
|
||||
plug->IsEffectRealtime() ? realflags : batchflags);
|
||||
}
|
||||
|
||||
if (groupNames.GetCount() > 0)
|
||||
if (groupNames.size() > 0)
|
||||
{
|
||||
using namespace MenuTable;
|
||||
BaseItemPtrs temp;
|
||||
bool bInSubmenu = groupNames.Count() > 1;
|
||||
bool bInSubmenu = groupNames.size() > 1;
|
||||
|
||||
AddEffectMenuItemGroup(temp,
|
||||
groupNames, vHasDialog, groupPlugs, groupFlags, isDefault);
|
||||
@@ -280,18 +280,18 @@ void AddEffectMenuItems(
|
||||
group = wxEmptyString;
|
||||
}
|
||||
|
||||
if (!group.IsEmpty())
|
||||
if (!group.empty())
|
||||
{
|
||||
group += wxT(": ");
|
||||
}
|
||||
|
||||
groupNames.Add(group + name);
|
||||
groupNames.push_back(group + name);
|
||||
vHasDialog.push_back(hasDialog);
|
||||
groupPlugs.Add(plug->GetID());
|
||||
groupPlugs.push_back(plug->GetID());
|
||||
groupFlags.push_back(plug->IsEffectRealtime() ? realflags : batchflags);
|
||||
}
|
||||
|
||||
if (groupNames.GetCount() > 0)
|
||||
if (groupNames.size() > 0)
|
||||
{
|
||||
AddEffectMenuItemGroup(
|
||||
table, groupNames, vHasDialog, groupPlugs, groupFlags, isDefault);
|
||||
@@ -568,7 +568,7 @@ void OnManageEffects(const CommandContext &context)
|
||||
void OnRepeatLastEffect(const CommandContext &context)
|
||||
{
|
||||
auto lastEffect = GetMenuManager(context.project).mLastEffect;
|
||||
if (!lastEffect.IsEmpty())
|
||||
if (!lastEffect.empty())
|
||||
{
|
||||
DoEffect( lastEffect, context, kConfigured );
|
||||
}
|
||||
@@ -711,7 +711,7 @@ void AddEffectMenuItemGroup(
|
||||
const std::vector<CommandFlag> & flags,
|
||||
bool isDefault)
|
||||
{
|
||||
const int namesCnt = (int) names.GetCount();
|
||||
const int namesCnt = (int) names.size();
|
||||
int perGroup;
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
@@ -827,7 +827,7 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
|
||||
wxArrayString names = MacroCommands::GetNames();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)names.GetCount(); i++) {
|
||||
for (i = 0; i < (int)names.size(); i++) {
|
||||
wxString MacroID = ApplyMacroDialog::MacroIdOfName( names[i] );
|
||||
result.push_back( MenuTable::Command( MacroID,
|
||||
names[i], false, FN(OnApplyMacroDirectly),
|
||||
@@ -871,7 +871,7 @@ MenuTable::BaseItemPtr EffectMenu( AudacityProject &project )
|
||||
|
||||
const auto &lastEffect = GetMenuManager(project).mLastEffect;
|
||||
wxString buildMenuLabel;
|
||||
if (!lastEffect.IsEmpty()) {
|
||||
if (!lastEffect.empty()) {
|
||||
buildMenuLabel.Printf(_("Repeat %s"),
|
||||
EffectManager::Get().GetCommandName(lastEffect));
|
||||
}
|
||||
|
Reference in New Issue
Block a user