Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
NavigationActions::Handler Struct Reference
Inheritance diagram for NavigationActions::Handler:
[legend]
Collaboration diagram for NavigationActions::Handler:
[legend]

Public Member Functions

void OnPrevWindow (const CommandContext &context)
 
void OnNextWindow (const CommandContext &context)
 
void OnPrevFrame (const CommandContext &context)
 
void OnNextFrame (const CommandContext &context)
 
void OnCursorUp (const CommandContext &context)
 
void OnCursorDown (const CommandContext &context)
 
void OnFirstTrack (const CommandContext &context)
 
void OnLastTrack (const CommandContext &context)
 
void OnShiftUp (const CommandContext &context)
 
void OnShiftDown (const CommandContext &context)
 
void OnToggle (const CommandContext &context)
 
void UpdatePrefs () override
 
 Handler ()
 
 Handler (const Handler &) PROHIBITED
 
Handleroperator= (const Handler &) PROHIBITED
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Public Attributes

bool mCircularTrackNavigation {}
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

Definition at line 295 of file NavigationMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

NavigationActions::Handler::Handler ( )
inline

Definition at line 522 of file NavigationMenus.cpp.

523{
524 UpdatePrefs();
525}

References UpdatePrefs().

Here is the call graph for this function:

◆ Handler() [2/2]

NavigationActions::Handler::Handler ( const Handler )

Member Function Documentation

◆ OnCursorDown()

void NavigationActions::Handler::OnCursorDown ( const CommandContext context)
inline

Definition at line 444 of file NavigationMenus.cpp.

445{
446 auto &project = context.project;
447 DoNextTrack( project, false, mCircularTrackNavigation );
448}
AudacityProject & project
void DoNextTrack(AudacityProject &project, bool shift, bool circularTrackNavigation)

References anonymous_namespace{NavigationMenus.cpp}::DoNextTrack(), mCircularTrackNavigation, and CommandContext::project.

Here is the call graph for this function:

◆ OnCursorUp()

void NavigationActions::Handler::OnCursorUp ( const CommandContext context)
inline

Definition at line 438 of file NavigationMenus.cpp.

439{
440 auto &project = context.project;
441 DoPrevTrack( project, false, mCircularTrackNavigation );
442}
void DoPrevTrack(AudacityProject &project, bool shift, bool circularTrackNavigation)

References anonymous_namespace{NavigationMenus.cpp}::DoPrevTrack(), mCircularTrackNavigation, and CommandContext::project.

Here is the call graph for this function:

◆ OnFirstTrack()

void NavigationActions::Handler::OnFirstTrack ( const CommandContext context)
inline

Definition at line 450 of file NavigationMenus.cpp.

451{
452 auto &project = context.project;
453 auto &trackFocus = TrackFocus::Get( project );
454 auto &tracks = TrackList::Get( project );
455
456 auto t = trackFocus.Get();
457 if (!t)
458 return;
459
460 auto f = *tracks.Any().begin();
461 if (t != f)
462 trackFocus.Set(f);
463 if (f)
464 f->EnsureVisible( t != f );
465}
Track * Get()
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:385

References TrackFocus::Get(), TrackList::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnLastTrack()

void NavigationActions::Handler::OnLastTrack ( const CommandContext context)
inline

Definition at line 467 of file NavigationMenus.cpp.

468{
469 auto &project = context.project;
470 auto &trackFocus = TrackFocus::Get( project );
471 auto &tracks = TrackList::Get( project );
472
473 Track *t = trackFocus.Get();
474 if (!t)
475 return;
476
477 auto l = *tracks.Any().rbegin();
478 if (t != l)
479 trackFocus.Set(l);
480 if (l)
481 l->EnsureVisible( t != l );
482}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:162

References TrackFocus::Get(), TrackList::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnNextFrame()

void NavigationActions::Handler::OnNextFrame ( const CommandContext context)
inline

Definition at line 429 of file NavigationMenus.cpp.

430{
431 auto &project = context.project;
432 NextOrPrevFrame(project, true);
433}
void NextOrPrevFrame(AudacityProject &project, bool forward)

References anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), and CommandContext::project.

Here is the call graph for this function:

◆ OnNextWindow()

void NavigationActions::Handler::OnNextWindow ( const CommandContext context)
inline

Definition at line 360 of file NavigationMenus.cpp.

361{
362 auto &project = context.project;
363 auto &window = GetProjectFrame( project );
364 auto isEnabled = window.IsEnabled();
365
366 wxWindow *w = wxGetTopLevelParent(wxWindow::FindFocus());
367 const auto & list = window.GetChildren();
368 auto iter = list.begin(), end = list.end();
369
370 // If the project window has the current focus, start the search with the
371 // first child
372 if (w == &window)
373 {
374 }
375 // Otherwise start the search with the current window's next sibling
376 else
377 {
378 // Find the window in this projects children. If the window with the
379 // focus isn't a child of this project (like when a dialog is created
380 // without specifying a parent), then we'll get back NULL here.
381 while (iter != end && *iter != w)
382 ++iter;
383 if (iter != end)
384 ++iter;
385 }
386
387 // Search for the next toplevel window
388 for (; iter != end; ++iter)
389 {
390 // If it's a toplevel, visible (we have hidden windows) and is enabled,
391 // then we're done. The IsEnabled() prevents us from moving away from
392 // a modal dialog because all other toplevel windows will be disabled.
393 w = *iter;
394 if (w->IsTopLevel() && w->IsShown() && w->IsEnabled())
395 {
396 break;
397 }
398 }
399
400 // Ran out of siblings, so make the current project active
401 if ((iter == end) && isEnabled)
402 {
403 w = &window;
404 }
405
406 // And make sure it's on top (only for floating windows...project window will
407 // not raise)
408 // (Really only works on Windows)
409 w->Raise();
410
411
412#if defined(__WXMAC__) || defined(__WXGTK__)
413 // bug 868
414 // Simulate a TAB key press before continuing, else the cycle of
415 // navigation among top level windows stops because the keystrokes don't
416 // go to the CommandManager.
417 if (dynamic_cast<wxDialog*>(w)) {
418 w->SetFocus();
419 }
420#endif
421}
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
Definition: BasicUI.h:343
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References PackedArray::end(), BasicUI::FindFocus(), GetProjectFrame(), and CommandContext::project.

