1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 00:50:05 +02:00

Bug2303: Play after project open should start at saved cursor

This commit is contained in:
Paul Licameli 2020-02-25 14:54:58 -05:00
parent c886851edc
commit 5a2eaf9a52
2 changed files with 18 additions and 6 deletions

View File

@ -34,6 +34,17 @@ wxEvent *SelectedRegionEvent::Clone() const
return safenew SelectedRegionEvent{ *this }; return safenew SelectedRegionEvent{ *this };
} }
bool NotifyingSelectedRegion::HandleXMLAttribute
(const wxChar *attr, const wxChar *value,
const wxChar *legacyT0Name, const wxChar *legacyT1Name)
{
auto result = mRegion.HandleXMLAttribute(
attr, value, legacyT0Name, legacyT1Name );
if ( result )
Notify( true );
return result;
}
NotifyingSelectedRegion& NotifyingSelectedRegion::operator = NotifyingSelectedRegion& NotifyingSelectedRegion::operator =
( const SelectedRegion &other ) ( const SelectedRegion &other )
{ {
@ -128,10 +139,13 @@ bool NotifyingSelectedRegion::setF1(double f, bool maySwap)
return result; return result;
} }
void NotifyingSelectedRegion::Notify() void NotifyingSelectedRegion::Notify( bool delayed )
{ {
SelectedRegionEvent evt{ EVT_SELECTED_REGION_CHANGE, this }; SelectedRegionEvent evt{ EVT_SELECTED_REGION_CHANGE, this };
ProcessEvent( evt ); if ( delayed )
QueueEvent( evt.Clone() );
else
ProcessEvent( evt );
} }
static const AudacityProject::AttachedObjects::RegisteredFactory key{ static const AudacityProject::AttachedObjects::RegisteredFactory key{

View File

@ -59,9 +59,7 @@ public:
bool HandleXMLAttribute bool HandleXMLAttribute
(const wxChar *attr, const wxChar *value, (const wxChar *attr, const wxChar *value,
const wxChar *legacyT0Name, const wxChar *legacyT1Name) const wxChar *legacyT0Name, const wxChar *legacyT1Name);
{ return mRegion.HandleXMLAttribute(
attr, value, legacyT0Name, legacyT1Name ); }
// const-only access allows assignment from this into a SelectedRegion // const-only access allows assignment from this into a SelectedRegion
// or otherwise passing it into a function taking const SelectedRegion& // or otherwise passing it into a function taking const SelectedRegion&
@ -95,7 +93,7 @@ public:
bool setF1(double f, bool maySwap = true); bool setF1(double f, bool maySwap = true);
private: private:
void Notify(); void Notify( bool delayed = false );
SelectedRegion mRegion; SelectedRegion mRegion;
}; };