summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gui/action.cpp3
-rw-r--r--gui/animation.cpp2
-rw-r--r--gui/blanktimer.cpp10
-rw-r--r--gui/button.cpp2
-rw-r--r--gui/checkbox.cpp2
-rw-r--r--gui/console.cpp2
-rw-r--r--gui/fileselector.cpp2
-rw-r--r--gui/fill.cpp2
-rw-r--r--gui/gui.cpp2
-rw-r--r--gui/image.cpp2
-rw-r--r--gui/input.cpp28
-rw-r--r--gui/keyboard.cpp6
-rw-r--r--gui/listbox.cpp2
-rw-r--r--gui/mousecursor.cpp2
-rw-r--r--gui/pages.cpp2
-rw-r--r--gui/partitionlist.cpp2
-rw-r--r--gui/patternpassword.cpp2
-rw-r--r--gui/progressbar.cpp2
-rw-r--r--gui/resources.cpp2
-rw-r--r--gui/resources.hpp2
-rw-r--r--gui/scrolllist.cpp2
-rw-r--r--gui/slider.cpp2
-rw-r--r--gui/slidervalue.cpp4
-rw-r--r--gui/terminal.cpp8
-rw-r--r--gui/text.cpp10
-rw-r--r--gui/textbox.cpp4
26 files changed, 56 insertions, 53 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 8895e4013..240db8f24 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -43,15 +43,16 @@
#include "../adb_install.h"
#include "../fuse_sideload.h"
#include "blanktimer.hpp"
+
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
#include "../variables.h"
#include "../twinstall.h"
#include "cutils/properties.h"
#include "../adb_install.h"
#include "../set_metadata.h"
};
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/animation.cpp b/gui/animation.cpp
index 888b4ab08..d45373d81 100644
--- a/gui/animation.cpp
+++ b/gui/animation.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp
index 06208e273..4662b1fab 100644
--- a/gui/blanktimer.cpp
+++ b/gui/blanktimer.cpp
@@ -26,9 +26,9 @@ using namespace std;
#include "blanktimer.hpp"
#include "../data.hpp"
extern "C" {
-#include "../minuitwrp/minui.h"
#include "../twcommon.h"
}
+#include "../minuitwrp/minui.h"
#include "../twrp-functions.hpp"
#include "../variables.h"
@@ -71,7 +71,8 @@ void blanktimer::checkForTimeout() {
PageManager::ChangeOverlay("lock");
}
#ifndef TW_NO_SCREEN_BLANK
- if (state == kOff && gr_fb_blank(1) >= 0) {
+ if (state == kOff) {
+ gr_fb_blank(true);
state = kBlanked;
}
#endif
@@ -97,10 +98,7 @@ void blanktimer::resetTimerAndUnblank(void) {
switch (state) {
case kBlanked:
#ifndef TW_NO_SCREEN_BLANK
- if (gr_fb_blank(0) < 0) {
- LOGINFO("blanktimer::resetTimerAndUnblank failed to gr_fb_blank(0)\n");
- break;
- }
+ gr_fb_blank(false);
#endif
// TODO: this is asymmetric with postscreenblank.sh - shouldn't it be under the next case label?
TWFunc::check_and_run_script("/sbin/postscreenunblank.sh", "unblank");
diff --git a/gui/button.cpp b/gui/button.cpp
index a4c1b52bd..45614e461 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -36,8 +36,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/checkbox.cpp b/gui/checkbox.cpp
index 1760bac25..e79f0cdcd 100644
--- a/gui/checkbox.cpp
+++ b/gui/checkbox.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/console.cpp b/gui/console.cpp
index b5204fb7c..6f375ff28 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -37,8 +37,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index a97ff34b1..23f235c75 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -23,8 +23,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/fill.cpp b/gui/fill.cpp
index b315cd08a..d0a1cfda7 100644
--- a/gui/fill.cpp
+++ b/gui/fill.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 7cf21b0a0..f8a6a73e2 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -38,9 +38,9 @@
extern "C"
{
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
#include <pixelflinger/pixelflinger.h>
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/image.cpp b/gui/image.cpp
index 8b43aaa34..2107d5506 100644
--- a/gui/image.cpp
+++ b/gui/image.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/input.cpp b/gui/input.cpp
index 68bd163b9..c12ecc2b2 100644
--- a/gui/input.cpp
+++ b/gui/input.cpp
@@ -39,8 +39,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -196,7 +196,7 @@ int GUIInput::HandleTextLocation(int x)
maskedValue += mMask;
displayValue = maskedValue;
}
- textWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
if (textWidth <= mRenderW) {
lastX = x;
scrollingX = 0;
@@ -209,7 +209,7 @@ int GUIInput::HandleTextLocation(int x)
if (skipChars && skipChars < displayValue.size())
displayValue.erase(0, skipChars);
- textWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
mRendered = false;
int deltaX, deltaText, newWidth;
@@ -222,11 +222,11 @@ int GUIInput::HandleTextLocation(int x)
if (mCursorLocation == -1) {
displayValue = originalValue;
skipChars = 0;
- textWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
while (textWidth > mRenderW) {
displayValue.erase(0, 1);
skipChars++;
- textWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
}
scrollingX = mRenderW - textWidth;
mInputText->SkipCharCount(skipChars);
@@ -237,12 +237,12 @@ int GUIInput::HandleTextLocation(int x)
cursorLocate = displayValue;
cursorLocate.resize(mCursorLocation);
- textWidth = gr_measureEx(cursorLocate.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(cursorLocate.c_str(), fontResource);
while (textWidth > mRenderW) {
skipChars++;
mCursorLocation--;
cursorLocate.erase(0, 1);
- textWidth = gr_measureEx(cursorLocate.c_str(), fontResource);
+ textWidth = gr_ttf_measureEx(cursorLocate.c_str(), fontResource);
adjust_scrollingX = -1;
}
if (adjust_scrollingX) {
@@ -261,7 +261,7 @@ int GUIInput::HandleTextLocation(int x)
}
insertChar = originalValue.substr(skipChars - 1, 1);
displayValue.insert(0, insertChar);
- newWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ newWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
deltaText = newWidth - textWidth;
if (newWidth > mRenderW) {
scrollingX = mRenderW - textWidth;
@@ -289,7 +289,7 @@ int GUIInput::HandleTextLocation(int x)
}
insertChar = originalValue.substr(skipChars - 1, 1);
displayValue.insert(0, insertChar);
- newWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ newWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
deltaText = newWidth - textWidth;
if (deltaText < deltaX) {
lastX += deltaText;
@@ -324,7 +324,7 @@ int GUIInput::HandleTextLocation(int x)
deltaX = lastX - x;
displayValue.erase(0, 1);
skipChars++;
- newWidth = gr_measureEx(displayValue.c_str(), fontResource);
+ newWidth = gr_ttf_measureEx(displayValue.c_str(), fontResource);
deltaText = textWidth - newWidth;
if (newWidth <= mRenderW) {
scrollingX = mRenderW - newWidth;
@@ -407,15 +407,15 @@ int GUIInput::Render(void)
cursorDisplay = displayValue;
cursorDisplay.resize(mCursorLocation);
- cursorX = gr_measureEx(cursorDisplay.c_str(), fontResource) + mRenderX;
+ cursorX = gr_ttf_measureEx(cursorDisplay.c_str(), fontResource) + mRenderX;
} else {
// Cursor location is after the end of the text - reset to -1
mCursorLocation = -1;
- cursorX = gr_measureEx(displayValue.c_str(), fontResource) + mRenderX;
+ cursorX = gr_ttf_measureEx(displayValue.c_str(), fontResource) + mRenderX;
}
} else {
// Cursor is at the end (-1)
- cursorX = gr_measureEx(displayValue.c_str(), fontResource) + mRenderX;
+ cursorX = gr_ttf_measureEx(displayValue.c_str(), fontResource) + mRenderX;
}
}
cursorX += scrollingX;
@@ -534,7 +534,7 @@ int GUIInput::NotifyTouch(TOUCH_STATE state, int x, int y)
for(index=0; index<displayValue.size(); index++)
{
cursorString = displayValue.substr(0, index);
- cursorX = gr_measureEx(cursorString.c_str(), fontResource) + mRenderX;
+ cursorX = gr_ttf_measureEx(cursorString.c_str(), fontResource) + mRenderX;
if (cursorX > x) {
if (index > 0)
mCursorLocation = index - 1;
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index 3b8fdc9ae..4a78ad798 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -25,9 +25,9 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
#include "gui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -333,7 +333,7 @@ void GUIKeyboard::DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH)
else if (!labelText.empty())
{
void* fontResource = labelFont->GetResource();
- int textW = gr_measureEx(labelText.c_str(), fontResource);
+ int textW = gr_ttf_measureEx(labelText.c_str(), fontResource);
int textH = labelFont->GetHeight();
int textX = keyX + (keyW - textW) / 2;
int textY = keyY + (keyH - textH) / 2;
@@ -347,7 +347,7 @@ void GUIKeyboard::DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH)
gr_color(mLongpressFontColor.red, mLongpressFontColor.green, mLongpressFontColor.blue, mLongpressFontColor.alpha);
string text(1, keychar);
int textH = mLongpressFont->GetHeight();
- int textW = gr_measureEx(text.c_str(), fontResource);
+ int textW = gr_ttf_measureEx(text.c_str(), fontResource);
int textX = keyX + keyW - longpressOffsetX - textW;
int textY = keyY + longpressOffsetY;
gr_textEx_scaleW(textX, textY, text.c_str(), fontResource, keyW, TOP_LEFT, 0);
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index b0d2731fe..e10fee72a 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -20,8 +20,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/mousecursor.cpp b/gui/mousecursor.cpp
index 84e6322a4..bd730df6b 100644
--- a/gui/mousecursor.cpp
+++ b/gui/mousecursor.cpp
@@ -17,8 +17,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/pages.cpp b/gui/pages.cpp
index c45566232..4a4c52361 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -39,11 +39,11 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
#include "../minzip/SysUtil.h"
#include "../minzip/Zip.h"
#include "gui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp
index 102802d7d..ff207fa9a 100644
--- a/gui/partitionlist.cpp
+++ b/gui/partitionlist.cpp
@@ -22,8 +22,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp
index a6ab83128..96054c15f 100644
--- a/gui/patternpassword.cpp
+++ b/gui/patternpassword.cpp
@@ -13,8 +13,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/progressbar.cpp b/gui/progressbar.cpp
index a478a40d0..fc2a4976c 100644
--- a/gui/progressbar.cpp
+++ b/gui/progressbar.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/resources.cpp b/gui/resources.cpp
index a8f41991b..e7611dd9f 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -14,9 +14,9 @@
#include "../minzip/Zip.h"
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
#include "gui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/resources.hpp b/gui/resources.hpp
index ce06d9679..4548c10b4 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -49,7 +49,7 @@ public:
public:
void* GetResource() { return this ? mFont : NULL; }
- int GetHeight() { return gr_getMaxFontHeight(this ? mFont : NULL); }
+ int GetHeight() { return gr_ttf_getMaxFontHeight(this ? mFont : NULL); }
void Override(xml_node<>* node, ZipArchive* pZip);
protected:
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
index 6e974f205..291b3820b 100644
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -20,8 +20,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/slider.cpp b/gui/slider.cpp
index 6ee2024d5..59b295bd0 100644
--- a/gui/slider.cpp
+++ b/gui/slider.cpp
@@ -21,8 +21,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index 8a44a3cb7..088620a21 100644
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -249,7 +249,7 @@ int GUISliderValue::measureText(const std::string& str)
void* fontResource = NULL;
if (mFont) fontResource = mFont->GetResource();
- return gr_measureEx(str.c_str(), fontResource);
+ return gr_ttf_measureEx(str.c_str(), fontResource);
}
int GUISliderValue::Render(void)
diff --git a/gui/terminal.cpp b/gui/terminal.cpp
index 044782e4e..29b0e8469 100644
--- a/gui/terminal.cpp
+++ b/gui/terminal.cpp
@@ -32,8 +32,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -869,10 +869,10 @@ void GUITerminal::RenderItem(size_t itemindex, int yPos, bool selected)
// render cursor
int cursorX = engine->getCursorX();
std::string leftOfCursor = line.substr(0, cursorX);
- int x = gr_measureEx(leftOfCursor.c_str(), mFont->GetResource());
+ int x = gr_ttf_measureEx(leftOfCursor.c_str(), mFont->GetResource());
// note that this single character can be a UTF-8 sequence
std::string atCursor = (size_t)cursorX < line.length() ? line.substr(cursorX, 1) : " ";
- int w = gr_measureEx(atCursor.c_str(), mFont->GetResource());
+ int w = gr_ttf_measureEx(atCursor.c_str(), mFont->GetResource());
gr_color(mFontColor.red, mFontColor.green, mFontColor.blue, mFontColor.alpha);
gr_fill(mRenderX + x, yPos, w, actualItemHeight);
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, mBackgroundColor.alpha);
@@ -890,7 +890,7 @@ void GUITerminal::InitAndResize()
// make sure the shell is started
engine->initPty();
// send window resize
- int charWidth = gr_measureEx("N", mFont->GetResource());
+ int charWidth = gr_ttf_measureEx("N", mFont->GetResource());
engine->setSize(mRenderW / charWidth, GetDisplayItemCount(), mRenderW, mRenderH);
}
diff --git a/gui/text.cpp b/gui/text.cpp
index 9898e2838..6498af62c 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -19,8 +19,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -47,6 +47,8 @@ GUIText::GUIText(xml_node<>* node)
// Load the font, and possibly override the color
mFont = LoadAttrFont(FindNode(node, "font"), "resource");
+ if (!mFont)
+ return;
mColor = LoadAttrColor(FindNode(node, "font"), "color", mColor);
mHighlightColor = LoadAttrColor(FindNode(node, "font"), "highlightcolor", mColor);
@@ -88,6 +90,8 @@ int GUIText::Render(void)
void* fontResource = NULL;
if (mFont)
fontResource = mFont->GetResource();
+ else
+ return -1;
mLastValue = gui_parse_text(mText);
string displayValue = mLastValue;
@@ -98,7 +102,7 @@ int GUIText::Render(void)
mVarChanged = 0;
int x = mRenderX, y = mRenderY;
- int width = gr_measureEx(displayValue.c_str(), fontResource);
+ int width = gr_ttf_measureEx(displayValue.c_str(), fontResource);
if (isHighlighted)
gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha);
@@ -145,7 +149,7 @@ int GUIText::GetCurrentBounds(int& w, int& h)
h = mFontHeight;
mLastValue = gui_parse_text(mText);
- w = gr_measureEx(mLastValue.c_str(), fontResource);
+ w = gr_ttf_measureEx(mLastValue.c_str(), fontResource);
return 0;
}
diff --git a/gui/textbox.cpp b/gui/textbox.cpp
index 277297fec..2e2512c50 100644
--- a/gui/textbox.cpp
+++ b/gui/textbox.cpp
@@ -22,8 +22,8 @@
extern "C" {
#include "../twcommon.h"
-#include "../minuitwrp/minui.h"
}
+#include "../minuitwrp/minui.h"
#include "rapidxml.hpp"
#include "objects.hpp"
@@ -86,7 +86,7 @@ void GUITextBox::RenderItem(size_t itemindex, int yPos, bool selected __unused)
// render text
const char* text = rText[itemindex].c_str();
- gr_textEx(mRenderX, yPos, text, mFont->GetResource());
+ gr_textEx_scaleW(mRenderX, yPos, text, mFont->GetResource(), mRenderW, TOP_LEFT, 0);
}
void GUITextBox::NotifySelect(size_t item_selected __unused)