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

Modified Files:
        osd.py 
Log Message:
Corrected drawstringframedhard() truncate. 


Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** osd.py      20 Mar 2003 19:27:19 -0000      1.24
--- osd.py      23 Mar 2003 06:28:02 -0000      1.25
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.25  2003/03/23 06:28:02  gsbarbieri
+ # Corrected drawstringframedhard() truncate.
+ #
  # Revision 1.24  2003/03/20 19:27:19  dischi
  # Fix drawstringframedhard: the ellipses must fit the width, too
***************
*** 960,963 ****
--- 963,968 ----
          return_x1 = 0
          return_y1 = 0
+         plain_tab = '   '
+ 
  
          if DEBUG >= 3:
***************
*** 991,1009 ****
          lines = [ '' ]
          line_number = 0
!         ellipse_size = self.stringsize(ellipses, font, ptsize)[0]
          for i in range(len(string)):
!             char_size, char_height = self.charsize(string[i], font, ptsize)
!             if ((occupied_size + char_size + ellipse_size) <= width) and (string[i] 
!= '\n'):
                  occupied_size += char_size
!                 if string[i] == '\t':
!                     lines[line_number] += '   '
!                 else:
!                     lines[line_number] += string[i] 
              else:
                  if (occupied_height + char_height) <= height:
!                     occupied_height += word_height
                      line_number += 1
                      lines += [ '' ]
!                     if string[i] == '\n':
                          # Linebreak due to CR
                          occupied_size = 0
--- 996,1021 ----
          lines = [ '' ]
          line_number = 0
!         ellipses_size = self.stringsize(ellipses, font, ptsize)[0]
          for i in range(len(string)):
!             char = string[i]
!             if string[i] == '\t':
!                 char = plain_tab
!             else:
!                 char = string[i]
! 
!             char_size, char_height = self.charsize(char, font, ptsize)
! 
!             if ((occupied_size + char_size) <= width) and (char != '\n'):
! 
                  occupied_size += char_size
!                 lines[line_number] += char
!                 
              else:
                  if (occupied_height + char_height) <= height:
!                     # we can add one more line
!                     occupied_height += word_height                    
                      line_number += 1
                      lines += [ '' ]
!                     if char == '\n':
                          # Linebreak due to CR
                          occupied_size = 0
***************
*** 1012,1021 ****
                          # put it on the next line
                          occupied_size = char_size
!                         lines[line_number] = string[i]
                  else:
                      j = 1
                      len_line = len(lines[line_number])
                      for j in range(len_line):
!                         if (occupied_size + ellipse_size) <= width:
                              break
                          char_size = self.charsize(lines[line_number][len_line-j-1],
--- 1024,1035 ----
                          # put it on the next line
                          occupied_size = char_size
!                         lines[line_number] = char
                  else:
+                     # we can NOT add more lines :(
+                     # add the ellipses indicating we did truncate
                      j = 1
                      len_line = len(lines[line_number])
                      for j in range(len_line):
!                         if (occupied_size + ellipses_size) <= width:
                              break
                          char_size = self.charsize(lines[line_number][len_line-j-1],
***************
*** 1024,1030 ****
                      lines[line_number] = lines[line_number][0:len_line-j]
                      if ellipses:
!                         while ellipses and ellipse_size >= width:
                              ellipses = ellipses[:-1]
!                             ellipse_size = self.stringsize(ellipses, font, ptsize)[0]
                          lines[line_number] += ellipses
                      break
--- 1038,1044 ----
                      lines[line_number] = lines[line_number][0:len_line-j]
                      if ellipses:
!                         while ellipses and ellipses_size >= width:
                              ellipses = ellipses[:-1]
!                             ellipses_size = self.stringsize(ellipses, font, 
ptsize)[0]
                          lines[line_number] += ellipses
                      break
***************
*** 1039,1042 ****
--- 1053,1057 ----
          elif align_v == 'bottom':
              y0 = y + (height - (line_number+1) * word_height)
+ 
          
          for line in lines:
***************
*** 1049,1056 ****
                  x0 = x
              elif align_h == 'center' or align_h == 'justified':
!                 line_size, line_heigt = self.stringsize(line, font, ptsize)
                  x0 = x + (width - line_size) / 2
              elif align_h == 'right':
!                 line_size, line_heigt = self.stringsize(line, font, ptsize)
                  x0 = x + (width - line_size)
              self.drawstring(line, x0, y0, fgcolor, None, font, ptsize, layer=layer)
--- 1064,1071 ----
                  x0 = x
              elif align_h == 'center' or align_h == 'justified':
!                 line_size, line_heigth = self.stringsize(line, font, ptsize)
                  x0 = x + (width - line_size) / 2
              elif align_h == 'right':
!                 line_size, line_heigth = self.stringsize(line, font, ptsize)
                  x0 = x + (width - line_size)
              self.drawstring(line, x0, y0, fgcolor, None, font, ptsize, layer=layer)




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to