[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Tue Sep 13 20:59:01 CEST 2005


SVN commit 460416 by staikos:

- remove  x = new Foo; if (x)
- fix formatting
- fix flicker when escape is hit in layout mode
      -> there is also a bug here which was not tracked yet
- use a const iterator where possible


 M  +33 -34    ksttoplevelview.cpp  


--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #460415:460416
@@ -1407,42 +1407,41 @@
 
 void KstTopLevelView::groupSelection() {
   KstPlotGroupPtr pg = new KstPlotGroup;
-  KstViewObjectList::Iterator it;
   QRect gg = _selectionList.first()->geometry();
 
-  if (pg) {
-    // First build the container
-    for (it = _selectionList.begin(); it != _selectionList.end(); ++it) {
-      gg |= (*it)->geometry();
-    }
+  // First build the container
+  for (KstViewObjectList::ConstIterator it = _selectionList.begin(); it != _selectionList.end(); ++it) {
+    gg |= (*it)->geometry();
+  }
 
-    pg->move(gg.topLeft());
-    pg->resize(gg.size());
+  pg->move(gg.topLeft());
+  pg->resize(gg.size());
 
-    // Then add the items
-    for (it = _selectionList.begin(); it != _selectionList.end(); ++it) {
-      (*it)->setSelected(false);
-      (*it)->setFocus(false);
-      (*it)->detach();
-      pg->appendChild(*it);
-    }
+  // Then add the items
+  for (KstViewObjectList::Iterator it = _selectionList.begin(); it != _selectionList.end(); ++it) {
+    (*it)->setSelected(false);
+    (*it)->setFocus(false);
+    (*it)->detach();
+    pg->appendChild(*it);
+  }
 
-    if (!pg->children().isEmpty()) {
-      appendChild(pg.data());
-    }
-
-    KstApp::inst()->document()->setModified();
-    paint(P_PAINT);
+  if (!pg->children().isEmpty()) {
+    appendChild(pg.data());
   }
+
+  KstApp::inst()->document()->setModified();
+  paint(P_PAINT);
 }
 
 
 void KstTopLevelView::cancelMouseOperations() {
   if (_mode == LayoutMode) {
     clearFocus();
+    if (_pressTarget || _prevBand.isValid()) {
+      paint(P_PAINT);
+    }
     //_pressTarget = 0L;
     _prevBand = QRect(-1, -1, 0, 0);
-    paint(P_PAINT);
     return;
   }
   
@@ -1489,24 +1488,24 @@
   return _w;
 }
 
-void KstTopLevelView::cleanupDefault()
-{
+
+void KstTopLevelView::cleanupDefault() {
   // roughly layout in a square
   cleanup();
 }
 
-void KstTopLevelView::cleanupCustom()
-{
+
+void KstTopLevelView::cleanupCustom() {
   bool ok = false;
 #if KDE_VERSION >= KDE_MAKE_VERSION(3,3,0)
-  int numCols = KInputDialog::getInteger (i18n("Number of Columns"), 
-                                          i18n("Select number of columns:"), 
-                                          (int)sqrt(_children.count()), 
-                                          1, 
-                                          _children.count(), 
-                                          1, 
-                                          &ok, 
-                                          0L);
+  int numCols = KInputDialog::getInteger(i18n("Number of Columns"), 
+                                         i18n("Select number of columns:"), 
+                                         int(sqrt(_children.count())), 
+                                         1, 
+                                         _children.count(), 
+                                         1, 
+                                         &ok, 
+                                         0L);
   if (ok) {
     cleanup(numCols);
   } 


More information about the Kst mailing list