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 982 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().

985  : wxFrame(parent, id, _TS("Audacity"), pos, size),
986  mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom()),
987  mbLoadedFromAup( false ),
989  mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
992  gPrefs->Read(wxT("/SelectionFormat"), wxT("")) ) ),
995  gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT("")) ) ),
998  gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) ),
999  mUndoManager(std::make_unique<UndoManager>())
1000  , mCommandManager( std::make_unique<CommandManager>() )
1001 {
1002  if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate())) {
1003  // The default given above can vary with host/devices. So unless there is an entry for
1004  // the default sample rate in audacity.cfg, Audacity can open with a rate which is different
1005  // from the rate with which it closed. See bug 1879.
1006  gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mRate);
1007  gPrefs->Flush();
1008  }
1009 
1011 
1012 #ifdef EXPERIMENTAL_DA2
1013  SetBackgroundColour(theTheme.Colour( clrMedium ));
1014 #endif
1015  // Note that the first field of the status bar is a dummy, and it's width is set
1016  // to zero latter in the code. This field is needed for wxWidgets 2.8.12 because
1017  // if you move to the menu bar, the first field of the menu bar is cleared, which
1018  // is undesirable behaviour.
1019  // In addition, the help strings of menu items are by default sent to the first
1020  // field. Currently there are no such help strings, but it they were introduced, then
1021  // there would need to be an event handler to send them to the appropriate field.
1022  mStatusBar = CreateStatusBar(4);
1023 #if wxUSE_ACCESSIBILITY
1024  // so that name can be set on a standard control
1025  mStatusBar->SetAccessible(safenew WindowAccessible(mStatusBar));
1026 #endif
1027  mStatusBar->SetName(wxT("status_line")); // not localized
1028  mProjectNo = mProjectCounter++; // Bug 322
1029 
1031 
1032  // MM: DirManager is created dynamically, freed on demand via ref-counting
1033  // MM: We don't need to Ref() here because it start with refcount=1
1034  mDirManager = std::make_shared<DirManager>();
1035 
1036  mLastSavedTracks.reset();
1037 
1038  //
1039  // Initialize view info (shared with TrackPanel)
1040  //
1041 
1042  {
1043  ObjectFactorySetLocker locker;
1044  for (const auto &factory : sObjectFactories()) {
1045  auto pObject = factory();
1046  wxASSERT( pObject );
1047  mAttachedObjects.push_back( std::move( pObject ) );
1048  }
1049  }
1050 
1051  mMenuManager = std::make_unique<MenuManager>();
1052 
1053  UpdatePrefs();
1054 
1055  mLockPlayRegion = false;
1056 
1057  // Make sure valgrind sees mIsSyncLocked is initialized, even
1058  // though we're about to set it from prefs.
1059  mIsSyncLocked = false;
1060  gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
1061 
1062  // LLL: Read this!!!
1063  //
1064  // Until the time (and cpu) required to refresh the track panel is
1065  // reduced, leave the following window creations in the order specified.
1066  // This will place the refresh of the track panel last, allowing all
1067  // the others to get done quickly.
1068  //
1069  // Near as I can tell, this is only a problem under Windows.
1070  //
1071 
1072 
1073  // PRL: this panel groups the top tool dock and the ruler into one
1074  // tab cycle.
1075  // Must create it with non-default width equal to the main window width,
1076  // or else the device toolbar doesn't make initial widths of the choice
1077  // controls correct.
1079  this, wxID_ANY, wxDefaultPosition,
1080  wxSize{ this->GetSize().GetWidth(), -1 }
1081  };
1082  mTopPanel->SetLabel( "Top Panel" );// Not localised
1083  mTopPanel->SetLayoutDirection(wxLayout_LeftToRight);
1084  mTopPanel->SetAutoLayout(true);
1085 #ifdef EXPERIMENTAL_DA2
1086  mTopPanel->SetBackgroundColour(theTheme.Colour( clrMedium ));
1087 #endif
1088 
1089  //
1090  // Create the ToolDock
1091  //
1092  mToolManager = std::make_unique<ToolManager>( this, mTopPanel );
1093  GetSelectionBar()->SetListener(this);
1094 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
1096 #endif
1097  mToolManager->LayoutToolBars();
1098 
1099  //
1100  // Create the horizontal ruler
1101  //
1103  wxID_ANY,
1104  wxDefaultPosition,
1105  wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ),
1106  &mViewInfo );
1107  mRuler->SetLayoutDirection(wxLayout_LeftToRight);
1108 
1109  //
1110  // Create the TrackPanel and the scrollbars
1111  //
1112  wxWindow * pPage;
1113 
1114 #ifdef EXPERIMENTAL_NOTEBOOK
1115  // We are using a notebook (tabbed panel), so we create the notebook and add pages.
1116  GuiFactory Factory;
1117  wxNotebook * pNotebook;
1118  mMainPanel = Factory.AddPanel(
1119  this, wxPoint( left, top ), wxSize( width, height ) );
1120  pNotebook = Factory.AddNotebook( mMainPanel );
1121  /* i18n-hint: This is an experimental feature where the main panel in
1122  Audacity is put on a notebook tab, and this is the name on that tab.
1123  Other tabs in that notebook may have instruments, patch panels etc.*/
1124  pPage = Factory.AddPage( pNotebook, _("Main Mix"));
1125 #else
1126  // Not using a notebook, so we place the track panel inside another panel,
1127  // this keeps the notebook code and normal code consistant and also
1128  // paves the way for adding additional windows inside the track panel.
1129  mMainPanel = safenew wxPanelWrapper(this, -1,
1130  wxDefaultPosition,
1131  wxDefaultSize,
1132  wxNO_BORDER);
1133  mMainPanel->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
1134  mMainPanel->SetLabel("Main Panel");// Not localised.
1135  pPage = mMainPanel;
1136  // Set the colour here to the track panel background to avoid
1137  // flicker when Audacity starts up.
1138  // However, that leads to areas next to the horizontal scroller
1139  // being painted in background colour and not scroller background
1140  // colour, so suppress this for now.
1141  //pPage->SetBackgroundColour( theTheme.Colour( clrDark ));
1142 #endif
1143  pPage->SetLayoutDirection(wxLayout_LeftToRight);
1144 
1145 #ifdef EXPERIMENTAL_DA2
1146  pPage->SetBackgroundColour(theTheme.Colour( clrMedium ));
1147 #endif
1148 
1149  {
1150  auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1151  ubs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP);
1152  ubs->Add(mRuler, 0, wxEXPAND);
1153  mTopPanel->SetSizer(ubs.release());
1154  }
1155 
1156  wxBoxSizer *bs;
1157  {
1158  auto ubs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1159  bs = ubs.get();
1160  bs->Add(mTopPanel, 0, wxEXPAND | wxALIGN_TOP);
1161  bs->Add(pPage, 1, wxEXPAND);
1162  bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND);
1163  SetAutoLayout(true);
1164  SetSizer(ubs.release());
1165  }
1166  bs->Layout();
1167 
1168  // The right hand side translates to NEW TrackPanel(...) in normal
1169  // Audacity without additional DLLs.
1171  TrackPanelID,
1172  wxDefaultPosition,
1173  wxDefaultSize,
1174  mTracks,
1175  &mViewInfo,
1176  this,
1177  mRuler);
1179 
1180  mIndicatorOverlay = std::make_unique<PlayIndicatorOverlay>(this);
1181 
1182  mCursorOverlay = std::make_unique<EditCursorOverlay>(this);
1183 
1184  mBackgroundCell = std::make_shared<BackgroundCell>(this);
1185 
1186 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1187  mScrubOverlay = std::make_unique<ScrubbingOverlay>(this);
1188  mScrubber = std::make_unique<Scrubber>(this);
1189 #endif
1190 
1191  // More order dependencies here...
1192  // This must follow construction of *mIndicatorOverlay, because it must
1193  // attach its timer event handler later (so that its handler is invoked
1194  // earlier)
1195  mPlaybackScroller = std::make_unique<PlaybackScroller>(this);
1196 
1197  // This must follow construction of *mPlaybackScroller,
1198  // because it must
1199  // attach its timer event handler later (so that its handler is invoked
1200  // earlier)
1201  this->Bind(EVT_TRACK_PANEL_TIMER,
1203  &mViewInfo);
1204 
1205  // Add the overlays, in the sequence in which they will be painted
1207  mTrackPanel->AddOverlay(mCursorOverlay.get());
1208 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1209  mTrackPanel->AddOverlay(mScrubOverlay.get());
1210 #endif
1211 
1212  mMenuManager->CreateMenusAndCommands(*this);
1213 
1214  mTrackPanel->SetBackgroundCell(mBackgroundCell);
1215 
1216  // LLL: When Audacity starts or becomes active after returning from
1217  // another application, the first window that can accept focus
1218  // will be given the focus even if we try to SetFocus(). By
1219  // creating the scrollbars after the TrackPanel, we resolve
1220  // several focus problems.
1221  mHsbar = safenew ScrollBar(pPage, HSBarID, wxSB_HORIZONTAL);
1222  mVsbar = safenew ScrollBar(pPage, VSBarID, wxSB_VERTICAL);
1223 #if wxUSE_ACCESSIBILITY
1224  // so that name can be set on a standard control
1225  mHsbar->SetAccessible(safenew WindowAccessible(mHsbar));
1226  mVsbar->SetAccessible(safenew WindowAccessible(mVsbar));
1227 #endif
1228  mHsbar->SetLayoutDirection(wxLayout_LeftToRight);
1229  mHsbar->SetName(_("Horizontal Scrollbar"));
1230  mVsbar->SetName(_("Vertical Scrollbar"));
1231  // LLL: When Audacity starts or becomes active after returning from
1232  // another application, the first window that can accept focus
1233  // will be given the focus even if we try to SetFocus(). By
1234  // making the TrackPanel that first window, we resolve several
1235  // keyboard focus problems.
1236  pPage->MoveBeforeInTabOrder(mTopPanel);
1237 
1238  bs = (wxBoxSizer *)pPage->GetSizer();
1239 
1240  {
1241  // Top horizontal grouping
1242  auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
1243 
1244  // Track panel
1245  hs->Add(mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
1246 
1247  {
1248  // Vertical grouping
1249  auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
1250 
1251  // Vertical scroll bar
1252  vs->Add(mVsbar, 1, wxEXPAND | wxALIGN_TOP);
1253  hs->Add(vs.release(), 0, wxEXPAND | wxALIGN_TOP);
1254  }
1255 
1256  bs->Add(hs.release(), 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
1257  }
1258 
1259  {
1260  // Bottom horizontal grouping
1261  auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
1262 
1263  // Bottom scrollbar
1264  hs->Add(mTrackPanel->GetLeftOffset() - 1, 0);
1265  hs->Add(mHsbar, 1, wxALIGN_BOTTOM);
1266  hs->Add(mVsbar->GetSize().GetWidth(), 0);
1267  bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT);
1268  }
1269 
1270  // Lay it out
1271  pPage->SetAutoLayout(true);
1272  pPage->Layout();
1273 
1274 #ifdef EXPERIMENTAL_NOTEBOOK
1275  AddPages(this, Factory, pNotebook);
1276 #endif
1277 
1278  mMainPanel->Layout();
1279 
1280  wxASSERT( mTrackPanel->GetProject()==this);
1281 
1282  // MM: Give track panel the focus to ensure keyboard commands work
1283  mTrackPanel->SetFocus();
1284 
1285  // Create tags object
1286  mTags = std::make_shared<Tags>();
1287 
1288  InitialState();
1289  FixScrollbars();
1290  mRuler->SetLeftOffset(mTrackPanel->GetLeftOffset()); // bevel on AdornedRuler
1291 
1292  //
1293  // Set the Icon
1294  //
1295 
1296  // loads either the XPM or the windows resource, depending on the platform
1297 #if !defined(__WXMAC__) && !defined(__WXX11__)
1298  {
1299 #if defined(__WXMSW__)
1300  wxIcon ic{ wxICON(AudacityLogo) };
1301 #elif defined(__WXGTK__)
1302  wxIcon ic{wxICON(AudacityLogoAlpha)};
1303 #else
1304  wxIcon ic{};
1305  ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
1306 #endif
1307  SetIcon(ic);
1308  }
1309 #endif
1310  mIconized = false;
1311 
1313 
1314  int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, 150};
1315  mStatusBar->SetStatusWidths(4, widths);
1316  wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
1318  mStatusBar->SetStatusText(msg, mainStatusBarField);
1320 
1321  mTimer = std::make_unique<wxTimer>(this, AudacityProjectTimerID);
1322  RestartTimer();
1323 
1324 #if wxUSE_DRAG_AND_DROP
1325  // We can import now, so become a drag target
1326 // SetDropTarget(safenew AudacityDropTarget(this));
1327 // mTrackPanel->SetDropTarget(safenew AudacityDropTarget(this));
1328 
1329  // SetDropTarget takes ownership
1330  mTrackPanel->SetDropTarget(safenew DropTarget(this));
1331 #endif
1332 
1333  wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
1335  this);
1336 
1337 #ifdef EXPERIMENTAL_DA2
1338  ClearBackground();// For wxGTK.
1339 #endif
1340 }
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:4583
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:1496
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:4864
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:1972
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:1426
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:4810
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:4855
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:4926
AudacityProject::~AudacityProject ( )
virtual