Here is the call graph for this function:

◆ OnPrevFrame()

void NavigationActions::Handler::OnPrevFrame ( const CommandContext context)
inline

Definition at line 423 of file NavigationMenus.cpp.

424{
425 auto &project = context.project;
426 NextOrPrevFrame(project, false);
427}

References anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), and CommandContext::project.

Here is the call graph for this function:

◆ OnPrevWindow()

void NavigationActions::Handler::OnPrevWindow ( const CommandContext context)
inline

Definition at line 301 of file NavigationMenus.cpp.

302{
303 auto &project = context.project;
304 auto &window = GetProjectFrame( project );
305 auto isEnabled = window.IsEnabled();
306
307 wxWindow *w = wxGetTopLevelParent(wxWindow::FindFocus());
308 const auto & list = window.GetChildren();
309 auto iter = list.rbegin(), end = list.rend();
310
311 // If the project window has the current focus, start the search with the
312 // last child
313 if (w == &window)
314 {
315 }
316 // Otherwise start the search with the current window's previous sibling
317 else
318 {
319 while (iter != end && *iter != w)
320 ++iter;
321 if (iter != end)
322 ++iter;
323 }
324
325 // Search for the previous toplevel window
326 for (; iter != end; ++iter)
327 {
328 // If it's a toplevel and is visible (we have come hidden windows), then
329 // we're done
330 w = *iter;
331 if (w->IsTopLevel() && w->IsShown() && isEnabled)
332 {
333 break;
334 }
335 }
336
337 // Ran out of siblings, so make the current project active
338 if ((iter == end) && isEnabled)
339 {
340 w = &window;
341 }
342
343 // And make sure it's on top (only for floating windows...project window will
344 // not raise)
345 // (Really only works on Windows)
346 w->Raise();
347
348
349#if defined(__WXMAC__) || defined(__WXGTK__)
350 // bug 868
351 // Simulate a TAB key press before continuing, else the cycle of
352 // navigation among top level windows stops because the keystrokes don't
353 // go to the CommandManager.
354 if (dynamic_cast<wxDialog*>(w)) {
355 w->SetFocus();
356 }
357#endif
358}

References PackedArray::end(), BasicUI::FindFocus(), GetProjectFrame(), and CommandContext::project.

Here is the call graph for this function:

◆ OnShiftDown()

void NavigationActions::Handler::OnShiftDown ( const CommandContext context)
inline

Definition at line 490 of file NavigationMenus.cpp.

491{
492 auto &project = context.project;
493 DoNextTrack( project, true, mCircularTrackNavigation );
494}

References anonymous_namespace{NavigationMenus.cpp}::DoNextTrack(), mCircularTrackNavigation, and CommandContext::project.

Here is the call graph for this function:

◆ OnShiftUp()

void NavigationActions::Handler::OnShiftUp ( const CommandContext context)
inline

Definition at line 484 of file NavigationMenus.cpp.

485{
486 auto &project = context.project;
487 DoPrevTrack( project, true, mCircularTrackNavigation );
488}

References anonymous_namespace{NavigationMenus.cpp}::DoPrevTrack(), mCircularTrackNavigation, and CommandContext::project.

Here is the call graph for this function:

◆ OnToggle()

void NavigationActions::Handler::OnToggle ( const CommandContext context)
inline

Definition at line 496 of file NavigationMenus.cpp.

497{
498 auto &project = context.project;
499 auto &trackFocus = TrackFocus::Get( project );
500 auto &selectionState = SelectionState::Get( project );
501
502 Track *t;
503
504 t = trackFocus.Get(); // Get currently focused track
505 if (!t)
506 return;
507
508 selectionState.SelectTrack
509 ( *t, !t->GetSelected(), true );
510 t->EnsureVisible( true );
511
512 trackFocus.UpdateAccessibility();
513
514 return;
515}
static SelectionState & Get(AudacityProject &project)
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Definition: Track.cpp:82
void EnsureVisible(bool modifyState=false)
Definition: Track.cpp:98

References Track::EnsureVisible(), TrackFocus::Get(), SelectionState::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), Track::GetSelected(), and CommandContext::project.

Here is the call graph for this function:

◆ operator=()

Handler & NavigationActions::Handler::operator= ( const Handler )

◆ UpdatePrefs()

void NavigationActions::Handler::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 517 of file NavigationMenus.cpp.

518{
520 gPrefs->ReadBool(wxT("/GUI/CircularTrackNavigation"), false);
521}
wxT("CloseDown"))
FileConfig * gPrefs
Definition: Prefs.cpp:70

References gPrefs, mCircularTrackNavigation, and wxT().

Referenced by Handler().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mCircularTrackNavigation

bool NavigationActions::Handler::mCircularTrackNavigation {}

Definition at line 436 of file NavigationMenus.cpp.

Referenced by OnCursorDown(), OnCursorUp(), OnShiftDown(), OnShiftUp(), and UpdatePrefs().


The documentation for this struct was generated from the following file: