mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-28 05:14:36 +02:00
Modified the key shortcuts of the text input dialog, so that the X and Y keys are not used.
This commit is contained in:
parent
87106cdf56
commit
b5131c1db9
@ -84,22 +84,22 @@ InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_,
|
|||||||
|
|
||||||
setKeyboard(0);
|
setKeyboard(0);
|
||||||
|
|
||||||
ButtonAction actBackspace = MakeDelegate(this, &InputDialog::backspace);
|
buttonbox = new ButtonBox(gmenu2x);
|
||||||
|
IconButton *btnBackspace = new IconButton(gmenu2x, "skin:imgs/buttons/l.png", gmenu2x->tr["Backspace"]);
|
||||||
|
btnBackspace->setAction(MakeDelegate(this, &InputDialog::backspace));
|
||||||
|
buttonbox->add(btnBackspace);
|
||||||
|
|
||||||
btnBackspaceX = new IconButton(gmenu2x, "skin:imgs/buttons/x.png");
|
IconButton *btnSpace = new IconButton(gmenu2x, "skin:imgs/buttons/r.png", gmenu2x->tr["Space"]);
|
||||||
btnBackspaceX->setAction(actBackspace);
|
|
||||||
|
|
||||||
btnBackspaceL = new IconButton(gmenu2x, "skin:imgs/buttons/l.png", gmenu2x->tr["Backspace"]);
|
|
||||||
btnBackspaceL->setAction(actBackspace);
|
|
||||||
|
|
||||||
btnSpace = new IconButton(gmenu2x, "skin:imgs/buttons/r.png", gmenu2x->tr["Space"]);
|
|
||||||
btnSpace->setAction(MakeDelegate(this, &InputDialog::space));
|
btnSpace->setAction(MakeDelegate(this, &InputDialog::space));
|
||||||
|
buttonbox->add(btnSpace);
|
||||||
|
|
||||||
btnConfirm = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Confirm"]);
|
IconButton *btnConfirm = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Confirm"]);
|
||||||
btnConfirm->setAction(MakeDelegate(this, &InputDialog::confirm));
|
btnConfirm->setAction(MakeDelegate(this, &InputDialog::confirm));
|
||||||
|
buttonbox->add(btnConfirm);
|
||||||
|
|
||||||
btnChangeKeys = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Change keys"]);
|
IconButton *btnChangeKeys = new IconButton(gmenu2x, "skin:imgs/buttons/a.png", gmenu2x->tr["Change keys"]);
|
||||||
btnChangeKeys->setAction(MakeDelegate(this, &InputDialog::changeKeys));
|
btnChangeKeys->setAction(MakeDelegate(this, &InputDialog::changeKeys));
|
||||||
|
buttonbox->add(btnChangeKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDialog::setKeyboard(int kb) {
|
void InputDialog::setKeyboard(int kb) {
|
||||||
@ -138,11 +138,7 @@ bool InputDialog::exec() {
|
|||||||
writeSubTitle(text);
|
writeSubTitle(text);
|
||||||
drawTitleIcon(icon);
|
drawTitleIcon(icon);
|
||||||
|
|
||||||
gmenu2x->drawButton(gmenu2x->s, "y", gmenu2x->tr["Change keys"],
|
buttonbox->paint(5);
|
||||||
gmenu2x->drawButton(gmenu2x->s, "b", gmenu2x->tr["Confirm"],
|
|
||||||
gmenu2x->drawButton(gmenu2x->s, "r", gmenu2x->tr["Space"],
|
|
||||||
gmenu2x->drawButton(btnBackspaceL,
|
|
||||||
gmenu2x->drawButton(btnBackspaceX)-6))));
|
|
||||||
|
|
||||||
box.w = gmenu2x->font->getTextWidth(input)+18;
|
box.w = gmenu2x->font->getTextWidth(input)+18;
|
||||||
box.x = 160-box.w/2;
|
box.x = 160-box.w/2;
|
||||||
@ -185,10 +181,9 @@ bool InputDialog::exec() {
|
|||||||
case ACCEPT:
|
case ACCEPT:
|
||||||
confirm();
|
confirm();
|
||||||
break;
|
break;
|
||||||
case MANUAL:
|
case CANCEL:
|
||||||
changeKeys();
|
changeKeys();
|
||||||
break;
|
break;
|
||||||
case CLEAR:
|
|
||||||
case ALTLEFT:
|
case ALTLEFT:
|
||||||
backspace();
|
backspace();
|
||||||
break;
|
break;
|
||||||
@ -198,44 +193,6 @@ bool InputDialog::exec() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
inputMgr.update();
|
|
||||||
if ( inputMgr[ACTION_START] ) action = ID_ACTION_CLOSE;
|
|
||||||
if ( inputMgr[ACTION_UP ] ) action = ID_ACTION_UP;
|
|
||||||
if ( inputMgr[ACTION_DOWN ] ) action = ID_ACTION_DOWN;
|
|
||||||
if ( inputMgr[ACTION_LEFT ] ) action = ID_ACTION_LEFT;
|
|
||||||
if ( inputMgr[ACTION_RIGHT] ) action = ID_ACTION_RIGHT;
|
|
||||||
if ( inputMgr[ACTION_B] ) action = ID_ACTION_SELECT;
|
|
||||||
if ( inputMgr[ACTION_Y] ) action = ID_ACTION_KB_CHANGE;
|
|
||||||
if ( inputMgr[ACTION_X] || inputMgr[ACTION_L] ) action = ID_ACTION_BACKSPACE;
|
|
||||||
if ( inputMgr[ACTION_R ] ) action = ID_ACTION_SPACE;
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case ID_ACTION_CLOSE: {
|
|
||||||
ok = false;
|
|
||||||
close = true;
|
|
||||||
} break;
|
|
||||||
case ID_ACTION_UP: {
|
|
||||||
selRow--;
|
|
||||||
} break;
|
|
||||||
case ID_ACTION_DOWN: {
|
|
||||||
selRow++;
|
|
||||||
if (selRow==(int)kb->size()) selCol = selCol<8 ? 0 : 1;
|
|
||||||
} break;
|
|
||||||
case ID_ACTION_LEFT: {
|
|
||||||
selCol--;
|
|
||||||
} break;
|
|
||||||
case ID_ACTION_RIGHT: {
|
|
||||||
selCol++;
|
|
||||||
} break;
|
|
||||||
case ID_ACTION_BACKSPACE: backspace(); break;
|
|
||||||
case ID_ACTION_SPACE: space(); break;
|
|
||||||
case ID_ACTION_KB_CHANGE: changeKeys(); break;
|
|
||||||
case ID_ACTION_SELECT: confirm(); break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
|
#include "buttonbox.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -61,7 +62,7 @@ private:
|
|||||||
stringlist *kb;
|
stringlist *kb;
|
||||||
int kbLength, kbWidth, kbHeight, kbLeft;
|
int kbLength, kbWidth, kbHeight, kbLeft;
|
||||||
SDL_Rect kbRect;
|
SDL_Rect kbRect;
|
||||||
IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys;
|
ButtonBox *buttonbox;
|
||||||
string input;
|
string input;
|
||||||
|
|
||||||
void backspace();
|
void backspace();
|
||||||
|
Loading…
Reference in New Issue
Block a user