Display multi-mappings correctly in the mapping list

This commit is contained in:
Henrik Rydgård
2023-04-01 15:00:22 +02:00
parent 49a2c93b66
commit 8c9fee064e
3 changed files with 18 additions and 8 deletions
+2 -8
View File
@@ -141,18 +141,12 @@ void SingleControlMapper::Refresh() {
rows_.clear();
for (size_t i = 0; i < mappings.size(); i++) {
// TODO: Correctly handle multis.
auto &mapping = mappings[i].mappings[0];
std::string deviceName = GetDeviceName(mapping.deviceId);
std::string keyName = KeyMap::GetKeyOrAxisName(mapping);
std::string multiMappingString = mappings[i].ToVisualString();
LinearLayout *row = rightColumn->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
row->SetSpacing(2.0f);
rows_.push_back(row);
Choice *c = row->Add(new Choice(deviceName + "." + keyName, new LinearLayoutParams(FILL_PARENT, itemH, 1.0f)));
Choice *c = row->Add(new Choice(multiMappingString, new LinearLayoutParams(FILL_PARENT, itemH, 1.0f)));
c->SetTag(StringFromFormat("%d_Change%d", (int)i, pspKey_));
c->OnClick.Handle(this, &SingleControlMapper::OnReplace);