Bug 92603 - Order of plots in a group gets mixed up after a maximiZe.
Summary: Order of plots in a group gets mixed up after a maximiZe.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: view objects (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: Andrew Walker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-02 20:53 UTC by Netterfield
Modified: 2004-11-05 18:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2004-11-02 20:53:15 UTC
Version:           1.0.0_pre1 (using KDE 3.3.0, Gentoo)
Compiler:          gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.8-gentoo-r3

How to reproduce:
-Create a window with several plots.
-Make one plot much smaller and put it inside a bigger one
-Group them.
-'Z' to maximize in the large plot of the group.  
-'Z' to unmaximize.
The smaller embedded plot is now behind the large one and can not be seen.  

Expected behavior:
-the appearance of the plots should be the same after max/unmax as before.
Comment 1 Andrew Walker 2004-11-05 18:02:54 UTC
CVS commit by arwalker: 

Don't bring the maximized plot to the top of the z-order. Instead check which plots are maximized when painting.

CCMAIL: 92603-done@bugs.kde.org


  M +10 -3     kst.cpp   1.256
  M +38 -15    kstviewobject.cpp   1.98
  M +1 -1      kstviewobject.h   1.81


--- kdeextragear-2/kst/kst/kst.cpp  #1.255:1.256
@@ -1283,7 +1283,14 @@ void KstApp::toggleDataMode() {
 
 void KstApp::toggleMouseMode() {
-  KstTopLevelViewPtr pView = activeView();
+  KMdiIterator<KMdiChildView*> *it = createIterator();
+  if (it) {
+    while (it->currentItem()) {
+      KstViewWindow *pView = dynamic_cast<KstViewWindow*>(it->currentItem());
   if (pView) {
-    pView->setViewMode(LayoutAction->isChecked() ? KstTopLevelView::LayoutMode : KstTopLevelView::DisplayMode);
+        pView->view()->setViewMode(LayoutAction->isChecked() ? KstTopLevelView::LayoutMode : KstTopLevelView::DisplayMode);
+      }
+      it->next();
+    }
+    deleteIterator(it);
   }
 }

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.97:1.98
@@ -192,5 +192,18 @@ void KstViewObject::paint(KstPaintType t
   bool hadClipping = p.hasClipping();
   QRegion oldRegion = p.clipRegion();
+  bool maximized = false;
+
+  //
+  // handle the case where we have maximized plots
+  //
+  for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+    if ((*i)->_maximized) {
+      (*i)->paint(type, p);
+      maximized = true;
+      break;
+    }
+  }
 
+  if (!maximized) {
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     // Compute the clip reg - this can't be stored if we want to keep the code
@@ -204,4 +217,8 @@ void KstViewObject::paint(KstPaintType t
     p.setClipRegion(clipRegion);
     (*i)->paint(type, p);
+      if ((*i)->_maximized) {
+        break;
+      }
+    }
   }
 
@@ -564,6 +581,8 @@ KstViewObjectPtr KstViewObject::findChil
 
 KstViewObjectPtr KstViewObject::findChild(const QPoint& pos) {
+  KstViewObjectPtr obj;
+
   if (!_geom.contains(pos) || _children.isEmpty()) {
-    return KstViewObjectPtr();
+    return obj;
   }
 
@@ -571,5 +590,10 @@ KstViewObjectPtr KstViewObject::findChil
   for (--i; ; --i) {
     if (QRect((*i)->position(), (*i)->size()).contains(pos)) {
-      return *i;
+      if (obj == 0L || (*i)->_maximized) {
+        obj = *i;
+        if ((*i)->_maximized) {
+          break;
+        }
+      }
     }
     if (i == _children.begin()) {
@@ -578,5 +602,5 @@ KstViewObjectPtr KstViewObject::findChil
   }
 
-  return KstViewObjectPtr();
+  return obj;
 }
 
@@ -911,5 +935,4 @@ void KstViewObject::zoomToggle() {
     }
     resizeFromAspect(0.0, 0.0, 1.0, 1.0);
-    raiseToTop();
     _prevOnGrid = onGrid();
     setOnGrid(false);