mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 14:50:06 +02:00
Bug 1401 - Wait for window visibility before starting timer
This commit is contained in:
parent
ebd767f81b
commit
43291687a5
@ -516,7 +516,8 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
|
|
||||||
mTimeCount = 0;
|
mTimeCount = 0;
|
||||||
mTimer.parent = this;
|
mTimer.parent = this;
|
||||||
mTimer.Start(kTimerInterval, FALSE);
|
// Timer is started after the window is visible
|
||||||
|
GetProject()->Bind(wxEVT_IDLE, &TrackPanel::OnIdle, this);
|
||||||
|
|
||||||
//Initialize a member variable pointing to the current
|
//Initialize a member variable pointing to the current
|
||||||
//drawing track.
|
//drawing track.
|
||||||
@ -904,6 +905,24 @@ AudacityProject * TrackPanel::GetProject() const
|
|||||||
return (AudacityProject*)pWind;
|
return (AudacityProject*)pWind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackPanel::OnIdle(wxIdleEvent& event)
|
||||||
|
{
|
||||||
|
// The window must be ready when the timer fires (#1401)
|
||||||
|
if (IsShownOnScreen())
|
||||||
|
{
|
||||||
|
mTimer.Start(kTimerInterval, FALSE);
|
||||||
|
|
||||||
|
// Timer is started, we don't need the event anymore
|
||||||
|
GetProject()->Unbind(wxEVT_IDLE, &TrackPanel::OnIdle, this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get another idle event, wx only guarantees we get one
|
||||||
|
// event after "some other normal events occur"
|
||||||
|
event.RequestMore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// AS: This gets called on our wx timer events.
|
/// AS: This gets called on our wx timer events.
|
||||||
void TrackPanel::OnTimer(wxTimerEvent& )
|
void TrackPanel::OnTimer(wxTimerEvent& )
|
||||||
{
|
{
|
||||||
|
@ -171,6 +171,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel {
|
|||||||
|
|
||||||
virtual double GetMostRecentXPos();
|
virtual double GetMostRecentXPos();
|
||||||
|
|
||||||
|
virtual void OnIdle(wxIdleEvent & event);
|
||||||
virtual void OnTimer(wxTimerEvent& event);
|
virtual void OnTimer(wxTimerEvent& event);
|
||||||
|
|
||||||
virtual int GetLeftOffset() const { return GetLabelWidth() + 1;}
|
virtual int GetLeftOffset() const { return GetLabelWidth() + 1;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user