summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-07-02 17:15:54 +0200
committerGerrit Code Review <gerrit2@gerrit>2014-07-09 15:46:35 +0200
commitbf2cb1c4d85b8212c481777aa846b182ca3014a4 (patch)
tree1deb57f8d2946bd966a4b58e833a339a9cf929e1 /gui
parentRefresh after partition changes (diff)
downloadandroid_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar.gz
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar.bz2
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar.lz
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar.xz
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.tar.zst
android_bootable_recovery-bf2cb1c4d85b8212c481777aa846b182ca3014a4.zip
Diffstat (limited to '')
-rw-r--r--gui/console.cpp64
-rwxr-xr-xgui/devices/1024x600/res/ui.xml3
-rw-r--r--gui/devices/1024x768/res/ui.xml3
-rw-r--r--gui/devices/1080x1920/res/ui.xml3
-rw-r--r--gui/devices/1200x1920/res/ui.xml3
-rw-r--r--gui/devices/1280x800/res/ui.xml3
-rw-r--r--gui/devices/1600x2560/res/ui.xml3
-rw-r--r--gui/devices/1920x1200/res/ui.xml3
-rw-r--r--gui/devices/240x240/res/ui.xml3
-rw-r--r--gui/devices/2560x1600/res/ui.xml3
-rw-r--r--gui/devices/320x480/res/ui.xml3
-rw-r--r--gui/devices/480x800/res/ui.xml3
-rw-r--r--gui/devices/480x854/res/ui.xml3
-rw-r--r--gui/devices/540x960/res/ui.xml3
-rw-r--r--gui/devices/720x1280/res/ui.xml3
-rwxr-xr-xgui/devices/800x1280/res/ui.xml3
-rwxr-xr-xgui/devices/800x480/res/ui.xml3
-rw-r--r--gui/gui.h1
-rw-r--r--gui/objects.hpp1
19 files changed, 99 insertions, 15 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 848a34472..b1f16c48a 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -27,18 +27,10 @@ extern "C" {
static std::vector<std::string> gConsole;
+static std::vector<std::string> gConsoleColor;
-extern "C" void gui_print(const char *fmt, ...)
+extern "C" void __gui_print(const char *color, char *buf)
{
- char buf[512]; // We're going to limit a single request to 512 bytes
-
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, 512, fmt, ap);
- va_end(ap);
-
- fputs(buf, stdout);
-
char *start, *next;
if (buf[0] == '\n' && strlen(buf) < 2) {
@@ -52,6 +44,7 @@ extern "C" void gui_print(const char *fmt, ...)
{
*next = '\0';
gConsole.push_back(start);
+ gConsoleColor.push_back(color);
start = ++next;
}
@@ -60,8 +53,39 @@ extern "C" void gui_print(const char *fmt, ...)
}
// The text after last \n (or whole string if there is no \n)
- if(*start)
+ if(*start) {
gConsole.push_back(start);
+ gConsoleColor.push_back(color);
+ }
+}
+
+extern "C" void gui_print(const char *fmt, ...)
+{
+ char buf[512]; // We're going to limit a single request to 512 bytes
+
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(buf, 512, fmt, ap);
+ va_end(ap);
+
+ fputs(buf, stdout);
+
+ __gui_print("normal", buf);
+ return;
+}
+
+extern "C" void gui_print_color(const char *color, const char *fmt, ...)
+{
+ char buf[512]; // We're going to limit a single request to 512 bytes
+
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(buf, 512, fmt, ap);
+ va_end(ap);
+
+ fputs(buf, stdout);
+
+ __gui_print(color, buf);
return;
}
@@ -171,9 +195,6 @@ int GUIConsole::RenderConsole(void)
gr_color(mScrollColor.red, mScrollColor.green, mScrollColor.blue, mScrollColor.alpha);
gr_fill(mConsoleX + (mConsoleW * 9 / 10), mConsoleY, (mConsoleW / 10), mConsoleH);
- // Render the lines
- gr_color(mForegroundColor.red, mForegroundColor.green, mForegroundColor.blue, mForegroundColor.alpha);
-
// Don't try to continue to render without data
int prevCount = mLastCount;
mLastCount = gConsole.size();
@@ -186,14 +207,17 @@ int GUIConsole::RenderConsole(void)
// may different in different console windows
for (int i = prevCount; i < mLastCount; i++) {
string curr_line = gConsole[i];
+ string curr_color = gConsoleColor[i];
int line_char_width;
for(;;) {
line_char_width = gr_maxExW(curr_line.c_str(), fontResource, mConsoleW);
if (line_char_width < curr_line.size()) {
rConsole.push_back(curr_line.substr(0, line_char_width));
+ rConsoleColor.push_back(curr_color);
curr_line = curr_line.substr(line_char_width);
} else {
rConsole.push_back(curr_line);
+ rConsoleColor.push_back(curr_color);
break;
}
}
@@ -219,8 +243,18 @@ int GUIConsole::RenderConsole(void)
unsigned int line;
for (line = 0; line < mMaxRows; line++)
{
- if ((start + (int) line) >= 0 && (start + (int) line) < (int) RenderCount)
+ if ((start + (int) line) >= 0 && (start + (int) line) < (int) RenderCount) {
+ if (rConsoleColor[start + line] == "normal") {
+ gr_color(mForegroundColor.red, mForegroundColor.green, mForegroundColor.blue, mForegroundColor.alpha);
+ } else {
+ COLOR mFontColor;
+ std::string color = rConsoleColor[start + line];
+ ConvertStrToColor(color, &mFontColor);
+ mFontColor.alpha = 255;
+ gr_color(mFontColor.red, mFontColor.green, mFontColor.blue, mFontColor.alpha);
+ }
gr_textExW(mConsoleX, mStartY + (line * mFontHeight), rConsole[start + line].c_str(), fontResource, mConsoleW + mConsoleX);
+ }
}
return (mSlideout ? RenderSlideout() : 0);
}
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index c0880a76a..d54771941 100755
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="25" />
<variable name="console_width" value="974" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index 3409972d9..f404b466d 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="25" />
<variable name="console_width" value="974" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml
index 21498a76e..28130b7db 100644
--- a/gui/devices/1080x1920/res/ui.xml
+++ b/gui/devices/1080x1920/res/ui.xml
@@ -122,6 +122,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="1080" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="705" />
diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml
index 9faff14d6..d19813947 100644
--- a/gui/devices/1200x1920/res/ui.xml
+++ b/gui/devices/1200x1920/res/ui.xml
@@ -125,6 +125,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="1200" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="705" />
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index eeb59231f..21fc3b7a8 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="25" />
<variable name="console_width" value="1230" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/1600x2560/res/ui.xml b/gui/devices/1600x2560/res/ui.xml
index a8e919def..b6ca28c7e 100644
--- a/gui/devices/1600x2560/res/ui.xml
+++ b/gui/devices/1600x2560/res/ui.xml
@@ -125,6 +125,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="1600" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="938" />
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index 4573dedb2..5ee5b4646 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="50" />
<variable name="console_width" value="1820" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml
index c353d0198..ac98dbad8 100644
--- a/gui/devices/240x240/res/ui.xml
+++ b/gui/devices/240x240/res/ui.xml
@@ -116,6 +116,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="240" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="120" />
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index 531e43f1c..25b86194f 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="50" />
<variable name="console_width" value="2460" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index e29245aba..369b9941e 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -118,6 +118,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="320" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="192" />
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index 54069f930..72b44e51f 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -117,6 +117,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="480" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index 48fe8d6d5..5026f4016 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -116,6 +116,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="480" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="320" />
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index 665e6762a..bd39a18f2 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -117,6 +117,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="540" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="380" />
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index 3d69a352e..c9e68629a 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -122,6 +122,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="720" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="470" />
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index 7194373d4..b4cbb508e 100755
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -118,6 +118,9 @@
<variable name="console_x" value="0" />
<variable name="console_width" value="800" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="470" />
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index ac9abc984..272bf6491 100755
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -129,6 +129,9 @@
<variable name="console_x" value="25" />
<variable name="console_width" value="750" />
<variable name="console_foreground" value="#A0A0A0" />
+ <variable name="warning" value="#F8F8A0" />
+ <variable name="error" value="#FF4040" />
+ <variable name="highlight" value="#33B5E5" />
<variable name="console_background" value="#303030" />
<variable name="console_scroll" value="#303030" />
<variable name="console_action_height" value="230" />
diff --git a/gui/gui.h b/gui/gui.h
index 10bf6ce2a..a927cf39a 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -25,6 +25,7 @@ int gui_loadResources();
int gui_start();
int gui_startPage(const char* page_name);
void gui_print(const char *fmt, ...);
+void gui_print_color(const char *color, const char *fmt, ...);
#endif // _GUI_HEADER
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 02417154a..486e2e704 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -350,6 +350,7 @@ protected:
int mSlideout;
SlideoutState mSlideoutState;
std::vector<std::string> rConsole;
+ std::vector<std::string> rConsoleColor;
bool mRender;
protected: