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 &)=delete
 
Handleroperator= (const Handler &)=delete
 
- 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 296 of file NavigationMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

NavigationActions::Handler::Handler ( )
inline

Definition at line 534 of file NavigationMenus.cpp.

535{
536 UpdatePrefs();
537}

References UpdatePrefs().

Here is the call graph for this function:

◆ Handler() [2/2]

NavigationActions::Handler::Handler ( const Handler )
delete

Member Function Documentation

◆ OnCursorDown()

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

Definition at line 445 of file NavigationMenus.cpp.

446{
447 auto &project = context.project;
449}
const auto project
AudacityProject & project
void DoNextTrack(AudacityProject &project, bool shift, bool circularTrackNavigation)

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

Here is the call graph for this function:

◆ OnCursorUp()

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

Definition at line 439 of file NavigationMenus.cpp.

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

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

Here is the call graph for this function:

◆ OnFirstTrack()

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

Definition at line 451 of file NavigationMenus.cpp.

452{
453 auto &project = context.project;
454 auto &projectHistory = ProjectHistory::Get(project);
455 auto &trackFocus = TrackFocus::Get( project );
456 auto &tracks = TrackList::Get( project );
457 auto &viewport = Viewport::Get(project);
458
459 auto t = trackFocus.Get();
460 if (!t)
461 return;
462
463 auto f = *tracks.begin();
464 if (t != f)
465 trackFocus.Set(f);
466 if (f) {
467 viewport.ShowTrack(*f);
468 if (t != f)
469 projectHistory.ModifyState(false);
470 }
471}
const auto tracks
static ProjectHistory & Get(AudacityProject &project)
Track * Get()
Definition: TrackFocus.cpp:156
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33

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

Here is the call graph for this function:

◆ OnLastTrack()

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

Definition at line 473 of file NavigationMenus.cpp.

474{
475 auto &project = context.project;
476 auto &projectHistory = ProjectHistory::Get(project);
477 auto &trackFocus = TrackFocus::Get( project );
478 auto &tracks = TrackList::Get( project );
479 auto &viewport = Viewport::Get(project);
480
481 Track *t = trackFocus.Get();
482 if (!t)
483 return;
484
485 auto l = *tracks.rbegin();
486 if (t != l)
487 trackFocus.Set(l);
488 if (l) {
489 viewport.ShowTrack(*l);
490 if (t != l)
491 projectHistory.ModifyState(false);
492 }
493}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:318
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110

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

Here is the call graph for this function:

◆ OnNextFrame()

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

Definition at line 430 of file NavigationMenus.cpp.

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

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

Here is the call graph for this function:

◆ OnNextWindow()

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

Definition at line 361 of file NavigationMenus.cpp.

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

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

Here is the call graph for this function:

◆ OnPrevFrame()

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

Definition at line 424 of file NavigationMenus.cpp.

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

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

Here is the call graph for this function:

◆ OnPrevWindow()

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

Definition at line 302 of file NavigationMenus.cpp.

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

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

Here is the call graph for this function:

◆ OnShiftDown()

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

Definition at line 501 of file NavigationMenus.cpp.

502{
503 auto &project = context.project;
505}

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

Here is the call graph for this function:

◆ OnShiftUp()

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

Definition at line 495 of file NavigationMenus.cpp.

496{
497 auto &project = context.project;
499}

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

Here is the call graph for this function:

◆ OnToggle()

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

Definition at line 507 of file NavigationMenus.cpp.

508{
509 auto &project = context.project;
510 auto &projectHistory = ProjectHistory::Get(project);
511 auto &trackFocus = TrackFocus::Get(project);
512 auto &selectionState = SelectionState::Get(project);
513 auto &viewport = Viewport::Get(project);
514
515 Track *t;
516
517 t = trackFocus.Get(); // Get currently focused track
518 if (!t)
519 return;
520 selectionState.SelectTrack(*t, !t->GetSelected(), true);
521 viewport.ShowTrack(*t);
522 projectHistory.ModifyState(false);
523
524 trackFocus.UpdateAccessibility();
525
526 return;
527}
static SelectionState & Get(AudacityProject &project)
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Definition: Track.cpp:78

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

Here is the call graph for this function:

◆ operator=()

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

◆ UpdatePrefs()

void NavigationActions::Handler::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 529 of file NavigationMenus.cpp.

530{
532 gPrefs->ReadBool(wxT("/GUI/CircularTrackNavigation"), false);
533}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
bool ReadBool(const wxString &key, bool defaultValue) const

References gPrefs, mCircularTrackNavigation, audacity::BasicSettings::ReadBool(), 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 437 of file NavigationMenus.cpp.

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


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