Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not scroll list label if <scroll>false</scroll> #4247

Merged
merged 1 commit into from Dec 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions xbmc/guilib/GUIControl.h
Expand Up @@ -281,6 +281,8 @@ class CGUIControl

enum GUIVISIBLE { HIDDEN = 0, DELAYED, VISIBLE };

enum GUISCROLLVALUE { FOCUS = 0, NEVER, ALWAYS };

#ifdef _DEBUG
virtual void DumpTextureUse() {};
#endif
Expand Down
12 changes: 8 additions & 4 deletions xbmc/guilib/GUIControlFactory.cpp
Expand Up @@ -744,7 +744,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl

vector<CAnimation> animations;

bool bScrollLabel = false;
CGUIControl::GUISCROLLVALUE scrollValue = CGUIControl::FOCUS;
bool bPulse = true;
unsigned int timePerImage = 0;
unsigned int fadeTime = 0;
Expand Down Expand Up @@ -996,7 +996,11 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
XMLUtils::GetFloat(pControlNode, "itemgap", buttonGap);
XMLUtils::GetInt(pControlNode, "movement", iMovementRange);
GetAspectRatio(pControlNode, "aspectratio", aspect);
XMLUtils::GetBoolean(pControlNode, "scroll", bScrollLabel);

bool alwaysScroll;
if (XMLUtils::GetBoolean(pControlNode, "scroll", alwaysScroll))
scrollValue = alwaysScroll ? CGUIControl::ALWAYS : CGUIControl::NEVER;

XMLUtils::GetBoolean(pControlNode,"pulseonselect", bPulse);
XMLUtils::GetInt(pControlNode, "timeblocks", timeBlocks);
XMLUtils::GetInt(pControlNode, "rulerunit", rulerUnit);
Expand Down Expand Up @@ -1127,15 +1131,15 @@ 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);
control = new CGUIListLabel(parentID, id, posX, posY, width, height, labelInfo, content, scrollValue);
}
else
{
control = new CGUILabelControl(
parentID, id, posX, posY, width, height,
labelInfo, wrapMultiLine, bHasPath);
((CGUILabelControl *)control)->SetInfo(content);
((CGUILabelControl *)control)->SetWidthControl(minWidth, bScrollLabel);
((CGUILabelControl *)control)->SetWidthControl(minWidth, (scrollValue == CGUIControl::ALWAYS) ? true : false);
}
}
else if (type == CGUIControl::GUICONTROL_EDIT)
Expand Down
4 changes: 2 additions & 2 deletions xbmc/guilib/GUIListItemLayout.cpp
Expand Up @@ -212,10 +212,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]", "", m_group.GetParentID()), false);
CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]", "", m_group.GetParentID()), CGUIControl::FOCUS);
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]", "", m_group.GetParentID()), false);
label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]", "", m_group.GetParentID()), CGUIControl::FOCUS);
m_group.AddControl(label);
}
//#endif
Expand Down
11 changes: 7 additions & 4 deletions xbmc/guilib/GUIListLabel.cpp
Expand Up @@ -22,12 +22,12 @@
#include <limits>
#include "addons/Skin.h"

CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll)
CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, CGUIControl::GUISCROLLVALUE scroll)
: CGUIControl(parentID, controlID, posX, posY, width, height)
, m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
, m_label(posX, posY, width, height, labelInfo, (scroll == CGUIControl::ALWAYS) ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
, m_info(info)
{
m_alwaysScroll = alwaysScroll;
m_scroll = scroll;
if (g_SkinInfo && g_SkinInfo->APIVersion() < ADDON::AddonVersion("5.1.0"))
{
if (labelInfo.align & XBFONT_RIGHT)
Expand All @@ -46,7 +46,10 @@ CGUIListLabel::~CGUIListLabel(void)

void CGUIListLabel::SetScrolling(bool scrolling)
{
m_label.SetScrolling(scrolling || m_alwaysScroll);
if (m_scroll == CGUIControl::FOCUS)
m_label.SetScrolling(scrolling);
else
m_label.SetScrolling((m_scroll == CGUIControl::ALWAYS) ? true : false);
}

void CGUIListLabel::SetSelected(bool selected)
Expand Down
4 changes: 2 additions & 2 deletions xbmc/guilib/GUIListLabel.h
Expand Up @@ -36,7 +36,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);
CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &label, CGUIControl::GUISCROLLVALUE scroll);
virtual ~CGUIListLabel(void);
virtual CGUIListLabel *Clone() const { return new CGUIListLabel(*this); };

Expand Down Expand Up @@ -64,5 +64,5 @@ class CGUIListLabel :

CGUILabel m_label;
CGUIInfoLabel m_info;
bool m_alwaysScroll;
CGUIControl::GUISCROLLVALUE m_scroll;
};