Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KeyConfigPrefs Class Referencefinal

A PrefsPanel for keybindings. More...

#include <KeyConfigPrefs.h>

Inheritance diagram for KeyConfigPrefs:
[legend]
Collaboration diagram for KeyConfigPrefs:
[legend]

Public Member Functions

 KeyConfigPrefs (wxWindow *parent, wxWindowID winid, AudacityProject *pProject, const CommandID &name)
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
bool Commit () override
 
void Cancel () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual PluginPath GetPath ()
 
virtual VendorSymbol GetVendor ()
 
virtual wxString GetVersion ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void Populate ()
 
void RefreshBindings (bool bSort)
 
void RefreshKeyInfo ()
 
void ClearAllKeys ()
 
bool ContainsIllegalDups (TranslatableString &fMatching, TranslatableString &sMatching) const
 
TranslatableString MergeWithExistingKeys (const std::vector< NormalizedKeyString > &toAdd)
 
void FilterKeys (std::vector< NormalizedKeyString > &arr)
 
CommandID NameFromKey (const NormalizedKeyString &key)
 
void SetKeyForSelected (const NormalizedKeyString &key)
 
void OnShow (wxShowEvent &e)
 
void OnViewBy (wxCommandEvent &e)
 
void OnDefaults (wxCommandEvent &e)
 
void OnImportDefaults (wxCommandEvent &e)
 
void OnImport (wxCommandEvent &e)
 
void OnExport (wxCommandEvent &e)
 
void OnSet (wxCommandEvent &e)
 
void OnClear (wxCommandEvent &e)
 
void OnSelected (wxCommandEvent &e)
 
void OnHotkeyKeyDown (wxKeyEvent &e)
 
void OnHotkeyChar (wxEvent &e)
 
void OnHotkeyKillFocus (wxEvent &e)
 
void OnHotkeyContext (wxEvent &e)
 
void OnFilterTimer (wxTimerEvent &e)
 
void OnFilterKeyDown (wxKeyEvent &e)
 
void OnFilterChar (wxEvent &e)
 

Private Attributes

KeyViewmView
 
wxTextCtrl * mKey
 
wxButton * mSet
 
wxButton * mClear
 
wxTextCtrl * mFilter
 
wxStaticText * mFilterLabel
 
wxTimer mFilterTimer
 
bool mFilterPending
 
ViewByType mViewType
 
wxRadioButton * mViewByTree
 
wxRadioButton * mViewByName
 
wxRadioButton * mViewByKey
 
AudacityProjectmProject {}
 
CommandManagermManager
 
int mCommandSelected
 
CommandIDs mNames
 
std::vector< NormalizedKeyStringmDefaultKeys
 
std::vector< NormalizedKeyStringmStandardDefaultKeys
 
std::vector< NormalizedKeyStringmKeys
 
std::vector< NormalizedKeyStringmNewKeys
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel for keybindings.

The code for displaying keybindings is similar to code in MousePrefs. It would be nice to create a NEW 'Bindings' class which both KeyConfigPrefs and MousePrefs use.

Definition at line 32 of file KeyConfigPrefs.h.

Constructor & Destructor Documentation

◆ KeyConfigPrefs()

KeyConfigPrefs::KeyConfigPrefs ( wxWindow *  parent,
wxWindowID  winid,
AudacityProject pProject,
const CommandID name 
)

Definition at line 90 of file KeyConfigPrefs.cpp.

94 : PrefsPanel(parent, winid, XO("Keyboard")),
95  mView(NULL),
96  mKey(NULL),
97  mFilter(NULL),
99  mFilterPending(false)
100  , mProject{ pProject }
101 {
102  Populate();
103  if (!name.empty()) {
104  auto index = mView->GetIndexByName(name);
105  mView->SelectNode(index);
106  }
107 
108  // See bug #2315 for discussion. This should be reviewed
109  // and (possibly) removed after wx3.1.3.
110  Bind(wxEVT_SHOW, &KeyConfigPrefs::OnShow, this);
111 }

Member Function Documentation

◆ Cancel()

void KeyConfigPrefs::Cancel ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 929 of file KeyConfigPrefs.cpp.

930 {
931  // Restore original key values
932  for (size_t i = 0; i < mNames.size(); i++) {
934  }
935 
936  return;
937 }

References mKeys, mManager, mNames, and CommandManager::SetKeyFromIndex().

Here is the call graph for this function:

◆ ClearAllKeys()

void KeyConfigPrefs::ClearAllKeys ( )
private

Definition at line 371 of file KeyConfigPrefs.cpp.

372 {
373  const NormalizedKeyString noKey{ NO_SHORTCUT };
374  for (const auto & command : mNames)
375  mManager->SetKeyFromName(command, noKey);
376 }

References mManager, mNames, NO_SHORTCUT, and CommandManager::SetKeyFromName().

Referenced by OnImport().

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

◆ Commit()

bool KeyConfigPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 890 of file KeyConfigPrefs.cpp.

891 {
892  // On the Mac, preferences may be changed without any active
893  // projects. This means that the CommandManager isn't available
894  // either. So we can't attempt to save preferences, otherwise
895  // NULL ptr dereferences will happen in ShuttleGui because the
896  // radio buttons are never created. (See Populate() above.)
897  if ( !mProject ) {
898  return true;
899  }
900 
901  ShuttleGui S(this, eIsSavingToPrefs);
903 
904  bool bFull = gPrefs->ReadBool(wxT("/GUI/Shortcuts/FullDefaults"), false);
905  for (size_t i = 0; i < mNames.size(); i++) {
906  const auto &dkey = bFull ? mDefaultKeys[i] : mStandardDefaultKeys[i];
907  // using GET to interpret CommandID as a config path component
908  auto name = wxT("/NewKeys/") + mNames[i].GET();
909  const auto &key = mNewKeys[i];
910 
911  if (gPrefs->HasEntry(name)) {
912  if (key != NormalizedKeyString{ gPrefs->ReadObject(name, key) } ) {
913  gPrefs->Write(name, key);
914  }
915  if (key == dkey) {
917  }
918  }
919  else {
920  if (key != dkey) {
921  gPrefs->Write(name, key);
922  }
923  }
924  }
925 
926  return gPrefs->Flush();
927 }

References FileConfig::DeleteEntry(), eIsSavingToPrefs, FileConfig::Flush(), gPrefs, FileConfig::HasEntry(), key, mDefaultKeys, mNames, mNewKeys, mProject, mStandardDefaultKeys, name, and PopulateOrExchange().

Here is the call graph for this function:

◆ ContainsIllegalDups()

bool KeyConfigPrefs::ContainsIllegalDups ( TranslatableString fMatching,
TranslatableString sMatching 
) const
private

Definition at line 383 of file KeyConfigPrefs.cpp.

