aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-05-06 20:33:21 +0000
committerjmarshallnz <jmarshallnz@svn>2010-05-06 20:33:21 +0000
commit8ccb2535f8cded99d07b0f7fbac4814093525eef (patch)
treeab10073396779bb8c59918aa8e1b2d6495b3760d
parent03633b567dfd083ed425fe31263793a4d12ab301 (diff)
added: Ticket #8885 - <scrollspeed> and <scrollsuffix> more generally. Thanks to EqUiNoX
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29851 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--guilib/GUIControlFactory.cpp17
-rw-r--r--guilib/GUIFadeLabelControl.cpp8
-rw-r--r--guilib/GUIFadeLabelControl.h2
-rw-r--r--guilib/GUIFont.h4
-rw-r--r--guilib/GUILabel.cpp8
-rw-r--r--guilib/GUILabel.h11
-rw-r--r--guilib/GUILabelControl.cpp4
-rw-r--r--guilib/GUILabelControl.h2
-rw-r--r--guilib/GUIListItemLayout.cpp4
-rw-r--r--guilib/GUIListLabel.cpp4
-rw-r--r--guilib/GUIListLabel.h2
-rw-r--r--guilib/GUIRSSControl.cpp4
-rw-r--r--guilib/GUIRSSControl.h2
-rw-r--r--xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp1
14 files changed, 39 insertions, 34 deletions
diff --git a/guilib/GUIControlFactory.cpp b/guilib/GUIControlFactory.cpp
index 8ea81f721b..8920311b48 100644
--- a/guilib/GUIControlFactory.cpp
+++ b/guilib/GUIControlFactory.cpp
@@ -764,7 +764,6 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
CRect hitRect;
CPoint camera;
bool hasCamera = false;
- int scrollSpeed = CScrollInfo::defaultSpeed;
bool resetOnLabelChange = true;
bool bPassword = false;
@@ -1094,7 +1093,13 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
g_SkinInfo->ResolveConstant(cam->Attribute("y"), camera.y);
}
- XMLUtils::GetInt(pControlNode, "scrollspeed", scrollSpeed);
+ XMLUtils::GetInt(pControlNode, "scrollspeed", labelInfo.scrollSpeed);
+ labelInfo2.scrollSpeed = labelInfo.scrollSpeed;
+ spinInfo.scrollSpeed = labelInfo.scrollSpeed;
+
+ GetString(pControlNode, "scrollsuffix", labelInfo.scrollSuffix);
+ labelInfo2.scrollSuffix = labelInfo.scrollSuffix;
+ spinInfo.scrollSuffix = labelInfo.scrollSuffix;
/////////////////////////////////////////////////////////////////////////////
// Instantiate a new control using the properties gathered above
@@ -1126,7 +1131,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
const CGUIInfoLabel &content = (infoLabels.size()) ? infoLabels[0] : CGUIInfoLabel("");
if (insideContainer)
{ // inside lists we use CGUIListLabel
- control = new CGUIListLabel(parentID, id, posX, posY, width, height, labelInfo, content, bScrollLabel, scrollSpeed);
+ control = new CGUIListLabel(parentID, id, posX, posY, width, height, labelInfo, content, bScrollLabel);
}
else
{
@@ -1134,7 +1139,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
parentID, id, posX, posY, width, height,
labelInfo, wrapMultiLine, bHasPath);
((CGUILabelControl *)control)->SetInfo(content);
- ((CGUILabelControl *)control)->SetWidthControl(minWidth, bScrollLabel, scrollSpeed);
+ ((CGUILabelControl *)control)->SetWidthControl(minWidth, bScrollLabel);
}
}
else if (type == CGUIControl::GUICONTROL_EDIT)
@@ -1156,7 +1161,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
{
control = new CGUIFadeLabelControl(
parentID, id, posX, posY, width, height,
- labelInfo, scrollOut, scrollSpeed, timeToPauseAtEnd, resetOnLabelChange);
+ labelInfo, scrollOut, timeToPauseAtEnd, resetOnLabelChange);
((CGUIFadeLabelControl *)control)->SetInfo(infoLabels);
}
@@ -1164,7 +1169,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
{
control = new CGUIRSSControl(
parentID, id, posX, posY, width, height,
- labelInfo, textColor3, labelInfo2.textColor, strRSSTags, scrollSpeed);
+ labelInfo, textColor3, labelInfo2.textColor, strRSSTags);
std::map<int,CSettings::RssSet>::iterator iter=g_settings.m_mapRssUrls.find(iUrlSet);
if (iter != g_settings.m_mapRssUrls.end())
diff --git a/guilib/GUIFadeLabelControl.cpp b/guilib/GUIFadeLabelControl.cpp
index 693f6f2cb6..2007e203b2 100644
--- a/guilib/GUIFadeLabelControl.cpp
+++ b/guilib/GUIFadeLabelControl.cpp
@@ -24,8 +24,8 @@
using namespace std;
-CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
- : CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, scrollSpeed)
+CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
+ : CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
, m_textLayout(labelInfo.font, false)
{
m_label = labelInfo;
@@ -37,7 +37,7 @@ CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float po
m_fadeAnim->ApplyAnimation();
m_renderTime = 0;
m_lastLabel = -1;
- m_scrollSpeed = scrollSpeed; // save it for later
+ m_scrollSpeed = labelInfo.scrollSpeed; // save it for later
m_resetOnLabelChange = resetOnLabelChange;
m_shortText = false;
}
@@ -108,7 +108,7 @@ void CGUIFadeLabelControl::Render()
if (width < m_width) // append spaces for scrolling
numSpaces += (unsigned int)((m_width - width) / spaceWidth) + 1;
m_shortText = (width + m_label.offsetX) < m_width;
- m_scrollInfo.suffix.assign(numSpaces, L' ');
+ m_scrollInfo.suffix.assign(numSpaces, ' ');
if (m_resetOnLabelChange)
{
m_scrollInfo.Reset();
diff --git a/guilib/GUIFadeLabelControl.h b/guilib/GUIFadeLabelControl.h
index dca7dae0fb..f71c6249d9 100644
--- a/guilib/GUIFadeLabelControl.h
+++ b/guilib/GUIFadeLabelControl.h
@@ -39,7 +39,7 @@
class CGUIFadeLabelControl : public CGUIControl
{
public:
- CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, int scrollSpeed, unsigned int timeToDelayAtEnd, bool resetOnLabelChange);
+ CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange);
CGUIFadeLabelControl(const CGUIFadeLabelControl &from);
virtual ~CGUIFadeLabelControl(void);
virtual CGUIFadeLabelControl *Clone() const { return new CGUIFadeLabelControl(*this); };
diff --git a/guilib/GUIFont.h b/guilib/GUIFont.h
index 44f6b618e2..6123bdb7a3 100644
--- a/guilib/GUIFont.h
+++ b/guilib/GUIFont.h
@@ -33,7 +33,7 @@ class CGUIFontTTFBase;
class CScrollInfo
{
public:
- CScrollInfo(unsigned int wait = 50, float pos = 0, int speed = defaultSpeed, const CStdStringW &scrollSuffix = L" | ")
+ CScrollInfo(unsigned int wait = 50, float pos = 0, int speed = defaultSpeed, const CStdString &scrollSuffix = " | ")
{
initialWait = wait;
initialPos = pos;
@@ -74,7 +74,7 @@ public:
unsigned int characterPos;
unsigned int initialWait;
float initialPos;
- CStdStringW suffix;
+ CStdString suffix;
static const int defaultSpeed = 60;
private:
diff --git a/guilib/GUILabel.cpp b/guilib/GUILabel.cpp
index 25470f6346..088fcaebce 100644
--- a/guilib/GUILabel.cpp
+++ b/guilib/GUILabel.cpp
@@ -23,9 +23,9 @@
#include "utils/CharsetConverter.h"
#include <limits>
-CGUILabel::CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, CGUILabel::OVER_FLOW overflow, int scrollSpeed)
+CGUILabel::CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, CGUILabel::OVER_FLOW overflow)
: m_textLayout(labelInfo.font, overflow == OVER_FLOW_WRAP, height)
- , m_scrollInfo(50, 0, scrollSpeed)
+ , m_scrollInfo(50, 0, labelInfo.scrollSpeed, labelInfo.scrollSuffix)
, m_maxRect(posX, posY, posX + width, posY + height)
{
m_selected = false;
@@ -39,11 +39,9 @@ CGUILabel::~CGUILabel(void)
{
}
-void CGUILabel::SetScrolling(bool scrolling, int scrollSpeed)
+void CGUILabel::SetScrolling(bool scrolling)
{
m_scrolling = scrolling;
- if (scrollSpeed)
- m_scrollInfo.SetSpeed(scrollSpeed);
if (!m_scrolling)
m_scrollInfo.Reset();
}
diff --git a/guilib/GUILabel.h b/guilib/GUILabel.h
index 094f126c4d..11ab9b365e 100644
--- a/guilib/GUILabel.h
+++ b/guilib/GUILabel.h
@@ -41,6 +41,8 @@ public:
offsetX = offsetY = 0;
width = 0;
angle = 0;
+ scrollSpeed = 0;
+ scrollSuffix = " | ";
};
void UpdateColors()
{
@@ -62,6 +64,8 @@ public:
float width;
float angle;
CGUIFont *font;
+ int scrollSpeed;
+ CStdString scrollSuffix;
};
/*!
@@ -84,7 +88,7 @@ public:
OVER_FLOW_SCROLL,
OVER_FLOW_WRAP };
- CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, OVER_FLOW overflow = OVER_FLOW_TRUNCATE, int scrollSpeed = 0);
+ CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, OVER_FLOW overflow = OVER_FLOW_TRUNCATE);
virtual ~CGUILabel(void);
/*! \brief Render the label on screen
@@ -128,10 +132,9 @@ public:
/*! \brief Set whether or not this label control should scroll
\param scrolling true if this label should scroll.
- \param scrollSpeed speed (in pixels per second) at which the label should scroll
*/
- void SetScrolling(bool scrolling, int scrollSpeed = 0);
-
+ void SetScrolling(bool scrolling);
+
/*! \brief Set this label invalid. Forces an update of the control
*/
void SetInvalid();
diff --git a/guilib/GUILabelControl.cpp b/guilib/GUILabelControl.cpp
index 7dfa8af69d..773db08da7 100644
--- a/guilib/GUILabelControl.cpp
+++ b/guilib/GUILabelControl.cpp
@@ -121,10 +121,10 @@ void CGUILabelControl::SetLabel(const string &strLabel)
m_iCursorPos = strLabel.size();
}
-void CGUILabelControl::SetWidthControl(float minWidth, bool bScroll, int scrollSpeed)
+void CGUILabelControl::SetWidthControl(float minWidth, bool bScroll)
{
m_minWidth = minWidth;
- m_label.SetScrolling(bScroll, scrollSpeed);
+ m_label.SetScrolling(bScroll);
}
void CGUILabelControl::SetAlignment(uint32_t align)
diff --git a/guilib/GUILabelControl.h b/guilib/GUILabelControl.h
index 7ac25f4c7c..c82e89c891 100644
--- a/guilib/GUILabelControl.h
+++ b/guilib/GUILabelControl.h
@@ -57,7 +57,7 @@ public:
void SetCursorPos(int iPos);
int GetCursorPos() const { return m_iCursorPos;};
void SetInfo(const CGUIInfoLabel&labelInfo);
- void SetWidthControl(float minWidth, bool bScroll, int scrollSpeed);
+ void SetWidthControl(float minWidth, bool bScroll);
void SetAlignment(uint32_t align);
void SetHighlight(unsigned int start, unsigned int end);
diff --git a/guilib/GUIListItemLayout.cpp b/guilib/GUIListItemLayout.cpp
index 7145d41a00..7e77a6c073 100644
--- a/guilib/GUIListItemLayout.cpp
+++ b/guilib/GUIListItemLayout.cpp
@@ -184,10 +184,10 @@ void CGUIListItemLayout::CreateListControlLayouts(float width, float height, boo
image->SetAspectRatio(CAspectRatio::AR_KEEP);
m_group.AddControl(image);
float x = iconWidth + labelInfo.offsetX + 10;
- CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]"), false, CScrollInfo::defaultSpeed);
+ CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]"), false);
m_group.AddControl(label);
x = labelInfo2.offsetX ? labelInfo2.offsetX : m_width - 16;
- label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]"), false, CScrollInfo::defaultSpeed);
+ label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]"), false);
m_group.AddControl(label);
}
//#endif
diff --git a/guilib/GUIListLabel.cpp b/guilib/GUIListLabel.cpp
index 9a571a01b8..28439cf58e 100644
--- a/guilib/GUIListLabel.cpp
+++ b/guilib/GUIListLabel.cpp
@@ -23,9 +23,9 @@
#include "utils/CharsetConverter.h"
#include <limits>
-CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll, int scrollSpeed)
+CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll)
: CGUIControl(parentID, controlID, posX, posY, width, height)
- , m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE, scrollSpeed)
+ , m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
{
m_info = info;
m_alwaysScroll = alwaysScroll;
diff --git a/guilib/GUIListLabel.h b/guilib/GUIListLabel.h
index 5d41d5e396..5c82fe196e 100644
--- a/guilib/GUIListLabel.h
+++ b/guilib/GUIListLabel.h
@@ -37,7 +37,7 @@ class CGUIListLabel :
public CGUIControl
{
public:
- CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &label, bool alwaysScroll, int scrollSpeed);
+ CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &label, bool alwaysScroll);
virtual ~CGUIListLabel(void);
virtual CGUIListLabel *Clone() const { return new CGUIListLabel(*this); };
diff --git a/guilib/GUIRSSControl.cpp b/guilib/GUIRSSControl.cpp
index d222f94672..0f841e585c 100644
--- a/guilib/GUIRSSControl.cpp
+++ b/guilib/GUIRSSControl.cpp
@@ -29,9 +29,9 @@
using namespace std;
-CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags, int scrollSpeed)
+CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags)
: CGUIControl(parentID, controlID, posX, posY, width, height),
- m_scrollInfo(0,0,scrollSpeed,"")
+ m_scrollInfo(0,0,labelInfo.scrollSpeed,"")
{
m_label = labelInfo;
m_headlineColor = headlineColor;
diff --git a/guilib/GUIRSSControl.h b/guilib/GUIRSSControl.h
index 3d09d3bc58..c8ea850239 100644
--- a/guilib/GUIRSSControl.h
+++ b/guilib/GUIRSSControl.h
@@ -54,7 +54,7 @@ public:
class CGUIRSSControl : public CGUIControl, public IRssObserver
{
public:
- CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags, int scrollSpeed);
+ CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags);
CGUIRSSControl(const CGUIRSSControl &from);
virtual ~CGUIRSSControl(void);
virtual CGUIRSSControl *Clone() const { return new CGUIRSSControl(*this); };
diff --git a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
index e664db51f4..1a065c656b 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
@@ -126,7 +126,6 @@ namespace PYXBMC
(float)pControl->dwHeight,
label,
true,
- CScrollInfo::defaultSpeed,
0,
true);