Title: [commits] (jeffrey) [15948] [APP] Minor tweaks to lozenge text drawing.
Revision
15948
Author
jeffrey
Date
2007-11-28 19:09:25 -0800 (Wed, 28 Nov 2007)

Log Message

[APP] Minor tweaks to lozenge text drawing.

Modified Paths

Diff

Modified: branches/rearchitecture/Chandler-Platform/ocap/wxui/calendar.py (15947 => 15948)

--- branches/rearchitecture/Chandler-Platform/ocap/wxui/calendar.py	2007-11-29 01:37:51 UTC (rev 15947)
+++ branches/rearchitecture/Chandler-Platform/ocap/wxui/calendar.py	2007-11-29 03:09:25 UTC (rev 15948)
@@ -33,9 +33,9 @@
 MARGIN_LEFT = 40.0
 
 TEXT_X_MARGIN = 3.5
-TEXT_Y_MARGIN = 3
+TEXT_Y_MARGIN = 1
 
-TIME_BOTTOM_MARGIN = 2
+TIME_Y_MARGIN = 2
 
 # arbitrary base size to use as a reference point for calculating calendar sizes
 BASE_WIDTH  = 701.0
@@ -357,8 +357,7 @@
             radius = SMALL_RADIUS if rect.height > min_height else rect.height/2
             DrawFilledLozenge(gc, rect, radius, truncate = truncate)
 
-            time_height = (TEXT_Y_MARGIN + TIME_BOTTOM_MARGIN +
-                           self.time_font_height)
+            time_height = 2*TIME_Y_MARGIN + self.time_font_height
 
             rect.Inset(TEXT_X_MARGIN - 1, 0)
             gc.Clip(*rect)
@@ -366,16 +365,17 @@
 
             if rect.height <= time_height + line_height:
                 # room for just one line of text
+                rect.Inset(radius/3, 0, 0, 0)
                 text_top = rect.GetCentre()[1] - line_height/2
                 gc.SetFont(self.title_font, DefaultColors.text)
                 DrawClippedText(gc, event.title, rect.x, text_top, rect.width)
             else:
-                rect.Inset(0, TEXT_Y_MARGIN, 0, 0)
+                rect.Inset(radius/3, TIME_Y_MARGIN, 0, 0)
                 time_text = self.time_formatter(event.start)
                 gc.SetFont(self.time_font, DefaultColors.text)
                 gc.DrawText(time_text, rect.x, rect.y)
                 width, height = gc.GetTextExtent(time_text)
-                rect.Inset(0, TIME_BOTTOM_MARGIN + height, 0, 0)
+                rect.Inset(0, TIME_Y_MARGIN + height, 0, 0)
                 gc.SetFont(self.title_font, DefaultColors.text)
                 # need to wrap text
                 DrawWrappedText(gc, event.title, rect)

Modified: branches/rearchitecture/Chandler-Platform/ocap/wxui/drawing.py (15947 => 15948)

--- branches/rearchitecture/Chandler-Platform/ocap/wxui/drawing.py	2007-11-29 01:37:51 UTC (rev 15947)
+++ branches/rearchitecture/Chandler-Platform/ocap/wxui/drawing.py	2007-11-29 03:09:25 UTC (rev 15948)
@@ -169,6 +169,7 @@
     probably cheaper to just start walking up or down from the guess,
     rather than trying to do a quicksearch -alecf
     """
+    x, y = round(x), round(y)
     if wordWidth < 0:
         # do some initial measurements
         wordWidth = dc.GetTextExtent(word)[0]




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to