Whitespace cleanup
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
diff --git a/gui/action.cpp b/gui/action.cpp
index 5ba749c..8f85e16 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -107,7 +107,7 @@
ActionThread::~ActionThread()
{
pthread_mutex_lock(&m_act_lock);
- if(m_thread_running) {
+ if (m_thread_running) {
pthread_mutex_unlock(&m_act_lock);
pthread_join(m_thread, NULL);
} else {
@@ -262,7 +262,7 @@
if (attr)
{
std::vector<std::string> keys = TWFunc::Split_String(attr->value(), "+");
- for(size_t i = 0; i < keys.size(); ++i)
+ for (size_t i = 0; i < keys.size(); ++i)
{
const int key = getKeyByName(keys[i]);
mKeys[key] = false;
@@ -297,7 +297,7 @@
int GUIAction::NotifyKey(int key, bool down)
{
std::map<int, bool>::iterator itr = mKeys.find(key);
- if(itr == mKeys.end())
+ if (itr == mKeys.end())
return 1;
bool prevState = itr->second;
@@ -307,20 +307,20 @@
// doesn't trigger with multi-key actions.
// Else, check if all buttons are pressed, then consume their release events
// so they don't trigger one-button actions and reset mKeys pressed status
- if(mKeys.size() == 1) {
- if(!down && prevState) {
+ if (mKeys.size() == 1) {
+ if (!down && prevState) {
doActions();
return 0;
}
- } else if(down) {
- for(itr = mKeys.begin(); itr != mKeys.end(); ++itr) {
- if(!itr->second)
+ } else if (down) {
+ for (itr = mKeys.begin(); itr != mKeys.end(); ++itr) {
+ if (!itr->second)
return 1;
}
// Passed, all req buttons are pressed, reset them and consume release events
HardwareKeyboard *kb = PageManager::GetHardwareKeyboard();
- for(itr = mKeys.begin(); itr != mKeys.end(); ++itr) {
+ for (itr = mKeys.begin(); itr != mKeys.end(); ++itr) {
kb->ConsumeKeyRelease(itr->first);
itr->second = false;
}
@@ -338,7 +338,7 @@
if (varName.empty() && !isConditionValid() && mKeys.empty() && !mActionW)
doActions();
- else if((varName.empty() || IsConditionVariable(varName)) && isConditionValid() && isConditionTrue())
+ else if ((varName.empty() || IsConditionVariable(varName)) && isConditionValid() && isConditionTrue())
doActions();
return 0;
@@ -707,7 +707,7 @@
int divide_by = atoi(divide_by_str.c_str());
int value;
- if(divide_by != 0)
+ if (divide_by != 0)
{
DataManager::GetValue(varName, value);
DataManager::SetValue(varName, value/divide_by);
@@ -855,7 +855,7 @@
} else {
DataManager::SetValue("tw_check_partition_list", 0);
}
- return 0;
+ return 0;
}
int GUIAction::getpartitiondetails(std::string arg)
@@ -943,19 +943,19 @@
gid_t gid = -1;
struct passwd *pwd = getpwnam("media_rw");
- if(pwd) {
+ if (pwd) {
uid = pwd->pw_uid;
gid = pwd->pw_gid;
}
const std::string storage = DataManager::GetCurrentStoragePath();
- if(PartitionManager.Is_Mounted_By_Path(storage)) {
+ if (PartitionManager.Is_Mounted_By_Path(storage)) {
snprintf(path, sizeof(path), "%s/Pictures/Screenshots/", storage.c_str());
} else {
strcpy(path, "/tmp/");
}
- if(!TWFunc::Create_Dir_Recursive(path, 0775, uid, gid))
+ if (!TWFunc::Create_Dir_Recursive(path, 0775, uid, gid))
return 0;
tm = time(NULL);
@@ -965,7 +965,7 @@
strftime(path+path_len, sizeof(path)-path_len, "Screenshot_%Y-%m-%d-%H-%M-%S.png", localtime(&tm));
int res = gr_save_screenshot(path);
- if(res == 0) {
+ if (res == 0) {
chmod(path, 0666);
chown(path, uid, gid);
@@ -1388,7 +1388,7 @@
struct timeval timeout;
fd_set fdset;
- while(keep_going)
+ while (keep_going)
{
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
@@ -1406,7 +1406,7 @@
keep_going = 0;
} else {
// Try to read output
- if(fgets(line, sizeof(line), fp) != NULL)
+ if (fgets(line, sizeof(line), fp) != NULL)
gui_print("%s", line); // Display output
else
keep_going = 0; // Done executing
diff --git a/gui/animation.cpp b/gui/animation.cpp
index d45373d..37f0d08 100644
--- a/gui/animation.cpp
+++ b/gui/animation.cpp
@@ -88,7 +88,7 @@
int GUIAnimation::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (!mAnimation || !mAnimation->GetResource(mFrame)) return -1;
@@ -99,7 +99,7 @@
int GUIAnimation::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (!mAnimation) return -1;
diff --git a/gui/console.cpp b/gui/console.cpp
index 6f375ff..b518e77 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -78,7 +78,7 @@
}
// 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);
}
@@ -205,7 +205,10 @@
if (!node)
{
- mRenderX = 0; mRenderY = 0; mRenderW = gr_fb_width(); mRenderH = gr_fb_height();
+ mRenderX = 0;
+ mRenderY = 0;
+ mRenderW = gr_fb_width();
+ mRenderH = gr_fb_height();
}
else
{
@@ -276,7 +279,7 @@
int GUIConsole::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (mSlideout && mSlideoutState == hidden)
@@ -346,7 +349,7 @@
// 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())
+ if (!isConditionTrue())
return -1;
if (mSlideout && x >= mSlideoutX && x < mSlideoutX + mSlideoutW && y >= mSlideoutY && y < mSlideoutY + mSlideoutH) {
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 9275d97..fa4ed82 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -127,7 +127,7 @@
int GUIFileSelector::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
GUIScrollList::Update();
@@ -155,7 +155,7 @@
{
GUIScrollList::NotifyVarChange(varName, value);
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (varName.empty()) {
diff --git a/gui/fill.cpp b/gui/fill.cpp
index d0a1cfd..0fda4b4 100644
--- a/gui/fill.cpp
+++ b/gui/fill.cpp
@@ -42,7 +42,7 @@
int GUIFill::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
diff --git a/gui/gui.cpp b/gui/gui.cpp
index df41939..17ed108 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -300,15 +300,15 @@
// Handle key-press here
LOGEVENT("TOUCH_KEY: %d\n", ev.code);
// Left mouse button is treated as a touch
- if(ev.code == BTN_LEFT)
+ if (ev.code == BTN_LEFT)
{
MouseCursor *cursor = PageManager::GetMouseCursor();
- if(ev.value == 1)
+ if (ev.value == 1)
{
cursor->GetPos(x, y);
doTouchStart();
}
- else if(touch_status)
+ else if (touch_status)
{
// Left mouse button was previously pressed and now is
// being released so send a TOUCH_RELEASE
@@ -323,9 +323,9 @@
}
}
// side mouse button, often used for "back" function
- else if(ev.code == BTN_SIDE)
+ else if (ev.code == BTN_SIDE)
{
- if(ev.value == 1)
+ if (ev.value == 1)
kb->KeyDown(KEY_BACK);
else
kb->KeyUp(KEY_BACK);
@@ -366,12 +366,12 @@
// Mouse movement
MouseCursor *cursor = PageManager::GetMouseCursor();
LOGEVENT("EV_REL %d %d\n", ev.code, ev.value);
- if(ev.code == REL_X)
+ if (ev.code == REL_X)
cursor->Move(ev.value, 0);
- else if(ev.code == REL_Y)
+ else if (ev.code == REL_Y)
cursor->Move(0, ev.value);
- if(touch_status) {
+ if (touch_status) {
cursor->GetPos(x, y);
LOGEVENT("Mouse TOUCH_DRAG: %d, %d\n", x, y);
key_status = KS_NONE;
diff --git a/gui/input.cpp b/gui/input.cpp
index ec370ab..8dd981c 100644
--- a/gui/input.cpp
+++ b/gui/input.cpp
@@ -236,7 +236,7 @@
unsigned index = 0, displaySize = displayValue.size();
int prevX = mRenderX + scrollingX;
- for(index = 0; index <= displaySize; index++) {
+ for (index = 0; index <= displaySize; index++) {
cursorString = displayValue.substr(0, index);
cursorX = gr_ttf_measureEx(cursorString.c_str(), fontResource) + mRenderX + scrollingX;
if (cursorX > x) {
@@ -263,7 +263,7 @@
}
void GUIInput::HandleCursorByText() {
-// Uses mCursorLocation to find cursorX
+// Uses mCursorLocation to find cursorX
if (!DrawCursor)
return;
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index e10fee7..05276e8 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -123,7 +123,7 @@
int GUIListBox::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
GUIScrollList::Update();
@@ -140,7 +140,7 @@
{
GUIScrollList::NotifyVarChange(varName, value);
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
// Check to see if the variable that we are using to store the list selected value has been updated
diff --git a/gui/mousecursor.cpp b/gui/mousecursor.cpp
index bd730df..cb5e11b 100644
--- a/gui/mousecursor.cpp
+++ b/gui/mousecursor.cpp
@@ -52,15 +52,15 @@
xml_node<>* child;
child = FindNode(node, "placement");
- if(child)
+ if (child)
LoadPlacement(child, &mRenderX, &mRenderY, &mRenderW, &mRenderH);
child = FindNode(node, "background");
- if(child)
+ if (child)
{
m_color = LoadAttrColor(child, "color", m_color);
m_image = LoadAttrImage(child, "resource");
- if(m_image)
+ if (m_image)
{
mRenderW = m_image->GetWidth();
mRenderH = m_image->GetHeight();
@@ -68,20 +68,20 @@
}
child = FindNode(node, "speed");
- if(child)
+ if (child)
{
attr = child->first_attribute("multiplier");
- if(attr)
+ if (attr)
m_speedMultiplier = atof(attr->value());
}
}
int MouseCursor::Render(void)
{
- if(!m_present)
+ if (!m_present)
return 0;
- if(m_image)
+ if (m_image)
{
gr_blit(m_image->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
}
@@ -95,15 +95,15 @@
int MouseCursor::Update(void)
{
- if(m_present != ev_has_mouse())
+ if (m_present != ev_has_mouse())
{
m_present = ev_has_mouse();
- if(m_present)
+ if (m_present)
SetRenderPos(m_resX/2, m_resY/2);
return 2;
}
- if(m_present && m_moved)
+ if (m_present && m_moved)
{
m_moved = false;
return 2;
@@ -113,7 +113,7 @@
int MouseCursor::SetRenderPos(int x, int y, int w, int h)
{
- if(x == mRenderX && y == mRenderY)
+ if (x == mRenderX && y == mRenderY)
m_moved = true;
return RenderObject::SetRenderPos(x, y, w, h);
@@ -121,7 +121,7 @@
void MouseCursor::Move(int deltaX, int deltaY)
{
- if(deltaX != 0)
+ if (deltaX != 0)
{
mRenderX += deltaX*m_speedMultiplier;
mRenderX = (std::min)(mRenderX, m_resX);
@@ -130,7 +130,7 @@
m_moved = true;
}
- if(deltaY != 0)
+ if (deltaY != 0)
{
mRenderY += deltaY*m_speedMultiplier;
mRenderY = (std::min)(mRenderY, m_resY);
diff --git a/gui/object.cpp b/gui/object.cpp
index e7d1bf9..be831a7 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -159,7 +159,7 @@
std::vector<Condition>::iterator iter;
for (iter = conditions.begin(); iter != conditions.end(); ++iter)
{
- if(varNameEmpty && iter->mCompareOp == "modified")
+ if (varNameEmpty && iter->mCompareOp == "modified")
{
string val;
@@ -172,10 +172,10 @@
iter->mLastVal = val;
}
- if(varNameEmpty || iter->mVar1 == varName || iter->mVar2 == varName)
+ if (varNameEmpty || iter->mVar1 == varName || iter->mVar2 == varName)
iter->mLastResult = isConditionTrue(&(*iter));
- if(!iter->mLastResult)
+ if (!iter->mLastResult)
result = false;
}
return result;
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 7506277..f1c9c49 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -1234,8 +1234,6 @@
FontResource* LoadAttrFont(xml_node<>* element, const char* attrname);
ImageResource* LoadAttrImage(xml_node<>* element, const char* attrname);
AnimationResource* LoadAttrAnimation(xml_node<>* element, const char* attrname);
-
bool LoadPlacement(xml_node<>* node, int* x, int* y, int* w = NULL, int* h = NULL, Placement* placement = NULL);
#endif // _OBJECTS_HEADER
-
diff --git a/gui/pages.cpp b/gui/pages.cpp
index d7cb92d..5c647c3 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -1009,7 +1009,7 @@
name = child->first_attribute("name");
value = child->first_attribute("value");
persist = child->first_attribute("persist");
- if(name && value)
+ if (name && value)
{
if (strcmp(name->value(), "tw_x_offset") == 0) {
tw_x_offset = atoi(value->value());
@@ -1193,7 +1193,7 @@
// We can try to load the XML directly...
LOGINFO("PageManager::LoadFileToBuffer loading filename: '%s' directly\n", filename.c_str());
struct stat st;
- if(stat(filename.c_str(),&st) != 0) {
+ if (stat(filename.c_str(),&st) != 0) {
// This isn't always an error, sometimes we request files that don't exist.
return NULL;
}
@@ -1471,7 +1471,7 @@
if (iter == mPageSets.end())
return -1;
- if(mMouseCursor)
+ if (mMouseCursor)
mMouseCursor->ResetData(gr_fb_width(), gr_fb_height());
PageSet* set = (*iter).second;
@@ -1589,18 +1589,18 @@
int PageManager::Render(void)
{
- if(blankTimer.isScreenOff())
+ if (blankTimer.isScreenOff())
return 0;
int res = (mCurrentSet ? mCurrentSet->Render() : -1);
- if(mMouseCursor)
+ if (mMouseCursor)
mMouseCursor->Render();
return res;
}
HardwareKeyboard *PageManager::GetHardwareKeyboard()
{
- if(!mHardwareKeyboard)
+ if (!mHardwareKeyboard)
mHardwareKeyboard = new HardwareKeyboard();
return mHardwareKeyboard;
}
@@ -1630,14 +1630,14 @@
MouseCursor *PageManager::GetMouseCursor()
{
- if(!mMouseCursor)
+ if (!mMouseCursor)
mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height());
return mMouseCursor;
}
void PageManager::LoadCursorData(xml_node<>* node)
{
- if(!mMouseCursor)
+ if (!mMouseCursor)
mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height());
mMouseCursor->LoadData(node);
@@ -1645,7 +1645,7 @@
int PageManager::Update(void)
{
- if(blankTimer.isScreenOff())
+ if (blankTimer.isScreenOff())
return 0;
if (RunReload())
@@ -1653,10 +1653,10 @@
int res = (mCurrentSet ? mCurrentSet->Update() : -1);
- if(mMouseCursor)
+ if (mMouseCursor)
{
int c_res = mMouseCursor->Update();
- if(c_res > res)
+ if (c_res > res)
res = c_res;
}
return res;
diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp
index ff207fa..dca3904 100644
--- a/gui/partitionlist.cpp
+++ b/gui/partitionlist.cpp
@@ -79,7 +79,7 @@
int GUIPartitionList::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
// Check for changes in mount points if the list type is mount and update the list and render if needed
@@ -101,8 +101,8 @@
if (updateList) {
int listSize = 0;
- // Completely update the list if needed -- Used primarily for
- // restore as the list for restore will change depending on what
+ // Completely update the list if needed -- Used primarily for
+ // restore as the list for restore will change depending on what
// partitions were backed up
mList.clear();
PartitionManager.Get_Partition_List(ListType, &mList);
@@ -126,7 +126,7 @@
{
GUIScrollList::NotifyVarChange(varName, value);
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (varName == mVariable && !mUpdate)
diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp
index ab446b9..4bce37a 100644
--- a/gui/patternpassword.cpp
+++ b/gui/patternpassword.cpp
@@ -54,7 +54,7 @@
mAction = new GUIAction(node);
child = FindNode(node, "dot");
- if(child)
+ if (child)
{
mDotColor = LoadAttrColor(child, "color", mDotColor);
mActiveDotColor = LoadAttrColor(child, "activecolor", mActiveDotColor);
@@ -65,18 +65,18 @@
}
child = FindNode(node, "line");
- if(child)
+ if (child)
{
mLineColor = LoadAttrColor(child, "color", mLineColor);
mLineWidth = LoadAttrIntScaleX(child, "width", mLineWidth);
}
child = FindNode(node, "data");
- if(child)
+ if (child)
mPassVar = LoadAttrString(child, "name", "");
child = FindNode(node, "size");
- if(child) {
+ if (child) {
mSizeVar = LoadAttrString(child, "name", "");
// Use the configured default, if set.
@@ -84,7 +84,7 @@
Resize(size);
}
- if(!mDotImage || !mDotImage->GetResource() || !mActiveDotImage || !mActiveDotImage->GetResource())
+ if (!mDotImage || !mDotImage->GetResource() || !mActiveDotImage || !mActiveDotImage->GetResource())
{
mDotCircle = gr_render_circle(mDotRadius, mDotColor.red, mDotColor.green, mDotColor.blue, mDotColor.alpha);
mActiveDotCircle = gr_render_circle(mDotRadius/2, mActiveDotColor.red, mActiveDotColor.green, mActiveDotColor.blue, mActiveDotColor.alpha);
@@ -104,10 +104,10 @@
delete[] mDots;
delete[] mConnectedDots;
- if(mDotCircle)
+ if (mDotCircle)
gr_free_surface(mDotCircle);
- if(mActiveDotCircle)
+ if (mActiveDotCircle)
gr_free_surface(mActiveDotCircle);
}
@@ -115,7 +115,7 @@
{
mConnectedDotsLen = 0;
mCurLineX = mCurLineY = -1;
- for(size_t i = 0; i < mGridSize * mGridSize; ++i)
+ for (size_t i = 0; i < mGridSize * mGridSize; ++i)
mDots[i].active = false;
}
@@ -155,9 +155,9 @@
* n*n-1
*/
- for(size_t r = 0; r < mGridSize; ++r)
+ for (size_t r = 0; r < mGridSize; ++r)
{
- for(size_t c = 0; c < mGridSize; ++c)
+ for (size_t c = 0; c < mGridSize; ++c)
{
mDots[mGridSize*r + c].x = x;
mDots[mGridSize*r + c].y = y;
@@ -170,29 +170,29 @@
int GUIPatternPassword::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
gr_color(mLineColor.red, mLineColor.green, mLineColor.blue, mLineColor.alpha);
- for(size_t i = 1; i < mConnectedDotsLen; ++i) {
+ for (size_t i = 1; i < mConnectedDotsLen; ++i) {
const Dot& dp = mDots[mConnectedDots[i-1]];
const Dot& dc = mDots[mConnectedDots[i]];
gr_line(dp.x + mDotRadius, dp.y + mDotRadius, dc.x + mDotRadius, dc.y + mDotRadius, mLineWidth);
}
- if(mConnectedDotsLen > 0 && mTrackingTouch) {
+ if (mConnectedDotsLen > 0 && mTrackingTouch) {
const Dot& dc = mDots[mConnectedDots[mConnectedDotsLen-1]];
gr_line(dc.x + mDotRadius, dc.y + mDotRadius, mCurLineX, mCurLineY, mLineWidth);
}
- for(size_t i = 0; i < mGridSize * mGridSize; ++i) {
- if(mDotCircle) {
+ for (size_t i = 0; i < mGridSize * mGridSize; ++i) {
+ if (mDotCircle) {
gr_blit(mDotCircle, 0, 0, gr_get_width(mDotCircle), gr_get_height(mDotCircle), mDots[i].x, mDots[i].y);
- if(mDots[i].active) {
+ if (mDots[i].active) {
gr_blit(mActiveDotCircle, 0, 0, gr_get_width(mActiveDotCircle), gr_get_height(mActiveDotCircle), mDots[i].x + mDotRadius/2, mDots[i].y + mDotRadius/2);
}
} else {
- if(mDots[i].active) {
+ if (mDots[i].active) {
gr_blit(mActiveDotImage->GetResource(), 0, 0, mActiveDotImage->GetWidth(), mActiveDotImage->GetHeight(),
mDots[i].x + (mDotRadius - mActiveDotImage->GetWidth()/2), mDots[i].y + (mDotRadius - mActiveDotImage->GetHeight()/2));
} else {
@@ -205,7 +205,7 @@
int GUIPatternPassword::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
int res = mNeedRender ? 2 : 1;
@@ -214,7 +214,7 @@
}
void GUIPatternPassword::Resize(size_t n) {
- if(mGridSize == n)
+ if (mGridSize == n)
return;
delete[] mDots;
@@ -247,8 +247,8 @@
int GUIPatternPassword::InDot(int x, int y)
{
- for(size_t i = 0; i < mGridSize * mGridSize; ++i) {
- if(IsInCircle(x, y, mDots[i].x + mDotRadius, mDots[i].y + mDotRadius, mDotRadius*3))
+ for (size_t i = 0; i < mGridSize * mGridSize; ++i) {
+ if (IsInCircle(x, y, mDots[i].x + mDotRadius, mDots[i].y + mDotRadius, mDotRadius*3))
return i;
}
return -1;
@@ -256,8 +256,8 @@
bool GUIPatternPassword::DotUsed(int dot_idx)
{
- for(size_t i = 0; i < mConnectedDotsLen; ++i) {
- if(mConnectedDots[i] == dot_idx)
+ for (size_t i = 0; i < mConnectedDotsLen; ++i) {
+ if (mConnectedDots[i] == dot_idx)
return true;
}
return false;
@@ -265,7 +265,7 @@
void GUIPatternPassword::ConnectDot(int dot_idx)
{
- if(mConnectedDotsLen >= mGridSize * mGridSize)
+ if (mConnectedDotsLen >= mGridSize * mGridSize)
{
LOGERR("mConnectedDots in GUIPatternPassword has overflown!\n");
return;
@@ -277,7 +277,7 @@
void GUIPatternPassword::ConnectIntermediateDots(int next_dot_idx)
{
- if(mConnectedDotsLen == 0)
+ if (mConnectedDotsLen == 0)
return;
const int prev_dot_idx = mConnectedDots[mConnectedDotsLen-1];
@@ -311,15 +311,15 @@
int Dy = (ny > py) ? 1 : -1;
// Vertical lines.
- if(px == nx)
+ if (px == nx)
Dx = 0;
// Horizontal lines.
- else if(py == ny)
+ else if (py == ny)
Dy = 0;
// Diagonal lines (|∆x| = |∆y|).
- else if(abs(px - nx) == abs(py - ny))
+ else if (abs(px - nx) == abs(py - ny))
;
// No valid intermediate dots.
@@ -327,19 +327,19 @@
return;
// Iterate along axis, adding dots in the correct order.
- while((Dy == 0 || y != ny - Dy) && (Dx == 0 || x != nx - Dx)) {
+ while ((Dy == 0 || y != ny - Dy) && (Dx == 0 || x != nx - Dx)) {
x += Dx;
y += Dy;
int idx = mGridSize * y + x;
- if(!DotUsed(idx))
+ if (!DotUsed(idx))
ConnectDot(idx);
}
}
int GUIPatternPassword::NotifyTouch(TOUCH_STATE state, int x, int y)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return -1;
switch (state)
@@ -347,7 +347,7 @@
case TOUCH_START:
{
const int dot_idx = InDot(x, y);
- if(dot_idx == -1)
+ if (dot_idx == -1)
break;
mTrackingTouch = true;
@@ -361,11 +361,11 @@
}
case TOUCH_DRAG:
{
- if(!mTrackingTouch)
+ if (!mTrackingTouch)
break;
const int dot_idx = InDot(x, y);
- if(dot_idx != -1 && !DotUsed(dot_idx))
+ if (dot_idx != -1 && !DotUsed(dot_idx))
{
ConnectIntermediateDots(dot_idx);
ConnectDot(dot_idx);
@@ -379,7 +379,7 @@
}
case TOUCH_RELEASE:
{
- if(!mTrackingTouch)
+ if (!mTrackingTouch)
break;
mNeedRender = true;
@@ -396,10 +396,10 @@
int GUIPatternPassword::NotifyVarChange(const std::string& varName, const std::string& value)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
- if(varName == mSizeVar) {
+ if (varName == mSizeVar) {
Resize(atoi(value.c_str()));
mUpdate = true;
}
@@ -420,8 +420,8 @@
std::string GUIPatternPassword::GeneratePassphrase()
{
char pattern[mConnectedDotsLen];
- for(size_t i = 0; i < mConnectedDotsLen; i++) {
- pattern[i] = (char) mConnectedDots[i];
+ for (size_t i = 0; i < mConnectedDotsLen; i++) {
+ pattern[i] = (char) mConnectedDots[i];
}
std::stringstream pass;
@@ -461,9 +461,9 @@
void GUIPatternPassword::PatternDrawn()
{
- if(!mPassVar.empty() && mConnectedDotsLen > 0)
+ if (!mPassVar.empty() && mConnectedDotsLen > 0)
DataManager::SetValue(mPassVar, GeneratePassphrase());
- if(mAction)
+ if (mAction)
mAction->doActions();
}
diff --git a/gui/progressbar.cpp b/gui/progressbar.cpp
index fc2a497..c40e63e 100644
--- a/gui/progressbar.cpp
+++ b/gui/progressbar.cpp
@@ -67,7 +67,7 @@
int GUIProgressBar::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
// This handles making sure timing updates occur
@@ -90,7 +90,7 @@
int GUIProgressBar::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
std::string str;
@@ -165,7 +165,7 @@
{
GUIObject::NotifyVarChange(varName, value);
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
static int nextPush = 0;
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 8884dd7..000912d 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -124,7 +124,7 @@
file = attr->value();
- if(file.size() >= 4 && file.compare(file.size()-4, 4, ".ttf") == 0)
+ if (file.size() >= 4 && file.compare(file.size()-4, 4, ".ttf") == 0)
{
int font_size = 0;
@@ -144,7 +144,7 @@
int dpi = 300;
attr = node->first_attribute("dpi");
- if(attr)
+ if (attr)
dpi = atoi(attr->value());
// we can't use TMP_RESOURCE_NAME here because the ttf subsystem is caching the name and scaling needs to reload the font
@@ -166,10 +166,10 @@
}
void FontResource::DeleteFont() {
- if(mFont)
+ if (mFont)
gr_ttf_freeFont(mFont);
mFont = NULL;
- if(origFont)
+ if (origFont)
gr_ttf_freeFont(origFont);
origFont = NULL;
}
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
index 291b382..7540356 100644
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -190,7 +190,7 @@
int GUIScrollList::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
// First step, fill background
@@ -352,7 +352,7 @@
int GUIScrollList::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (!mHeaderIsStatic) {
@@ -421,7 +421,7 @@
int GUIScrollList::NotifyTouch(TOUCH_STATE state, int x, int y)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return -1;
switch (state)
@@ -524,7 +524,7 @@
{
// handle dragging downward, scrolling upward
// the offset should always be <= 0 and > -actualItemHeight, adjust the first display row and offset as needed
- while(firstDisplayedItem && y_offset > 0) {
+ while (firstDisplayedItem && y_offset > 0) {
firstDisplayedItem--;
y_offset -= actualItemHeight;
}
@@ -569,7 +569,7 @@
{
GUIObject::NotifyVarChange(varName, value);
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (!mHeaderIsStatic) {
@@ -624,7 +624,7 @@
string curr_color;
if (origColor)
curr_color = origColor->at(i);
- for(;;) {
+ for (;;) {
size_t line_char_width = gr_ttf_maxExW(curr_line.c_str(), mFont->GetResource(), mRenderW);
if (line_char_width < curr_line.size()) {
//string left = curr_line.substr(0, line_char_width);
diff --git a/gui/slider.cpp b/gui/slider.cpp
index 59b295b..1a2f59e 100644
--- a/gui/slider.cpp
+++ b/gui/slider.cpp
@@ -108,7 +108,7 @@
int GUISlider::Render(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (!sSlider || !sSlider->GetResource())
@@ -136,7 +136,7 @@
int GUISlider::Update(void)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return 0;
if (sUpdate)
@@ -146,7 +146,7 @@
int GUISlider::NotifyTouch(TOUCH_STATE state, int x, int y)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return -1;
static bool dragging = false;
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index 088620a..b53797b 100644
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -62,7 +62,7 @@
}
mLabel = new GUIText(node);
- if(mLabel->Render() < 0)
+ if (mLabel->Render() < 0)
{
delete mLabel;
mLabel = NULL;
@@ -156,7 +156,7 @@
mFontHeight = mFont->GetHeight();
- if(mShowCurr)
+ if (mShowCurr)
{
int maxLen = std::max(strlen(mMinStr.c_str()), strlen(mMaxStr.c_str()));
mValueStr = new char[maxLen+1];
@@ -182,10 +182,10 @@
void GUISliderValue::loadValue(bool force)
{
- if(!mVariable.empty())
+ if (!mVariable.empty())
{
int value = DataManager::GetIntValue(mVariable);
- if(mValue == value && !force)
+ if (mValue == value && !force)
return;
mValue = value;
@@ -208,7 +208,7 @@
}
mRenderH = mSliderH;
- if(mShowCurr)
+ if (mShowCurr)
mRenderH += mFontHeight;
if (mLabel)
@@ -230,7 +230,7 @@
mActionW = mRenderW;
mActionH = mRenderH;
- if(mBackgroundImage && mBackgroundImage->GetResource())
+ if (mBackgroundImage && mBackgroundImage->GetResource())
{
mLineW = mBackgroundImage->GetWidth();
mLineH = mBackgroundImage->GetHeight();
@@ -260,7 +260,7 @@
return 0;
}
- if(mLabel)
+ if (mLabel)
{
int w, h;
mLabel->GetCurrentBounds(w, h);
@@ -270,12 +270,12 @@
mLabel->SetRenderPos(textX, mRenderY);
}
int res = mLabel->Render();
- if(res < 0)
+ if (res < 0)
return res;
}
// line
- if(mBackgroundImage && mBackgroundImage->GetResource())
+ if (mBackgroundImage && mBackgroundImage->GetResource())
{
gr_blit(mBackgroundImage->GetResource(), 0, 0, mLineW, mLineH, mLineX, mLineY);
}
@@ -288,10 +288,10 @@
// slider
uint32_t sliderX = mLineX + (mValuePct*(mLineW - mSliderW))/100;
- if(mHandleImage && mHandleImage->GetResource())
+ if (mHandleImage && mHandleImage->GetResource())
{
gr_surface s = mHandleImage->GetResource();
- if(mDragging && mHandleHoverImage && mHandleHoverImage->GetResource())
+ if (mDragging && mHandleHoverImage && mHandleHoverImage->GetResource())
s = mHandleHoverImage->GetResource();
gr_blit(s, 0, 0, mSliderW, mSliderH, sliderX, mLineY + (mLineH/2 - mSliderH/2));
}
@@ -302,16 +302,16 @@
}
void *fontResource = NULL;
- if(mFont) fontResource = mFont->GetResource();
+ if (mFont) fontResource = mFont->GetResource();
gr_color(mTextColor.red, mTextColor.green, mTextColor.blue, mTextColor.alpha);
- if(mShowRange)
+ if (mShowRange)
{
int rangeY = (mLineY - mLineH/2) - mFontHeight/2;
gr_textEx_scaleW(mRenderX + mPadding/2, rangeY, mMinStr.c_str(), fontResource, mRenderW, TOP_LEFT, 0);
gr_textEx_scaleW(mLineX + mLineW + mPadding/2, rangeY, mMaxStr.c_str(), fontResource, mRenderW, TOP_LEFT, 0);
}
- if(mValueStr && mShowCurr)
+ if (mValueStr && mShowCurr)
{
sprintf(mValueStr, "%d", mValue);
int textW = measureText(mValueStr);
@@ -329,7 +329,7 @@
if (!mRendered)
return 2;
- if(mLabel)
+ if (mLabel)
return mLabel->Update();
return 0;
}
@@ -406,7 +406,7 @@
mLabel->NotifyVarChange(varName, value);
if (varName == mVariable) {
int newVal = atoi(value.c_str());
- if(newVal != mValue) {
+ if (newVal != mValue) {
mValue = newVal;
mValuePct = pctFromValue(mValue);
mRendered = false;
diff --git a/gui/terminal.cpp b/gui/terminal.cpp
index b4194d0..fe80fb0 100644
--- a/gui/terminal.cpp
+++ b/gui/terminal.cpp
@@ -500,7 +500,7 @@
uint32_t u8state = 0, u8cp = 0;
std::string& s = lines[y].text;
unpackedLine.cells.clear();
- for(size_t i = 0; i < s.size(); ++i) {
+ for (size_t i = 0; i < s.size(); ++i) {
uint32_t rc = utf8decode(&u8state, &u8cp, (unsigned char)s[i]);
if (rc == UTF8_ACCEPT)
unpackedLine.cells.push_back(Cell(u8cp));
@@ -776,7 +776,10 @@
lastCondition = false;
if (!node) {
- mRenderX = 0; mRenderY = 0; mRenderW = gr_fb_width(); mRenderH = gr_fb_height();
+ mRenderX = 0;
+ mRenderY = 0;
+ mRenderW = gr_fb_width();
+ mRenderH = gr_fb_height();
}
engine = &gEngine;
@@ -785,7 +788,7 @@
int GUITerminal::Update(void)
{
- if(!isConditionTrue()) {
+ if (!isConditionTrue()) {
lastCondition = false;
return 0;
}
@@ -816,7 +819,7 @@
// Return 0 on success, >0 to ignore remainder of touch, and <0 on error
int GUITerminal::NotifyTouch(TOUCH_STATE state, int x, int y)
{
- if(!isConditionTrue())
+ if (!isConditionTrue())
return -1;
// TODO: grab focus correctly
diff --git a/gui/textbox.cpp b/gui/textbox.cpp
index 2e2512c..2c7d09f 100644
--- a/gui/textbox.cpp
+++ b/gui/textbox.cpp
@@ -98,7 +98,7 @@
{
GUIScrollList::NotifyVarChange(varName, value);
- if(!isConditionTrue() || mIsStatic)
+ if (!isConditionTrue() || mIsStatic)
return 0;
// Check to see if the variable exists in mText
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index b36b5a6..80e358b 100644
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -386,9 +386,9 @@
</checkbox>
<checkbox>
- <placement x="%indent%" y="%row13a_y%" />
+ <placement x="%indent%" y="%row13a_y%"/>
<text>{@install_reboot_chk=Reboot after installation is complete}</text>
- <data variable="tw_install_reboot" />
+ <data variable="tw_install_reboot"/>
</checkbox>
<checkbox>
diff --git a/gui/twmsg.cpp b/gui/twmsg.cpp
index 57f1922..ebd6fc3 100644
--- a/gui/twmsg.cpp
+++ b/gui/twmsg.cpp
@@ -33,7 +33,7 @@
{
const std::vector<std::string>& vars;
const StringLookup& next;
- public:
+public:
LocalLookup(const std::vector<std::string>& vars, const StringLookup& next) : vars(vars), next(next) {}
virtual std::string operator()(const std::string& name) const
{