summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/Android.mk2
-rw-r--r--gui/action.cpp2
-rw-r--r--gui/animation.cpp8
-rw-r--r--gui/button.cpp2
-rw-r--r--gui/checkbox.cpp2
-rw-r--r--gui/console.cpp11
-rw-r--r--gui/fileselector.cpp14
-rw-r--r--gui/fill.cpp5
-rw-r--r--gui/image.cpp2
-rw-r--r--gui/input.cpp2
-rw-r--r--gui/keyboard.cpp2
-rw-r--r--gui/listbox.cpp14
-rw-r--r--gui/object.cpp (renamed from gui/conditional.cpp)18
-rw-r--r--gui/objects.hpp37
-rw-r--r--gui/partitionlist.cpp14
-rw-r--r--gui/progressbar.cpp11
-rw-r--r--gui/slider.cpp11
-rw-r--r--gui/slidervalue.cpp2
-rw-r--r--gui/text.cpp2
19 files changed, 119 insertions, 42 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index 29d99f7f8..40b67d80a 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -15,7 +15,7 @@ LOCAL_SRC_FILES := \
fileselector.cpp \
progressbar.cpp \
animation.cpp \
- conditional.cpp \
+ object.cpp \
slider.cpp \
slidervalue.cpp \
listbox.cpp \
diff --git a/gui/action.cpp b/gui/action.cpp
index 9c785d169..951feb114 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -67,7 +67,7 @@ extern blanktimer blankTimer;
void curtainClose(void);
GUIAction::GUIAction(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
xml_node<>* child;
xml_node<>* actions;
diff --git a/gui/animation.cpp b/gui/animation.cpp
index 8c922786d..771e1c116 100644
--- a/gui/animation.cpp
+++ b/gui/animation.cpp
@@ -26,7 +26,7 @@ extern "C" {
#include "objects.hpp"
-GUIAnimation::GUIAnimation(xml_node<>* node)
+GUIAnimation::GUIAnimation(xml_node<>* node) : GUIObject(node)
{
xml_node<>* child;
xml_attribute<>* attr;
@@ -101,6 +101,9 @@ GUIAnimation::GUIAnimation(xml_node<>* node)
int GUIAnimation::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mAnimation || !mAnimation->GetResource(mFrame)) return -1;
gr_blit(mAnimation->GetResource(mFrame), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
@@ -109,6 +112,9 @@ int GUIAnimation::Render(void)
int GUIAnimation::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mAnimation) return -1;
// Handle the "end-of-animation" state
diff --git a/gui/button.cpp b/gui/button.cpp
index b14e6754c..097bf7189 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -43,7 +43,7 @@ extern "C" {
#include "objects.hpp"
GUIButton::GUIButton(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
diff --git a/gui/checkbox.cpp b/gui/checkbox.cpp
index 8739c9c25..fe5f557bb 100644
--- a/gui/checkbox.cpp
+++ b/gui/checkbox.cpp
@@ -26,7 +26,7 @@ extern "C" {
#include "objects.hpp"
GUICheckbox::GUICheckbox(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
diff --git a/gui/console.cpp b/gui/console.cpp
index 517a7c293..5d0ed3ec3 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -103,7 +103,7 @@ extern "C" void gui_print_overwrite(const char *fmt, ...)
return;
}
-GUIConsole::GUIConsole(xml_node<>* node)
+GUIConsole::GUIConsole(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -242,6 +242,9 @@ int GUIConsole::RenderConsole(void)
int GUIConsole::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (mSlideout && mSlideoutState == hidden)
return RenderSlideout();
@@ -250,6 +253,9 @@ int GUIConsole::Render(void)
int GUIConsole::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (mSlideout && mSlideoutState != visible)
{
if (mSlideoutState == hidden)
@@ -326,6 +332,9 @@ int GUIConsole::IsInRegion(int x, int y)
// Return 0 on success, >0 to ignore remainder of touch, and <0 on error
int GUIConsole::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
if (mSlideout && mSlideoutState == hidden)
{
if (state == TOUCH_START)
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 1c2a8ccf0..484bcff11 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -55,7 +55,7 @@ extern "C" {
int GUIFileSelector::mSortOrder = 0;
-GUIFileSelector::GUIFileSelector(xml_node<>* node)
+GUIFileSelector::GUIFileSelector(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -392,6 +392,9 @@ GUIFileSelector::~GUIFileSelector()
int GUIFileSelector::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
// First step, fill background
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, 255);
gr_fill(mRenderX, mRenderY + mHeaderH, mRenderW, mRenderH - mHeaderH);
@@ -577,6 +580,9 @@ int GUIFileSelector::Render(void)
int GUIFileSelector::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
@@ -659,6 +665,9 @@ int GUIFileSelector::GetSelection(int x, int y)
int GUIFileSelector::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
static int lastY = 0, last2Y = 0, fastScroll = 0;
int selection = 0;
@@ -858,6 +867,9 @@ int GUIFileSelector::NotifyTouch(TOUCH_STATE state, int x, int y)
int GUIFileSelector::NotifyVarChange(std::string varName, std::string value)
{
+ if(!isConditionTrue())
+ return 0;
+
if (varName.empty()) {
// Always clear the data variable so we know to use it
DataManager::SetValue(mVariable, "");
diff --git a/gui/fill.cpp b/gui/fill.cpp
index ad1f4e075..1ddefaa9b 100644
--- a/gui/fill.cpp
+++ b/gui/fill.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUIFill::GUIFill(xml_node<>* node)
+GUIFill::GUIFill(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -50,6 +50,9 @@ GUIFill::GUIFill(xml_node<>* node)
int GUIFill::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
gr_fill(mRenderX, mRenderY, mRenderW, mRenderH);
return 0;
diff --git a/gui/image.cpp b/gui/image.cpp
index 31d9418d3..2cf3b68af 100644
--- a/gui/image.cpp
+++ b/gui/image.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUIImage::GUIImage(xml_node<>* node) : Conditional(node)
+GUIImage::GUIImage(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
diff --git a/gui/input.cpp b/gui/input.cpp
index 4fd1d0ecf..e4020745c 100644
--- a/gui/input.cpp
+++ b/gui/input.cpp
@@ -47,7 +47,7 @@ extern "C" {
#include "../data.hpp"
GUIInput::GUIInput(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index 36106c7c1..f08d71488 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -43,7 +43,7 @@ extern "C" {
#include "objects.hpp"
GUIKeyboard::GUIKeyboard(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
int layoutindex, rowindex, keyindex, Xindex, Yindex, keyHeight = 0, keyWidth = 0;
rowY = colX = -1;
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index 626cbacf4..99e2dedf1 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -51,7 +51,7 @@ extern "C" {
#define SCROLLING_FLOOR 10
#define SCROLLING_MULTIPLIER 6
-GUIListBox::GUIListBox(xml_node<>* node)
+GUIListBox::GUIListBox(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -352,6 +352,9 @@ GUIListBox::~GUIListBox()
int GUIListBox::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
// First step, fill background
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, 255);
gr_fill(mRenderX, mRenderY + mHeaderH, mRenderW, mRenderH - mHeaderH);
@@ -522,6 +525,9 @@ int GUIListBox::Render(void)
int GUIListBox::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
@@ -602,6 +608,9 @@ int GUIListBox::GetSelection(int x, int y)
int GUIListBox::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
static int lastY = 0, last2Y = 0, fastScroll = 0;
int selection = 0;
@@ -753,6 +762,9 @@ int GUIListBox::NotifyTouch(TOUCH_STATE state, int x, int y)
int GUIListBox::NotifyVarChange(std::string varName, std::string value)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
diff --git a/gui/conditional.cpp b/gui/object.cpp
index 5ea8d176c..b6010d778 100644
--- a/gui/conditional.cpp
+++ b/gui/object.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "objects.hpp"
#include "../data.hpp"
-Conditional::Conditional(xml_node<>* node)
+GUIObject::GUIObject(xml_node<>* node)
{
// Break out early, it's too hard to check if valid every step
if (!node) return;
@@ -61,7 +61,11 @@ Conditional::Conditional(xml_node<>* node)
}
}
-bool Conditional::IsConditionVariable(std::string var)
+GUIObject::~GUIObject()
+{
+}
+
+bool GUIObject::IsConditionVariable(std::string var)
{
std::vector<Condition>::iterator iter;
for (iter = mConditions.begin(); iter != mConditions.end(); iter++)
@@ -72,7 +76,7 @@ bool Conditional::IsConditionVariable(std::string var)
return false;
}
-bool Conditional::isConditionTrue()
+bool GUIObject::isConditionTrue()
{
std::vector<Condition>::iterator iter;
for (iter = mConditions.begin(); iter != mConditions.end(); iter++)
@@ -83,7 +87,7 @@ bool Conditional::isConditionTrue()
return true;
}
-bool Conditional::isConditionTrue(Condition* condition)
+bool GUIObject::isConditionTrue(Condition* condition)
{
// This is used to hold the proper value of "true" based on the '!' NOT flag
bool bTrue = true;
@@ -150,12 +154,12 @@ bool Conditional::isConditionTrue(Condition* condition)
return !bTrue;
}
-bool Conditional::isConditionValid()
+bool GUIObject::isConditionValid()
{
return !mConditions.empty();
}
-void Conditional::NotifyPageSet()
+void GUIObject::NotifyPageSet()
{
std::vector<Condition>::iterator iter;
for (iter = mConditions.begin(); iter != mConditions.end(); iter++)
@@ -175,7 +179,7 @@ void Conditional::NotifyPageSet()
}
}
-bool Conditional::isMounted(string vol)
+bool GUIObject::isMounted(string vol)
{
FILE *fp;
char tmpOutput[255];
diff --git a/gui/objects.hpp b/gui/objects.hpp
index e8110b016..42dfb1f09 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -122,10 +122,11 @@ protected:
int mActionX, mActionY, mActionW, mActionH;
};
-class Conditional
+class GUIObject
{
public:
- Conditional(xml_node<>* node);
+ GUIObject(xml_node<>* node);
+ virtual ~GUIObject();
public:
bool IsConditionVariable(std::string var);
@@ -169,7 +170,7 @@ protected:
// Derived Objects
// GUIText - Used for static text
-class GUIText : public RenderObject, public ActionObject, public Conditional
+class GUIText : public GUIObject, public RenderObject, public ActionObject
{
public:
// w and h may be ignored, in which case, no bounding box is applied
@@ -217,7 +218,7 @@ protected:
};
// GUIImage - Used for static image
-class GUIImage : public RenderObject, public Conditional
+class GUIImage : public GUIObject, public RenderObject
{
public:
GUIImage(xml_node<>* node);
@@ -240,7 +241,7 @@ protected:
};
// GUIFill - Used for fill colors
-class GUIFill : public RenderObject
+class GUIFill : public GUIObject, public RenderObject
{
public:
GUIFill(xml_node<>* node);
@@ -255,7 +256,7 @@ protected:
};
// GUIAction - Used for standard actions
-class GUIAction : public ActionObject, public Conditional
+class GUIAction : public GUIObject, public ActionObject
{
public:
GUIAction(xml_node<>* node);
@@ -289,7 +290,7 @@ protected:
time_t Start;
};
-class GUIConsole : public RenderObject, public ActionObject
+class GUIConsole : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIConsole(xml_node<>* node);
@@ -347,7 +348,7 @@ protected:
virtual int RenderConsole(void);
};
-class GUIButton : public RenderObject, public ActionObject, public Conditional
+class GUIButton : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIButton(xml_node<>* node);
@@ -386,7 +387,7 @@ protected:
Placement TextPlacement;
};
-class GUICheckbox: public RenderObject, public ActionObject, public Conditional
+class GUICheckbox: public GUIObject, public RenderObject, public ActionObject
{
public:
GUICheckbox(xml_node<>* node);
@@ -420,7 +421,7 @@ protected:
std::string mVarName;
};
-class GUIFileSelector : public RenderObject, public ActionObject
+class GUIFileSelector : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIFileSelector(xml_node<>* node);
@@ -524,7 +525,7 @@ protected:
bool updateFileList;
};
-class GUIListBox : public RenderObject, public ActionObject
+class GUIListBox : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIListBox(xml_node<>* node);
@@ -612,7 +613,7 @@ protected:
int touchDebounce;
};
-class GUIPartitionList : public RenderObject, public ActionObject
+class GUIPartitionList : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIPartitionList(xml_node<>* node);
@@ -697,7 +698,7 @@ protected:
};
// GUIAnimation - Used for animations
-class GUIAnimation : public RenderObject
+class GUIAnimation : public GUIObject, public RenderObject
{
public:
GUIAnimation(xml_node<>* node);
@@ -720,7 +721,7 @@ protected:
int mUpdateCount;
};
-class GUIProgressBar : public RenderObject, public ActionObject
+class GUIProgressBar : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIProgressBar(xml_node<>* node);
@@ -753,7 +754,7 @@ protected:
virtual int RenderInternal(void); // Does the actual render
};
-class GUISlider : public RenderObject, public ActionObject
+class GUISlider : public GUIObject, public RenderObject, public ActionObject
{
public:
GUISlider(xml_node<>* node);
@@ -798,7 +799,7 @@ protected:
#define KEYBOARD_SPECIAL_KEYS 245
#define KEYBOARD_BACKSPACE 8
-class GUIKeyboard : public RenderObject, public ActionObject, public Conditional
+class GUIKeyboard : public GUIObject, public RenderObject, public ActionObject
{
public:
GUIKeyboard(xml_node<>* node);
@@ -836,7 +837,7 @@ protected:
};
// GUIInput - Used for keyboard input
-class GUIInput : public RenderObject, public ActionObject, public Conditional, public InputObject
+class GUIInput : public GUIObject, public RenderObject, public ActionObject, public InputObject
{
public:
// w and h may be ignored, in which case, no bounding box is applied
@@ -912,7 +913,7 @@ public:
virtual int KeyRepeat(void);
};
-class GUISliderValue: public RenderObject, public ActionObject, public Conditional
+class GUISliderValue: public GUIObject, public RenderObject, public ActionObject
{
public:
GUISliderValue(xml_node<>* node);
diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp
index 35bf702bb..cb9011f30 100644
--- a/gui/partitionlist.cpp
+++ b/gui/partitionlist.cpp
@@ -52,7 +52,7 @@ extern "C" {
#define SCROLLING_FLOOR 10
#define SCROLLING_MULTIPLIER 6
-GUIPartitionList::GUIPartitionList(xml_node<>* node)
+GUIPartitionList::GUIPartitionList(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -344,6 +344,9 @@ GUIPartitionList::~GUIPartitionList()
int GUIPartitionList::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
// First step, fill background
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, 255);
gr_fill(mRenderX, mRenderY + mHeaderH, mRenderW, mRenderH - mHeaderH);
@@ -525,6 +528,9 @@ int GUIPartitionList::Render(void)
int GUIPartitionList::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
@@ -619,6 +625,9 @@ int GUIPartitionList::GetSelection(int x, int y)
int GUIPartitionList::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
static int lastY = 0, last2Y = 0;
int selection = 0;
@@ -820,6 +829,9 @@ int GUIPartitionList::NotifyTouch(TOUCH_STATE state, int x, int y)
int GUIPartitionList::NotifyVarChange(std::string varName, std::string value)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
diff --git a/gui/progressbar.cpp b/gui/progressbar.cpp
index d53fdc19f..9c80eb40a 100644
--- a/gui/progressbar.cpp
+++ b/gui/progressbar.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUIProgressBar::GUIProgressBar(xml_node<>* node)
+GUIProgressBar::GUIProgressBar(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -82,6 +82,9 @@ GUIProgressBar::GUIProgressBar(xml_node<>* node)
int GUIProgressBar::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
// This handles making sure timing updates occur
Update();
return RenderInternal();
@@ -102,6 +105,9 @@ int GUIProgressBar::RenderInternal(void)
int GUIProgressBar::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
std::string str;
int min, max, cur, pos;
@@ -168,6 +174,9 @@ int GUIProgressBar::Update(void)
int GUIProgressBar::NotifyVarChange(std::string varName, std::string value)
{
+ if(!isConditionTrue())
+ return 0;
+
static int nextPush = 0;
if (varName.empty())
diff --git a/gui/slider.cpp b/gui/slider.cpp
index af0c542de..692676561 100644
--- a/gui/slider.cpp
+++ b/gui/slider.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUISlider::GUISlider(xml_node<>* node)
+GUISlider::GUISlider(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -93,6 +93,9 @@ GUISlider::~GUISlider()
int GUISlider::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!sSlider || !sSlider->GetResource())
return -1;
@@ -113,6 +116,9 @@ int GUISlider::Render(void)
int GUISlider::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (sUpdate)
return 2;
return 0;
@@ -120,6 +126,9 @@ int GUISlider::Update(void)
int GUISlider::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
static bool dragging = false;
switch (state)
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index d369aceb9..c83456b9e 100644
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUISliderValue::GUISliderValue(xml_node<>* node) : Conditional(node)
+GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
diff --git a/gui/text.cpp b/gui/text.cpp
index 7eb6c18b4..715880b62 100644
--- a/gui/text.cpp
+++ b/gui/text.cpp
@@ -26,7 +26,7 @@ extern "C" {
#include "objects.hpp"
GUIText::GUIText(xml_node<>* node)
- : Conditional(node)
+ : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;