40#if wxUSE_ACCESSIBILITY
90 return( focusedTrack );
98#if wxUSE_ACCESSIBILITY
101 if( focusedTrack && !focusedTrack->GetSelected() )
103 NotifyEvent( wxACC_EVENT_OBJECT_SELECTIONREMOVE,
116 if (
auto pFocus = wFocus.lock())
122#if wxUSE_ACCESSIBILITY
127 NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
133 if( track->GetSelected() )
135 NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
143 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
181 if( t == target.get() )
198 return t->SharedPointer();
206#if wxUSE_ACCESSIBILITY
212 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
217 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
226#if wxUSE_ACCESSIBILITY
241 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
250#if wxUSE_ACCESSIBILITY
254wxAccStatus TrackPanelAx::GetChild(
int childId, wxAccessible** child )
256 if( childId == wxACC_SELF )
269wxAccStatus TrackPanelAx::GetChildCount(
int* childCount )
281wxAccStatus TrackPanelAx::GetDefaultAction(
int WXUNUSED(childId), wxString *actionName )
289wxAccStatus TrackPanelAx::GetDescription(
int WXUNUSED(childId), wxString *description )
291 description->clear();
297wxAccStatus TrackPanelAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText )
306wxAccStatus TrackPanelAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut )
315wxAccStatus TrackPanelAx::GetLocation( wxRect& rect,
int elementId )
319 if( elementId == wxACC_SELF )
340 rect.Inflate(dx, dx);
341 rect.SetPosition(
GetWindow()->ClientToScreen(rect.GetPosition()));
348wxAccStatus TrackPanelAx::GetName(
int childId, wxString*
name )
350#if defined(__WXMSW__) || defined(__WXMAC__)
353 if( childId == wxACC_SELF )
355 *
name =
_(
"TrackView" );
368 const auto trackNameLower = t->GetName().Lower();
372 if(trackNameLower.Find(wxString(
_(
"Label Track")).Lower()) == wxNOT_FOUND &&
376 name->Append(
wxT(
" ") + wxString(
_(
"Label Track")));
378 else if(
dynamic_cast<TimeTrack*
>(t.get()))
383 name->Append(
wxT(
" ") + wxString(
_(
"Time Track")));
386 else if(
dynamic_cast<NoteTrack*
>(t.get()))
389 name->Append(
wxT(
" ") + wxString(
_(
"Note Track")));
394 if( pt && pt->GetMute() )
404 name->Append(
wxT(
" ") + wxString(
_(
" Muted" )) );
407 if( pt && pt->GetSolo() )
411 name->Append(
wxT(
" ") + wxString(
_(
" Soloed" )) );
413 if( t->GetSelected() )
417 name->Append(
wxT(
" ") + wxString(
_(
" Selected" )) );
425 name->Append(
wxT(
" ") + wxString(
_(
" Sync Locked" )) );
437#if defined(__WXMAC__)
438 return wxACC_NOT_IMPLEMENTED;
443wxAccStatus TrackPanelAx::GetRole(
int childId, wxAccRole* role )
445#if defined(__WXMSW__)
448 if( childId == wxACC_SELF )
450 *role = wxROLE_SYSTEM_TABLE;
454 *role = wxROLE_SYSTEM_ROW;
463#if defined(__WXMAC__)
464 if( childId == wxACC_SELF )
466 *role = wxROLE_SYSTEM_PANE;
470 *role = wxROLE_SYSTEM_STATICTEXT;
485wxAccStatus TrackPanelAx::GetSelections( wxVariant * WXUNUSED(selections) )
487 return wxACC_NOT_IMPLEMENTED;
491wxAccStatus TrackPanelAx::GetState(
int childId,
long* state )
493#if defined(__WXMSW__)
498 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
503 *state |= wxACC_STATE_SYSTEM_FOCUSED;
508 *state |= wxACC_STATE_SYSTEM_SELECTED;
514 *state = wxACC_STATE_SYSTEM_FOCUSABLE + wxACC_STATE_SYSTEM_FOCUSED;
518#if defined(__WXMAC__)
519 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
529 *state |= wxACC_STATE_SYSTEM_FOCUSED;
532 if( t->GetSelected() )
534 *state |= wxACC_STATE_SYSTEM_SELECTED;
545#if defined(__WXMAC__)
546wxAccStatus TrackPanelAx::GetValue(
int childId, wxString* strValue )
548wxAccStatus TrackPanelAx::GetValue(
int WXUNUSED(childId), wxString* WXUNUSED(strValue) )
551#if defined(__WXMSW__)
552 return wxACC_NOT_IMPLEMENTED;
555#if defined(__WXMAC__)
556 if( childId == wxACC_SELF )
558 *strValue =
_(
"TrackView" );
571 strValue->Printf(
_(
"Track %d"), TrackNum(t));
572 strValue->Append(
" " + t->GetName());
576 if( pt && pt->GetMute() )
578 strValue->Append(
_(
" Mute On" ) );
581 if( pt && pt->GetSolo() )
583 strValue->Append(
_(
" Solo On" ) );
585 if( t->GetSelected() )
587 strValue->Append(
_(
" Select On" ) );
601#if defined(__WXMSW__)
619#if defined(__WXMAC__)
625 *childId =
TrackNum( focusedTrack );
629 *childId = wxACC_SELF;
635 return wxACC_NOT_IMPLEMENTED;
640wxAccStatus TrackPanelAx::Navigate(wxNavDir navDir,
int fromId,
int* toId, wxAccessible** toObject)
643 GetChildCount( &childCount );
645 if (fromId > childCount)
649 case wxNAVDIR_FIRSTCHILD:
650 if (fromId == wxACC_SELF && childCount > 0 )
656 case wxNAVDIR_LASTCHILD:
657 if (fromId == wxACC_SELF && childCount > 0 )
665 if (fromId != wxACC_SELF) {
667 if (*toId > childCount)
671 return wxACC_NOT_IMPLEMENTED;
674 case wxNAVDIR_PREVIOUS:
676 if (fromId != wxACC_SELF) {
682 return wxACC_NOT_IMPLEMENTED;
687 if (fromId != wxACC_SELF)
690 return wxACC_NOT_IMPLEMENTED;
699wxAccStatus TrackPanelAx::Select(
int childId, wxAccSelectionFlags selectFlags)
702 if (selectFlags != wxACC_SEL_TAKEFOCUS)
703 return wxACC_NOT_IMPLEMENTED;
705 if (childId != wxACC_SELF) {
707 GetChildCount( &childCount );
708 if (childId > childCount)
718 return wxACC_NOT_IMPLEMENTED;
727 return std::make_shared< TrackFocus >( parent );
742 : mProject{ project }
753 return mAx->GetFocus().get();
768 return mAx->IsFocused( pTrack );
774 std::unique_ptr< TrackPanelAx > pAx
777#if wxUSE_ACCESSIBILITY
779 owner.SetAccessible(
mAx = pAx.release());
782 mAx = std::move(pAx);
789 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.
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
std::shared_ptr< Track > FindTrack(TrackPanelCell *pCell)