diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2015-02-18 21:35:00 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2015-02-21 15:14:24 +0100 |
commit | 21ff02a69331fbcd53dc93a1af9a93618225b4bf (patch) | |
tree | 623fe5a07a506362b91a16b34d62a875b3d45c32 /gui/keyboard.cpp | |
parent | gui: make kinetic scrolling deceleration more awesome (diff) | |
download | android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar.gz android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar.bz2 android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar.lz android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar.xz android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.tar.zst android_bootable_recovery-21ff02a69331fbcd53dc93a1af9a93618225b4bf.zip |
Diffstat (limited to 'gui/keyboard.cpp')
-rw-r--r-- | gui/keyboard.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index 5528be936..d0262aac2 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -48,7 +48,8 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node) { int layoutindex, rowindex, keyindex, Xindex, Yindex, keyHeight = 0, keyWidth = 0; rowY = colX = -1; - highlightRenderCount = hasHighlight = hasCapsHighlight = 0; + highlightRenderCount = 0; + hasHighlight = hasCapsHighlight = false; char resource[10], layout[8], row[5], key[6], longpress[7]; xml_attribute<>* attr; xml_node<>* child; @@ -66,36 +67,17 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node) if (!node) return; // Load the action - child = node->first_node("action"); + child = FindNode(node, "action"); if (child) { mAction = new GUIAction(node); } - memset(&mHighlightColor, 0, sizeof(COLOR)); - child = node->first_node("highlight"); - if (child) { - attr = child->first_attribute("color"); - if (attr) { - hasHighlight = 1; - std::string color = attr->value(); - ConvertStrToColor(color, &mHighlightColor); - } - } - - memset(&mCapsHighlightColor, 0, sizeof(COLOR)); - child = node->first_node("capshighlight"); - if (child) { - attr = child->first_attribute("color"); - if (attr) { - hasCapsHighlight = 1; - std::string color = attr->value(); - ConvertStrToColor(color, &mCapsHighlightColor); - } - } + mHighlightColor = LoadAttrColor(FindNode(node, "highlight"), "color", &hasHighlight); + mCapsHighlightColor = LoadAttrColor(FindNode(node, "capshighlight"), "color", &hasCapsHighlight); // Load the images for the different layouts - child = node->first_node("layout"); + child = FindNode(node, "layout"); if (child) { layoutindex = 1; @@ -120,7 +102,7 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node) // Load all of the layout maps layoutindex = 1; strcpy(layout, "layout1"); - keylayout = node->first_node(layout); + keylayout = FindNode(node, layout); while (keylayout) { if (layoutindex > MAX_KEYBOARD_LAYOUTS) { @@ -212,12 +194,12 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node) } layoutindex++; layout[6] = (char)(layoutindex + 48); - keylayout = node->first_node(layout); + keylayout = FindNode(node, layout); } int x, y, w, h; // Load the placement - LoadPlacement(node->first_node("placement"), &x, &y, &w, &h); + LoadPlacement(FindNode(node, "placement"), &x, &y, &w, &h); SetActionPos(x, y, KeyboardWidth, KeyboardHeight); SetRenderPos(x, y, w, h); return; |