Audacity  2.3.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
AudacityProject Class Referencefinal

AudacityProject provides the main window, with tools and tracks contained within it. More...

#include <Project.h>

Inheritance diagram for AudacityProject:
TrackPanelListener SelectionBarListener SpectralSelectionBarListener XMLTagHandler AudioIOListener

Classes

class  PlaybackScroller
 
class  RegisteredAttachedObjectFactory
 

Public Types

using AttachedObject = PrefsListener
 
using AttachedObjectFactory = std::function< std::unique_ptr< AttachedObject >() >
 

Public Member Functions

 AudacityProject (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
 
virtual ~AudacityProject ()
 
AttachedObjectGetAttachedObject (const RegisteredAttachedObjectFactory &factory)
 
virtual void ApplyUpdatedTheme ()
 
AudioIOStartStreamOptions GetDefaultPlayOptions ()
 
AudioIOStartStreamOptions GetSpeedPlayOptions ()
 
TrackListGetTracks ()
 
const TrackListGetTracks () const
 
size_t GetTrackCount () const
 
UndoManagerGetUndoManager ()
 
sampleFormat GetDefaultFormat ()
 
double GetRate () const
 
bool ZoomInAvailable () const
 
bool ZoomOutAvailable () const
 
const SelectedRegionGetSelection () const
 
SelectedRegionGetSelection ()
 
double GetSel0 () const
 
double GetSel1 () const
 
const ZoomInfoGetZoomInfo () const
 
const ViewInfoGetViewInfo () const
 
ViewInfoGetViewInfo ()
 
void GetPlayRegion (double *playRegionStart, double *playRegionEnd)
 
bool IsPlayRegionLocked ()
 
void SetPlayRegionLocked (bool value)
 
void SetSel0 (double)
 
void SetSel1 (double)
 
bool Clipboard ()
 
wxString GetName ()
 
const std::shared_ptr
< DirManager > & 
GetDirManager ()
 
TrackFactoryGetTrackFactory ()
 
AdornedRulerPanelGetRulerPanel ()
 
const TagsGetTags ()
 
void SetTags (const std::shared_ptr< Tags > &tags)
 
int GetAudioIOToken () const
 
bool IsAudioActive () const
 
void SetAudioIOToken (int token)
 
bool IsActive () override
 
void OpenFile (const wxString &fileName, bool addtohistory=true)
 
bool WarnOfLegacyFile ()
 
bool Import (const wxString &fileName, WaveTrackArray *pTrackArray=NULL)
 
void ZoomAfterImport (Track *pTrack)
 
std::vector< std::shared_ptr
< Track > > 
AddImportedTracks (const wxString &fileName, TrackHolders &&newTracks)
 
bool Save ()
 
bool SaveAs (bool bWantSaveCopy=false, bool bLossless=false)
 
bool SaveAs (const wxString &newFileName, bool bWantSaveCopy=false, bool addToHistory=true)
 
bool SaveCopyWaveTracks (const wxString &strProjectPathName, bool bLossless=false)
 
const wxString & GetFileName ()
 
bool GetDirty ()
 
void SetProjectTitle (int number=-1)
 
wxPanel * GetTopPanel ()
 
TrackPanelGetTrackPanel ()
 
const TrackPanelGetTrackPanel () const
 
SelectionStateGetSelectionState ()
 
bool GetIsEmpty ()
 
bool GetTracksFitVerticallyZoomed ()
 
void SetTracksFitVerticallyZoomed (bool flag)
 
bool GetShowId3Dialog ()
 
void SetShowId3Dialog (bool flag)
 
bool GetNormalizeOnLoad ()
 
void SetNormalizeOnLoad (bool flag)
 
void SetMissingAliasFileDialog (wxDialog *dialog)
 Sets the wxDialog that is being displayed Used by the custom dialog warning constructor and destructor. More...
 
wxDialog * GetMissingAliasFileDialog ()
 returns a pointer to the wxDialog if it is displayed, NULL otherwise. More...
 
bool SaveFromTimerRecording (wxFileName fnFile)
 
bool ExportFromTimerRecording (wxFileName fnFile, int iFormat, int iSubFormat, int iFilterIndex)
 
bool IsProjectSaved ()
 
void ResetProjectToEmpty ()
 
bool ProjectHasTracks ()
 
int GetEstimatedRecordingMinsLeftOnDisk (long lCaptureChannels=0)
 
wxString GetHoursMinsString (int iMinutes)
 
CommandManagerGetCommandManager ()
 
const CommandManagerGetCommandManager () const
 
void MayStartMonitoring ()
 
void OnMenu (wxCommandEvent &event)
 
void OnUpdateUI (wxUpdateUIEvent &event)
 
void MacShowUndockedToolbars (bool show)
 
void OnActivate (wxActivateEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void OnIconize (wxIconizeEvent &event)
 
void OnSize (wxSizeEvent &event)
 
void OnShow (wxShowEvent &event)
 
void OnMove (wxMoveEvent &event)
 
void DoScroll ()
 
void OnScroll (wxScrollEvent &event)
 
void OnCloseWindow (wxCloseEvent &event)
 
void OnTimer (wxTimerEvent &event)
 
void OnToolBarUpdate (wxCommandEvent &event)
 
void OnOpenAudioFile (wxCommandEvent &event)
 
void OnODTaskUpdate (wxCommandEvent &event)
 Handles the redrawing necessary for tasks as they partially update in the background. More...
 
void OnODTaskComplete (wxCommandEvent &event)
 
void HandleResize ()
 
void UpdateLayout ()
 
double GetScreenEndTime () const
 
void ZoomInByFactor (double ZoomFactor)
 
void ZoomOutByFactor (double ZoomFactor)
 
int GetProjectNumber ()
 
void UpdatePrefs ()
 
void UpdatePrefsVariables ()
 
void RedrawProject (const bool bForceWaveTracks=false)
 
void RefreshCursor ()
 
void SelectNone ()
 
void SelectAllIfNone ()
 
void StopIfPaused ()
 
void Zoom (double level)
 
void ZoomBy (double multiplier)
 
void Rewind (bool shift)
 
void SkipEnd (bool shift)
 
bool IsSyncLocked ()
 
void SetSyncLock (bool flag)
 
void SetSnapTo (int snap)
 
int GetSnapTo () const
 
void SetSelectionFormat (const NumericFormatId &format)
 
const NumericFormatIdGetSelectionFormat () const
 
void SetFrequencySelectionFormatName (const NumericFormatId &format)
 
const NumericFormatIdGetFrequencySelectionFormatName () const
 
void SetBandwidthSelectionFormatName (const NumericFormatId &format)
 
const NumericFormatIdGetBandwidthSelectionFormatName () const
 
void OnScrollLeft ()
 
void OnScrollRight ()
 
void OnScrollLeftButton (wxScrollEvent &event)
 
void OnScrollRightButton (wxScrollEvent &event)
 
void FinishAutoScroll ()
 
void FixScrollbars ()
 
bool MayScrollBeyondZero () const
 
double ScrollingLowerBoundTime () const
 
double PixelWidthBeforeTime (double scrollto) const
 
void SetHorizontalThumb (double scrollto)
 
wxSize GetTPTracksUsableArea ()
 
void RefreshTPTrack (Track *pTrk, bool refreshbacking=true)
 
void TP_DisplaySelection () override
 
void TP_DisplayStatusMessage (const wxString &msg) override
 
ToolsToolBarTP_GetToolsToolBar () override
 
void TP_PushState (const wxString &longDesc, const wxString &shortDesc, UndoPush flags) override
 
void TP_ModifyState (bool bWantsAutoSave) override
 
void TP_RedrawScrollbars () override
 
void TP_ScrollLeft () override
 
void TP_ScrollRight () override
 
void TP_ScrollWindow (double scrollto) override
 
bool TP_ScrollUpDown (int delta) override
 
void TP_HandleResize () override
 
ControlToolBarGetControlToolBar ()
 
DeviceToolBarGetDeviceToolBar ()
 
EditToolBarGetEditToolBar ()
 
MixerToolBarGetMixerToolBar ()
 
ScrubbingToolBarGetScrubbingToolBar ()
 
SelectionBarGetSelectionBar ()
 
SpectralSelectionBarGetSpectralSelectionBar ()
 
ToolsToolBarGetToolsToolBar ()
 
const ToolsToolBarGetToolsToolBar () const
 
TranscriptionToolBarGetTranscriptionToolBar ()
 
MeterPanelGetPlaybackMeter ()
 
void SetPlaybackMeter (MeterPanel *playback)
 
MeterPanelGetCaptureMeter ()
 
void SetCaptureMeter (MeterPanel *capture)
 
LyricsWindowGetLyricsWindow (bool create=false)
 
MixerBoardFrameGetMixerBoardFrame (bool create=false)
 
HistoryWindowGetHistoryWindow (bool create=false)
 
MacrosWindowGetMacrosWindow (bool bExpanded, bool create=false)
 
FreqWindowGetFreqWindow (bool create=false)
 
ContrastDialogGetContrastDialog (bool create=false)
 
wxStatusBar * GetStatusBar ()
 
double AS_GetRate () override
 
void AS_SetRate (double rate) override
 
int AS_GetSnapTo () override
 
void AS_SetSnapTo (int snap) override
 
const NumericFormatIdAS_GetSelectionFormat () override
 
void AS_SetSelectionFormat (const NumericFormatId &format) override
 
void AS_ModifySelection (double &start, double &end, bool done) override
 
double SSBL_GetRate () const override
 
const NumericFormatIdSSBL_GetFrequencySelectionFormatName () override
 
void SSBL_SetFrequencySelectionFormatName (const NumericFormatId &formatName) override
 
const NumericFormatIdSSBL_GetBandwidthSelectionFormatName () override
 
void SSBL_SetBandwidthSelectionFormatName (const NumericFormatId &formatName) override
 
void SSBL_ModifySpectralSelection (double &bottom, double &top, bool done) override
 
void SetStateTo (unsigned int n)
 
bool HandleXMLTag (const wxChar *tag, const wxChar **attrs) override
 
XMLTagHandlerHandleXMLChild (const wxChar *tag) override
 
void WriteXML (XMLWriter &xmlFile, bool bWantSaveCopy)
 
void WriteXMLHeader (XMLWriter &xmlFile) const
 
void OnAudioIORate (int rate) override
 
void OnAudioIOStartRecording () override
 
void OnAudioIOStopRecording () override
 
void OnAudioIONewBlockFiles (const AutoSaveFile &blockFileLog) override
 
bool UndoAvailable ()
 
bool RedoAvailable ()
 
void PushState (const wxString &desc, const wxString &shortDesc)
 
void PushState (const wxString &desc, const wxString &shortDesc, UndoPush flags)
 
void RollbackState ()
 
void ModifyState (bool bWantsAutoSave)
 
void PopState (const UndoState &state)
 
void AutoSave ()
 
void DeleteCurrentAutoSaveFile ()
 
bool IsSoloSimple () const
 
bool IsSoloNone () const
 
wxScrollBar & GetVerticalScrollBar ()
 
ToolManagerGetToolManager ()
 
void SetNormalizedWindowState (wxRect pSizeAndLocation)
 
wxRect GetNormalizedWindowState () const
 
bool IsTimerRecordCancelled ()
 
void SetTimerRecordCancelled ()
 
void ResetTimerRecordCancelled ()
 
void SortTracks (int flags)
 
bool EmptyCanBeDirty () const
 
void SetMenuClose (bool value)
 
bool IsCapturing () const
 
ScrubberGetScrubber ()
 
const ScrubberGetScrubber () const
 
PlaybackScrollerGetPlaybackScroller ()
 
std::shared_ptr< BackgroundCellGetBackgroundCell () const
 
bool IsFocused (const wxWindow *window) const
 
- Public Member Functions inherited from TrackPanelListener
 TrackPanelListener ()
 
virtual ~TrackPanelListener ()
 
- Public Member Functions inherited from SelectionBarListener
 SelectionBarListener ()
 
virtual ~SelectionBarListener ()
 
- Public Member Functions inherited from SpectralSelectionBarListener
 SpectralSelectionBarListener ()
 
virtual ~SpectralSelectionBarListener ()
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
 
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
 
bool ReadXMLTag (const char *tag, const char **attrs)
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 
- Public Member Functions inherited from AudioIOListener
 AudioIOListener ()
 
virtual ~AudioIOListener ()
 

Static Public Member Functions

static wxArrayString ShowOpenDialog (const wxString &extraformat=wxEmptyString, const wxString &extrafilter=wxEmptyString)
 Show an open dialogue for opening audio files, and possibly other sorts of files. More...
 
static bool IsAlreadyOpen (const wxString &projPathName)
 
static void OpenFiles (AudacityProject *proj)
 
static AudacityProjectOpenProject (AudacityProject *pProject, const wxString &fileNameArg, bool addtohistory=true)
 
static int GetOpenProjectCount ()
 
static bool HasKeyboardCapture (const wxWindow *handler)
 
static wxWindow * GetKeyboardCaptureHandler ()
 
static void CaptureKeyboard (wxWindow *handler)
 
static void ReleaseKeyboard (wxWindow *handler)
 
static TrackListGetClipboardTracks ()
 
static void ClearClipboard ()
 
static void DeleteClipboard ()
 
static int CountUnnamed ()
 
static void RefreshAllTitles (bool bShowProjectNumbers)
 
static ODLockAllProjectDeleteMutex ()
 Prevents DELETE from external thread - for e.g. use of GetActiveProject. More...
 

Public Attributes

PlayMode mLastPlayMode { PlayMode::normalPlay }
 
ViewInfo mViewInfo
 
bool mShowSplashScreen
 
wxString mHelpPref
 
wxString mSoloPref
 
bool mbBusyImporting { false }
 
int mBatchMode { 0 }
 
wxWindowRef mFocusLender
 

Static Public Attributes

static std::shared_ptr< TrackListmsClipboard { TrackList::Create() }
 
static AudacityProjectmsClipProject = NULL
 
static double msClipT0 = 0.0
 
static double msClipT1 = 0.0
 

Private Member Functions

void EnqueueODTasks ()
 
bool DoSave (bool fromSaveAs, bool bWantSaveCopy, bool bLossless=false)
 
bool SnapSelection ()
 
void OnCapture (wxCommandEvent &evt)
 
void InitialState ()
 
void RestartTimer ()
 

Private Attributes

wxString mFileName
 
bool mbLoadedFromAup
 
std::shared_ptr< DirManagermDirManager
 
int mProjectNo
 
double mRate
 
sampleFormat mDefaultFormat
 
std::shared_ptr< TagsmTags
 
std::shared_ptr< TrackListmTracks
 
int mSnapTo
 
NumericFormatId mSelectionFormat
 
NumericFormatId mFrequencySelectionFormatName
 
NumericFormatId mBandwidthSelectionFormatName
 
std::shared_ptr< TrackListmLastSavedTracks
 
std::unique_ptr< UndoManagermUndoManager
 
bool mDirty { false }
 
std::unique_ptr< CommandManagermCommandManager
 
wxString mLastMainStatusMessage
 
std::unique_ptr< wxTimer > mTimer
 
wxStatusBar * mStatusBar
 
AdornedRulerPanelmRuler {}
 
wxPanel * mTopPanel {}
 
TrackPanelmTrackPanel {}
 
SelectionState mSelectionState {}
 
std::unique_ptr< TrackFactorymTrackFactory {}
 
wxPanel * mMainPanel
 
wxScrollBar * mHsbar
 
wxScrollBar * mVsbar
 
bool mAutoScrolling { false }
 
bool mActive { true }
 
bool mIconized
 
MacrosWindowmMacrosWindow {}
 
HistoryWindowmHistoryWindow {}
 
LyricsWindowmLyricsWindow {}
 
MixerBoardFramemMixerBoardFrame {}
 
MixerBoardmMixerBoard {}
 
Destroy_ptr< FreqWindowmFreqWindow
 
Destroy_ptr< ContrastDialogmContrastDialog
 
wxDialog * mAliasMissingWarningDialog {}
 
bool mShownOnce { false }
 
MeterPanelmPlaybackMeter {}
 
MeterPanelmCaptureMeter {}
 
std::unique_ptr< ToolManagermToolManager
 
int mAudioIOToken { -1 }
 
bool mIsDeleting { false }
 
bool mTracksFitVerticallyZoomed { false }
 
bool mNormalizeOnLoad
 
bool mShowId3Dialog { true }
 
bool mEmptyCanBeDirty
 
bool mIsSyncLocked
 
bool mLockPlayRegion
 
std::unique_ptr
< ImportXMLTagHandler
mImportXMLTagHandler
 
wxString mAutoSaveFileName
 
bool mAutoSaving { false }
 
bool mIsRecovered { false }
 
wxString mRecoveryAutoSaveDataDir
 
std::unique_ptr
< RecordingRecoveryHandler
mRecordingRecoveryHandler
 
bool mImportedDependencies { false }
 
wxArrayString mStrOtherNamesArray
 
wxRect mNormalizedWindowState
 
bool mTimerRecordCanceled { false }
 
bool mMenuClose { false }
 
bool mbInitializingScrollbar { false }
 
bool mIsCapturing { false }
 
wxWindow * mKeyboardCaptureHandler {}
 
bool mIsBeingDeleted { false }
 
std::unique_ptr< OverlaymIndicatorOverlay
 
std::unique_ptr< OverlaymCursorOverlay
 
std::shared_ptr< BackgroundCellmBackgroundCell
 
std::unique_ptr< OverlaymScrubOverlay
 
std::unique_ptr< ScrubbermScrubber
 
std::vector< std::unique_ptr
< AttachedObject > > 
mAttachedObjects
 
std::unique_ptr< MenuManagermMenuManager
 
std::unique_ptr< PlaybackScrollermPlaybackScroller
 

Static Private Attributes

static int mProjectCounter =0
 

Friends

class CommandManager
 
MenuManagerGetMenuManager (AudacityProject &project)
 

Detailed Description

AudacityProject provides the main window, with tools and tracks contained within it.

In Audacity, the main window you work in is called a project. AudacityProjects can contain an arbitrary number of tracks of many different types, but if a project contains just one or two tracks then it can be saved in standard formats like WAV or AIFF. This window is the one that contains the menu bar (except on the Mac).

Attention
The menu functions for AudacityProject, those for creating the menu bars and acting on clicks, are found in file Menus.cpp

Definition at line 174 of file Project.h.

Member Typedef Documentation

Definition at line 186 of file Project.h.

using AudacityProject::AttachedObjectFactory = std::function< std::unique_ptr<AttachedObject>() >

Definition at line 188 of file Project.h.

Constructor & Destructor Documentation

AudacityProject::AudacityProject ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size 
)

Definition at line 983 of file Project.cpp.

References _(), AUDACITY_VERSION_STRING, AudacityProjectTimerID, ThemeBase::Bitmap(), ThemeBase::Colour(), TrackList::Create(), factory, TrackPanel::FactoryFunction, RefreshCode::FixScrollbars, AudioIO::GetOptimalSupportedSampleRate(), AdornedRulerPanel::GetRulerHeight(), gPrefs, mainStatusBarField, OnCapture(), ViewInfo::OnTimer(), safenew, AudacityApp::SetMissingAliasedFileWarningShouldShow(), theTheme, TrackPanelID, TrackInfo::UpdatePrefs(), and wxGetApp().

986  : wxFrame(parent, id, _TS("Audacity"), pos, size),
987  mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom()),
988  mbLoadedFromAup( false ),
990  mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
993  gPrefs->Read(wxT("/SelectionFormat"), wxT("")) ) ),
996  gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT("")) ) ),
999  gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) ),
1000  mUndoManager(std::make_unique<UndoManager>())
1001  , mCommandManager( std::make_unique<CommandManager>() )
1002 {
1003  if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate())) {
1004  // The default given above can vary with host/devices. So unless there is an entry for
1005  // the default sample rate in audacity.cfg, Audacity can open with a rate which is different
1006  // from the rate with which it closed. See bug 1879.
1007  gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mRate);
1008  gPrefs->Flush();
1009  }
1010 
1012 
1013 #ifdef EXPERIMENTAL_DA2
1014  SetBackgroundColour(theTheme.Colour( clrMedium ));
1015 #endif
1016  // Note that the first field of the status bar is a dummy, and it's width is set
1017  // to zero latter in the code. This field is needed for wxWidgets 2.8.12 because
1018  // if you move to the menu bar, the first field of the menu bar is cleared, which
1019  // is undesirable behaviour.
1020  // In addition, the help strings of menu items are by default sent to the first
1021  // field. Currently there are no such help strings, but it they were introduced, then
1022  // there would need to be an event handler to send them to the appropriate field.
1023  mStatusBar = CreateStatusBar(4);
1024 #if wxUSE_ACCESSIBILITY
1025  // so that name can be set on a standard control
1026  mStatusBar->SetAccessible(safenew WindowAccessible(mStatusBar));
1027 #endif
1028  mStatusBar->SetName(wxT("status_line")); // not localized
1029  mProjectNo = mProjectCounter++; // Bug 322
1030 
1032 
1033  // MM: DirManager is created dynamically, freed on demand via ref-counting
1034  // MM: We don't need to Ref() here because it start with refcount=1
1035  mDirManager = std::make_shared<DirManager>();
1036 
1037  mLastSavedTracks.reset();
1038 
1039  //
1040  // Initialize view info (shared with TrackPanel)
1041  //
1042 
1043  {
1044  ObjectFactorySetLocker locker;
1045  for (const auto &factory : sObjectFactories()) {
1046  auto pObject = factory();
1047  wxASSERT( pObject );
1048  mAttachedObjects.push_back( std::move( pObject ) );
1049  }
1050  }
1051 
1052  mMenuManager = std::make_unique<MenuManager>();
1053 
1054  UpdatePrefs();
1055 
1056  mLockPlayRegion = false;
1057 
1058  // Make sure valgrind sees mIsSyncLocked is initialized, even
1059  // though we're about to set it from prefs.
1060  mIsSyncLocked = false;
1061  gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
1062 
1063  // LLL: Read this!!!
1064  //
1065  // Until the time (and cpu) required to refresh the track panel is
1066  // reduced, leave the following window creations in the order specified.
1067  // This will place the refresh of the track panel last, allowing all
1068  // the others to get done quickly.
1069  //
1070  // Near as I can tell, this is only a problem under Windows.
1071  //
1072 
1073 
1074  // PRL: this panel groups the top tool dock and the ruler into one
1075  // tab cycle.
1076  // Must create it with non-default width equal to the main window width,
1077  // or else the device toolbar doesn't make initial widths of the choice
1078  // controls correct.
1080  this, wxID_ANY, wxDefaultPosition,
1081  wxSize{ this->GetSize().GetWidth(), -1 }
1082  };
1083  mTopPanel->SetLabel( "Top Panel" );// Not localised
1084  mTopPanel->SetLayoutDirection(wxLayout_LeftToRight);
1085  mTopPanel->SetAutoLayout(true);
1086 #ifdef EXPERIMENTAL_DA2
1087  mTopPanel->SetBackgroundColour(theTheme.Colour( clrMedium ));
1088 #endif
1089 
1090  //
1091  // Create the ToolDock
1092  //
1093  mToolManager = std::make_unique<ToolManager>( this, mTopPanel );
1094  GetSelectionBar()->SetListener(this);
1095 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
1097 #endif
1098  mToolManager->LayoutToolBars();
1099 
1100  //
1101  // Create the horizontal ruler
1102  //
1104  wxID_ANY,
1105  wxDefaultPosition,
1106  wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ),
1107  &mViewInfo );
1108  mRuler->SetLayoutDirection(wxLayout_LeftToRight);
1109 
1110  //
1111  // Create the TrackPanel and the scrollbars
1112  //
1113  wxWindow * pPage;
1114 
1115 #ifdef EXPERIMENTAL_NOTEBOOK
1116  // We are using a notebook (tabbed panel), so we create the notebook and add pages.
1117  GuiFactory Factory;
1118  wxNotebook * pNotebook;
1119  mMainPanel = Factory.AddPanel(
1120  this, wxPoint( left, top ), wxSize( width, height ) );
1121  pNotebook = Factory.AddNotebook( mMainPanel );
1122  /* i18n-hint: This is an experimental feature where the main panel in
1123  Audacity is put on a notebook tab, and this is the name on that tab.
1124  Other tabs in that notebook may have instruments, patch panels etc.*/
1125  pPage = Factory.AddPage( pNotebook, _("Main Mix"));
1126 #else
1127  // Not using a notebook, so we place the track panel inside another panel,
1128  // this keeps the notebook code and normal code consistant and also
1129  // paves the way for adding additional windows inside the track panel.
1130  mMainPanel = safenew wxPanelWrapper(this, -1,
1131  wxDefaultPosition,
1132  wxDefaultSize,
1133  wxNO_BORDER);
1134  mMainPanel->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
1135  mMainPanel->SetLabel("Main Panel");// Not localised.
1136  pPage = mMainPanel;
1137  // Set the colour here to the track panel background to avoid
1138  // flicker when Audacity starts up.
1139  // However, that leads to areas next to the horizontal scroller
1140  // being painted in background colour and not scroller background
1141  // colour, so suppress this for now.
1142  //pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
1143 #endif
1144  pPage->SetLayoutDirection(wxLayout_LeftToRight);
1145 
1146 #ifdef EXPERIMENTAL_DA2
1147  pPage->SetBackgroundColour(theTheme.Colour( clrMedium ));
1148 #endif
1149 
1150  {
1151  auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1152  ubs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP);
1153  ubs->Add(mRuler, 0, wxEXPAND);
1154  mTopPanel->SetSizer(ubs.release());
1155  }
1156 
1157  wxBoxSizer *bs;
1158  {
1159  auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1160  bs = ubs.get();
1161  bs->Add(mTopPanel, 0, wxEXPAND | wxALIGN_TOP);
1162  bs->Add(pPage, 1, wxEXPAND);
1163  bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
1164  SetAutoLayout(true);
1165  SetSizer(ubs.release());
1166  }
1167  bs->Layout();
1168 
1169  // The right hand side translates to NEW TrackPanel(...) in normal
1170  // Audacity without additional DLLs.
1172  TrackPanelID,
1173  wxDefaultPosition,
1174  wxDefaultSize,
1175  mTracks,
1176  &mViewInfo,
1177  this,
1178  mRuler);
1180 
1181  mIndicatorOverlay = std::make_unique<PlayIndicatorOverlay>(this);
1182 
1183  mCursorOverlay = std::make_unique<EditCursorOverlay>(this);
1184 
1185  mBackgroundCell = std::make_shared<BackgroundCell>(this);
1186 
1187 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1188  mScrubOverlay = std::make_unique<ScrubbingOverlay>(this);
1189  mScrubber = std::make_unique<Scrubber>(this);
1190 #endif
1191 
1192  // More order dependencies here...
1193  // This must follow construction of *mIndicatorOverlay, because it must
1194  // attach its timer event handler later (so that its handler is invoked
1195  // earlier)
1196  mPlaybackScroller = std::make_unique<PlaybackScroller>(this);
1197 
1198  // This must follow construction of *mPlaybackScroller,
1199  // because it must
1200  // attach its timer event handler later (so that its handler is invoked
1201  // earlier)
1202  this->Bind(EVT_TRACK_PANEL_TIMER,
1204  &mViewInfo);
1205 
1206  // Add the overlays, in the sequence in which they will be painted
1208  mTrackPanel->AddOverlay(mCursorOverlay.get());
1209 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1210  mTrackPanel->AddOverlay(mScrubOverlay.get());
1211 #endif
1212 
1213  mMenuManager->CreateMenusAndCommands(*this);
1214 
1215  mTrackPanel->SetBackgroundCell(mBackgroundCell);
1216 
1217  // LLL: When Audacity starts or becomes active after returning from
1218  // another application, the first window that can accept focus
1219  // will be given the focus even if we try to SetFocus(). By
1220  // creating the scrollbars after the TrackPanel, we resolve
1221  // several focus problems.
1222  mHsbar = safenew ScrollBar(pPage, HSBarID, wxSB_HORIZONTAL);
1223  mVsbar = safenew ScrollBar(pPage, VSBarID, wxSB_VERTICAL);
1224 #if wxUSE_ACCESSIBILITY
1225  // so that name can be set on a standard control
1226  mHsbar->SetAccessible(safenew WindowAccessible(mHsbar));
1227  mVsbar->SetAccessible(safenew WindowAccessible(mVsbar));
1228 #endif
1229  mHsbar->SetLayoutDirection(wxLayout_LeftToRight);
1230  mHsbar->SetName(_("Horizontal Scrollbar"));
1231  mVsbar->SetName(_("Vertical Scrollbar"));
1232  // LLL: When Audacity starts or becomes active after returning from
1233  // another application, the first window that can accept focus
1234  // will be given the focus even if we try to SetFocus(). By
1235  // making the TrackPanel that first window, we resolve several
1236  // keyboard focus problems.
1237  pPage->MoveBeforeInTabOrder(mTopPanel);
1238 
1239  bs = (wxBoxSizer *)pPage->GetSizer();
1240 
1241  {
1242  // Top horizontal grouping
1243  auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
1244 
1245  // Track panel
1246  hs->Add(mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
1247 
1248  {
1249  // Vertical grouping
1250  auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1251 
1252  // Vertical scroll bar
1253  vs->Add(mVsbar, 1, wxEXPAND | wxALIGN_TOP);
1254  hs->Add(vs.release(), 0, wxEXPAND | wxALIGN_TOP);
1255  }
1256 
1257  bs->Add(hs.release(), 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
1258  }
1259 
1260  {
1261  // Bottom horizontal grouping
1262  auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
1263 
1264  // Bottom scrollbar
1265  hs->Add(mTrackPanel->GetLeftOffset() - 1, 0);
1266  hs->Add(mHsbar, 1, wxALIGN_BOTTOM);
1267  hs->Add(mVsbar->GetSize().GetWidth(), 0);
1268  bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT);
1269  }
1270 
1271  // Lay it out
1272  pPage->SetAutoLayout(true);
1273  pPage->Layout();
1274 
1275 #ifdef EXPERIMENTAL_NOTEBOOK
1276  AddPages(this, Factory, pNotebook);
1277 #endif
1278 
1279  mMainPanel->Layout();
1280 
1281  wxASSERT( mTrackPanel->GetProject()==this);
1282 
1283  // MM: Give track panel the focus to ensure keyboard commands work
1284  mTrackPanel->SetFocus();
1285 
1286  // Create tags object
1287  mTags = std::make_shared<Tags>();
1288 
1289  InitialState();
1290  FixScrollbars();
1291  mRuler->SetLeftOffset(mTrackPanel->GetLeftOffset()); // bevel on AdornedRuler
1292 
1293  //
1294  // Set the Icon
1295  //
1296 
1297  // loads either the XPM or the windows resource, depending on the platform
1298 #if !defined(__WXMAC__) && !defined(__WXX11__)
1299  {
1300 #if defined(__WXMSW__)
1301  wxIcon ic{ wxICON(AudacityLogo) };
1302 #elif defined(__WXGTK__)
1303  wxIcon ic{wxICON(AudacityLogoAlpha)};
1304 #else
1305  wxIcon ic{};
1306  ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
1307 #endif
1308  SetIcon(ic);
1309  }
1310 #endif
1311  mIconized = false;
1312 
1314 
1315  int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, 150};
1316  mStatusBar->SetStatusWidths(4, widths);
1317  wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
1319  mStatusBar->SetStatusText(msg, mainStatusBarField);
1321 
1322  mTimer = std::make_unique<wxTimer>(this, AudacityProjectTimerID);
1323  RestartTimer();
1324 
1325 #if wxUSE_DRAG_AND_DROP
1326  // We can import now, so become a drag target
1327 // SetDropTarget(safenew AudacityDropTarget(this));
1328 // mTrackPanel->SetDropTarget(safenew AudacityDropTarget(this));
1329 
1330  // SetDropTarget takes ownership
1331  mTrackPanel->SetDropTarget(safenew DropTarget(this));
1332 #endif
1333 
1334  wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
1336  this);
1337 
1338 #ifdef EXPERIMENTAL_DA2
1339  ClearBackground();// For wxGTK.
1340 #endif
1341 }
Definition: Snap.h:54
std::unique_ptr< MenuManager > mMenuManager
Definition: Project.h:793
std::unique_ptr< Overlay > mIndicatorOverlay
Definition: Project.h:778
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool mbLoadedFromAup
Definition: Project.h:593
#define AUDACITY_VERSION_STRING
Definition: Audacity.h:81
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void InitialState()
Definition: Project.cpp:4601
std::unique_ptr< PlaybackScroller > mPlaybackScroller
Definition: Project.h:824
bool mIsSyncLocked
Definition: Project.h:719
bool mIconized
Definition: Project.h:662
std::unique_ptr< wxTimer > mTimer
Definition: Project.h:642
void SetMissingAliasedFileWarningShouldShow(bool b)
Changes the behavior of missing aliased blockfiles warnings.
wxScrollBar * mVsbar
Definition: Project.h:654
void SetListener(SpectralSelectionBarListener *l)
bool mLockPlayRegion
Definition: Project.h:721
void UpdatePrefs()
Definition: TrackPanel.cpp:301
std::unique_ptr< Scrubber > mScrubber
Definition: Project.h:784
#define _TS(s)
Definition: Internat.h:30
sampleFormat mDefaultFormat
Definition: Project.h:600
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
std::unique_ptr< CommandManager > mCommandManager
Definition: Project.h:637
void OnCapture(wxCommandEvent &evt)
Definition: Project.cpp:1497
std::unique_ptr< TrackFactory > mTrackFactory
Definition: Project.h:651
static int GetOptimalSupportedSampleRate()
Get a supported sample rate which can be used a an optimal default.
Definition: AudioIO.cpp:3085
SpectralSelectionBar * GetSpectralSelectionBar()
Definition: Project.cpp:4882
std::unique_ptr< Overlay > mCursorOverlay
Definition: Project.h:778
#define safenew
Definition: Audacity.h:230
DropTarget, derived from wxFileDropTarget gives drag and drop functionality for audio files...
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:574
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:1617
std::shared_ptr< Tags > mTags
Definition: Project.h:606
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1244
void UpdateStatusBar(AudacityProject *pProject)
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
void FixScrollbars()
Definition: Project.cpp:1973
std::vector< std::unique_ptr< AttachedObject > > mAttachedObjects
Definition: Project.h:792
std::shared_ptr< TrackList > mLastSavedTracks
Definition: Project.h:616
std::shared_ptr< BackgroundCell > mBackgroundCell
Definition: Project.h:780
double mRate
Definition: Project.h:599
AdornedRulerPanel * mRuler
Definition: Project.h:647
static NumericFormatId LookupFormat(Type type, const wxString &id)
void SetListener(SelectionBarListener *l)
NumericFormatId mSelectionFormat
Definition: Project.h:612
std::unique_ptr< UndoManager > mUndoManager
Definition: Project.h:632
ViewInfo mViewInfo
Definition: Project.h:555
const int AudacityProjectTimerID
Definition: Project.h:48
static const AudacityProject::RegisteredAttachedObjectFactory factory
std::unique_ptr< Overlay > mScrubOverlay
Definition: Project.h:783
void SetBackgroundCell(const std::shared_ptr< TrackPanelCell > &pCell)
void UpdatePrefs()
Definition: Project.cpp:1427
NumericFormatId mFrequencySelectionFormatName
Definition: Project.h:613
void AddOverlay(Overlay *pOverlay)
void OnTimer(wxCommandEvent &event)
Definition: ViewInfo.cpp:203
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
int WidthForStatusBar(wxStatusBar *const)
wxStatusBar * mStatusBar
Definition: Project.h:645
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:4828
AudacityProject * GetProject() const override
Definition: TrackPanel.cpp:340
static double GetDefaultZoom()
Definition: ViewInfo.h:85
wxScrollBar * mHsbar
Definition: Project.h:653
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
wxPanel * mTopPanel
Definition: Project.h:648
static int mProjectCounter
Definition: Project.h:596
SelectionBar * GetSelectionBar()
Definition: Project.cpp:4873
This is an Audacity Specific ruler panel which additionally has border, selection markers...
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
int GetLeftOffset() const
Definition: TrackPanel.h:279
AudacityApp & wxGetApp()
static sampleFormat SampleFormatChoice()
static TrackPanel *(* FactoryFunction)(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const std::shared_ptr< TrackList > &tracks, ViewInfo *viewInfo, TrackPanelListener *listener, AdornedRulerPanel *ruler)
Definition: TrackPanel.h:369
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
TrackPanel * mTrackPanel
Definition: Project.h:649
void SetLeftOffset(int offset)
std::function< std::shared_ptr< MenuTable::BaseItem >(AudacityProject &) > Factory
wxPanel * mMainPanel
Definition: Project.h:652
NumericFormatId mBandwidthSelectionFormatName
Definition: Project.h:614
void RestartTimer()
Definition: Project.cpp:4944
AudacityProject::~AudacityProject ( )
virtual

