[dvbapp] remove patches in bsp layer and cleanup unused patch files. (patches were...
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-vuplus / enigma2 / enigma2 / enigma2_vuplus_skin.patch
1 diff --git a/data/skin.xml b/data/skin.xml
2 index bbf4dd0..b99bdce 100755
3 --- a/data/skin.xml
4 +++ b/data/skin.xml
5 @@ -148,10 +148,10 @@
6                         <convert type="ConditionalShowHide" />
7                 </widget>
8                 <!-- Audio icon (is there multichannel audio?) -->
9 -<!--   <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/icon_dolby.png" position="645,48" zPosition="1" size="26,16" alphatest="on">
10 +               <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/icon_dolby.png" position="645,48" zPosition="1" size="26,16" alphatest="on">
11                         <convert type="ServiceInfo">IsMultichannel</convert>
12                         <convert type="ConditionalShowHide" />
13 -               </widget>       -->
14 +               </widget>
15                 <!-- Progressbar (current event duration)-->
16                 <ePixmap pixmap="skin_default/progress_bg.png" position="48,77" size="84,7" transparent="1" alphatest="on" />
17                 <widget source="session.Event_Now" render="Progress" pixmap="skin_default/progress_small.png" position="50,78" zPosition="1" size="80,5" transparent="1">
18 diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp
19 index fd33298..d8c1982 100644
20 --- a/lib/gdi/epng.cpp
21 +++ b/lib/gdi/epng.cpp
22 @@ -116,10 +116,71 @@ int loadPNG(ePtr<gPixmap> &result, const char *filename)
23                 }
24                 surface->clut.start=0;
25                 png_read_end(png_ptr, end_info);
26 +#ifndef BUILD_VUPLUS
27         } else {
28                 result=0;
29                 eDebug("%s: %dx%dx%d png, %d", filename, (int)width, (int)height, (int)bit_depth, color_type);
30         }
31 +#else          //csh Support for 32bit png file.
32 +       }else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA && bit_depth == 8){
33 +//             eDebug("%s: %dx%dx%d png, %d", filename, (int)width, (int)height, (int)bit_depth, color_type);
34 +               result=new gPixmap(eSize(width, height), bit_depth*4);
35 +               gSurface *surface = result->surface;
36 +               int pass;
37 +               png_bytep *rowptr=new png_bytep[height];
38 +
39 +
40 +               //png_set_swap_alpha(png_ptr);
41 +
42 +               if (color_type & PNG_COLOR_MASK_COLOR)
43 +                       png_set_bgr(png_ptr);
44 +
45 +
46 +
47 +               int number_passes = png_set_interlace_handling(png_ptr);
48 +
49 +               for (unsigned int i=0; i<height; i++)
50 +                       rowptr[i]=((png_byte*)(surface->data))+i*surface->stride;
51 +
52 +               for (pass = 0; pass < number_passes; pass++)
53 +                       for (int y = 0; y < height; y++)
54 +                       {
55 +                               png_read_rows(png_ptr, &rowptr[y], NULL, 1);
56 +                       }
57 +
58 +/*
59 +               png_bytep testptr = rowptr[32] + sizeof(unsigned int)*32;
60 +
61 +               for(int i = 0 ; i < 40 ; i ++)
62 +                       fprintf(stderr, "0x%x\n", testptr[i]);
63 +*/
64 +               for (int y = 0; y < height; y++){                               //csh  
65 +                       __u32 col;                      
66 +                       unsigned int *ptr = (unsigned int *)rowptr[y];
67 +                       for(int i = 0 ; i < width ; i ++){
68 +                               col= ptr[i];
69 +                               col ^=0xFF000000;
70 +                               ptr[i] = col;
71 +                       }
72 +               }
73
74 +               surface->clut.data=0;
75 +               surface->clut.colors=0;
76 +               surface->clut.start=0; 
77 +/*
78 +               testptr = rowptr[32] + sizeof(unsigned int)*32;
79 +               fprintf(stderr, "----------------------------------------------\n");
80 +               for(int i = 0 ; i < 40 ; i ++)
81 +                       fprintf(stderr, "0x%x\n", testptr[i]);
82 +*/
83 +               delete [] rowptr;
84 +               png_read_end(png_ptr, end_info);
85 +
86 +       } else {
87 +               result=0;
88 +               eDebug("%s: %dx%dx%d png, %d", filename, (int)width, (int)height, (int)bit_depth, color_type);
89 +       }
90 +#endif
91  
92         png_destroy_read_struct(&png_ptr, &info_ptr,&end_info);
93         fclose(fp);
94 diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py
95 index fc176a7..75a933f 100755
96 --- a/lib/python/Screens/ChannelSelection.py
97 +++ b/lib/python/Screens/ChannelSelection.py
98 @@ -2,6 +2,8 @@ from Tools.Profile import profile
99  
100  from Screen import Screen
101  from Components.Button import Button
102 +
103 +from Components.Label import Label
104  from Components.ServiceList import ServiceList
105  from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap
106  from Components.MenuList import MenuList
107 @@ -733,6 +735,8 @@ class ChannelSelectionBase(Screen):
108                 self["key_yellow"] = Button(_("Provider"))
109                 self["key_blue"] = Button(_("Favourites"))
110  
111 +               self["etitle"] = Label(_('Channel Selection'))
112 +
113                 self["list"] = ServiceList()
114                 self.servicelist = self["list"]
115  
116 @@ -878,25 +882,51 @@ class ChannelSelectionBase(Screen):
117                 pos = titleStr.find(']')
118                 if pos == -1:
119                         pos = titleStr.find(')')
120 -               if pos != -1:
121 -                       titleStr = titleStr[:pos+1]
122 -                       Len = len(self.servicePath)
123 -                       if Len > 0:
124 -                               base_ref = self.servicePath[0]
125 -                               if Len > 1:
126 -                                       end_ref = self.servicePath[Len-1]
127 -                               else:
128 -                                       end_ref = None
129 -                               nameStr = self.getServiceName(base_ref)
130 -                               titleStr += ' ' + nameStr
131 -                               if end_ref is not None:
132 -                                       if Len > 2:
133 -                                               titleStr += '/../'
134 +
135 +               if config.skin.primary_skin.value       =="750S/skin.xml":
136 +                       if pos != -1:
137 +                               titleStr = titleStr[:pos+1]
138 +                               Len = len(self.servicePath)
139 +                               if Len > 0:
140 +                                       base_ref = self.servicePath[0]
141 +                                       if Len > 1:
142 +                                               end_ref = self.servicePath[Len-1]
143                                         else:
144 -                                               titleStr += '/'
145 -                                       nameStr = self.getServiceName(end_ref)
146 -                                       titleStr += nameStr
147 -                               self.setTitle(titleStr)
148 +                                               end_ref = None
149 +                                       nameStr = self.getServiceName(base_ref)
150 +                                       if end_ref is not None:
151 +                                               titles = ".../"+ nameStr
152 +                                               if Len > 2:
153 +                                                       titles += '/../'
154 +                                               else:
155 +                                                       titles += '/'
156 +                                               nameStr = self.getServiceName(end_ref)
157 +                                               titles += nameStr
158 +                                               self["etitle"].setText(titles)
159 +                                       else:
160 +                                               titles = "Channel Selection "+titleStr + ' ' + nameStr                  
161 +                                               self["etitle"].setText(titles)
162 +               else:   
163 +               #       
164 +                       if pos != -1:
165 +                               titleStr = titleStr[:pos+1]
166 +                               Len = len(self.servicePath)
167 +                               if Len > 0:
168 +                                       base_ref = self.servicePath[0]
169 +                                       if Len > 1:
170 +                                               end_ref = self.servicePath[Len-1]
171 +                                       else:
172 +                                               end_ref = None
173 +                                       nameStr = self.getServiceName(base_ref)
174 +                                       titleStr += ' ' + nameStr
175 +                                       if end_ref is not None:
176 +                                               if Len > 2:
177 +                                                       titleStr += '/../'
178 +                                               else:
179 +                                                       titleStr += '/'
180 +                                               nameStr = self.getServiceName(end_ref)
181 +                                               titleStr += nameStr
182 +                                       self.setTitle(titleStr)
183  
184         def moveUp(self):
185                 self.servicelist.moveUp()
186 diff --git a/lib/python/Screens/FixedMenu.py b/lib/python/Screens/FixedMenu.py
187 index 0122346..39b48ac 100644
188 --- a/lib/python/Screens/FixedMenu.py
189 +++ b/lib/python/Screens/FixedMenu.py
190 @@ -20,3 +20,8 @@ class FixedMenu(Screen):
191                         })
192  
193                 self["title"] = StaticText(title)
194 +               self["thistory"] = StaticText(title)
195 +               self["title0"] = StaticText('')
196 +               self["title1"] = StaticText('')
197 +               self["title2"] = StaticText('')
198 +
199 diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py
200 index 2a8801c..fe5bcf0 100755
201 --- a/lib/python/Screens/Menu.py
202 +++ b/lib/python/Screens/Menu.py
203 @@ -22,6 +22,27 @@ from Screens.Setup import Setup, getSetupTitle
204  # read the menu
205  mdom = xml.etree.cElementTree.parse(resolveFilename(SCOPE_SKIN, 'menu.xml'))
206  
207 +class title_History:
208 +       def __init__(self):
209 +               self.thistory = ''
210 +       def reset(self):
211 +               self.thistory = ''
212 +       def reducehistory(self):
213 +#              print "reducehistory" , self.thistory
214 +               history_len = len(self.thistory.split('>'))
215 +               if(history_len < 3):
216 +                       self.reset()
217 +                       return
218 +               if(self.thistory == ''):
219 +                       return
220 +               result = self.thistory.rsplit('>',2)
221 +               if(result[0] == ''):
222 +                       self.reset()
223 +                       return
224 +               self.thistory = result[0] + '> '
225 +
226 +t_history = title_History()
227 +
228  class boundFunction:
229         def __init__(self, fnc, *args):
230                 self.fnc = fnc
231 @@ -237,9 +258,39 @@ class Menu(Screen):
232                 a = a and _(a)
233                 if a is None:
234                         a = _(parent.get("text", "").encode("UTF-8"))
235 +               else:
236 +                       t_history.reset()
237 +                       
238                 self["title"] = StaticText(a)
239                 self.menu_title = a
240  
241 +               self["thistory"] = StaticText(t_history.thistory)
242 +               history_len = len(t_history.thistory)
243 +               self["title0"] = StaticText('')
244 +               self["title1"] = StaticText('')
245 +               self["title2"] = StaticText('')
246 +               if history_len < 13 :
247 +                       self["title0"] = StaticText(a)
248 +               elif history_len < 21 :
249 +                       self["title0"] = StaticText('')
250 +                       self["title1"] = StaticText(a)
251 +               else:
252 +                       self["title0"] = StaticText('')
253 +                       self["title1"] = StaticText('')
254 +                       self["title2"] = StaticText(a)                          
255 +
256 +#              english title                   
257 +#              if(t_history.thistory ==''):
258 +#                      t_history.thistory = str(etitle) + ' > '
259 +#              else:
260 +#                      t_history.thistory = t_history.thistory + str(etitle) + ' > '
261 +
262 +               if(t_history.thistory ==''):
263 +                       t_history.thistory = str(a) + ' > '
264 +               else:
265 +                       t_history.thistory = t_history.thistory + str(a) + ' > '
266 +               #
267 +
268         def keyNumberGlobal(self, number):
269                 print "menu keyNumber:", number
270                 # Calculate index
271 @@ -250,9 +301,11 @@ class Menu(Screen):
272                         self.okbuttonClick()
273  
274         def closeNonRecursive(self):
275 +               t_history.reducehistory()
276                 self.close(False)
277  
278         def closeRecursive(self):
279 +               t_history.reset()
280                 self.close(True)
281  
282         def createSummary(self):
283 diff --git a/skin.py b/skin.py
284 index 933f524..151af61 100755
285 --- a/skin.py
286 +++ b/skin.py
287 @@ -235,14 +235,27 @@ class AttributeParser:
288                 self.guiObject.setZPosition(int(value))
289         def itemHeight(self, value):
290                 self.guiObject.setItemHeight(int(value))
291 +
292 +       def getPixmapPtr(self, value):
293 +               global pngcache
294 +               ptr = None
295 +               for cvalue, cptr in pngcache:
296 +                       if cvalue == value:
297 +                               ptr = cptr
298 +
299 +               if ptr is None:
300 +                       ptr = loadPixmap(value, self.desktop)
301 +
302 +               return ptr
303 +
304         def pixmap(self, value):
305 -               ptr = loadPixmap(value, self.desktop)
306 +               ptr = self.getPixmapPtr(value)
307                 self.guiObject.setPixmap(ptr)
308         def backgroundPixmap(self, value):
309 -               ptr = loadPixmap(value, self.desktop)
310 +               ptr = self.getPixmapPtr(value)
311                 self.guiObject.setBackgroundPicture(ptr)
312         def selectionPixmap(self, value):
313 -               ptr = loadPixmap(value, self.desktop)
314 +               ptr = self.getPixmapPtr(value)
315                 self.guiObject.setSelectionPicture(ptr)
316         def itemHeight(self, value):
317                 self.guiObject.setItemHeight(int(value))
318 @@ -336,6 +349,34 @@ class AttributeParser:
319         def id(self, value):
320                 pass
321  
322 +from enigma import runMainloop, eDVBDB, eTimer, quitMainloop, \
323 +       getDesktop, ePythonConfigQuery, eAVSwitch, eServiceEvent
324 +pngcache = []
325 +def cachemenu():
326 +       pixmaplist = []
327 +       for (path, skin) in dom_skins:
328 +               for x in skin.findall("screen"):
329 +                       if x.attrib.get('name') == 'menu_mainmenu':
330 +                               print x.attrib.get('name')
331 +                               for s in x.findall("ePixmap"):
332 +                                       if s.attrib.get('pixmap','') is not '':
333 +                                               pixmaplist.append(s.attrib.get('pixmap',''))
334 +                               for s in x.findall('widget'):
335 +                                       if s.attrib.get('pixmap','') is not '':
336 +                                               pixmaplist.append(s.attrib.get('pixmap',''))
337 +       desktop = getDesktop(0)
338 +       for s in pixmaplist:
339 +               value ='/usr/share/enigma2/'+s
340 +#              print value
341 +               ptr = loadPixmap(value, desktop)
342 +               pngcache.append((value,ptr))
343 +
344 +try:
345 +       if config.skin.primary_skin.value == "750S/skin.xml" or config.skin.primary_skin.value == "Vu_HD/skin.xml":
346 +               cachemenu()
347 +except:
348 +       print "fail cache main menu"
349 +
350  def applySingleAttribute(guiObject, desktop, attrib, value, scale = ((1,1),(1,1))):
351         # Someone still using applySingleAttribute?
352         AttributeParser(guiObject, desktop, scale).applyOne(attrib, value)