diff --git a/src/Project.cpp b/src/Project.cpp index c1c6f4429..f916671ce 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -742,6 +742,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)), mSelectionFormat(gPrefs->Read(wxT("/SelectionFormat"), wxT(""))), mDirty(false), + mRuler(NULL), mTrackPanel(NULL), mTrackFactory(NULL), mAutoScrolling(false), @@ -1067,6 +1068,10 @@ void AudacityProject::UpdatePrefs() mToolManager->UpdatePrefs(); } + if (mRuler) { + mRuler->RegenerateTooltips(); + } + // The toolbars will be recreated, so make sure we don't leave // a stale pointer hanging around. mLastFocusedWindow = NULL; diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index fd7d1c835..b8b3911d2 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -62,6 +62,7 @@ array of Ruler::Label. #include #include +#include "../AudioIO.h" #include "../Internat.h" #include "../Project.h" #include "Ruler.h" @@ -70,6 +71,7 @@ array of Ruler::Label. #include "../AllThemeResources.h" #include "../Experimental.h" #include "../TimeTrack.h" +#include #define max(a,b) ( (aConnect(EVT_AUDIOIO_CAPTURE, + wxCommandEventHandler(AdornedRulerPanel::OnCapture), + NULL, + this); } AdornedRulerPanel::~AdornedRulerPanel() @@ -1639,6 +1653,34 @@ AdornedRulerPanel::~AdornedRulerPanel() delete mBuffer; } +void AdornedRulerPanel::RegenerateTooltips() +{ +#if wxUSE_TOOLTIPS + if (mIsRecording) + this->SetToolTip(_("Timeline actions disabled during recording")); + else + this->SetToolTip(_("Timeline - Quick Play enabled")); +#endif +} + +void AdornedRulerPanel::OnCapture(wxCommandEvent & evt) +{ + evt.Skip(); + + if (evt.GetInt() != 0) + { + // Set cursor immediately because OnMouseEvents is not called + // if recording is initiated by a modal window (Timer Record). + SetCursor(wxCursor(wxCURSOR_DEFAULT)); + mIsRecording = true; + } + else { + SetCursor(wxCursor(wxCURSOR_HAND)); + mIsRecording = false; + } + RegenerateTooltips(); +} + void AdornedRulerPanel::OnErase(wxEraseEvent & WXUNUSED(evt)) { // Ignore it to prevent flashing @@ -1723,11 +1765,9 @@ bool AdornedRulerPanel::IsWithinMarker(int mousePosX, double markerTime) void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) { - // Prevent accidentally stopping recording. - if (GetActiveProject()->GetControlToolBar()->IsRecordDown()) { - SetCursor(wxCursor(wxCURSOR_DEFAULT)); + // Disable mouse actions on Timeline while recording. + if (mIsRecording) return; - } bool isWithinStart = IsWithinMarker(evt.GetX(), mPlayRegionStart); bool isWithinEnd = IsWithinMarker(evt.GetX(), mPlayRegionEnd); diff --git a/src/widgets/Ruler.h b/src/widgets/Ruler.h index 10d59a6ba..49d87e02c 100644 --- a/src/widgets/Ruler.h +++ b/src/widgets/Ruler.h @@ -268,7 +268,10 @@ public: void SetProject(AudacityProject* project) {mProject = project;}; void GetMaxSize(wxCoord *width, wxCoord *height); + void RegenerateTooltips(); + private: + void OnCapture(wxCommandEvent & evt); void OnErase(wxEraseEvent &evt); void OnPaint(wxPaintEvent &evt); void OnSize(wxSizeEvent &evt); @@ -306,6 +309,8 @@ private: double mPlayRegionStart; double mPlayRegionEnd; + bool mIsRecording; + enum MouseEventState { mesNone, mesDraggingPlayRegionStart,