[Kst] extragear/graphics/kst

George Staikos staikos at kde.org
Wed Nov 30 22:01:53 CET 2005


SVN commit 484453 by staikos:

fix all the ROP stuff by letting each object decide.  the state is stored in
the KstPainter


 M  +1 -2      devel-docs/PlotUIFixes  
 M  +3 -0      kst/kstborderedviewobject.cpp  
 M  +11 -1     kst/kstpainter.cpp  
 M  +4 -0      kst/kstpainter.h  
 M  +3 -0      kst/kstviewarrow.cpp  
 M  +5 -0      kst/kstviewbox.cpp  
 M  +3 -0      kst/kstviewline.cpp  
 M  +3 -1      kst/kstviewobject.cpp  
 M  +3 -2      kst/kstviewpicture.cpp  


--- trunk/extragear/graphics/kst/devel-docs/PlotUIFixes #484452:484453
@@ -45,14 +45,13 @@
  relative to the axis (imagine an arrow pointing to a feature).
 
 More bugs:
-- Transparency of images is broken
+- Keep doing object->edit, get more and more dialogs.
 - Transparency of labels is quirky (holes are filled with background)
 - Lines and arrows are clipped
 - Selection points are not accessible on ellipses if they overlap another
   object, even if the the ellipse is above the other object.
 - Selection points are always clipped even if the object lies below.
 - Flicker!!
-- No Edit... menu entry on object context menus in layout mode
 - Dragging a view object and dropping it on the desktop crashes Kst
 - The mouse handler stuff needs to be genericized - it's too difficult to add
   new objects.
--- trunk/extragear/graphics/kst/kst/kstborderedviewobject.cpp #484452:484453
@@ -71,6 +71,9 @@
 
 
 void KstBorderedViewObject::paint(KstPainter& p, const QRegion& bounds) {
+  if (p.makingMask()) {
+    p.setRasterOp(Qt::SetROP);
+  }
  // if (_borderWidth > 0 && !_focus && !_selected) {
   if (_borderWidth > 0) {
     QRect r;
--- trunk/extragear/graphics/kst/kst/kstpainter.cpp #484452:484453
@@ -18,7 +18,7 @@
 #include "kstpainter.h"
 
 KstPainter::KstPainter(PaintType t)
-: QPainter(), _type(t), _drawInlineUI(false) {
+: QPainter(), _type(t), _drawInlineUI(false), _makingMask(false) {
 }
 
 
@@ -45,4 +45,14 @@
   _drawInlineUI = draw;
 }
 
+
+bool KstPainter::makingMask() const {
+  return _makingMask;
+}
+
+
+void KstPainter::setMakingMask(bool making) {
+  _makingMask = making;
+}
+
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstpainter.h #484452:484453
@@ -45,9 +45,13 @@
 
     inline QRegion& uiMask() { return _uiMask; }
 
+    bool makingMask() const;
+    void setMakingMask(bool making);
+
   private:
     PaintType _type;
     bool _drawInlineUI;
+    bool _makingMask;
     QRegion _uiMask;
 };
 
--- trunk/extragear/graphics/kst/kst/kstviewarrow.cpp #484452:484453
@@ -75,6 +75,9 @@
 
 
 void KstViewArrow::paint(KstPainter& p, const QRegion& bounds) {
+  if (p.makingMask()) {
+    p.setRasterOp(Qt::SetROP);
+  }
   if (hasArrow()) {
     int w = width();
     QPen pen(_foregroundColor, w);
--- trunk/extragear/graphics/kst/kst/kstviewbox.cpp #484452:484453
@@ -63,11 +63,16 @@
 
 
 void KstViewBox::paint(KstPainter& p, const QRegion& bounds) {
+  if (p.makingMask()) {
+    p.setRasterOp(Qt::SetROP);
+  }
   QPen pen(borderColor(), borderWidth());
   pen.setJoinStyle(_cornerStyle);
+#if 0
   if (borderWidth() == 0) {
     pen.setStyle(Qt::NoPen);
   }
+#endif
   p.setPen(pen);
   if (_transparentFill) {
     p.setBrush(Qt::NoBrush);  
--- trunk/extragear/graphics/kst/kst/kstviewline.cpp #484452:484453
@@ -60,6 +60,9 @@
 
 
 void KstViewLine::paint(KstPainter& p, const QRegion& bounds) {
+  if (p.makingMask()) {
+    p.setRasterOp(Qt::SetROP);
+  }
   // figure out which direction to draw the line
   QPen pen(_foregroundColor, _width);
   pen.setCapStyle(_capStyle);
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #484452:484453
@@ -1503,8 +1503,8 @@
       QBitmap bm(_geom.bottomRight().x(), _geom.bottomRight().y(), true);
       if (!bm.isNull()) {
         KstPainter p;
+        p.setMakingMask(true);
         p.begin(&bm);
-        p.setRasterOp(Qt::OrROP);
         p.setViewXForm(true);
         paint(p, QRegion());
         p.flush();
@@ -1643,11 +1643,13 @@
 
 
 bool KstViewObject::fillConfigWidget(QWidget *w) const {
+  Q_UNUSED(w)
   return false;
 }
 
 
 bool KstViewObject::readConfigWidget(QWidget *w) {
+  Q_UNUSED(w)
   return false;
 }
 
--- trunk/extragear/graphics/kst/kst/kstviewpicture.cpp #484452:484453
@@ -86,7 +86,8 @@
       }
     }
     if (!_iCache.isNull()) {
-      if (p.rasterOp() == Qt::OrROP) { // HACK!!  we look for depth=1
+      if (p.makingMask()) {
+        p.setRasterOp(Qt::OrROP);
         // which indicates clipping / BW mode
         if (_iCache.hasAlphaBuffer()) {
           assert(_iCache.hasAlphaBuffer());
@@ -100,7 +101,7 @@
       }
     }
   }
-  //KstBorderedViewObject::paint(p, bounds);
+  KstBorderedViewObject::paint(p, bounds);
 }
 
 


More information about the Kst mailing list