mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +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)),
|
mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
|
||||||
mSelectionFormat(gPrefs->Read(wxT("/SelectionFormat"), wxT(""))),
|
mSelectionFormat(gPrefs->Read(wxT("/SelectionFormat"), wxT(""))),
|
||||||
mDirty(false),
|
mDirty(false),
|
||||||
|
mRuler(NULL),
|
||||||
mTrackPanel(NULL),
|
mTrackPanel(NULL),
|
||||||
mTrackFactory(NULL),
|
mTrackFactory(NULL),
|
||||||
mAutoScrolling(false),
|
mAutoScrolling(false),
|
||||||
@ -1067,6 +1068,10 @@ void AudacityProject::UpdatePrefs()
|
|||||||
mToolManager->UpdatePrefs();
|
mToolManager->UpdatePrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mRuler) {
|
||||||
|
mRuler->RegenerateTooltips();
|
||||||
|
}
|
||||||
|
|
||||||
// The toolbars will be recreated, so make sure we don't leave
|
// The toolbars will be recreated, so make sure we don't leave
|
||||||
// a stale pointer hanging around.
|
// a stale pointer hanging around.
|
||||||
mLastFocusedWindow = NULL;
|
mLastFocusedWindow = NULL;
|
||||||
|
@ -62,6 +62,7 @@ array of Ruler::Label.
|
|||||||
#include <wx/dcbuffer.h>
|
#include <wx/dcbuffer.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
|
|
||||||
|
#include "../AudioIO.h"
|
||||||
#include "../Internat.h"
|
#include "../Internat.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "Ruler.h"
|
#include "Ruler.h"
|
||||||
@ -70,6 +71,7 @@ array of Ruler::Label.
|
|||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
#include "../TimeTrack.h"
|
#include "../TimeTrack.h"
|
||||||
|
#include <wx/tooltip.h>
|
||||||
|
|
||||||
#define max(a,b) ( (a<b)?b:a )
|
#define max(a,b) ( (a<b)?b:a )
|
||||||
|
|
||||||
@ -1632,6 +1634,18 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
|
|||||||
mInner.GetBottom() );
|
mInner.GetBottom() );
|
||||||
ruler.SetLabelEdges( false );
|
ruler.SetLabelEdges( false );
|
||||||
ruler.SetFormat( Ruler::TimeFormat );
|
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()
|
AdornedRulerPanel::~AdornedRulerPanel()
|
||||||
@ -1639,6 +1653,34 @@ AdornedRulerPanel::~AdornedRulerPanel()
|
|||||||
delete mBuffer;
|
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))
|
void AdornedRulerPanel::OnErase(wxEraseEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
// Ignore it to prevent flashing
|
// Ignore it to prevent flashing
|
||||||
@ -1723,11 +1765,9 @@ bool AdornedRulerPanel::IsWithinMarker(int mousePosX, double markerTime)
|
|||||||
|
|
||||||
void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
// Prevent accidentally stopping recording.
|
// Disable mouse actions on Timeline while recording.
|
||||||
if (GetActiveProject()->GetControlToolBar()->IsRecordDown()) {
|
if (mIsRecording)
|
||||||
SetCursor(wxCursor(wxCURSOR_DEFAULT));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
bool isWithinStart = IsWithinMarker(evt.GetX(), mPlayRegionStart);
|
bool isWithinStart = IsWithinMarker(evt.GetX(), mPlayRegionStart);
|
||||||
bool isWithinEnd = IsWithinMarker(evt.GetX(), mPlayRegionEnd);
|
bool isWithinEnd = IsWithinMarker(evt.GetX(), mPlayRegionEnd);
|
||||||
|
@ -268,7 +268,10 @@ public:
|
|||||||
void SetProject(AudacityProject* project) {mProject = project;};
|
void SetProject(AudacityProject* project) {mProject = project;};
|
||||||
void GetMaxSize(wxCoord *width, wxCoord *height);
|
void GetMaxSize(wxCoord *width, wxCoord *height);
|
||||||
|
|
||||||
|
void RegenerateTooltips();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnCapture(wxCommandEvent & evt);
|
||||||
void OnErase(wxEraseEvent &evt);
|
void OnErase(wxEraseEvent &evt);
|
||||||
void OnPaint(wxPaintEvent &evt);
|
void OnPaint(wxPaintEvent &evt);
|
||||||
void OnSize(wxSizeEvent &evt);
|
void OnSize(wxSizeEvent &evt);
|
||||||
@ -306,6 +309,8 @@ private:
|
|||||||
double mPlayRegionStart;
|
double mPlayRegionStart;
|
||||||
double mPlayRegionEnd;
|
double mPlayRegionEnd;
|
||||||
|
|
||||||
|
bool mIsRecording;
|
||||||
|
|
||||||
enum MouseEventState {
|
enum MouseEventState {
|
||||||
mesNone,
|
mesNone,
|
||||||
mesDraggingPlayRegionStart,
|
mesDraggingPlayRegionStart,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user