[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Sat Dec 11 02:13:05 CET 2004


CVS commit by arwalker: 

Scale symbol size with line width, so we don't lose the symbols when the line width is increased.


  M +2 -2      curveappearancewidget.ui.h   1.19
  M +2 -2      kst2dplot.cpp   1.311
  M +17 -7     kstpoint.cpp   1.9
  M +1 -1      kstpoint.h   1.8


--- kdeextragear-2/kst/kst/curveappearancewidget.ui.h  #1.18:1.19
@@ -69,5 +69,5 @@ void CurveAppearanceWidget::fillCombo()
     pp.fillRect( pp.window(), QColor("white"));
     tmppoint.setType(ptype);
-    tmppoint.draw( &pp, ppix.width()/2, ppix.height()/2, 600 );
+    tmppoint.draw( &pp, ppix.width()/2, ppix.height()/2, 0, 600 );
     _combo->insertItem(ppix);
   }
@@ -123,5 +123,5 @@ void CurveAppearanceWidget::drawLine()
     p.setPen(pen);
     tmppoint.setType(_combo->currentItem());
-    tmppoint.draw(&p, pix.width()/2, pix.height()/2, 600);
+    tmppoint.draw(&p, pix.width()/2, pix.height()/2, lineWidth(), 600);
   }
 

--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.310:1.311
@@ -5502,5 +5502,5 @@ void Kst2DPlot::plotCurves(QPainter& p,
             point.setY(d2i(m_Y * rY + b_Y));
             if (rgn.contains(point)) {
-              c->Point.draw(&p, point.x(), point.y());
+              c->Point.draw(&p, point.x(), point.y(), c->lineWidth());
               rgn -= QRegion(point.x()-size/2, point.y()-size/2, size, size, QRegion::Ellipse);
             }
@@ -5519,5 +5519,5 @@ void Kst2DPlot::plotCurves(QPainter& p,
             Y1 = m_Y * rY + b_Y;
             if (X1 >= Lx && X1 <= Hx && Y1 >= Ly && Y1 <= Hy) {
-              c->Point.draw(&p, d2i(X1), d2i(Y1));
+              c->Point.draw(&p, d2i(X1), d2i(Y1), c->lineWidth());
             }
           }

--- kdeextragear-2/kst/kst/kstpoint.cpp  #1.8:1.9
@@ -37,5 +37,5 @@ int KstPoint::type() const {
 }
 
-void KstPoint::draw(QPainter *p, int x, int y, int size) {
+void KstPoint::draw(QPainter *p, int x, int y, int lineSize, int size) {
   int s;
 
@@ -50,4 +50,6 @@ void KstPoint::draw(QPainter *p, int x, 
   }
 
+  s += lineSize;
+  
   switch (Type) {
     case 0:
@@ -68,12 +70,20 @@ void KstPoint::draw(QPainter *p, int x, 
       break;
     case 4:
-      p->drawLine(x-s, y-s, x+s, y-s);
-      p->drawLine(x-s, y-s, x, y+s);
-      p->drawLine(x, y+s, x+s, y-s);
+      {
+        QPointArray pts(3);
+
+        pts.putPoints( 0, 3, x-s, y-s, x, y+s, x+s, y-s );
+        p->setBrush(QBrush::NoBrush);
+        p->drawPolygon(pts);
+      }
       break;
     case 5:
-      p->drawLine(x-s, y+s, x+s, y+s);
-      p->drawLine(x-s, y+s, x, y-s);
-      p->drawLine(x, y-s, x+s, y+s);
+      {
+        QPointArray pts(3);
+
+        pts.putPoints( 0, 3, x-s, y+s, x, y-s, x+s, y+s );
+        p->setBrush(QBrush::NoBrush);
+        p->drawPolygon(pts);
+      }
       break;
     case 6:

--- kdeextragear-2/kst/kst/kstpoint.h  #1.7:1.8
@@ -32,5 +32,5 @@ class KstPoint {
 
     /** draw the point on a painter the scale of the point is based on size */
-    void draw(QPainter *p, int x, int y, int size=-1);
+    void draw(QPainter *p, int x, int y, int lineSize=0, int size=-1);
     /** set the type of the point: arbitrary meaning only */
     void setType(int type);





More information about the Kst mailing list