Audacity 3.2.0
Public Member Functions | List of all members
NormalizedKeyString Struct Reference

#include <Keyboard.h>

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

Public Member Functions

 NormalizedKeyString ()=default
 
 NormalizedKeyString (const wxString &key)
 
wxString Display (bool usesSpecialChars=false) const
 
- Public Member Functions inherited from TaggedIdentifier< Tag, CaseSensitive >
 TaggedIdentifier ()=default
 
 TaggedIdentifier (const TaggedIdentifier &)=default
 Copy allowed only for the same Tag class and case sensitivity. More...
 
 TaggedIdentifier (TaggedIdentifier &&)=default
 Move allowed only for the same Tag class and case sensitivity. More...
 
TaggedIdentifieroperator= (const TaggedIdentifier &)=default
 Copy allowed only for the same Tag class and case sensitivity. More...
 
TaggedIdentifieroperator= (TaggedIdentifier &&)=default
 Move allowed only for the same Tag class and case sensitivity. More...
 
template<typename Tag2 , bool b>
 TaggedIdentifier (const TaggedIdentifier< Tag2, b > &)=delete
 Copy prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
 TaggedIdentifier (TaggedIdentifier< Tag2, b > &&)=delete
 Move prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
TaggedIdentifieroperator= (const TaggedIdentifier< Tag2, b > &)=delete
 Copy prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
TaggedIdentifieroperator= (TaggedIdentifier< Tag2, b > &&)=delete
 Move prohibited for other Tag classes or case sensitivity. More...
 
 TaggedIdentifier (const Identifier &str)
 
template<typename String , typename = typename String::TagType>
String CONVERT () const
 Explicit conversion to another kind of TaggedIdentifier. More...
 
 Identifier ()=default
 
 Identifier (const wxString &str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const wxChar *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const char *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const Identifier &)=default
 
 Identifier (wxString &&str)
 
 Identifier (Identifier &&id)
 
 Identifier (std::initializer_list< Identifier > components, wxChar separator)
 Convenience for building concatenated identifiers. More...
 
- Public Member Functions inherited from Identifier
 Identifier ()=default
 
 Identifier (const wxString &str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const wxChar *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const char *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const Identifier &)=default
 
Identifieroperator= (const Identifier &)=default
 
 Identifier (wxString &&str)
 
 Identifier (Identifier &&id)
 
Identifieroperator= (Identifier &&id)
 
void swap (Identifier &id)
 
 Identifier (std::initializer_list< Identifier > components, wxChar separator)
 Convenience for building concatenated identifiers. More...
 
bool empty () const
 
size_t size () const
 
size_t length () const
 
const wxString & GET () const
 Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct. More...
 
std::vector< Identifiersplit (wxChar separator) const
 

Additional Inherited Members

- Public Types inherited from TaggedIdentifier< Tag, CaseSensitive >
using TagType = Tag
 

Detailed Description

Definition at line 23 of file Keyboard.h.

Constructor & Destructor Documentation

◆ NormalizedKeyString() [1/2]

NormalizedKeyString::NormalizedKeyString ( )
default

◆ NormalizedKeyString() [2/2]

NormalizedKeyString::NormalizedKeyString ( const wxString &  key)
explicit

Definition at line 17 of file Keyboard.cpp.

19{
20#if defined(__WXMAC__)
21 wxString newkey;
22 wxString temp = key;
23
24 // PRL: This is needed to parse older preference files.
25 temp.Replace(wxT("XCtrl+"), wxT("Control+"));
26
27 // PRL: RawCtrl is the proper replacement for Control, when formatting
28 // wxMenuItem, so that wxWidgets shows ^ in the menu. It is written into
29 // NEW preference files (2.2.0 and later).
30 temp.Replace(wxT("RawCtrl+"), wxT("Control+"));
31 temp.Replace(wxT("Ctrl+"), wxT("Command+"));
32
33 if (temp.Contains(wxT("Control+"))) {
34 newkey += wxT("RawCtrl+");
35 }
36
37 if (temp.Contains(wxT("Alt+")) || temp.Contains(wxT("Option+"))) {
38 newkey += wxT("Alt+");
39 }
40
41 if (temp.Contains(wxT("Shift+"))) {
42 newkey += wxT("Shift+");
43 }
44
45 if (temp.Contains(wxT("Command+"))) {
46 newkey += wxT("Ctrl+");
47 }
48
50 newkey + temp.AfterLast(wxT('+'));
51#else
53#endif
54}
wxT("CloseDown"))
TaggedIdentifier< NormalizedKeyStringTag, false > NormalizedKeyStringBase
Definition: Keyboard.h:21
static const AudacityProject::AttachedObjects::RegisteredFactory key
Template generates different TaggedIdentifier classes that don't interconvert implicitly.
Definition: Identifier.h:113

References key, and wxT().

Here is the call graph for this function:

Member Function Documentation

◆ Display()

wxString NormalizedKeyString::Display ( bool  usesSpecialChars = false) const

Definition at line 56 of file Keyboard.cpp.

57{
58 (void)usesSpecialChars;//compiler food
59 // using GET to manipulate key string as needed for macOS differences
60 // in displaying of it
61 auto newkey = this->GET();
62#if defined(__WXMAC__)
63
64 if (!usesSpecialChars) {
65 // Compose user-visible keystroke names, all ASCII
66 newkey.Replace(wxT("RawCtrl+"), wxT("Control+"));
67 newkey.Replace(wxT("Alt+"), wxT("Option+"));
68 newkey.Replace(wxT("Ctrl+"), wxT("Command+"));
69 }
70 else {
71 // Compose user-visible keystroke names, with special characters
72 newkey.Replace(wxT("Shift+"), wxT("\u21e7"));
73 newkey.Replace(wxT("RawCtrl+"), '^');
74 newkey.Replace(wxT("Alt+"), wxT("\u2325"));
75 newkey.Replace(wxT("Ctrl+"), wxT("\u2318"));
76 }
77
78#endif
79
80 return newkey;
81}
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

References Identifier::GET(), and wxT().

Referenced by KeyView::CmpKeyNodeByKey(), KeyView::OnDrawItem(), KeyConfigPrefs::OnFilterKeyDown(), KeyConfigPrefs::OnHotkeyKeyDown(), KeyConfigPrefs::OnHotkeyKillFocus(), KeyView::OnKeyDown(), KeyConfigPrefs::OnSelected(), SelectHandle::Preview(), KeyView::RecalcExtents(), KeyView::RefreshBindings(), KeyView::RefreshLines(), and KeyView::SetKey().

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

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