[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Tue Jul 27 02:30:45 CEST 2004


CVS commit by netterfield: 

Fix for bug 85828: Wasted space


  M +11 -4     kst2dplot.cpp   1.182
  M +31 -29    kstlabel.cpp   1.34


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.181:1.182
@@ -818,5 +818,5 @@ void Kst2DPlot::setBorders(double& xleft
                          double YTick, double Yorg,
                          QPainter& p) {
-  int x_px, y_px,i;
+  int x_px, y_px,i,  ls;
   char TmpStr[120];
 
@@ -829,5 +829,12 @@ void Kst2DPlot::setBorders(double& xleft
   /* Set Borders                               */
   ytop_bdr_px = 1.3 * TopLabel->lineSpacing(p);
-  ybot_bdr_px = 1.3 * XLabel->lineSpacing(p) + TickLabel->ascent(p);
+  if ( ytop_bdr_px<1 ) ytop_bdr_px = 2;
+
+  ls = XLabel->lineSpacing(p);
+  if ( ls >1 ) {
+    ybot_bdr_px = XLabel->lineSpacing(p) + 1.3 * TickLabel->ascent(p);
+  } else {
+    ybot_bdr_px = 1.7 * TickLabel->ascent(p);
+  }
 
   double ifloat = (YMax - Yorg)/YTick;

--- kdeextragear-2/kst/kst/kstlabel.cpp  #1.33:1.34
@@ -122,4 +122,5 @@ int KstLabel::width(QPainter &p) {
 
 int KstLabel::ascent(QPainter &p) {
+  if ( Text.isEmpty() ) return( 0 );
   int Ascent = 0;
   QFont TextFont(FontName, fontSize(p), QFont::Normal, false);
@@ -135,4 +136,5 @@ int KstLabel::ascent(QPainter &p) {
 // FIXME: expensive - cache it?
 int KstLabel::lineSpacing(QPainter &p) {
+  if ( Text.isEmpty() ) return( 0 );
   int LineSpacing = 0;
   QFont TextFont(FontName, fontSize(p), QFont::Normal, false);





More information about the Kst mailing list