385 {
386  using IndexesArray = std::vector<int>;
387  std::unordered_map<NormalizedKeyString, IndexesArray> seen;
388 
389  for (size_t i{ 0 }; i < mKeys.size(); i++)
390  {
391  if (mKeys[i] == EMPTY_SHORTCUT || mKeys[i] == NO_SHORTCUT)
392  continue;
393 
394  if (seen.count(mKeys[i]) == 0)
395  seen.insert({ mKeys[i], {(int)i} });
396  else
397  {
398  IndexesArray checkMe{ seen.at(mKeys[i]) };
399  for (int index : checkMe)
400  {
401  if (mDefaultKeys[i] == EMPTY_SHORTCUT ||
402  mDefaultKeys[i] != mDefaultKeys[index])
403  {
404  fMatching = mManager->GetPrefixedLabelFromName(mNames[i]);
405  sMatching = mManager->GetPrefixedLabelFromName(mNames[index]);
406  return true;
407  }
408  else
409  seen.at(mKeys[i]).push_back(index);
410  }
411  }
412  }
413  return false;
414 }

References EMPTY_SHORTCUT, CommandManager::GetPrefixedLabelFromName(), mDefaultKeys, mKeys, mManager, mNames, and NO_SHORTCUT.

Referenced by OnImport().

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

◆ FilterKeys()

void KeyConfigPrefs::FilterKeys ( std::vector< NormalizedKeyString > &  arr)
private

Definition at line 606 of file KeyConfigPrefs.cpp.

607 {
608  const auto &MaxListOnly = CommandManager::ExcludedList();
609 
610  // Remove items that are in MaxList.
611  for (size_t i = 0; i < arr.size(); i++) {
612  if( std::binary_search(MaxListOnly.begin(), MaxListOnly.end(), arr[i]) )
613  arr[i] = {};
614  }
615 }

References CommandManager::ExcludedList().

Referenced by OnImportDefaults(), and RefreshBindings().

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

◆ GetDescription()

TranslatableString KeyConfigPrefs::GetDescription ( )
overridevirtual

Implements ComponentInterface.

Definition at line 118 of file KeyConfigPrefs.cpp.

