[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Wed Dec 7 16:14:35 CET 2005


SVN commit 486325 by staikos:

I give up with trying to make objects view-independent at this point.  _parent
is used all over and the design depends on it now.


 M  +0 -1      kst2dplot.cpp  
 M  +7 -10     kstplotgroup.cpp  
 M  +1 -1      ksttoplevelview.cpp  
 M  +8 -15     kstviewobject.cpp  
 M  +1 -8      kstviewobject.h  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #486324:486325
@@ -2263,7 +2263,6 @@
       _mouse.lastGuideline = KstApp::inst()->activeView()->widget()->mapFromGlobal(QCursor::pos());
     }
   }
-
   KstPlotBase::paint(p, bounds);
 }
 
--- trunk/extragear/graphics/kst/kst/kstplotgroup.cpp #486324:486325
@@ -86,11 +86,11 @@
 
 
 void KstPlotGroup::copyObject() {
-  KstApp::inst()->document()->setModified();
   if (_parent) {
+    KstApp::inst()->document()->setModified();
     _parent->appendChild(new KstPlotGroup(*this), true);
+    QTimer::singleShot(0, KstApp::inst(), SLOT(updateDialogs()));
   }
-  QTimer::singleShot(0, KstApp::inst(), SLOT(updateDialogs()));
 }
 
 
@@ -104,20 +104,18 @@
 bool KstPlotGroup::removeChild(KstViewObjectPtr obj, bool recursive) {
   if (KstViewObject::removeChild(obj, recursive)) {
     if (_children.count() > 1) {
-      QRect gg = _children.first()->geometry();
-      for (KstViewObjectList::Iterator it = _children.begin(); it != _children.end(); ++it) {
+      QRect gg; // = _children.first()->geometry();
+      for (KstViewObjectList::ConstIterator it = _children.begin(); it != _children.end(); ++it) {
         gg |= (*it)->geometry();
       }
 
       _geom = gg;
       updateAspect();
-      for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+      for (KstViewObjectList::ConstIterator i = _children.begin(); i != _children.end(); ++i) {
         updateAspect();
       }
-    } else {
-      if (_parent) { // can be false if we are being deleted already
-        flatten();
-      }
+    } else if (_parent) { // can be false if we are being deleted already
+      flatten();
     }
 
     return true;
@@ -129,7 +127,6 @@
 
 void KstPlotGroup::flatten() {
   assert(_parent);
-  // FIXME: remove dependency on _parent
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     (*i)->setSelected(false);
     (*i)->setFocus(false);
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #486324:486325
@@ -1472,7 +1472,7 @@
   _mouseGrabber = 0L;
   _mouseGrabbed = false;
   _selectionList.clear();
-  clearChildren(); // FIXME: remove this once we get rid of _parent
+  clearChildren();
   if (_w) {
     _w->release();
   }
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #486324:486325
@@ -1118,8 +1118,6 @@
 
 
 void KstViewObject::raiseToTop() {
-  // FIXME: eliminate _parent!!
-  KstApp::inst()->document()->setModified();
   if (_parent) {
     KstViewObjectPtr t = this;
     KstViewObjectList::Iterator it = _parent->_children.find(t);
@@ -1127,15 +1125,14 @@
     if (it != _parent->_children.end()) {
       _parent->_children.remove(it);
       _parent->_children.append(t);
+      KstApp::inst()->document()->setModified();
+      setDirty();
     }
   }
-  setDirty();
 }
 
 
 void KstViewObject::lowerToBottom() {
-  // FIXME: eliminate _parent!!
-  KstApp::inst()->document()->setModified();
   if (_parent) {
     KstViewObjectPtr t = this;
     KstViewObjectList::Iterator it = _parent->_children.find(t);
@@ -1143,15 +1140,14 @@
     if (it != _parent->_children.end()) {
       _parent->_children.remove(it);
       _parent->_children.prepend(t);
+      KstApp::inst()->document()->setModified();
+      setDirty();
     }
   }
-  setDirty();
 }
 
 
 void KstViewObject::raise() {
-  // FIXME: eliminate _parent!!
-  KstApp::inst()->document()->setModified();
   if (_parent) {
     KstViewObjectPtr t = this;
     KstViewObjectList::Iterator it = _parent->_children.find(t);
@@ -1164,15 +1160,14 @@
       } else {
         _parent->_children.append(t);
       }
+      KstApp::inst()->document()->setModified();
+      setDirty();
     }
   }
-  setDirty();
 }
 
 
 void KstViewObject::lower() {
-  // FIXME: eliminate _parent!!
-  KstApp::inst()->document()->setModified();
   if (_parent) {
     KstViewObjectPtr t = this;
     KstViewObjectList::Iterator it = _parent->_children.find(t);
@@ -1185,9 +1180,10 @@
       } else {
         _parent->_children.prepend(t);
       }
+      KstApp::inst()->document()->setModified();
+      setDirty();
     }
   }
-  setDirty();
 }
 
 
@@ -1230,7 +1226,6 @@
 
 
 void KstViewObject::updateFromAspect() {
-  // FIXME: eliminate _parent!!
   setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
   if (_parent) {
     const QRect geom(_parent->geometry());
@@ -1248,7 +1243,6 @@
 
 
 void KstViewObject::updateAspectPos() {
-  // FIXME: eliminate _parent!!
   if (_parent) {
     const QRect geom(_parent->geometry());
     _aspect.x = double(geometry().left() - geom.left()) / double(geom.width());
@@ -1261,7 +1255,6 @@
 
 
 void KstViewObject::updateAspectSize() {
-  // FIXME: eliminate _parent!!
   if (_parent) {
     const QRect geom(_parent->geometry());
     _aspect.w = double(geometry().width()) / double(geom.width());
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #486324:486325
@@ -292,13 +292,7 @@
     bool _container : 1;
     int _columns : 6; // "64 columns ought to be enough for anyone"
     QGuardedPtr<KstViewObject> _topObjectForMenu;
-    KstViewObject *_parent; // danger!!
-    //KstViewObjectPtr _parent; // FIXME: this is bad and should be removed ASAP
-                              //        It was introduced as a temporary hack
-                              //        but is no longer needed as events now
-                              //        pass the view pointer along.  Also use
-                              //        of this member indicates a bug since
-                              //        objects can have multiple parents.
+    QGuardedPtr<KstViewObject> _parent; // danger!!
     Q_UINT32 _standardActions, _layoutActions;
     KstAspectRatio _aspect;
     KstAspectRatio _aspectOldZoomedObject;
@@ -308,7 +302,6 @@
     QMap<int, QString> _moveToMap;
     QMap<int, QString> _copyToMap;
     QSize _minimumSize;
-
 };
 
 


More information about the Kst mailing list