Simulator key/mouse mapping improvements (#4175)

* [simulator] Keyboard and mouse control adjustments:
  ~ Make kay/mouse navigation more consistent between radios and ensure keyboard events are always properly detected (eg. after clicking on a control);
  * Fix mouse wheel direction for rotary encoder emulation (fixes https://github.com/opentx/opentx/issues/4160);
  * Fix page up/down buttons on Horus (also #4160);
  ~ Horus rotary encoder can now be controlled with +/- keys (also keeps X/C, otherwise supersedes https://github.com/opentx/opentx/pull/4087 );
  ~ DEL key now another alternative for ESC/BKSP (brings all controls to number pad);
  ~ "=" key now acts same as "+" key (+ requires SHIFT in main row on most US keyboards);
  * Fix controls direction when using mouse wheel over RC switches;
  + Add help text showing keyboard mappings for each radio type (activate on F1 key).

* [simulator] Enable mouse wheel scrolling on radios w/out a rotary encoder (acts as +/- keys on X9D, PU/DN keys on 9X).
This commit is contained in:
Max Paperno
2016-12-30 22:36:29 +01:00
committed by Bertrand Songis
parent 1d3b6721c6
commit 5bf7a6c28d
10 changed files with 168 additions and 32 deletions
@@ -158,6 +158,11 @@ void OpenTxSimulator::wheelEvent(int steps)
{
#if defined(ROTARY_ENCODER_NAVIGATION)
ROTARY_ENCODER_NAVIGATION_VALUE += steps * ROTARY_ENCODER_GRANULARITY;
#else
if (steps > 0)
simuSetKey(KEY_MINUS, 1);
else if (steps < 0)
simuSetKey(KEY_PLUS, 1);
#endif
}