Definition at line 1343 of file Project.cpp.

References mCursorOverlay, mIndicatorOverlay, mScrubOverlay, mTrackPanel, and OverlayPanel::RemoveOverlay().

1344 {
1345  // Tool manager gives us capture sometimes
1346  if(HasCapture())
1347  ReleaseMouse();
1348 
1349  if(mTrackPanel) {
1350 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1352 #endif
1355  }
1356 }
std::unique_ptr< Overlay > mIndicatorOverlay
Definition: Project.h:778
bool RemoveOverlay(Overlay *pOverlay)
std::unique_ptr< Overlay > mCursorOverlay
Definition: Project.h:778
std::unique_ptr< Overlay > mScrubOverlay
Definition: Project.h:783
TrackPanel * mTrackPanel
Definition: Project.h:649

Member Function Documentation

std::vector< std::shared_ptr< Track > > AudacityProject::AddImportedTracks ( const wxString &  fileName,
TrackHolders &&  newTracks 
)

Definition at line 4191 of file Project.cpp.

References _(), SeqBlock::f, WaveTrack::GetClipByIndex(), WaveTrack::GetRate(), GetSelectionBar(), IsProjectSaved(), make_iterator_range(), mbLoadedFromAup, mFileName, mImportedDependencies, mRate, mTracks, Track::Pointer(), PushState(), SelectNone(), SetProjectTitle(), and SelectionBar::SetRate().

Referenced by Import(), and FileActions::Handler::OnImportRaw().

4193 {
4194  std::vector< std::shared_ptr< Track > > results;
4195 
4196  SelectNone();
4197 
4198  bool initiallyEmpty = mTracks->empty();
4199  double newRate = 0;
4200  wxString trackNameBase = fileName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
4201  int i = -1;
4202 
4203  // Must add all tracks first (before using Track::IsLeader)
4204  for (auto &group : newTracks) {
4205  if (group.empty()) {
4206  wxASSERT(false);
4207  continue;
4208  }
4209  auto first = group.begin()->get();
4210  auto nChannels = group.size();
4211  for (auto &uNewTrack : group) {
4212  auto newTrack = mTracks->Add(std::move(uNewTrack));
4213  results.push_back(Track::Pointer(newTrack));
4214  }
4215  mTracks->GroupChannels(*first, nChannels);
4216  }
4217  newTracks.clear();
4218 
4219  // Now name them
4220 
4221  // Add numbers to track names only if there is more than one (mono or stereo)
4222  // track (not necessarily, more than one channel)
4223  const bool useSuffix =
4224  make_iterator_range( results.begin() + 1, results.end() )
4225  .any_of( []( decltype(*results.begin()) &pTrack )
4226  { return pTrack->IsLeader(); } );
4227 
4228  for (const auto &newTrack : results) {
4229  if ( newTrack->IsLeader() )
4230  // Count groups only
4231  ++i;
4232 
4233  newTrack->SetSelected(true);
4234 
4235  if ( useSuffix )
4236  newTrack->SetName(trackNameBase + wxString::Format(wxT(" %d" ), i + 1));
4237  else
4238  newTrack->SetName(trackNameBase);
4239 
4240  newTrack->TypeSwitch( [&](WaveTrack *wt) {
4241  if (newRate == 0)
4242  newRate = wt->GetRate();
4243 
4244  // Check if NEW track contains aliased blockfiles and if yes,
4245  // remember this to show a warning later
4246  if(WaveClip* clip = wt->GetClipByIndex(0)) {
4247  BlockArray &blocks = clip->GetSequence()->GetBlockArray();
4248  if (blocks.size())
4249  {
4250  SeqBlock& block = blocks[0];
4251  if (block.f->IsAlias())
4252  {
4253  mImportedDependencies = true;
4254  }
4255  }
4256  }
4257  });
4258  }
4259 
4260  // Automatically assign rate of imported file to whole project,
4261  // if this is the first file that is imported
4262  if (initiallyEmpty && newRate > 0) {
4263  mRate = newRate;
4265  }
4266 
4267  PushState(wxString::Format(_("Imported '%s'"), fileName),
4268  _("Import"));
4269 
4270 #if defined(__WXGTK__)
4271  // See bug #1224
4272  // The track panel hasn't we been fully created, so the DoZoomFit() will not give
4273  // expected results due to a window width of zero. Should be safe to yield here to
4274  // allow the creattion to complete. If this becomes a problem, it "might" be possible
4275  // to queue a dummy event to trigger the DoZoomFit().
4276  wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
4277 #endif
4278 
4279  if (initiallyEmpty && !IsProjectSaved() ) {
4280  wxString name = fileName.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.'));
4281  mFileName =::wxPathOnly(fileName) + wxFILE_SEP_PATH + name + wxT(".aup");
4282  mbLoadedFromAup = false;
4283  SetProjectTitle();
4284  }
4285 
4286  // Moved this call to higher levels to prevent flicker redrawing everything on each file.
4287  // HandleResize();
4288 
4289  return results;
4290 }
Data structure containing pointer to a BlockFile and a start time. Element of a BlockArray.
Definition: Sequence.h:31
bool mbLoadedFromAup
Definition: Project.h:593
void SetRate(double rate)
WaveClip * GetClipByIndex(int index)
Definition: WaveTrack.cpp:2298
wxString mFileName
Definition: Project.h:592
bool mImportedDependencies
Definition: Project.h:741
void SetProjectTitle(int number=-1)
Definition: Project.cpp:1562
double mRate
Definition: Project.h:599
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:176
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:608
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4629
const wxChar * name
Definition: Distortion.cpp:94
void SelectNone()
Definition: Project.cpp:5653
BlockFilePtr f
Definition: Sequence.h:33
bool IsProjectSaved()
Definition: Project.cpp:5389
SelectionBar * GetSelectionBar()
Definition: Project.cpp:4873
double GetRate() const
Definition: WaveTrack.cpp:401
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
ODLock & AudacityProject::AllProjectDeleteMutex ( )
static

Prevents DELETE from external thread - for e.g. use of GetActiveProject.

Definition at line 186 of file Project.cpp.

Referenced by ODTask::DoSome(), OnCloseWindow(), and ODManager::Start().

187 {
188  static ODLock theMutex;
189  return theMutex;
190 };
void AudacityProject::ApplyUpdatedTheme ( )
virtual

Definition at line 1358 of file Project.cpp.

References TrackPanel::ApplyUpdatedTheme(), ThemeBase::Colour(), mTrackPanel, and theTheme.

Referenced by Theme::ApplyUpdatedImages().

