32#include <wx/stattext.h>
40static inline wxString U8(
const char* s) {
return wxString::FromUTF8(s); }
49 : wxButton(parent, wxID_OK, _(
"Browse manual")) {
50 Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent) {
52 Manual(
this, datadir.ToStdString()).Launch(
"Hotkeys");
60 CloseButton(wxDialog* parent) : wxButton(parent, wxID_CLOSE) {
61 Bind(wxEVT_COMMAND_BUTTON_CLICKED,
62 [parent](wxCommandEvent) { parent->EndModal(wxID_OK); });
66 ButtonsSizer(wxDialog* parent) : wxStdDialogButtonSizer() {
76 static constexpr int kGridSize{4};
77 static constexpr int kNumMsgs{12};
78 using MsgLine = std::array<wxString, kGridSize>;
79 using Messages = std::array<MsgLine, kNumMsgs>;
82 GridSizer(wxWindow* parent) : wxGridSizer(kGridSize) {
83 const auto osSystemId = wxPlatformInfo::Get().GetOperatingSystemId();
84 const Messages& kMessages =
85 (osSystemId & wxOS_MAC) ? kMacMessages : kWinLinuxMessages;
87 for (
const MsgLine& line : kMessages)
88 for (
const wxString& word : line)
89 Add(
new wxStaticText(parent, wxID_ANY, word),
90 wxSizerFlags().DoubleBorder());
96 const Messages kWinLinuxMessages{
98 {{_(
"Zoom in"),
"+, PgUp",
99 _(
"Zoom out"),
"-, PgDown"},
100 {_(
"Fine zoom in"),
"Alt +",
101 _(
"Fine zoom out"),
"Alt -"},
102 {_(
"Fine zoom"), _(
"Ctrl scroll-wheel"),
104 {_(
"Panning"), U8(
"→ ← ↑ ↓")
105 , _(
"Slow panning"), U8(
"Alt → ← ↑ ↓")},
106 {_(
"Larger scale chart"), U8(
"Ctrl ←, F7"),
107 _(
"Smaller scale chart"), U8(
"Ctrl →, F8")},
108 {_(
"Toggle quilting "),
"Q, F9",
109 _(
"Toggle auto-follow"),
"Ctrl A, F2"},
110 {_(
"Toggle outlines"),
"O, F12",
111 _(
"Toggle range rings"),
"R"},
112 {_(
"Toggle chart bar"),
"Ctrl B",
113 _(
"Change color scheme"),
"Ctrl-G, F5"},
114 {_(
"Toggle full screen"),
"F11",
117 {_(
"Start measure mode"),
"M, F4",
118 _(
"Stop measure mode"),
"Esc"},
119 {_(
"Drop mark"), _(
"Ctrl O, space bar"),
120 _(
"Open Data Monitor"),
"E"}}};
122 const Messages kMacMessages{
123 {{_(
"Zoom in"),
"+, PgUp",
124 _(
"Zoom out"),
"-, PgDown"},
125 {_(
"Fine zoom in"),
"Alt +",
126 _(
"Fine zoom out"),
"Alt -"},
127 {_(
"Fine zoom"), _(
"Ctrl scroll-wheel"),
129 {_(
"Panning"), U8(
"→ ← ↑ ↓")
130 , _(
"Slow panning"), U8(
"Alt → ← ↑ ↓")},
131 {_(
"Larger scale chart"), U8(
"Cmd ←, F7"),
132 _(
"Smaller scale chart"), U8(
"Cmd →, F8")},
133 {_(
"Toggle quilting "),
"Q, F9",
134 _(
"Toggle auto-follow"),
"Cmd A"},
135 {_(
"Toggle outlines"),
"O, F12",
136 _(
"Toggle range rings"),
"R"},
137 {_(
"Toggle chart bar"),
"Ctrl B",
138 _(
"Change color scheme"),
"Ctrl-G, F5"},
139 {_(
"Toggle full screen"),
"Ctrl Cmd F",
142 {_(
"Start measure mode"),
"F4",
143 _(
"Stop measure mode"),
"Esc"},
144 {_(
"Drop mark"), _(
"Ctrl O, space bar"),
145 _(
"Open Data Monitor"),
"E"}}};
148HotkeysDlg::HotkeysDlg(wxWindow* parent)
149 : wxDialog(parent, wxID_ANY, _(
"Keyboard Shortcuts")) {
150 auto vbox =
new wxBoxSizer(wxVERTICAL);
151 auto flags = wxSizerFlags().DoubleBorder();
152 vbox->Add(
new GridSizer(
this), flags.Expand());
153 vbox->Add(
new wxStaticText(
this, wxID_ANY,
154 _(
"More keys are available in the manual.")),
155 wxSizerFlags().DoubleBorder().Centre());
160 Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent&) { EndModal(wxID_OK); });
Overall help message: key functions and bindings in a string matrix.
Hotheys help dialog (the '?' button).
PlugIn Object Definition/API.