119 {
120  return XO("Preferences for KeyConfig");
121 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol KeyConfigPrefs::GetSymbol ( )
overridevirtual

Implements ComponentInterface.

Definition at line 113 of file KeyConfigPrefs.cpp.

114 {
116 }

References KEY_CONFIG_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID KeyConfigPrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 123 of file KeyConfigPrefs.cpp.

124 {
125  return "Keyboard_Preferences";
126 }

◆ MergeWithExistingKeys()

TranslatableString KeyConfigPrefs::MergeWithExistingKeys ( const std::vector< NormalizedKeyString > &  toAdd)
private

Definition at line 423 of file KeyConfigPrefs.cpp.

425 {
426  TranslatableString disabledShortcuts;
427 
428  auto searchAddInKeys = [&](size_t index)
429  {
430  for (size_t k{ 0 }; k < toAdd.size(); k++)
431  if (k == index)
432  continue;
433  else if (toAdd[index] == mKeys[k] &&
434  (mDefaultKeys[k] == EMPTY_SHORTCUT ||
435  mDefaultKeys[k] != mDefaultKeys[index]))
436  return (int)k;
437 
438  return -1;
439  };
440 
441  const NormalizedKeyString noKey{ EMPTY_SHORTCUT };
442 
443  for (size_t i{ 0 }; i < toAdd.size(); i++)
444  {
445  if (mKeys[i] != NO_SHORTCUT)
446  continue;
447  else if (toAdd[i] == EMPTY_SHORTCUT)
448  mManager->SetKeyFromIndex(i, noKey);
449  else
450  {
451  int sRes{ searchAddInKeys(i) };
452 
453  if (sRes == -1)
454  mManager->SetKeyFromIndex(i, toAdd[i]);
455  else
456  {
458 
459  disabledShortcuts +=
460  XO(
461 "\n * \"%s\" (because the shortcut \'%s\' is used by \"%s\")\n")
462  .Format(
464  name,
466 
467  mManager->SetKeyFromIndex(i, noKey);
468  }
469  }
470  }
471 
472  return disabledShortcuts;
473 }

References EMPTY_SHORTCUT, Identifier::GET(), CommandManager::GetKeyFromName(), CommandManager::GetPrefixedLabelFromName(), mDefaultKeys, mKeys, mManager, mNames, name, NO_SHORTCUT, CommandManager::SetKeyFromIndex(), and XO.

Referenced by OnImport().

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

◆ NameFromKey()

CommandID KeyConfigPrefs::NameFromKey ( const NormalizedKeyString key)
private

Definition at line 736 of file KeyConfigPrefs.cpp.

737 {
738  return mView->GetNameByKey(key);
739 }

References KeyView::GetNameByKey(), key, and mView.

Here is the call graph for this function:

◆ OnClear()

void KeyConfigPrefs::OnClear ( wxCommandEvent &  e)
private

Definition at line 840 of file KeyConfigPrefs.cpp.

841 {
842  mKey->Clear();
843 
844  if (mCommandSelected != wxNOT_FOUND) {
845  SetKeyForSelected({});
846  }
847 }

References mCommandSelected, mKey, and SetKeyForSelected().

Here is the call graph for this function:

◆ OnDefaults()

void KeyConfigPrefs::OnDefaults ( wxCommandEvent &  e)
private

Definition at line 596 of file KeyConfigPrefs.cpp.

597 {
598  wxMenu Menu;
599  Menu.Append( 1, _("Standard") );
600  Menu.Append( 2, _("Full") );
601  Menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &KeyConfigPrefs::OnImportDefaults, this );
602  // Pop it up where the mouse is.
603  PopupMenu(&Menu);//, wxPoint(0, 0));
604 }

References _, MenuTable::Menu(), and OnImportDefaults().

Here is the call graph for this function:

◆ OnExport()

void KeyConfigPrefs::OnExport ( wxCommandEvent &  e)
private

Definition at line 568 of file KeyConfigPrefs.cpp.

569 {
570  wxString file = wxT("Audacity-keys.xml");
571 
572  file = SelectFile(FileNames::Operation::Export,
573  XO("Export Keyboard Shortcuts As:"),
574  wxEmptyString,
575  file,
576  wxT("xml"),
578  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
579  this);
580 
581  if (!file) {
582  return;
583  }
584 
585  GuardedCall( [&] {
586  XMLFileWriter prefFile{ file, XO("Error Exporting Keyboard Shortcuts") };
587  mManager->WriteXML(prefFile);
588  prefFile.Commit();
589  } );
590 }

References FileNames::AllFiles, GuardedCall(), mManager, SelectFile(), CommandManager::WriteXML(), FileNames::XMLFiles, and XO.

Here is the call graph for this function:

◆ OnFilterChar()

void KeyConfigPrefs::OnFilterChar ( wxEvent &  e)
private

Definition at line 726 of file KeyConfigPrefs.cpp.

727 {
728  if (mViewType != ViewByKey)
729  {
730  e.Skip();
731  }
732 }

References mViewType, and ViewByKey.

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ OnFilterKeyDown()

void KeyConfigPrefs::OnFilterKeyDown ( wxKeyEvent &  e)
private

Definition at line 684 of file KeyConfigPrefs.cpp.

685 {
686  wxTextCtrl *t = (wxTextCtrl *)e.GetEventObject();
687  int keycode = e.GetKeyCode();
688 
689  // Make sure we can navigate away from the hotkey textctrl.
690  // On Linux and OSX, it an get stuck, but it doesn't hurt
691  // to do it for Windows as well.
692  if (keycode == WXK_TAB) {
693  wxNavigationKeyEvent nevent;
694  nevent.SetWindowChange(e.ControlDown());
695  nevent.SetDirection(!e.ShiftDown());
696  nevent.SetEventObject(t);
697  nevent.SetCurrentFocus(t);
698  t->GetParent()->GetEventHandler()->ProcessEvent(nevent);
699 
700  return;
701  }
702 
703  if (mViewType == ViewByKey) {
704  wxString key = KeyEventToKeyString(e).Display();
705  t->SetValue(key);
706 
707  if (!key.empty()) {
708  mView->SetFilter(t->GetValue());
709  }
710  }
711  else
712  {
713  if (keycode == WXK_RETURN) {
714  mFilterPending = false;
715  mView->SetFilter(t->GetValue());
716  }
717  else {
718  mFilterPending = true;
719  mFilterTimer.Start(500, wxTIMER_ONE_SHOT);
720 
721  e.Skip();
722  }
723  }
724 }

References NormalizedKeyString::Display(), key, KeyEventToKeyString(), mFilterPending, mFilterTimer, mView, mViewType, KeyView::SetFilter(), and ViewByKey.

Referenced by PopulateOrExchange().

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

◆ OnFilterTimer()

void KeyConfigPrefs::OnFilterTimer ( wxTimerEvent &  e)
private

Definition at line 674 of file KeyConfigPrefs.cpp.

675 {
676  // The filter timer has expired, so set the filter
677  if (mFilterPending)
678  {
679  // Do not reset mFilterPending here...possible race
680  mView->SetFilter(mFilter->GetValue());
681  }
682 }

References mFilter, mFilterPending, mView, and KeyView::SetFilter().

Here is the call graph for this function:

◆ OnHotkeyChar()

void KeyConfigPrefs::OnHotkeyChar ( wxEvent &  e)
private

Definition at line 655 of file KeyConfigPrefs.cpp.

656 {
657  // event.Skip() not performed, so event will not be processed further.
658 }

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ OnHotkeyContext()

void KeyConfigPrefs::OnHotkeyContext ( wxEvent &  e)
private

Definition at line 669 of file KeyConfigPrefs.cpp.

670 {
671  // event.Skip() not performed, so event will not be processed further.
672 }

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ OnHotkeyKeyDown()

void KeyConfigPrefs::OnHotkeyKeyDown ( wxKeyEvent &  e)
private

Definition at line 633 of file KeyConfigPrefs.cpp.

634 {
635  wxTextCtrl *t = (wxTextCtrl *)e.GetEventObject();
636 
637  // Make sure we can navigate away from the hotkey textctrl.
638  // On Linux and OSX, it can get stuck, but it doesn't hurt
639  // to do it for Windows as well.
640  //
641  // Mac note: Don't waste time trying to figure out why the
642  // focus goes back to the prefs tree. Unless Voiceover is
643  // active, buttons on the Mac do not accept focus and all the
644  // controls between this one and the tree control are buttons.
645  if (e.GetKeyCode() == WXK_TAB) {
646  t->Navigate(e.ShiftDown()
647  ? wxNavigationKeyEvent::IsBackward
648  : wxNavigationKeyEvent::IsForward);
649  return;
650  }
651 
652  t->SetValue(KeyEventToKeyString(e).Display());
653 }

References NormalizedKeyString::Display(), and KeyEventToKeyString().

Referenced by PopulateOrExchange().

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

◆ OnHotkeyKillFocus()

void KeyConfigPrefs::OnHotkeyKillFocus ( wxEvent &  e)
private

Definition at line 660 of file KeyConfigPrefs.cpp.

661 {
662  if (mKey->GetValue().empty() && mCommandSelected != wxNOT_FOUND) {
663  mKey->AppendText(mView->GetKey(mCommandSelected).Display());
664  }
665 
666  e.Skip();
667 }

References NormalizedKeyString::Display(), KeyView::GetKey(), mCommandSelected, mKey, and mView.

Referenced by PopulateOrExchange().

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

◆ OnImport()

void KeyConfigPrefs::OnImport ( wxCommandEvent &  e)
private

Definition at line 489 of file KeyConfigPrefs.cpp.

490 {
491  wxString file = wxT("Audacity-keys.xml");
492 
493  file = SelectFile(FileNames::Operation::Open,
494  XO("Select an XML file containing Audacity keyboard shortcuts..."),
495  wxEmptyString,
496  file,
497  wxT(""),
499  wxRESIZE_BORDER,
500  this);
501 
502  if (!file) {
503  return;
504  }
505 
506  // this RefreshKeyInfo is here to account for
507  // potential OnSet() function executions before importing
508  RefreshKeyInfo();
509 
510  // saving pre-import settings
511  const std::vector<NormalizedKeyString> oldKeys{ mKeys };
512 
513  // clearing all pre-import settings
514  ClearAllKeys();
515 
516  // getting new settings
517  XMLFileReader reader;
518  if (!reader.Parse(mManager, file)) {
520  reader.GetErrorStr(),
521  XO("Error Importing Keyboard Shortcuts"),
522  wxOK | wxCENTRE,
523  this);
524  }
525 
526  RefreshKeyInfo();
527 
528  // checking new setting for duplicates
529  // if there are duplicates, throwing error and returning to pre-import state
530  TranslatableString fMatching;
531  TranslatableString sMatching;
532 
533  if (ContainsIllegalDups(fMatching, sMatching))
534  {
535  // restore the old pre-import hotkeys stored in oldKeys
536  for (size_t k{ 0 }; k < mNames.size(); k++)
537  mManager->SetKeyFromName(mNames[k], oldKeys[k]);
538  mKeys = oldKeys;
539 
540  // output an error message
542  XO(
543 "The file with the shortcuts contains illegal shortcut duplicates for \"%s\" and \"%s\".\nNothing is imported.")
544  .Format( fMatching, sMatching ),
545  XO("Error Importing Keyboard Shortcuts"),
546  wxICON_ERROR | wxCENTRE, this);
547 
548  // stop the function
549  return;
550  }
551 
552  // adding possible old settings to the new settings and recording the conflicting ones
553  TranslatableString disabledShortcuts{ MergeWithExistingKeys(oldKeys) };
554 
555  RefreshBindings(true);
556 
557  TranslatableString message{
558  XO("Loaded %d keyboard shortcuts\n").Format(mManager->GetNumberOfKeysRead()) };
559 
560  if (disabledShortcuts.Translation() != (""))
561  message += XO("\nThe following commands are not mentioned in the imported file, "
562  "but have their shortcuts removed because of the conflict with other new shortcuts:\n") +
563  disabledShortcuts;
564 
565  AudacityMessageBox(message, XO("Loading Keyboard Shortcuts"), wxOK | wxCENTRE);
566 }

