43#if wxUSE_ACCESSIBILITY
93 return( focusedTrack );
101#if wxUSE_ACCESSIBILITY
104 if( focusedTrack && !focusedTrack->GetSelected() )
106 NotifyEvent( wxACC_EVENT_OBJECT_SELECTIONREMOVE,
119 if (
auto pFocus = wFocus.lock())
125#if wxUSE_ACCESSIBILITY
128 if (
GetWindow() == wxWindow::FindFocus())
130 NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
136 if( track->GetSelected() )
138 NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
146 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
184 if( t == target.get() )
201 return t->SharedPointer();
209#if wxUSE_ACCESSIBILITY
215 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
220 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
229#if wxUSE_ACCESSIBILITY
230 if (
GetWindow() == wxWindow::FindFocus())
244 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
253#if wxUSE_ACCESSIBILITY
257wxAccStatus TrackPanelAx::GetChild(
int childId, wxAccessible** child )
259 if( childId == wxACC_SELF )
272wxAccStatus TrackPanelAx::GetChildCount(
int* childCount )
284wxAccStatus TrackPanelAx::GetDefaultAction(
int WXUNUSED(childId), wxString *actionName )
292wxAccStatus TrackPanelAx::GetDescription(
int WXUNUSED(childId), wxString *description )
294 description->clear();
300wxAccStatus TrackPanelAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText )
309wxAccStatus TrackPanelAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut )
318wxAccStatus TrackPanelAx::GetLocation( wxRect& rect,
int elementId )
322 if( elementId == wxACC_SELF )
343 rect.Inflate(dx, dx);
346 rect.SetPosition(
GetWindow()->GetParent()->ClientToScreen( rect.GetPosition() ) );
352wxAccStatus TrackPanelAx::GetName(
int childId, wxString*
name )
354#if defined(__WXMSW__) || defined(__WXMAC__)
357 if( childId == wxACC_SELF )
359 *
name =
_(
"TrackView" );
372 const auto trackNameLower = t->GetName().Lower();
376 if(trackNameLower.Find(wxString(
_(
"Label Track")).Lower()) == wxNOT_FOUND &&
380 name->Append( wxT(
" ") + wxString(
_(
"Label Track")));
382 else if(
dynamic_cast<TimeTrack*
>(t.get()))
387 name->Append(wxT(
" ") + wxString(
_(
"Time Track")));
390 else if(
dynamic_cast<NoteTrack*
>(t.get()))
393 name->Append( wxT(
" ") + wxString(
_(
"Note Track")));
398 if( pt && pt->GetMute() )
408 name->Append( wxT(
" ") + wxString(
_(
" Muted" )) );
411 if( pt && pt->GetSolo() )
415 name->Append( wxT(
" ") + wxString(
_(
" Soloed" )) );
417 if( t->GetSelected() )
421 name->Append( wxT(
" ") + wxString(
_(
" Selected" )) );
429 name->Append( wxT(
" ") + wxString(
_(
" Sync Locked" )) );
441#if defined(__WXMAC__)
442 return wxACC_NOT_IMPLEMENTED;
447wxAccStatus TrackPanelAx::GetRole(
int childId, wxAccRole* role )
449#if defined(__WXMSW__)
452 if( childId == wxACC_SELF )
454 *role = wxROLE_SYSTEM_TABLE;
458 *role = wxROLE_SYSTEM_ROW;
467#if defined(__WXMAC__)
468 if( childId == wxACC_SELF )
470 *role = wxROLE_SYSTEM_PANE;
474 *role = wxROLE_SYSTEM_STATICTEXT;
489wxAccStatus TrackPanelAx::GetSelections( wxVariant * WXUNUSED(selections) )
491 return wxACC_NOT_IMPLEMENTED;
495wxAccStatus TrackPanelAx::GetState(
int childId,
long* state )
497#if defined(__WXMSW__)
502 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
507 *state |= wxACC_STATE_SYSTEM_FOCUSED;
512 *state |= wxACC_STATE_SYSTEM_SELECTED;
518 *state = wxACC_STATE_SYSTEM_FOCUSABLE + wxACC_STATE_SYSTEM_FOCUSED;
522#if defined(__WXMAC__)
523 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
533 *state |= wxACC_STATE_SYSTEM_FOCUSED;
536 if( t->GetSelected() )
538 *state |= wxACC_STATE_SYSTEM_SELECTED;
549#if defined(__WXMAC__)
550wxAccStatus TrackPanelAx::GetValue(
int childId, wxString* strValue )
552wxAccStatus TrackPanelAx::GetValue(
int WXUNUSED(childId), wxString* WXUNUSED(strValue) )
555#if defined(__WXMSW__)
556 return wxACC_NOT_IMPLEMENTED;
559#if defined(__WXMAC__)
560 if( childId == wxACC_SELF )
562 *strValue =
_(
"TrackView" );
575 strValue->Printf(
_(
"Track %d"), TrackNum(t));
576 strValue->Append(
" " + t->GetName());
580 if( pt && pt->GetMute() )
582 strValue->Append(
_(
" Mute On" ) );
585 if( pt && pt->GetSolo() )
587 strValue->Append(
_(
" Solo On" ) );
589 if( t->GetSelected() )
591 strValue->Append(
_(
" Select On" ) );
605#if defined(__WXMSW__)
607 if (
GetWindow() == wxWindow::FindFocus())
623#if defined(__WXMAC__)
624 if(
GetWindow() == wxWindow::FindFocus() )
629 *childId =
TrackNum( focusedTrack );
633 *childId = wxACC_SELF;
639 return wxACC_NOT_IMPLEMENTED;
644wxAccStatus TrackPanelAx::Navigate(wxNavDir navDir,
int fromId,
int* toId, wxAccessible** toObject)
647 GetChildCount( &childCount );
649 if (fromId > childCount)
653 case wxNAVDIR_FIRSTCHILD:
654 if (fromId == wxACC_SELF && childCount > 0 )
660 case wxNAVDIR_LASTCHILD:
661 if (fromId == wxACC_SELF && childCount > 0 )
669 if (fromId != wxACC_SELF) {
671 if (*toId > childCount)
675 return wxACC_NOT_IMPLEMENTED;
678 case wxNAVDIR_PREVIOUS:
680 if (fromId != wxACC_SELF) {
686 return wxACC_NOT_IMPLEMENTED;
691 if (fromId != wxACC_SELF)
694 return wxACC_NOT_IMPLEMENTED;
703wxAccStatus TrackPanelAx::Select(
int childId, wxAccSelectionFlags selectFlags)
706 if (selectFlags != wxACC_SEL_TAKEFOCUS)
707 return wxACC_NOT_IMPLEMENTED;
709 if (childId != wxACC_SELF) {
711 GetChildCount( &childCount );
712 if (childId > childCount)
722 return wxACC_NOT_IMPLEMENTED;
731 return std::make_shared< TrackFocus >( parent );
746 : mProject{ project }
757 return mAx->GetFocus().get();
772 return mAx->IsFocused( pTrack );
778 std::unique_ptr< TrackPanelAx > pAx
781#if wxUSE_ACCESSIBILITY
783 owner.SetAccessible(
mAx = pAx.release());
786 mAx = std::move(pAx);
793 mAx->MessageForScreenReader( message );
Toolkit-neutral facade for basic user interface services.
const TranslatableString name
declares abstract base class Track, TrackList, and iterators over TrackList
static const AudacityProject::AttachedObjects::RegisteredFactory key
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
A LabelTrack is a Track that holds labels (LabelStruct).
static wxString GetDefaultName()
A Track that is used for Midi notes. (Somewhat old code).
AudioTrack subclass that can also be audibly replayed by the program.
static bool IsSyncLockSelected(const Track *pTrack)
A kind of Track used to 'warp time'.
static wxString GetDefaultName()
void UpdateAccessibility()
void SetAccessible(wxWindow &owner, std::unique_ptr< TrackPanelAx > pAccessible)
void MessageForScreenReader(const TranslatableString &message)
TrackFocus(AudacityProject &project)
std::unique_ptr< TrackPanelAx > mAx
bool IsFocused(const Track *pTrack)
AudacityProject & mProject
Abstract base class for an object holding data associated with points on a time axis.
void EnsureVisible(bool modifyState=false)
std::shared_ptr< Subclass > SharedPointer()
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
auto Leaders() -> TrackIterRange< TrackType >
static TrackList & Get(AudacityProject &project)
Track * FindById(TrackId id)
TrackIter< Track > FindLeader(Track *pTrack)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
TrackPanelAx(AudacityProject &project)
std::weak_ptr< Track > mFocusedTrack
void MessageForScreenReader(const TranslatableString &message)
std::shared_ptr< Track > GetFocus()
AudacityProject & mProject
int TrackNum(const std::shared_ptr< Track > &track)
std::shared_ptr< Track > SetFocus(std::shared_ptr< Track > track={})
bool IsFocused(const Track *track)
std::shared_ptr< Track > FindTrack(int num)
wxWindow * GetWindow() const
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
std::shared_ptr< Track > FindTrack(TrackPanelCell *pCell)