1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-02 18:32:20 +03:00

Made ASFont::utf8Code() a function in inputdialog.cpp instead

The implementation doesn't make sense to me, but that's something for
another day; at least it is together with the code that calls it now.
This commit is contained in:
Maarten ter Huurne 2013-08-03 22:02:50 +02:00
parent a9b5d8bd19
commit 0046fa9e19
2 changed files with 9 additions and 9 deletions

View File

@ -27,11 +27,6 @@ public:
return getTextWidth(text.c_str());
}
bool utf8Code(unsigned char c)
{
return (c>=194 && c<=198) || c==208 || c==209;
}
int getHeight()
{
return fontheight;

View File

@ -34,6 +34,11 @@ using namespace std;
#define KEY_HEIGHT 20
#define KB_TOP 90
static bool utf8Code(unsigned char c)
{
return (c>=194 && c<=198) || c==208 || c==209;
}
InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_,
Touchscreen &ts_, const string &text,
const string &startvalue, const string &title, const string &icon)
@ -121,7 +126,7 @@ void InputDialog::setKeyboard(int kb) {
this->kb = &(keyboard[kb]);
kbLength = this->kb->at(0).length();
for (int x = 0, l = kbLength; x < l; x++) {
if (gmenu2x->font->utf8Code(this->kb->at(0)[x])) {
if (utf8Code(this->kb->at(0)[x])) {
kbLength--;
x++;
}
@ -221,7 +226,7 @@ bool InputDialog::exec() {
void InputDialog::backspace() {
// Check for UTF8 characters.
input = input.substr(0, input.length()
- (gmenu2x->font->utf8Code(input[input.length() - 2]) ? 2 : 1));
- (utf8Code(input[input.length() - 2]) ? 2 : 1));
}
void InputDialog::space() {
@ -237,7 +242,7 @@ void InputDialog::confirm() {
} else {
int xc = 0;
for (uint x = 0; x < kb->at(selRow).length(); x++) {
bool utf8 = gmenu2x->font->utf8Code(kb->at(selRow)[x]);
bool utf8 = utf8Code(kb->at(selRow)[x]);
if (xc == selCol) input += kb->at(selRow).substr(x, utf8 ? 2 : 1);
if (utf8) x++;
xc++;
@ -281,7 +286,7 @@ void InputDialog::drawVirtualKeyboard() {
for (uint x=0, xc=0; x<line.length(); x++) {
string charX;
//utf8 characters
if (gmenu2x->font->utf8Code(line[x])) {
if (utf8Code(line[x])) {
charX = line.substr(x,2);
x++;
} else