1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Move AudacityProject::Clear

This commit is contained in:
Paul Licameli 2018-10-27 19:00:21 -04:00
parent 0969d00b1b
commit 95cca91eb1
3 changed files with 20 additions and 23 deletions

View File

@ -4739,26 +4739,6 @@ void AudacityProject::ClearClipboard()
}
}
void AudacityProject::Clear()
{
for (auto n : GetTracks()->Any()) {
if (n->GetSelected() || n->IsSyncLockSelected()) {
n->Clear(mViewInfo.selectedRegion.t0(), mViewInfo.selectedRegion.t1());
}
}
double seconds = mViewInfo.selectedRegion.duration();
mViewInfo.selectedRegion.collapseToT0();
PushState(wxString::Format(_("Deleted %.2f seconds at t=%.2f"),
seconds,
mViewInfo.selectedRegion.t0()),
_("Delete"));
RedrawProject();
}
// Utility function called by other zoom methods
void AudacityProject::Zoom(double level)
{

View File

@ -318,8 +318,6 @@ private:
bool DoSave(bool fromSaveAs, bool bWantSaveCopy, bool bLossless = false);
public:
void Clear();// clears a selection
const wxString &GetFileName() { return mFileName; }
bool GetDirty() { return mDirty; }
void SetProjectTitle( int number =-1);

View File

@ -364,9 +364,28 @@ void OnCut(const CommandContext &context)
void OnDelete(const CommandContext &context)
{
auto &project = context.project;
project.Clear();
auto &tracks = *project.GetTracks();
auto &selectedRegion = project.GetViewInfo().selectedRegion;
for (auto n : tracks.Any()) {
if (n->GetSelected() || n->IsSyncLockSelected()) {
n->Clear(selectedRegion.t0(), selectedRegion.t1());
}
}
double seconds = selectedRegion.duration();
selectedRegion.collapseToT0();
project.PushState(wxString::Format(_("Deleted %.2f seconds at t=%.2f"),
seconds,
selectedRegion.t0()),
_("Delete"));
project.RedrawProject();
}
void OnCopy(const CommandContext &context)
{
auto &project = context.project;