From cfde442bcdd1fdf3cd6772a2ee6d3a5241a37747 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 27 Mar 2019 04:29:30 -0400 Subject: [PATCH] Remove a few small member functions from AudacityProject --- src/AudacityApp.cpp | 2 +- src/BatchProcessDialog.cpp | 2 +- src/Menus.cpp | 4 ++-- src/Project.cpp | 14 +------------- src/Project.h | 9 --------- src/menus/TransportMenus.cpp | 2 +- 6 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 9ba487a01..d9f4fe337 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -797,7 +797,7 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) { // there are no tracks, but there's an Undo history, etc, then // bad things can happen, including data files moving to the NEW // project directory, etc. - if (proj && (proj->GetDirty() || !proj->GetIsEmpty())) + if (proj && (proj->GetDirty() || !proj->GetTracks()->empty())) proj = nullptr; // This project is clean; it's never been touched. Therefore // all relevant member variables are in their initial state, diff --git a/src/BatchProcessDialog.cpp b/src/BatchProcessDialog.cpp index 85e505581..3cc0fb99e 100644 --- a/src/BatchProcessDialog.cpp +++ b/src/BatchProcessDialog.cpp @@ -323,7 +323,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event)) gPrefs->Flush(); AudacityProject *project = GetActiveProject(); - if (!project->GetIsEmpty()) { + if (!project->GetTracks()->empty()) { AudacityMessageBox(_("Please save and close the current project first.")); return; } diff --git a/src/Menus.cpp b/src/Menus.cpp index 3e3b317a1..a17941644 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -508,10 +508,10 @@ CommandFlag MenuManager::GetUpdateFlags if (project.RedoAvailable()) flags |= RedoAvailableFlag; - if (project.ZoomInAvailable() && (flags & TracksExistFlag)) + if (project.GetViewInfo().ZoomInAvailable() && (flags & TracksExistFlag)) flags |= ZoomInAvailableFlag; - if (project.ZoomOutAvailable() && (flags & TracksExistFlag)) + if (project.GetViewInfo().ZoomOutAvailable() && (flags & TracksExistFlag)) flags |= ZoomOutAvailableFlag; // TextClipFlag is currently unused (Jan 2017, 2.1.3 alpha) diff --git a/src/Project.cpp b/src/Project.cpp index 733261b46..11e8732f0 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1564,11 +1564,6 @@ void AudacityProject::SetProjectTitle( int number) SetName(name); // to make the nvda screen reader read the correct title } -bool AudacityProject::GetIsEmpty() -{ - return mTracks->empty(); -} - bool AudacityProject::SnapSelection() { if (mSnapTo != SNAP_OFF) { @@ -2521,7 +2516,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) } // MY: Use routine here so other processes can make same check - bool bHasTracks = ProjectHasTracks(); + bool bHasTracks = !GetTracks()->empty(); // We may not bother to prompt the user to save, if the // project is now empty. @@ -5425,13 +5420,6 @@ bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) { return bSuccess; } -// Does the project have any tracks? -bool AudacityProject::ProjectHasTracks() { - // Test for an 'empty' project. - // of course it could still have a history at this stage. - return ! ( GetTracks()->Any() ).empty(); -} - wxString AudacityProject::GetHoursMinsString(int iMinutes) { diff --git a/src/Project.h b/src/Project.h index 0ac530eb1..345562306 100644 --- a/src/Project.h +++ b/src/Project.h @@ -216,8 +216,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, sampleFormat GetDefaultFormat() { return mDefaultFormat; } double GetRate() const { return mRate; } - bool ZoomInAvailable() const { return mViewInfo.ZoomInAvailable(); } - bool ZoomOutAvailable() const { return mViewInfo.ZoomOutAvailable(); } const ZoomInfo &GetZoomInfo() const { return mViewInfo; } const ViewInfo &GetViewInfo() const { return mViewInfo; } ViewInfo &GetViewInfo() { return mViewInfo; } @@ -226,9 +224,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, bool IsPlayRegionLocked() { return mLockPlayRegion; } void SetPlayRegionLocked(bool value) { mLockPlayRegion = value; } - - bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; } - wxString GetName(); const std::shared_ptr &GetDirManager(); TrackFactory *GetTrackFactory(); @@ -321,8 +316,6 @@ public: const TrackPanel * GetTrackPanel() const {return mTrackPanel;} SelectionState &GetSelectionState() { return mSelectionState; } - bool GetIsEmpty(); - bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda @@ -348,8 +341,6 @@ public: bool IsProjectSaved(); void ResetProjectToEmpty(); - bool ProjectHasTracks(); - // Routine to estimate how many minutes of recording time are left on disk int GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels = 0); // Converts number of minutes to human readable format diff --git a/src/menus/TransportMenus.cpp b/src/menus/TransportMenus.cpp index 943c295bd..00155c116 100644 --- a/src/menus/TransportMenus.cpp +++ b/src/menus/TransportMenus.cpp @@ -408,7 +408,7 @@ void OnTimerRecord(const CommandContext &context) // preventing issues surrounding "dirty" projects when Automatic Save/Export // is used in Timer Recording. if ((undoManager.UnsavedChanges()) && - (project.ProjectHasTracks() || project.EmptyCanBeDirty())) { + (project.GetTracks()->Any() || project.EmptyCanBeDirty())) { AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."), _("Timer Recording"), wxICON_INFORMATION | wxOK);