Bug 87318 - Tie box does not follow plot in layout mode
Summary: Tie box does not follow plot in layout mode
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Rick Chern
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-16 23:40 UTC by Rick Chern
Modified: 2004-08-17 20:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Chern 2004-08-16 23:40:46 UTC
Version:           1.0.0-devel (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.3.2 20031022 
OS:                Linux

When in data mode, the tie box sometimes does not follow the plot

How to reproduce
- start kst
- create 1 plot
- enter layout mode
- resize the plot to about 1/4 the size of the window
- now move the plot around

The tie box seems to stay stationary, outside of the plot.  Switching to mouse zoom mode does not seem to allow zooming using the mouse.  Also, the scroll wheel is not functional.

Expected behaviour:
the tie box follows the plot, and switching to mouse zoom mode works after being in layout mode.
Comment 1 Rick Chern 2004-08-16 23:45:29 UTC
The first sentence should say "layout mode", not "data mode"
Comment 2 Andrew Walker 2004-08-17 20:52:57 UTC
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@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 ************/