1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-18 17:47:41 +02:00

Remove a few small member functions from AudacityProject

This commit is contained in:
Paul Licameli 2019-03-27 04:29:30 -04:00
parent 69962f62d3
commit cfde442bcd
6 changed files with 6 additions and 27 deletions

View File

@ -797,7 +797,7 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) {
// there are no tracks, but there's an Undo history, etc, then // there are no tracks, but there's an Undo history, etc, then
// bad things can happen, including data files moving to the NEW // bad things can happen, including data files moving to the NEW
// project directory, etc. // project directory, etc.
if (proj && (proj->GetDirty() || !proj->GetIsEmpty())) if (proj && (proj->GetDirty() || !proj->GetTracks()->empty()))
proj = nullptr; proj = nullptr;
// This project is clean; it's never been touched. Therefore // This project is clean; it's never been touched. Therefore
// all relevant member variables are in their initial state, // all relevant member variables are in their initial state,

View File

@ -323,7 +323,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
gPrefs->Flush(); gPrefs->Flush();
AudacityProject *project = GetActiveProject(); AudacityProject *project = GetActiveProject();
if (!project->GetIsEmpty()) { if (!project->GetTracks()->empty()) {
AudacityMessageBox(_("Please save and close the current project first.")); AudacityMessageBox(_("Please save and close the current project first."));
return; return;
} }

View File

@ -508,10 +508,10 @@ CommandFlag MenuManager::GetUpdateFlags
if (project.RedoAvailable()) if (project.RedoAvailable())
flags |= RedoAvailableFlag; flags |= RedoAvailableFlag;
if (project.ZoomInAvailable() && (flags & TracksExistFlag)) if (project.GetViewInfo().ZoomInAvailable() && (flags & TracksExistFlag))
flags |= ZoomInAvailableFlag; flags |= ZoomInAvailableFlag;
if (project.ZoomOutAvailable() && (flags & TracksExistFlag)) if (project.GetViewInfo().ZoomOutAvailable() && (flags & TracksExistFlag))
flags |= ZoomOutAvailableFlag; flags |= ZoomOutAvailableFlag;
// TextClipFlag is currently unused (Jan 2017, 2.1.3 alpha) // TextClipFlag is currently unused (Jan 2017, 2.1.3 alpha)

View File

@ -1564,11 +1564,6 @@ void AudacityProject::SetProjectTitle( int number)
SetName(name); // to make the nvda screen reader read the correct title SetName(name); // to make the nvda screen reader read the correct title
} }
bool AudacityProject::GetIsEmpty()
{
return mTracks->empty();
}
bool AudacityProject::SnapSelection() bool AudacityProject::SnapSelection()
{ {
if (mSnapTo != SNAP_OFF) { if (mSnapTo != SNAP_OFF) {
@ -2521,7 +2516,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
} }
// MY: Use routine here so other processes can make same check // 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 // We may not bother to prompt the user to save, if the
// project is now empty. // project is now empty.
@ -5425,13 +5420,6 @@ bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) {
return bSuccess; 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) wxString AudacityProject::GetHoursMinsString(int iMinutes)
{ {

View File

@ -216,8 +216,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
sampleFormat GetDefaultFormat() { return mDefaultFormat; } sampleFormat GetDefaultFormat() { return mDefaultFormat; }
double GetRate() const { return mRate; } double GetRate() const { return mRate; }
bool ZoomInAvailable() const { return mViewInfo.ZoomInAvailable(); }
bool ZoomOutAvailable() const { return mViewInfo.ZoomOutAvailable(); }
const ZoomInfo &GetZoomInfo() const { return mViewInfo; } const ZoomInfo &GetZoomInfo() const { return mViewInfo; }
const ViewInfo &GetViewInfo() const { return mViewInfo; } const ViewInfo &GetViewInfo() const { return mViewInfo; }
ViewInfo &GetViewInfo() { return mViewInfo; } ViewInfo &GetViewInfo() { return mViewInfo; }
@ -226,9 +224,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
bool IsPlayRegionLocked() { return mLockPlayRegion; } bool IsPlayRegionLocked() { return mLockPlayRegion; }
void SetPlayRegionLocked(bool value) { mLockPlayRegion = value; } void SetPlayRegionLocked(bool value) { mLockPlayRegion = value; }
bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; }
wxString GetName(); wxString GetName();
const std::shared_ptr<DirManager> &GetDirManager(); const std::shared_ptr<DirManager> &GetDirManager();
TrackFactory *GetTrackFactory(); TrackFactory *GetTrackFactory();
@ -321,8 +316,6 @@ public:
const TrackPanel * GetTrackPanel() const {return mTrackPanel;} const TrackPanel * GetTrackPanel() const {return mTrackPanel;}
SelectionState &GetSelectionState() { return mSelectionState; } SelectionState &GetSelectionState() { return mSelectionState; }
bool GetIsEmpty();
bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
@ -348,8 +341,6 @@ public:
bool IsProjectSaved(); bool IsProjectSaved();
void ResetProjectToEmpty(); void ResetProjectToEmpty();
bool ProjectHasTracks();
// Routine to estimate how many minutes of recording time are left on disk // Routine to estimate how many minutes of recording time are left on disk
int GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels = 0); int GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels = 0);
// Converts number of minutes to human readable format // Converts number of minutes to human readable format

View File

@ -408,7 +408,7 @@ void OnTimerRecord(const CommandContext &context)
// preventing issues surrounding "dirty" projects when Automatic Save/Export // preventing issues surrounding "dirty" projects when Automatic Save/Export
// is used in Timer Recording. // is used in Timer Recording.
if ((undoManager.UnsavedChanges()) && 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."), AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
_("Timer Recording"), _("Timer Recording"),
wxICON_INFORMATION | wxOK); wxICON_INFORMATION | wxOK);