mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Better fix for bug 802.
This commit is contained in:
parent
82b2302921
commit
c8cabab88b
@ -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;
|
||||
|
@ -62,6 +62,7 @@ array of Ruler::Label.
|
||||
#include <wx/dcbuffer.h>
|
||||
#include <wx/settings.h>
|
||||
|
||||
#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 <wx/tooltip.h>
|
||||
|
||||
#define max(a,b) ( (a<b)?b:a )
|
||||
|
||||
@ -1632,6 +1634,18 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
|
||||
mInner.GetBottom() );
|
||||
ruler.SetLabelEdges( false );
|
||||
ruler.SetFormat( Ruler::TimeFormat );
|
||||
|
||||
mIsRecording = false;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
RegenerateTooltips();
|
||||
wxToolTip::Enable(true);
|
||||
#endif
|
||||
|
||||
wxTheApp->Connect(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);
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user