References FileNames::AllFiles, AudacityMessageBox(), ClearAllKeys(), ContainsIllegalDups(), XMLFileReader::GetErrorStr(), CommandManager::GetNumberOfKeysRead(), MergeWithExistingKeys(), mKeys, mManager, mNames, XMLFileReader::Parse(), RefreshBindings(), RefreshKeyInfo(), SelectFile(), CommandManager::SetKeyFromName(), FileNames::XMLFiles, and XO.

Here is the call graph for this function:

◆ OnImportDefaults()

void KeyConfigPrefs::OnImportDefaults ( wxCommandEvent &  e)
private

Definition at line 617 of file KeyConfigPrefs.cpp.

618 {
619  gPrefs->DeleteEntry(wxT("/GUI/Shortcuts/FullDefaults"));
620  gPrefs->Flush();
621 
623  if( event.GetId() == 1 )
624  FilterKeys( mNewKeys );
625 
626  for (size_t i = 0; i < mNewKeys.size(); i++) {
628  }
629 
630  RefreshBindings(true);
631 }

References FileConfig::DeleteEntry(), FilterKeys(), FileConfig::Flush(), gPrefs, mDefaultKeys, mManager, mNewKeys, RefreshBindings(), and CommandManager::SetKeyFromIndex().

Referenced by OnDefaults().

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

◆ OnSelected()

void KeyConfigPrefs::OnSelected ( wxCommandEvent &  e)
private

Definition at line 849 of file KeyConfigPrefs.cpp.

850 {
852  mKey->Clear();
853 
854  if (mCommandSelected != wxNOT_FOUND) {
855  bool canset = mView->CanSetKey(mCommandSelected);
856  if (canset) {
857  mKey->AppendText(mView->GetKey(mCommandSelected).Display());
858  }
859 
860  mKey->Enable(canset);
861  mSet->Enable(canset);
862  mClear->Enable(canset);
863  }
864 }

References KeyView::CanSetKey(), NormalizedKeyString::Display(), KeyView::GetKey(), KeyView::GetSelected(), mClear, mCommandSelected, mKey, mSet, and mView.

Here is the call graph for this function:

◆ OnSet()

void KeyConfigPrefs::OnSet ( wxCommandEvent &  e)
private

Definition at line 763 of file KeyConfigPrefs.cpp.

764 {
765  if (mCommandSelected == wxNOT_FOUND) {
767  XO("You must select a binding before assigning a shortcut"),
768  XO("Error"),
769  wxICON_WARNING | wxCENTRE,
770  this);
771  return;
772  }
773 
774  CommandID newCommand{ mView->GetName(mCommandSelected) };
775  NormalizedKeyString enteredKey{ mKey->GetValue() };
776  NormalizedKeyString newComDefaultKey{
777  mManager->GetDefaultKeyFromName(newCommand) };
778  CommandIDs oldCommands;
779 
780  // collecting commands competing for the same shortcut
781  for (size_t i{ 0 }; i < mNames.size(); i++)
782  {
783  if (mNewKeys[i] == enteredKey)
784  {
785  // ignore the Set button if the same shortcut is used
786  if (mNames[i] == newCommand)
787  return;
788 
789  if (newComDefaultKey == EMPTY_SHORTCUT ||
790  mDefaultKeys[i] != newComDefaultKey)
791  {
792  oldCommands.push_back(mNames[i]);
793  }
794  }
795  }
796 
797  // Prevent same hotkey combination being used twice.
798  if (!oldCommands.empty()) {
799  auto newlabel = Verbatim( wxT("'%s - %s'") )
800  .Format(
801  mManager->GetCategoryFromName(newCommand),
802  mManager->GetPrefixedLabelFromName(newCommand) );
803  auto oldlabel = Verbatim(wxT("'%s - %s'"))
804  .Format(
805  mManager->GetCategoryFromName(oldCommands[0]),
806  mManager->GetPrefixedLabelFromName(oldCommands[0]));
807 
808  for (size_t i{ 1 }; i < oldCommands.size(); i++)
809  oldlabel += XO("\n\n\t and\n\n\t") +
810  Verbatim(wxT("'%s - %s'")).Format(
811  mManager->GetCategoryFromName(oldCommands[i]),
812  mManager->GetPrefixedLabelFromName(oldCommands[i]));
813 
814  if (wxCANCEL == AudacityMessageBox(
815  XO(
816 "The keyboard shortcut '%s' is already assigned to:\n\n\t%s\n\n\nClick OK to assign the shortcut to\n\n\t%s\n\ninstead. Otherwise, click Cancel.")
817  .Format(
818  mKey->GetValue(),
819  oldlabel,
820  newlabel
821  ),
822  XO("Warning"),
823  wxOK | wxCANCEL | wxICON_STOP | wxCENTRE,
824  this))
825  {
826  return;
827  }
828 
829  for (const auto & command : oldCommands)
830  {
831  mView->SetKeyByName(command, {});
832  mManager->SetKeyFromName(command, {});
833  mNewKeys[make_iterator_range(mNames).index(command)] = {};
834  }
835  }
836 
837  SetKeyForSelected(enteredKey);
838 }

References AudacityMessageBox(), EMPTY_SHORTCUT, TranslatableString::Format(), CommandManager::GetCategoryFromName(), CommandManager::GetDefaultKeyFromName(), KeyView::GetName(), CommandManager::GetPrefixedLabelFromName(), make_iterator_range(), mCommandSelected, mDefaultKeys, mKey, mManager, mNames, mNewKeys, mView, KeyView::SetKeyByName(), SetKeyForSelected(), CommandManager::SetKeyFromName(), Verbatim(), and XO.

Here is the call graph for this function:

◆ OnShow()

void KeyConfigPrefs::OnShow ( wxShowEvent &  e)
private

Definition at line 477 of file KeyConfigPrefs.cpp.

478 {
479  event.Skip();
480 
481  // This is required to prevent a crash if Preferences
482  // were opened without a project.
483  if (event.IsShown() && mView != nullptr)
484  {
485  mView->Refresh();
486  }
487 }

References mView.

◆ OnViewBy()

void KeyConfigPrefs::OnViewBy ( wxCommandEvent &  e)
private

Definition at line 866 of file KeyConfigPrefs.cpp.

867 {
868  switch (e.GetId())
869  {
870  case ViewByTreeID:
872  mFilterLabel->SetLabel(_("Searc&h:"));
873  break;
874 
875  case ViewByNameID:
877  mFilterLabel->SetLabel(_("Searc&h:"));
878  break;
879 
880  case ViewByKeyID:
882  mFilterLabel->SetLabel(_("&Hotkey:"));
883  break;
884  }
885 
887  mFilter->SetName(wxStripMenuCodes(mFilterLabel->GetLabel()));
888 }

References _, mFilter, mFilterLabel, mView, mViewType, KeyView::SetView(), ViewByKey, ViewByKeyID, ViewByName, ViewByNameID, ViewByTree, and ViewByTreeID.

Here is the call graph for this function:

◆ Populate()

