Make key mapping screen save changes

This commit is contained in:
Daniel Dressler 2013-06-30 22:48:15 -07:00
parent 643133238f
commit 20399b9d6c
3 changed files with 16 additions and 10 deletions

View file

@ -25,12 +25,7 @@ using namespace KeyMap;
// default
std::map<int,int> *platform_keymap = NULL;
// Default key mapping
// Ugly, yet the cleanest way
// I could find to create a
// static map.
// Still nicer than what
// I once did in C.
// TODO: Make use const_map.h from native
struct DefaultKeyMap {
static std::map<int,int> init()
{

View file

@ -1418,7 +1418,8 @@ void KeyMappingNewKeyDialog::render() {
int left = 10;
int stride = 70;
KeyScale(1.6f);
KeyText(left, top, keyI18N->T("Set a new key mapping"));
KeyText(left, top, keyI18N->T("Map a new key for button: "));
KeyText(left, top += stride, (KeyMap::GetPspButtonName(this->pspBtn)).c_str());
KeyScale(1.3f);
KeyText(left, top += stride, keyI18N->T("Current key"));
KeyScale(2.0f);
@ -1428,8 +1429,16 @@ void KeyMappingNewKeyDialog::render() {
KeyScale(1.4f);
KeyText(right, top, keyI18N->T("New Key"));
KeyScale(2.0f);
if (last_kb_key != 0)
KeyText(right, top + stride, KeyMap::GetKeyName(last_kb_key).c_str());
if (last_kb_key != 0) {
bool key_used = KeyMap::IsMappedKey(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"));
}
}
KeyScale(1.0f);
#undef KeyText
@ -1437,6 +1446,8 @@ void KeyMappingNewKeyDialog::render() {
// Save & cancel buttons
if (UIButton(GEN_ID, Pos(10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, keyI18N->T("Save Mapping"), ALIGN_LEFT | ALIGN_BOTTOM)) {
KeyMap::SetKeyMapping(this->last_kb_key, this->pspBtn);
g_Config.Save();
screenManager()->finishDialog(this, DR_OK);
}

2
native

@ -1 +1 @@
Subproject commit a51474d255b2a607c178ebdf7732716781b3bccf
Subproject commit 91114ba60554713da98d4c23aeb533e2da650397