From a0b904c7e8ff5f972e94b709e18fbcf1ac38c748 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Thu, 27 Apr 2017 10:09:57 +0200 Subject: [PATCH] Try on a nicer mapping workaround. --- UI/ControlMappingScreen.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 0d3e9ed32c..913e17f8df 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -47,6 +47,7 @@ private: void Refresh(); UI::EventReturn OnAdd(UI::EventParams ¶ms); + UI::EventReturn OnAddMouse(UI::EventParams ¶ms); UI::EventReturn OnDelete(UI::EventParams ¶ms); UI::EventReturn OnReplace(UI::EventParams ¶ms); UI::EventReturn OnReplaceAll(UI::EventParams ¶ms); @@ -119,6 +120,10 @@ void ControlMapper::Refresh() { Choice *p = root->Add(new Choice(" + ", new LayoutParams(WRAP_CONTENT, itemH))); p->OnClick.Handle(this, &ControlMapper::OnAdd); + if (g_Config.bMouseControl) { + Choice *p = root->Add(new Choice("M", new LayoutParams(WRAP_CONTENT, itemH))); + p->OnClick.Handle(this, &ControlMapper::OnAddMouse); + } LinearLayout *rightColumn = root->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f))); rightColumn->SetSpacing(2.0f); @@ -192,6 +197,12 @@ UI::EventReturn ControlMapper::OnAdd(UI::EventParams ¶ms) { scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); return UI::EVENT_DONE; } +UI::EventReturn ControlMapper::OnAddMouse(UI::EventParams ¶ms) { + action_ = ADD; + g_Config.bMapMouse = true; + scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); + return UI::EVENT_DONE; +} UI::EventReturn ControlMapper::OnDelete(UI::EventParams ¶ms) { int index = atoi(params.v->Tag().c_str()); @@ -218,8 +229,6 @@ void ControlMappingScreen::CreateViews() { leftColumn->Add(new Choice(km->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure); } leftColumn->Add(new Choice(km->T("Test Analogs")))->OnClick.Handle(this, &ControlMappingScreen::OnTestAnalogs); - if (g_Config.bMouseControl) - leftColumn->Add(new CheckBox(&g_Config.bMapMouse, km->T("Map Mouse"))); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f))); AddStandardBack(leftColumn);