From 6d290f453061dbd4ece38e673a91b0281fca3494 Mon Sep 17 00:00:00 2001 From: Daniel Dressler Date: Wed, 3 Jul 2013 22:29:18 -0700 Subject: [PATCH] Make key map screen hint which map conflicts --- Common/KeyMap.cpp | 9 +++++++++ Common/KeyMap.h | 1 + UI/MenuScreens.cpp | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 6d980d8f15..180ed77e91 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -214,6 +214,15 @@ bool KeyMap::IsMappedKey(int key) } +bool KeyMap::IsUserDefined(int key) +{ + int layer = 0; + int ignored; + FindKeyMapping(key, &layer, &ignored); + return layer == 0; // key found in user settings +} + + std::string KeyMap::NamePspButtonFromKey(int key) { return KeyMap::GetPspButtonName(KeyMap::KeyToPspButton(key)); diff --git a/Common/KeyMap.h b/Common/KeyMap.h index 4b959f365a..1579522980 100644 --- a/Common/KeyMap.h +++ b/Common/KeyMap.h @@ -62,6 +62,7 @@ namespace KeyMap { int KeyToPspButton(int); bool IsMappedKey(int); + bool IsUserDefined(int); // Might be usful if you want // to provide hints to users diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 5b3a7b6944..e76d1f52f5 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1593,13 +1593,15 @@ void KeyMappingNewKeyDialog::render() { KeyText(right, top, keyI18N->T("New Key")); KeyScale(2.0f); if (last_kb_key != 0) { - bool key_used = KeyMap::IsMappedKey(last_kb_key); + bool key_used = KeyMap::IsMapped(last_kb_key); if (!key_used) { KeyText(right, top + stride, KeyMap::GetKeyName(last_kb_key).c_str()); } else { KeyScale(1.0f); KeyText(left + stride, top + 2*stride, - keyI18N->T("Error: Key is already used")); + keyI18N->T("Error: Key is already used by")); + KeyText(left + stride, top + 3*stride, + (KeyMap::NamePspButtonFromKey(last_kb_key)).c_str()); } }