From 55d3c9106f92ae745c7576dfacdb5b1f51e7474f Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Thu, 15 Aug 2019 10:12:37 +0200 Subject: [PATCH] made EventMode an enum class --- src/common/KeyMap.cxx | 22 ++--- src/common/KeyMap.hxx | 26 +++--- src/common/PJoystickHandler.cxx | 112 +++++++++++++------------- src/common/PJoystickHandler.hxx | 2 +- src/common/PKeyboardHandler.cxx | 106 ++++++++++++------------ src/common/PKeyboardHandler.hxx | 2 +- src/common/PhysicalJoystick.cxx | 20 ++--- src/debugger/gui/DebuggerDialog.cxx | 2 +- src/emucore/EventHandler.cxx | 28 +++---- src/emucore/EventHandlerConstants.hxx | 6 +- src/gui/ContextMenu.cxx | 8 +- src/gui/Dialog.cxx | 8 +- src/gui/EventMappingWidget.cxx | 2 +- src/gui/HelpDialog.cxx | 2 +- src/gui/InputDialog.cxx | 8 +- src/gui/LauncherDialog.cxx | 4 +- src/gui/ListWidget.cxx | 4 +- 17 files changed, 179 insertions(+), 183 deletions(-) diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx index 551b1a86e..8b79fea1c 100644 --- a/src/common/KeyMap.cxx +++ b/src/common/KeyMap.cxx @@ -29,7 +29,7 @@ void KeyMap::add(const Event::Type event, const Mapping& mapping) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void KeyMap::add(const Event::Type event, const int mode, const int key, const int mod) +void KeyMap::add(const Event::Type event, const EventMode mode, const int key, const int mod) { add(event, Mapping(mode, key, mod)); } @@ -41,7 +41,7 @@ void KeyMap::erase(const Mapping& mapping) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void KeyMap::erase(const int mode, const int key, const int mod) +void KeyMap::erase(const EventMode mode, const int key, const int mod) { erase(Mapping(mode, key, mod)); } @@ -69,7 +69,7 @@ Event::Type KeyMap::get(const Mapping& mapping) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Event::Type KeyMap::get(const int mode, const int key, const int mod) const +Event::Type KeyMap::get(const EventMode mode, const int key, const int mod) const { return get(Mapping(mode, key, mod)); } @@ -83,7 +83,7 @@ bool KeyMap::check(const Mapping& mapping) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool KeyMap::check(const int mode, const int key, const int mod) const +bool KeyMap::check(const EventMode mode, const int key, const int mod) const { return check(Mapping(mode, key, mod)); } @@ -138,13 +138,13 @@ string KeyMap::getDesc(const Mapping& mapping) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string KeyMap::getDesc(const int mode, const int key, const int mod) const +string KeyMap::getDesc(const EventMode mode, const int key, const int mod) const { return getDesc(Mapping(mode, key, mod)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string KeyMap::getEventMappingDesc(const Event::Type event, const int mode) const +string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode) const { ostringstream buf; @@ -161,7 +161,7 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const int mode) cons } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const int mode) const +KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const EventMode mode) const { MappingArray map; @@ -173,7 +173,7 @@ KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const int } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string KeyMap::saveMapping(const int mode) const +string KeyMap::saveMapping(const EventMode mode) const { ostringstream buf; @@ -190,7 +190,7 @@ string KeyMap::saveMapping(const int mode) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int KeyMap::loadMapping(string& list, const int mode) +int KeyMap::loadMapping(string& list, const EventMode mode) { // Since istringstream swallows whitespace, we have to make the // delimiters be spaces @@ -207,7 +207,7 @@ int KeyMap::loadMapping(string& list, const int mode) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void KeyMap::eraseMode(const int mode) +void KeyMap::eraseMode(const EventMode mode) { for (auto item = myMap.begin(); item != myMap.end();) if (item->first.mode == mode) { @@ -218,7 +218,7 @@ void KeyMap::eraseMode(const int mode) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void KeyMap::eraseEvent(const Event::Type event, const int mode) +void KeyMap::eraseEvent(const Event::Type event, const EventMode mode) { for (auto item = myMap.begin(); item != myMap.end();) if (item->second == event && item->first.mode == mode) { diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx index f69d92b1e..d789d58c7 100644 --- a/src/common/KeyMap.hxx +++ b/src/common/KeyMap.hxx @@ -41,8 +41,8 @@ class KeyMap Mapping(const Mapping& m) : mode(m.mode), key(m.key), mod(m.mod) { } explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod) : mode(c_mode), key(c_key), mod(c_mod) { } - explicit Mapping(int c_mode, int c_key, int c_mod) - : mode(EventMode(c_mode)), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { } + explicit Mapping(EventMode c_mode, int c_key, int c_mod) + : mode(c_mode), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { } bool operator==(const Mapping& other) const { @@ -62,36 +62,36 @@ class KeyMap /** Add new mapping for given event */ void add(const Event::Type event, const Mapping& mapping); - void add(const Event::Type event, const int mode, const int key, const int mod); + void add(const Event::Type event, const EventMode mode, const int key, const int mod); /** Erase mapping */ void erase(const Mapping& mapping); - void erase(const int mode, const int key, const int mod); + void erase(const EventMode mode, const int key, const int mod); /** Get event for mapping */ Event::Type get(const Mapping& mapping) const; - Event::Type get(const int mode, const int key, const int mod) const; + Event::Type get(const EventMode mode, const int key, const int mod) const; /** Check if a mapping exists */ bool check(const Mapping& mapping) const; - bool check(const int mode, const int key, const int mod) const; + bool check(const EventMode mode, const int key, const int mod) const; /** Get mapping description */ string getDesc(const Mapping& mapping) const; - string getDesc(const int mode, const int key, const int mod) const; + string getDesc(const EventMode mode, const int key, const int mod) const; /** Get the mapping description(s) for given event and mode */ - string getEventMappingDesc(const Event::Type event, const int mode) const; + string getEventMappingDesc(const Event::Type event, const EventMode mode) const; - MappingArray getEventMapping(const Event::Type event, const int mode) const; + MappingArray getEventMapping(const Event::Type event, const EventMode mode) const; - string saveMapping(const int mode) const; - int loadMapping(string& list, const int mode); + string saveMapping(const EventMode mode) const; + int loadMapping(string& list, const EventMode mode); /** Erase all mappings for given mode */ - void eraseMode(const int mode); + void eraseMode(const EventMode mode); /** Erase given event's mapping for given mode */ - void eraseEvent(const Event::Type event, const int mode); + void eraseEvent(const Event::Type event, const EventMode mode); /** clear all mappings for a modes */ // void clear() { myMap.clear(); } size_t size() { return myMap.size(); } diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index c16c4a2ac..b6db891e3 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -123,8 +123,8 @@ int PhysicalJoystickHandler::add(PhysicalJoystickPtr stick) { StickInfo info("", stick); myDatabase.emplace(stick->name, info); - setStickDefaultMapping(stick->ID, Event::NoType, kEmulationMode, true); - setStickDefaultMapping(stick->ID, Event::NoType, kMenuMode, true); + setStickDefaultMapping(stick->ID, Event::NoType, EventMode::kEmulationMode, true); + setStickDefaultMapping(stick->ID, Event::NoType, EventMode::kMenuMode, true); } return stick->ID; @@ -275,36 +275,36 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even { switch (mode) { - case kEmulationMode: + case EventMode::kEmulationMode: if ((stick % 2) == 0) // even sticks { // put all controller events into their own mode's mappings for (const auto& item : DefaultLeftJoystickMapping) - setDefaultAction(j, item, event, kJoystickMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kJoystickMode, updateDefaults); for (const auto& item : DefaultLeftPaddlesMapping) - setDefaultAction(j, item, event, kPaddlesMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kPaddlesMode, updateDefaults); for (const auto& item : DefaultLeftKeypadMapping) - setDefaultAction(j, item, event, kKeypadMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kKeypadMode, updateDefaults); } else // odd sticks { // put all controller events into their own mode's mappings for (const auto& item : DefaultRightJoystickMapping) - setDefaultAction(j, item, event, kJoystickMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kJoystickMode, updateDefaults); for (const auto& item : DefaultRightPaddlesMapping) - setDefaultAction(j, item, event, kPaddlesMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kPaddlesMode, updateDefaults); for (const auto& item : DefaultRightKeypadMapping) - setDefaultAction(j, item, event, kKeypadMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kKeypadMode, updateDefaults); } for(const auto& item : DefaultCommonMapping) - setDefaultAction(j, item, event, kCommonMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kCommonMode, updateDefaults); // update running emulation mapping too enableEmulationMappings(); break; - case kMenuMode: + case EventMode::kMenuMode: for (const auto& item : DefaultMenuMapping) - setDefaultAction(j, item, event, kMenuMode, updateDefaults); + setDefaultAction(j, item, event, EventMode::kMenuMode, updateDefaults); break; default: @@ -328,27 +328,27 @@ void PhysicalJoystickHandler::defineControllerMappings(const string& controllerN if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD")) { if (port == Controller::Jack::Left) - myLeftMode = kKeypadMode; + myLeftMode = EventMode::kKeypadMode; else - myRightMode = kKeypadMode; + myRightMode = EventMode::kKeypadMode; } else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES")) { if (port == Controller::Jack::Left) - myLeftMode = kPaddlesMode; + myLeftMode = EventMode::kPaddlesMode; else - myRightMode = kPaddlesMode; + myRightMode = EventMode::kPaddlesMode; } else if (controllerName == "CM") { - myLeftMode = myRightMode = kCompuMateMode; + myLeftMode = myRightMode = EventMode::kCompuMateMode; } else { if (port == Controller::Jack::Left) - myLeftMode = kJoystickMode; + myLeftMode = EventMode::kJoystickMode; else - myRightMode = kJoystickMode; + myRightMode = EventMode::kJoystickMode; } } @@ -360,7 +360,7 @@ void PhysicalJoystickHandler::enableEmulationMappings() const PhysicalJoystickPtr j = stick.second; // start from scratch and enable common mappings - j->joyMap.eraseMode(kEmulationMode); + j->joyMap.eraseMode(EventMode::kEmulationMode); } enableCommonMappings(); @@ -368,31 +368,31 @@ void PhysicalJoystickHandler::enableEmulationMappings() // enable right mode first, so that in case of mapping clashes the left controller has preference switch (myRightMode) { - case kPaddlesMode: - enableMappings(RightPaddlesEvents, kPaddlesMode); + case EventMode::kPaddlesMode: + enableMappings(RightPaddlesEvents, EventMode::kPaddlesMode); break; - case kKeypadMode: - enableMappings(RightKeypadEvents, kKeypadMode); + case EventMode::kKeypadMode: + enableMappings(RightKeypadEvents, EventMode::kKeypadMode); break; default: - enableMappings(RightJoystickEvents, kJoystickMode); + enableMappings(RightJoystickEvents, EventMode::kJoystickMode); break; } switch (myLeftMode) { - case kPaddlesMode: - enableMappings(LeftPaddlesEvents, kPaddlesMode); + case EventMode::kPaddlesMode: + enableMappings(LeftPaddlesEvents, EventMode::kPaddlesMode); break; - case kKeypadMode: - enableMappings(LeftKeypadEvents, kKeypadMode); + case EventMode::kKeypadMode: + enableMappings(LeftKeypadEvents, EventMode::kKeypadMode); break; default: - enableMappings(LeftJoystickEvents, kJoystickMode); + enableMappings(LeftJoystickEvents, EventMode::kJoystickMode); break; } } @@ -405,7 +405,7 @@ void PhysicalJoystickHandler::enableCommonMappings() Event::Type event = static_cast(i); if (isCommonEvent(event)) - enableMapping(event, kCommonMode); + enableMapping(event, EventMode::kCommonMode); } } @@ -427,26 +427,26 @@ void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode m JoyMap::JoyMappingArray joyMappings = j->joyMap.getEventMapping(event, mode); for (const auto& mapping : joyMappings) - j->joyMap.add(event, kEmulationMode, mapping.button, mapping.axis, mapping.adir); + j->joyMap.add(event, EventMode::kEmulationMode, mapping.button, mapping.axis, mapping.adir); } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const EventMode mode) const { - if (mode == kEmulationMode) + if (mode == EventMode::kEmulationMode) { if (isJoystickEvent(event)) - return kJoystickMode; + return EventMode::kJoystickMode; if (isPaddleEvent(event)) - return kPaddlesMode; + return EventMode::kPaddlesMode; if (isKeypadEvent(event)) - return kKeypadMode; + return EventMode::kKeypadMode; if (isCommonEvent(event)) - return kCommonMode; + return EventMode::kCommonMode; } return mode; @@ -489,12 +489,12 @@ void PhysicalJoystickHandler::eraseMapping(Event::Type event, EventMode mode) for (auto& stick : mySticks) { stick.second->eraseMap(mode); // erase all events - if (mode == kEmulationMode) + if (mode == EventMode::kEmulationMode) { - stick.second->eraseMap(kCommonMode); - stick.second->eraseMap(kJoystickMode); - stick.second->eraseMap(kPaddlesMode); - stick.second->eraseMap(kKeypadMode); + stick.second->eraseMap(EventMode::kCommonMode); + stick.second->eraseMap(EventMode::kJoystickMode); + stick.second->eraseMap(EventMode::kPaddlesMode); + stick.second->eraseMap(EventMode::kKeypadMode); } } } @@ -567,7 +567,7 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i { j->joyMap.add(event, evMode, button, axis, JoyDir::ANALOG); // update running emulation mapping too - j->joyMap.add(event, kEmulationMode, button, axis, JoyDir::ANALOG); + j->joyMap.add(event, EventMode::kEmulationMode, button, axis, JoyDir::ANALOG); } else { @@ -576,9 +576,9 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i j->joyMap.erase(evMode, button, axis, JoyDir::ANALOG); j->joyMap.add(event, evMode, button, axis, convertAxisValue(value)); // update running emulation mapping too - if(Event::isAnalog(j->joyMap.get(kEmulationMode, button, axis, JoyDir::ANALOG))) - j->joyMap.erase(kEmulationMode, button, axis, JoyDir::ANALOG); - j->joyMap.add(event, kEmulationMode, button, axis, convertAxisValue(value)); + if(Event::isAnalog(j->joyMap.get(EventMode::kEmulationMode, button, axis, JoyDir::ANALOG))) + j->joyMap.erase(EventMode::kEmulationMode, button, axis, JoyDir::ANALOG); + j->joyMap.add(event, EventMode::kEmulationMode, button, axis, convertAxisValue(value)); } return true; } @@ -597,7 +597,7 @@ bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode { j->joyMap.add(event, getEventMode(event, mode), button, hat, dir); // update running emulation mapping too - j->joyMap.add(event, kEmulationMode, button, hat, dir); + j->joyMap.add(event, EventMode::kEmulationMode, button, hat, dir); return true; } return false; @@ -614,7 +614,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value) if (myHandler.state() == EventHandlerState::EMULATION) { - Event::Type eventAxisAnalog = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG); + Event::Type eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG); // Check for analog events, which are handled differently if (Event::isAnalog(eventAxisAnalog)) @@ -625,8 +625,8 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value) { // Otherwise, we know the event is digital // Every axis event has two associated values, negative and positive - Event::Type eventAxisNeg = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::NEG); - Event::Type eventAxisPos = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::POS); + Event::Type eventAxisNeg = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::NEG); + Event::Type eventAxisPos = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::POS); if (value > Joystick::deadzone()) myHandler.handleEvent(eventAxisPos); @@ -684,12 +684,12 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE; // Handle buttons which switch eventhandler state - if (pressed && myHandler.changeStateByEvent(j->joyMap.get(kEmulationMode, button))) + if (pressed && myHandler.changeStateByEvent(j->joyMap.get(EventMode::kEmulationMode, button))) return; // Determine which mode we're in, then send the event to the appropriate place if (myHandler.state() == EventHandlerState::EMULATION) - myHandler.handleEvent(j->joyMap.get(kEmulationMode, button), pressed); + myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button), pressed); #ifdef GUI_SUPPORT else if (myHandler.hasOverlay()) myHandler.overlay().handleJoyBtnEvent(stick, button, pressed); @@ -712,13 +712,13 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value) if (myHandler.state() == EventHandlerState::EMULATION) { - myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::UP), + myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::UP), value & EVENT_HATUP_M); - myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::RIGHT), + myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::RIGHT), value & EVENT_HATRIGHT_M); - myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::DOWN), + myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::DOWN), value & EVENT_HATDOWN_M); - myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::LEFT), + myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::LEFT), value & EVENT_HATLEFT_M); } #ifdef GUI_SUPPORT diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index 81f90f7ea..c12081412 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -150,7 +150,7 @@ class PhysicalJoystickHandler void setDefaultAction(const PhysicalJoystickPtr& j, EventMapping map, Event::Type event = Event::NoType, - EventMode mode = kEmulationMode, bool updateDefaults = false); + EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false); /** returns the event's controller mode */ EventMode getEventMode(const Event::Type event, const EventMode mode) const; diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 6b66e6451..cd837d7ac 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -53,20 +53,20 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler& if (version == Event::VERSION) { string list = myOSystem.settings().getString("keymap_emu"); - myKeyMap.loadMapping(list, kCommonMode); + myKeyMap.loadMapping(list, EventMode::kCommonMode); list = myOSystem.settings().getString("keymap_joy"); - myKeyMap.loadMapping(list, kJoystickMode); + myKeyMap.loadMapping(list, EventMode::kJoystickMode); list = myOSystem.settings().getString("keymap_pad"); - myKeyMap.loadMapping(list, kPaddlesMode); + myKeyMap.loadMapping(list, EventMode::kPaddlesMode); list = myOSystem.settings().getString("keymap_key"); - myKeyMap.loadMapping(list, kKeypadMode); + myKeyMap.loadMapping(list, EventMode::kKeypadMode); list = myOSystem.settings().getString("keymap_ui"); - myKeyMap.loadMapping(list, kMenuMode); + myKeyMap.loadMapping(list, EventMode::kMenuMode); } myKeyMap.enableMod() = myOSystem.settings().getBool("modcombo"); - setDefaultMapping(Event::NoType, kEmulationMode, true); - setDefaultMapping(Event::NoType, kMenuMode, true); + setDefaultMapping(Event::NoType, EventMode::kEmulationMode, true); + setDefaultMapping(Event::NoType, EventMode::kMenuMode, true); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -114,23 +114,23 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: for (const auto& item: DefaultCommonMapping) - setDefaultKey(item, event, kCommonMode, updateDefaults); + setDefaultKey(item, event, EventMode::kCommonMode, updateDefaults); // put all controller events into their own mode's mappings for (const auto& item: DefaultJoystickMapping) - setDefaultKey(item, event, kJoystickMode, updateDefaults); + setDefaultKey(item, event, EventMode::kJoystickMode, updateDefaults); for (const auto& item: DefaultPaddleMapping) - setDefaultKey(item, event, kPaddlesMode, updateDefaults); + setDefaultKey(item, event, EventMode::kPaddlesMode, updateDefaults); for (const auto& item: DefaultKeypadMapping) - setDefaultKey(item, event, kKeypadMode, updateDefaults); + setDefaultKey(item, event, EventMode::kKeypadMode, updateDefaults); for (const auto& item : CompuMateMapping) - setDefaultKey(item, event, kCompuMateMode, updateDefaults); + setDefaultKey(item, event, EventMode::kCompuMateMode, updateDefaults); break; - case kMenuMode: + case EventMode::kMenuMode: for (const auto& item: DefaultMenuMapping) - setDefaultKey(item, event, kMenuMode, updateDefaults); + setDefaultKey(item, event, EventMode::kMenuMode, updateDefaults); break; default: @@ -145,27 +145,27 @@ void PhysicalKeyboardHandler::defineControllerMappings(const string& controllerN if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD")) { if (port == Controller::Jack::Left) - myLeftMode = kKeypadMode; + myLeftMode = EventMode::kKeypadMode; else - myRightMode = kKeypadMode; + myRightMode = EventMode::kKeypadMode; } else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES")) { if (port == Controller::Jack::Left) - myLeftMode = kPaddlesMode; + myLeftMode = EventMode::kPaddlesMode; else - myRightMode = kPaddlesMode; + myRightMode = EventMode::kPaddlesMode; } else if (controllerName == "CM") { - myLeftMode = myRightMode = kCompuMateMode; + myLeftMode = myRightMode = EventMode::kCompuMateMode; } else { if (port == Controller::Jack::Left) - myLeftMode = kJoystickMode; + myLeftMode = EventMode::kJoystickMode; else - myRightMode = kJoystickMode; + myRightMode = EventMode::kJoystickMode; } } @@ -173,46 +173,46 @@ void PhysicalKeyboardHandler::defineControllerMappings(const string& controllerN void PhysicalKeyboardHandler::enableEmulationMappings() { // start from scratch and enable common mappings - myKeyMap.eraseMode(kEmulationMode); + myKeyMap.eraseMode(EventMode::kEmulationMode); enableCommonMappings(); // enable right mode first, so that in case of mapping clashes the left controller has preference switch (myRightMode) { - case kPaddlesMode: - enableMappings(RightPaddlesEvents, kPaddlesMode); + case EventMode::kPaddlesMode: + enableMappings(RightPaddlesEvents, EventMode::kPaddlesMode); break; - case kKeypadMode: - enableMappings(RightKeypadEvents, kKeypadMode); + case EventMode::kKeypadMode: + enableMappings(RightKeypadEvents, EventMode::kKeypadMode); break; - case kCompuMateMode: + case EventMode::kCompuMateMode: // see below break; default: - enableMappings(RightJoystickEvents, kJoystickMode); + enableMappings(RightJoystickEvents, EventMode::kJoystickMode); break; } switch (myLeftMode) { - case kPaddlesMode: - enableMappings(LeftPaddlesEvents, kPaddlesMode); + case EventMode::kPaddlesMode: + enableMappings(LeftPaddlesEvents, EventMode::kPaddlesMode); break; - case kKeypadMode: - enableMappings(LeftKeypadEvents, kKeypadMode); + case EventMode::kKeypadMode: + enableMappings(LeftKeypadEvents, EventMode::kKeypadMode); break; - case kCompuMateMode: + case EventMode::kCompuMateMode: for (const auto& item : CompuMateMapping) - enableMapping(item.event, kCompuMateMode); + enableMapping(item.event, EventMode::kCompuMateMode); break; default: - enableMappings(LeftJoystickEvents, kJoystickMode); + enableMappings(LeftJoystickEvents, EventMode::kJoystickMode); break; } } @@ -225,7 +225,7 @@ void PhysicalKeyboardHandler::enableCommonMappings() Event::Type event = static_cast(i); if (isCommonEvent(event)) - enableMapping(event, kCommonMode); + enableMapping(event, EventMode::kCommonMode); } } @@ -243,25 +243,25 @@ void PhysicalKeyboardHandler::enableMapping(const Event::Type event, EventMode m KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode); for (const auto& mapping : mappings) - myKeyMap.add(event, kEmulationMode, mapping.key, mapping.mod); + myKeyMap.add(event, EventMode::kEmulationMode, mapping.key, mapping.mod); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event, const EventMode mode) const { - if (mode == kEmulationMode) + if (mode == EventMode::kEmulationMode) { if (isJoystickEvent(event)) - return kJoystickMode; + return EventMode::kJoystickMode; if (isPaddleEvent(event)) - return kPaddlesMode; + return EventMode::kPaddlesMode; if (isKeypadEvent(event)) - return kKeypadMode; + return EventMode::kKeypadMode; if (isCommonEvent(event)) - return kCommonMode; + return EventMode::kCommonMode; } return mode; @@ -305,11 +305,11 @@ void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode) void PhysicalKeyboardHandler::saveMapping() { myOSystem.settings().setValue("event_ver", Event::VERSION); - myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(kCommonMode)); - myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(kJoystickMode)); - myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(kPaddlesMode)); - myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(kKeypadMode)); - myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(kMenuMode)); + myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(EventMode::kCommonMode)); + myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(EventMode::kJoystickMode)); + myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(EventMode::kPaddlesMode)); + myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(EventMode::kKeypadMode)); + myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(EventMode::kMenuMode)); enableEmulationMappings(); } @@ -357,10 +357,10 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre if ((estate == EventHandlerState::EMULATION || estate == EventHandlerState::PAUSE) && myOSystem.console().leftController().type() == Controller::Type::CompuMate) { - Event::Type event = myKeyMap.get(kCompuMateMode, key, mod); + Event::Type event = myKeyMap.get(EventMode::kCompuMateMode, key, mod); // (potential) CompuMate events are handled directly. - if (myKeyMap.get(kEmulationMode, key, mod) != Event::ExitMode && + if (myKeyMap.get(EventMode::kEmulationMode, key, mod) != Event::ExitMode && !StellaModTest::isAlt(mod) && event != Event::NoType) { myHandler.handleEvent(event, pressed, repeated); @@ -370,7 +370,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre // Arrange the logic to take advantage of short-circuit evaluation // Handle keys which switch eventhandler state - if (!pressed && myHandler.changeStateByEvent(myKeyMap.get(kEmulationMode, key, mod))) + if (!pressed && myHandler.changeStateByEvent(myKeyMap.get(EventMode::kEmulationMode, key, mod))) return; // Otherwise, let the event handler deal with it @@ -378,7 +378,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre { case EventHandlerState::EMULATION: case EventHandlerState::PAUSE: - myHandler.handleEvent(myKeyMap.get(kEmulationMode, key, mod), pressed, repeated); + myHandler.handleEvent(myKeyMap.get(EventMode::kEmulationMode, key, mod), pressed, repeated); break; default: @@ -386,7 +386,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre if (myHandler.hasOverlay()) myHandler.overlay().handleKeyEvent(key, mod, pressed, repeated); #endif - myHandler.handleEvent(myKeyMap.get(kMenuMode, key, mod), pressed, repeated); + myHandler.handleEvent(myKeyMap.get(EventMode::kMenuMode, key, mod), pressed, repeated); break; } } diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx index fa7f135b2..d24d3ca17 100644 --- a/src/common/PKeyboardHandler.hxx +++ b/src/common/PKeyboardHandler.hxx @@ -88,7 +88,7 @@ class PhysicalKeyboardHandler using EventMappingArray = std::vector; void setDefaultKey(EventMapping map, Event::Type event = Event::NoType, - EventMode mode = kEmulationMode, bool updateDefaults = false); + EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false); /** returns the event's controller mode */ EventMode getEventMode(const Event::Type event, const EventMode mode) const; diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index d36e31cd2..3b977d058 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -67,11 +67,11 @@ void PhysicalJoystick::initialize(int index, const string& desc, axisLastValue[a] = 0; // Erase the mappings - eraseMap(kMenuMode); - eraseMap(kJoystickMode); - eraseMap(kPaddlesMode); - eraseMap(kKeypadMode); - eraseMap(kCommonMode); + eraseMap(EventMode::kMenuMode); + eraseMap(EventMode::kJoystickMode); + eraseMap(EventMode::kPaddlesMode); + eraseMap(EventMode::kKeypadMode); + eraseMap(EventMode::kCommonMode); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -83,11 +83,11 @@ string PhysicalJoystick::getMap() const ostringstream joybuf; joybuf << name; - joybuf << MODE_DELIM << int(kMenuMode) << "|" << joyMap.saveMapping(kMenuMode); - joybuf << MODE_DELIM << int(kJoystickMode) << "|" << joyMap.saveMapping(kJoystickMode); - joybuf << MODE_DELIM << int(kPaddlesMode) << "|" << joyMap.saveMapping(kPaddlesMode); - joybuf << MODE_DELIM << int(kKeypadMode) << "|" << joyMap.saveMapping(kKeypadMode); - joybuf << MODE_DELIM << int(kCommonMode) << "|" << joyMap.saveMapping(kCommonMode); + joybuf << MODE_DELIM << int(EventMode::kMenuMode) << "|" << joyMap.saveMapping(EventMode::kMenuMode); + joybuf << MODE_DELIM << int(EventMode::kJoystickMode) << "|" << joyMap.saveMapping(EventMode::kJoystickMode); + joybuf << MODE_DELIM << int(EventMode::kPaddlesMode) << "|" << joyMap.saveMapping(EventMode::kPaddlesMode); + joybuf << MODE_DELIM << int(EventMode::kKeypadMode) << "|" << joyMap.saveMapping(EventMode::kKeypadMode); + joybuf << MODE_DELIM << int(EventMode::kCommonMode) << "|" << joyMap.saveMapping(EventMode::kCommonMode); return joybuf.str(); } diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index e42f955ec..e76271f5b 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -124,7 +124,7 @@ void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) } // handle emulation keys second (can be remapped) - Event::Type event = instance().eventHandler().eventForKey(kEmulationMode, key, mod); + Event::Type event = instance().eventHandler().eventForKey(EventMode::kEmulationMode, key, mod); switch (event) { // events which can be handled 1:1 diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index dde0e1056..342b9fede 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -92,8 +92,8 @@ void EventHandler::initialize() // Make sure the event/action mappings are correctly set, // and fill the ActionList structure with valid values setComboMap(); - setActionMappings(kEmulationMode); - setActionMappings(kMenuMode); + setActionMappings(EventMode::kEmulationMode); + setActionMappings(EventMode::kMenuMode); Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone")); Paddles::setDejitterBase(myOSystem.settings().getInt("dejitter.base")); @@ -154,8 +154,8 @@ void EventHandler::addPhysicalJoystick(PhysicalJoystickPtr joy) if(ID < 0) return; - setActionMappings(kEmulationMode); - setActionMappings(kMenuMode); + setActionMappings(EventMode::kEmulationMode); + setActionMappings(EventMode::kMenuMode); ostringstream buf; buf << "Added joystick " << ID << ":" << endl @@ -1026,11 +1026,11 @@ void EventHandler::setActionMappings(EventMode mode) switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: listsize = EMUL_ACTIONLIST_SIZE; list = ourEmulActionList; break; - case kMenuMode: + case EventMode::kMenuMode: listsize = MENU_ACTIONLIST_SIZE; list = ourMenuActionList; break; @@ -1236,11 +1236,11 @@ StringList EventHandler::getActionList(EventMode mode) const StringList l; switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: for(uInt32 i = 0; i < EMUL_ACTIONLIST_SIZE; ++i) l.push_back(EventHandler::ourEmulActionList[i].action); break; - case kMenuMode: + case EventMode::kMenuMode: for(uInt32 i = 0; i < MENU_ACTIONLIST_SIZE; ++i) l.push_back(EventHandler::ourMenuActionList[i].action); break; @@ -1324,12 +1324,12 @@ Event::Type EventHandler::eventAtIndex(int idx, EventMode mode) const { switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE) return Event::NoType; else return ourEmulActionList[idx].event; - case kMenuMode: + case EventMode::kMenuMode: if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE) return Event::NoType; else @@ -1344,12 +1344,12 @@ string EventHandler::actionAtIndex(int idx, EventMode mode) const { switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE) return EmptyString; else return ourEmulActionList[idx].action; - case kMenuMode: + case EventMode::kMenuMode: if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE) return EmptyString; else @@ -1364,12 +1364,12 @@ string EventHandler::keyAtIndex(int idx, EventMode mode) const { switch(mode) { - case kEmulationMode: + case EventMode::kEmulationMode: if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE) return EmptyString; else return ourEmulActionList[idx].key; - case kMenuMode: + case EventMode::kMenuMode: if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE) return EmptyString; else diff --git a/src/emucore/EventHandlerConstants.hxx b/src/emucore/EventHandlerConstants.hxx index d0b1e373d..7b06e94f1 100644 --- a/src/emucore/EventHandlerConstants.hxx +++ b/src/emucore/EventHandlerConstants.hxx @@ -72,12 +72,8 @@ enum JoyHatMask { }; static const int NUM_PORTS = 2; -static const int NUM_JOY_AXIS = 2; -static const int NUM_JOY_DIRS = 2; -static const int NUM_JOY_HAT_DIRS = 4; -// TODO - make this 'enum class' somehow -enum EventMode { +enum class EventMode { kEmulationMode, // active mapping used for emulation kMenuMode, // mapping used for dialogs kJoystickMode, // 4 extra modes for mapping controller keys separately for emulation mode diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index c801fa550..d15c78a05 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -282,26 +282,26 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) { - handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod)); + handleEvent(instance().eventHandler().eventForKey(EventMode::kMenuMode, key, mod)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::handleJoyDown(int stick, int button, bool longPress) { - handleEvent(instance().eventHandler().eventForJoyButton(kMenuMode, stick, button)); + handleEvent(instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::handleJoyAxis(int stick, int axis, int value, int button) { if(value != 0) // we don't care about 'axis up' events - handleEvent(instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button)); + handleEvent(instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool ContextMenu::handleJoyHat(int stick, int hat, JoyHat value, int button) { - handleEvent(instance().eventHandler().eventForJoyHat(kMenuMode, stick, hat, value, button)); + handleEvent(instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button)); return true; } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 4aaafb58f..a7cf9cc0e 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -459,7 +459,7 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) // Check the keytable now, since we might get one of the above events, // which must always be processed before any widget sees it. if(e == Event::NoType) - e = instance().eventHandler().eventForKey(kMenuMode, key, mod); + e = instance().eventHandler().eventForKey(EventMode::kMenuMode, key, mod); // Unless a widget has claimed all responsibility for data, we assume // that if an event exists for the given data, it should have priority. @@ -591,7 +591,7 @@ bool Dialog::handleMouseClicks(int x, int y, MouseButton b) void Dialog::handleJoyDown(int stick, int button, bool longPress) { Event::Type e = - instance().eventHandler().eventForJoyButton(kMenuMode, stick, button); + instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button); // Unless a widget has claimed all responsibility for data, we assume // that if an event exists for the given data, it should have priority. @@ -615,7 +615,7 @@ void Dialog::handleJoyUp(int stick, int button) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event::Type Dialog::getJoyAxisEvent(int stick, int axis, int value, int button) { - return instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button); + return instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -638,7 +638,7 @@ void Dialog::handleJoyAxis(int stick, int axis, int value, int button) bool Dialog::handleJoyHat(int stick, int hat, JoyHat value, int button) { Event::Type e = - instance().eventHandler().eventForJoyHat(kMenuMode, stick, hat, value, button); + instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button); // Unless a widget has claimed all responsibility for data, we assume // that if an event exists for the given data, it should have priority. diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index 06759f26e..6361948dd 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -96,7 +96,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, myResetButton->setTarget(this); addFocusWidget(myResetButton); - if(mode == kEmulationMode) + if(mode == EventMode::kEmulationMode) { ypos += lineHeight + 20; myComboButton = new ButtonWidget(boss, font, xpos, ypos, diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index a18e663c6..5716b5495 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -93,7 +93,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title) }; auto ADD_EVENT = [&](const Event::Type e, const string & d) { - string desc = instance().eventHandler().getMappingDesc(e, kEmulationMode); + string desc = instance().eventHandler().getMappingDesc(e, EventMode::kEmulationMode); ADD_BIND(desc.length() ? desc : "None", d); }; auto ADD_TEXT = [&](const string& d) { ADD_BIND("", d); }; diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 89d10279c..d4db36abb 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -60,21 +60,21 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, // 1) Event mapper for emulation actions tabID = myTab->addTab(" Emulation Events ", TabWidget::AUTO_WIDTH); - actions = instance().eventHandler().getActionList(kEmulationMode); + actions = instance().eventHandler().getActionList(EventMode::kEmulationMode); myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2, myTab->getWidth(), myTab->getHeight() - 4, - actions, kEmulationMode); + actions, EventMode::kEmulationMode); myTab->setParentWidget(tabID, myEmulEventMapper); addToFocusList(myEmulEventMapper->getFocusList(), myTab, tabID); // 2) Event mapper for UI actions tabID = myTab->addTab(" UI Events ", TabWidget::AUTO_WIDTH); - actions = instance().eventHandler().getActionList(kMenuMode); + actions = instance().eventHandler().getActionList(EventMode::kMenuMode); myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2, myTab->getWidth(), myTab->getHeight() - 4, - actions, kMenuMode); + actions, EventMode::kMenuMode); myTab->setParentWidget(tabID, myMenuEventMapper); addToFocusList(myMenuEventMapper->getFocusList(), myTab, tabID); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 3b424df51..95e3bb292 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -470,7 +470,7 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) void LauncherDialog::handleJoyDown(int stick, int button, bool longPress) { // open power-up options and settings for 2nd and 4th button if not mapped otherwise - Event::Type e = instance().eventHandler().eventForJoyButton(kMenuMode, stick, button); + Event::Type e = instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button); if (button == 1 && (e == Event::UIOK || e == Event::NoType)) myGlobalProps->open(); @@ -495,7 +495,7 @@ void LauncherDialog::handleJoyUp(int stick, int button) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event::Type LauncherDialog::getJoyAxisEvent(int stick, int axis, int value, int button) { - Event::Type e = instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button); + Event::Type e = instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button); if(myUseMinimalUI) { diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index 82004107c..2ee285d98 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -330,7 +330,7 @@ void ListWidget::handleJoyDown(int stick, int button, bool longPress) if (longPress) sendCommand(ListWidget::kLongButtonPressCmd, _selectedItem, _id); - Event::Type e = _boss->instance().eventHandler().eventForJoyButton(kMenuMode, stick, button); + Event::Type e = _boss->instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button); // handle UISelect event on button up if(e != Event::UISelect) @@ -340,7 +340,7 @@ void ListWidget::handleJoyDown(int stick, int button, bool longPress) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::handleJoyUp(int stick, int button) { - Event::Type e = _boss->instance().eventHandler().eventForJoyButton(kMenuMode, stick, button); + Event::Type e = _boss->instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button); // handle UISelect event on button up if(e == Event::UISelect)