From b6e374f623261056c1832ab08f931d0adcd9a3ec Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 17 Dec 2011 19:22:23 +0100 Subject: [PATCH] xbmc-pvr: add patch to add toggleButtonState function Signed-off-by: Stephan Raue --- ...mc-pvr-d967ec3-981-toggleButtonState.patch | 362 ++++++++++++++++++ 1 file changed, 362 insertions(+) create mode 100644 packages/mediacenter/xbmc-pvr/patches/xbmc-pvr-d967ec3-981-toggleButtonState.patch diff --git a/packages/mediacenter/xbmc-pvr/patches/xbmc-pvr-d967ec3-981-toggleButtonState.patch b/packages/mediacenter/xbmc-pvr/patches/xbmc-pvr-d967ec3-981-toggleButtonState.patch new file mode 100644 index 0000000000..1efac552aa --- /dev/null +++ b/packages/mediacenter/xbmc-pvr/patches/xbmc-pvr-d967ec3-981-toggleButtonState.patch @@ -0,0 +1,362 @@ +diff -Naur xbmc-f3b0020/xbmc/guilib/GUIToggleButtonControl.h xbmc-f3b0020.patch/xbmc/guilib/GUIToggleButtonControl.h +--- xbmc-f3b0020/xbmc/guilib/GUIToggleButtonControl.h 2011-12-10 22:16:22.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/guilib/GUIToggleButtonControl.h 2011-12-17 18:43:42.183704449 +0100 +@@ -57,6 +57,7 @@ + virtual CStdString GetDescription() const; + void SetToggleSelect(const CStdString &toggleSelect); + void SetAltClickActions(const CGUIAction &clickActions); ++ bool IsSelected() const { return m_bSelected; }; + + protected: + virtual bool UpdateColors(); +diff -Naur xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/control.h xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/control.h +--- xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/control.h 2011-12-10 22:16:21.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/control.h 2011-12-17 18:43:42.216705084 +0100 +@@ -135,6 +135,11 @@ + + typedef struct { + PyObject_HEAD_XBMC_CONTROL ++ bool bIsSelected; ++ } ControlToggle; ++ ++ typedef struct { ++ PyObject_HEAD_XBMC_CONTROL + std::string strFont; + color_t textColor; + std::vector vecLabels; +@@ -263,7 +268,8 @@ + extern PyTypeObject ControlRadioButton_Type; + extern PyTypeObject ControlSlider_Type; + extern PyTypeObject ControlEdit_Type; +- ++ extern PyTypeObject ControlToggle_Type; ++ + CGUIControl* ControlLabel_Create(ControlLabel* pControl); + CGUIControl* ControlFadeLabel_Create(ControlFadeLabel* pControl); + CGUIControl* ControlTextBox_Create(ControlTextBox* pControl); +@@ -276,6 +282,7 @@ + CGUIControl* ControlRadioButton_Create(ControlRadioButton* pControl); + CGUIControl* ControlSlider_Create(ControlSlider* pControl); + CGUIControl* ControlEdit_Create(ControlEdit* pControl); ++ CGUIControl* ControlToggle_Create(ControlToggle* pControl); + + void initControl_Type(); + void initControlSpin_Type(); +@@ -291,6 +298,7 @@ + void initControlRadioButton_Type(); + void initControlSlider_Type(); + void initControlEdit_Type(); ++ void initControlToggle_Type(); + } + + #ifdef __cplusplus +diff -Naur xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/controltogglebutton.cpp xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/controltogglebutton.cpp +--- xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/controltogglebutton.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/controltogglebutton.cpp 2011-12-17 18:43:42.217705104 +0100 +@@ -0,0 +1,181 @@ ++/* ++ * Copyright (C) 2005-2011 Team XBMC ++ * http://www.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, write to ++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ++ * http://www.gnu.org/copyleft/gpl.html ++ * ++ */ ++ ++#include ++ ++#include "guilib/GUIToggleButtonControl.h" ++#include "guilib/GUIFontManager.h" ++#include "control.h" ++#include "pyutil.h" ++ ++using namespace std; ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++namespace PYXBMC ++{ ++ PyObject* ControlToggle_New( ++ PyTypeObject *type, ++ PyObject *args, ++ PyObject *kwds ) ++ { ++ static const char *keywords[] = { ++ "x", "y", "width", "height", "label", ++ "focusTexture", "noFocusTexture", ++ "textOffsetX", "textOffsetY", "alignment", ++ "font", "textColor", "disabledColor", "angle", "shadowColor", "focusedColor", NULL }; ++ ControlToggle *self; ++ char* cFont = NULL; ++ char* cTextureFocus = NULL; ++ char* cTextureNoFocus = NULL; ++ char* cTextColor = NULL; ++ char* cDisabledColor = NULL; ++ char* cShadowColor = NULL; ++ char* cFocusedColor = NULL; ++ ++ PyObject* pObjectText; ++ ++ self = (ControlToggle*)type->tp_alloc(type, 0); ++ if (!self) return NULL; ++ new(&self->bIsSelected) bool(); ++ ++ if (!PyArg_ParseTupleAndKeywords( ++ args, ++ kwds, ++ (char*)"llllO|sslllssslss", ++ (char**)keywords, ++ &self->dwPosX, ++ &self->dwPosY, ++ &self->dwWidth, ++ &self->dwHeight, ++ &pObjectText, ++ &cTextureFocus, ++ &cTextureNoFocus, ++ &cFont, ++ &cTextColor, ++ &cDisabledColor, ++ &cShadowColor, ++ &cFocusedColor)) ++ { ++ Py_DECREF( self ); ++ return NULL; ++ } ++ ++ ++ cTextureFocus : ++ PyXBMCGetDefaultImage((char*)"button", (char*)"texturefocus", (char*)"button-focus.png"); ++ cTextureNoFocus : ++ PyXBMCGetDefaultImage((char*)"button", (char*)"texturenofocus", (char*)"button-nofocus.jpg"); ++ ++ return (PyObject*)self; ++ } ++ ++ void ControlToggle_Dealloc(ControlToggle* self) ++ { ++ self->ob_type->tp_free((PyObject*)self); ++ } ++ ++ ++ // isSelected() Method ++ PyDoc_STRVAR(isSelected__doc__, ++ "isSelected() -- Returns the toggle buttons's selected status.\n" ++ "\n" ++ "example:\n" ++ " - is = self.togglebutton.isSelected()\n"); ++ ++ PyObject* ControlToggle_IsSelected(ControlToggle *self, PyObject *args) ++ { ++ bool isSelected = false; ++ ++ PyXBMCGUILock(); ++ if (self->pGUIControl) ++ isSelected = ((CGUIToggleButtonControl*)self->pGUIControl)->IsSelected(); ++ PyXBMCGUIUnlock(); ++ ++ return Py_BuildValue((char*)"b", isSelected); ++ } ++ ++ ++ PyMethodDef ControlToggle_methods[] = { ++ {(char*)"isSelected", (PyCFunction)ControlToggle_IsSelected, METH_VARARGS, isSelected__doc__}, ++ {NULL, NULL, 0, NULL} ++ }; ++ ++ // ControlRadioButton class ++ PyDoc_STRVAR(ControlToggle__doc__, ++ "ControlRadioButton class.\n" ++ "\n" ++ "ControlRadioButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY,\n" ++ " alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor,\n" ++ " radioFocusTexture, noRadioFocusTexture])\n" ++ "\n" ++ "x : integer - x coordinate of control.\n" ++ "y : integer - y coordinate of control.\n" ++ "width : integer - width of control.\n" ++ "height : integer - height of control.\n" ++ "label : string or unicode - text string.\n" ++ "focusTexture : [opt] string - filename for focus texture.\n" ++ "noFocusTexture : [opt] string - filename for no focus texture.\n" ++ "textOffsetX : [opt] integer - x offset of label.\n" ++ "textOffsetY : [opt] integer - y offset of label.\n" ++ "alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n" ++ "font : [opt] string - font used for label text. (e.g. 'font13')\n" ++ "textColor : [opt] hexstring - color of enabled radio button's label. (e.g. '0xFFFFFFFF')\n" ++ "disabledColor : [opt] hexstring - color of disabled radio button's label. (e.g. '0xFFFF3300')\n" ++ "angle : [opt] integer - angle of control. (+ rotates CCW, - rotates CW)\n" ++ "shadowColor : [opt] hexstring - color of radio button's label's shadow. (e.g. '0xFF000000')\n" ++ "focusedColor : [opt] hexstring - color of focused radio button's label. (e.g. '0xFF00FFFF')\n" ++ "radioFocusTexture : [opt] string - filename for radio focus texture.\n" ++ "noRadioFocusTexture : [opt] string - filename for radio no focus texture.\n" ++ "\n" ++ "*Note, You can use the above as keywords for arguments and skip certain optional arguments.\n" ++ " Once you use a keyword, all following arguments require the keyword.\n" ++ " After you create the control, you need to add it to the window with addControl().\n" ++ "\n" ++ "example:\n" ++ " - self.radiobutton = xbmcgui.ControlToggleButton(100, 250, 200, 50, 'Status', font='font14')\n"); ++ ++ // Restore code and data sections to normal. ++ ++ PyTypeObject ControlToggle_Type; ++ ++ void initControlToggle_Type() ++ { ++ PyXBMCInitializeTypeObject(&ControlToggle_Type); ++ ++ ControlToggle_Type.tp_name = (char*)"xbmcgui.ControlToggleButton"; ++ ControlToggle_Type.tp_basicsize = sizeof(ControlToggle); ++ ControlToggle_Type.tp_dealloc = (destructor)ControlToggle_Dealloc; ++ ControlToggle_Type.tp_compare = 0; ++ ControlToggle_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; ++ ControlToggle_Type.tp_doc = ControlToggle__doc__; ++ ControlToggle_Type.tp_methods = ControlToggle_methods; ++ ControlToggle_Type.tp_base = &Control_Type; ++ ControlToggle_Type.tp_new = ControlToggle_New; ++ } ++} ++ ++#ifdef __cplusplus ++} ++#endif +diff -Naur xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/Makefile.in xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/Makefile.in +--- xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/Makefile.in 2011-12-10 22:16:21.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/Makefile.in 2011-12-17 18:44:47.447960296 +0100 +@@ -13,6 +13,7 @@ + controlslider.cpp \ + controlspin.cpp \ + controltextbox.cpp \ ++ controltogglebutton.cpp \ + dialog.cpp \ + GUIPythonWindow.cpp \ + GUIPythonWindowDialog.cpp \ +diff -Naur xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/window.cpp xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/window.cpp +--- xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/window.cpp 2011-12-10 22:16:21.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/window.cpp 2011-12-17 18:43:42.218705123 +0100 +@@ -277,6 +277,12 @@ + if (li.font) ((ControlEdit*)pControl)->strFont = li.font->GetFontName(); + ((ControlButton*)pControl)->align = li.align; + break; ++ case CGUIControl::GUICONTROL_TOGGLEBUTTON: ++ pControl = (Control*)ControlToggle_Type.tp_alloc(&ControlToggle_Type, 0); ++ new(&((ControlToggle*)pControl)->bIsSelected) bool(); ++ ++ break; ++ + default: + break; + } +diff -Naur xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/xbmcguimodule.cpp xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/xbmcguimodule.cpp +--- xbmc-f3b0020/xbmc/interfaces/python/xbmcmodule/xbmcguimodule.cpp 2011-12-10 22:16:21.000000000 +0100 ++++ xbmc-f3b0020.patch/xbmc/interfaces/python/xbmcmodule/xbmcguimodule.cpp 2011-12-17 18:43:42.219705142 +0100 +@@ -138,6 +138,7 @@ + initAction_Type(); + initControlRadioButton_Type(); + initControlEdit_Type(); ++ initControlToggle_Type(); + + if (PyType_Ready(&Window_Type) < 0 || + PyType_Ready(&WindowDialog_Type) < 0 || +@@ -160,7 +161,8 @@ + PyType_Ready(&ControlSlider_Type) < 0 || + PyType_Ready(&ControlRadioButton_Type) < 0 || + PyType_Ready(&ControlEdit_Type) < 0 || +- PyType_Ready(&Action_Type) < 0) ++ PyType_Ready(&Action_Type) < 0 || ++ PyType_Ready(&ControlToggle_Type) < 0) + return; + + } +@@ -200,6 +202,7 @@ + Py_INCREF(&Action_Type); + Py_INCREF(&ControlRadioButton_Type); + Py_INCREF(&ControlEdit_Type); ++ Py_INCREF(&ControlToggle_Type); + + pXbmcGuiModule = Py_InitModule3((char*)"xbmcgui", xbmcGuiMethods, xbmcgui_module_documentation); + +@@ -227,7 +230,8 @@ + PyModule_AddObject(pXbmcGuiModule, (char*)"Action", (PyObject *)&Action_Type); + PyModule_AddObject(pXbmcGuiModule, (char*)"ControlRadioButton", (PyObject*)&ControlRadioButton_Type); + PyModule_AddObject(pXbmcGuiModule, (char*)"ControlEdit", (PyObject*)&ControlEdit_Type); +- ++ PyModule_AddObject(pXbmcGuiModule, (char*)"ControlToggle", (PyObject*)&ControlToggle_Type); ++ + PyModule_AddStringConstant(pXbmcGuiModule, (char*)"__author__", (char*)PY_XBMC_AUTHOR); + PyModule_AddStringConstant(pXbmcGuiModule, (char*)"__date__", (char*)"14 July 2006"); + PyModule_AddStringConstant(pXbmcGuiModule, (char*)"__version__", (char*)"1.2"); +diff -Naur xbmc-f3b0020/XBMC.xcodeproj/project.pbxproj xbmc-f3b0020.patch/XBMC.xcodeproj/project.pbxproj +--- xbmc-f3b0020/XBMC.xcodeproj/project.pbxproj 2011-12-10 22:16:23.000000000 +0100 ++++ xbmc-f3b0020.patch/XBMC.xcodeproj/project.pbxproj 2011-12-17 18:43:42.152703851 +0100 +@@ -38,6 +38,10 @@ + /* End PBXAggregateTarget section */ + + /* Begin PBXBuildFile section */ ++ 1809F6BE149C900D00960880 /* controltogglebutton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1809F6BD149C900D00960880 /* controltogglebutton.cpp */; }; ++ 1809F6BF149C900D00960880 /* controltogglebutton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1809F6BD149C900D00960880 /* controltogglebutton.cpp */; }; ++ 1809F6C4149C918B00960880 /* karaokevideobackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1809F6C2149C918B00960880 /* karaokevideobackground.cpp */; }; ++ 1809F6C5149C918B00960880 /* karaokevideobackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1809F6C2149C918B00960880 /* karaokevideobackground.cpp */; }; + 1830212813B8E2DC00770920 /* controledit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1830212713B8E2DC00770920 /* controledit.cpp */; }; + 1830212913B8E2DC00770920 /* controledit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1830212713B8E2DC00770920 /* controledit.cpp */; }; + 183C454D130C4D55006AA317 /* xbmcvfsmodule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 189047D11301DEAB00C11012 /* xbmcvfsmodule.cpp */; settings = {COMPILER_FLAGS = "-I$XBMC_DEPENDS/include/python2.6"; }; }; +@@ -1939,6 +1943,9 @@ + + /* Begin PBXFileReference section */ + 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = ../../../System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; ++ 1809F6BD149C900D00960880 /* controltogglebutton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controltogglebutton.cpp; sourceTree = ""; }; ++ 1809F6C2149C918B00960880 /* karaokevideobackground.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokevideobackground.cpp; sourceTree = ""; }; ++ 1809F6C3149C918B00960880 /* karaokevideobackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokevideobackground.h; sourceTree = ""; }; + 1830212713B8E2DC00770920 /* controledit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controledit.cpp; sourceTree = ""; }; + 18308CB41303370800AA309E /* stat_utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stat_utf8.h; sourceTree = ""; }; + 18308CB51303370800AA309E /* stdio_utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdio_utf8.h; sourceTree = ""; }; +@@ -4614,6 +4621,8 @@ + F54C51E00F1E787700D46E3C /* karaokelyricstextlrc.h */, + 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */, + 7CDAEA7C1001CD6E0040B25F /* karaokelyricstextustar.h */, ++ 1809F6C2149C918B00960880 /* karaokevideobackground.cpp */, ++ 1809F6C3149C918B00960880 /* karaokevideobackground.h */, + F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */, + F56A08490F4A18FB003F9F87 /* karaokewindowbackground.h */, + ); +@@ -6022,6 +6031,7 @@ + C80425701158A0DE00D158A6 /* controlslider.cpp */, + E38E25880D263CE000618676 /* controlspin.cpp */, + E38E25890D263CE000618676 /* controltextbox.cpp */, ++ 1809F6BD149C900D00960880 /* controltogglebutton.cpp */, + E38E258A0D263CE000618676 /* dialog.cpp */, + E38E19EA0D25F9FB00618676 /* dialog.h */, + E38E258B0D263CE000618676 /* GUIPythonWindow.cpp */, +@@ -8043,6 +8053,8 @@ + DF85BAB51443669A000686BE /* FileUPnP.cpp in Sources */, + DF673AA51443819600A5A509 /* AddonManager.cpp in Sources */, + F5BD02F6148D3A7E001B5583 /* CryptThreading.cpp in Sources */, ++ 1809F6BE149C900D00960880 /* controltogglebutton.cpp in Sources */, ++ 1809F6C4149C918B00960880 /* karaokevideobackground.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +@@ -8963,6 +8975,8 @@ + F54BCC601439345300F86B0F /* HotKeyController.m in Sources */, + DF85BAB61443669A000686BE /* FileUPnP.cpp in Sources */, + F5BD02F7148D3A7E001B5583 /* CryptThreading.cpp in Sources */, ++ 1809F6BF149C900D00960880 /* controltogglebutton.cpp in Sources */, ++ 1809F6C5149C918B00960880 /* karaokevideobackground.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + };