From 973a013d8bf90e5083484a950a0a9db4cc0effff Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 27 Oct 2016 14:59:40 +0200 Subject: [PATCH] [ion] Simulator uses the physical keyboard Change-Id: I843faaa35931eae59bbe2d75eab36bc5820fb68e --- ion/src/simulator/keyboard/fltkkbd.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ion/src/simulator/keyboard/fltkkbd.cpp b/ion/src/simulator/keyboard/fltkkbd.cpp index 1729004ca..1a692c426 100644 --- a/ion/src/simulator/keyboard/fltkkbd.cpp +++ b/ion/src/simulator/keyboard/fltkkbd.cpp @@ -17,6 +17,19 @@ static const char* kCharForKey[Ion::Keyboard::NumberOfKeys] = { "ON", "0", ".", "(-)", "ENTER" }; +static const int kShortcutForKey[Ion::Keyboard::NumberOfKeys] = { + 0, 0, 0, 0, 0, + 0, 0, FL_Escape, FL_Left, FL_Up, + 0, 0, 0, FL_Down, FL_Right, + 0, 0, 0, FL_BackSpace, 0, + 'x', 'y', 'z', 't', '^', + '=', '(', ')', ',', '/', + 0, '7', '8', '9', '*', + 0, '4', '5', '6', '-', + 0, '1', '2', '3', '+', + 0, '0', '.', 0, FL_Enter +}; + FltkKbd::FltkKbd(int x, int y, int w, int h) : Fl_Group(x, y, w, h) { assert(KeyboardRows*KeyboardColumns == Ion::Keyboard::NumberOfKeys); int key_width = w/KeyboardColumns; @@ -27,6 +40,10 @@ FltkKbd::FltkKbd(int x, int y, int w, int h) : Fl_Group(x, y, w, h) { key_width, key_height, kCharForKey[k]); + if (kShortcutForKey[k]) { + m_buttons[k]->shortcut(kShortcutForKey[k]); + } + m_buttons[k]->clear_visible_focus(); } end(); }