[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Aug 17 20:52:52 CEST 2004


CVS commit by arwalker: 

Ensure that the tie box region is correctly updated after all moves in layout mode. This in turn means ensuring that WinRegion and PlotRegion are updated after all moves.
Fix for 87318.

CCMAIL: 87318-done at bugs.kde.org


  M +34 -11    kst2dplot.cpp   1.226
  M +3 -1      kst2dplot.h   1.92
  M +4 -3      kstviewobject.cpp   1.84
  M +1 -1      kstviewobject.h   1.67


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.225:1.226
@@ -1319,4 +1319,15 @@ void Kst2DPlot::edit() {
 
 
+void Kst2DPlot::move(const QPoint& pos) {
+  QPoint offset = pos - _geom.topLeft();
+
+  PlotRegion.moveBy(offset.x(), offset.y());
+  WinRegion.moveBy(offset.x(), offset.y());
+  PlotAndAxisRegion.moveBy(offset.x(), offset.y());
+
+  KstPlotBase::move(pos);
+}
+
+
 void Kst2DPlot::parentResized() {
   KstPlotBase::parentResized();
@@ -1325,4 +1336,13 @@ void Kst2DPlot::parentResized() {
 
 
+void Kst2DPlot::parentMoved(const QPoint& offset) {
+  PlotRegion.moveBy(offset.x(), offset.y());
+  WinRegion.moveBy(offset.x(), offset.y());
+  PlotAndAxisRegion.moveBy(offset.x(), offset.y());
+
+  KstPlotBase::parentMoved(offset);
+}
+
+
 void Kst2DPlot::resize(const QSize& size) {
   KstPlotBase::resize(size);
@@ -1484,7 +1504,4 @@ void Kst2DPlot::draw(QPainter &p, KstPai
   ytick_px = (YTick / (y_max - y_min)) * ((double)y_px - (ytop_bdr_px + ybot_bdr_px));
 
-  /* return if the plot is too small to draw */
-  if (x_px - xright_bdr_px - xleft_bdr_px >= 10 &&
-      y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10) {      
     QRect RelPlotRegion(d2i(xleft_bdr_px),
                           d2i(ytop_bdr_px),
@@ -1497,4 +1514,11 @@ void Kst2DPlot::draw(QPainter &p, KstPai
     QRect RelWinRegion(0, 0, (int)x_px, (int)y_px);
 
+  if (type != P_PRINT && type != P_EXPORT) {
+    setPixRect(RelPlotRegion, RelWinRegion, RelPlotAndAxisRegion);
+  }
+  
+  /* return if the plot is too small to draw */
+  if (x_px - xright_bdr_px - xleft_bdr_px >= 10 &&
+      y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10) {      
     Lx = (double)xleft_bdr_px + 1;
     Hx = (double)(x_px - xright_bdr_px - 1);
@@ -1506,5 +1530,4 @@ void Kst2DPlot::draw(QPainter &p, KstPai
     b_Y = Hy - m_Y * y_min;
     if (type != P_PRINT && type != P_EXPORT) {
-      setPixRect(RelPlotRegion, RelWinRegion, RelPlotAndAxisRegion);
       _m_X = m_X;
       _m_Y = m_Y;

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.91:1.92
@@ -162,6 +162,8 @@ public:
   void setPixRect(const QRect& RelPlotRegion, const QRect& RelWinRegion, const QRect& RelPlotAndAxisRegion);
 
+  virtual void move(const QPoint&);
   virtual void resize(const QSize&);
   virtual void parentResized();
+  virtual void parentMoved(const QPoint&);
 
   virtual bool mouseHandler() const;

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.83:1.84
@@ -474,8 +474,8 @@ QPoint KstViewObject::position() const {
 
 
-void KstViewObject::parentMoved( ) {
+void KstViewObject::parentMoved(const QPoint& offset) {
   updateFromAspect();
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-    (*i)->parentMoved();
+    (*i)->parentMoved(offset);
   }
 }
@@ -488,5 +489,5 @@ void KstViewObject::move(const QPoint& p
     updateAspectPos( );
     for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-      (*i)->parentMoved( );
+      (*i)->parentMoved(offset);
     }
   }

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.66:1.67
@@ -191,5 +191,5 @@ class KstViewObject : public KstObject {
     virtual void parentResizedForPrint();
     virtual void parentRevertedForPrint();
-    virtual void parentMoved();
+    virtual void parentMoved(const QPoint& offset);
 
     /***********  Actions ************/





More information about the Kst mailing list