void KeyConfigPrefs::Populate ( )
private

Definition at line 128 of file KeyConfigPrefs.cpp.

129 {
131 
132  if (!mProject) {
133  S.StartVerticalLay(true);
134  {
135  S.StartStatic( {}, true);
136  {
137  S.AddTitle(XO("Keyboard preferences currently unavailable."));
138  S.AddTitle(XO("Open a new project to modify keyboard shortcuts."));
139  }
140  S.EndStatic();
141  }
142  S.EndVerticalLay();
143 
144  return;
145  }
146 
148 
149  mCommandSelected = wxNOT_FOUND;
150 
152 
153  // For speed, don't sort here. We're just creating.
154  // Instead sort when we do SetView later in this function.
155  RefreshBindings(false);
156 
157  if (mViewByTree->GetValue()) {
159  }
160  else if (mViewByName->GetValue()) {
162  }
163  else if (mViewByKey->GetValue()) {
165  mFilterLabel->SetLabel(_("&Hotkey:"));
166  mFilter->SetName(wxStripMenuCodes(mFilterLabel->GetLabel()));
167  }
168 
170 }

References _, ShuttleGuiBase::AddTitle(), eIsCreatingFromPrefs, ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndVerticalLay(), CommandManager::Get(), mCommandSelected, mFilter, mFilterLabel, mManager, mProject, mView, mViewByKey, mViewByName, mViewByTree, mViewType, PopulateOrExchange(), RefreshBindings(), KeyView::SetView(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::StartVerticalLay(), ViewByKey, ViewByName, ViewByTree, and XO.

Here is the call graph for this function:

◆ PopulateOrExchange()

void KeyConfigPrefs::PopulateOrExchange ( ShuttleGui S)
override

Normally in classes derived from PrefsPanel this function is used both to populate the panel and to exchange data with it. With KeyConfigPrefs all the exchanges are handled specially, so this is only used in populating the panel.

Definition at line 176 of file KeyConfigPrefs.cpp.

177 {
178  S.SetBorder(2);
179 
180  S.StartStatic(XO("Key Bindings"), 1);
181  {
182  S.StartHorizontalLay(wxEXPAND, 0);
183  {
184  S.Position(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL).AddTitle(XO("View by:"));
185 
186  // Bug 2692: Place button group in panel so tabbing will work and,
187  // on the Mac, VoiceOver will announce as radio buttons.
188  S.StartPanel();
189  {
190  S.StartHorizontalLay();
191  {
193  wxT("/Prefs/KeyConfig/ViewBy"),
194  {
195  { wxT("tree"), XXO("&Tree") },
196  { wxT("name"), XXO("&Name") },
197  { wxT("key"), XXO("&Key") },
198  },
199  0 // tree
200  });
201  {
203  .Name(XO("View by tree"))
204  .TieRadioButton();
206  .Name(XO("View by name"))
207  .TieRadioButton();
209  .Name(XO("View by key"))
210  .TieRadioButton();
211 #if !defined(__WXMAC__) && wxUSE_ACCESSIBILITY
212  // so that name can be set on a standard control
216 #endif
217  }
219  }
220  S.EndHorizontalLay();
221  }
222  S.EndPanel();
223 
224  S.AddSpace(wxDefaultCoord, wxDefaultCoord, 1);
225 
226  S.StartHorizontalLay(wxALIGN_CENTER_VERTICAL, 0);
227  {
228  mFilterLabel = S.Position(wxALIGN_CENTER_VERTICAL).AddVariableText(XO("Searc&h:"));
229 
230  if (!mFilter) {
231  mFilter = safenew wxTextCtrl(S.GetParent(),
232  FilterID,
233  wxT(""),
234  wxDefaultPosition,
235 #if defined(__WXMAC__)
236  wxSize(300, -1),
237 #else
238  wxSize(210, -1),
239 #endif
240  wxTE_PROCESS_ENTER);
241  mFilter->SetName(wxStripMenuCodes(mFilterLabel->GetLabel()));
242  }
243  S.Position(wxALIGN_NOT | wxALIGN_LEFT)
244  .ConnectRoot(wxEVT_KEY_DOWN,
246  .ConnectRoot(wxEVT_CHAR,
248  .AddWindow(mFilter);
249  }
250  S.EndHorizontalLay();
251  }
252  S.EndHorizontalLay();
253 
254  S.AddSpace(wxDefaultCoord, 2);
255 
256  S.StartHorizontalLay(wxEXPAND, 1);
257  {
258  if (!mView) {
260  mView->SetName(_("Bindings"));
261  }
262  S.Prop(true)
263  .Position(wxEXPAND)
264  .AddWindow(mView);
265  }
266  S.EndHorizontalLay();
267 
268  S.StartThreeColumn();
269  {
270  if (!mKey) {
271  mKey = safenew wxTextCtrl(S.GetParent(),
273  wxT(""),
274  wxDefaultPosition,
275 #if defined(__WXMAC__)
276  wxSize(300, -1),
277 #else
278  wxSize(210, -1),
279 #endif
280  wxTE_PROCESS_ENTER);
281 #if !defined(__WXMAC__) && wxUSE_ACCESSIBILITY
282  // so that name can be set on a standard control
283  mKey->SetAccessible(safenew WindowAccessible(mKey));
284 #endif
285  mKey->SetName(_("Short cut"));
286  }
287  S
288  .ConnectRoot(wxEVT_KEY_DOWN,
290  .ConnectRoot(wxEVT_CHAR,
292  .ConnectRoot(wxEVT_KILL_FOCUS,
294  .ConnectRoot(wxEVT_CONTEXT_MENU,
296  .AddWindow(mKey);
297 
298  /* i18n-hint: (verb)*/
299  mSet = S.Id(SetButtonID).AddButton(XXO("&Set"));
300  /* i18n-hint: (verb)*/
301  mClear = S.Id(ClearButtonID).AddButton(XXO("Cl&ear"));
302  }
303  S.EndThreeColumn();
304 
305 #if defined(__WXMAC__)
306  S.AddFixedText(XO("Note: Pressing Cmd+Q will quit. All other keys are valid."));
307 #endif
308 
309  S.StartThreeColumn();
310  {
311  S.Id(ImportButtonID).AddButton(XXO("&Import..."));
312  S.Id(ExportButtonID).AddButton(XXO("&Export..."));
313  S.Id(AssignDefaultsButtonID).AddButton(XXO("&Defaults"));
314  }
315  S.EndThreeColumn();
316  }
317  S.EndStatic();
318 
319 
320  // Need to layout so that the KeyView is properly sized before populating.
321  // Otherwise, the initial selection is not scrolled into view.
322  Layout();
323 }

References _, ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddFixedText(), ShuttleGui::AddSpace(), ShuttleGuiBase::AddTitle(), ShuttleGuiBase::AddVariableText(), ShuttleGuiBase::AddWindow(), AssignDefaultsButtonID, ClearButtonID, CommandsListID, ShuttleGui::ConnectRoot(), CurrentComboID, ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndPanel(), ShuttleGuiBase::EndRadioButtonGroup(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndThreeColumn(), ExportButtonID, FilterID, ShuttleGuiBase::GetParent(), ShuttleGui::Id(), ImportButtonID, mClear, mFilter, mFilterLabel, mKey, mSet, mView, mViewByKey, mViewByName, mViewByTree, ShuttleGui::Name(), OnFilterChar(), OnFilterKeyDown(), OnHotkeyChar(), OnHotkeyContext(), OnHotkeyKeyDown(), OnHotkeyKillFocus(), ShuttleGui::Position(), ShuttleGui::Prop(), safenew, ShuttleGuiBase::SetBorder(), SetButtonID, ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartPanel(), ShuttleGuiBase::StartRadioButtonGroup(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::StartThreeColumn(), ViewByKeyID, ViewByNameID, ViewByTreeID, XO, and XXO.

Referenced by Commit(), and Populate().

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

◆ RefreshBindings()

void KeyConfigPrefs::RefreshBindings ( bool  bSort)
private

Definition at line 325 of file KeyConfigPrefs.cpp.

326 {
327  TranslatableStrings Labels;
328  TranslatableStrings Categories;
329  TranslatableStrings Prefixes;
330 
331  mNames.clear();
332  mKeys.clear();
333  mDefaultKeys.clear();
334  mStandardDefaultKeys.clear();
336  mNames,
337  mKeys,
338  mDefaultKeys,
339  Labels,
340  Categories,
341  Prefixes,
342  true); // True to include effects (list items), false otherwise.
343 
346 
348  Categories,
349  Prefixes,
350  Labels,
351  mKeys,
352  bSort);
353  //Not needed as NEW nodes are already shown expanded.
354  //mView->ExpandAll();
355 
356  mNewKeys = mKeys;
357 }

References FilterKeys(), CommandManager::GetAllCommandData(), mDefaultKeys, mKeys, mManager, mNames, mNewKeys, mStandardDefaultKeys, mView, and KeyView::RefreshBindings().

Referenced by OnImport(), OnImportDefaults(), and Populate().

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

◆ RefreshKeyInfo()

void KeyConfigPrefs::RefreshKeyInfo ( )
private

Definition at line 361 of file KeyConfigPrefs.cpp.

362 {
363  mKeys.clear();
364 
365  for (const auto & name : mNames)
366  mKeys.push_back(mManager->GetKeyFromName(name));
367 }

References CommandManager::GetKeyFromName(), mKeys, mManager, mNames, and name.

Referenced by OnImport().

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

◆ SetKeyForSelected()

void KeyConfigPrefs::SetKeyForSelected ( const NormalizedKeyString key)
private

Definition at line 743 of file KeyConfigPrefs.cpp.

744 {
746 
748  {
750  XO("You may not assign a key to this entry"),
751  XO("Error"),
752  wxICON_ERROR | wxCENTRE,
753  this);
754  return;
755  }
756 
759  mNewKeys[ make_iterator_range( mNames ).index( name ) ] = key;
760 }

References AudacityMessageBox(), KeyView::CanSetKey(), KeyView::GetName(), key, make_iterator_range(), mCommandSelected, mManager, mNames, mNewKeys, mView, name, KeyView::SetKey(), CommandManager::SetKeyFromName(), and XO.

Referenced by OnClear(), and OnSet().

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

Member Data Documentation

◆ mClear

wxButton* KeyConfigPrefs::mClear
private

Definition at line 84 of file KeyConfigPrefs.h.

Referenced by OnSelected(), and PopulateOrExchange().

◆ mCommandSelected

int KeyConfigPrefs::mCommandSelected
private

◆ mDefaultKeys

std::vector<NormalizedKeyString> KeyConfigPrefs::mDefaultKeys
private

◆ mFilter

wxTextCtrl* KeyConfigPrefs::mFilter
private

Definition at line 86 of file KeyConfigPrefs.h.

Referenced by OnFilterTimer(), OnViewBy(), Populate(), and PopulateOrExchange().

◆ mFilterLabel

wxStaticText* KeyConfigPrefs::mFilterLabel
private

Definition at line 87 of file KeyConfigPrefs.h.

Referenced by OnViewBy(), Populate(), and PopulateOrExchange().

◆ mFilterPending

bool KeyConfigPrefs::mFilterPending
private

Definition at line 89 of file KeyConfigPrefs.h.

Referenced by OnFilterKeyDown(), and OnFilterTimer().

◆ mFilterTimer

wxTimer KeyConfigPrefs::mFilterTimer
private

Definition at line 88 of file KeyConfigPrefs.h.

Referenced by OnFilterKeyDown().

◆ mKey

wxTextCtrl* KeyConfigPrefs::mKey
private

Definition at line 82 of file KeyConfigPrefs.h.

Referenced by OnClear(), OnHotkeyKillFocus(), OnSelected(), OnSet(), and PopulateOrExchange().

◆ mKeys

std::vector<NormalizedKeyString> KeyConfigPrefs::mKeys
private

◆ mManager

CommandManager* KeyConfigPrefs::mManager
private

◆ mNames

CommandIDs KeyConfigPrefs::mNames
private

◆ mNewKeys

std::vector<NormalizedKeyString> KeyConfigPrefs::mNewKeys
private

Definition at line 105 of file KeyConfigPrefs.h.

Referenced by Commit(), OnImportDefaults(), OnSet(), RefreshBindings(), and SetKeyForSelected().

◆ mProject

AudacityProject* KeyConfigPrefs::mProject {}
private

Definition at line 96 of file KeyConfigPrefs.h.

Referenced by Commit(), and Populate().

◆ mSet

wxButton* KeyConfigPrefs::mSet
private

Definition at line 83 of file KeyConfigPrefs.h.

Referenced by OnSelected(), and PopulateOrExchange().

◆ mStandardDefaultKeys

std::vector<NormalizedKeyString> KeyConfigPrefs::mStandardDefaultKeys
private

Definition at line 103 of file KeyConfigPrefs.h.

Referenced by Commit(), and RefreshBindings().

◆ mView

KeyView* KeyConfigPrefs::mView
private

◆ mViewByKey

wxRadioButton* KeyConfigPrefs::mViewByKey
private

Definition at line 94 of file KeyConfigPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mViewByName

wxRadioButton* KeyConfigPrefs::mViewByName
private

Definition at line 93 of file KeyConfigPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mViewByTree

wxRadioButton* KeyConfigPrefs::mViewByTree
private

Definition at line 92 of file KeyConfigPrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mViewType

ViewByType KeyConfigPrefs::mViewType
private

Definition at line 91 of file KeyConfigPrefs.h.

Referenced by OnFilterChar(), OnFilterKeyDown(), OnViewBy(), and Populate().


The documentation for this class was generated from the following files:
ShuttleGuiBase::StartRadioButtonGroup
void StartRadioButtonGroup(const ChoiceSetting &Setting)
Call this before any TieRadioButton calls.
Definition: ShuttleGui.cpp:1595
CommandManager::GetAllCommandData
void GetAllCommandData(CommandIDs &names, std::vector< NormalizedKeyString > &keys, std::vector< NormalizedKeyString > &default_keys, TranslatableStrings &labels, TranslatableStrings &categories, bool includeMultis)
Definition: CommandManager.cpp:1445
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
CommandManager::SetKeyFromIndex
void SetKeyFromIndex(int i, const NormalizedKeyString &key)
Definition: CommandManager.cpp:1044
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
ImportButtonID
#define ImportButtonID
Definition: KeyConfigPrefs.cpp:65
ShuttleGuiBase::EndRadioButtonGroup
void EndRadioButtonGroup()
Definition: ShuttleGui.cpp:1612
KeyView::RefreshBindings
void RefreshBindings(const CommandIDs &names, const TranslatableStrings &categories, const TranslatableStrings &prefixes, const TranslatableStrings &labels, const std::vector< NormalizedKeyString > &keys, bool bSort)
Definition: KeyView.cpp:636
KeyConfigPrefs::mStandardDefaultKeys
std::vector< NormalizedKeyString > mStandardDefaultKeys
Definition: KeyConfigPrefs.h:103
GuardedCall
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), std::function< void(AudacityException *)> delayedHandler=DefaultDelayedHandlerAction{})
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread...
Definition: AudacityException.h:202
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:549
KeyConfigPrefs::OnShow
void OnShow(wxShowEvent &e)
Definition: KeyConfigPrefs.cpp:477
NormalizedKeyString::Display
wxString Display(bool usesSpecialChars=false) const
Definition: Keyboard.cpp:56
KeyConfigPrefs::OnHotkeyKillFocus
void OnHotkeyKillFocus(wxEvent &e)
Definition: KeyConfigPrefs.cpp:660
KeyConfigPrefs::ContainsIllegalDups
bool ContainsIllegalDups(TranslatableString &fMatching, TranslatableString &sMatching) const
Definition: KeyConfigPrefs.cpp:383
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
ShuttleGuiBase::EndThreeColumn
void EndThreeColumn()
Definition: ShuttleGui.h:369
ExportButtonID
#define ExportButtonID
Definition: KeyConfigPrefs.cpp:64
ShuttleGuiBase::AddTitle
void AddTitle(const TranslatableString &Prompt, int wrapWidth=0)
Centred text string.
Definition: ShuttleGui.cpp:281
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: TranslatableString.h:295
KeyView::GetName
wxString GetName() const override
Definition: KeyView.cpp:194
FileConfig::HasEntry
virtual bool HasEntry(const wxString &strName) const wxOVERRIDE
Definition: FileConfig.cpp:138
SelectFile
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
KeyConfigPrefs::Populate
void Populate()
Definition: KeyConfigPrefs.cpp:128
KeyConfigPrefs::mFilterPending
bool mFilterPending
Definition: KeyConfigPrefs.h:89
Format
Abstract base class used in importing a file.
CommandManager::GetPrefixedLabelFromName
TranslatableString GetPrefixedLabelFromName(const CommandID &name)
Definition: CommandManager.cpp:1492
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
KeyConfigPrefs::mNames
CommandIDs mNames
Definition: KeyConfigPrefs.h:101
FileConfig::DeleteEntry
virtual bool DeleteEntry(const wxString &key, bool bDeleteGroupIfEmpty=true) wxOVERRIDE
Definition: FileConfig.cpp:209
XO
#define XO(s)
Definition: Internat.h:31
FileNames::XMLFiles
FILES_API const FileType XMLFiles
Definition: FileNames.h:74
CommandManager::ExcludedList
static const std::vector< NormalizedKeyString > & ExcludedList()
Definition: CommandManager.cpp:253
FilterID
#define FilterID
Definition: KeyConfigPrefs.cpp:66
CommandManager::GetCategoryFromName
TranslatableString GetCategoryFromName(const CommandID &name)
Definition: CommandManager.cpp:1506
KeyConfigPrefs::mFilterLabel
wxStaticText * mFilterLabel
Definition: KeyConfigPrefs.h:87
KeyView::GetSelected
int GetSelected() const
Definition: KeyView.cpp:185
FileNames::AllFiles
FILES_API const FileType AllFiles
Definition: FileNames.h:71
KeyConfigPrefs::mNewKeys
std::vector< NormalizedKeyString > mNewKeys
Definition: KeyConfigPrefs.h:105
CommandManager::GetNumberOfKeysRead
int GetNumberOfKeysRead() const
Definition: CommandManager.cpp:1011
KeyView::SetKey
bool SetKey(int index, const NormalizedKeyString &key)
Definition: KeyView.cpp:355
ShuttleGuiBase::StartPanel
wxPanel * StartPanel(int iStyle=0)
Definition: ShuttleGui.cpp:990
KeyConfigPrefs::mProject
AudacityProject * mProject
Definition: KeyConfigPrefs.h:96
ShuttleGuiBase::EndPanel
void EndPanel()
Definition: ShuttleGui.cpp:1018
KEY_CONFIG_PREFS_PLUGIN_SYMBOL
#define KEY_CONFIG_PREFS_PLUGIN_SYMBOL
Definition: KeyConfigPrefs.h:30
KeyConfigPrefs::mKey
wxTextCtrl * mKey
Definition: KeyConfigPrefs.h:82
KeyConfigPrefs::ClearAllKeys
void ClearAllKeys()
Definition: KeyConfigPrefs.cpp:371
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
KeyView::SetKeyByName
bool SetKeyByName(const CommandID &name, const NormalizedKeyString &key)
Definition: KeyView.cpp:396
XMLFileReader::Parse
bool Parse(XMLTagHandler *baseHandler, const FilePath &fname)
Definition: XMLFileReader.cpp:42
KeyConfigPrefs::FilterKeys
void FilterKeys(std::vector< NormalizedKeyString > &arr)
Definition: KeyConfigPrefs.cpp:606
ViewByKeyID
#define ViewByKeyID
Definition: KeyConfigPrefs.cpp:69
SetButtonID
#define SetButtonID
Definition: KeyConfigPrefs.cpp:61
KeyConfigPrefs::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: KeyConfigPrefs.cpp:176
CommandIDs
std::vector< CommandID > CommandIDs
Definition: Identifier.h:233
CommandsListID
#define CommandsListID
Definition: KeyConfigPrefs.cpp:63
XXO
#define XXO(s)
Definition: Internat.h:44
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
XMLFileReader::GetErrorStr
const TranslatableString & GetErrorStr() const
Definition: XMLFileReader.cpp:178
KeyConfigPrefs::mViewByTree
wxRadioButton * mViewByTree
Definition: KeyConfigPrefs.h:92
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
CommandManager::GetKeyFromName
NormalizedKeyString GetKeyFromName(const CommandID &name) const
Definition: CommandManager.cpp:1515
CurrentComboID
#define CurrentComboID
Definition: KeyConfigPrefs.cpp:60
ShuttleGuiBase::AddFixedText
void AddFixedText(const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
Definition: ShuttleGui.cpp:440
ViewByKey
@ ViewByKey
Definition: KeyView.h:64
name
const TranslatableString name
Definition: Distortion.cpp:98
KeyView::GetKey
NormalizedKeyString GetKey(int index) const
Definition: KeyView.cpp:322
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:496
KeyView::GetNameByKey
CommandID GetNameByKey(const NormalizedKeyString &key) const
Definition: KeyView.cpp:282
ShuttleGuiBase::AddWindow
wxWindow * AddWindow(wxWindow *pWindow, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:299
WindowAccessible
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
ViewByTree
@ ViewByTree
Definition: KeyView.h:62
KeyConfigPrefs::mViewByName
wxRadioButton * mViewByName
Definition: KeyConfigPrefs.h:93
ShuttleGuiBase::StartThreeColumn
void StartThreeColumn()
Definition: ShuttleGui.h:368
KeyConfigPrefs::OnFilterKeyDown
void OnFilterKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:684
KeyConfigPrefs::mFilter
wxTextCtrl * mFilter
Definition: KeyConfigPrefs.h:86
KeyConfigPrefs::mView
KeyView * mView
Definition: KeyConfigPrefs.h:81
NO_SHORTCUT
#define NO_SHORTCUT
Definition: KeyConfigPrefs.cpp:75
ShuttleGui::Prop
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:725
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
Identifier::GET
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
NormalizedKeyString
Definition: Keyboard.h:25
CommandManager::SetKeyFromName
void SetKeyFromName(const CommandID &name, const NormalizedKeyString &key)
Definition: CommandManager.cpp:1035
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
eIsSavingToPrefs
@ eIsSavingToPrefs
Definition: ShuttleGui.h:48
ViewByName
@ ViewByName
Definition: KeyView.h:63
KeyConfigPrefs::RefreshKeyInfo
void RefreshKeyInfo()
Definition: KeyConfigPrefs.cpp:361
ShuttleGui::Name
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:663
KeyConfigPrefs::mCommandSelected
int mCommandSelected
Definition: KeyConfigPrefs.h:99
CommandManager::WriteXML
void WriteXML(XMLWriter &xmlFile) const
Definition: CommandManager.cpp:1586
CommandManager::GetDefaultKeyFromName
NormalizedKeyString GetDefaultKeyFromName(const CommandID &name)
Definition: CommandManager.cpp:1526
KeyConfigPrefs::mKeys
std::vector< NormalizedKeyString > mKeys
Definition: KeyConfigPrefs.h:104
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
EMPTY_SHORTCUT
#define EMPTY_SHORTCUT
Definition: KeyConfigPrefs.cpp:73
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
KeyView::GetIndexByName
int GetIndexByName(const CommandID &name) const
Definition: KeyView.cpp:246
XMLFileReader
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:18
ShuttleGui::Position
ShuttleGui & Position(int flags)
Definition: ShuttleGui.h:712
KeyConfigPrefs::mDefaultKeys
std::vector< NormalizedKeyString > mDefaultKeys
Definition: KeyConfigPrefs.h:102
TaggedIdentifier< CommandIdTag, false >
KeyView::SetView
void SetView(ViewByType type)
Definition: KeyView.cpp:414
_
#define _(s)
Definition: Internat.h:75
ShuttleGui::ConnectRoot
auto ConnectRoot(wxEventTypeTag< Tag > eventType, void(Handler::*func)(Argument &)) -> typename std::enable_if< std::is_base_of< Argument, Tag >::value, ShuttleGui & >::type
Definition: ShuttleGui.h:699
KeyConfigPrefs::mClear
wxButton * mClear
Definition: KeyConfigPrefs.h:84
XMLFileWriter
Wrapper to output XML data to files.
Definition: XMLWriter.h:81
KeyConfigPrefs::mSet
wxButton * mSet
Definition: KeyConfigPrefs.h:83
KeyConfigPrefs::OnHotkeyChar
void OnHotkeyChar(wxEvent &e)
Definition: KeyConfigPrefs.cpp:655
FilterTimerID
#define FilterTimerID
Definition: KeyConfigPrefs.cpp:70
MenuTable::Menu
std::unique_ptr< MenuItem > Menu(const Identifier &internalName, const TranslatableString &title, Args &&... args)
Definition: CommandManager.h:623
Verbatim
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Definition: TranslatableString.h:321
KeyView
Provides multiple views of keyboard shortcuts.
Definition: KeyView.h:73
KeyConfigPrefs::OnHotkeyContext
void OnHotkeyContext(wxEvent &e)
Definition: KeyConfigPrefs.cpp:669
KeyConfigPrefs::RefreshBindings
void RefreshBindings(bool bSort)
Definition: KeyConfigPrefs.cpp:325
KeyView::SetFilter
void SetFilter(const wxString &filter)
Definition: KeyView.cpp:472
ViewByTreeID
#define ViewByTreeID
Definition: KeyConfigPrefs.cpp:67
KeyEventToKeyString
NormalizedKeyString KeyEventToKeyString(const wxKeyEvent &event)
Definition: Keyboard.cpp:83
KeyConfigPrefs::mViewByKey
wxRadioButton * mViewByKey
Definition: KeyConfigPrefs.h:94
ViewByNameID
#define ViewByNameID
Definition: KeyConfigPrefs.cpp:68
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
TranslatableString::Format
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
Definition: TranslatableString.h:103
eIsCreatingFromPrefs
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:47
KeyView::SelectNode
void SelectNode(int index)
Definition: KeyView.cpp:1105
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:463
KeyConfigPrefs::OnFilterChar
void OnFilterChar(wxEvent &e)
Definition: KeyConfigPrefs.cpp:726
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition: CommandManager.cpp:207
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
KeyConfigPrefs::MergeWithExistingKeys
TranslatableString MergeWithExistingKeys(const std::vector< NormalizedKeyString > &toAdd)
Definition: KeyConfigPrefs.cpp:423
safenew
#define safenew
Definition: MemoryX.h:10
KeyConfigPrefs::SetKeyForSelected
void SetKeyForSelected(const NormalizedKeyString &key)
Definition: KeyConfigPrefs.cpp:743
KeyView::CanSetKey
bool CanSetKey(int index) const
Definition: KeyView.cpp:338
KeyConfigPrefs::mFilterTimer
wxTimer mFilterTimer
Definition: KeyConfigPrefs.h:88
ClearButtonID
#define ClearButtonID
Definition: KeyConfigPrefs.cpp:62
KeyConfigPrefs::mManager
CommandManager * mManager
Definition: KeyConfigPrefs.h:98
AssignDefaultsButtonID
#define AssignDefaultsButtonID
Definition: KeyConfigPrefs.cpp:59
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
PrefsPanel::PrefsPanel
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:90
KeyConfigPrefs::OnImportDefaults
void OnImportDefaults(wxCommandEvent &e)
Definition: KeyConfigPrefs.cpp:617
KeyConfigPrefs::mViewType
ViewByType mViewType
Definition: KeyConfigPrefs.h:91
KeyConfigPrefs::OnHotkeyKeyDown
void OnHotkeyKeyDown(wxKeyEvent &e)
Definition: KeyConfigPrefs.cpp:633