Definition at line 1342 of file Project.cpp.

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

1343 {
1344  // Tool manager gives us capture sometimes
1345  if(HasCapture())
1346  ReleaseMouse();
1347 
1348  if(mTrackPanel) {
1349 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
1351 #endif
1354  }
1355 }
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 4173 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().

4175 {
4176  std::vector< std::shared_ptr< Track > > results;
4177 
4178  SelectNone();
4179 
4180  bool initiallyEmpty = mTracks->empty();
4181  double newRate = 0;
4182  wxString trackNameBase = fileName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
4183  int i = -1;
4184 
4185  // Must add all tracks first (before using Track::IsLeader)
4186  for (auto &group : newTracks) {
4187  if (group.empty()) {
4188  wxASSERT(false);
4189  continue;
4190  }
4191  auto first = group.begin()->get();
4192  auto nChannels = group.size();
4193  for (auto &uNewTrack : group) {
4194  auto newTrack = mTracks->Add(std::move(uNewTrack));
4195  results.push_back(Track::Pointer(newTrack));
4196  }
4197  mTracks->GroupChannels(*first, nChannels);
4198  }
4199  newTracks.clear();
4200 
4201  // Now name them
4202 
4203  // Add numbers to track names only if there is more than one (mono or stereo)
4204  // track (not necessarily, more than one channel)
4205  const bool useSuffix =
4206  make_iterator_range( results.begin() + 1, results.end() )
4207  .any_of( []( decltype(*results.begin()) &pTrack )
4208  { return pTrack->IsLeader(); } );
4209 
4210  for (const auto &newTrack : results) {
4211  if ( newTrack->IsLeader() )
4212  // Count groups only
4213  ++i;
4214 
4215  newTrack->SetSelected(true);
4216 
4217  if ( useSuffix )
4218  newTrack->SetName(trackNameBase + wxString::Format(wxT(" %d" ), i + 1));
4219  else
4220  newTrack->SetName(trackNameBase);
4221 
4222  newTrack->TypeSwitch( [&](WaveTrack *wt) {
4223  if (newRate == 0)
4224  newRate = wt->GetRate();
4225 
4226  // Check if NEW track contains aliased blockfiles and if yes,
4227  // remember this to show a warning later
4228  if(WaveClip* clip = wt->GetClipByIndex(0)) {
4229  BlockArray &blocks = clip->GetSequence()->GetBlockArray();
4230  if (blocks.size())
4231  {
4232  SeqBlock& block = blocks[0];
4233  if (block.f->IsAlias())
4234  {
4235  mImportedDependencies = true;
4236  }
4237  }
4238  }
4239  });
4240  }
4241 
4242  // Automatically assign rate of imported file to whole project,
4243  // if this is the first file that is imported
4244  if (initiallyEmpty && newRate > 0) {
4245  mRate = newRate;
4247  }
4248 
4249  PushState(wxString::Format(_("Imported '%s'"), fileName),
4250  _("Import"));
4251 
4252 #if defined(__WXGTK__)
4253  // See bug #1224
4254  // The track panel hasn't we been fully created, so the DoZoomFit() will not give
4255  // expected results due to a window width of zero. Should be safe to yield here to
4256  // allow the creattion to complete. If this becomes a problem, it "might" be possible
4257  // to queue a dummy event to trigger the DoZoomFit().
4258  wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
4259 #endif
4260 
4261  if (initiallyEmpty && !IsProjectSaved() ) {
4262  wxString name = fileName.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.'));
4263  mFileName =::wxPathOnly(fileName) + wxFILE_SEP_PATH + name + wxT(".aup");
4264  mbLoadedFromAup = false;
4265  SetProjectTitle();
4266  }
4267 
4268  // Moved this call to higher levels to prevent flicker redrawing everything on each file.
4269  // HandleResize();
4270 
4271  return results;
4272 }
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:1561
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:4611
const wxChar * name
Definition: Distortion.cpp:94
void SelectNone()
Definition: Project.cpp:5635
BlockFilePtr f
Definition: Sequence.h:33
bool IsProjectSaved()
Definition: Project.cpp:5371
SelectionBar * GetSelectionBar()
Definition: Project.cpp:4855
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 1357 of file Project.cpp.

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

Referenced by Theme::ApplyUpdatedImages().

1358 {
1359  SetBackgroundColour(theTheme.Colour( clrMedium ));
1360  ClearBackground();// For wxGTK.
1362 }
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 1623 of file Project.cpp.

References mRate.

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

Implements SelectionBarListener.

Definition at line 1654 of file Project.cpp.

References GetSelectionFormat().

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

Implements SelectionBarListener.

Definition at line 1635 of file Project.cpp.

References GetSnapTo().

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

Implements SelectionBarListener.

Definition at line 1767 of file Project.cpp.

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

1768 {
1769  mViewInfo.selectedRegion.setTimes(start, end);
1770  mTrackPanel->Refresh(false);
1771  if (done) {
1772  ModifyState(false);
1773  }
1774 }
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:4642
bool setTimes(double t0, double t1)
TrackPanel * mTrackPanel
Definition: Project.h:649
void AudacityProject::AS_SetRate ( double  rate)
overridevirtual

