Audacity 3.2.0
Classes | Functions
MenuCreator.h File Reference
#include "Callable.h"
#include "CommandManager.h"
Include dependency graph for MenuCreator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MenuCreator
 MenuCreator is responsible for creating the main menu bar. More...
 
struct  MenuCreator::SpecialItem
 

Functions

AUDACITY_DLL_API NormalizedKeyString KeyEventToKeyString (const wxKeyEvent &keyEvent)
 

Function Documentation

◆ KeyEventToKeyString()

AUDACITY_DLL_API NormalizedKeyString KeyEventToKeyString ( const wxKeyEvent &  keyEvent)

Definition at line 698 of file MenuCreator.cpp.

699{
700 wxString newStr;
701
702 long key = event.GetKeyCode();
703
704 if (event.ControlDown())
705 newStr += wxT("Ctrl+");
706
707 if (event.AltDown())
708 newStr += wxT("Alt+");
709
710 if (event.ShiftDown())
711 newStr += wxT("Shift+");
712
713#if defined(__WXMAC__)
714 if (event.RawControlDown())
715 newStr += wxT("RawCtrl+");
716#endif
717
718 if (event.RawControlDown() && key >= 1 && key <= 26)
719 newStr += (wxChar)(64 + key);
720 else if (key >= 33 && key <= 255 && key != 127)
721 newStr += (wxChar)key;
722 else
723 {
724 switch(key)
725 {
726 case WXK_BACK:
727 newStr += wxT("Backspace");
728 break;
729 case WXK_DELETE:
730 newStr += wxT("Delete");
731 break;
732 case WXK_SPACE:
733 newStr += wxT("Space");
734 break;
735 case WXK_TAB:
736 newStr += wxT("Tab");
737 break;
738 case WXK_RETURN:
739 newStr += wxT("Return");
740 break;
741 case WXK_PAGEUP:
742 newStr += wxT("PageUp");
743 break;
744 case WXK_PAGEDOWN:
745 newStr += wxT("PageDown");
746 break;
747 case WXK_END:
748 newStr += wxT("End");
749 break;
750 case WXK_HOME:
751 newStr += wxT("Home");
752 break;
753 case WXK_LEFT:
754 newStr += wxT("Left");
755 break;
756 case WXK_UP:
757 newStr += wxT("Up");
758 break;
759 case WXK_RIGHT:
760 newStr += wxT("Right");
761 break;
762 case WXK_DOWN:
763 newStr += wxT("Down");
764 break;
765 case WXK_ESCAPE:
766 newStr += wxT("Escape");
767 break;
768 case WXK_INSERT:
769 newStr += wxT("Insert");
770 break;
771 case WXK_NUMPAD0:
772 newStr += wxT("NUMPAD0");
773 break;
774 case WXK_NUMPAD1:
775 newStr += wxT("NUMPAD1");
776 break;
777 case WXK_NUMPAD2:
778 newStr += wxT("NUMPAD2");
779 break;
780 case WXK_NUMPAD3:
781 newStr += wxT("NUMPAD3");
782 break;
783 case WXK_NUMPAD4:
784 newStr += wxT("NUMPAD4");
785 break;
786 case WXK_NUMPAD5:
787 newStr += wxT("NUMPAD5");
788 break;
789 case WXK_NUMPAD6:
790 newStr += wxT("NUMPAD6");
791 break;
792 case WXK_NUMPAD7:
793 newStr += wxT("NUMPAD7");
794 break;
795 case WXK_NUMPAD8:
796 newStr += wxT("NUMPAD8");
797 break;
798 case WXK_NUMPAD9:
799 newStr += wxT("NUMPAD9");
800 break;
801 case WXK_MULTIPLY:
802 newStr += wxT("*");
803 break;
804 case WXK_ADD:
805 newStr += wxT("+");
806 break;
807 case WXK_SUBTRACT:
808 newStr += wxT("-");
809 break;
810 case WXK_DECIMAL:
811 newStr += wxT(".");
812 break;
813 case WXK_DIVIDE:
814 newStr += wxT("/");
815 break;
816 case WXK_F1:
817 newStr += wxT("F1");
818 break;
819 case WXK_F2:
820 newStr += wxT("F2");
821 break;
822 case WXK_F3:
823 newStr += wxT("F3");
824 break;
825 case WXK_F4:
826 newStr += wxT("F4");
827 break;
828 case WXK_F5:
829 newStr += wxT("F5");
830 break;
831 case WXK_F6:
832 newStr += wxT("F6");
833 break;
834 case WXK_F7:
835 newStr += wxT("F7");
836 break;
837 case WXK_F8:
838 newStr += wxT("F8");
839 break;
840 case WXK_F9:
841 newStr += wxT("F9");
842 break;
843 case WXK_F10:
844 newStr += wxT("F10");
845 break;
846 case WXK_F11:
847 newStr += wxT("F11");
848 break;
849 case WXK_F12:
850 newStr += wxT("F12");
851 break;
852 case WXK_F13:
853 newStr += wxT("F13");
854 break;
855 case WXK_F14:
856 newStr += wxT("F14");
857 break;
858 case WXK_F15:
859 newStr += wxT("F15");
860 break;
861 case WXK_F16:
862 newStr += wxT("F16");
863 break;
864 case WXK_F17:
865 newStr += wxT("F17");
866 break;
867 case WXK_F18:
868 newStr += wxT("F18");
869 break;
870 case WXK_F19:
871 newStr += wxT("F19");
872 break;
873 case WXK_F20:
874 newStr += wxT("F20");
875 break;
876 case WXK_F21:
877 newStr += wxT("F21");
878 break;
879 case WXK_F22:
880 newStr += wxT("F22");
881 break;
882 case WXK_F23:
883 newStr += wxT("F23");
884 break;
885 case WXK_F24:
886 newStr += wxT("F24");
887 break;
888 case WXK_NUMPAD_ENTER:
889 newStr += wxT("NUMPAD_ENTER");
890 break;
891 case WXK_NUMPAD_F1:
892 newStr += wxT("NUMPAD_F1");
893 break;
894 case WXK_NUMPAD_F2:
895 newStr += wxT("NUMPAD_F2");
896 break;
897 case WXK_NUMPAD_F3:
898 newStr += wxT("NUMPAD_F3");
899 break;
900 case WXK_NUMPAD_F4:
901 newStr += wxT("NUMPAD_F4");
902 break;
903 case WXK_NUMPAD_HOME:
904 newStr += wxT("NUMPAD_HOME");
905 break;
906 case WXK_NUMPAD_LEFT:
907 newStr += wxT("NUMPAD_LEFT");
908 break;
909 case WXK_NUMPAD_UP:
910 newStr += wxT("NUMPAD_UP");
911 break;
912 case WXK_NUMPAD_RIGHT:
913 newStr += wxT("NUMPAD_RIGHT");
914 break;
915 case WXK_NUMPAD_DOWN:
916 newStr += wxT("NUMPAD_DOWN");
917 break;
918 case WXK_NUMPAD_PAGEUP:
919 newStr += wxT("NUMPAD_PAGEUP");
920 break;
921 case WXK_NUMPAD_PAGEDOWN:
922 newStr += wxT("NUMPAD_PAGEDOWN");
923 break;
924 case WXK_NUMPAD_END:
925 newStr += wxT("NUMPAD_END");
926 break;
927 case WXK_NUMPAD_BEGIN:
928 newStr += wxT("NUMPAD_HOME");
929 break;
930 case WXK_NUMPAD_INSERT:
931 newStr += wxT("NUMPAD_INSERT");
932 break;
933 case WXK_NUMPAD_DELETE:
934 newStr += wxT("NUMPAD_DELETE");
935 break;
936 case WXK_NUMPAD_EQUAL:
937 newStr += wxT("NUMPAD_EQUAL");
938 break;
939 case WXK_NUMPAD_MULTIPLY:
940 newStr += wxT("NUMPAD_MULTIPLY");
941 break;
942 case WXK_NUMPAD_ADD:
943 newStr += wxT("NUMPAD_ADD");
944 break;
945 case WXK_NUMPAD_SUBTRACT:
946 newStr += wxT("NUMPAD_SUBTRACT");
947 break;
948 case WXK_NUMPAD_DECIMAL:
949 newStr += wxT("NUMPAD_DECIMAL");
950 break;
951 case WXK_NUMPAD_DIVIDE:
952 newStr += wxT("NUMPAD_DIVIDE");
953 break;
954 default:
955 return {}; // Don't do anything if we don't recognize the key
956 }
957 }
958
959 return NormalizedKeyString{ newStr };
960}
wxT("CloseDown"))
static const AudacityProject::AttachedObjects::RegisteredFactory key

References key, and wxT().

Referenced by MenuCreator::FilterKeyEvent(), KeyConfigPrefs::OnFilterKeyDown(), and KeyConfigPrefs::OnHotkeyKeyDown().

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