Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv22629

Modified Files:
        osd.py 
Log Message:
Added null_layer. This layer can be used for drawstringframed to avoid
unneccessay drawings.


Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** osd.py      21 Jun 2003 10:18:34 -0000      1.45
--- osd.py      22 Jun 2003 11:35:36 -0000      1.46
***************
*** 10,13 ****
--- 10,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.46  2003/06/22 11:35:36  dischi
+ # Added null_layer. This layer can be used for drawstringframed to avoid
+ # unneccessay drawings.
+ #
  # Revision 1.45  2003/06/21 10:18:34  dischi
  # small fix
***************
*** 282,285 ****
--- 286,293 ----
          self.height = config.CONF.height
  
+         # layer for drawstringframed if you don't want to draw, only calc
+         # the geometry
+         self.null_layer = 'null layer'
+         
          if config.CONF.display== 'dxr3':
              os.environ['SDL_VIDEODRIVER'] = 'dxr3'
***************
*** 648,652 ****
      #  - Improve it
      def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, 
bgcolor=None,
!                          font=None, ptsize=0, align_h='left', align_v='top', 
layer=None, ellipses='...'):
  
          if not pygame.display.get_init():
--- 656,661 ----
      #  - Improve it
      def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, 
bgcolor=None,
!                              font=None, ptsize=0, align_h='left', align_v='top', 
layer=None,
!                              ellipses='...'):
  
          if not pygame.display.get_init():
***************
*** 850,854 ****
              print "osd.drawstringframed_soft():\n\n%s\n" % lines
  
!         if bgcolor != None:
              self.drawbox(x,y, x+width, y+height, width=-1, color=bgcolor, 
layer=layer)
          for line_number in range(len(lines)):
--- 859,863 ----
              print "osd.drawstringframed_soft():\n\n%s\n" % lines
  
!         if bgcolor != None and layer != self.null_layer:
              self.drawbox(x,y, x+width, y+height, width=-1, color=bgcolor, 
layer=layer)
          for line_number in range(len(lines)):
***************
*** 874,878 ****
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         self.drawstring(word, x0, y0, fgcolor, None, font, ptsize, 
layer=layer)
                          x0 += spacing + word_size 
                      
--- 883,889 ----
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         if layer != self.null_layer:
!                             self.drawstring(word, x0, y0, fgcolor, None, font,
!                                             ptsize, layer=layer)
                          x0 += spacing + word_size 
                      
***************
*** 885,889 ****
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         self.drawstring(word, x0, y0, fgcolor, None, font, ptsize, 
layer=layer)
                          x0 += spacing
                          x0 += word_size
--- 896,902 ----
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         if layer != self.null_layer:
!                             self.drawstring(word, x0, y0, fgcolor, None, font,
!                                             ptsize, layer=layer)
                          x0 += spacing
                          x0 += word_size
***************
*** 897,901 ****
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         self.drawstring(word, x0, y0, fgcolor, None, font, ptsize, 
layer=layer)
                          x0 += spacing
                          x0 += word_size
--- 910,916 ----
                      if word:
                          word_size, word_height = self.stringsize(word, font,ptsize)
!                         if layer != self.null_layer:
!                             self.drawstring(word, x0, y0, fgcolor, None, font,
!                                             ptsize, layer=layer)
                          x0 += spacing
                          x0 += word_size
***************
*** 911,916 ****
                          word_size, word_height = \
                                     self.stringsize(lines[line_number][pos], 
font,ptsize)
!                         self.drawstring(lines[line_number][pos], x0, y0, fgcolor, \
!                                         None, font, ptsize, 'right', layer=layer)
                          x0 -= spacing
                          x0 -= word_size
--- 926,932 ----
                          word_size, word_height = \
                                     self.stringsize(lines[line_number][pos], 
font,ptsize)
!                         if layer != self.null_layer:
!                             self.drawstring(lines[line_number][pos], x0, y0, 
fgcolor, \
!                                             None, font, ptsize, 'right', layer=layer)
                          x0 -= spacing
                          x0 -= word_size
***************
*** 993,997 ****
          if line_height > height:
              return string
!         
          # Fit chars in lines
          lines = [ '' ]
--- 1009,1013 ----
          if line_height > height:
              return string
! 
          # Fit chars in lines
          lines = [ '' ]
***************
*** 1033,1037 ****
                          if (occupied_size + ellipses_size) <= width:
                              break
!                         
                          # shorten the line again to make space for 'ellipses'
                          char_size = self.charsize(lines[line_number][len_line-j-1],
--- 1049,1053 ----
                          if (occupied_size + ellipses_size) <= width:
                              break
! 
                          # shorten the line again to make space for 'ellipses'
                          char_size = self.charsize(lines[line_number][len_line-j-1],
***************
*** 1050,1053 ****
--- 1066,1072 ----
  
          rest_words = string[i+1:len(string)]
+             
+         if layer == self.null_layer:
+             return (rest_words, (return_x0,return_y0, return_x1, return_y1))
  
          if bgcolor != None:




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to