diff options
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 39 | ||||
-rw-r--r-- | xbmc/guiinfo/GUIInfoLabels.h | 3 | ||||
-rw-r--r-- | xbmc/guilib/GUIBaseContainer.cpp | 3 |
3 files changed, 22 insertions, 23 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 36c73c5111..9ed84bc533 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -1203,34 +1203,24 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool return AddMultiInfo(GUIInfo(CONTAINER_SORT_DIRECTION, order)); } } - else if (cat.name == "listitem") + else if (cat.name == "listitem" || cat.name == "listitemposition" + || cat.name == "listitemnowrap" || cat.name == "listitemabsolute") { int offset = atoi(cat.param().c_str()); int ret = TranslateListItem(prop); if (ret) listItemDependent = true; if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP)); - return ret; - } - else if (cat.name == "listitemposition") - { - int offset = atoi(cat.param().c_str()); - int ret = TranslateListItem(prop); - if (ret) - listItemDependent = true; - if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION)); - return ret; - } - else if (cat.name == "listitemnowrap") - { - int offset = atoi(cat.param().c_str()); - int ret = TranslateListItem(prop); - if (ret) - listItemDependent = true; - if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset)); + { + if (cat.name == "listitem") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP)); + else if (cat.name == "listitemposition") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION)); + else if (cat.name == "listitemabsolute") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_ABSOLUTE)); + else if (cat.name == "listitemnowrap") + return AddMultiInfo(GUIInfo(ret, 0, offset)); + } return ret; } else if (cat.name == "visualisation") @@ -1420,6 +1410,11 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool listItemDependent = true; return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_WRAP)); } + else if (info[1].name == "listitemabsolute") + { + listItemDependent = true; + return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_ABSOLUTE)); + } } else if (info[0].name == "control") { diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h index e29ac9459e..919aa94016 100644 --- a/xbmc/guiinfo/GUIInfoLabels.h +++ b/xbmc/guiinfo/GUIInfoLabels.h @@ -736,4 +736,5 @@ // Stored in the top 8 bits of GUIInfo::m_data1 // therefore we only have room for 8 flags #define INFOFLAG_LISTITEM_WRAP ((uint32_t) (1 << 25)) // Wrap ListItem lookups -#define INFOFLAG_LISTITEM_POSITION ((uint32_t) (1 << 26)) // Absolute ListItem lookups +#define INFOFLAG_LISTITEM_POSITION ((uint32_t) (1 << 26)) // ListItem lookups based on cursor position +#define INFOFLAG_LISTITEM_ABSOLUTE ((uint32_t) (1 << 27)) // Absolute ListItem lookups diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp index 8eddde4892..231a247033 100644 --- a/xbmc/guilib/GUIBaseContainer.cpp +++ b/xbmc/guilib/GUIBaseContainer.cpp @@ -651,6 +651,9 @@ CGUIListItemPtr CGUIBaseContainer::GetListItem(int offset, unsigned int flag) co int item = GetSelectedItem() + offset; if (flag & INFOFLAG_LISTITEM_POSITION) // use offset from the first item displayed, taking into account scrolling item = CorrectOffset((int)(m_scroller.GetValue() / m_layout->Size(m_orientation)), offset); + + if (flag & INFOFLAG_LISTITEM_ABSOLUTE) // use offset from the first item + item = CorrectOffset(0, offset); if (flag & INFOFLAG_LISTITEM_WRAP) { |