[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Fri Jul 2 21:36:26 CEST 2004


CVS commit by netterfield: 

Printing seems to work now....
But exporting to graphics is probably broken...


  M +13 -5     kst2dplot.cpp   1.128
  M +1 -1      kst2dplot.h   1.55


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.127:1.128
@@ -906,7 +906,5 @@ void Kst2DPlot::paint(KstPaintType type,
     p.setViewport(geometry().left(), geometry().top(),
                   geometry().width(), geometry().height());
-    // need to now resize, and reset the window
-    p.setWindow(0, 0, 5*geometry().width(), 5*geometry().height());
-    draw(p);
+    draw(p, 5);
     p.setWindow(window_hold);
     p.setViewport(viewport_hold);
@@ -961,5 +959,5 @@ void Kst2DPlot::draw() {
 }
 
-void Kst2DPlot::draw(QPainter &p) {
+void Kst2DPlot::draw(QPainter &p, int resolutionEnhancement) {
 /* Draws to the buffer */
 
@@ -968,5 +966,5 @@ void Kst2DPlot::draw(QPainter &p) {
   }
 
-  double in_xleft_bdr_px = KST::alignment.x(p.window().size());
+  double in_xleft_bdr_px = resolutionEnhancement * KST::alignment.x(p.window().size());
 
   double XTick, YTick, Xorg, Yorg; // Tick interval and position
@@ -997,4 +995,9 @@ void Kst2DPlot::draw(QPainter &p) {
   bool overlap, nopoint;
 
+  QRect old_window = p.window();
+
+  p.setWindow(0, 0, p.viewport().width() * resolutionEnhancement,
+              p.viewport().height() * resolutionEnhancement);
+
   setpixrect();
   updateScale();
@@ -1035,8 +1038,10 @@ void Kst2DPlot::draw(QPainter &p) {
   /* return if the plot is too small to draw */
   if (x_px - xright_bdr_px - xleft_bdr_px < 10) {
+    p.setWindow(old_window);
     return;
   }
 
   if (y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px < 10) {
+    p.setWindow(old_window);
     return;
   }
@@ -1509,4 +1514,7 @@ void Kst2DPlot::draw(QPainter &p) {
 
   p.flush();
+
+  p.setWindow(old_window);
+
 }
 

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.54:1.55
@@ -195,5 +195,5 @@ public slots:
   virtual void edit();
   void draw(); // draw into back buffer
-  void draw(QPainter &p); // This actually does the drawing
+  void draw(QPainter &p, int resolutionEnhancement = 1); // This actually does the drawing
   virtual void paint(KstPaintType type, QPainter& p);
   void editCurve(int id);





More information about the Kst mailing list