[GME-commit] GMESRC/GME/Annotator Decorator.cpp,1.9,1.10

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Dec 4 19:07:20 CST 2006


Update of /project/gme-repository/GMESRC/GME/Annotator
In directory escher:/tmp/cvs-serv4831

Modified Files:
	Decorator.cpp 
Log Message:
Annotations were drawn with DT_WORDBREAK style, thus when zooming distorted a bit (fonts are zoomed in special way), the calculated box was not enough big for the (trickyly) downscaled fonts, thus lines were broken, and finally not the whole text was shown.
We enlarge the area (rect) where the text will be written, by an empirically provided const> 1.33. This way only when drawing the text will have enough area. The bounding box is affected by the GetLocation, and that remains the same, thus it may happen that the bounding box is not nicely drawn on lower, or right side. Anyway, we don't deal with this, since the zooming currently does not require a full reset and invalidate, and we do can not recalculate the box size.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: Decorator.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Annotator/Decorator.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Decorator.cpp	30 Jul 2004 13:34:39 -0000	1.9
--- Decorator.cpp	4 Dec 2006 19:07:18 -0000	1.10
***************
*** 181,185 ****
  	rect.left += AN_MARGIN;
  	rect.right -= AN_MARGIN;
! 	dc.DrawText(m_text, &rect, DT_LEFT | DT_EXPANDTABS | DT_NOPREFIX | DT_WORDBREAK);
  
  	dc.SetBkColor(oldbkcolor);
--- 181,202 ----
  	rect.left += AN_MARGIN;
  	rect.right -= AN_MARGIN;
! 
! 	// enlarge area where the text will be written
! 	// in order to show the whole text when different
! 	// zoom levels are used (the bounding box still remains
! 	// the old one) being calculated based on GetLocation()
! 	rect.right+= (int)( rect.Width() * 0.33);
! 	rect.bottom+= (int)( rect.Height() * 0.33);
! 	// annotations can be shown under/behind objects anyway
! 	// so why feel guilty about allocating much bigger space
! 	// that would be needed at 100% zoom
! 
! 	// note: fonts are scaled down differently than guifcos
! 	// that is why zooming distorts a bit
! 	// different font sizes are used in different zoom levels
! 	dc.DrawText( m_text, &rect, DT_LEFT | DT_EXPANDTABS | DT_NOPREFIX);
! 	// DT_WORDBREAK removed, do not break lines if space is limited,
! 	// it conflicts with the native size allocated and calculated before
! 	// altered by zolmol
  
  	dc.SetBkColor(oldbkcolor);



More information about the GME-commit mailing list