1359 {
1360  SetBackgroundColour(theTheme.Colour( clrMedium ));
1361  ClearBackground();// For wxGTK.
1363 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void ApplyUpdatedTheme()
Definition: TrackPanel.cpp:322
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
TrackPanel * mTrackPanel
Definition: Project.h:649
double AudacityProject::AS_GetRate ( )
overridevirtual

Implements SelectionBarListener.

Definition at line 1624 of file Project.cpp.

References mRate.

1625 {
1626  return mRate;
1627 }
double mRate
Definition: Project.h:599
const NumericFormatId & AudacityProject::AS_GetSelectionFormat ( )
overridevirtual

Implements SelectionBarListener.

Definition at line 1655 of file Project.cpp.

References GetSelectionFormat().

1656 {
1657  return GetSelectionFormat();
1658 }
const NumericFormatId & GetSelectionFormat() const
Definition: Project.cpp:1762
int AudacityProject::AS_GetSnapTo ( )
overridevirtual

Implements SelectionBarListener.

Definition at line 1636 of file Project.cpp.

References GetSnapTo().

1637 {
1638  return GetSnapTo();
1639 }
int GetSnapTo() const
Definition: Project.cpp:5310
void AudacityProject::AS_ModifySelection ( double &  start,
double &  end,
bool  done 
)
overridevirtual

Implements SelectionBarListener.

Definition at line 1768 of file Project.cpp.

References ModifyState(), mTrackPanel, mViewInfo, TrackPanel::Refresh(), ViewInfo::selectedRegion, and SelectedRegion::setTimes().

1769 {
1770  mViewInfo.selectedRegion.setTimes(start, end);
1771  mTrackPanel->Refresh(false);
1772  if (done) {
1773  ModifyState(false);
1774  }
1775 }
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
ViewInfo mViewInfo
Definition: Project.h:555
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
void ModifyState(bool bWantsAutoSave)
Definition: Project.cpp:4660
bool setTimes(double t0, double t1)
TrackPanel * mTrackPanel
Definition: Project.h:649
void AudacityProject::AS_SetRate ( double  rate)
overridevirtual

Implements SelectionBarListener.

Definition at line 1631 of file Project.cpp.

References mRate.

1632 {
1633  mRate = rate;
1634 }
double mRate
Definition: Project.h:599
void AudacityProject::AS_SetSelectionFormat ( const NumericFormatId format)
overridevirtual

Implements SelectionBarListener.

Definition at line 1660 of file Project.cpp.

References format, GetTrackPanel(), gPrefs, ComponentInterfaceSymbol::Internal(), mSelectionFormat, TrackPanel::Refresh(), and SnapSelection().

Referenced by SetSelectionFormat().

1661 {
1663 
1664  gPrefs->Write(wxT("/SelectionFormat"), mSelectionFormat.Internal());
1665  gPrefs->Flush();
1666 
1667  if (SnapSelection() && GetTrackPanel())
1668  GetTrackPanel()->Refresh(false);
1669 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
const wxString & Internal() const
bool SnapSelection()
Definition: Project.cpp:1596
int format
Definition: ExportPCM.cpp:56
NumericFormatId mSelectionFormat
Definition: Project.h:612
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
TrackPanel * GetTrackPanel()
Definition: Project.h:324
void AudacityProject::AS_SetSnapTo ( int  snap)
overridevirtual

Implements SelectionBarListener.

Definition at line 1641 of file Project.cpp.

References gPrefs, mSnapTo, RedrawProject(), and SnapSelection().

Referenced by SetSnapTo().

1642 {
1643  mSnapTo = snap;
1644 
1645 // LLL: TODO - what should this be changed to???
1646 // GetCommandManager()->Check(wxT("Snap"), mSnapTo);
1647  gPrefs->Write(wxT("/SnapTo"), mSnapTo);
1648  gPrefs->Flush();
1649 
1650  SnapSelection();
1651 
1652  RedrawProject();
1653 }
void RedrawProject(const bool bForceWaveTracks=false)
Definition: Project.cpp:1466
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool SnapSelection()
Definition: Project.cpp:1596
void AudacityProject::AutoSave ( )

Definition at line 5114 of file Project.cpp.

References _(), AudacityMessageBox(), FileNames::AutoSaveDir(), CreateUniqueName(), DeleteCurrentAutoSaveFile(), mAutoSaveFileName, mAutoSaving, mFileName, mStrOtherNamesArray, AutoSaveFile::Write(), WriteXML(), and WriteXMLHeader().

Referenced by ModifyState(), OnAudioIOStartRecording(), OnAudioIOStopRecording(), PopState(), and PushState().

5115 {
5116  // SonifyBeginAutoSave(); // part of RBD's r10680 stuff now backed out
5117 
5118  // To minimize the possibility of race conditions, we first write to a
5119  // file with the extension ".tmp", then rename the file to .autosave
5120  wxString projName;
5121 
5122  if (mFileName.IsEmpty())
5123  projName = wxT("New Project");
5124  else
5125  projName = wxFileName(mFileName).GetName();
5126 
5127  wxString fn = wxFileName(FileNames::AutoSaveDir(),
5128  projName + wxString(wxT(" - ")) + CreateUniqueName()).GetFullPath();
5129 
5130  // PRL: I found a try-catch and rewrote it,
5131  // but this guard is unnecessary because AutoSaveFile does not throw
5132  bool success = GuardedCall< bool >( [&]
5133  {
5134  VarSetter<bool> setter(&mAutoSaving, true, false);
5135 
5136  AutoSaveFile buffer;
5137  WriteXMLHeader(buffer);
5138  WriteXML(buffer, false);
5139  mStrOtherNamesArray.Clear();
5140 
5141  wxFFile saveFile;
5142  saveFile.Open(fn + wxT(".tmp"), wxT("wb"));
5143  return buffer.Write(saveFile);
5144  } );
5145 
5146  if (!success)
5147  return;
5148 
5149  // Now that we have a NEW auto-save file, DELETE the old one
5151 
5152  if (!mAutoSaveFileName.IsEmpty())
5153  return; // could not remove auto-save file
5154 
5155  if (!wxRenameFile(fn + wxT(".tmp"), fn + wxT(".autosave")))
5156  {
5158  wxString::Format( _("Could not create autosave file: %s"),
5159  fn + wxT(".autosave") ),
5160  _("Error"), wxICON_STOP, this);
5161  return;
5162  }
5163 
5164  mAutoSaveFileName += fn + wxT(".autosave");
5165  // no-op cruft that's not #ifdefed for NoteTrack
5166  // See above for further comments.
5167  // SonifyEndAutoSave();
5168 }
void WriteXMLHeader(XMLWriter &xmlFile) const
Definition: Project.cpp:3676
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
void WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
Definition: Project.cpp:3691
wxString mFileName
Definition: Project.h:592
static wxString CreateUniqueName()
Definition: Project.cpp:883
wxArrayString mStrOtherNamesArray
Definition: Project.h:743
wxString mAutoSaveFileName
Definition: Project.h:726
void DeleteCurrentAutoSaveFile()
Definition: Project.cpp:5170
static wxString AutoSaveDir()
Definition: FileNames.cpp:125
bool mAutoSaving
Definition: Project.h:729
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void Write(const wxString &data) override
a class wrapping reading and writing of arbitrary data in text or binary format to a file...
Definition: AutoRecovery.h:76
void AudacityProject::CaptureKeyboard ( wxWindow *  handler)
static

Definition at line 5354 of file Project.cpp.

References GetActiveProject(), and mKeyboardCaptureHandler.

Referenced by DeviceToolBar::OnFocus(), MixerToolBar::OnFocus(), MixerTrackSlider::OnFocus(), SelectionBar::OnFocus(), TranscriptionToolBar::OnFocus(), NumericTextCtrl::OnFocus(), and TrackPanel::SetFocusedTrack().

5355 {
5356  AudacityProject *project = GetActiveProject();
5357  if (project)
5358  {
5359 // wxASSERT(project->mKeyboardCaptureHandler == NULL);
5360  project->mKeyboardCaptureHandler = handler;
5361  }
5362 }
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:174
wxWindow * mKeyboardCaptureHandler
Definition: Project.h:768
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:311
void AudacityProject::ClearClipboard ( )
static

Definition at line 4750 of file Project.cpp.

References msClipboard, msClipProject, msClipT0, and msClipT1.

Referenced by EditActions::Handler::OnCopy(), EditActions::Handler::OnCut(), HistoryWindow::OnDiscardClipboard(), and EditActions::Handler::OnSplitCut().

4751 {
4752  msClipT0 = 0.0;
4753  msClipT1 = 0.0;
4754  msClipProject = NULL;
4755  if (msClipboard) {
4756  msClipboard->Clear();
4757  }
4758 }
static double msClipT0
Definition: Project.h:623
static double msClipT1
Definition: Project.h:624
static std::shared_ptr< TrackList > msClipboard
Definition: Project.h:620
static AudacityProject * msClipProject
Definition: Project.h:621
bool AudacityProject::Clipboard ( )
inline

Definition at line 234 of file Project.h.

234 { return (msClipT1 - msClipT0) > 0.0; }
static double msClipT0
Definition: Project.h:623
static double msClipT1
Definition: Project.h:624
int AudacityProject::CountUnnamed ( )
static

Definition at line 2170 of file Project.cpp.

References gAudacityProjects, and GetName().

Referenced by TitleRestorer::TitleRestorer().

2171 {
2172  int j = 0;
2173  for ( size_t i = 0; i < gAudacityProjects.size(); i++) {
2174  if ( gAudacityProjects[i] )
2175  if ( gAudacityProjects[i]->GetName().IsEmpty() )
2176  j++;
2177  }
2178  return j;
2179 }
AProjectArray gAudacityProjects
Definition: Project.cpp:306
wxString GetName()
Definition: Project.cpp:1549
void AudacityProject::DeleteClipboard ( )
static

Definition at line 4745 of file Project.cpp.

References msClipboard.

Referenced by OnCloseWindow(), and QuitAudacity().

4746 {
4747  msClipboard.reset();
4748 }
static std::shared_ptr< TrackList > msClipboard
Definition: Project.h:620
void AudacityProject::DeleteCurrentAutoSaveFile ( )

Definition at line 5170 of file Project.cpp.

References _(), AudacityMessageBox(), and mAutoSaveFileName.

Referenced by AutoSave(), DoSave(), and OnCloseWindow().

5171 {
5172  if (!mAutoSaveFileName.IsEmpty())
5173  {
5174  if (wxFileExists(mAutoSaveFileName))
5175  {
5176  if (!wxRemoveFile(mAutoSaveFileName))
5177  {
5179  wxString::Format(
5180  _("Could not remove old autosave file: %s"), mAutoSaveFileName ),
5181  _("Error"), wxICON_STOP, this);
5182  return;
5183  }
5184  }
5185 
5186  mAutoSaveFileName = wxT("");
5187  }
5188 }
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
wxString mAutoSaveFileName
Definition: Project.h:726
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool AudacityProject::DoSave ( bool  fromSaveAs,
bool  bWantSaveCopy,
bool  bLossless = false 
)
private

Definition at line 3835 of file Project.cpp.

References _(), AudacityMessageBox(), DirManager::ProjectSetter::Commit(), Maybe< X >::create(), TrackList::Create(), DeleteCurrentAutoSaveFile(), GetTracks(), GetUndoManager(), mainStatusBarField, MakeSimpleGuard(), mDirManager, mEmptyCanBeDirty, mFileName, mImportedDependencies, mIsRecovered, mLastSavedTracks, mRecoveryAutoSaveDataDir, mStatusBar, mStrOtherNamesArray, DirManager::ProjectSetter::Ok(), SaveCopyWaveTracks(), SetProjectTitle(), ShowDependencyDialogIfNeeded(), UndoManager::StateSaved(), WriteXML(), and WriteXMLHeader().

Referenced by Save(), SaveAs(), and SaveFromTimerRecording().

