[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Wed Oct 19 05:56:30 CEST 2005


SVN commit 471880 by netterfield:

Some minor changes to labels... still more bugs in process...



 M  +14 -10    kst2dplot.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #471879:471880
@@ -523,19 +523,12 @@
                                 bool x_log,
                                 bool y_log) {
   _labelFontSize = 0;
-  _absLabelFontSize = 0; // this value should never actually be used...
+  _absLabelFontSize = 0; // this value will be reset before use
+  _labelFontLineSpacing = 1; // this value will be reset before use
   _xLabel = new KstPlotLabel;
   _yLabel = new KstPlotLabel(270);
   _topLabel = new KstPlotLabel;
   _labelFontName = KstApp::inst()->defaultFont();
-#ifdef BENCHMARK
-  QTime t;
-  t.start();
-#endif
-  _labelFontLineSpacing = QFontMetrics(QFont(_labelFontName, _absLabelFontSize)).lineSpacing();
-#ifdef BENCHMARK
-  kstdDebug() << "commonConstructor -> linespacing #1 took: " << t.elapsed() << endl;
-#endif
   _zoomPaused = false;
   setDirty(true);
   _oldSize.setWidth(0);
@@ -1951,6 +1944,7 @@
     xleft_bdr_px  = tpy.maxWidth;
     xleft_bdr_px += 5 * _yLabel->lineSpacing() / 4;
     xleft_bdr_px += _labelFontLineSpacing / 4;
+    printf("mw: %g yls: %d lfls: %d xlbp: %g\n", tpy.maxWidth, _yLabel->lineSpacing(), _labelFontLineSpacing, xleft_bdr_px);
   }
 
   // calculate the right border
@@ -2313,6 +2307,16 @@
   
   // resize labels based on window size.
   _absLabelFontSize = scaleFontSize(_labelFontSize, x_px, y_px);
+  
+#ifdef BENCHMARK
+  QTime t;
+  t.start();
+#endif
+  _labelFontLineSpacing = QFontMetrics(QFont(_labelFontName, _absLabelFontSize)).lineSpacing();
+#ifdef BENCHMARK
+  kstdDebug() << "draw -> linespacing #1 took: " << t.elapsed() << endl;
+#endif
+
   _xLabel->setAbsFontSize(scaleFontSize(_xLabel->fontSize(), x_px, y_px));
   _yLabel->setAbsFontSize(scaleFontSize(_yLabel->fontSize(), x_px, y_px));
   _topLabel->setAbsFontSize(scaleFontSize(_topLabel->fontSize(), x_px, y_px)); 
@@ -2879,7 +2883,7 @@
   if (yl) 
     _yLabel->setText(ylabel);
   if (tl)  
-    _topLabel->setText("toplabel"); 
+    _topLabel->setText(toplabel); 
 }
 
 


More information about the Kst mailing list