Implements SelectionBarListener.

Definition at line 1630 of file Project.cpp.

References mRate.

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

Implements SelectionBarListener.

Definition at line 1659 of file Project.cpp.

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

Referenced by SetSelectionFormat().

1660 {
1662 
1663  gPrefs->Write(wxT("/SelectionFormat"), mSelectionFormat.Internal());
1664  gPrefs->Flush();
1665 
1666  if (SnapSelection() && GetTrackPanel())
1667  GetTrackPanel()->Refresh(false);
1668 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
const wxString & Internal() const
bool SnapSelection()
Definition: Project.cpp:1595
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 1640 of file Project.cpp.

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

Referenced by SetSnapTo().

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

Definition at line 5096 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().

5097 {
5098  // SonifyBeginAutoSave(); // part of RBD's r10680 stuff now backed out
5099 
5100  // To minimize the possibility of race conditions, we first write to a
5101  // file with the extension ".tmp", then rename the file to .autosave
5102  wxString projName;
5103 
5104  if (mFileName.IsEmpty())
5105  projName = wxT("New Project");
5106  else
5107  projName = wxFileName(mFileName).GetName();
5108 
5109  wxString fn = wxFileName(FileNames::AutoSaveDir(),
5110  projName + wxString(wxT(" - ")) + CreateUniqueName()).GetFullPath();
5111 
5112  // PRL: I found a try-catch and rewrote it,
5113  // but this guard is unnecessary because AutoSaveFile does not throw
5114  bool success = GuardedCall< bool >( [&]
5115  {
5116  VarSetter<bool> setter(&mAutoSaving, true, false);
5117 
5118  AutoSaveFile buffer;
5119  WriteXMLHeader(buffer);
5120  WriteXML(buffer, false);
5121  mStrOtherNamesArray.Clear();
5122 
5123  wxFFile saveFile;
5124  saveFile.Open(fn + wxT(".tmp"), wxT("wb"));
5125  return buffer.Write(saveFile);
5126  } );
5127 
5128  if (!success)
5129  return;
5130 
5131  // Now that we have a NEW auto-save file, DELETE the old one
5133 
5134  if (!mAutoSaveFileName.IsEmpty())
5135  return; // could not remove auto-save file
5136 
5137  if (!wxRenameFile(fn + wxT(".tmp"), fn + wxT(".autosave")))
5138  {
5140  wxString::Format( _("Could not create autosave file: %s"),
5141  fn + wxT(".autosave") ),
5142  _("Error"), wxICON_STOP, this);
5143  return;
5144  }
5145 
5146  mAutoSaveFileName += fn + wxT(".autosave");
5147  // no-op cruft that's not #ifdefed for NoteTrack
5148  // See above for further comments.
5149  // SonifyEndAutoSave();
5150 }
void WriteXMLHeader(XMLWriter &xmlFile) const
Definition: Project.cpp:3664
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:3679
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:5152
static wxString AutoSaveDir()
Definition: FileNames.cpp:123
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 5336 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().

5337 {
5338  AudacityProject *project = GetActiveProject();
5339  if (project)
5340  {
5341 // wxASSERT(project->mKeyboardCaptureHandler == NULL);
5342  project->mKeyboardCaptureHandler = handler;
5343  }
5344 }
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 4732 of file Project.cpp.

References msClipboard, msClipProject, msClipT0, and msClipT1.

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

4733 {
4734  msClipT0 = 0.0;
4735  msClipT1 = 0.0;
4736  msClipProject = NULL;
4737  if (msClipboard) {
4738  msClipboard->Clear();
4739  }
4740 }
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 2169 of file Project.cpp.

References gAudacityProjects, and GetName().

Referenced by TitleRestorer::TitleRestorer().

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

Definition at line 4727 of file Project.cpp.

References msClipboard.

Referenced by OnCloseWindow(), and QuitAudacity().

4728 {
4729  msClipboard.reset();
4730 }
static std::shared_ptr< TrackList > msClipboard
Definition: Project.h:620
void AudacityProject::DeleteCurrentAutoSaveFile ( )

Definition at line 5152 of file Project.cpp.

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

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

5153 {
5154  if (!mAutoSaveFileName.IsEmpty())
5155  {
5156  if (wxFileExists(mAutoSaveFileName))
5157  {
5158  if (!wxRemoveFile(mAutoSaveFileName))
5159  {
5161  wxString::Format(
5162  _("Could not remove old autosave file: %s"), mAutoSaveFileName ),
5163  _("Error"), wxICON_STOP, this);
5164  return;
5165  }
5166  }
5167 
5168  mAutoSaveFileName = wxT("");
5169  }
5170 }
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 3821 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().