3838 {
3839  // See explanation above
3840  // ProjectDisabler disabler(this);
3841 
3842  wxASSERT_MSG(!bWantSaveCopy || fromSaveAs, "Copy Project SHOULD only be availabele from SaveAs");
3843 
3844  // Some confirmation dialogs
3845  if (!bWantSaveCopy)
3846  {
3847  if ( ! GetTracks()->Any() )
3848  {
3849  if (GetUndoManager()->UnsavedChanges() && mEmptyCanBeDirty) {
3850  int result = AudacityMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
3851  _("Warning - Empty Project"),
3852  wxYES_NO | wxICON_QUESTION, this);
3853  if (result == wxNO)
3854  return false;
3855  }
3856  }
3857 
3858  // If the user has recently imported dependencies, show
3859  // a dialog where the user can see audio files that are
3860  // aliased by this project. The user may make the project
3861  // self-contained during this dialog, it modifies the project!
3863  {
3864  bool bSuccess = ShowDependencyDialogIfNeeded(this, true);
3865  if (!bSuccess)
3866  return false;
3867  mImportedDependencies = false; // do not show again
3868  }
3869  }
3870  // End of confirmations
3871 
3872  //
3873  // Always save a backup of the original project file
3874  //
3875 
3876  wxString safetyFileName = wxT("");
3877  if (wxFileExists(mFileName)) {
3878 
3879 #ifdef __WXGTK__
3880  safetyFileName = mFileName + wxT("~");
3881 #else
3882  safetyFileName = mFileName + wxT(".bak");
3883 #endif
3884 
3885  if (wxFileExists(safetyFileName))
3886  wxRemoveFile(safetyFileName);
3887 
3888  if ( !wxRenameFile(mFileName, safetyFileName) ) {
3890  wxString::Format(
3891  _("Could not create safety file: %s"), safetyFileName ),
3892  _("Error"), wxICON_STOP, this);
3893  return false;
3894  }
3895  }
3896 
3897  bool success = true;
3898  wxString project, projName, projPath;
3899 
3900  auto cleanup = finally( [&] {
3901  if (safetyFileName != wxT("")) {
3902  if (wxFileExists(mFileName))
3903  wxRemove(mFileName);
3904  wxRename(safetyFileName, mFileName);
3905  }
3906 
3907  // mStrOtherNamesArray is a temporary array of file names, used only when
3908  // saving compressed
3909  if (!success) {
3910  AudacityMessageBox(wxString::Format(_("Could not save project. Perhaps %s \nis not writable or the disk is full."),
3911  project),
3912  _("Error Saving Project"),
3913  wxICON_ERROR, this);
3914 
3915  // Make the export of tracks succeed all-or-none.
3916  auto dir = project + wxT("_data");
3917  for ( auto &name : mStrOtherNamesArray )
3918  wxRemoveFile( dir + wxFileName::GetPathSeparator() + name);
3919  // This has effect only if the folder is empty
3920  wxFileName::Rmdir( dir );
3921  }
3922  // Success or no, we can forget the names
3923  mStrOtherNamesArray.clear();
3924  } );
3925 
3926  if (fromSaveAs) {
3927  // This block of code is duplicated in WriteXML, for now...
3928  project = mFileName;
3929  if (project.Len() > 4 && project.Mid(project.Len() - 4) == wxT(".aup"))
3930  project = project.Mid(0, project.Len() - 4);
3931  projName = wxFileNameFromPath(project) + wxT("_data");
3932  projPath = wxPathOnly(project);
3933 
3934  if( !wxDir::Exists( projPath ) ){
3935  AudacityMessageBox(wxString::Format(
3936  _("Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name."),
3937  projPath),
3938  _("Error Saving Project"),
3939  wxICON_ERROR, this);
3940  return (success = false);
3941  }
3942 
3943  if (bWantSaveCopy)
3944  {
3945  // Do this before saving the .aup, because we accumulate
3946  // mStrOtherNamesArray which affects the contents of the .aup
3947 
3948  // This populates the array mStrOtherNamesArray
3949  success = this->SaveCopyWaveTracks(project, bLossless);
3950  }
3951 
3952  if (!success)
3953  return false;
3954  }
3955 
3956  // Write the .aup now, before DirManager::SetProject,
3957  // because it's easier to clean up the effects of successful write of .aup
3958  // followed by failed SetProject, than the other way about.
3959  // And that cleanup is done by the destructor of saveFile, if PostCommit() is
3960  // not done.
3961  // (SetProject, when it fails, cleans itself up.)
3962  XMLFileWriter saveFile{ mFileName, _("Error Saving Project") };
3963  success = GuardedCall< bool >( [&] {
3964  WriteXMLHeader(saveFile);
3965  WriteXML(saveFile, bWantSaveCopy);
3966  // Flushes files, forcing space exhaustion errors before trying
3967  // SetProject():
3968  saveFile.PreCommit();
3969  return true;
3970  },
3971  MakeSimpleGuard(false),
3972  // Suppress the usual error dialog for failed write,
3973  // which is redundant here:
3974  [](void*){}
3975  );
3976 
3977  if (!success)
3978  return false;
3979 
3981 
3982  if (fromSaveAs && !bWantSaveCopy) {
3983  // We are about to move files from the current directory to
3984  // the NEW directory. We need to make sure files that belonged
3985  // to the last saved project don't get erased, so we "lock" them, so that
3986  // ProjectSetter's constructor copies instead of moves the files.
3987  // (Otherwise the NEW project would be fine, but the old one would
3988  // be empty of all of its files.)
3989 
3990  std::vector<std::unique_ptr<WaveTrack::Locker>> lockers;
3991  if (mLastSavedTracks) {
3992  lockers.reserve(mLastSavedTracks->size());
3993  for (auto wt : mLastSavedTracks->Any<WaveTrack>())
3994  lockers.push_back(
3995  std::make_unique<WaveTrack::Locker>(wt));
3996  }
3997 
3998  // This renames the project directory, and moves or copies
3999  // all of our block files over.
4000  pSetter.create( *mDirManager, projPath, projName, true );
4001 
4002  if (!pSetter->Ok()){
4003  success = false;
4004  return false;
4005  }
4006  }
4007 
4008  // Commit the writing of the .aup only now, after we know that the _data
4009  // folder also saved with no problems.
4010  // It is very unlikely that errors will happen:
4011  // only renaming and removing of files, not writes that might exhaust space.
4012  // So DO give a second dialog in case the unusual happens.
4013  success = success && GuardedCall< bool >( [&] {
4014  saveFile.PostCommit();
4015  return true;
4016  } );
4017 
4018  if (!success)
4019  return false;
4020 
4021  // SAVE HAS SUCCEEDED -- following are further no-fail commit operations.
4022 
4023  if (pSetter)
4024  pSetter->Commit();
4025 
4026  if ( !bWantSaveCopy )
4027  {
4028  // Now that we have saved the file, we can DELETE the auto-saved version
4030 
4031  if (mIsRecovered)
4032  {
4033  // This was a recovered file, that is, we have just overwritten the
4034  // old, crashed .aup file. There may still be orphaned blockfiles in
4035  // this directory left over from the crash, so we DELETE them now
4036  mDirManager->RemoveOrphanBlockfiles();
4037 
4038  // Before we saved this, this was a recovered project, but now it is
4039  // a regular project, so remember this.
4040  mIsRecovered = false;
4041  mRecoveryAutoSaveDataDir = wxT("");
4042  SetProjectTitle();
4043  }
4044  else if (fromSaveAs)
4045  {
4046  // On save as, always remove orphaned blockfiles that may be left over
4047  // because the user is trying to overwrite another project
4048  mDirManager->RemoveOrphanBlockfiles();
4049  }
4050 
4051  if (mLastSavedTracks)
4052  mLastSavedTracks->Clear();
4054 
4055  for (auto t : GetTracks()->Any()) {
4056  mLastSavedTracks->Add(t->Duplicate());
4057 
4058  //only after the xml has been saved we can mark it saved.
4059  //thus is because the OD blockfiles change on background thread while this is going on.
4060  // if(const auto wt = track_cast<WaveTrack*>(dupT))
4061  // wt->MarkSaved();
4062  }
4063 
4065  }
4066 
4067  // If we get here, saving the project was successful, so we can DELETE
4068  // the .bak file (because it now does not fit our block files anymore
4069  // anyway).
4070  if (safetyFileName != wxT(""))
4071  wxRemoveFile(safetyFileName),
4072  // cancel the cleanup:
4073  safetyFileName = wxT("");
4074 
4075  mStatusBar->SetStatusText(wxString::Format(_("Saved %s"),
4077 
4078  return true;
4079 }
void WriteXMLHeader(XMLWriter &xmlFile) const
Definition: Project.cpp:3676
wxString mRecoveryAutoSaveDataDir
Definition: Project.h:735
void StateSaved()
bool ShowDependencyDialogIfNeeded(AudacityProject *project, bool isSaving)
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
Like a smart pointer, allows for object to not exist (nullptr)
Definition: MemoryX.h:209
bool mEmptyCanBeDirty
Definition: Project.h:713
void WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
Definition: Project.cpp:3691
wxString mFileName
Definition: Project.h:592
bool mImportedDependencies
Definition: Project.h:741
SimpleGuard< R > MakeSimpleGuard(R value)
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:574
void SetProjectTitle(int number=-1)
Definition: Project.cpp:1562
std::shared_ptr< TrackList > mLastSavedTracks
Definition: Project.h:616
Wrapper to output XML data to files.
Definition: XMLWriter.h:74
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
wxArrayString mStrOtherNamesArray
Definition: Project.h:743
void DeleteCurrentAutoSaveFile()
Definition: Project.cpp:5170
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool SaveCopyWaveTracks(const wxString &strProjectPathName, bool bLossless=false)
Definition: Project.cpp:4082
wxStatusBar * mStatusBar
Definition: Project.h:645
const wxChar * name
Definition: Distortion.cpp:94
UndoManager * GetUndoManager()
Definition: Project.h:212
TrackList * GetTracks()
Definition: Project.h:209
bool mIsRecovered
Definition: Project.h:732
void create(Args &&...args)
Definition: MemoryX.h:256
void AudacityProject::DoScroll ( )

Definition at line 2323 of file Project.cpp.

References GetTrackPanel(), TrackPanel::GetTracksUsableArea(), ZoomInfo::h, mAutoScrolling, MayScrollBeyondZero(), mTrackPanel, mViewInfo, mVsbar, TrackPanel::Refresh(), ViewInfo::sbarH, ScrollingLowerBoundTime(), ViewInfo::scrollStep, ViewInfo::SetBeforeScreenWidth(), SetHorizontalThumb(), ZoomInfo::TimeToPosition(), and ZoomInfo::vpos.

Referenced by FinishAutoScroll(), OnScroll(), OnScrollLeftButton(), OnScrollRightButton(), TP_ScrollUpDown(), and TP_ScrollWindow().

2324 {
2325  const double lowerBound = ScrollingLowerBoundTime();
2326 
2327  int width;
2328  mTrackPanel->GetTracksUsableArea(&width, NULL);
2329  mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH, width, lowerBound);
2330 
2331 
2332  if (MayScrollBeyondZero()) {
2333  enum { SCROLL_PIXEL_TOLERANCE = 10 };
2334  if (std::abs(mViewInfo.TimeToPosition(0.0, 0
2335  )) < SCROLL_PIXEL_TOLERANCE) {
2336  // Snap the scrollbar to 0
2337  mViewInfo.h = 0;
2338  SetHorizontalThumb(0.0);
2339  }
2340  }
2341 
2342  mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
2343 
2344  //mchinen: do not always set this project to be the active one.
2345  //a project may autoscroll while playing in the background
2346  //I think this is okay since OnMouseEvent has one of these.
2347  //SetActiveProject(this);
2348 
2349  if (!mAutoScrolling) {
2350  mTrackPanel->Refresh(false);
2351  }
2352 
2353  CallAfter(
2354  [this]{ if (GetTrackPanel())
2355  GetTrackPanel()->HandleCursorForPresentMouseState(); } );
2356 }
void SetBeforeScreenWidth(wxInt64 beforeWidth, wxInt64 screenWidth, double lowerBoundTime=0.0)
Definition: ViewInfo.cpp:161
wxInt64 sbarH
Definition: ViewInfo.h:168
bool mAutoScrolling
Definition: Project.h:660
wxScrollBar * mVsbar
Definition: Project.h:654
double h
Definition: ViewInfo.h:47
void GetTracksUsableArea(int *width, int *height) const
Definition: TrackPanel.cpp:328
double ScrollingLowerBoundTime() const
Definition: Project.cpp:1894
ViewInfo mViewInfo
Definition: Project.h:555
wxInt64 TimeToPosition(double time, wxInt64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ViewInfo.cpp:59
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
int scrollStep
Definition: ViewInfo.h:179
int vpos
Definition: ViewInfo.h:45
bool MayScrollBeyondZero() const
Definition: Project.cpp:1876
TrackPanel * GetTrackPanel()
Definition: Project.h:324
void SetHorizontalThumb(double scrollto)
Definition: Project.cpp:1912
TrackPanel * mTrackPanel
Definition: Project.h:649
bool AudacityProject::EmptyCanBeDirty ( ) const
inline

Definition at line 716 of file Project.h.

Referenced by TransportActions::Handler::OnTimerRecord().

716 { return mEmptyCanBeDirty; }
bool mEmptyCanBeDirty
Definition: Project.h:713
void AudacityProject::EnqueueODTasks ( )
private

Definition at line 3357 of file Project.cpp.

References ODManager::AddNewTask(), ODTask::AddWaveTrack(), ODTask::eODFLAC, ODTask::eODPCMSummary, GetTracks(), ODManager::HasLoadedODFlag(), and ODManager::Instance.

Referenced by OpenFile().

3358 {
3359  //check the ODManager to see if we should add the tracks to the ODManager.
3360  //this flag would have been set in the HandleXML calls from above, if there were
3361  //OD***Blocks.
3363  {
3364  std::vector<std::unique_ptr<ODTask>> newTasks;
3365  //std::vector<ODDecodeTask*> decodeTasks;
3366  unsigned int createdODTasks=0;
3367  for (auto wt : GetTracks()->Any<WaveTrack>()) {
3368  //check the track for blocks that need decoding.
3369  //There may be more than one type e.g. FLAC/FFMPEG/lame
3370  unsigned int odFlags = wt->GetODFlags();
3371 
3372  //add the track to the already created tasks that correspond to the od flags in the wavetrack.
3373  for(unsigned int i=0;i<newTasks.size();i++) {
3374  if(newTasks[i]->GetODType() & odFlags)
3375  newTasks[i]->AddWaveTrack(wt);
3376  }
3377 
3378  //create whatever NEW tasks we need to.
3379  //we want at most one instance of each class for the project
3380  while((odFlags|createdODTasks) != createdODTasks)
3381  {
3382  std::unique_ptr<ODTask> newTask;
3383 #ifdef EXPERIMENTAL_OD_FLAC
3384  if(!(createdODTasks&ODTask::eODFLAC) && (odFlags & ODTask::eODFLAC)) {
3385  newTask = std::make_unique<ODDecodeFlacTask>();
3386  createdODTasks = createdODTasks | ODTask::eODFLAC;
3387  }
3388  else
3389 #endif
3390  if(!(createdODTasks&ODTask::eODPCMSummary) && (odFlags & ODTask::eODPCMSummary)) {
3391  newTask = std::make_unique<ODComputeSummaryTask>();
3392  createdODTasks = createdODTasks | ODTask::eODPCMSummary;
3393  }
3394  else {
3395  wxPrintf("unrecognized OD Flag in block file.\n");
3396  //TODO:ODTODO: display to user. This can happen when we build audacity on a system that doesnt have libFLAC
3397  break;
3398  }
3399  if(newTask)
3400  {
3401  newTask->AddWaveTrack(wt);
3402  newTasks.push_back(std::move(newTask));
3403  }
3404  }
3405  }
3406  for(unsigned int i=0;i<newTasks.size();i++)
3407  ODManager::Instance()->AddNewTask(std::move(newTasks[i]));
3408  }
3409 }
static ODManager *(* Instance)()
Definition: ODManager.h:49
void AddNewTask(std::unique_ptr< ODTask > &&mtask, bool lockMutex=true)
Adds a wavetrack, creates a queue member.
Definition: ODManager.cpp:145
void AddWaveTrack(WaveTrack *track)
Adds a WaveTrack to do the task for.
Definition: ODTask.cpp:265
static bool HasLoadedODFlag()
returns a flag that is set if we have loaded some OD blockfiles from PCM.
Definition: ODManager.cpp:522
TrackList * GetTracks()
Definition: Project.h:209
bool AudacityProject::ExportFromTimerRecording ( wxFileName  fnFile,
int  iFormat,
int  iSubFormat,
int  iFilterIndex 
)

Definition at line 5377 of file Project.cpp.

References mTracks, Exporter::ProcessFromTimerRecording(), AudacityApp::SetMissingAliasedFileWarningShouldShow(), and wxGetApp().

Referenced by TimerRecordDialog::ExecutePostRecordActions().

5378 {
5379  Exporter e;
5380 
5382  return e.ProcessFromTimerRecording(this, false, 0.0, mTracks->GetEndTime(), fnFile, iFormat, iSubFormat, iFilterIndex);
5383 }
void SetMissingAliasedFileWarningShouldShow(bool b)
Changes the behavior of missing aliased blockfiles warnings.
bool ProcessFromTimerRecording(AudacityProject *project, bool selectedOnly, double t0, double t1, wxFileName fnFile, int iFormat, int iSubFormat, int iFilterIndex)
Definition: Export.cpp:962
AudacityApp & wxGetApp()
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
void AudacityProject::FinishAutoScroll ( )

Definition at line 1777 of file Project.cpp.

References DoScroll(), and mAutoScrolling.

Referenced by TrackActions::Handler::OnResample(), OnScrollLeft(), and OnScrollRight().

1778 {
1779  // Set a flag so we don't have to generate two update events
1780  mAutoScrolling = true;
1781 
1782  // Call our Scroll method which updates our ViewInfo variables
1783  // to reflect the positions of the scrollbars
1784  DoScroll();
1785 
1786  mAutoScrolling = false;
1787 }
bool mAutoScrolling
Definition: Project.h:660
void AudacityProject::FixScrollbars ( )

Definition at line 1973 of file Project.cpp.

References ViewInfo::GetBeforeScreenWidth(), GetMenuManager, GetScreenEndTime(), ViewInfo::GetTotalWidth(), GetTrackPanel(), GetTracks(), TrackPanel::GetTracksUsableArea(), ZoomInfo::h, MayScrollBeyondZero(), mbInitializingScrollbar, mHsbar, mTrackPanel, mTracks, mViewInfo, mVsbar, PixelWidthBeforeTime(), TrackPanel::Refresh(), ViewInfo::sbarH, ViewInfo::sbarScale, ViewInfo::sbarScreen, ViewInfo::sbarTotal, ScrollingLowerBoundTime(), ViewInfo::scrollStep, ViewInfo::selectedRegion, SelectedRegion::t1(), ViewInfo::total, UpdateLayout(), MenuManager::UpdateMenus(), and ZoomInfo::vpos.

Referenced by TrackActions::DoRemoveTrack(), HandleResize(), OnAudioIOStopRecording(), OnCloseWindow(), TrackPanel::OnTimer(), RedrawProject(), TP_RedrawScrollbars(), Zoom(), and ZoomBy().

1974 {
1975  if (!GetTracks())
1976  return;
1977 
1978  bool refresh = false;
1979  bool rescroll = false;
1980 
1981  int totalHeight = (mTracks->GetHeight() + 32);
1982 
1983  int panelWidth, panelHeight;
1984  mTrackPanel->GetTracksUsableArea(&panelWidth, &panelHeight);
1985 
1986  // (From Debian...at least I think this is the change cooresponding
1987  // to this comment)
1988  //
1989  // (2.) GTK critical warning "IA__gtk_range_set_range: assertion
1990  // 'min < max' failed" because of negative numbers as result of window
1991  // size checking. Added a sanity check that straightens up the numbers
1992  // in edge cases.
1993  if (panelWidth < 0) {
1994  panelWidth = 0;
1995  }
1996  if (panelHeight < 0) {
1997  panelHeight = 0;
1998  }
1999 
2000  auto LastTime = std::numeric_limits<double>::lowest();
2001  auto &tracks = *GetTracks();
2002  for (const Track *track : tracks) {
2003  // Iterate over pending changed tracks if present.
2004  track = track->SubstitutePendingChangedTrack().get();
2005  LastTime = std::max( LastTime, track->GetEndTime() );
2006  }
2007  LastTime =
2008  std::max(LastTime, mViewInfo.selectedRegion.t1());
2009 
2010  const double screen = GetScreenEndTime() - mViewInfo.h;
2011  const double halfScreen = screen / 2.0;
2012 
2013  // If we can scroll beyond zero,
2014  // Add 1/2 of a screen of blank space to the end
2015  // and another 1/2 screen before the beginning
2016  // so that any point within the union of the selection and the track duration
2017  // may be scrolled to the midline.
2018  // May add even more to the end, so that you can always scroll the starting time to zero.
2019  const double lowerBound = ScrollingLowerBoundTime();
2020  const double additional = MayScrollBeyondZero()
2021  ? -lowerBound + std::max(halfScreen, screen - LastTime)
2022  : screen / 4.0;
2023 
2024  mViewInfo.total = LastTime + additional;
2025 
2026  // Don't remove time from total that's still on the screen
2027  mViewInfo.total = std::max(mViewInfo.total, mViewInfo.h + screen);
2028 
2029  if (mViewInfo.h < lowerBound) {
2030  mViewInfo.h = lowerBound;
2031  rescroll = true;
2032  }
2033 
2034  mViewInfo.sbarTotal = (wxInt64) (mViewInfo.GetTotalWidth());
2035  mViewInfo.sbarScreen = (wxInt64)(panelWidth);
2037 
2038  // PRL: Can someone else find a more elegant solution to bug 812, than
2039  // introducing this boolean member variable?
2040  // Setting mVSbar earlier, int HandlXMLTag, didn't succeed in restoring
2041  // the vertical scrollbar to its saved position. So defer that till now.
2042  // mbInitializingScrollbar should be true only at the start of the life
2043  // of an AudacityProject reopened from disk.
2044  if (!mbInitializingScrollbar) {
2045  mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
2046  }
2047  mbInitializingScrollbar = false;
2048 
2049  if (mViewInfo.vpos >= totalHeight)
2050  mViewInfo.vpos = totalHeight - 1;
2051  if (mViewInfo.vpos < 0)
2052  mViewInfo.vpos = 0;
2053 
2054  bool oldhstate;
2055  bool oldvstate;
2056  bool newhstate = (GetScreenEndTime() - mViewInfo.h) < mViewInfo.total;
2057  bool newvstate = panelHeight < totalHeight;
2058 
2059 #ifdef __WXGTK__
2060  oldhstate = mHsbar->IsShown();
2061  oldvstate = mVsbar->IsShown();
2062  mHsbar->Show(newhstate);
2063  mVsbar->Show(panelHeight < totalHeight);
2064 #else
2065  oldhstate = mHsbar->IsEnabled();
2066  oldvstate = mVsbar->IsEnabled();
2067  mHsbar->Enable(newhstate);
2068  mVsbar->Enable(panelHeight < totalHeight);
2069 #endif
2070 
2071  if (panelHeight >= totalHeight && mViewInfo.vpos != 0) {
2072  mViewInfo.vpos = 0;
2073 
2074  refresh = true;
2075  rescroll = false;
2076  }
2077  if (!newhstate && mViewInfo.sbarH != 0) {
2078  mViewInfo.sbarH = 0;
2079 
2080  refresh = true;
2081  rescroll = false;
2082  }
2083 
2084  // wxScrollbar only supports int values but we need a greater range, so
2085  // we scale the scrollbar coordinates on demand. We only do this if we
2086  // would exceed the int range, so we can always use the maximum resolution
2087  // available.
2088 
2089  // Don't use the full 2^31 max int range but a bit less, so rounding
2090  // errors in calculations do not overflow max int
2091  wxInt64 maxScrollbarRange = (wxInt64)(2147483647 * 0.999);
2092  if (mViewInfo.sbarTotal > maxScrollbarRange)
2093  mViewInfo.sbarScale = ((double)maxScrollbarRange) / mViewInfo.sbarTotal;
2094  else
2095  mViewInfo.sbarScale = 1.0; // use maximum resolution
2096 
2097  {
2098  int scaledSbarH = (int)(mViewInfo.sbarH * mViewInfo.sbarScale);
2099  int scaledSbarScreen = (int)(mViewInfo.sbarScreen * mViewInfo.sbarScale);
2100  int scaledSbarTotal = (int)(mViewInfo.sbarTotal * mViewInfo.sbarScale);
2101  const int offset =
2102  (int)(floor(0.5 + mViewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
2103 
2104  mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
2105  scaledSbarScreen, TRUE);
2106  }
2107 
2108  // Vertical scrollbar
2109  mVsbar->SetScrollbar(mViewInfo.vpos / mViewInfo.scrollStep,
2110  panelHeight / mViewInfo.scrollStep,
2111  totalHeight / mViewInfo.scrollStep,
2112  panelHeight / mViewInfo.scrollStep, TRUE);
2113 
2114  if (refresh || (rescroll &&
2116  mTrackPanel->Refresh(false);
2117  }
2118 
2119  GetMenuManager(*this).UpdateMenus(*this);
2120 
2121  if (oldhstate != newhstate || oldvstate != newvstate) {
2122  UpdateLayout();
2123  }
2124 
2125  CallAfter(
2126  [this]{ if (GetTrackPanel())
2127  GetTrackPanel()->HandleCursorForPresentMouseState(); } );
2128 }
bool mbInitializingScrollbar
Definition: Project.h:757
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
wxInt64 sbarH
Definition: ViewInfo.h:168
wxScrollBar * mVsbar
Definition: Project.h:654
void UpdateMenus(AudacityProject &project, bool checkActive=true)
Definition: Menus.cpp:646
double GetBeforeScreenWidth() const
Definition: ViewInfo.h:151
double PixelWidthBeforeTime(double scrollto) const
Definition: Project.cpp:1904
double h
Definition: ViewInfo.h:47
double t1() const
void GetTracksUsableArea(int *width, int *height) const
Definition: TrackPanel.cpp:328
void UpdateLayout()
Definition: Project.cpp:2130
friend MenuManager & GetMenuManager(AudacityProject &project)
Definition: Menus.cpp:58
wxInt64 sbarTotal
Definition: ViewInfo.h:170
double ScrollingLowerBoundTime() const
Definition: Project.cpp:1894
double GetTotalWidth() const
Definition: ViewInfo.h:157
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:191
wxInt64 sbarScreen
Definition: ViewInfo.h:169
ViewInfo mViewInfo
Definition: Project.h:555
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
int scrollStep
Definition: ViewInfo.h:179
int vpos
Definition: ViewInfo.h:45
double total
Definition: ViewInfo.h:166
double sbarScale
Definition: ViewInfo.h:176
wxScrollBar * mHsbar
Definition: Project.h:653
double GetScreenEndTime() const
Definition: Project.cpp:5648
bool MayScrollBeyondZero() const
Definition: Project.cpp:1876
TrackPanel * GetTrackPanel()
Definition: Project.h:324
TrackList * GetTracks()
Definition: Project.h:209
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
TrackPanel * mTrackPanel
Definition: Project.h:649
AudacityProject::AttachedObject & AudacityProject::GetAttachedObject ( const RegisteredAttachedObjectFactory factory)

Definition at line 936 of file Project.cpp.

References mAttachedObjects, AudacityProject::RegisteredAttachedObjectFactory::mIndex, and THROW_INCONSISTENCY_EXCEPTION.

Referenced by findCommandHandler().

938 {
939  ObjectFactorySetLocker locker;
940  if ( factory.mIndex >= mAttachedObjects.size() )
942  auto &pObject = mAttachedObjects[ factory.mIndex ];
943  if ( !pObject )
945  return *pObject;
946 }
#define THROW_INCONSISTENCY_EXCEPTION
std::vector< std::unique_ptr< AttachedObject > > mAttachedObjects
Definition: Project.h:792
static const AudacityProject::RegisteredAttachedObjectFactory factory
int AudacityProject::GetAudioIOToken ( ) const
std::shared_ptr<BackgroundCell> AudacityProject::GetBackgroundCell ( ) const
inline

Definition at line 828 of file Project.h.

Referenced by Track::HitTest().

829  { return mBackgroundCell; }
std::shared_ptr< BackgroundCell > mBackgroundCell
Definition: Project.h:780
const NumericFormatId & AudacityProject::GetBandwidthSelectionFormatName ( ) const

Definition at line 1739 of file Project.cpp.

References mBandwidthSelectionFormatName.

Referenced by SSBL_GetBandwidthSelectionFormatName(), and WriteXML().

1740 {
1742 }
NumericFormatId mBandwidthSelectionFormatName
Definition: Project.h:614
MeterPanel * AudacityProject::GetCaptureMeter ( )

Definition at line 4929 of file Project.cpp.

References mCaptureMeter.

Referenced by MeterToolBar::Expose(), MeterToolBar::ReCreateButtons(), AudioIO::StartPortAudioStream(), and ControlToolBar::StopPlaying().

4930 {
4931  return mCaptureMeter;
4932 }
MeterPanel * mCaptureMeter
Definition: Project.h:680
TrackList * AudacityProject::GetClipboardTracks ( )
static

Definition at line 4739 of file Project.cpp.

References msClipboard.

Referenced by UndoManager::CalculateSpaceUsage(), and DirManager::FindOrphanBlockFiles().

4740 {
4741  return msClipboard.get();
4742 }
static std::shared_ptr< TrackList > msClipboard
Definition: Project.h:620
CommandManager* AudacityProject::GetCommandManager ( )
inline
const CommandManager* AudacityProject::GetCommandManager ( ) const
inline

Definition at line 364 of file Project.h.

365  { return mCommandManager.get(); }
std::unique_ptr< CommandManager > mCommandManager
Definition: Project.h:637
ContrastDialog * AudacityProject::GetContrastDialog ( bool  create = false)

Definition at line 5636 of file Project.cpp.

References _(), mContrastDialog, and safenew.

Referenced by PluginActions::Handler::OnContrast().

5637 {
5638  // All of this goes away when the Contrast Dialog is converted to a module
5639  if(create && !mContrastDialog)
5641  this, -1, _("Contrast Analysis (WCAG 2 compliance)"),
5642  wxPoint{ 150, 150 }
5643  } );
5644 
5645  return mContrastDialog.get();
5646 }
#define safenew
Definition: Audacity.h:230
Destroy_ptr< ContrastDialog > mContrastDialog
Definition: Project.h:671
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ControlToolBar * AudacityProject::GetControlToolBar ( )

Definition at line 4828 of file Project.cpp.

References mToolManager, and TransportBarID.

Referenced by AdornedRulerPanel::ScrubbingHandle::Cancel(), AudioIoCallback::CheckSoundActivatedRecordingLevel(), AdornedRulerPanel::ClearPlayRegion(), Scrubber::ContinueScrubbingUI(), TransportActions::DoPause(), TransportActions::DoPlayStopSelect(), TransportActions::DoRecord(), Scrubber::DoScrub(), TransportActions::DoStop(), TransportActions::DoTogglePinnedHead(), MenuManager::GetUpdateFlags(), Scrubber::MarkScrubStart(), Scrubber::MaybeStartScrubbing(), Scrubber::OnActivateOrDeactivateApp(), OnAudioIORate(), OnCloseWindow(), EffectUIHost::OnPlay(), TransportActions::Handler::OnPlayAfterSelectionEnd(), TransportActions::Handler::OnPlayAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionEnd(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeSelectionEnd(), TransportActions::Handler::OnPlayBeforeSelectionStart(), TransportActions::Handler::OnPlayCutPreview(), TransportActions::Handler::OnPlayLooped(), TransportActions::Handler::OnPlayOneSecond(), TransportActions::Handler::OnPlayToSelection(), TransportActions::Handler::OnPunchAndRoll(), TransportActions::Handler::OnRecord2ndChoice(), Scrubber::OnScrubOrSeek(), SelectActions::Handler::OnSkipEnd(), SelectActions::Handler::OnSkipStart(), TrackPanel::OnTimer(), TranscriptionToolBar::PlayAtSpeed(), AdornedRulerPanel::StartQPPlay(), Scrubber::StartSpeedPlay(), Scrubber::StopScrubbing(), and AudioIO::StopStream().

4829 {
4830  return (ControlToolBar *)
4831  (mToolManager ?
4832  mToolManager->GetToolBar(TransportBarID) :
4833  NULL);
4834 }
A ToolBar that has the main Transport buttons.
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
sampleFormat AudacityProject::GetDefaultFormat ( )
inline
AudioIOStartStreamOptions AudacityProject::GetDefaultPlayOptions ( )
DeviceToolBar * AudacityProject::GetDeviceToolBar ( )

Definition at line 4841 of file Project.cpp.

References DeviceBarID, and mToolManager.

Referenced by ExtraActions::Handler::OnAudioHost(), ExtraActions::Handler::OnInputChannels(), ExtraActions::Handler::OnInputDevice(), and ExtraActions::Handler::OnOutputDevice().

4842 {
4843  return (DeviceToolBar *)
4844  (mToolManager ?
4845  mToolManager->GetToolBar(DeviceBarID) :
4846  NULL);
4847 }
A toobar to allow easier changing of input and output devices .
Definition: DeviceToolBar.h:25
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
const std::shared_ptr< DirManager > & AudacityProject::GetDirManager ( )

Definition at line 1508 of file Project.cpp.

References mDirManager.

Referenced by Exporter::CheckFilename(), ExportMultiple::DoExport(), RecordingRecoveryHandler::HandleXMLTag(), ImportXMLTagHandler::HandleXMLTag(), Import(), OpenFile(), and RemoveDependencies().

1509 {
1510  return mDirManager;
1511 }
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
bool AudacityProject::GetDirty ( )
inline

Definition at line 320 of file Project.h.

Referenced by AudacityApp::MRUOpen().

320 { return mDirty; }
EditToolBar * AudacityProject::GetEditToolBar ( )

Definition at line 4849 of file Project.cpp.

References EditBarID, and mToolManager.

4850 {
4851  return (EditToolBar *)
4852  (mToolManager ?
4853  mToolManager->GetToolBar(EditBarID) :
4854  NULL);
4855 }
A ToolBar that has the edit buttons on it.
Definition: EditToolBar.h:73
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
int AudacityProject::GetEstimatedRecordingMinsLeftOnDisk ( long  lCaptureChannels = 0)

Definition at line 5502 of file Project.cpp.

References GetRate(), gPrefs, mDirManager, SAMPLE_SIZE_DISK, and QualityPrefs::SampleFormatChoice().

Referenced by TimerRecordDialog::OnOK(), and OnTimer().

5502  {
5503 
5504  // Obtain the current settings
5505  auto oCaptureFormat = QualityPrefs::SampleFormatChoice();
5506  if (lCaptureChannels == 0) {
5507  gPrefs->Read(wxT("/AudioIO/RecordChannels"), &lCaptureChannels, 2L);
5508  }
5509 
5510  // Find out how much free space we have on disk
5511  wxLongLong lFreeSpace = mDirManager->GetFreeDiskSpace();
5512  if (lFreeSpace < 0) {
5513  return 0;
5514  }
5515 
5516  // Calculate the remaining time
5517  double dRecTime = 0.0;
5518  double bytesOnDiskPerSample = SAMPLE_SIZE_DISK(oCaptureFormat);
5519  dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
5520  dRecTime /= bytesOnDiskPerSample;
5521  dRecTime /= lCaptureChannels;
5522  dRecTime /= GetRate();
5523 
5524  // Convert to minutes before returning
5525  int iRecMins = (int)round(dRecTime / 60.0);
5526  return iRecMins;
5527 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
#define SAMPLE_SIZE_DISK(SampleFormat)
Return the size on disk of one uncompressed sample (bytes)
Definition: SampleFormat.h:43
double GetRate() const
Definition: Project.h:216
static sampleFormat SampleFormatChoice()
const wxString& AudacityProject::GetFileName ( )
inline
const NumericFormatId & AudacityProject::GetFrequencySelectionFormatName ( ) const

Definition at line 1724 of file Project.cpp.

References mFrequencySelectionFormatName.

Referenced by LabelTrack::DoEditLabels(), SSBL_GetFrequencySelectionFormatName(), and WriteXML().

1725 {
1727 }
NumericFormatId mFrequencySelectionFormatName
Definition: Project.h:613
FreqWindow * AudacityProject::GetFreqWindow ( bool  create = false)

Definition at line 5626 of file Project.cpp.

References _(), mFreqWindow, and safenew.

Referenced by PluginActions::Handler::OnPlotSpectrum().

5627 {
5628  if (create && !mFreqWindow)
5630  this, -1, _("Frequency Analysis"),
5631  wxPoint{ 150, 150 }
5632  } );
5633  return mFreqWindow.get();
5634 }
#define safenew
Definition: Audacity.h:230
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
Displays a spectrum plot of the waveform. Has options for selecting parameters of the plot...
Definition: FreqWindow.h:127
Destroy_ptr< FreqWindow > mFreqWindow
Definition: Project.h:670
HistoryWindow * AudacityProject::GetHistoryWindow ( bool  create = false)

Definition at line 5606 of file Project.cpp.

References GetUndoManager(), mHistoryWindow, and safenew.

Referenced by ViewActions::Handler::OnHistory().

5607 {
5608  if (create && !mHistoryWindow)
5610  return mHistoryWindow;
5611 }
Works with UndoManager to allow user to see descriptions of and undo previous commands. Also allows you to selectively clear the undo memory so as to free up space.
Definition: HistoryWindow.h:27
#define safenew
Definition: Audacity.h:230
UndoManager * GetUndoManager()
Definition: Project.h:212
HistoryWindow * mHistoryWindow
Definition: Project.h:665
wxString AudacityProject::GetHoursMinsString ( int  iMinutes)

Definition at line 5473 of file Project.cpp.

References _(), and wxPLURAL.

Referenced by TimerRecordDialog::OnOK(), and OnTimer().

5474 {
5475 
5476  wxString sFormatted = wxEmptyString;
5477 
5478  if (iMinutes < 1) {
5479  // Less than a minute...
5480  sFormatted = _("Less than 1 minute");
5481  return sFormatted;
5482  }
5483 
5484  // Calculate
5485  int iHours = iMinutes / 60;
5486  int iMins = iMinutes % 60;
5487 
5488  auto sHours =
5489  wxString::Format( wxPLURAL("%d hour", "%d hours", iHours), iHours );
5490  auto sMins =
5491  wxString::Format( wxPLURAL("%d minute", "%d minutes", iMins), iMins );
5492 
5493  /* i18n-hint: A time in hours and minutes. Only translate the "and". */
5494  sFormatted.Printf( _("%s and %s."), sHours, sMins);
5495  return sFormatted;
5496 }
#define wxPLURAL(sing, plur, n)
Definition: Internat.h:82
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool AudacityProject::GetIsEmpty ( )

Definition at line 1591 of file Project.cpp.

References mTracks.

Referenced by AudacityApp::MRUOpen(), and ApplyMacroDialog::OnApplyToFiles().

1592 {
1593  return mTracks->empty();
1594 }
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
wxWindow * AudacityProject::GetKeyboardCaptureHandler ( )
static

Definition at line 5342 of file Project.cpp.

References GetActiveProject(), and mKeyboardCaptureHandler.

Referenced by CommandManagerEventMonitor::FilterEvent(), and HasKeyboardCapture().

5343 {
5344  AudacityProject *project = GetActiveProject();
5345  if (project)
5346  {
5347  return project->mKeyboardCaptureHandler;
5348  }
5349 
5350  return NULL;
5351 }
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:174
wxWindow * mKeyboardCaptureHandler
Definition: Project.h:768
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:311
LyricsWindow * AudacityProject::GetLyricsWindow ( bool  create = false)

Definition at line 5590 of file Project.cpp.

References mLyricsWindow, and safenew.

Referenced by MenuManager::GetFocusedFrame(), and ViewActions::Handler::OnKaraoke().

5591 {
5592  if (create && !mLyricsWindow)
5594  return mLyricsWindow;
5595 }
#define safenew
Definition: Audacity.h:230
LyricsWindow * mLyricsWindow
Definition: Project.h:666
MacrosWindow * AudacityProject::GetMacrosWindow ( bool  bExpanded,
bool  create = false 
)

Definition at line 5613 of file Project.cpp.

References mMacrosWindow, safenew, and MacrosWindow::UpdateDisplay().

Referenced by PluginActions::Handler::OnApplyMacrosPalette(), and PluginActions::Handler::OnManageMacros().

5614 {
5615  if (create && !mMacrosWindow)
5616  mMacrosWindow = safenew MacrosWindow{ this, bExpanded };
5617 
5618  if (mMacrosWindow) {
5619  mMacrosWindow->Show();
5620  mMacrosWindow->Raise();
5621  mMacrosWindow->UpdateDisplay( bExpanded );
5622  }
5623  return mMacrosWindow;
5624 }
MacrosWindow * mMacrosWindow
Definition: Project.h:664
#define safenew
Definition: Audacity.h:230
void UpdateDisplay(bool bExpanded)
wxDialog * AudacityProject::GetMissingAliasFileDialog ( )

returns a pointer to the wxDialog if it is displayed, NULL otherwise.

Definition at line 1461 of file Project.cpp.

References mAliasMissingWarningDialog.

1462 {
1464 }
wxDialog * mAliasMissingWarningDialog
Definition: Project.h:674
MixerBoardFrame * AudacityProject::GetMixerBoardFrame ( bool  create = false)

Definition at line 5597 of file Project.cpp.

References MixerBoardFrame::mMixerBoard, mMixerBoard, mMixerBoardFrame, and safenew.

Referenced by ViewActions::Handler::OnMixerBoard().

5598 {
5599  if (create && !mMixerBoardFrame) {
5602  }
5603  return mMixerBoardFrame;
5604 }
MixerBoardFrame * mMixerBoardFrame
Definition: Project.h:667
#define safenew
Definition: Audacity.h:230
MixerBoard * mMixerBoard
Definition: Project.h:668
MixerBoard * mMixerBoard
Definition: MixerBoard.h:279
MixerToolBar * AudacityProject::GetMixerToolBar ( )

Definition at line 4857 of file Project.cpp.

References MixerBarID, and mToolManager.

Referenced by ExtraActions::Handler::OnInputGain(), ExtraActions::Handler::OnInputGainDec(), ExtraActions::Handler::OnInputGainInc(), ExtraActions::Handler::OnOutputGain(), ExtraActions::Handler::OnOutputGainDec(), ExtraActions::Handler::OnOutputGainInc(), and OnTimer().

4858 {
4859  return (MixerToolBar *)
4860  (mToolManager ?
4861  mToolManager->GetToolBar(MixerBarID) :
4862  NULL);
4863 }
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
A ToolBar that provides the record and playback volume settings.
Definition: MixerToolBar.h:25
wxString AudacityProject::GetName ( )

Definition at line 1549 of file Project.cpp.

References mFileName, and name.

Referenced by CountUnnamed(), Exporter::GetFilename(), HandleXMLTag(), FileActions::Handler::OnPrint(), ExportMultiple::PopulateOrExchange(), NyquistEffect::Process(), SetProjectTitle(), and TitleRestorer::TitleRestorer().

1550 {
1551  wxString name = wxFileNameFromPath(mFileName);
1552 
1553  // Chop off the extension
1554  size_t len = name.Len();
1555  if (len > 4 && name.Mid(len - 4) == wxT(".aup"))
1556  name = name.Mid(0, len - 4);
1557 
1558  return name;
1559 }
wxString mFileName
Definition: Project.h:592
const wxChar * name
Definition: Distortion.cpp:94
wxRect AudacityProject::GetNormalizedWindowState ( ) const
inline

Definition at line 693 of file Project.h.

Referenced by SaveWindowSize().

693 { return mNormalizedWindowState; }
wxRect mNormalizedWindowState
Definition: Project.h:745
bool AudacityProject::GetNormalizeOnLoad ( )
inline

Definition at line 336 of file Project.h.

336 { return mNormalizeOnLoad; } //lda
bool mNormalizeOnLoad
Definition: Project.h:711
int AudacityProject::GetOpenProjectCount ( )
static

Definition at line 5385 of file Project.cpp.

References gAudacityProjects.

Referenced by TransportActions::Handler::OnTimerRecord().

5385  {
5386  return gAudacityProjects.size();
5387 }
AProjectArray gAudacityProjects
Definition: Project.cpp:306
MeterPanel * AudacityProject::GetPlaybackMeter ( )

Definition at line 4915 of file Project.cpp.

References mPlaybackMeter.

Referenced by MeterToolBar::Expose(), MeterToolBar::ReCreateButtons(), AudioIO::StartPortAudioStream(), and ControlToolBar::StopPlaying().

4916 {
4917  return mPlaybackMeter;
4918 }
MeterPanel * mPlaybackMeter
Definition: Project.h:679
PlaybackScroller& AudacityProject::GetPlaybackScroller ( )
inline

Definition at line 827 of file Project.h.

Referenced by PlayIndicatorOverlay::OnTimer(), and ControlToolBar::StartScrollingIfPreferred().

827 { return *mPlaybackScroller; }
std::unique_ptr< PlaybackScroller > mPlaybackScroller
Definition: Project.h:824
void AudacityProject::GetPlayRegion ( double *  playRegionStart,
double *  playRegionEnd 
)

Definition at line 5105 of file Project.cpp.

References AdornedRulerPanel::GetPlayRegion(), and mRuler.

Referenced by LabelTrack::DoCaptureKey(), TransportActions::DoLockPlayRegion(), MenuManager::GetUpdateFlags(), EffectUIHost::OnPlay(), TranscriptionToolBar::PlayAtSpeed(), ControlToolBar::PlayCurrentRegion(), and TP_DisplaySelection().

5107 {
5108  if (mRuler)
5109  mRuler->GetPlayRegion(playRegionStart, playRegionEnd);
5110  else
5111  *playRegionEnd = *playRegionStart = 0;
5112 }
AdornedRulerPanel * mRuler
Definition: Project.h:647
void GetPlayRegion(double *playRegionStart, double *playRegionEnd)
int AudacityProject::GetProjectNumber ( )
inline

Definition at line 409 of file Project.h.

Referenced by RefreshAllTitles(), and TitleRestorer::TitleRestorer().

409 { return mProjectNo;};
double AudacityProject::GetRate ( ) const
inline
AdornedRulerPanel * AudacityProject::GetRulerPanel ( )
double AudacityProject::GetScreenEndTime ( ) const
Scrubber& AudacityProject::GetScrubber ( )
inline
const Scrubber& AudacityProject::GetScrubber ( ) const
inline

Definition at line 787 of file Project.h.

787 { return *mScrubber; }
std::unique_ptr< Scrubber > mScrubber
Definition: Project.h:784
ScrubbingToolBar * AudacityProject::GetScrubbingToolBar ( )

Definition at line 4865 of file Project.cpp.

References mToolManager, and ScrubbingBarID.

Referenced by Scrubber::OnScrubOrSeek().

4866 {
4867  return dynamic_cast<ScrubbingToolBar*>
4868  (mToolManager ?
4869  mToolManager->GetToolBar(ScrubbingBarID) :
4870  nullptr);
4871 }
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
double AudacityProject::GetSel0 ( ) const
inline
double AudacityProject::GetSel1 ( ) const
inline
const SelectedRegion& AudacityProject::GetSelection ( ) const
inline
SelectedRegion& AudacityProject::GetSelection ( )
inline

Definition at line 220 of file Project.h.

220 { return mViewInfo.selectedRegion; }
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
ViewInfo mViewInfo
Definition: Project.h:555
SelectionBar * AudacityProject::GetSelectionBar ( )

Definition at line 4873 of file Project.cpp.

References mToolManager, and SelectionBarID.

Referenced by AddImportedTracks(), SetProjectCommand::Apply(), HandleXMLTag(), SetSelectionFormat(), SetSnapTo(), TP_DisplaySelection(), and UpdatePrefsVariables().

4874 {
4875  return (SelectionBar *)
4876  (mToolManager ?
4877  mToolManager->GetToolBar(SelectionBarID) :
4878  NULL);
4879 }
(not quite a Toolbar) at foot of screen for setting and viewing the selection range.
Definition: SelectionBar.h:44
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
const NumericFormatId & AudacityProject::GetSelectionFormat ( ) const
SelectionState& AudacityProject::GetSelectionState ( )
inline
bool AudacityProject::GetShowId3Dialog ( )
inline
int AudacityProject::GetSnapTo ( ) const

Definition at line 5310 of file Project.cpp.

References mSnapTo.

Referenced by AS_GetSnapTo(), SnapManager::Reinit(), and WriteXML().

5311 {
5312  return mSnapTo;
5313 }
SpectralSelectionBar * AudacityProject::GetSpectralSelectionBar ( )

Definition at line 4882 of file Project.cpp.

References mToolManager, and SpectralSelectionBarID.

Referenced by SetBandwidthSelectionFormatName(), SetFrequencySelectionFormatName(), and TP_DisplaySelection().

4883 {
4884  return static_cast<SpectralSelectionBar*>(
4885  (mToolManager ?
4886  mToolManager->GetToolBar(SpectralSelectionBarID) :
4887  NULL));
4888 }
(not quite a Toolbar) at foot of screen for setting and viewing the frequency selection range...
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
AudioIOStartStreamOptions AudacityProject::GetSpeedPlayOptions ( )

Definition at line 1374 of file Project.cpp.

References gAudioIO, AudioIO::GetBestRate(), GetRate(), TrackList::GetTimeTrack(), GetTracks(), and AudioIOStartStreamOptions::timeTrack.

Referenced by Scrubber::StartSpeedPlay().

1375 {
1376  auto PlayAtSpeedRate = gAudioIO->GetBestRate(
1377  false, //not capturing
1378  true, //is playing
1379  GetRate() //suggested rate
1380  );
1381  AudioIOStartStreamOptions options{ PlayAtSpeedRate };
1382  options.timeTrack = GetTracks()->GetTimeTrack();
1383  options.listener = this;
1384  return options;
1385 }
TimeTrack * timeTrack
Definition: AudioIO.h:138
TimeTrack * GetTimeTrack()
Definition: Track.cpp:1087
struct holding stream options, including a pointer to the TimeTrack and AudioIOListener and whether t...
Definition: AudioIO.h:124
double GetBestRate(bool capturing, bool playing, double sampleRate)
Return a valid sample rate that is supported by the current I/O device(s).
Definition: AudioIO.cpp:3105
AudioIO * gAudioIO
Definition: AudioIO.cpp:491
double GetRate() const
Definition: Project.h:216
TrackList * GetTracks()
Definition: Project.h:209
wxStatusBar* AudacityProject::GetStatusBar ( )
inline

Definition at line 515 of file Project.h.

Referenced by ControlToolBar::UpdateStatusBar().

515 { return mStatusBar; }
wxStatusBar * mStatusBar
Definition: Project.h:645
const Tags * AudacityProject::GetTags ( )
ToolManager* AudacityProject::GetToolManager ( )
inline
ToolsToolBar * AudacityProject::GetToolsToolBar ( )

Definition at line 4891 of file Project.cpp.

References mToolManager, and ToolsBarID.

Referenced by TimeShiftHandle::Click(), Track::HitTest(), ToolbarActions::Handler::OnNextTool(), ToolbarActions::Handler::OnPrevTool(), SelectHandle::Preview(), and TP_GetToolsToolBar().

4892 {
4893  return (ToolsToolBar *)
4894  (mToolManager ?
4895  mToolManager->GetToolBar(ToolsBarID) :
4896  NULL);
4897 }
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
A kind of ToolBar with Tools on it.
Definition: ToolsToolBar.h:49
const ToolsToolBar * AudacityProject::GetToolsToolBar ( ) const

Definition at line 4899 of file Project.cpp.

References mToolManager, and ToolsBarID.

4900 {
4901  return (ToolsToolBar *)
4902  (mToolManager ?
4903  mToolManager->GetToolBar(ToolsBarID) :
4904  NULL);
4905 }
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
A kind of ToolBar with Tools on it.
Definition: ToolsToolBar.h:49
wxPanel* AudacityProject::GetTopPanel ( )
inline

Definition at line 323 of file Project.h.

323 { return mTopPanel; }
wxPanel * mTopPanel
Definition: Project.h:648
wxSize AudacityProject::GetTPTracksUsableArea ( )

Definition at line 5056 of file Project.cpp.

References TrackPanel::GetTracksUsableArea(), and mTrackPanel.

Referenced by IsVisibleTrack::IsVisibleTrack().

5057 {
5058  wxSize s;
5059  mTrackPanel->GetTracksUsableArea(&s.x, &s.y);
5060  return s;
5061 }
void GetTracksUsableArea(int *width, int *height) const
Definition: TrackPanel.cpp:328
TrackPanel * mTrackPanel
Definition: Project.h:649
size_t AudacityProject::GetTrackCount ( ) const
inline

Definition at line 211 of file Project.h.

Referenced by PluginActions::DoEffect(), and UpdatePrefsVariables().

211 { return GetTracks()->size(); }
size_t size() const
Definition: Track.cpp:1077
TrackList * GetTracks()
Definition: Project.h:209
TrackFactory * AudacityProject::GetTrackFactory ( )
TrackPanel* AudacityProject::GetTrackPanel ( )
inline

Definition at line 324 of file Project.h.

Referenced by SelectTimeCommand::Apply(), ScreenshotCommand::Apply(), SetTrackStatusCommand::ApplyInner(), SetTrackVisualsCommand::ApplyInner(), AS_SetSelectionFormat(), SelectHandle::Click(), WaveformPrefs::Commit(), MenuButtonHandle::CommitChanges(), Scrubber::ContinueScrubbingPoll(), LabelTrack::DialogForLabelName(), PluginActions::DoEffect(), EditCursorOverlay::DoGetRectangle(), SelectActions::DoListSelection(), TrackActions::DoMoveTrack(), TrackActions::DoRemoveTrack(), TrackActions::DoRemoveTracks(), DoScroll(), Scrubber::DoScrub(), TrackActions::DoTrackMute(), TrackActions::DoTrackSolo(), EditActions::DoUndo(), ViewActions::DoZoomFitV(), EditCursorOverlay::Draw(), AdornedRulerPanel::DrawBothOverlays(), DeviceToolBar::EnableDisableButtons(), GetInfoCommand::ExploreTrackPanel(), CommandManager::FilterKeyEvent(), FixScrollbars(), MenuManager::GetFocusedFrame(), ViewActions::GetZoomOfToFit(), CommonTrackPanelCell::HandleWheelRotation(), GainSliderHandle::HitTest(), VelocitySliderHandle::HitTest(), PanSliderHandle::HitTest(), LabelTrack::KeyDown(), Scrubber::MaybeStartScrubbing(), ModifyState(), SelectHandle::MoveSnappingFreqSelection(), EditActions::Handler::OnCopy(), LabelEditActions::Handler::OnCopyLabels(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), NavigationActions::Handler::OnFirstTrack(), LabelTrack::OnKeyDown(), NavigationActions::Handler::OnLastTrack(), TrackActions::Handler::OnNewLabelTrack(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewTimeTrack(), TrackActions::Handler::OnNewWaveTrack(), ToolbarActions::Handler::OnNextTool(), EditActions::Handler::OnPaste(), LabelEditActions::Handler::OnPasteNewLabel(), TransportActions::Handler::OnPlayOneSecond(), TransportActions::Handler::OnPlayToSelection(), ToolbarActions::Handler::OnPrevTool(), FileActions::Handler::OnPrint(), EditActions::Handler::OnRedo(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), SelectActions::Handler::OnSetLeftSelection(), SelectActions::Handler::OnSetRightSelection(), ViewActions::Handler::OnShowClipping(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), TrackActions::Handler::OnSortName(), TrackActions::Handler::OnSortTime(), EditActions::Handler::OnSplit(), WaveTrackMenuTable::OnSwapChannels(), TrackActions::Handler::OnSyncLock(), PlayIndicatorOverlay::OnTimer(), ScrubbingOverlay::OnTimer(), SelectHandle::TimerHandler::OnTimer(), NavigationActions::Handler::OnToggle(), SelectActions::Handler::OnToggleSpectralSelection(), TrackActions::Handler::OnTrackClose(), TrackActions::Handler::OnTrackGain(), TrackActions::Handler::OnTrackGainDec(), TrackActions::Handler::OnTrackGainInc(), TrackActions::Handler::OnTrackMenu(), TrackActions::Handler::OnTrackMoveBottom(), TrackActions::Handler::OnTrackMoveDown(), TrackActions::Handler::OnTrackMoveTop(), TrackActions::Handler::OnTrackMoveUp(), TrackActions::Handler::OnTrackMute(), TrackActions::Handler::OnTrackPan(), TrackActions::Handler::OnTrackPanLeft(), TrackActions::Handler::OnTrackPanRight(), TrackActions::Handler::OnTrackSolo(), SelectActions::Handler::OnZeroCrossing(), ViewActions::Handler::OnZoomNormal(), ViewActions::Handler::OnZoomToggle(), TrackSelectHandle::Preview(), SpectrumPrefs::Preview(), PushState(), AdornedRulerPanel::QuickPlayIndicatorOverlay::QuickPlayIndicatorOverlay(), SpectrumPrefs::Rollback(), GetInfoCommand::SendTracks(), SetSyncLock(), AdornedRulerPanel::UpdateQuickPlayPos(), and AdornedRulerPanel::QuickPlayIndicatorOverlay::~QuickPlayIndicatorOverlay().

324 {return mTrackPanel;}
TrackPanel * mTrackPanel
Definition: Project.h:649
const TrackPanel* AudacityProject::GetTrackPanel ( ) const
inline

Definition at line 325 of file Project.h.

325 {return mTrackPanel;}
TrackPanel * mTrackPanel
Definition: Project.h:649
TrackList* AudacityProject::GetTracks ( )
inline

Definition at line 209 of file Project.h.

Referenced by SelectHandle::AdjustSelection(), AdornedRulerPanel::AdornedRulerPanel(), SetTrackBase::Apply(), SetLabelCommand::Apply(), SelectTimeCommand::Apply(), SelectTracksCommand::Apply(), ScreenshotCommand::Apply(), TrackSelectHandle::CalculateRearrangingThresholds(), TrackPanelResizeHandle::Cancel(), Exporter::CheckMix(), ControlToolBar::ChooseExistingRecordingTracks(), LabelDefaultClickHandle::Click(), BackgroundHandle::Click(), LabelTextHandle::Click(), ButtonHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), LOFImportFileHandle::doDurationAndScrollOffset(), LabelTrack::DoEditLabels(), PluginActions::DoEffect(), FileActions::DoImportMIDI(), SelectActions::DoListSelection(), TransportActions::DoLockPlayRegion(), TrackActions::DoMoveTrack(), TrackActions::DoRemoveTrack(), TrackActions::DoRemoveTracks(), DoSave(), SelectActions::DoSelectSomething(), TrackActions::DoTrackMute(), TrackActions::DoTrackSolo(), ViewActions::DoZoomFit(), ViewActions::DoZoomFitV(), TrackPanelResizeHandle::Drag(), TrackSelectHandle::Drag(), LabelTextHandle::Drag(), NoteTrackVZoomHandle::Drag(), ButtonHandle::Drag(), WaveTrackVZoomHandle::Drag(), SelectHandle::Drag(), TimeShiftHandle::Drag(), TranscriptionToolBar::EnableDisableButtons(), ControlToolBar::EnableDisableButtons(), EnqueueODTasks(), Exporter::ExamineTracks(), GetInfoCommand::ExploreTrackPanel(), ExportOGG::Export(), ExportFFmpeg::Export(), ExportFLAC::Export(), ExportCL::Export(), ExportPCM::Export(), ExportMP3::Export(), RecordingRecoveryHandler::FindTrack(), FixScrollbars(), GetAllSeqBlocks(), FreqWindow::GetAudio(), ContrastDialog::GetDB(), GetDefaultPlayOptions(), MacroCommands::GetEndTime(), CompareAudioCommand::GetSelection(), SliderHandle::GetSlider(), GetSpeedPlayOptions(), ScreenshotCommand::GetTrackRect(), MenuManager::GetUpdateFlags(), ViewActions::GetZoomOfToFit(), CommonTrackPanelCell::HandleWheelRotation(), RecordingRecoveryHandler::HandleXMLEndTag(), RecordingRecoveryHandler::HandleXMLTag(), SelectHandle::HitTest(), NyquistEffect::Init(), EffectEqualization::Init(), InitialState(), TrackMenuTable::InitMenu(), WaveTrackMenuTable::InitMenu(), MacroCommands::IsMono(), ODTask::IsTaskAssociatedWithProject(), LOFImportFileHandle::lofOpenFiles(), Scrubber::MaybeStartScrubbing(), ModifyState(), OnAudioIOStopRecording(), ViewActions::Handler::OnCollapseAllTracks(), EditActions::Handler::OnCopy(), LabelEditActions::Handler::OnCopyLabels(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), EditActions::Handler::OnDelete(), LabelEditActions::Handler::OnDeleteLabels(), EditActions::Handler::OnDisjoin(), LabelEditActions::Handler::OnDisjoinLabels(), EditActions::Handler::OnDuplicate(), ViewActions::Handler::OnExpandAllTracks(), FileActions::Handler::OnExportLabels(), FileActions::Handler::OnExportMIDI(), NavigationActions::Handler::OnFirstTrack(), ContrastDialog::OnGetBackground(), ContrastDialog::OnGetForeground(), FileActions::Handler::OnImportLabels(), EditActions::Handler::OnJoin(), LabelEditActions::Handler::OnJoinLabels(), LabelTrack::OnKeyDown(), NavigationActions::Handler::OnLastTrack(), WaveTrackMenuTable::OnMergeStereo(), TrackActions::Handler::OnMuteAllTracks(), TrackActions::Handler::OnNewLabelTrack(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewTimeTrack(), TrackActions::Handler::OnNewWaveTrack(), EditActions::Handler::OnPaste(), LabelEditActions::Handler::OnPasteNewLabel(), FileActions::Handler::OnPrint(), TransportActions::Handler::OnPunchAndRoll(), ControlToolBar::OnRecord(), TrackActions::Handler::OnResample(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), ScreenFrame::OnShortTracks(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), EditActions::Handler::OnSplit(), EditActions::Handler::OnSplitCut(), LabelEditActions::Handler::OnSplitCutLabels(), EditActions::Handler::OnSplitDelete(), LabelEditActions::Handler::OnSplitDeleteLabels(), LabelEditActions::Handler::OnSplitLabels(), EditActions::Handler::OnSplitNew(), WaveTrackMenuTable::OnSwapChannels(), TrackActions::Handler::OnTrackMoveBottom(), TrackActions::Handler::OnTrackMoveDown(), TrackActions::Handler::OnTrackMoveTop(), TrackActions::Handler::OnTrackMoveUp(), EditActions::Handler::OnTrim(), TrackActions::Handler::OnUnmuteAllTracks(), OpenFile(), TranscriptionToolBar::PlayAtSpeed(), ControlToolBar::PlayPlayRegion(), NyquistEffect::Process(), ProjectHasTracks(), PushState(), RedoAvailable(), RedrawProject(), LabelTextHandle::Release(), NoteTrackButtonHandle::Release(), WaveTrackVZoomHandle::Release(), ButtonHandle::Release(), LabelDefaultClickHandle::RestoreState(), SaveCopyWaveTracks(), LabelDefaultClickHandle::SaveState(), SelectNone(), GetInfoCommand::SendClips(), GetInfoCommand::SendEnvelopes(), GetInfoCommand::SendLabels(), GetInfoCommand::SendTracks(), ControlToolBar::SetupCutPreviewTracks(), ScreenFrame::SizeTracks(), WaveTrackMenuTable::SplitStereo(), Scrubber::StartSpeedPlay(), UndoAvailable(), and WriteXML().

209 { return mTracks.get(); }
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
const TrackList* AudacityProject::GetTracks ( ) const
inline

Definition at line 210 of file Project.h.

210 { return mTracks.get(); }
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
bool AudacityProject::GetTracksFitVerticallyZoomed ( )
inline

Definition at line 330 of file Project.h.

Referenced by PushState().

330 { return mTracksFitVerticallyZoomed; } //lda
bool mTracksFitVerticallyZoomed
Definition: Project.h:710
TranscriptionToolBar * AudacityProject::GetTranscriptionToolBar ( )
UndoManager* AudacityProject::GetUndoManager ( )
inline
wxScrollBar& AudacityProject::GetVerticalScrollBar ( )
inline

Definition at line 657 of file Project.h.

Referenced by ViewActions::Handler::OnZoomFitV().

657 { return *mVsbar; }
wxScrollBar * mVsbar
Definition: Project.h:654
const ViewInfo& AudacityProject::GetViewInfo ( ) const
inline

Definition at line 224 of file Project.h.

Referenced by LabelTextHandle::Cancel(), SelectHandle::Cancel(), AdornedRulerPanel::QPHandle::Cancel(), LabelTextHandle::Click(), CutlineHandle::Click(), SampleHandle::Click(), LabelGlyphHandle::Click(), EnvelopeHandle::Click(), SelectHandle::Click(), StretchHandle::Click(), TimeShiftHandle::Click(), AdornedRulerPanel::QPHandle::Click(), Scrubber::ContinueScrubbingPoll(), LabelTrack::DialogForLabelName(), LabelTrack::DoEditLabels(), SelectActions::DoListSelection(), TransportActions::DoPlayStopSelect(), SelectActions::DoSelectSomething(), ViewActions::DoZoomFit(), SampleHandle::Drag(), LabelGlyphHandle::Drag(), EnvelopeHandle::Drag(), SelectHandle::Drag(), TimeShiftHandle::Drag(), Scrubber::FindScrubSpeed(), MenuManager::GetUpdateFlags(), ViewActions::GetZoomOfToFit(), CommonTrackPanelCell::HandleWheelRotation(), EnvelopeHandle::HitEnvelope(), CutlineHandle::HitTest(), SampleHandle::HitTest(), SelectHandle::HitTest(), StretchHandle::HitTest(), Scrubber::MaybeStartScrubbing(), LabelEditActions::Handler::OnAddLabel(), EditActions::Handler::OnCopy(), LabelEditActions::Handler::OnCopyLabels(), SelectActions::Handler::OnCursorPositionStore(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), EditActions::Handler::OnDelete(), LabelEditActions::Handler::OnDeleteLabels(), EditActions::Handler::OnDisjoin(), LabelEditActions::Handler::OnDisjoinLabels(), EditActions::Handler::OnDuplicate(), FileActions::Handler::OnExportSelection(), ViewActions::Handler::OnGoSelEnd(), ViewActions::Handler::OnGoSelStart(), EditActions::Handler::OnJoin(), LabelEditActions::Handler::OnJoinLabels(), EditActions::Handler::OnPaste(), LabelEditActions::Handler::OnPasteNewLabel(), TransportActions::Handler::OnPlayAfterSelectionEnd(), TransportActions::Handler::OnPlayAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionEnd(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeSelectionEnd(), TransportActions::Handler::OnPlayBeforeSelectionStart(), TransportActions::Handler::OnPlayToSelection(), TransportActions::Handler::OnPunchAndRoll(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelectionSave(), SelectActions::Handler::OnSelectNone(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectTrackStartToEnd(), SelectActions::Handler::OnSetLeftSelection(), SelectActions::Handler::OnSetRightSelection(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), EditActions::Handler::OnSplit(), EditActions::Handler::OnSplitCut(), LabelEditActions::Handler::OnSplitCutLabels(), EditActions::Handler::OnSplitDelete(), LabelEditActions::Handler::OnSplitDeleteLabels(), LabelEditActions::Handler::OnSplitLabels(), EditActions::Handler::OnSplitNew(), PlayIndicatorOverlay::OnTimer(), ScrubbingOverlay::OnTimer(), EditActions::Handler::OnTrim(), SelectActions::Handler::OnZeroCrossing(), ViewActions::Handler::OnZoomSel(), ViewActions::Handler::OnZoomToggle(), SelectHandle::Preview(), ZoomHandle::Release(), LabelGlyphHandle::Release(), EnvelopeHandle::Release(), StretchHandle::Release(), SelectHandle::StartSelection(), and StretchHandle::Stretch().

224 { return mViewInfo; }
ViewInfo mViewInfo
Definition: Project.h:555
ViewInfo& AudacityProject::GetViewInfo ( )
inline

Definition at line 225 of file Project.h.

225 { return mViewInfo; }
ViewInfo mViewInfo
Definition: Project.h:555
const ZoomInfo& AudacityProject::GetZoomInfo ( ) const
inline

Definition at line 223 of file Project.h.

Referenced by EditCursorOverlay::DoGetRectangle(), and EditCursorOverlay::Draw().

223 { return mViewInfo; }
ViewInfo mViewInfo
Definition: Project.h:555
void AudacityProject::HandleResize ( )

Definition at line 2159 of file Project.cpp.

References FixScrollbars(), mTrackPanel, and UpdateLayout().

Referenced by TrackActions::DoRemoveTrack(), FileActions::Handler::OnImport(), FileActions::Handler::OnImportRaw(), OnSize(), OnToolBarUpdate(), OpenFile(), PopState(), SetStateTo(), and TP_HandleResize().

2160 {
2161  if (!mTrackPanel)
2162  return;
2163 
2164  FixScrollbars();
2165 
2166  UpdateLayout();
2167 }
void UpdateLayout()
Definition: Project.cpp:2130
void FixScrollbars()
Definition: Project.cpp:1973
TrackPanel * mTrackPanel
Definition: Project.h:649
XMLTagHandler * AudacityProject::HandleXMLChild ( const wxChar *  tag)
overridevirtual

Implements XMLTagHandler.

Definition at line 3633 of file Project.cpp.

References mImportXMLTagHandler, mRecordingRecoveryHandler, mTags, mTrackFactory, and mTracks.

3634 {
3635  if (!wxStrcmp(tag, wxT("tags"))) {
3636  return mTags.get();
3637  }
3638 
3639  // Note that TrackList::Add includes assignment of unique in-session TrackId
3640  // to a reloaded track, though no promise that it equals the id it originally
3641  // had
3642 
3643  if (!wxStrcmp(tag, wxT("wavetrack"))) {
3644  return mTracks->Add(mTrackFactory->NewWaveTrack());
3645  }
3646 
3647  #ifdef USE_MIDI
3648  if (!wxStrcmp(tag, wxT("notetrack"))) {
3649  return mTracks->Add(mTrackFactory->NewNoteTrack());
3650  }
3651  #endif // USE_MIDI
3652 
3653  if (!wxStrcmp(tag, wxT("labeltrack"))) {
3654  return mTracks->Add(mTrackFactory->NewLabelTrack());
3655  }
3656 
3657  if (!wxStrcmp(tag, wxT("timetrack"))) {
3658  return mTracks->Add(mTrackFactory->NewTimeTrack());
3659  }
3660 
3661  if (!wxStrcmp(tag, wxT("recordingrecovery"))) {
3663  mRecordingRecoveryHandler = std::make_unique<RecordingRecoveryHandler>(this);
3664  return mRecordingRecoveryHandler.get();
3665  }
3666 
3667  if (!wxStrcmp(tag, wxT("import"))) {
3668  if (!mImportXMLTagHandler)
3669  mImportXMLTagHandler = std::make_unique<ImportXMLTagHandler>(this);
3670  return mImportXMLTagHandler.get();
3671  }
3672 
3673  return NULL;
3674 }
std::unique_ptr< ImportXMLTagHandler > mImportXMLTagHandler
Definition: Project.h:723
std::unique_ptr< TrackFactory > mTrackFactory
Definition: Project.h:651
std::unique_ptr< RecordingRecoveryHandler > mRecordingRecoveryHandler
Definition: Project.h:738
std::shared_ptr< Tags > mTags
Definition: Project.h:606
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
bool AudacityProject::HandleXMLTag ( const wxChar *  tag,
const wxChar **  attrs 
)
overridevirtual

XMLValueChecker::IsGoodInt(fileVersion) ||

Implements XMLTagHandler.

Definition at line 3411 of file Project.cpp.

References _(), AUDACITY_FILE_FORMAT_VERSION, AUDACITY_VERSION_STRING, AudacityMessageBox(), NumericConverter::BANDWIDTH, Internat::CompatibleToDouble(), NumericConverter::FREQUENCY, GetName(), GetSelectionBar(), gsLegacyFileWarning(), XMLValueChecker::IsGoodPathString(), XMLValueChecker::IsGoodString(), NumericConverter::LookupFormat(), mbInitializingScrollbar, mbLoadedFromAup, mDirManager, mFileName, mIsRecovered, mRate, mRecoveryAutoSaveDataDir, mViewInfo, ViewInfo::ReadXMLAttribute(), SetBandwidthSelectionFormatName(), SetFrequencySelectionFormatName(), SetProjectTitle(), SelectionBar::SetRate(), SetSelectionFormat(), SetSnapTo(), NumericConverter::TIME, ViewInfo::UpdatePrefs(), and ZoomInfo::vpos.

3412 {
3413  bool bFileVersionFound = false;
3414  wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
3415  wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
3416  int requiredTags = 0;
3417  long longVpos = 0;
3418 
3419  // loop through attrs, which is a null-terminated list of
3420  // attribute-value pairs
3421  while(*attrs) {
3422  const wxChar *attr = *attrs++;
3423  const wxChar *value = *attrs++;
3424 
3425  if (!value || !XMLValueChecker::IsGoodString(value))
3426  break;
3427 
3428  if (mViewInfo.ReadXMLAttribute(attr, value)) {
3429  // We need to save vpos now and restore it below
3430  longVpos = std::max(longVpos, long(mViewInfo.vpos));
3431  continue;
3432  }
3433 
3434  if (!wxStrcmp(attr, wxT("datadir")))
3435  {
3436  //
3437  // This is an auto-saved version whose data is in another directory
3438  //
3439  // Note: This attribute must currently be written and parsed before
3440  // any other attributes
3441  //
3442  if ((value[0] != 0) && XMLValueChecker::IsGoodPathString(value))
3443  {
3444  // Remember that this is a recovered project
3445  mIsRecovered = true;
3446  mRecoveryAutoSaveDataDir = value;
3447  }
3448  }
3449 
3450  else if (!wxStrcmp(attr, wxT("version")))
3451  {
3452  fileVersion = value;
3453  bFileVersionFound = true;
3454  requiredTags++;
3455  }
3456 
3457  else if (!wxStrcmp(attr, wxT("audacityversion"))) {
3458  audacityVersion = value;
3459  requiredTags++;
3460  }
3461 
3462  else if (!wxStrcmp(attr, wxT("projname"))) {
3463  wxString projName;
3464  wxString projPath;
3465 
3466  if (mIsRecovered) {
3467  // Fake the filename as if we had opened the original file
3468  // (which was lost by the crash) rather than the one in the
3469  // auto save folder
3470  wxFileName realFileDir;
3471  realFileDir.AssignDir(mRecoveryAutoSaveDataDir);
3472  realFileDir.RemoveLastDir();
3473 
3474  wxString realFileName = value;
3475  if (realFileName.Length() >= 5 &&
3476  realFileName.Right(5) == wxT("_data"))
3477  {
3478  realFileName = realFileName.Left(realFileName.Length() - 5);
3479  }
3480 
3481  if (realFileName.IsEmpty())
3482  {
3483  // A previously unsaved project has been recovered, so fake
3484  // an unsaved project. The data files just stay in the temp
3485  // directory
3486  mDirManager->SetLocalTempDir(mRecoveryAutoSaveDataDir);
3487  mFileName = wxT("");
3488  projName = wxT("");
3489  projPath = wxT("");
3490  } else
3491  {
3492  realFileName += wxT(".aup");
3493  projPath = realFileDir.GetFullPath();
3494  mFileName = wxFileName(projPath, realFileName).GetFullPath();
3495  mbLoadedFromAup = true;
3496  projName = value;
3497  }
3498 
3499  SetProjectTitle();
3500  } else {
3501  projName = value;
3502  projPath = wxPathOnly(mFileName);
3503  }
3504 
3505  if (!projName.IsEmpty())
3506  {
3507  // First try to load the data files based on the _data dir given in the .aup file
3508  // If this fails then try to use the filename of the .aup as the base directory
3509  // This is because unzipped projects e.g. those that get transfered between mac-pc
3510  // have encoding issues and end up expanding the wrong filenames for certain
3511  // international characters (such as capital 'A' with an umlaut.)
3512  if (!mDirManager->SetProject(projPath, projName, false))
3513  {
3514  projName = GetName() + wxT("_data");
3515  if (!mDirManager->SetProject(projPath, projName, false)) {
3516  AudacityMessageBox(wxString::Format(_("Couldn't find the project data folder: \"%s\""),
3517  projName),
3518  _("Error Opening Project"),
3519  wxOK | wxCENTRE, this);
3520  return false;
3521  }
3522  }
3523  }
3524 
3525  requiredTags++;
3526  }
3527 
3528  else if (!wxStrcmp(attr, wxT("rate"))) {
3531  }
3532 
3533  else if (!wxStrcmp(attr, wxT("snapto"))) {
3534  SetSnapTo(wxString(value) == wxT("on") ? true : false);
3535  }
3536 
3537  else if (!wxStrcmp(attr, wxT("selectionformat")))
3540 
3541  else if (!wxStrcmp(attr, wxT("frequencyformat")))
3544 
3545  else if (!wxStrcmp(attr, wxT("bandwidthformat")))
3548  } // while
3549 
3551 
3552  if (longVpos != 0) {
3553  // PRL: It seems this must happen after SetSnapTo
3554  mViewInfo.vpos = longVpos;
3555  mbInitializingScrollbar = true;
3556  }
3557 
3558  // Specifically detect newer versions of Audacity
3559  // WARNING: This will need review/revision if we ever have a version string
3560  // such as 1.5.10, i.e. with 2 digit numbers.
3561  // We're able to do a shortcut and use string comparison because we know
3562  // that does not happen.
3563  // TODO: Um. We actually have released 0.98 and 1.3.14 so the comment
3564  // above is inaccurate.
3565 
3566  if (!bFileVersionFound ||
3567  (fileVersion.Length() != 5) || // expecting '1.1.0', for example
3568  // JKC: I commentted out next line. IsGoodInt is not for
3569  // checking dotted numbers.
3571  (fileVersion > wxT(AUDACITY_FILE_FORMAT_VERSION)))
3572  {
3573  wxString msg;
3574  /* i18n-hint: %s will be replaced by the version number.*/
3575  msg.Printf(_("This file was saved using Audacity %s.\nYou are using Audacity %s. You may need to upgrade to a newer version to open this file."),
3576  audacityVersion,
3578  AudacityMessageBox(msg,
3579  _("Can't open project file"),
3580  wxOK | wxICON_EXCLAMATION | wxCENTRE, this);
3581  return false;
3582  }
3583 
3584  // NOTE: It looks as if there was some confusion about fileversion and audacityversion.
3585  // fileversion NOT being increased when file formats changed, so unfortunately we're
3586  // using audacityversion to rescue the situation.
3587 
3588  // KLUDGE: guess the true 'fileversion' by stripping away any '-beta-Rc' stuff on
3589  // audacityVersion.
3590  // It's fairly safe to do this as it has already been established that the
3591  // puported file version was five chars long.
3592  fileVersion = audacityVersion.Mid(0,5);
3593 
3594  bool bIsOld = fileVersion < wxT(AUDACITY_FILE_FORMAT_VERSION);
3595  bool bIsVeryOld = fileVersion < wxT("1.1.9" );
3596  // Very old file versions could even have the file version starting
3597  // with text: 'AudacityProject Version 0.95'
3598  // Atoi return zero in this case.
3599  bIsVeryOld |= wxAtoi( fileVersion )==0;
3600  // Specifically detect older versions of Audacity
3601  if ( bIsOld | bIsVeryOld ) {
3602  wxString msg;
3603  msg.Printf(gsLegacyFileWarning(), audacityVersion);
3604 
3605  int icon_choice = wxICON_EXCLAMATION;
3606  if( bIsVeryOld )
3607  // Stop icon, and choose 'NO' by default.
3608  icon_choice = wxICON_STOP | wxNO_DEFAULT;
3609  int action =
3610  AudacityMessageBox(msg,
3611  _("Warning - Opening Old Project File"),
3612  wxYES_NO | icon_choice | wxCENTRE,
3613  this);
3614  if (action == wxNO)
3615  return false;
3616  }
3617 
3618  if (wxStrcmp(tag, wxT("audacityproject")) &&
3619  wxStrcmp(tag, wxT("project"))) {
3620  // If the tag name is not one of these two (the NEW name is
3621  // "project" with an Audacity namespace, but we don't detect
3622  // the namespace yet), then we don't know what the error is
3623  return false;
3624  }
3625 
3626  if (requiredTags < 3)
3627  return false;
3628 
3629  // All other tests passed, so we succeed
3630  return true;
3631 }
void SetFrequencySelectionFormatName(const NumericFormatId &format)
Definition: Project.cpp:1729
bool mbLoadedFromAup
Definition: Project.h:593
#define AUDACITY_VERSION_STRING
Definition: Audacity.h:81
void SetRate(double rate)
bool mbInitializingScrollbar
Definition: Project.h:757
wxString mRecoveryAutoSaveDataDir
Definition: Project.h:735
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
wxString mFileName
Definition: Project.h:592
static bool IsGoodPathString(const wxString &str)
void UpdatePrefs()
Definition: ViewInfo.cpp:150
void SetProjectTitle(int number=-1)
Definition: Project.cpp:1562
#define AUDACITY_FILE_FORMAT_VERSION
Definition: Audacity.h:108
static bool IsGoodString(const wxString &str)
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
Definition: Internat.cpp:122
double mRate
Definition: Project.h:599
static NumericFormatId LookupFormat(Type type, const wxString &id)
ViewInfo mViewInfo
Definition: Project.h:555
int vpos
Definition: ViewInfo.h:45
bool ReadXMLAttribute(const wxChar *attr, const wxChar *value)
Definition: ViewInfo.cpp:178
void SetSnapTo(int snap)
Definition: Project.cpp:5302
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxString GetName()
Definition: Project.cpp:1549
SelectionBar * GetSelectionBar()
Definition: Project.cpp:4873
void SetSelectionFormat(const NumericFormatId &format)
Definition: Project.cpp:1754
bool mIsRecovered
Definition: Project.h:732
static wxString gsLegacyFileWarning()
Definition: Project.cpp:2932
void SetBandwidthSelectionFormatName(const NumericFormatId &format)
Definition: Project.cpp:1744
bool AudacityProject::HasKeyboardCapture ( const wxWindow *  handler)
static

Definition at line 5336 of file Project.cpp.

References GetKeyboardCaptureHandler().

Referenced by CellularPanel::OnKillFocus().

5337 {
5338  return GetKeyboardCaptureHandler() == handler;
5339 }
static wxWindow * GetKeyboardCaptureHandler()
Definition: Project.cpp:5342
bool AudacityProject::Import ( const wxString &  fileName,
WaveTrackArray pTrackArray = NULL 
)

Definition at line 4304 of file Project.cpp.

References _(), AudacityApp::AddFileToHistory(), AddImportedTracks(), PluginActions::DoEffect(), EffectManager::Get(), Importer::Get(), GetDirManager(), GetTrackFactory(), gPrefs, Importer::Import(), PluginActions::kConfigured, mTags, SelectAllIfNone(), SelectNone(), ShowErrorDialog(), valueRestorer(), and wxGetApp().

Referenced by ImportCommand::Apply(), ImportXMLTagHandler::HandleXMLTag(), ApplyMacroDialog::OnApplyToFiles(), FileActions::Handler::OnImport(), and OpenFile().

4305 {
4306  TrackHolders newTracks;
4307  wxString errorMessage = wxEmptyString;
4308 
4309  {
4310  // Backup Tags, before the import. Be prepared to roll back changes.
4311  auto cleanup = valueRestorer( mTags,
4312  mTags ? mTags->Duplicate() : decltype(mTags){} );
4313 
4314  bool success = Importer::Get().Import(fileName,
4315  GetTrackFactory(),
4316  newTracks,
4317  mTags.get(),
4318  errorMessage);
4319 
4320  if (!errorMessage.IsEmpty()) {
4321  // Error message derived from Importer::Import
4322  // Additional help via a Help button links to the manual.
4323  ShowErrorDialog(this, _("Error Importing"),
4324  errorMessage, wxT("Importing_Audio"));
4325  }
4326  if (!success)
4327  return false;
4328 
4329  wxGetApp().AddFileToHistory(fileName);
4330 
4331  // no more errors, commit
4332  cleanup.release();
4333  }
4334 
4335  // for LOF ("list of files") files, do not import the file as if it
4336  // were an audio file itself
4337  if (fileName.AfterLast('.').IsSameAs(wxT("lof"), false)) {
4338  // PRL: don't redundantly do the steps below, because we already
4339  // did it in case of LOF, because of some weird recursion back to this
4340  // same function. I think this should be untangled.
4341 
4342  // So Undo history push is not bypassed, despite appearances.
4343  return false;
4344  }
4345 
4346  // PRL: Undo history is incremented inside this:
4347  auto newSharedTracks = AddImportedTracks(fileName, std::move(newTracks));
4348 
4349  if (pTrackArray) {
4350  for (const auto &newTrack : newSharedTracks) {
4351  newTrack->TypeSwitch( [&](WaveTrack *wt) {
4352  pTrackArray->push_back( Track::Pointer< WaveTrack >( wt ) );
4353  });
4354  }
4355  }
4356 
4357  int mode = gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"), 0L);
4358  if (mode == 1) {
4359  //TODO: All we want is a SelectAll()
4360  SelectNone();
4361  SelectAllIfNone();
4362  const CommandContext context( *this);
4364  EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
4365  context,
4367  }
4368 
4369  // This is a no-fail:
4370  GetDirManager()->FillBlockfilesCache();
4371  return true;
4372 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
std::vector< std::shared_ptr< Track > > AddImportedTracks(const wxString &fileName, TrackHolders &&newTracks)
Definition: Project.cpp:4191
bool Import(const wxString &fName, TrackFactory *trackFactory, TrackHolders &tracks, Tags *tags, wxString &errorMessage)
Definition: Import.cpp:336
CommandContext provides addiitonal information to an 'Apply()' command. It provides the project...
void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, const bool Close)
Displays an error dialog with a button that offers help.
std::shared_ptr< Tags > mTags
Definition: Project.h:606
void AddFileToHistory(const wxString &name)
const std::shared_ptr< DirManager > & GetDirManager()
Definition: Project.cpp:1508
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
static EffectManager & Get()
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:426
std::vector< NewChannelGroup > TrackHolders
Definition: ImportRaw.h:27
void SelectNone()
Definition: Project.cpp:5653
AudacityApp & wxGetApp()
static Importer & Get()
Definition: Import.cpp:72
bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
TrackFactory * GetTrackFactory()
Definition: Project.cpp:1513
void SelectAllIfNone()
Definition: Project.cpp:5751
void AudacityProject::InitialState ( )
private

Definition at line 4601 of file Project.cpp.

References _(), UndoManager::ClearStates(), GetMenuManager, GetTracks(), GetUndoManager(), MenuManager::ModifyUndoMenuItems(), mTags, mViewInfo, UndoManager::PushState(), ViewInfo::selectedRegion, UndoManager::StateSaved(), and MenuManager::UpdateMenus().

Referenced by OpenFile().

4602 {
4604 
4606  _("Created new project"), wxT(""));
4607 
4609 
4610  GetMenuManager(*this).ModifyUndoMenuItems(*this);
4611 
4612  GetMenuManager(*this).UpdateMenus(*this);
4613 }
void PushState(const TrackList *l, const SelectedRegion &selectedRegion, const std::shared_ptr< Tags > &tags, const wxString &longDescription, const wxString &shortDescription, UndoPush flags=UndoPush::AUTOSAVE)
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
void StateSaved()
void UpdateMenus(AudacityProject &project, bool checkActive=true)
Definition: Menus.cpp:646
void ClearStates()
std::shared_ptr< Tags > mTags
Definition: Project.h:606
friend MenuManager & GetMenuManager(AudacityProject &project)
Definition: Menus.cpp:58
ViewInfo mViewInfo
Definition: Project.h:555
static void ModifyUndoMenuItems(AudacityProject &project)
Definition: Menus.cpp:302
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
UndoManager * GetUndoManager()
Definition: Project.h:212
TrackList * GetTracks()
Definition: Project.h:209
bool AudacityProject::IsActive ( )
override

Definition at line 2450 of file Project.cpp.

References mActive.

Referenced by MenuManager::GetUpdateFlags().

2451 {
2452  return mActive;
2453 }
bool AudacityProject::IsAlreadyOpen ( const wxString &  projPathName)
static

Definition at line 2856 of file Project.cpp.

References _(), AudacityMessageBox(), and gAudacityProjects.

Referenced by AudacityApp::MRUOpen(), AudacityApp::OnMRUFile(), OpenFile(), and OpenFiles().

2857 {
2858  const wxFileName newProjPathName(projPathName);
2859  size_t numProjects = gAudacityProjects.size();
2860  for (size_t i = 0; i < numProjects; i++)
2861  {
2862  if (newProjPathName.SameAs(gAudacityProjects[i]->mFileName))
2863  {
2864  wxString errMsg =
2865  wxString::Format(_("%s is already open in another window."),
2866  newProjPathName.GetName());
2867  wxLogError(errMsg);
2868  AudacityMessageBox(errMsg, _("Error Opening Project"), wxOK | wxCENTRE);
2869  return true;
2870  }
2871  }
2872  return false;
2873 }
AProjectArray gAudacityProjects
Definition: Project.cpp:306
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool AudacityProject::IsAudioActive ( ) const
bool AudacityProject::IsCapturing ( ) const
inline

Definition at line 763 of file Project.h.

Referenced by MenuManager::GetUpdateFlags().

763 { return mIsCapturing; }
bool mIsCapturing
Definition: Project.h:760
bool AudacityProject::IsFocused ( const wxWindow *  window) const

Definition at line 5585 of file Project.cpp.

References mFocusLender.

5586 {
5587  return window == mFocusLender || window == wxWindow::FindFocus();
5588 }
wxWindowRef mFocusLender
Definition: Project.h:831
bool AudacityProject::IsPlayRegionLocked ( )
inline
bool AudacityProject::IsProjectSaved ( )

Definition at line 5389 of file Project.cpp.

References mDirManager.

Referenced by AddImportedTracks(), MenuManager::GetUpdateFlags(), TransportActions::Handler::OnTimerRecord(), Save(), SaveFromTimerRecording(), and WriteXML().

5389  {
5390  // This is true if a project was opened from an .aup
5391  // Otherwise it becomes true only when a project is first saved successfully
5392  // in DirManager::SetProject
5393  wxString sProjectName = mDirManager->GetProjectName();
5394  return (sProjectName != wxT(""));
5395 }
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
bool AudacityProject::IsSoloNone ( ) const
inline
bool AudacityProject::IsSoloSimple ( ) const
inline
bool AudacityProject::IsSyncLocked ( )

Definition at line 5315 of file Project.cpp.

References mIsSyncLocked.

Referenced by SelectHandle::Click(), SelectActions::DoListSelection(), MenuManager::GetUpdateFlags(), Track::IsSyncLockSelected(), EditActions::Handler::OnPaste(), EffectTruncSilence::ProcessIndependently(), and StretchHandle::Release().

5316 {
5317 #ifdef EXPERIMENTAL_SYNC_LOCK
5318  return mIsSyncLocked;
5319 #else
5320  return false;
5321 #endif
5322 }
bool mIsSyncLocked
Definition: Project.h:719
bool AudacityProject::IsTimerRecordCancelled ( )
inline

Definition at line 695 of file Project.h.

Referenced by OnAudioIOStopRecording().

695 {return mTimerRecordCanceled;}
bool mTimerRecordCanceled
Definition: Project.h:748
void AudacityProject::MacShowUndockedToolbars ( bool  show)

Definition at line 2390 of file Project.cpp.

Referenced by OnActivate().

2391 {
2392  (void)show;//compiler food
2393 #ifdef __WXMAC__
2394  // Find all the floating toolbars, and show or hide them
2395  const auto &children = GetChildren();
2396  for(const auto &child : children) {
2397  if (auto frame = dynamic_cast<ToolFrame*>(child)) {
2398  if (!show)
2399  frame->Hide();
2400  else if (frame->GetBar() &&
2401  frame->GetBar()->IsVisible())
2402  frame->Show();
2403  }
2404  }
2405 #endif
2406 }
bool AudacityProject::MayScrollBeyondZero ( ) const

Definition at line 1876 of file Project.cpp.

References ViewInfo::bScrollBeyondZero, GetScrubber(), IsAudioActive(), mPlaybackScroller, mViewInfo, AudacityProject::PlaybackScroller::Pinned, and AudacityProject::PlaybackScroller::Right.

Referenced by DoScroll(), FixScrollbars(), and ScrollingLowerBoundTime().

1877 {
1879  return true;
1880 
1881  if (GetScrubber().HasMark() ||
1882  IsAudioActive()) {
1883  if (mPlaybackScroller) {
1884  auto mode = mPlaybackScroller->GetMode();
1885  if (mode == PlaybackScroller::Mode::Pinned ||
1887  return true;
1888  }
1889  }
1890 
1891  return false;
1892 }
std::unique_ptr< PlaybackScroller > mPlaybackScroller
Definition: Project.h:824
Scrubber & GetScrubber()
Definition: Project.h:786
bool bScrollBeyondZero
Definition: ViewInfo.h:186
ViewInfo mViewInfo
Definition: Project.h:555
bool IsAudioActive() const
Definition: Project.cpp:1533
void AudacityProject::MayStartMonitoring ( )

Definition at line 5191 of file Project.cpp.

References gPrefs.

Referenced by AudacityApp::OnInit(), and ControlToolBar::StopPlaying().

5192 {
5193 #ifdef EXPERIMENTAL_EXTRA_MONITORING
5194  bool bAlwaysMonitor;
5195  gPrefs->Read( wxT("GUI/AlwaysMonitor"), &bAlwaysMonitor, true );
5196  if( !bAlwaysMonitor )
5197  return;
5198 
5199  MeterToolBar * pToolBar = GetMeterToolBar();
5200  if( pToolBar == NULL )
5201  return;
5202  pToolBar->StartMonitoring();
5203 #endif
5204 }
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:32
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void AudacityProject::ModifyState ( bool  bWantsAutoSave)

Definition at line 4660 of file Project.cpp.

References AutoSave(), GetTrackPanel(), GetTracks(), GetUndoManager(), CellularPanel::HandleCursorForPresentMouseState(), UndoManager::ModifyState(), mTags, mViewInfo, and ViewInfo::selectedRegion.

Referenced by AS_ModifySelection(), LabelTextHandle::Click(), SelectHandle::Click(), MinimizeButtonHandle::CommitChanges(), SelectActions::DoListSelection(), TransportActions::DoPlayStopSelect(), TrackActions::DoTrackMute(), TrackActions::DoTrackSolo(), WaveTrackVZoomHandle::DoZoom(), WaveTrackVRulerControls::HandleWheelRotation(), NoteTrackVRulerControls::HandleWheelRotation(), NoteTrackMenuTable::OnChangeOctave(), ViewActions::Handler::OnCollapseAllTracks(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), ViewActions::Handler::OnExpandAllTracks(), NavigationActions::Handler::OnFirstTrack(), NavigationActions::Handler::OnLastTrack(), TrackActions::Handler::OnMuteAllTracks(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelectNone(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), SelectActions::Handler::OnSelToEnd(), SelectActions::Handler::OnSelToStart(), WaveTrackMenuTable::OnSetDisplay(), SelectActions::Handler::OnSetLeftSelection(), SelectActions::Handler::OnSetRightSelection(), SelectActions::Handler::OnSkipEnd(), SelectActions::Handler::OnSkipStart(), WaveTrackMenuTable::OnSpectrogramSettings(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), NavigationActions::Handler::OnToggle(), SelectActions::Handler::OnToggleSpectralSelection(), TrackActions::Handler::OnUnmuteAllTracks(), WaveformVRulerMenuTable::OnWaveformScaleType(), SelectActions::Handler::OnZeroCrossing(), ViewActions::Handler::OnZoomFitV(), TrackPanelResizeHandle::Release(), NoteTrackButtonHandle::Release(), SelectHandle::Release(), SSBL_ModifySpectralSelection(), SelectHandle::StartSelection(), and TP_ModifyState().

4661 {
4663  if (bWantsAutoSave)
4664  AutoSave();
4666 }
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
std::shared_ptr< Tags > mTags
Definition: Project.h:606
ViewInfo mViewInfo
Definition: Project.h:555
void HandleCursorForPresentMouseState(bool doHit=true)
UndoManager * GetUndoManager()
Definition: Project.h:212
void ModifyState(const TrackList *l, const SelectedRegion &selectedRegion, const std::shared_ptr< Tags > &tags)
TrackPanel * GetTrackPanel()
Definition: Project.h:324
TrackList * GetTracks()
Definition: Project.h:209
void AudacityProject::OnActivate ( wxActivateEvent &  event)

Definition at line 2408 of file Project.cpp.

References GetToolManager(), MacShowUndockedToolbars(), mActive, mIsDeleting, mTrackPanel, and SetActiveProject().

2409 {
2410  // Activate events can fire during window teardown, so just
2411  // ignore them.
2412  if (mIsDeleting) {
2413  return;
2414  }
2415 
2416  mActive = event.GetActive();
2417 
2418  // Under Windows, focus can be "lost" when returning to
2419  // Audacity from a different application.
2420  //
2421  // This was observed by minimizing all windows using WINDOWS+M and
2422  // then ALT+TAB to return to Audacity. Focus will be given to the
2423  // project window frame which is not at all useful.
2424  //
2425  // So, we use ToolManager's observation of focus changes in a wxEventFilter.
2426  // Then, when we receive the
2427  // activate event, we restore that focus to the child or the track
2428  // panel if no child had the focus (which probably should never happen).
2429  if (!mActive) {
2430 #ifdef __WXMAC__
2431  if (IsIconized())
2432  MacShowUndockedToolbars(false);
2433 #endif
2434  }
2435  else {
2436  SetActiveProject(this);
2437  if ( ! GetToolManager()->RestoreFocus() ) {
2438  if (mTrackPanel) {
2439  mTrackPanel->SetFocus();
2440  }
2441  }
2442 
2443 #ifdef __WXMAC__
2445 #endif
2446  }
2447  event.Skip();
2448 }
void MacShowUndockedToolbars(bool show)
Definition: Project.cpp:2390
bool mIsDeleting
Definition: Project.h:709
ToolManager * GetToolManager()
Definition: Project.h:685
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:316
TrackPanel * mTrackPanel
Definition: Project.h:649
void AudacityProject::OnAudioIONewBlockFiles ( const AutoSaveFile blockFileLog)
overridevirtual

Implements AudioIOListener.

Definition at line 5289 of file Project.cpp.

References AutoSaveFile::Append(), and mAutoSaveFileName.

5290 {
5291  // New blockfiles have been created, so add them to the auto-save file
5292  if (!mAutoSaveFileName.IsEmpty())
5293  {
5294  wxFFile f(mAutoSaveFileName, wxT("ab"));
5295  if (!f.IsOpened())
5296  return; // Keep recording going, there's not much we can do here
5297  blockFileLog.Append(f);
5298  f.Close();
5299  }
5300 }
wxString mAutoSaveFileName
Definition: Project.h:726
bool Append(wxFFile &file) const
void AudacityProject::OnAudioIORate ( int  rate)
overridevirtual

Implements AudioIOListener.

Definition at line 5206 of file Project.cpp.

References _(), GetControlToolBar(), mStatusBar, rateStatusBarField, and ControlToolBar::WidthForStatusBar().

5207 {
5208  wxString display;
5209  if (rate > 0) {
5210  display = wxString::Format(_("Actual Rate: %d"), rate);
5211  }
5212  else
5213  // clear the status field
5214  ;
5215 
5216  int x, y;
5217  mStatusBar->GetTextExtent(display, &x, &y);
5218  int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, x+50};
5219  mStatusBar->SetStatusWidths(4, widths);
5220  mStatusBar->SetStatusText(display, rateStatusBarField);
5221 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
int WidthForStatusBar(wxStatusBar *const)
wxStatusBar * mStatusBar
Definition: Project.h:645
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:4828
void AudacityProject::OnAudioIOStartRecording ( )
overridevirtual

Implements AudioIOListener.

Definition at line 5223 of file Project.cpp.

References AutoSave().

5224 {
5225  // Before recording is started, auto-save the file. The file will have
5226  // empty tracks at the bottom where the recording will be put into
5227  AutoSave();
5228 }
void AudacityProject::OnAudioIOStopRecording ( )
overridevirtual

Implements AudioIOListener.

Definition at line 5231 of file Project.cpp.

References _(), TrackList::Add(), AutoSave(), EditActions::DoUndo(), FixScrollbars(), gAudioIO, GetAudioIOToken(), GetTrackFactory(), GetTracks(), IsTimerRecordCancelled(), AudioIoCallback::LostCaptureIntervals(), mDirManager, TrackFactory::NewLabelTrack(), PushState(), RedrawProject(), ResetTimerRecordCancelled(), Track::SetName(), and ShowWarningDialog().

5232 {
5233  // Only push state if we were capturing and not monitoring
5234  if (GetAudioIOToken() > 0)
5235  {
5236  auto &intervals = gAudioIO->LostCaptureIntervals();
5237  if (intervals.size()) {
5238  // Make a track with labels for recording errors
5239  auto uTrack = GetTrackFactory()->NewLabelTrack();
5240  auto pTrack = uTrack.get();
5241  GetTracks()->Add( std::move(uTrack) );
5242  /* i18n-hint: A name given to a track, appearing as its menu button.
5243  The translation should be short or else it will not display well.
5244  At most, about 11 Latin characters.
5245  Dropout is a loss of a short sequence audio sample data from the
5246  recording */
5247  pTrack->SetName(_("Dropouts"));
5248  long counter = 1;
5249  for (auto &interval : intervals)
5250  pTrack->AddLabel(
5251  SelectedRegion{ interval.first,
5252  interval.first + interval.second },
5253  wxString::Format(wxT("%ld"), counter++),
5254  -2 );
5255  ShowWarningDialog(this, wxT("DropoutDetected"), _("\
5256 Recorded audio was lost at the labeled locations. Possible causes:\n\
5257 \n\
5258 Other applications are competing with Audacity for processor time\n\
5259 \n\
5260 You are saving directly to a slow external storage device\n\
5261 "
5262  ),
5263  false,
5264  _("Turn off dropout detection"));
5265  }
5266 
5267  // Add to history
5268  PushState(_("Recorded Audio"), _("Record"));
5269 
5270  // Reset timer record
5271  if (IsTimerRecordCancelled())
5272  {
5273  EditActions::DoUndo( *this );
5275  }
5276 
5277  // Refresh the project window
5278  FixScrollbars();
5279  RedrawProject();
5280  }
5281 
5282  // Write all cached files to disk, if any
5283  mDirManager->WriteCacheToDisk();
5284 
5285  // Now we auto-save again to get the project to a "normal" state again.
5286  AutoSave();
5287 }
void RedrawProject(const bool bForceWaveTracks=false)
Definition: Project.cpp:1466
bool IsTimerRecordCancelled()
Definition: Project.h:695
void DoUndo(AudacityProject &project)
Definition: EditMenus.cpp:217
Track * Add(std::unique_ptr< TrackKind > &&t)
Add a Track, giving it a fresh id.
Definition: Track.cpp:732
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
int GetAudioIOToken() const
Definition: Project.cpp:1523
int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, const wxString &message, bool showCancelButton, const wxString &footer)
Definition: Warning.cpp:93
void FixScrollbars()
Definition: Project.cpp:1973
void ResetTimerRecordCancelled()
Definition: Project.h:697
Defines a selected portion of a project.
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
AudioIO * gAudioIO
Definition: AudioIO.cpp:491
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4629
void SetName(const wxString &n)
Definition: Track.cpp:94
const std::vector< std::pair< double, double > > & LostCaptureIntervals()
Definition: AudioIO.h:617
TrackList * GetTracks()
Definition: Project.h:209
std::unique_ptr< LabelTrack > NewLabelTrack()
Definition: LabelTrack.cpp:100
TrackFactory * GetTrackFactory()
Definition: Project.cpp:1513
void AudacityProject::OnCapture ( wxCommandEvent &  evt)
private

Definition at line 1497 of file Project.cpp.

References mIsCapturing.

Referenced by AudacityProject().

1498 {
1499  evt.Skip();
1500 
1501  if (evt.GetInt() != 0)
1502  mIsCapturing = true;
1503  else
1504  mIsCapturing = false;
1505 }
bool mIsCapturing
Definition: Project.h:760
void AudacityProject::OnCloseWindow ( wxCloseEvent &  event)

Definition at line 2497 of file Project.cpp.

References _(), AllProjectDeleteMutex(), AudacityMessageBox(), UndoManager::ClearStates(), CreateNewAudacityProject(), DeleteClipboard(), DeleteCurrentAutoSaveFile(), ModuleManager::Dispatch(), FixScrollbars(), gActiveProject, gAudacityProjects, gAudioIO, ModuleManager::Get(), GetAudioIOToken(), GetControlToolBar(), AudioIO::GetListener(), GetUndoManager(), gIsQuitting, AudioIO::IsMonitoring(), AudioIO::IsStreamActive(), mbBusyImporting, mContrastDialog, mDirManager, mEmptyCanBeDirty, mFreqWindow, mHistoryWindow, mImportXMLTagHandler, mIsBeingDeleted, mIsDeleting, mLastSavedTracks, mMenuClose, mRuler, mTags, mTimer, mToolManager, mTrackFactory, mTrackPanel, mTracks, ControlToolBar::OnStop(), ProjectClosing, ProjectHasTracks(), QuitAudacity(), RedrawProject(), Save(), SaveWindowSize(), SetActiveProject(), SetAudioIOToken(), AudioIO::SetListener(), AudacityApp::SetWindowRectAlreadySaved(), TitleRestorer::sProjName, TitleRestorer::sProjNumber, AudioIO::StopStream(), UndoManager::UnsavedChanges(), and wxGetApp().

2498 {
2499  // We are called for the wxEVT_CLOSE_WINDOW, wxEVT_END_SESSION, and
2500  // wxEVT_QUERY_END_SESSION, so we have to protect against multiple
2501  // entries. This is a hack until the whole application termination
2502  // process can be reviewed and reworked. (See bug #964 for ways
2503  // to exercise the bug that instigated this hack.)
2504  if (mIsBeingDeleted)
2505  {
2506  event.Skip();
2507  return;
2508  }
2509 
2510  if (event.CanVeto() && (::wxIsBusy() || mbBusyImporting))
2511  {
2512  event.Veto();
2513  return;
2514  }
2515 
2516  // TODO: consider postponing these steps until after the possible veto
2517  // below: closing the two analysis dialogs, and stopping audio streams.
2518  // Streams can be for play, recording, or monitoring. But maybe it still
2519  // makes sense to stop any recording before putting up the dialog.
2520 
2521  mFreqWindow.reset();
2522  mContrastDialog.reset();
2523 
2524  // Check to see if we were playing or recording
2525  // audio, and if so, make sure Audio I/O is completely finished.
2526  // The main point of this is to properly push the state
2527  // and flush the tracks once we've completely finished
2528  // recording NEW state.
2529  // This code is derived from similar code in
2530  // AudacityProject::~AudacityProject() and TrackPanel::OnTimer().
2531  if (GetAudioIOToken()>0 &&
2533 
2534  // We were playing or recording audio, but we've stopped the stream.
2535  wxCommandEvent dummyEvent;
2536  GetControlToolBar()->OnStop(dummyEvent);
2537 
2538  FixScrollbars();
2539  SetAudioIOToken(0);
2540  RedrawProject();
2541  }
2542  else if (gAudioIO->IsMonitoring()) {
2543  gAudioIO->StopStream();
2544  }
2545 
2546  // MY: Use routine here so other processes can make same check
2547  bool bHasTracks = ProjectHasTracks();
2548 
2549  // We may not bother to prompt the user to save, if the
2550  // project is now empty.
2551  if (event.CanVeto() && (mEmptyCanBeDirty || bHasTracks)) {
2552  if (GetUndoManager()->UnsavedChanges()) {
2553  TitleRestorer Restorer( this );// RAII
2554  /* i18n-hint: The first %s numbers the project, the second %s is the project name.*/
2555  wxString Title = wxString::Format(_("%sSave changes to %s?"), Restorer.sProjNumber, Restorer.sProjName);
2556  wxString Message = _("Save project before closing?");
2557  if( !bHasTracks )
2558  {
2559  Message += _("\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nCancel, Edit > Undo until all tracks\nare open, then File > Save Project.");
2560  }
2561  int result = AudacityMessageBox( Message,
2562  Title,
2563  wxYES_NO | wxCANCEL | wxICON_QUESTION,
2564  this);
2565 
2566  if (result == wxCANCEL || (result == wxYES &&
2567  !GuardedCall<bool>( [&]{ return Save(); } )
2568  )) {
2569  event.Veto();
2570  return;
2571  }
2572  }
2573  }
2574 
2575 #ifdef __WXMAC__
2576  // Fix bug apparently introduced into 2.1.2 because of wxWidgets 3:
2577  // closing a project that was made full-screen (as by clicking the green dot
2578  // or command+/; not merely "maximized" as by clicking the title bar or
2579  // Zoom in the Window menu) leaves the screen black.
2580  // Fix it by un-full-screening.
2581  // (But is there a different way to do this? What do other applications do?
2582  // I don't see full screen windows of Safari shrinking, but I do see
2583  // momentary blackness.)
2584  ShowFullScreen(false);
2585 #endif
2586 
2588 
2589  // Stop the timer since there's no need to update anything anymore
2590  mTimer.reset();
2591 
2592  // The project is now either saved or the user doesn't want to save it,
2593  // so there's no need to keep auto save info around anymore
2595 
2596  // DMM: Save the size of the last window the user closes
2597  //
2598  // LL: Save before doing anything else to the window that might make
2599  // its size change.
2600  SaveWindowSize();
2601 
2602  mIsDeleting = true;
2603 
2604  // Mac: we never quit as the result of a close.
2605  // Other systems: we quit only when the close is the result of an external
2606  // command (on Windows, those are taskbar closes, "X" box, Alt+F4, etc.)
2607  bool quitOnClose;
2608 #ifdef __WXMAC__
2609  quitOnClose = false;
2610 #else
2611  quitOnClose = !mMenuClose;
2612 #endif
2613 
2614  // DanH: If we're definitely about to quit, DELETE the clipboard.
2615  // Doing this after Deref'ing the DirManager causes problems.
2616  if ((gAudacityProjects.size() == 1) && (quitOnClose || gIsQuitting))
2617  DeleteClipboard();
2618 
2619  // JKC: For Win98 and Linux do not detach the menu bar.
2620  // We want wxWidgets to clean it up for us.
2621  // TODO: Is there a Mac issue here??
2622  // SetMenuBar(NULL);
2623 
2624  // Lock all blocks in all tracks of the last saved version, so that
2625  // the blockfiles aren't deleted on disk when we DELETE the blockfiles
2626  // in memory. After it's locked, DELETE the data structure so that
2627  // there's no memory leak.
2628  if (mLastSavedTracks) {
2629  for (auto wt : mLastSavedTracks->Any<WaveTrack>())
2630  wt->CloseLock();
2631 
2632  mLastSavedTracks->Clear(); // sends an event
2633  mLastSavedTracks.reset();
2634  }
2635 
2636  // Get rid of the history window
2637  // LL: Destroy it before the TrackPanel and ToolBars since they
2638  // may/will get additional wxEVT_PAINT events since window
2639  // destruction may be queued. This seems to only be a problem
2640  // on the Mac.
2641  if (mHistoryWindow) {
2642  mHistoryWindow->Destroy();
2643  mHistoryWindow = NULL;
2644  }
2645 
2646  // Some of the AdornedRulerPanel functions refer to the TrackPanel, so destroy this
2647  // before the TrackPanel is destroyed. This change was needed to stop Audacity
2648  // crashing when running with Jaws on Windows 10 1703.
2649  if (mRuler)
2650  mRuler->Destroy();
2651 
2652  // Destroy the TrackPanel early so it's not around once we start
2653  // deleting things like tracks and such out from underneath it.
2654  // Check validity of mTrackPanel per bug 584 Comment 1.
2655  // Deeper fix is in the Import code, but this failsafes against crash.
2656  if (mTrackPanel)
2657  {
2658  mTrackPanel->Destroy();
2659  mTrackPanel = NULL; // Make sure this gets set...see HandleResize()
2660  }
2661 
2662  // Delete the tool manager before the children since it needs
2663  // to save the state of the toolbars.
2664  mToolManager.reset();
2665 
2666  DestroyChildren();
2667 
2668  mTrackFactory.reset();
2669 
2670  mTags.reset();
2671 
2672  mImportXMLTagHandler.reset();
2673 
2674  // Delete all the tracks to free up memory and DirManager references.
2675  mTracks->Clear();
2676  mTracks.reset();
2677 
2678  // This must be done before the following Deref() since it holds
2679  // references to the DirManager.
2681 
2682  // MM: Tell the DirManager it can now DELETE itself
2683  // if it finds it is no longer needed. If it is still
2684  // used (f.e. by the clipboard), it will recognize this
2685  // and will destroy itself later.
2686  //
2687  // LL: All objects with references to the DirManager should
2688  // have been deleted before this.
2689  mDirManager.reset();
2690 
2691  AProjectHolder pSelf;
2692  {
2694  auto end = gAudacityProjects.end();
2695  auto it = std::find_if(gAudacityProjects.begin(), end,
2696  [this] (const AProjectHolder &p) { return p.get() == this; });
2697  wxASSERT( it != end );
2698  pSelf = std::move( *it );
2699  gAudacityProjects.erase(it);
2700  }
2701 
2702  if (gActiveProject == this) {
2703  // Find a NEW active project
2704  if (gAudacityProjects.size() > 0) {
2706  }
2707  else {
2708  SetActiveProject(NULL);
2709  }
2710  }
2711 
2712  // Since we're going to be destroyed, make sure we're not to
2713  // receive audio notifications anymore.
2714  if (gAudioIO->GetListener() == this) {
2716  }
2717 
2718  if (gAudacityProjects.empty() && !gIsQuitting) {
2719 
2720 #if !defined(__WXMAC__)
2721  if (quitOnClose) {
2722  QuitAudacity();
2723  }
2724  else {
2727  }
2728 #endif
2729  }
2730 
2731  // Destroys this
2732  pSelf.reset();
2733  mRuler = nullptr;
2734 
2735  mIsBeingDeleted = true;
2736 
2737 }
std::unique_ptr< ImportXMLTagHandler > mImportXMLTagHandler
Definition: Project.h:723
void RedrawProject(const bool bForceWaveTracks=false)
Definition: Project.cpp:1466
void StopStream()
Stop recording, playback or input monitoring.
Definition: AudioIO.cpp:2408
static ModuleManager & Get()
std::unique_ptr< wxTimer > mTimer
Definition: Project.h:642
void SaveWindowSize()
AProjectArray gAudacityProjects
Definition: Project.cpp:306
void SetAudioIOToken(int token)
Definition: Project.cpp:1528
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
int GetAudioIOToken() const
Definition: Project.cpp:1523
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
bool mEmptyCanBeDirty
Definition: Project.h:713
bool IsStreamActive() const
Returns true if the audio i/o is running at all, but not during cleanup.
Definition: AudioIO.cpp:2749
void ClearStates()
static AudacityProject * gActiveProject
Definition: Project.cpp:304
bool mIsDeleting
Definition: Project.h:709
AudioIOListener * GetListener()
Definition: AudioIO.h:809
std::unique_ptr< TrackFactory > mTrackFactory
Definition: Project.h:651
std::shared_ptr< AudacityProject > AProjectHolder
Definition: Project.h:116
int Dispatch(ModuleDispatchTypes type)
std::shared_ptr< Tags > mTags
Definition: Project.h:606
bool mbBusyImporting
Definition: Project.h:689
void FixScrollbars()
Definition: Project.cpp:1973
void SetWindowRectAlreadySaved(bool alreadySaved)
Definition: AudacityApp.h:162
void QuitAudacity(bool bForce)
std::shared_ptr< TrackList > mLastSavedTracks
Definition: Project.h:616
bool ProjectHasTracks()
Definition: Project.cpp:5467
bool mIsBeingDeleted
Definition: Project.h:771
AdornedRulerPanel * mRuler
Definition: Project.h:647
static ODLock & AllProjectDeleteMutex()
Prevents DELETE from external thread - for e.g. use of GetActiveProject.
Definition: Project.cpp:186
bool mMenuClose
Definition: Project.h:751
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
bool IsMonitoring() const
Returns true if we're monitoring input (but not recording or playing actual audio) ...
Definition: AudioIO.cpp:2773
void OnStop(wxCommandEvent &evt)
bool UnsavedChanges()
void DeleteCurrentAutoSaveFile()
Definition: Project.cpp:5170
Destroy_ptr< ContrastDialog > mContrastDialog
Definition: Project.h:671
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
AudioIO * gAudioIO
Definition: AudioIO.cpp:491
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:4828
void SetListener(AudioIOListener *listener)
Definition: AudioIO.cpp:4131
UndoManager * GetUndoManager()
Definition: Project.h:212
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:682
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:316
HistoryWindow * mHistoryWindow
Definition: Project.h:665
AudacityApp & wxGetApp()
bool gIsQuitting
std::shared_ptr< TrackList > mTracks
Definition: Project.h:609
TrackPanel * mTrackPanel
Definition: Project.h:649
static void DeleteClipboard()
Definition: Project.cpp:4745
Destroy_ptr< FreqWindow > mFreqWindow
Definition: Project.h:670
AudacityProject * CreateNewAudacityProject()
Definition: Project.cpp:552
void AudacityProject::OnIconize ( wxIconizeEvent &  event)

Definition at line 2194 of file Project.cpp.

References gAudacityProjects, mIconized, and OnShow().

2195 {
2196  int VisibleProjectCount = 0;
2197 
2198  //JKC: On Iconizing we get called twice. Don't know
2199  // why but it does no harm.
2200  // Should we be returning true/false rather than
2201  // void return? I don't know.
2202  mIconized = event.IsIconized();
2203 
2204  unsigned int i;
2205 
2206  // VisibileProjectCount seems to be just a counter for debugging.
2207  // It's not used outside this function.
2208  for(i=0;i<gAudacityProjects.size();i++){
2209  if(gAudacityProjects[i]){
2210  if( !gAudacityProjects[i]->mIconized )
2211  VisibleProjectCount++;
2212  }
2213  }
2214  event.Skip();
2215 
2216  // This step is to fix part of Bug 2040, where the BackingPanel
2217  // size was not restored after we leave Iconized state.
2218 
2219  // Queue up a resize event using OnShow so that we
2220  // refresh the track panel. But skip this, if we're iconized.
2221  if( mIconized )
2222  return;
2223  wxShowEvent Evt;
2224  OnShow( Evt );
2225 }
bool mIconized
Definition: Project.h:662
AProjectArray gAudacityProjects
Definition: Project.cpp:306
void OnShow(wxShowEvent &event)
Definition: Project.cpp:2252
void AudacityProject::OnMenu ( wxCommandEvent &  event)

Definition at line 2358 of file Project.cpp.

References GetCommandManager(), GetMenuManager, MenuManager::GetUpdateFlags(), CommandManager::HandleMenuID(), and NoFlagsSpecified.

2359 {
2360 #ifdef __WXMSW__
2361  // Bug 1642: We can arrive here with bogus menu IDs, which we
2362  // proceed to process. So if bogus, don't.
2363  // The bogus menu IDs are probably generated by controls on the TrackPanel,
2364  // such as the Project Rate.
2365  // 17000 is the magic number at which we start our menu.
2366  // This code would probably NOT be OK on Mac, since we assign
2367  // some specific ID numbers.
2368  if( event.GetId() < 17000){
2369  event.Skip();
2370  return;
2371  }
2372 #endif
2373  bool handled = GetCommandManager()->HandleMenuID(
2374  event.GetId(), GetMenuManager(*this).GetUpdateFlags(*this),
2376 
2377  if (handled)
2378  event.Skip(false);
2379  else{
2380  event.ResumePropagation( 999 );
2381  event.Skip(true);
2382  }
2383 }
bool HandleMenuID(int id, CommandFlag flags, CommandMask mask)
CommandManager * GetCommandManager()
Definition: Project.h:362
CommandFlag GetUpdateFlags(AudacityProject &project, bool checkActive=false)
Definition: Menus.cpp:394
friend MenuManager & GetMenuManager(AudacityProject &project)
Definition: Menus.cpp:58
void AudacityProject::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 2455 of file Project.cpp.

References SetActiveProject().

2456 {
2457  if (event.ButtonDown())
2458  SetActiveProject(this);
2459 }
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:316
void AudacityProject::OnMove ( wxMoveEvent &  event)

Definition at line 2227 of file Project.cpp.

References SetNormalizedWindowState().

2228 {
2229  if (!this->IsMaximized() && !this->IsIconized())
2230  SetNormalizedWindowState(this->GetRect());
2231  event.Skip();
2232 }
void SetNormalizedWindowState(wxRect pSizeAndLocation)
Definition: Project.h:692
void AudacityProject::OnODTaskComplete ( wxCommandEvent &  event)

Definition at line 2309 of file Project.cpp.

References mTrackPanel, and TrackPanel::Refresh().

2310 {
2311  if(mTrackPanel)
2312  mTrackPanel->Refresh(false);
2313 }
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
TrackPanel * mTrackPanel
Definition: Project.h:649
void AudacityProject::OnODTaskUpdate ( wxCommandEvent &  event)

Handles the redrawing necessary for tasks as they partially update in the background.

Definition at line 2300 of file Project.cpp.

References mTrackPanel, and TrackPanel::Refresh().

2301 {
2302  //todo: add track data to the event - check to see if the project contains it before redrawing.
2303  if(mTrackPanel)
2304  mTrackPanel->Refresh(false);
2305 
2306 }
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
TrackPanel * mTrackPanel
Definition: Project.h:649
void AudacityProject::OnOpenAudioFile ( wxCommandEvent &  event)

Definition at line 2739 of file Project.cpp.

References OpenFile().

2740 {
2741  const wxString &cmd = event.GetString();
2742 
2743  if (!cmd.IsEmpty()) {
2744  OpenFile(cmd);
2745  }
2746 
2747  RequestUserAttention();
2748 }
void OpenFile(const wxString &fileName, bool addtohistory=true)
Definition: Project.cpp:2973
void AudacityProject::OnScroll ( wxScrollEvent &  event)

Definition at line 2315 of file Project.cpp.

References DoScroll(), mHsbar, mViewInfo, PixelWidthBeforeTime(), ViewInfo::sbarH, and ViewInfo::sbarScale.

2316 {
2317  const wxInt64 offset = PixelWidthBeforeTime(0.0);
2318  mViewInfo.sbarH =
2319  (wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
2320  DoScroll();
2321 }
wxInt64 sbarH
Definition: ViewInfo.h:168
double PixelWidthBeforeTime(double scrollto) const
Definition: Project.cpp:1904
ViewInfo mViewInfo
Definition: Project.h:555
double sbarScale
Definition: ViewInfo.h:176
wxScrollBar * mHsbar
Definition: Project.h:653
void AudacityProject::OnScrollLeft ( )

This method handles general left-scrolling, either for drag-scrolling or when the scrollbar is clicked to the left of the thumb

Definition at line 1794 of file Project.cpp.

References FinishAutoScroll(), mHsbar, mViewInfo, PixelWidthBeforeTime(), ViewInfo::sbarH, sbarHjump, and ViewInfo::sbarScale.

Referenced by TP_ScrollLeft().

1795 {
1796  wxInt64 pos = mHsbar->GetThumbPosition();
1797  // move at least one scroll increment
1798  pos -= wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
1799  pos = wxMax(pos, 0);
1801  mViewInfo.sbarH = std::max(mViewInfo.sbarH,
1802  -(wxInt64) PixelWidthBeforeTime(0.0));
1803 
1804 
1805  if (pos != mHsbar->GetThumbPosition()) {
1806  mHsbar->SetThumbPosition((int)pos);
1807  FinishAutoScroll();
1808  }
1809 }
wxInt64 sbarH
Definition: ViewInfo.h:168