mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Implemented shoulder- and triggerbutton navigation to TextEditComponent (i.e. text edit quickjumps).
This commit is contained in:
parent
8492160a80
commit
4098c64468
|
@ -212,7 +212,7 @@ void GuiScraperMenu::openOtherSettings()
|
||||||
// Semi-automatic scraping.
|
// Semi-automatic scraping.
|
||||||
auto scraper_semiautomatic = std::make_shared<SwitchComponent>(mWindow);
|
auto scraper_semiautomatic = std::make_shared<SwitchComponent>(mWindow);
|
||||||
scraper_semiautomatic->setState(Settings::getInstance()->getBool("ScraperSemiautomatic"));
|
scraper_semiautomatic->setState(Settings::getInstance()->getBool("ScraperSemiautomatic"));
|
||||||
s->addWithLabel("AUTO-APPROVE SINGLE GAME MATCHES", scraper_semiautomatic);
|
s->addWithLabel("AUTO-ACCEPT SINGLE GAME MATCHES", scraper_semiautomatic);
|
||||||
s->addSaveFunc([scraper_semiautomatic] {
|
s->addSaveFunc([scraper_semiautomatic] {
|
||||||
Settings::getInstance()->setBool("ScraperSemiautomatic",
|
Settings::getInstance()->setBool("ScraperSemiautomatic",
|
||||||
scraper_semiautomatic->getState()); });
|
scraper_semiautomatic->getState()); });
|
||||||
|
|
|
@ -103,9 +103,20 @@ bool TextEditComponent::input(InputConfig* config, Input input)
|
||||||
bool const cursor_right = (config->getDeviceId() != DEVICE_KEYBOARD &&
|
bool const cursor_right = (config->getDeviceId() != DEVICE_KEYBOARD &&
|
||||||
config->isMappedLike("right", input)) || (config->getDeviceId() == DEVICE_KEYBOARD &&
|
config->isMappedLike("right", input)) || (config->getDeviceId() == DEVICE_KEYBOARD &&
|
||||||
input.id == SDLK_RIGHT);
|
input.id == SDLK_RIGHT);
|
||||||
|
bool const cursor_up = (config->getDeviceId() != DEVICE_KEYBOARD &&
|
||||||
|
config->isMappedLike("up", input)) || (config->getDeviceId() == DEVICE_KEYBOARD &&
|
||||||
|
input.id == SDLK_UP);
|
||||||
|
bool const cursor_down = (config->getDeviceId() != DEVICE_KEYBOARD &&
|
||||||
|
config->isMappedLike("down", input)) || (config->getDeviceId() == DEVICE_KEYBOARD &&
|
||||||
|
input.id == SDLK_DOWN);
|
||||||
|
bool const shoulder_left = (config->isMappedLike("leftshoulder", input));
|
||||||
|
bool const shoulder_right = (config->isMappedLike("rightshoulder", input));
|
||||||
|
bool const trigger_left = (config->isMappedLike("lefttrigger", input));
|
||||||
|
bool const trigger_right = (config->isMappedLike("righttrigger", input));
|
||||||
|
|
||||||
if (input.value == 0) {
|
if (input.value == 0) {
|
||||||
if (cursor_left || cursor_right)
|
if (cursor_left || cursor_right || cursor_up || cursor_down ||
|
||||||
|
shoulder_left || shoulder_right | trigger_left || trigger_right)
|
||||||
mCursorRepeatDir = 0;
|
mCursorRepeatDir = 0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -135,21 +146,33 @@ bool TextEditComponent::input(InputConfig* config, Input input)
|
||||||
stopEditing();
|
stopEditing();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedLike("up", input)) {
|
|
||||||
// TODO.
|
|
||||||
}
|
|
||||||
else if (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedLike("down", input)) {
|
|
||||||
// TODO.
|
|
||||||
}
|
|
||||||
else if (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedTo("y", input)) {
|
|
||||||
textInput("\b");
|
|
||||||
}
|
|
||||||
else if (cursor_left || cursor_right) {
|
else if (cursor_left || cursor_right) {
|
||||||
mCursorRepeatDir = cursor_left ? -1 : 1;
|
mCursorRepeatDir = cursor_left ? -1 : 1;
|
||||||
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
|
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
|
||||||
moveCursor(mCursorRepeatDir);
|
moveCursor(mCursorRepeatDir);
|
||||||
}
|
}
|
||||||
|
else if (cursor_up) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
else if (cursor_down) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
else if (shoulder_left || shoulder_right) {
|
||||||
|
mCursorRepeatDir = shoulder_left ? -10 : 10;
|
||||||
|
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
|
||||||
|
moveCursor(mCursorRepeatDir);
|
||||||
|
}
|
||||||
|
// Jump to beginning of text.
|
||||||
|
else if (trigger_left) {
|
||||||
|
setCursor(0);
|
||||||
|
}
|
||||||
|
// Jump to end of text.
|
||||||
|
else if (trigger_right) {
|
||||||
|
setCursor(mText.length());
|
||||||
|
}
|
||||||
|
else if (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedTo("y", input)) {
|
||||||
|
textInput("\b");
|
||||||
|
}
|
||||||
else if (config->getDeviceId() == DEVICE_KEYBOARD) {
|
else if (config->getDeviceId() == DEVICE_KEYBOARD) {
|
||||||
switch (input.id) {
|
switch (input.id) {
|
||||||
case SDLK_HOME:
|
case SDLK_HOME:
|
||||||
|
|
Loading…
Reference in a new issue