3824 {
3825  // See explanation above
3826  // ProjectDisabler disabler(this);
3827 
3828  wxASSERT_MSG(!bWantSaveCopy || fromSaveAs, "Copy Project SHOULD only be availabele from SaveAs");
3829 
3830  // Some confirmation dialogs
3831  if (!bWantSaveCopy)
3832  {
3833  if ( ! GetTracks()->Any() )
3834  {
3835  if (GetUndoManager()->UnsavedChanges() && mEmptyCanBeDirty) {
3836  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?"),
3837  _("Warning - Empty Project"),
3838  wxYES_NO | wxICON_QUESTION, this);
3839  if (result == wxNO)
3840  return false;
3841  }
3842  }
3843 
3844  // If the user has recently imported dependencies, show
3845  // a dialog where the user can see audio files that are
3846  // aliased by this project. The user may make the project
3847  // self-contained during this dialog, it modifies the project!
3849  {
3850  bool bSuccess = ShowDependencyDialogIfNeeded(this, true);
3851  if (!bSuccess)
3852  return false;
3853  mImportedDependencies = false; // do not show again
3854  }
3855  }
3856  // End of confirmations
3857 
3858  //
3859  // Always save a backup of the original project file
3860  //
3861 
3862  wxString safetyFileName = wxT("");
3863  if (wxFileExists(mFileName)) {
3864 
3865 #ifdef __WXGTK__
3866  safetyFileName = mFileName + wxT("~");
3867 #else
3868  safetyFileName = mFileName + wxT(".bak");
3869 #endif
3870 
3871  if (wxFileExists(safetyFileName))
3872  wxRemoveFile(safetyFileName);
3873 
3874  if ( !wxRenameFile(mFileName, safetyFileName) ) {
3876  wxString::Format(
3877  _("Could not create safety file: %s"), safetyFileName ),
3878  _("Error"), wxICON_STOP, this);
3879  return false;
3880  }
3881  }
3882 
3883  bool success = true;
3884  wxString project, projName, projPath;
3885 
3886  auto cleanup = finally( [&] {
3887  if (safetyFileName != wxT("")) {
3888  if (wxFileExists(mFileName))
3889  wxRemove(mFileName);
3890  wxRename(safetyFileName, mFileName);
3891  }
3892 
3893  // mStrOtherNamesArray is a temporary array of file names, used only when
3894  // saving compressed
3895  if (!success) {
3896  AudacityMessageBox(wxString::Format(_("Could not save project. Perhaps %s \nis not writable or the disk is full."),
3897  project),
3898  _("Error Saving Project"),
3899  wxICON_ERROR, this);
3900 
3901  // Make the export of tracks succeed all-or-none.
3902  auto dir = project + wxT("_data");
3903  for ( auto &name : mStrOtherNamesArray )
3904  wxRemoveFile( dir + wxFileName::GetPathSeparator() + name);
3905  // This has effect only if the folder is empty
3906  wxFileName::Rmdir( dir );
3907  }
3908  // Success or no, we can forget the names
3909  mStrOtherNamesArray.clear();
3910  } );
3911 
3912  if (fromSaveAs) {
3913  // This block of code is duplicated in WriteXML, for now...
3914  project = mFileName;
3915  if (project.Len() > 4 && project.Mid(project.Len() - 4) == wxT(".aup"))
3916  project = project.Mid(0, project.Len() - 4);
3917  projName = wxFileNameFromPath(project) + wxT("_data");
3918  projPath = wxPathOnly(project);
3919 
3920  if( !wxDir::Exists( projPath ) ){
3921  AudacityMessageBox(wxString::Format(
3922  _("Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name."),
3923  projPath),
3924  _("Error Saving Project"),
3925  wxICON_ERROR, this);
3926  return (success = false);
3927  }
3928 
3929  if (bWantSaveCopy)
3930  {
3931  // Do this before saving the .aup, because we accumulate
3932  // mStrOtherNamesArray which affects the contents of the .aup
3933 
3934  // This populates the array mStrOtherNamesArray
3935  success = this->SaveCopyWaveTracks(project, bLossless);
3936  }
3937 
3938  if (!success)
3939  return false;
3940  }
3941 
3942  // Write the .aup now, before DirManager::SetProject,
3943  // because it's easier to clean up the effects of successful write of .aup
3944  // followed by failed SetProject, than the other way about.
3945  // And that cleanup is done by the destructor of saveFile, if PostCommit() is
3946  // not done.
3947  // (SetProject, when it fails, cleans itself up.)
3948  XMLFileWriter saveFile{ mFileName, _("Error Saving Project") };
3949  success = GuardedCall< bool >( [&] {
3950  WriteXMLHeader(saveFile);
3951  WriteXML(saveFile, bWantSaveCopy);
3952  // Flushes files, forcing space exhaustion errors before trying
3953  // SetProject():
3954  saveFile.PreCommit();
3955  return true;
3956  },
3957  MakeSimpleGuard(false),
3958  // Suppress the usual error dialog for failed write,
3959  // which is redundant here:
3960  [](void*){}
3961  );
3962 
3963  if (!success)
3964  return false;
3965 
3967 
3968  if (fromSaveAs && !bWantSaveCopy) {
3969  // We are about to move files from the current directory to
3970  // the NEW directory. We need to make sure files that belonged
3971  // to the last saved project don't get erased, so we "lock" them, so that
3972  // ProjectSetter's constructor copies instead of moves the files.
3973  // (Otherwise the NEW project would be fine, but the old one would
3974  // be empty of all of its files.)
3975 
3976  std::vector<std::unique_ptr<WaveTrack::Locker>> lockers;
3977  if (mLastSavedTracks) {
3978  lockers.reserve(mLastSavedTracks->size());
3979  for (auto wt : mLastSavedTracks->Any<WaveTrack>())
3980  lockers.push_back(
3981  std::make_unique<WaveTrack::Locker>(wt));
3982  }
3983 
3984  // This renames the project directory, and moves or copies
3985  // all of our block files over.
3986  pSetter.create( *mDirManager, projPath, projName, true );
3987 
3988  if (!pSetter->Ok())
3989  return false;
3990  }
3991 
3992  // Commit the writing of the .aup only now, after we know that the _data
3993  // folder also saved with no problems.
3994  // It is very unlikely that errors will happen:
3995  // only renaming and removing of files, not writes that might exhaust space.
3996  // So DO give a second dialog in case the unusual happens.
3997  success = success && GuardedCall< bool >( [&] {
3998  saveFile.PostCommit();
3999  return true;
4000  } );
4001 
4002  if (!success)
4003  return false;
4004 
4005  // SAVE HAS SUCCEEDED -- following are further no-fail commit operations.
4006 
4007  if (pSetter)
4008  pSetter->Commit();
4009 
4010  if ( !bWantSaveCopy )
4011  {
4012  // Now that we have saved the file, we can DELETE the auto-saved version
4014 
4015  if (mIsRecovered)
4016  {
4017  // This was a recovered file, that is, we have just overwritten the
4018  // old, crashed .aup file. There may still be orphaned blockfiles in
4019  // this directory left over from the crash, so we DELETE them now
4020  mDirManager->RemoveOrphanBlockfiles();
4021 
4022  // Before we saved this, this was a recovered project, but now it is
4023  // a regular project, so remember this.
4024  mIsRecovered = false;
4025  mRecoveryAutoSaveDataDir = wxT("");
4026  SetProjectTitle();
4027  }
4028  else if (fromSaveAs)
4029  {
4030  // On save as, always remove orphaned blockfiles that may be left over
4031  // because the user is trying to overwrite another project
4032  mDirManager->RemoveOrphanBlockfiles();
4033  }
4034 
4035  if (mLastSavedTracks)
4036  mLastSavedTracks->Clear();
4038 
4039  for (auto t : GetTracks()->Any()) {
4040  mLastSavedTracks->Add(t->Duplicate());
4041 
4042  //only after the xml has been saved we can mark it saved.
4043  //thus is because the OD blockfiles change on background thread while this is going on.
4044  // if(const auto wt = track_cast<WaveTrack*>(dupT))
4045  // wt->MarkSaved();
4046  }
4047 
4049  }
4050 
4051  // If we get here, saving the project was successful, so we can DELETE
4052  // the .bak file (because it now does not fit our block files anymore
4053  // anyway).
4054  if (safetyFileName != wxT(""))
4055  wxRemoveFile(safetyFileName),
4056  // cancel the cleanup:
4057  safetyFileName = wxT("");
4058 
4059  mStatusBar->SetStatusText(wxString::Format(_("Saved %s"),
4061 
4062  return true;
4063 }
void WriteXMLHeader(XMLWriter &xmlFile) const
Definition: Project.cpp:3664
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:3679
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:1561
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:5152
_("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:4066
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 2311 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().

2312 {
2313  const double lowerBound = ScrollingLowerBoundTime();
2314 
2315  int width;
2316  mTrackPanel->GetTracksUsableArea(&width, NULL);
2317  mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH, width, lowerBound);
2318 
2319 
2320  if (MayScrollBeyondZero()) {
2321  enum { SCROLL_PIXEL_TOLERANCE = 10 };
2322  if (std::abs(mViewInfo.TimeToPosition(0.0, 0
2323  )) < SCROLL_PIXEL_TOLERANCE) {
2324  // Snap the scrollbar to 0
2325  mViewInfo.h = 0;
2326  SetHorizontalThumb(0.0);
2327  }
2328  }
2329 
2330  mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
2331 
2332  //mchinen: do not always set this project to be the active one.
2333  //a project may autoscroll while playing in the background
2334  //I think this is okay since OnMouseEvent has one of these.
2335  //SetActiveProject(this);
2336 
2337  if (!mAutoScrolling) {
2338  mTrackPanel->Refresh(false);
2339  }
2340 
2341  CallAfter(
2342  [this]{ if (GetTrackPanel())
2343  GetTrackPanel()->HandleCursorForPresentMouseState(); } );
2344 }
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:1893
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:1875
TrackPanel * GetTrackPanel()
Definition: Project.h:324
void SetHorizontalThumb(double scrollto)
Definition: Project.cpp:1911
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 3345 of file Project.cpp.

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

Referenced by OpenFile().

3346 {
3347  //check the ODManager to see if we should add the tracks to the ODManager.
3348  //this flag would have been set in the HandleXML calls from above, if there were
3349  //OD***Blocks.
3351  {
3352  std::vector<std::unique_ptr<ODTask>> newTasks;
3353  //std::vector<ODDecodeTask*> decodeTasks;
3354  unsigned int createdODTasks=0;
3355  for (auto wt : GetTracks()->Any<WaveTrack>()) {
3356  //check the track for blocks that need decoding.
3357  //There may be more than one type e.g. FLAC/FFMPEG/lame
3358  unsigned int odFlags = wt->GetODFlags();
3359 
3360  //add the track to the already created tasks that correspond to the od flags in the wavetrack.
3361  for(unsigned int i=0;i<newTasks.size();i++) {
3362  if(newTasks[i]->GetODType() & odFlags)
3363  newTasks[i]->AddWaveTrack(wt);
3364  }
3365 
3366  //create whatever NEW tasks we need to.
3367  //we want at most one instance of each class for the project
3368  while((odFlags|createdODTasks) != createdODTasks)
3369  {
3370  std::unique_ptr<ODTask> newTask;
3371 #ifdef EXPERIMENTAL_OD_FLAC
3372  if(!(createdODTasks&ODTask::eODFLAC) && (odFlags & ODTask::eODFLAC)) {
3373  newTask = std::make_unique<ODDecodeFlacTask>();
3374  createdODTasks = createdODTasks | ODTask::eODFLAC;
3375  }
3376  else
3377 #endif
3378  if(!(createdODTasks&ODTask::eODPCMSummary) && (odFlags & ODTask::eODPCMSummary)) {
3379  newTask = std::make_unique<ODComputeSummaryTask>();
3380  createdODTasks = createdODTasks | ODTask::eODPCMSummary;
3381  }
3382  else {
3383  wxPrintf("unrecognized OD Flag in block file.\n");
3384  //TODO:ODTODO: display to user. This can happen when we build audacity on a system that doesnt have libFLAC
3385  break;
3386  }
3387  if(newTask)
3388  {
3389  newTask->AddWaveTrack(wt);
3390  newTasks.push_back(std::move(newTask));
3391  }
3392  }
3393  }
3394  for(unsigned int i=0;i<newTasks.size();i++)
3395  ODManager::Instance()->AddNewTask(std::move(newTasks[i]));
3396  }
3397 }
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 5359 of file Project.cpp.

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

Referenced by TimerRecordDialog::ExecutePostRecordActions().

5360 {
5361  Exporter e;
5362 
5364  return e.ProcessFromTimerRecording(this, false, 0.0, mTracks->GetEndTime(), fnFile, iFormat, iSubFormat, iFilterIndex);
5365 }
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 1776 of file Project.cpp.

References DoScroll(), and mAutoScrolling.

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

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

Definition at line 1972 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().

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

References mBandwidthSelectionFormatName.

Referenced by SSBL_GetBandwidthSelectionFormatName(), and WriteXML().

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

Definition at line 4911 of file Project.cpp.

References mCaptureMeter.

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

4912 {
4913  return mCaptureMeter;
4914 }
MeterPanel * mCaptureMeter
Definition: Project.h:680
TrackList * AudacityProject::GetClipboardTracks ( )
static

Definition at line 4721 of file Project.cpp.

References msClipboard.

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

4722 {
4723  return msClipboard.get();
4724 }
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 5618 of file Project.cpp.

References _(), mContrastDialog, and safenew.

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

5619 {
5620  // All of this goes away when the Contrast Dialog is converted to a module
5621  if(create && !mContrastDialog)
5623  this, -1, _("Contrast Analysis (WCAG 2 compliance)"),
5624  wxPoint{ 150, 150 }
5625  } );
5626 
5627  return mContrastDialog.get();
5628 }
#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 4810 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().

