Update of /cvsroot/freevo/freevo/skins/dischi1
In directory sc8-pr-cvs1:/tmp/cvs-serv23955

Modified Files:
        area.py tvlisting_area.py 
Log Message:
Correct the rectangle drawing


Index: area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/area.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** area.py     20 Mar 2003 15:44:59 -0000      1.27
--- area.py     20 Mar 2003 18:55:45 -0000      1.28
***************
*** 28,31 ****
--- 28,34 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.28  2003/03/20 18:55:45  dischi
+ # Correct the rectangle drawing
+ #
  # Revision 1.27  2003/03/20 15:44:59  dischi
  # faster now
***************
*** 283,286 ****
--- 286,296 ----
  
  
+ class Geometry:
+     def __init__(self, x, y, width, height):
+         self.x = x
+         self.y = y
+         self.width  = width
+         self.height = height
+ 
  
  class Skin_Area:
***************
*** 506,509 ****
--- 516,539 ----
      
  
+     def fit_item_in_rectangle(self, rectangle, width, height):
+         """
+         calculates the rectangle geometry and fits it into the area
+         """
+         x = 0
+         y = 0
+         r = self.get_item_rectangle(rectangle, width, height)[2]
+         if r.width > width:
+             r.width, width = width, width - (r.width - width)
+         if r.height > height:
+             r.height, height = height, height - (r.height - height)
+         if r.x < 0:
+             r.x, x = 0, -r.x
+             width -= x
+         if r.y < 0:
+             r.y, y = 0, -r.y
+             height -= y
+ 
+         return Geometry(x, y, width, height), r
+     
  
      def init_vars(self, settings, display_type, widget_type = 'menu'):

Index: tvlisting_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/tvlisting_area.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tvlisting_area.py   19 Mar 2003 11:00:31 -0000      1.7
--- tvlisting_area.py   20 Mar 2003 18:55:46 -0000      1.8
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.8  2003/03/20 18:55:46  dischi
+ # Correct the rectangle drawing
+ #
  # Revision 1.7  2003/03/19 11:00:31  dischi
  # cache images inside the area and some bugfixes to speed up things
***************
*** 67,71 ****
  osd = osd.get_singleton()
  
! from area import Skin_Area
  from skin_utils import *
  
--- 70,74 ----
  osd = osd.get_singleton()
  
! from area import Skin_Area, Geometry
  from skin_utils import *
  
***************
*** 155,162 ****
              item_h = max(item_h, r.height + content.spacing)
  
          content_h = content.height + content.y - content_y
  
          self.last_items_geometry = font_h, label_width, label_txt_width, content_y,\
!                                    content_h / item_h, item_h
  
          return self.last_items_geometry
--- 158,170 ----
              item_h = max(item_h, r.height + content.spacing)
  
+         head_h = head_val.font.h
+         if head_val.rectangle:
+             r = self.get_item_rectangle(head_val.rectangle, 20, head_val.font.h)[2]
+             head_h = max(head_h, r.height + content.spacing)
+ 
          content_h = content.height + content.y - content_y
  
          self.last_items_geometry = font_h, label_width, label_txt_width, content_y,\
!                                    content_h / item_h, item_h, head_h
  
          return self.last_items_geometry
***************
*** 180,184 ****
          col_time = 30
  
!         font_h, label_width, label_txt_width, y0, num_rows, item_h = \
                  self.get_items_geometry(settings, menu)
  
--- 188,192 ----
          col_time = 30
  
!         font_h, label_width, label_txt_width, y0, num_rows, item_h, head_h = \
                  self.get_items_geometry(settings, menu)
  
***************
*** 220,235 ****
              ty0 = content.y
  
              if head_val.rectangle:
!                 r = self.get_item_rectangle(head_val.rectangle, x1-x0, 
head_font.h)[2]
!                 if r.x < 0:
!                     x0 -= r.x
!                 if r.y < 0:
!                     ty0 -= r.y
!                 self.drawroundbox(x0 + r.x, ty0 + r.y, r.width, r.height, r)
                  
              
self.write_text(time.strftime("%H:%M",time.localtime(to_listing[0][i+1])),
!                             head_font, content, x=x0, y=ty0, width=x1-x0, height=-1)
  
-         
          # define start and stop time
          date = time.strftime("%x", time.localtime())
--- 228,241 ----
              ty0 = content.y
  
+             ig = Geometry(0, 0, x1-x0+1, head_h)
              if head_val.rectangle:
!                 ig, r = self.fit_item_in_rectangle(head_val.rectangle, x1-x0+1, 
head_h)
!                 self.drawroundbox(x0+r.x, ty0+r.y, r.width, r.height, r)
                  
              
self.write_text(time.strftime("%H:%M",time.localtime(to_listing[0][i+1])),
!                             head_font, content, x=x0+ig.x,
!                             y=ty0+ig.y, width=ig.width, height=-1,
!                             align_v='center', align_h = head_val.align)
  
          # define start and stop time
          date = time.strftime("%x", time.localtime())
***************
*** 239,243 ****
  
          # 1 sec = x pixels
!         prop_1sec = float(w_contents) / float(n_cols * col_time * 60) 
  
          # selected program:
--- 245,249 ----
  
          # 1 sec = x pixels
!         prop_1sec = float(w_contents) / float(n_cols * col_time * 60)
  
          # selected program:
***************
*** 297,302 ****
              if to_listing[i].programs:
                  for prg in to_listing[i].programs:
!                     flag_left  = 0
!                     flag_right = 0
  
                      if prg.start < start_time:
--- 303,308 ----
              if to_listing[i].programs:
                  for prg in to_listing[i].programs:
!                     flag_left   = 0
!                     flag_right  = 0
  
                      if prg.start < start_time:
***************
*** 316,320 ****
                          x1 = x_contents + int(float(prg.stop-start_time) * prop_1sec)
  
- 
                      if prg.title == selected_prog.title and \
                         prg.channel_id == selected_prog.channel_id and \
--- 322,325 ----
***************
*** 342,358 ****
                      tx1 = x1
                      ty0 = y0
!                     
                      if val.rectangle:
!                         r = self.get_item_rectangle(val.rectangle, tx1-tx0, 
font_h)[2]
!                         if r.x < 0:
!                             tx0 -= r.x
!                         if r.y < 0:
!                             ty0 -= r.y
!                             
                          self.drawroundbox(tx0+r.x, ty0+r.y, r.width, r.height, r)
                          
                      if tx0 < tx1:
!                         self.write_text(prg.title, font, content, x=tx0,
!                                         y=ty0, width=tx1-tx0, height=font_h,
                                          align_v='center', align_h = val.align)
  
--- 347,359 ----
                      tx1 = x1
                      ty0 = y0
! 
!                     ig = Geometry(0, 0, tx1-tx0+1, item_h)
                      if val.rectangle:
!                         ig, r = self.fit_item_in_rectangle(val.rectangle, tx1-tx0+1, 
item_h)
                          self.drawroundbox(tx0+r.x, ty0+r.y, r.width, r.height, r)
                          
                      if tx0 < tx1:
!                         self.write_text(prg.title, font, content, x=tx0+ig.x,
!                                         y=ty0+ig.y, width=ig.width, height=-1,
                                          align_v='center', align_h = val.align)
  




-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC.  
Does your code think in ink? You could win a Tablet PC. 
Get a free Tablet PC hat just for playing. What are you waiting for? 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to