mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Fix crash on Linux startup since commit f6e5696
This commit is contained in:
parent
c44f2cf755
commit
3c9cd7925a
@ -153,12 +153,12 @@ CommandItem::CommandItem(const CommandID &name_,
|
||||
CommandItem::~CommandItem() {}
|
||||
|
||||
CommandGroupItem::CommandGroupItem(const wxString &name_,
|
||||
std::initializer_list< ComponentInterfaceSymbol > items_,
|
||||
std::vector< ComponentInterfaceSymbol > items_,
|
||||
CommandFunctorPointer callback_,
|
||||
CommandFlag flags_,
|
||||
bool isEffect_,
|
||||
CommandHandlerFinder finder_)
|
||||
: SingleItem{ name_ }, items{ items_ }
|
||||
: SingleItem{ name_ }, items{ std::move(items_) }
|
||||
, finder{ finder_ }, callback{ callback_ }
|
||||
, flags{ flags_ }, isEffect{ isEffect_ }
|
||||
{}
|
||||
|
@ -706,7 +706,7 @@ namespace MenuTable {
|
||||
// in the CommandContext identifying the command
|
||||
struct CommandGroupItem final : SingleItem {
|
||||
CommandGroupItem(const wxString &name_,
|
||||
std::initializer_list< ComponentInterfaceSymbol > items_,
|
||||
std::vector< ComponentInterfaceSymbol > items_,
|
||||
CommandFunctorPointer callback_,
|
||||
CommandFlag flags_,
|
||||
bool isEffect_,
|
||||
@ -716,12 +716,12 @@ namespace MenuTable {
|
||||
// previous constructor; useful within the lifetime of a FinderScope
|
||||
template< typename Handler >
|
||||
CommandGroupItem(const wxString &name_,
|
||||
std::initializer_list< ComponentInterfaceSymbol > items_,
|
||||
std::vector< ComponentInterfaceSymbol > items_,
|
||||
void (Handler::*pmf)(const CommandContext&),
|
||||
CommandFlag flags_,
|
||||
bool isEffect_,
|
||||
CommandHandlerFinder finder = FinderScope::DefaultFinder())
|
||||
: CommandGroupItem(name_, items_,
|
||||
: CommandGroupItem(name_, std::move(items_),
|
||||
static_cast<CommandFunctorPointer>(pmf),
|
||||
flags_, isEffect_, finder)
|
||||
{}
|
||||
@ -842,13 +842,13 @@ namespace MenuTable {
|
||||
template< typename Handler >
|
||||
inline std::unique_ptr<CommandGroupItem> CommandGroup(
|
||||
const wxString &name,
|
||||
std::initializer_list< ComponentInterfaceSymbol > items,
|
||||
std::vector< ComponentInterfaceSymbol > items,
|
||||
void (Handler::*pmf)(const CommandContext&),
|
||||
CommandFlag flags, bool isEffect = false,
|
||||
CommandHandlerFinder finder = FinderScope::DefaultFinder())
|
||||
{
|
||||
return std::make_unique<CommandGroupItem>(
|
||||
name, items, pmf, flags, isEffect, finder
|
||||
name, std::move(items), pmf, flags, isEffect, finder
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -175,15 +175,16 @@ enum {
|
||||
kAlignTogether
|
||||
};
|
||||
|
||||
static const std::initializer_list< ComponentInterfaceSymbol > alignLabels{
|
||||
static const std::vector< ComponentInterfaceSymbol >
|
||||
&alignLabels() { static std::vector< ComponentInterfaceSymbol > symbols{
|
||||
{ wxT("StartToZero"), XO("Start to &Zero") },
|
||||
{ wxT("StartToSelStart"), XO("Start to &Cursor/Selection Start") },
|
||||
{ wxT("StartToSelEnd"), XO("Start to Selection &End") },
|
||||
{ wxT("EndToSelStart"), XO("End to Cu&rsor/Selection Start") },
|
||||
{ wxT("EndToSelEnd"), XO("End to Selection En&d") },
|
||||
};
|
||||
}; return symbols; }
|
||||
|
||||
const size_t kAlignLabelsCount = alignLabels.end() - alignLabels.begin();
|
||||
const size_t kAlignLabelsCount(){ return alignLabels().size(); }
|
||||
|
||||
void DoAlign
|
||||
(AudacityProject &project, int index, bool moveSel)
|
||||
@ -288,7 +289,7 @@ void DoAlign
|
||||
: XO("Align Together");
|
||||
}
|
||||
|
||||
if ((unsigned)index >= kAlignLabelsCount) {
|
||||
if ((unsigned)index >= kAlignLabelsCount()) {
|
||||
// This is an alignLabelsNoSync command.
|
||||
for (auto t : tracks.SelectedLeaders< AudioTrack >()) {
|
||||
// This shifts different tracks in different ways, so no sync-lock
|
||||
@ -884,7 +885,7 @@ void OnAlignNoSync(const CommandContext &context)
|
||||
auto &project = context.project;
|
||||
|
||||
DoAlign(project,
|
||||
context.index + kAlignLabelsCount, false);
|
||||
context.index + kAlignLabelsCount(), false);
|
||||
}
|
||||
|
||||
void OnAlign(const CommandContext &context)
|
||||
@ -1377,7 +1378,7 @@ MenuTable::BaseItemSharedPtr TracksMenu()
|
||||
|
||||
// Alignment commands using selection or zero
|
||||
CommandGroup(wxT("Align"),
|
||||
alignLabels,
|
||||
alignLabels(),
|
||||
FN(OnAlign), AudioIONotBusyFlag | TracksSelectedFlag),
|
||||
|
||||
Separator(),
|
||||
@ -1393,7 +1394,7 @@ MenuTable::BaseItemSharedPtr TracksMenu()
|
||||
// TODO: Can these labels be made clearer?
|
||||
// Do we need this sub-menu at all?
|
||||
Menu( wxT("MoveSelectionAndTracks"), XO("Move Sele&ction and Tracks"), {
|
||||
CommandGroup(wxT("AlignMove"), alignLabels,
|
||||
CommandGroup(wxT("AlignMove"), alignLabels(),
|
||||
FN(OnAlignMoveSel), AudioIONotBusyFlag | TracksSelectedFlag),
|
||||
} ),
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user