4811 {
4812  return (ControlToolBar *)
4813  (mToolManager ?
4814  mToolManager->GetToolBar(TransportBarID) :
4815  NULL);
4816 }
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 4823 of file Project.cpp.

References DeviceBarID, and mToolManager.

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

4824 {
4825  return (DeviceToolBar *)
4826  (mToolManager ?
4827  mToolManager->GetToolBar(DeviceBarID) :
4828  NULL);
4829 }
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 1507 of file Project.cpp.

References mDirManager.

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

1508 {
1509  return mDirManager;
1510 }
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 4831 of file Project.cpp.

References EditBarID, and mToolManager.

4832 {
4833  return (EditToolBar *)
4834  (mToolManager ?
4835  mToolManager->GetToolBar(EditBarID) :
4836  NULL);
4837 }
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 5484 of file Project.cpp.

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

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

5484  {
5485 
5486  // Obtain the current settings
5487  auto oCaptureFormat = QualityPrefs::SampleFormatChoice();
5488  if (lCaptureChannels == 0) {
5489  gPrefs->Read(wxT("/AudioIO/RecordChannels"), &lCaptureChannels, 2L);
5490  }
5491 
5492  // Find out how much free space we have on disk
5493  wxLongLong lFreeSpace = mDirManager->GetFreeDiskSpace();
5494  if (lFreeSpace < 0) {
5495  return 0;
5496  }
5497 
5498  // Calculate the remaining time
5499  double dRecTime = 0.0;
5500  double bytesOnDiskPerSample = SAMPLE_SIZE_DISK(oCaptureFormat);
5501  dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
5502  dRecTime /= bytesOnDiskPerSample;
5503  dRecTime /= lCaptureChannels;
5504  dRecTime /= GetRate();
5505 
5506  // Convert to minutes before returning
5507  int iRecMins = (int)round(dRecTime / 60.0);
5508  return iRecMins;
5509 }
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 1723 of file Project.cpp.

References mFrequencySelectionFormatName.

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

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

Definition at line 5608 of file Project.cpp.

References _(), mFreqWindow, and safenew.

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

5609 {
5610  if (create && !mFreqWindow)
5612  this, -1, _("Frequency Analysis"),
5613  wxPoint{ 150, 150 }
5614  } );
5615  return mFreqWindow.get();
5616 }
#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 5588 of file Project.cpp.

References GetUndoManager(), mHistoryWindow, and safenew.

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

5589 {
5590  if (create && !mHistoryWindow)
5592  return mHistoryWindow;
5593 }
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 5455 of file Project.cpp.

References _(), and wxPLURAL.

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

5456 {
5457 
5458  wxString sFormatted = wxEmptyString;
5459 
5460  if (iMinutes < 1) {
5461  // Less than a minute...
5462  sFormatted = _("Less than 1 minute");
5463  return sFormatted;
5464  }
5465 
5466  // Calculate
5467  int iHours = iMinutes / 60;
5468  int iMins = iMinutes % 60;
5469 
5470  auto sHours =
5471  wxString::Format( wxPLURAL("%d hour", "%d hours", iHours), iHours );
5472  auto sMins =
5473  wxString::Format( wxPLURAL("%d minute", "%d minutes", iMins), iMins );
5474 
5475  /* i18n-hint: A time in hours and minutes. Only translate the "and". */
5476  sFormatted.Printf( _("%s and %s."), sHours, sMins);
5477  return sFormatted;
5478 }
#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 1590 of file Project.cpp.

References mTracks.

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

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

Definition at line 5324 of file Project.cpp.

References GetActiveProject(), and mKeyboardCaptureHandler.

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

5325 {
5326  AudacityProject *project = GetActiveProject();
5327  if (project)
5328  {
5329  return project->mKeyboardCaptureHandler;
5330  }
5331 
5332  return NULL;
5333 }
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 5572 of file Project.cpp.

References mLyricsWindow, and safenew.

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

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

Definition at line 5595 of file Project.cpp.

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

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

5596 {
5597  if (create && !mMacrosWindow)
5598  mMacrosWindow = safenew MacrosWindow{ this, bExpanded };
5599 
5600  if (mMacrosWindow) {
5601  mMacrosWindow->Show();
5602  mMacrosWindow->Raise();
5603  mMacrosWindow->UpdateDisplay( bExpanded );
5604  }
5605  return mMacrosWindow;
5606 }
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 1460 of file Project.cpp.

References mAliasMissingWarningDialog.

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

Definition at line 5579 of file Project.cpp.

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

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

5580 {
5581  if (create && !mMixerBoardFrame) {
5584  }
5585  return mMixerBoardFrame;
5586 }
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 4839 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().

4840 {
4841  return (MixerToolBar *)
4842  (mToolManager ?
4843  mToolManager->GetToolBar(MixerBarID) :
4844  NULL);
4845 }
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 1548 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().

1549 {
1550  wxString name = wxFileNameFromPath(mFileName);
1551 
1552  // Chop off the extension
1553  size_t len = name.Len();
1554  if (len > 4 && name.Mid(len - 4) == wxT(".aup"))
1555  name = name.Mid(0, len - 4);
1556 
1557  return name;
1558 }
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 5367 of file Project.cpp.

References gAudacityProjects.

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

5367  {
5368  return gAudacityProjects.size();
5369 }
AProjectArray gAudacityProjects
Definition: Project.cpp:306
MeterPanel * AudacityProject::GetPlaybackMeter ( )

Definition at line 4897 of file Project.cpp.

References mPlaybackMeter.

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

4898 {
4899  return mPlaybackMeter;
4900 }
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 5087 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().

5089 {
5090  if (mRuler)
5091  mRuler->GetPlayRegion(playRegionStart, playRegionEnd);
5092  else
5093  *playRegionEnd = *playRegionStart = 0;
5094 }
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 4847 of file Project.cpp.

References mToolManager, and ScrubbingBarID.

Referenced by Scrubber::OnScrubOrSeek().

4848 {
4849  return dynamic_cast<ScrubbingToolBar*>
4850  (mToolManager ?
4851  mToolManager->GetToolBar(ScrubbingBarID) :
4852  nullptr);
4853 }
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 4855 of file Project.cpp.

References mToolManager, and SelectionBarID.

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

