diff options
author | ronie <ronie@users.noreply.github.com> | 2016-05-21 03:31:11 +0200 |
---|---|---|
committer | ronie <ronie@users.noreply.github.com> | 2016-05-23 19:07:19 +0200 |
commit | a1edc7f05f938b4fde420c2a93a4799ffa9d7eb8 (patch) | |
tree | 2224eb0f78ab5d6c5d8738baa5a363d71f66de61 | |
parent | e4e432a8a92145d8142f3c8d2c2fdb1cd83d7be5 (diff) |
remove multiselect control
-rw-r--r-- | Kodi.xcodeproj/project.pbxproj | 9 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 2 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 6 | ||||
-rw-r--r-- | xbmc/guilib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | xbmc/guilib/GUIControl.h | 1 | ||||
-rw-r--r-- | xbmc/guilib/GUIControlFactory.cpp | 12 | ||||
-rw-r--r-- | xbmc/guilib/GUIControlProfiler.cpp | 2 | ||||
-rw-r--r-- | xbmc/guilib/GUIListGroup.cpp | 22 | ||||
-rw-r--r-- | xbmc/guilib/GUIMultiSelectText.cpp | 447 | ||||
-rw-r--r-- | xbmc/guilib/GUIMultiSelectText.h | 100 | ||||
-rw-r--r-- | xbmc/guilib/Makefile.in | 1 |
11 files changed, 6 insertions, 598 deletions
diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index bce914ae67..bcaed95e01 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -63,7 +63,6 @@ 18B7C7CF1294222E009E7A26 /* GUIMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77A1294222E009E7A26 /* GUIMessage.cpp */; }; 18B7C7D01294222E009E7A26 /* GUIMoverControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77B1294222E009E7A26 /* GUIMoverControl.cpp */; }; 18B7C7D11294222E009E7A26 /* GUIMultiImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77C1294222E009E7A26 /* GUIMultiImage.cpp */; }; - 18B7C7D21294222E009E7A26 /* GUIMultiSelectText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77D1294222E009E7A26 /* GUIMultiSelectText.cpp */; }; 18B7C7D31294222E009E7A26 /* GUIPanelContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77E1294222E009E7A26 /* GUIPanelContainer.cpp */; }; 18B7C7D41294222E009E7A26 /* GUIProgressControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77F1294222E009E7A26 /* GUIProgressControl.cpp */; }; 18B7C7D51294222E009E7A26 /* GUIRadioButtonControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7801294222E009E7A26 /* GUIRadioButtonControl.cpp */; }; @@ -1744,7 +1743,6 @@ E4991303174E5DAD00741B6D /* GUIMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77A1294222E009E7A26 /* GUIMessage.cpp */; }; E4991304174E5DAD00741B6D /* GUIMoverControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77B1294222E009E7A26 /* GUIMoverControl.cpp */; }; E4991305174E5DAD00741B6D /* GUIMultiImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77C1294222E009E7A26 /* GUIMultiImage.cpp */; }; - E4991306174E5DAD00741B6D /* GUIMultiSelectText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77D1294222E009E7A26 /* GUIMultiSelectText.cpp */; }; E4991307174E5DAD00741B6D /* GUIPanelContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77E1294222E009E7A26 /* GUIPanelContainer.cpp */; }; E4991308174E5DAD00741B6D /* GUIProgressControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C77F1294222E009E7A26 /* GUIProgressControl.cpp */; }; E4991309174E5DAD00741B6D /* GUIRadioButtonControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7801294222E009E7A26 /* GUIRadioButtonControl.cpp */; }; @@ -2384,7 +2382,6 @@ 18B7C7201294222D009E7A26 /* GUIMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIMessage.h; sourceTree = "<group>"; }; 18B7C7211294222D009E7A26 /* GUIMoverControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIMoverControl.h; sourceTree = "<group>"; }; 18B7C7221294222D009E7A26 /* GUIMultiImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIMultiImage.h; sourceTree = "<group>"; }; - 18B7C7231294222D009E7A26 /* GUIMultiSelectText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIMultiSelectText.h; sourceTree = "<group>"; }; 18B7C7241294222D009E7A26 /* GUIPanelContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIPanelContainer.h; sourceTree = "<group>"; }; 18B7C7251294222D009E7A26 /* GUIProgressControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIProgressControl.h; sourceTree = "<group>"; }; 18B7C7261294222D009E7A26 /* GUIRadioButtonControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIRadioButtonControl.h; sourceTree = "<group>"; }; @@ -2464,7 +2461,6 @@ 18B7C77A1294222E009E7A26 /* GUIMessage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIMessage.cpp; sourceTree = "<group>"; }; 18B7C77B1294222E009E7A26 /* GUIMoverControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIMoverControl.cpp; sourceTree = "<group>"; }; 18B7C77C1294222E009E7A26 /* GUIMultiImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIMultiImage.cpp; sourceTree = "<group>"; }; - 18B7C77D1294222E009E7A26 /* GUIMultiSelectText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIMultiSelectText.cpp; sourceTree = "<group>"; }; 18B7C77E1294222E009E7A26 /* GUIPanelContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIPanelContainer.cpp; sourceTree = "<group>"; }; 18B7C77F1294222E009E7A26 /* GUIProgressControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIProgressControl.cpp; sourceTree = "<group>"; }; 18B7C7801294222E009E7A26 /* GUIRadioButtonControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIRadioButtonControl.cpp; sourceTree = "<group>"; }; @@ -5268,8 +5264,6 @@ 18B7C7211294222D009E7A26 /* GUIMoverControl.h */, 18B7C77C1294222E009E7A26 /* GUIMultiImage.cpp */, 18B7C7221294222D009E7A26 /* GUIMultiImage.h */, - 18B7C77D1294222E009E7A26 /* GUIMultiSelectText.cpp */, - 18B7C7231294222D009E7A26 /* GUIMultiSelectText.h */, 18B7C77E1294222E009E7A26 /* GUIPanelContainer.cpp */, 18B7C7241294222D009E7A26 /* GUIPanelContainer.h */, 18B7C77F1294222E009E7A26 /* GUIProgressControl.cpp */, @@ -10156,7 +10150,7 @@ 2AB491701CDDF1920004C263 /* HTTPRequestHandlerUtils.cpp in Sources */, 18B7C7D01294222E009E7A26 /* GUIMoverControl.cpp in Sources */, 18B7C7D11294222E009E7A26 /* GUIMultiImage.cpp in Sources */, - 18B7C7D21294222E009E7A26 /* GUIMultiSelectText.cpp in Sources */, + 764697C61CA72E8D00AB1347 /* Addon_GUIControlSpin.cpp in Sources */, 18B7C7D31294222E009E7A26 /* GUIPanelContainer.cpp in Sources */, 18B7C7D41294222E009E7A26 /* GUIProgressControl.cpp in Sources */, DF1D2DF01B6E85EE002BB9DB /* XbtFile.cpp in Sources */, @@ -11156,7 +11150,6 @@ E4991304174E5DAD00741B6D /* GUIMoverControl.cpp in Sources */, 399442751A8DD920006C39E9 /* VideoLibraryMarkWatchedJob.cpp in Sources */, E4991305174E5DAD00741B6D /* GUIMultiImage.cpp in Sources */, - E4991306174E5DAD00741B6D /* GUIMultiSelectText.cpp in Sources */, 3994427B1A8DD920006C39E9 /* VideoLibraryScanningJob.cpp in Sources */, E4991307174E5DAD00741B6D /* GUIPanelContainer.cpp in Sources */, E4991308174E5DAD00741B6D /* GUIProgressControl.cpp in Sources */, diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 6cf41f674d..d5061be786 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -544,7 +544,6 @@ copy "..\Win32BuildSetup\dependencies\python27.dll" "$(TargetDir)"</Command> <ClCompile Include="..\..\xbmc\guilib\GUIMessage.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIMoverControl.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIMultiImage.cpp" /> - <ClCompile Include="..\..\xbmc\guilib\GUIMultiSelectText.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIPanelContainer.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIProgressControl.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIRadioButtonControl.cpp" /> @@ -2077,7 +2076,6 @@ copy "..\Win32BuildSetup\dependencies\python27.dll" "$(TargetDir)"</Command> <ClInclude Include="..\..\xbmc\guilib\GUIMessage.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIMoverControl.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIMultiImage.h" /> - <ClInclude Include="..\..\xbmc\guilib\GUIMultiSelectText.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIPanelContainer.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIProgressControl.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIRadioButtonControl.h" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 6306495090..ecf9cf9599 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -1041,9 +1041,6 @@ <ClCompile Include="..\..\xbmc\guilib\GUIMultiImage.cpp"> <Filter>guilib</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\guilib\GUIMultiSelectText.cpp"> - <Filter>guilib</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\guilib\GUIPanelContainer.cpp"> <Filter>guilib</Filter> </ClCompile> @@ -4146,9 +4143,6 @@ <ClInclude Include="..\..\xbmc\guilib\GUIMultiImage.h"> <Filter>guilib</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\guilib\GUIMultiSelectText.h"> - <Filter>guilib</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\guilib\GUIPanelContainer.h"> <Filter>guilib</Filter> </ClInclude> diff --git a/xbmc/guilib/CMakeLists.txt b/xbmc/guilib/CMakeLists.txt index 949f664a90..aa20e7b49d 100644 --- a/xbmc/guilib/CMakeLists.txt +++ b/xbmc/guilib/CMakeLists.txt @@ -37,7 +37,6 @@ set(SOURCES DDSImage.cpp GUIMessage.cpp GUIMoverControl.cpp GUIMultiImage.cpp - GUIMultiSelectText.cpp GUIPanelContainer.cpp GUIProgressControl.cpp GUIRadioButtonControl.cpp @@ -118,7 +117,6 @@ set(HEADERS DDSImage.h GUIMessage.h GUIMoverControl.h GUIMultiImage.h - GUIMultiSelectText.h GUIPanelContainer.h GUIProgressControl.h GUIRadioButtonControl.h diff --git a/xbmc/guilib/GUIControl.h b/xbmc/guilib/GUIControl.h index 425302e6ca..a6d45dc24a 100644 --- a/xbmc/guilib/GUIControl.h +++ b/xbmc/guilib/GUIControl.h @@ -274,7 +274,6 @@ public: GUICONTROL_GROUPLIST, GUICONTROL_SCROLLBAR, GUICONTROL_LISTLABEL, - GUICONTROL_MULTISELECT, GUICONTROL_GAMECONTROLLER, GUICONTAINER_LIST, GUICONTAINER_WRAPLIST, diff --git a/xbmc/guilib/GUIControlFactory.cpp b/xbmc/guilib/GUIControlFactory.cpp index 0c3f9eee65..dbed9bd798 100644 --- a/xbmc/guilib/GUIControlFactory.cpp +++ b/xbmc/guilib/GUIControlFactory.cpp @@ -49,7 +49,6 @@ #include "GUIWrappingListContainer.h" #include "epg/GUIEPGGridContainer.h" #include "GUIPanelContainer.h" -#include "GUIMultiSelectText.h" #include "GUIListLabel.h" #include "GUIListGroup.h" #include "GUIInfoManager.h" @@ -101,7 +100,6 @@ static const ControlMapping controls[] = {"multiimage", CGUIControl::GUICONTROL_MULTI_IMAGE}, {"grouplist", CGUIControl::GUICONTROL_GROUPLIST}, {"scrollbar", CGUIControl::GUICONTROL_SCROLLBAR}, - {"multiselect", CGUIControl::GUICONTROL_MULTISELECT}, {"gamecontroller", CGUIControl::GUICONTROL_GAMECONTROLLER}, {"list", CGUIControl::GUICONTAINER_LIST}, {"wraplist", CGUIControl::GUICONTAINER_WRAPLIST}, @@ -1218,16 +1216,6 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl ((CGUIRadioButtonControl *)control)->SetUnFocusActions(unfocusActions); } break; - case CGUIControl::GUICONTROL_MULTISELECT: - { - CGUIInfoLabel label; - if (infoLabels.size()) - label = infoLabels[0]; - control = new CGUIMultiSelectTextControl( - parentID, id, posX, posY, width, height, - textureFocus, textureNoFocus, labelInfo, label); - } - break; case CGUIControl::GUICONTROL_SPIN: { control = new CGUISpinControl( diff --git a/xbmc/guilib/GUIControlProfiler.cpp b/xbmc/guilib/GUIControlProfiler.cpp index 6922be8ed3..b2a59ec5ac 100644 --- a/xbmc/guilib/GUIControlProfiler.cpp +++ b/xbmc/guilib/GUIControlProfiler.cpp @@ -141,8 +141,6 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) lpszType = "scrollbar"; break; case CGUIControl::GUICONTROL_LISTLABEL: lpszType = "label"; break; - case CGUIControl::GUICONTROL_MULTISELECT: - lpszType = "multiselect"; break; case CGUIControl::GUICONTAINER_LIST: lpszType = "list"; break; case CGUIControl::GUICONTAINER_WRAPLIST: diff --git a/xbmc/guilib/GUIListGroup.cpp b/xbmc/guilib/GUIListGroup.cpp index 80a94cc702..fa0ad0f57c 100644 --- a/xbmc/guilib/GUIListGroup.cpp +++ b/xbmc/guilib/GUIListGroup.cpp @@ -20,7 +20,6 @@ #include "GUIListGroup.h" #include "GUIListLabel.h" -#include "GUIMultiSelectText.h" #include "utils/log.h" CGUIListGroup::CGUIListGroup(int parentID, int controlID, float posX, float posY, float width, float height) @@ -51,7 +50,6 @@ void CGUIListGroup::AddControl(CGUIControl *control, int position /*= -1*/) control->GetControlType() == CGUIControl::GUICONTROL_IMAGE || control->GetControlType() == CGUIControl::GUICONTROL_BORDEREDIMAGE || control->GetControlType() == CGUIControl::GUICONTROL_MULTI_IMAGE || - control->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT || control->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX || control->GetControlType() == CGUIControl::GUICONTROL_PROGRESS)) CLog::Log(LOGWARNING, "Trying to add unsupported control type %d", control->GetControlType()); @@ -172,9 +170,7 @@ void CGUIListGroup::SetFocusedItem(unsigned int focus) { for (iControls it = m_children.begin(); it != m_children.end(); it++) { - if ((*it)->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT) - ((CGUIMultiSelectTextControl *)(*it))->SetFocusedItem(focus); - else if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP) + if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP) ((CGUIListGroup *)(*it))->SetFocusedItem(focus); else (*it)->SetFocus(focus > 0); @@ -186,9 +182,7 @@ unsigned int CGUIListGroup::GetFocusedItem() const { for (ciControls it = m_children.begin(); it != m_children.end(); it++) { - if ((*it)->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT && ((CGUIMultiSelectTextControl *)(*it))->GetFocusedItem()) - return ((CGUIMultiSelectTextControl *)(*it))->GetFocusedItem(); - else if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->GetFocusedItem()) + if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->GetFocusedItem()) return ((CGUIListGroup *)(*it))->GetFocusedItem(); } return 0; @@ -198,9 +192,7 @@ bool CGUIListGroup::MoveLeft() { for (iControls it = m_children.begin(); it != m_children.end(); it++) { - if ((*it)->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT && ((CGUIMultiSelectTextControl *)(*it))->MoveLeft()) - return true; - else if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->MoveLeft()) + if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->MoveLeft()) return true; } return false; @@ -210,9 +202,7 @@ bool CGUIListGroup::MoveRight() { for (iControls it = m_children.begin(); it != m_children.end(); it++) { - if ((*it)->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT && ((CGUIMultiSelectTextControl *)(*it))->MoveRight()) - return true; - else if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->MoveRight()) + if ((*it)->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP && ((CGUIListGroup *)(*it))->MoveRight()) return true; } return false; @@ -240,9 +230,7 @@ void CGUIListGroup::SelectItemFromPoint(const CPoint &point) for (iControls it = m_children.begin(); it != m_children.end(); ++it) { CGUIControl *child = *it; - if (child->GetControlType() == CGUIControl::GUICONTROL_MULTISELECT) - ((CGUIMultiSelectTextControl *)child)->SelectItemFromPoint(point); - else if (child->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP) + if (child->GetControlType() == CGUIControl::GUICONTROL_LISTGROUP) ((CGUIListGroup *)child)->SelectItemFromPoint(point); } } diff --git a/xbmc/guilib/GUIMultiSelectText.cpp b/xbmc/guilib/GUIMultiSelectText.cpp deleted file mode 100644 index 77d078ef1f..0000000000 --- a/xbmc/guilib/GUIMultiSelectText.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "GUIMultiSelectText.h" -#include "GUIWindowManager.h" -#include "input/Key.h" -#include "utils/log.h" -#include "utils/StringUtils.h" - -CGUIMultiSelectTextControl::CSelectableString::CSelectableString(CGUIFont *font, const std::string &text, bool selectable, const std::string &clickAction) - : m_text(font, false) - , m_clickAction(clickAction) -{ - m_selectable = selectable; - StringUtils::TrimLeft(m_clickAction, " ="); - StringUtils::TrimRight(m_clickAction); - m_text.Update(text); - float height; - m_text.GetTextExtent(m_length, height); -} - -CGUIMultiSelectTextControl::CGUIMultiSelectTextControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo& labelInfo, const CGUIInfoLabel &content) - : CGUIControl(parentID, controlID, posX, posY, width, height) - , m_label(labelInfo) - , m_info(content) - , m_button(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo) -{ - m_selectedItem = 0; - m_offset = 0; - m_totalWidth = 0; - m_scrollOffset = 0; - m_scrollSpeed = 0; - m_scrollLastTime = 0; - m_renderTime = 0; - m_label.align &= ~3; // we currently ignore all x alignment -} - -CGUIMultiSelectTextControl::~CGUIMultiSelectTextControl(void) -{ -} - -bool CGUIMultiSelectTextControl::UpdateColors() -{ - bool changed = CGUIControl::UpdateColors(); - changed |= m_label.UpdateColors(); - - return changed; -} - -void CGUIMultiSelectTextControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) -{ - m_renderTime = currentTime; - - // check our selected item is in range - unsigned int numSelectable = GetNumSelectable(); - if (!numSelectable) - SetFocus(false); - else if (m_selectedItem >= numSelectable) - m_selectedItem = numSelectable - 1; - - // and validate our offset - if (m_offset + m_width > m_totalWidth) - m_offset = m_totalWidth - m_width; - if (m_offset < 0) m_offset = 0; - - // handle scrolling - m_scrollOffset += m_scrollSpeed * (m_renderTime - m_scrollLastTime); - if ((m_scrollSpeed < 0 && m_scrollOffset < m_offset) || - (m_scrollSpeed > 0 && m_scrollOffset > m_offset)) - { - m_scrollOffset = m_offset; - m_scrollSpeed = 0; - } - m_scrollLastTime = m_renderTime; - - g_graphicsContext.SetOrigin(-m_scrollOffset, 0); - - // process the buttons - for (unsigned int i = 0; i < m_buttons.size(); i++) - { - m_buttons[i].SetFocus(HasFocus() && i == m_selectedItem); - m_buttons[i].DoProcess(currentTime, dirtyregions); - } - - g_graphicsContext.RestoreOrigin(); - - CGUIControl::Process(currentTime, dirtyregions); -} - -void CGUIMultiSelectTextControl::Render() -{ - // clip and set our scrolling origin - bool clip(m_width < m_totalWidth); - if (clip) - { // need to crop - if (!g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) - return; // nothing to render?? - } - g_graphicsContext.SetOrigin(-m_scrollOffset, 0); - - // render the buttons - for (unsigned int i = 0; i < m_buttons.size(); i++) - m_buttons[i].DoRender(); - - // position the text - we center vertically if applicable, and use the offsets. - // all x-alignment is ignored for now (see constructor) - float posX = m_posX; - float posY = m_posY + m_label.offsetY; - if (m_label.align & XBFONT_CENTER_Y) - posY = m_posY + m_height * 0.5f; - - if (m_items.size() && m_items[0].m_selectable) - posX += m_label.offsetX; - - // render the text - unsigned int num_selectable = 0; - for (unsigned int i = 0; i < m_items.size(); i++) - { - CSelectableString &string = m_items[i]; - if (IsDisabled()) // all text is rendered with disabled color - string.m_text.Render(posX, posY, 0, m_label.disabledColor, m_label.shadowColor, m_label.align, 0, true); - else if (HasFocus() && string.m_selectable && num_selectable == m_selectedItem) // text is rendered with focusedcolor - string.m_text.Render(posX, posY, 0, m_label.focusedColor, m_label.shadowColor, m_label.align, 0); - else // text is rendered with textcolor - string.m_text.Render(posX, posY, 0, m_label.textColor, m_label.shadowColor, m_label.align, 0); - posX += string.m_length; - if (string.m_selectable) - num_selectable++; - } - - g_graphicsContext.RestoreOrigin(); - if (clip) - g_graphicsContext.RestoreClipRegion(); - - CGUIControl::Render(); -} - -void CGUIMultiSelectTextControl::UpdateInfo(const CGUIListItem *item) -{ - if (m_info.IsEmpty()) - return; // nothing to do - - if (item) - UpdateText(m_info.GetItemLabel(item)); - else - UpdateText(m_info.GetLabel(m_parentID)); -} - -bool CGUIMultiSelectTextControl::OnAction(const CAction &action) -{ - if (action.GetID() == ACTION_SELECT_ITEM) - { - // item is clicked - see if we have a clickaction - std::string clickAction; - unsigned int selected = 0; - for (unsigned int i = 0; i < m_items.size(); i++) - { - if (m_items[i].m_selectable) - { - if (m_selectedItem == selected) - clickAction = m_items[i].m_clickAction; - selected++; - } - } - if (!clickAction.empty()) - { // have a click action -> perform it - CGUIMessage message(GUI_MSG_EXECUTE, m_controlID, m_parentID); - message.SetStringParam(clickAction); - g_windowManager.SendMessage(message); - } - else - { // no click action, just send a message to the window - CGUIMessage msg(GUI_MSG_CLICKED, m_controlID, m_parentID, m_selectedItem); - SendWindowMessage(msg); - } - return true; - } - return CGUIControl::OnAction(action); -} - -void CGUIMultiSelectTextControl::OnLeft() -{ - if (MoveLeft()) - return; - CGUIControl::OnLeft(); -} - -void CGUIMultiSelectTextControl::OnRight() -{ - if (MoveRight()) - return; - CGUIControl::OnRight(); -} - -// movement functions (callable from lists) -bool CGUIMultiSelectTextControl::MoveLeft() -{ - CGUIAction action = GetAction(ACTION_MOVE_LEFT); - if (m_selectedItem > 0) - ScrollToItem(m_selectedItem - 1); - else if (GetNumSelectable() && action.GetNavigation() && action.GetNavigation() == m_controlID) - ScrollToItem(GetNumSelectable() - 1); - else - return false; - return true; -} - -bool CGUIMultiSelectTextControl::MoveRight() -{ - CGUIAction action = GetAction(ACTION_MOVE_RIGHT); - if (GetNumSelectable() && m_selectedItem < GetNumSelectable() - 1) - ScrollToItem(m_selectedItem + 1); - else if (action.GetNavigation() && action.GetNavigation() == m_controlID) - ScrollToItem(0); - else - return false; - return true; -} - -void CGUIMultiSelectTextControl::SelectItemFromPoint(const CPoint &point) -{ - int item = GetItemFromPoint(point); - if (item != -1) - { - ScrollToItem(item); - SetFocus(true); - } - else - SetFocus(false); -} - -bool CGUIMultiSelectTextControl::HitTest(const CPoint &point) const -{ - return (GetItemFromPoint(point) != -1); -} - -bool CGUIMultiSelectTextControl::OnMouseOver(const CPoint &point) -{ - ScrollToItem(GetItemFromPoint(point)); - return CGUIControl::OnMouseOver(point); -} - -EVENT_RESULT CGUIMultiSelectTextControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) -{ - if (event.m_id == ACTION_MOUSE_LEFT_CLICK) - { - m_selectedItem = GetItemFromPoint(point); - OnAction(CAction(ACTION_SELECT_ITEM)); - return EVENT_RESULT_HANDLED; - } - return EVENT_RESULT_UNHANDLED; -} - -int CGUIMultiSelectTextControl::GetItemFromPoint(const CPoint &point) const -{ - if (!m_label.font) return -1; - float posX = m_posX; - unsigned int selectable = 0; - for (unsigned int i = 0; i < m_items.size(); i++) - { - const CSelectableString &string = m_items[i]; - if (string.m_selectable) - { - CRect rect(posX, m_posY, posX + string.m_length, m_posY + m_height); - if (rect.PtInRect(point)) - return selectable; - selectable++; - } - posX += string.m_length; - } - return -1; -} - -void CGUIMultiSelectTextControl::UpdateText(const std::string &text) -{ - if (text == m_oldText) - return; - - m_items.clear(); - - // parse our text into clickable blocks - // format is [ONCLICK <action>] [/ONCLICK] - size_t startClickable = text.find("[ONCLICK"); - size_t startUnclickable = 0; - - // add the first unclickable block - if (startClickable != std::string::npos) - AddString(text.substr(startUnclickable, startClickable - startUnclickable), false); - else - AddString(text.substr(startUnclickable), false); - while (startClickable != std::string::npos) - { - // grep out the action and the end of the string - size_t endAction = text.find(']', startClickable + 8); - size_t endClickable = text.find("[/ONCLICK]", startClickable + 8); - if (endAction != std::string::npos && endClickable != std::string::npos) - { // success - add the string, and move the start of our next unclickable portion along - AddString(text.substr(endAction + 1, endClickable - endAction - 1), true, text.substr(startClickable + 8, endAction - startClickable - 8)); - startUnclickable = endClickable + 10; - } - else - { - CLog::Log(LOGERROR, "Invalid multiselect string %s", text.c_str()); - break; - } - startClickable = text.find("[ONCLICK", startUnclickable); - // add the unclickable portion - if (startClickable != std::string::npos) - AddString(text.substr(startUnclickable, startClickable - startUnclickable), false); - else - AddString(text.substr(startUnclickable), false); - } - - m_oldText = text; - - // finally, position our buttons - PositionButtons(); -} - -void CGUIMultiSelectTextControl::AddString(const std::string &text, bool selectable, const std::string &clickAction) -{ - if (!text.empty()) - m_items.push_back(CSelectableString(m_label.font, text, selectable, clickAction)); -} - -void CGUIMultiSelectTextControl::PositionButtons() -{ - m_buttons.clear(); - - // add new buttons - m_totalWidth = 0; - if (m_items.size() && m_items.front().m_selectable) - m_totalWidth += m_label.offsetX; - - for (unsigned int i = 0; i < m_items.size(); i++) - { - const CSelectableString &text = m_items[i]; - if (text.m_selectable) - { - CGUIButtonControl button(m_button); - button.SetPosition(m_posX + m_totalWidth - m_label.offsetX, m_posY); - button.SetWidth(text.m_length + 2 * m_label.offsetX); - m_buttons.push_back(button); - } - m_totalWidth += text.m_length; - } - - if (m_items.size() && m_items.back().m_selectable) - m_totalWidth += m_label.offsetX; -} - -std::string CGUIMultiSelectTextControl::GetDescription() const -{ - // We currently just return the entire string - should we bother returning the - // particular subitems of this? - std::string strLabel(m_info.GetLabel(m_parentID)); - return strLabel; -} - -unsigned int CGUIMultiSelectTextControl::GetNumSelectable() const -{ - unsigned int selectable = 0; - for (unsigned int i = 0; i < m_items.size(); i++) - if (m_items[i].m_selectable) - selectable++; - return selectable; -} - -unsigned int CGUIMultiSelectTextControl::GetFocusedItem() const -{ - if (GetNumSelectable()) - return m_selectedItem + 1; - return 0; -} - -void CGUIMultiSelectTextControl::SetFocusedItem(unsigned int item) -{ - SetFocus(item > 0); - if (item > 0) - ScrollToItem(item - 1); -} - -bool CGUIMultiSelectTextControl::CanFocus() const -{ - if (!GetNumSelectable()) return false; - return CGUIControl::CanFocus(); -} - -void CGUIMultiSelectTextControl::SetFocus(bool focus) -{ - for (unsigned int i = 0; i < m_buttons.size(); i++) - m_buttons[i].SetFocus(focus); - CGUIControl::SetFocus(focus); -} - -// overrides to allow anims to translate down to the focus image -void CGUIMultiSelectTextControl::SetAnimations(const std::vector<CAnimation> &animations) -{ - // send any focus animations down to the focus image only - m_animations.clear(); - std::vector<CAnimation> focusAnims; - for (unsigned int i = 0; i < animations.size(); i++) - { - const CAnimation &anim = animations[i]; - if (anim.GetType() == ANIM_TYPE_FOCUS) - focusAnims.push_back(anim); - else - m_animations.push_back(anim); - } - m_button.SetAnimations(focusAnims); -} - -void CGUIMultiSelectTextControl::ScrollToItem(unsigned int item) -{ - static const unsigned int time_to_scroll = 200; - if (item >= m_buttons.size()) return; - // grab our button - const CGUIButtonControl &button = m_buttons[item]; - float left = button.GetXPosition(); - float right = left + button.GetWidth(); - // make sure that we scroll so that this item is on screen - m_scrollOffset = m_offset; - if (left < m_posX + m_offset) - m_offset = left - m_posX; - else if (right > m_posX + m_offset + m_width) - m_offset = right - m_width - m_posX; - m_scrollSpeed = (m_offset - m_scrollOffset) / time_to_scroll; - m_selectedItem = item; -} - diff --git a/xbmc/guilib/GUIMultiSelectText.h b/xbmc/guilib/GUIMultiSelectText.h deleted file mode 100644 index 7b390fc7b1..0000000000 --- a/xbmc/guilib/GUIMultiSelectText.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "GUIButtonControl.h" - -/*! - \ingroup controls - \brief - */ -class CGUIMultiSelectTextControl : public CGUIControl -{ -public: - CGUIMultiSelectTextControl(int parentID, int controlID, - float posX, float posY, float width, float height, - const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo &label, const CGUIInfoLabel &content); - - virtual ~CGUIMultiSelectTextControl(void); - virtual CGUIMultiSelectTextControl *Clone() const { return new CGUIMultiSelectTextControl(*this); }; - - virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions); - virtual void Render(); - - virtual bool OnAction(const CAction &action); - virtual void OnLeft(); - virtual void OnRight(); - virtual bool HitTest(const CPoint &point) const; - virtual bool OnMouseOver(const CPoint &point); - virtual void UpdateInfo(const CGUIListItem *item = NULL); - - virtual std::string GetDescription() const; - virtual bool CanFocus() const; - - void UpdateText(const std::string &text); - bool MoveLeft(); - bool MoveRight(); - void SelectItemFromPoint(const CPoint &point); - unsigned int GetFocusedItem() const; - void SetFocusedItem(unsigned int item); - - // overrides to allow all focus anims to translate down to the focus image - virtual void SetAnimations(const std::vector<CAnimation> &animations); - virtual void SetFocus(bool focus); -protected: - virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); - virtual bool UpdateColors(); - void AddString(const std::string &text, bool selectable, const std::string &clickAction = ""); - void PositionButtons(); - unsigned int GetNumSelectable() const; - int GetItemFromPoint(const CPoint &point) const; - void ScrollToItem(unsigned int item); - - // the static strings and buttons strings - class CSelectableString - { - public: - CSelectableString(CGUIFont *font, const std::string &text, bool selectable, const std::string &clickAction); - CGUITextLayout m_text; - float m_length; - bool m_selectable; - std::string m_clickAction; - }; - std::vector<CSelectableString> m_items; - - CLabelInfo m_label; - CGUIInfoLabel m_info; - std::string m_oldText; - unsigned int m_renderTime; - - // scrolling - float m_totalWidth; - float m_offset; - float m_scrollOffset; - float m_scrollSpeed; - unsigned int m_scrollLastTime; - - // buttons - CGUIButtonControl m_button; - unsigned int m_selectedItem; - std::vector<CGUIButtonControl> m_buttons; -}; - diff --git a/xbmc/guilib/Makefile.in b/xbmc/guilib/Makefile.in index bcf8243fd5..f4e018954b 100644 --- a/xbmc/guilib/Makefile.in +++ b/xbmc/guilib/Makefile.in @@ -37,7 +37,6 @@ SRCS += GUIListLabel.cpp SRCS += GUIMessage.cpp SRCS += GUIMoverControl.cpp SRCS += GUIMultiImage.cpp -SRCS += GUIMultiSelectText.cpp SRCS += GUIPanelContainer.cpp SRCS += GUIProgressControl.cpp SRCS += GUIRadioButtonControl.cpp |