[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu Dec 1 01:37:12 CET 2005


SVN commit 484486 by netterfield:

Add fontColor to viewlabels, and activate it in the dialog.



 M  +17 -3     kstviewlabel.cpp  
 M  +6 -1      kstviewlabel.h  


--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #484485:484486
@@ -33,6 +33,7 @@
 #include <kpopupmenu.h>
 #include <knuminput.h>
 #include <kcombobox.h>
+#include <kcolorbutton.h>
 
 #include <qapplication.h>
 #include <qbitmap.h>
@@ -59,6 +60,7 @@
   _justify = justify;
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
+  _fontColor = KstSettings::globalSettings()->foregroundColor;
   _absFontSize = _fontSize+KstSettings::globalSettings()->plotFontSize;
   _layoutActions &= ~(MoveTo | Copy | CopyTo);
   _standardActions |= Delete | Edit;
@@ -150,7 +152,14 @@
   }
 }
 
+void KstViewLabel::setFontColor(QColor color) {
+  _fontColor = color;
+}
 
+QColor KstViewLabel::fontColor() const {
+  return _fontColor;
+}
+
 void KstViewLabel::resize(const QSize& size) {
   KstBorderedViewObject::resize(size);
   if (!_parsed) {
@@ -215,9 +224,9 @@
   _backBuffer.buffer().resize(size());
   _backBuffer.buffer().fill(backgroundColor());
   QPainter p(&_backBuffer.buffer());
-  QPen pen;
+/*  QPen pen;
   pen.setColor(foregroundColor());
-  p.setPen(pen);
+  p.setPen(pen);*/
   drawToPainter(lp, p);
 }
 
@@ -281,6 +290,10 @@
   p.translate(tx, ty);
   p.rotate(_rotation);
 
+  QPen pen;
+  pen.setColor(fontColor());
+  p.setPen(pen);
+
   rc.xStart = rc.x;
 #ifdef BENCHMARK
   QTime t;
@@ -597,6 +610,7 @@
     widget->_fontSize->setValue(int(fontSize()));
     widget->_horizontal->setCurrentItem(horizJustifyWrap());
     widget->_vertical->setCurrentItem(vertJustifyWrap());
+    widget->_fontColor->setColor(fontColor());
 
     widget->_transparent->setChecked(transparent());
     widget->_autoResize->setChecked(autoResize());
@@ -624,7 +638,7 @@
   setFontSize(widget->_fontSize->value());
   setHorizJustifyWrap(widget->_horizontal->currentItem());
   setVertJustifyWrap(widget->_vertical->currentItem());
-
+  setFontColor(widget->_fontColor->color());
   setTransparent(widget->_transparent->isChecked());
   setAutoResize(widget->_autoResize->isChecked());
   setBorderWidth(widget->_border->value());
--- trunk/extragear/graphics/kst/kst/kstviewlabel.h #484485:484486
@@ -33,6 +33,7 @@
   Q_PROPERTY(QString font READ fontName WRITE setFontName)
   Q_PROPERTY(int dataPrecision READ dataPrecision WRITE setDataPrecision)
   Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize)
+  Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColor)
   Q_PROPERTY(bool transparent READ transparent WRITE setTransparent)
   Q_PROPERTY(int horizontalJustification READ horizJustifyWrap WRITE setHorizJustifyWrap)
   Q_PROPERTY(int verticalJustification READ vertJustifyWrap WRITE setVertJustifyWrap)
@@ -50,7 +51,7 @@
 
     void setJustification(KstLJustifyType Justify);
     KstLJustifyType justification() const { return _justify; }
-    
+
     // wraps for Q_PROPERTIES
     int horizJustifyWrap() const;
     // 0 = left, 1 = right, 2 = centre
@@ -74,6 +75,9 @@
     void setFontSize(int size);
     int fontSize() const;
 
+    void setFontColor(QColor color);
+    QColor fontColor() const;
+
     virtual void save(QTextStream& ts, const QString& indent = QString::null);
 
     void setDoScalarReplacement(bool in_do);
@@ -121,6 +125,7 @@
     bool _autoResize : 1;
     int _absFontSize; // points
     int _fontSize; // size relative to reference size.....
+    QColor _fontColor;
     int _dataPrecision : 6;
     int _textWidth, _textHeight, _ascent;
     KstLJustifyType _justify;


More information about the Kst mailing list