Skip to content

Commit

Permalink
Prevent duplication of time tracks via track menu
Browse files Browse the repository at this point in the history
Previously, it was possible to duplicate a time track via the track
options menu and clicking on "Duplicate Entire Track". However, Tenacity
only allows one time track per project. This issue has now been fixed by
checking for the presence of a time track.

Signed-off-by: Avery King <[email protected]>
  • Loading branch information
generic-pers0n committed Aug 29, 2024
1 parent e242193 commit 71d5db4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/tracks/ui/CommonTrackControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Paul Licameli split from TrackControls.cpp
#include "Project.h"
#include "../../ProjectHistory.h"
#include "../../ProjectWindows.h"
#include "../../TimeTrack.h"
#include "../../TrackArtist.h"
#include "../../TrackInfo.h"
#include "../../TrackPanelDrawingContext.h"
Expand All @@ -29,6 +30,7 @@ Paul Licameli split from TrackControls.cpp
#include "../../commands/AudacityCommand.h"
#include "../../commands/CommandManager.h"
#include "../../shuttle/ShuttleGui.h"
#include "../../widgets/AudacityMessageBox.h"
#include "../../widgets/PopupMenuTable.h"

#include <wx/dc.h>
Expand Down Expand Up @@ -263,6 +265,16 @@ void TrackMenuTable::OnDuplicateTrack(wxCommandEvent&)
{
TenacityProject& project = mpData->project;
TrackList& tracks = TrackList::Get(project);

if (*tracks.Any<TimeTrack>().begin())
{
AudacityMessageBox(
XO("This version of Tenacity only allows one time track for each project window.")
);

return;
}

auto dupTrack = track->Duplicate();
tracks.Add(dupTrack);

Expand Down

0 comments on commit 71d5db4

Please sign in to comment.