4856 {
4857  return (SelectionBar *)
4858  (mToolManager ?
4859  mToolManager->GetToolBar(SelectionBarID) :
4860  NULL);
4861 }
(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 5292 of file Project.cpp.

References mSnapTo.

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

5293 {
5294  return mSnapTo;
5295 }
SpectralSelectionBar * AudacityProject::GetSpectralSelectionBar ( )

Definition at line 4864 of file Project.cpp.

References mToolManager, and SpectralSelectionBarID.

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

4865 {
4866  return static_cast<SpectralSelectionBar*>(
4867  (mToolManager ?
4868  mToolManager->GetToolBar(SpectralSelectionBarID) :
4869  NULL));
4870 }
(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 1373 of file Project.cpp.

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

Referenced by Scrubber::StartSpeedPlay().

1374 {
1375  auto PlayAtSpeedRate = gAudioIO->GetBestRate(
1376  false, //not capturing
1377  true, //is playing
1378  GetRate() //suggested rate
1379  );
1380  AudioIOStartStreamOptions options{ PlayAtSpeedRate };
1381  options.timeTrack = GetTracks()->GetTimeTrack();
1382  options.listener = this;
1383  return options;
1384 }
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 4873 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().

4874 {
4875  return (ToolsToolBar *)
4876  (mToolManager ?
4877  mToolManager->GetToolBar(ToolsBarID) :
4878  NULL);
4879 }
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 4881 of file Project.cpp.

References mToolManager, and ToolsBarID.

4882 {
4883  return (ToolsToolBar *)
4884  (mToolManager ?
4885  mToolManager->GetToolBar(ToolsBarID) :
4886  NULL);
4887 }
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 5038 of file Project.cpp.

References TrackPanel::GetTracksUsableArea(), and mTrackPanel.

Referenced by IsVisibleTrack::IsVisibleTrack().

5039 {
5040  wxSize s;
5041  mTrackPanel->GetTracksUsableArea(&s.x, &s.y);
5042  return s;
5043 }
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 2158 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().

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

Implements XMLTagHandler.

Definition at line 3621 of file Project.cpp.

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

3622 {
3623  if (!wxStrcmp(tag, wxT("tags"))) {
3624  return mTags.get();
3625  }
3626 
3627  // Note that TrackList::Add includes assignment of unique in-session TrackId
3628  // to a reloaded track, though no promise that it equals the id it originally
3629  // had
3630 
3631  if (!wxStrcmp(tag, wxT("wavetrack"))) {
3632  return mTracks->Add(mTrackFactory->NewWaveTrack());
3633  }
3634 
3635  #ifdef USE_MIDI
3636  if (!wxStrcmp(tag, wxT("notetrack"))) {
3637  return mTracks->Add(mTrackFactory->NewNoteTrack());
3638  }
3639  #endif // USE_MIDI
3640 
3641  if (!wxStrcmp(tag, wxT("labeltrack"))) {
3642  return mTracks->Add(mTrackFactory->NewLabelTrack());
3643  }
3644 
3645  if (!wxStrcmp(tag, wxT("timetrack"))) {
3646  return mTracks->Add(mTrackFactory->NewTimeTrack());
3647  }
3648 
3649  if (!wxStrcmp(tag, wxT("recordingrecovery"))) {
3651  mRecordingRecoveryHandler = std::make_unique<RecordingRecoveryHandler>(this);
3652  return mRecordingRecoveryHandler.get();
3653  }
3654 
3655  if (!wxStrcmp(tag, wxT("import"))) {
3656  if (!mImportXMLTagHandler)
3657  mImportXMLTagHandler = std::make_unique<ImportXMLTagHandler>(this);
3658  return mImportXMLTagHandler.get();
3659  }
3660 
3661  return NULL;
3662 }
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 3399 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.

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

Definition at line 5318 of file Project.cpp.

References GetKeyboardCaptureHandler().

Referenced by CellularPanel::OnKillFocus().

5319 {
5320  return GetKeyboardCaptureHandler() == handler;
5321 }
static wxWindow * GetKeyboardCaptureHandler()
Definition: Project.cpp:5324
bool AudacityProject::Import ( const wxString &  fileName,
WaveTrackArray pTrackArray = NULL 
)

Definition at line 4286 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().

4287 {
4288  TrackHolders newTracks;
4289  wxString errorMessage = wxEmptyString;
4290 
4291  {
4292  // Backup Tags, before the import. Be prepared to roll back changes.
4293  auto cleanup = valueRestorer( mTags,
4294  mTags ? mTags->Duplicate() : decltype(mTags){} );
4295 
4296  bool success = Importer::Get().Import(fileName,
4297  GetTrackFactory(),
4298  newTracks,
4299  mTags.get(),
4300  errorMessage);
4301 
4302  if (!errorMessage.IsEmpty()) {
4303  // Error message derived from Importer::Import
4304  // Additional help via a Help button links to the manual.
4305  ShowErrorDialog(this, _("Error Importing"),
4306  errorMessage, wxT("Importing_Audio"));
4307  }
4308  if (!success)
4309  return false;
4310 
4311  wxGetApp().AddFileToHistory(fileName);
4312 
4313  // no more errors, commit
4314  cleanup.release();
4315  }
4316 
4317  // for LOF ("list of files") files, do not import the file as if it
4318  // were an audio file itself
4319  if (fileName.AfterLast('.').IsSameAs(wxT("lof"), false)) {
4320  // PRL: don't redundantly do the steps below, because we already
4321  // did it in case of LOF, because of some weird recursion back to this
4322  // same function. I think this should be untangled.
4323 
4324  // So Undo history push is not bypassed, despite appearances.
4325  return false;
4326  }
4327 
4328  // PRL: Undo history is incremented inside this:
4329  auto newSharedTracks = AddImportedTracks(fileName, std::move(newTracks));
4330 
4331  if (pTrackArray) {
4332  for (const auto &newTrack : newSharedTracks) {
4333  newTrack->TypeSwitch( [&](WaveTrack *wt) {
4334  pTrackArray->push_back( Track::Pointer< WaveTrack >( wt ) );
4335  });
4336  }
4337  }
4338 
4339  int mode = gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"), 0L);
4340  if (mode == 1) {
4341  //TODO: All we want is a SelectAll()
4342  SelectNone();
4343  SelectAllIfNone();
4344  const CommandContext context( *this);
4346  EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
4347  context,
4349  }
4350 
4351  // This is a no-fail:
4352  GetDirManager()->FillBlockfilesCache();
4353  return true;
4354 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
std::vector< std::shared_ptr< Track > > AddImportedTracks(const wxString &fileName, TrackHolders &&newTracks)
Definition: Project.cpp:4173
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:1507
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:5635
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:1512
void SelectAllIfNone()
Definition: Project.cpp:5733
void AudacityProject::InitialState ( )
private

Definition at line 4583 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().

4584 {
4586 
4588  _("Created new project"), wxT(""));
4589 
4591 
4592  GetMenuManager(*this).ModifyUndoMenuItems(*this);
4593 
4594  GetMenuManager(*this).UpdateMenus(*this);
4595 }
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:641
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 2438 of file Project.cpp.

References mActive.

Referenced by MenuManager::GetUpdateFlags().

2439 {
2440  return mActive;
2441 }
bool AudacityProject::IsAlreadyOpen ( const wxString &  projPathName)
static

Definition at line 2844 of file Project.cpp.

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

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

2845 {
2846  const wxFileName newProjPathName(projPathName);
2847  size_t numProjects = gAudacityProjects.size();
2848  for (size_t i = 0; i < numProjects; i++)
2849  {
2850  if (newProjPathName.SameAs(gAudacityProjects[i]->mFileName))
2851  {
2852  wxString errMsg =
2853  wxString::Format(_("%s is already open in another window."),
2854  newProjPathName.GetName());
2855  wxLogError(errMsg);
2856  AudacityMessageBox(errMsg, _("Error Opening Project"), wxOK | wxCENTRE);
2857  return true;
2858  }
2859  }
2860  return false;
2861 }
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 5567 of file Project.cpp.

References mFocusLender.

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

Definition at line 5371 of file Project.cpp.

References mDirManager.

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

5371  {
5372  // This is true if a project was opened from an .aup
5373  // Otherwise it becomes true only when a project is first saved successfully
5374  // in DirManager::SetProject
5375  wxString sProjectName = mDirManager->GetProjectName();
5376  return (sProjectName != wxT(""));
5377 }
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 5297 of file Project.cpp.

References mIsSyncLocked.

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

5298 {
5299 #ifdef EXPERIMENTAL_SYNC_LOCK
5300  return mIsSyncLocked;
5301 #else
5302  return false;
5303 #endif
5304 }
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 2378 of file Project.cpp.

Referenced by OnActivate().

2379 {
2380  (void)show;//compiler food
2381 #ifdef __WXMAC__
2382  // Find all the floating toolbars, and show or hide them
2383  const auto &children = GetChildren();
2384  for(const auto &child : children) {
2385  if (auto frame = dynamic_cast<ToolFrame*>(child)) {
2386  if (!show)
2387  frame->Hide();
2388  else if (frame->GetBar() &&
2389  frame->GetBar()->IsVisible())
2390  frame->Show();
2391  }
2392  }
2393 #endif
2394 }
bool AudacityProject::MayScrollBeyondZero ( ) const

Definition at line 1875 of file Project.cpp.

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

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

1876 {
1878  return true;
1879 
1880  if (GetScrubber().HasMark() ||
1881  IsAudioActive()) {
1882  if (mPlaybackScroller) {
1883  auto mode = mPlaybackScroller->GetMode();
1884  if (mode == PlaybackScroller::Mode::Pinned ||
1886  return true;
1887  }
1888  }
1889 
1890  return false;
1891 }
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:1532
void AudacityProject::MayStartMonitoring ( )

Definition at line 5173 of file Project.cpp.

References gPrefs.

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

5174 {
5175 #ifdef EXPERIMENTAL_EXTRA_MONITORING
5176  bool bAlwaysMonitor;
5177  gPrefs->Read( wxT("GUI/AlwaysMonitor"), &bAlwaysMonitor, true );
5178  if( !bAlwaysMonitor )
5179  return;
5180 
5181  MeterToolBar * pToolBar = GetMeterToolBar();
5182  if( pToolBar == NULL )
5183  return;
5184  pToolBar->StartMonitoring();
5185 #endif
5186 }
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 4642 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().

4643 {
4645  if (bWantsAutoSave)
4646  AutoSave();
4648 }
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 2396 of file Project.cpp.

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

2397 {
2398  // Activate events can fire during window teardown, so just
2399  // ignore them.
2400  if (mIsDeleting) {
2401  return;
2402  }
2403 
2404  mActive = event.GetActive();
2405 
2406  // Under Windows, focus can be "lost" when returning to
2407  // Audacity from a different application.
2408  //
2409  // This was observed by minimizing all windows using WINDOWS+M and
2410  // then ALT+TAB to return to Audacity. Focus will be given to the
2411  // project window frame which is not at all useful.
2412  //
2413  // So, we use ToolManager's observation of focus changes in a wxEventFilter.
2414  // Then, when we receive the
2415  // activate event, we restore that focus to the child or the track
2416  // panel if no child had the focus (which probably should never happen).
2417  if (!mActive) {
2418 #ifdef __WXMAC__
2419  if (IsIconized())
2420  MacShowUndockedToolbars(false);
2421 #endif
2422  }
2423  else {
2424  SetActiveProject(this);
2425  if ( ! GetToolManager()->RestoreFocus() ) {
2426  if (mTrackPanel) {
2427  mTrackPanel->SetFocus();
2428  }
2429  }
2430 
2431 #ifdef __WXMAC__
2433 #endif
2434  }
2435  event.Skip();
2436 }
void MacShowUndockedToolbars(bool show)
Definition: Project.cpp:2378
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 5271 of file Project.cpp.

References AutoSaveFile::Append(), and mAutoSaveFileName.

5272 {
5273  // New blockfiles have been created, so add them to the auto-save file
5274  if (!mAutoSaveFileName.IsEmpty())
5275  {
5276  wxFFile f(mAutoSaveFileName, wxT("ab"));
5277  if (!f.IsOpened())
5278  return; // Keep recording going, there's not much we can do here
5279  blockFileLog.Append(f);
5280  f.Close();
5281  }
5282 }
wxString mAutoSaveFileName
Definition: Project.h:726
bool Append(wxFFile &file) const
void AudacityProject::OnAudioIORate ( int  rate)
overridevirtual

Implements AudioIOListener.

Definition at line 5188 of file Project.cpp.

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

5189 {
5190  wxString display;
5191  if (rate > 0) {
5192  display = wxString::Format(_("Actual Rate: %d"), rate);
5193  }
5194  else
5195  // clear the status field
5196  ;
5197 
5198  int x, y;
5199  mStatusBar->GetTextExtent(display, &x, &y);
5200  int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, x+50};
5201  mStatusBar->SetStatusWidths(4, widths);
5202  mStatusBar->SetStatusText(display, rateStatusBarField);
5203 }
_("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:4810
void AudacityProject::OnAudioIOStartRecording ( )
overridevirtual

Implements AudioIOListener.

Definition at line 5205 of file Project.cpp.

References AutoSave().

5206 {
5207  // Before recording is started, auto-save the file. The file will have
5208  // empty tracks at the bottom where the recording will be put into
5209  AutoSave();
5210 }
void AudacityProject::OnAudioIOStopRecording ( )
overridevirtual

Implements AudioIOListener.

Definition at line 5213 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().

5214 {
5215  // Only push state if we were capturing and not monitoring
5216  if (GetAudioIOToken() > 0)
5217  {
5218  auto &intervals = gAudioIO->LostCaptureIntervals();
5219  if (intervals.size()) {
5220  // Make a track with labels for recording errors
5221  auto uTrack = GetTrackFactory()->NewLabelTrack();
5222  auto pTrack = uTrack.get();
5223  GetTracks()->Add( std::move(uTrack) );
5224  /* i18n-hint: A name given to a track, appearing as its menu button.
5225  The translation should be short or else it will not display well.
5226  At most, about 11 Latin characters.
5227  Dropout is a loss of a short sequence audio sample data from the
5228  recording */
5229  pTrack->SetName(_("Dropouts"));
5230  long counter = 1;
5231  for (auto &interval : intervals)
5232  pTrack->AddLabel(
5233  SelectedRegion{ interval.first,
5234  interval.first + interval.second },
5235  wxString::Format(wxT("%ld"), counter++),
5236  -2 );
5237  ShowWarningDialog(this, wxT("DropoutDetected"), _("\
5238 Recorded audio was lost at the labeled locations. Possible causes:\n\
5239 \n\
5240 Other applications are competing with Audacity for processor time\n\
5241 \n\
5242 You are saving directly to a slow external storage device\n\
5243 "
5244  ),
5245  false,
5246  _("Turn off dropout detection"));
5247  }
5248 
5249  // Add to history
5250  PushState(_("Recorded Audio"), _("Record"));
5251 
5252  // Reset timer record
5253  if (IsTimerRecordCancelled())
5254  {
5255  EditActions::DoUndo( *this );
5257  }
5258 
5259  // Refresh the project window
5260  FixScrollbars();
5261  RedrawProject();
5262  }
5263 
5264  // Write all cached files to disk, if any
5265  mDirManager->WriteCacheToDisk();
5266 
5267  // Now we auto-save again to get the project to a "normal" state again.
5268  AutoSave();
5269 }
void RedrawProject(const bool bForceWaveTracks=false)
Definition: Project.cpp:1465
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:1522
int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, const wxString &message, bool showCancelButton, const wxString &footer)
Definition: Warning.cpp:93
void FixScrollbars()
Definition: Project.cpp:1972
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:4611
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:1512
void AudacityProject::OnCapture ( wxCommandEvent &  evt)
private

Definition at line 1496 of file Project.cpp.

References mIsCapturing.

Referenced by AudacityProject().

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

Definition at line 2485 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().

2486 {
2487  // We are called for the wxEVT_CLOSE_WINDOW, wxEVT_END_SESSION, and
2488  // wxEVT_QUERY_END_SESSION, so we have to protect against multiple
2489  // entries. This is a hack until the whole application termination
2490  // process can be reviewed and reworked. (See bug #964 for ways
2491  // to exercise the bug that instigated this hack.)
2492  if (mIsBeingDeleted)
2493  {
2494  event.Skip();
2495  return;
2496  }
2497 
2498  if (event.CanVeto() && (::wxIsBusy() || mbBusyImporting))
2499  {
2500  event.Veto();
2501  return;
2502  }
2503 
2504  // TODO: consider postponing these steps until after the possible veto
2505  // below: closing the two analysis dialogs, and stopping audio streams.
2506  // Streams can be for play, recording, or monitoring. But maybe it still
2507  // makes sense to stop any recording before putting up the dialog.
2508 
2509  mFreqWindow.reset();
2510  mContrastDialog.reset();
2511 
2512  // Check to see if we were playing or recording
2513  // audio, and if so, make sure Audio I/O is completely finished.
2514  // The main point of this is to properly push the state
2515  // and flush the tracks once we've completely finished
2516  // recording NEW state.
2517  // This code is derived from similar code in
2518  // AudacityProject::~AudacityProject() and TrackPanel::OnTimer().
2519  if (GetAudioIOToken()>0 &&
2521 
2522  // We were playing or recording audio, but we've stopped the stream.
2523  wxCommandEvent dummyEvent;
2524  GetControlToolBar()->OnStop(dummyEvent);
2525 
2526  FixScrollbars();
2527  SetAudioIOToken(0);
2528  RedrawProject();
2529  }
2530  else if (gAudioIO->IsMonitoring()) {
2531  gAudioIO->StopStream();
2532  }
2533 
2534  // MY: Use routine here so other processes can make same check
2535  bool bHasTracks = ProjectHasTracks();
2536 
2537  // We may not bother to prompt the user to save, if the
2538  // project is now empty.
2539  if (event.CanVeto() && (mEmptyCanBeDirty || bHasTracks)) {
2540  if (GetUndoManager()->UnsavedChanges()) {
2541  TitleRestorer Restorer( this );// RAII
2542  /* i18n-hint: The first %s numbers the project, the second %s is the project name.*/
2543  wxString Title = wxString::Format(_("%sSave changes to %s?"), Restorer.sProjNumber, Restorer.sProjName);
2544  wxString Message = _("Save project before closing?");
2545  if( !bHasTracks )
2546  {
2547  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.");
2548  }
2549  int result = AudacityMessageBox( Message,
2550  Title,
2551  wxYES_NO | wxCANCEL | wxICON_QUESTION,
2552  this);
2553 
2554  if (result == wxCANCEL || (result == wxYES &&
2555  !GuardedCall<bool>( [&]{ return Save(); } )
2556  )) {
2557  event.Veto();
2558  return;
2559  }
2560  }
2561  }
2562 
2563 #ifdef __WXMAC__
2564  // Fix bug apparently introduced into 2.1.2 because of wxWidgets 3:
2565  // closing a project that was made full-screen (as by clicking the green dot
2566  // or command+/; not merely "maximized" as by clicking the title bar or
2567  // Zoom in the Window menu) leaves the screen black.
2568  // Fix it by un-full-screening.
2569  // (But is there a different way to do this? What do other applications do?
2570  // I don't see full screen windows of Safari shrinking, but I do see
2571  // momentary blackness.)
2572  ShowFullScreen(false);
2573 #endif
2574 
2576 
2577  // Stop the timer since there's no need to update anything anymore
2578  mTimer.reset();
2579 
2580  // The project is now either saved or the user doesn't want to save it,
2581  // so there's no need to keep auto save info around anymore
2583 
2584  // DMM: Save the size of the last window the user closes
2585  //
2586  // LL: Save before doing anything else to the window that might make
2587  // its size change.
2588  SaveWindowSize();
2589 
2590  mIsDeleting = true;
2591 
2592  // Mac: we never quit as the result of a close.
2593  // Other systems: we quit only when the close is the result of an external
2594  // command (on Windows, those are taskbar closes, "X" box, Alt+F4, etc.)
2595  bool quitOnClose;
2596 #ifdef __WXMAC__
2597  quitOnClose = false;
2598 #else
2599  quitOnClose = !mMenuClose;
2600 #endif
2601 
2602  // DanH: If we're definitely about to quit, DELETE the clipboard.
2603  // Doing this after Deref'ing the DirManager causes problems.
2604  if ((gAudacityProjects.size() == 1) && (quitOnClose || gIsQuitting))
2605  DeleteClipboard();
2606 
2607  // JKC: For Win98 and Linux do not detach the menu bar.
2608  // We want wxWidgets to clean it up for us.
2609  // TODO: Is there a Mac issue here??
2610  // SetMenuBar(NULL);
2611 
2612  // Lock all blocks in all tracks of the last saved version, so that
2613  // the blockfiles aren't deleted on disk when we DELETE the blockfiles
2614  // in memory. After it's locked, DELETE the data structure so that
2615  // there's no memory leak.
2616  if (mLastSavedTracks) {
2617  for (auto wt : mLastSavedTracks->Any<WaveTrack>())
2618  wt->CloseLock();
2619 
2620  mLastSavedTracks->Clear(); // sends an event
2621  mLastSavedTracks.reset();
2622  }
2623 
2624  // Get rid of the history window
2625  // LL: Destroy it before the TrackPanel and ToolBars since they
2626  // may/will get additional wxEVT_PAINT events since window
2627  // destruction may be queued. This seems to only be a problem
2628  // on the Mac.
2629  if (mHistoryWindow) {
2630  mHistoryWindow->Destroy();
2631  mHistoryWindow = NULL;
2632  }
2633 
2634  // Some of the AdornedRulerPanel functions refer to the TrackPanel, so destroy this
2635  // before the TrackPanel is destroyed. This change was needed to stop Audacity
2636  // crashing when running with Jaws on Windows 10 1703.
2637  if (mRuler)
2638  mRuler->Destroy();
2639 
2640  // Destroy the TrackPanel early so it's not around once we start
2641  // deleting things like tracks and such out from underneath it.
2642  // Check validity of mTrackPanel per bug 584 Comment 1.
2643  // Deeper fix is in the Import code, but this failsafes against crash.
2644  if (mTrackPanel)
2645  {
2646  mTrackPanel->Destroy();
2647  mTrackPanel = NULL; // Make sure this gets set...see HandleResize()
2648  }
2649 
2650  // Delete the tool manager before the children since it needs
2651  // to save the state of the toolbars.
2652  mToolManager.reset();
2653 
2654  DestroyChildren();
2655 
2656  mTrackFactory.reset();
2657 
2658  mTags.reset();
2659 
2660  mImportXMLTagHandler.reset();
2661 
2662  // Delete all the tracks to free up memory and DirManager references.
2663  mTracks->Clear();
2664  mTracks.reset();
2665 
2666  // This must be done before the following Deref() since it holds
2667  // references to the DirManager.
2669 
2670  // MM: Tell the DirManager it can now DELETE itself
2671  // if it finds it is no longer needed. If it is still
2672  // used (f.e. by the clipboard), it will recognize this
2673  // and will destroy itself later.
2674  //
2675  // LL: All objects with references to the DirManager should
2676  // have been deleted before this.
2677  mDirManager.reset();
2678 
2679  AProjectHolder pSelf;
2680  {
2682  auto end = gAudacityProjects.end();
2683  auto it = std::find_if(gAudacityProjects.begin(), end,
2684  [this] (const AProjectHolder &p) { return p.get() == this; });
2685  wxASSERT( it != end );
2686  pSelf = std::move( *it );
2687  gAudacityProjects.erase(it);
2688  }
2689 
2690  if (gActiveProject == this) {
2691  // Find a NEW active project
2692  if (gAudacityProjects.size() > 0) {
2694  }
2695  else {
2696  SetActiveProject(NULL);
2697  }
2698  }
2699 
2700  // Since we're going to be destroyed, make sure we're not to
2701  // receive audio notifications anymore.
2702  if (gAudioIO->GetListener() == this) {
2704  }
2705 
2706  if (gAudacityProjects.empty() && !gIsQuitting) {
2707 
2708 #if !defined(__WXMAC__)
2709  if (quitOnClose) {
2710  QuitAudacity();
2711  }
2712  else {
2715  }
2716 #endif
2717  }
2718 
2719  // Destroys this
2720  pSelf.reset();
2721  mRuler = nullptr;
2722 
2723  mIsBeingDeleted = true;
2724 
2725 }
std::unique_ptr< ImportXMLTagHandler > mImportXMLTagHandler
Definition: Project.h:723
void RedrawProject(const bool bForceWaveTracks=false)
Definition: Project.cpp:1465
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:1527
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:594
int GetAudioIOToken() const
Definition: Project.cpp:1522
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:1972
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:5449
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:5152
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:4810
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:4727
Destroy_ptr< FreqWindow > mFreqWindow
Definition: Project.h:670
AudacityProject * CreateNewAudacityProject()
Definition: Project.cpp:552
void AudacityProject::OnIconize ( wxIconizeEvent &  event)

Definition at line 2193 of file Project.cpp.

References gAudacityProjects, and mIconized.

2194 {
2195  int VisibleProjectCount = 0;
2196 
2197  //JKC: On Iconizing we get called twice. Don't know
2198  // why but it does no harm.
2199  // Should we be returning true/false rather than
2200  // void return? I don't know.
2201  mIconized = event.IsIconized();
2202 
2203  unsigned int i;
2204 
2205  for(i=0;i<gAudacityProjects.size();i++){
2206  if(gAudacityProjects[i]){
2207  if( !gAudacityProjects[i]->mIconized )
2208  VisibleProjectCount++;
2209  }
2210  }
2211 
2212  event.Skip();
2213 }
bool mIconized
Definition: Project.h:662
AProjectArray gAudacityProjects
Definition: Project.cpp:306
void AudacityProject::OnMenu ( wxCommandEvent &  event)

Definition at line 2346 of file Project.cpp.

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

2347 {
2348 #ifdef __WXMSW__
2349  // Bug 1642: We can arrive here with bogus menu IDs, which we
2350  // proceed to process. So if bogus, don't.
2351  // The bogus menu IDs are probably generated by controls on the TrackPanel,
2352  // such as the Project Rate.
2353  // 17000 is the magic number at which we start our menu.
2354  // This code would probably NOT be OK on Mac, since we assign
2355  // some specific ID numbers.
2356  if( event.GetId() < 17000){
2357  event.Skip();
2358  return;
2359  }
2360 #endif
2361  bool handled = GetCommandManager()->HandleMenuID(
2362  event.GetId(), GetMenuManager(*this).GetUpdateFlags(*this),
2364 
2365  if (handled)
2366  event.Skip(false);
2367  else{
2368  event.ResumePropagation( 999 );
2369  event.Skip(true);
2370  }
2371 }
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 2443 of file Project.cpp.

References SetActiveProject().

2444 {
2445  if (event.ButtonDown())
2446  SetActiveProject(this);
2447 }
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:316
void AudacityProject::OnMove ( wxMoveEvent &  event)

Definition at line 2215 of file Project.cpp.

References SetNormalizedWindowState().

2216 {
2217  if (!this->IsMaximized() && !this->IsIconized())
2218  SetNormalizedWindowState(this->GetRect());
2219  event.Skip();
2220 }
void SetNormalizedWindowState(wxRect pSizeAndLocation)
Definition: Project.h:692
void AudacityProject::OnODTaskComplete ( wxCommandEvent &  event)

Definition at line 2297 of file Project.cpp.

References mTrackPanel, and TrackPanel::Refresh().

2298 {
2299  if(mTrackPanel)
2300  mTrackPanel->Refresh(false);
2301 }
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 2288 of file Project.cpp.

References mTrackPanel, and TrackPanel::Refresh().

2289 {
2290  //todo: add track data to the event - check to see if the project contains it before redrawing.
2291  if(mTrackPanel)
2292  mTrackPanel->Refresh(false);
2293 
2294 }
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 2727 of file Project.cpp.

References OpenFile().

2728 {
2729  const wxString &cmd = event.GetString();
2730 
2731  if (!cmd.IsEmpty()) {
2732  OpenFile(cmd);
2733  }
2734 
2735  RequestUserAttention();
2736 }
void OpenFile(const wxString &fileName, bool addtohistory=true)
Definition: Project.cpp:2961
void AudacityProject::OnScroll ( wxScrollEvent &  event)

Definition at line 2303 of file Project.cpp.

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

2304 {
2305  const wxInt64 offset = PixelWidthBeforeTime(0.0);
2306  mViewInfo.sbarH =
2307  (wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
2308  DoScroll();
2309 }
wxInt64 sbarH
Definition: ViewInfo.h:168
double PixelWidthBeforeTime(double scrollto) const
Definition: Project.cpp:1903
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 1793 of file Project.cpp.

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

Referenced by TP_ScrollLeft().

1794 {
1795  wxInt64 pos = mHsbar->GetThumbPosition();
1796  // move at least one scroll increment
1797  pos -= wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
1798  pos = wxMax(pos, 0);
1800  mViewInfo.sbarH = std::max(mViewInfo.sbarH,
1801  -(wxInt64) PixelWidthBeforeTime(0.0));
1802 
1803 
1804  if (pos != mHsbar->GetThumbPosition()) {
1805  mHsbar->SetThumbPosition((int)pos);
1806  FinishAutoScroll();
1807  }
1808 }
wxInt64 sbarH
Definition: ViewInfo.h:168
void FinishAutoScroll()
Definition: Project.cpp:1776
double PixelWidthBeforeTime(double scrollto) const
Definition: Project.cpp:1903
const int sbarHjump
Definition: Project.cpp:206
ViewInfo mViewInfo
Definition: Project.h:555
double sbarScale
Definition: ViewInfo.h:176
wxScrollBar * mHsbar
Definition: Project.h:653
void AudacityProject::OnScrollLeftButton (