Remove the UI::EventReturn return values. Makes editing the UI nicer.

This commit is contained in:
Henrik Rydgård
2025-09-15 11:01:02 -06:00
parent 730fd4754e
commit 58456ae950
62 changed files with 516 additions and 935 deletions
+16 -28
View File
@@ -65,11 +65,11 @@ public:
private:
void Refresh();
UI::EventReturn OnAdd(UI::EventParams &params);
UI::EventReturn OnAddMouse(UI::EventParams &params);
UI::EventReturn OnDelete(UI::EventParams &params);
UI::EventReturn OnReplace(UI::EventParams &params);
UI::EventReturn OnReplaceAll(UI::EventParams &params);
void OnAdd(UI::EventParams &params);
void OnAddMouse(UI::EventParams &params);
void OnDelete(UI::EventParams &params);
void OnReplace(UI::EventParams &params);
void OnReplaceAll(UI::EventParams &params);
void MappedCallback(const MultiInputMapping &kdf);
@@ -201,32 +201,28 @@ void SingleControlMapper::MappedCallback(const MultiInputMapping &kdf) {
g_IsMappingMouseInput = false;
}
UI::EventReturn SingleControlMapper::OnReplace(UI::EventParams &params) {
void SingleControlMapper::OnReplace(UI::EventParams &params) {
actionIndex_ = atoi(params.v->Tag().c_str());
action_ = REPLACEONE;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnReplaceAll(UI::EventParams &params) {
void SingleControlMapper::OnReplaceAll(UI::EventParams &params) {
action_ = REPLACEALL;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnAdd(UI::EventParams &params) {
void SingleControlMapper::OnAdd(UI::EventParams &params) {
action_ = ADD;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnAddMouse(UI::EventParams &params) {
void SingleControlMapper::OnAddMouse(UI::EventParams &params) {
action_ = ADD;
g_IsMappingMouseInput = true;
scrm_->push(new KeyMappingNewMouseKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
void SingleControlMapper::OnDelete(UI::EventParams &params) {
int index = atoi(params.v->Tag().c_str());
KeyMap::DeleteNthMapping(pspKey_, index);
@@ -234,7 +230,6 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
rows_[index]->SetFocus();
else
SetFocus();
return UI::EVENT_DONE;
}
@@ -263,11 +258,9 @@ void ControlMappingScreen::CreateViews() {
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, Margins(10, 0, 0, 10)));
leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Add([](UI::EventParams &) {
KeyMap::ClearAllMappings();
return UI::EVENT_DONE;
});
leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Add([](UI::EventParams &) {
KeyMap::RestoreDefault();
return UI::EVENT_DONE;
});
std::string sysName = System_GetProperty(SYSPROP_NAME);
// If there's a builtin controller, restore to default should suffice. No need to conf the controller on top.
@@ -277,7 +270,6 @@ void ControlMappingScreen::CreateViews() {
leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new VisualMappingScreen(gamePath_));
return UI::EVENT_DONE;
});
leftColumn->Add(new CheckBox(&g_Config.bAllowMappingCombos, km->T("Allow combo mappings")));
leftColumn->Add(new CheckBox(&g_Config.bStrictComboOrder, km->T("Strict combo input order")));
@@ -330,7 +322,7 @@ void ControlMappingScreen::update() {
SetVRAppMode(VRAppMode::VR_MENU_MODE);
}
UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
void ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
std::vector<std::string> items;
const auto seenPads = KeyMap::GetSeenPads();
for (auto s = seenPads.begin(), end = seenPads.end(); s != end; ++s) {
@@ -341,7 +333,6 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
if (params.v)
autoConfList->SetPopupOrigin(params.v);
screenManager()->push(autoConfList);
return UI::EVENT_DONE;
}
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
@@ -599,13 +590,12 @@ void AnalogSetupScreen::CreateViews() {
AddStandardBack(leftColumn);
}
UI::EventReturn AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) {
void AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) {
g_Config.fAnalogDeadzone = 0.15f;
g_Config.fAnalogInverseDeadzone = 0.0f;
g_Config.fAnalogSensitivity = 1.1f;
g_Config.bAnalogIsCircular = false;
g_Config.fAnalogAutoRotSpeed = 8.0f;
return UI::EVENT_DONE;
}
class Backplate : public UI::InertView {
@@ -793,7 +783,7 @@ private:
UI::AnchorLayoutParams *LayoutSize(float w, float h, float l, float t);
MockButton *AddButton(int button, ImageID img, ImageID bg, float angle, UI::LayoutParams *lp);
UI::EventReturn OnSelectButton(UI::EventParams &e);
void OnSelectButton(UI::EventParams &e);
std::unordered_map<int, MockButton *> buttons_;
UI::TextView *labelView_ = nullptr;
@@ -890,7 +880,7 @@ MockButton *MockPSP::AddButton(int button, ImageID img, ImageID bg, float angle,
return view;
}
UI::EventReturn MockPSP::OnSelectButton(UI::EventParams &e) {
void MockPSP::OnSelectButton(UI::EventParams &e) {
auto view = (MockButton *)e.v;
e.a = view->Button();
return ButtonClick.Dispatch(e);
@@ -992,17 +982,15 @@ void VisualMappingScreen::resized() {
RecreateViews();
}
UI::EventReturn VisualMappingScreen::OnMapButton(UI::EventParams &e) {
void VisualMappingScreen::OnMapButton(UI::EventParams &e) {
nextKey_ = e.a;
MapNext(false);
return UI::EVENT_DONE;
}
UI::EventReturn VisualMappingScreen::OnBindAll(UI::EventParams &e) {
void VisualMappingScreen::OnBindAll(UI::EventParams &e) {
bindAll_ = 0;
nextKey_ = bindAllOrder[bindAll_];
MapNext(false);
return UI::EVENT_DONE;
}
void VisualMappingScreen::HandleKeyMapping(const KeyMap::MultiInputMapping &key) {