//============================================================================== ChangeKeyButton::ChangeKeyButton(ChangeKeyListener *_listener, KeyPress keyPress, const int keyIndex) : Button(keyPress.getTextDescription()), listener(_listener), keyNum(keyIndex) { this->keyPress = keyPress; setWantsKeyboardFocus(false); setTriggeredOnMouseDown(keyNum >= 0); setTooltip(keyNum >= 0 ? TRANS("Adds a new key-mapping") : TRANS("Click to change this key-mapping")); }
bool keyPressed(const KeyPress& key) override { lastPress = key; String message(TRANS("Key") + ": " + key.getTextDescription()); const CommandID previousCommand = listener->GetCommandIDForKeyPress(key); if (previousCommand != 0) message << "\n\n(" << TRANS("Currently assigned to \"CMDN\"") .replace("CMDN", TRANS(listener->GetCommandName(previousCommand))) << ')'; setMessage(message); return true; }
String KeyMappingEditorComponent::getDescriptionForKeyPress (const KeyPress& key) { return key.getTextDescription(); }