[Kst] [Bug 93593] Y-axes not aligned when printing

Andrew Walker arwalker at sumusltd.com
Fri Dec 10 08:56:05 CET 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=93593        
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2004-12-10 08:56 -------
CVS commit by arwalker: 

Make the axes alignment work for printing and export as well as on-screen.

CCMAIL: 93593-done bugs kde org


  M +7 -8      kst2dplot.cpp   1.308
  M +1 -1      kst2dplot.h   1.128
  M +4 -3      ksttoplevelview.cpp   1.83
  M +1 -1      ksttoplevelview.h   1.49
  M +4 -1      kstviewobject.cpp   1.101
  M +1 -1      kstviewobject.h   1.83


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.307:1.308
 @ -1665,18 +1665,21  @ void Kst2DPlot::genAxisTickLabels(QPaint
 
 
-void Kst2DPlot::internalAlignment(QRect& plotRegion) {
-  _buffer.buffer().resize(size());
-  assert(!_buffer.buffer().isNull());
-  QPainter p(&_buffer.buffer());
+void Kst2DPlot::internalAlignment(KstPaintType type, QPainter& p, QRect& plotRegion) {
+  Q_UNUSED(type);
+
   TickParameters tpx;
   TickParameters tpy;
+  QRect rectWindow;
   double x_min, x_max, y_min, y_max;
   double xleft_bdr_px, xright_bdr_px, ytop_bdr_px, ybot_bdr_px;
   bool offsetX, offsetY;
 
+  rectWindow = p.window();
+  p.setWindow(0, 0, size().width(), size().height());
   updateScale();
   getLScale(x_min, y_min, x_max, y_max);
   setBorders(xleft_bdr_px, xright_bdr_px, ytop_bdr_px, ybot_bdr_px,
              tpx, tpy, p, offsetX, offsetY);
+  p.setWindow(rectWindow);
 
   plotRegion.setLeft( d2i(xleft_bdr_px) );
 @ -1968,8 +1971,4  @ void Kst2DPlot::draw() {
 
 void Kst2DPlot::draw(QPainter &p, KstPaintType type, double resolutionEnhancement) {
-  //
-  // draws to the buffer
-  //
-
   if (_zoomPaused) {
     return;

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.127:1.128
 @ -95,5 +95,5  @ public:
 
   void drawDotAt(QPainter& p, double x, double y, KstBaseCurvePtr curve);
-  void internalAlignment(QRect& plotRegion);
+  void internalAlignment(KstPaintType type, QPainter& p, QRect& plotRegion);
   void addCurve(KstBaseCurvePtr curve);
   void addLabel(KstLabel* label);

--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.82:1.83
 @ -82,6 +82,7  @ void KstTopLevelView::save(QTextStream& 
 void KstTopLevelView::paint(KstPaintType type, QPainter& p) {
   if (type != P_PRINT && type != P_EXPORT) {
-    updateAlignment();
+    updateAlignment(type, p);
   } else {
+    updateAlignment(type, p);
     p.fillRect(geometry(), QBrush(KstSettings::globalSettings()->backgroundColor, SolidPattern));
   }
 @ -96,10 +97,10  @ void KstTopLevelView::resized(const QSiz
 }
 
-void KstTopLevelView::updateAlignment() {
+void KstTopLevelView::updateAlignment(KstPaintType type, QPainter& p) {
   QRect plotRegion;
 
   KST::alignment.reset();  
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-    (*i)->internalAlignment(plotRegion);
+    (*i)->internalAlignment(type, p, plotRegion);
     KST::alignment.setPosition((*i)->geometry(), plotRegion);
   }

--- kdeextragear-2/kst/kst/ksttoplevelview.h  #1.48:1.49
 @ -43,5 +43,5  @ class KstTopLevelView : public KstViewOb
     virtual void paint(KstPaintType type, QPainter& p);
 
-    void updateAlignment();
+    void updateAlignment(KstPaintType type, QPainter& p);
     void paint(KstPaintType type);
 

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.100:1.101
 @ -382,5 +382,8  @ QSize KstViewObject::size() const {
 
 
-void KstViewObject::internalAlignment(QRect& plotRegion) {
+void KstViewObject::internalAlignment(KstPaintType type, QPainter& p, QRect& plotRegion) {
+  Q_UNUSED(type);
+  Q_UNUSED(p);
+
   plotRegion.setLeft(0);
   plotRegion.setRight(0);

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.82:1.83
 @ -81,5 +81,5  @ class KstViewObject : public KstObject {
     virtual void resizeFromAspect(double x, double y, double w, double h);
     virtual QSize size() const;
-    virtual void internalAlignment(QRect& plotRegion);
+    virtual void internalAlignment(KstPaintType type, QPainter& p, QRect& plotRegion);
     virtual QPoint position() const;
     virtual const QRect& geometry() const;



More information about the Kst mailing list