[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Jan 11 09:29:06 CET 2005


CVS commit by staikos: 

This is a bit of a fix for updating of hidden tabs.  It avoids painting or
drawing tabs that aren't visible.  It may be buggy so feedback is appreciated.
This stuff is very complex.  Updating of data objects that are "hidden" still
happens since we don't really know what is or is not hidden in the update
thread.  It also requires much more complex dependency walking than we are even
capable of doing right now.  I am going to close the bug as fixed and leave the
rest as "LATER" to be part of update redesign.  Reopen if tabs are still being
painted when they shouldn't be, or if this fix breaks things.
BUG: 96764


  M +34 -13    kst.cpp   1.275
  M +10 -4     kstviewwidget.cpp   1.64
  M +3 -1      kstviewwidget.h   1.21


--- kdeextragear-2/kst/kst/kst.cpp  #1.274:1.275
@@ -1406,10 +1406,13 @@ void KstApp::paintAll(KstPaintType pt) {
   t.start();
 #endif
+  if (mdiMode() == KMdi::TabPageMode) {
+    KstViewWindow *view = dynamic_cast<KstViewWindow*>(activeWindow());
+    if (pt == P_DATA) { // what about P_PLOT?  I think it's not needed anyway
   KMdiIterator<KMdiChildView*> *it = createIterator();
   if (it) {
     while (it->currentItem()) {
-      KstViewWindow *pView = dynamic_cast<KstViewWindow*>(it->currentItem());
-      if (pView) {
-        pView->view()->paint(pt);
+          KstViewWindow *v = dynamic_cast<KstViewWindow*>(it->currentItem());
+          if (v && v != view) {
+            v->view()->widget()->nextUpdateDo(pt);
       }
       it->next();
@@ -1417,4 +1420,22 @@ void KstApp::paintAll(KstPaintType pt) {
     deleteIterator(it);
   }
+    }
+
+    if (view) {
+      view->view()->paint(pt);
+    }
+  } else {
+    KMdiIterator<KMdiChildView*> *it = createIterator();
+    if (it) {
+      while (it->currentItem()) {
+        KstViewWindow *view = dynamic_cast<KstViewWindow*>(it->currentItem());
+        if (view) {
+          view->view()->paint(pt);
+        }
+        it->next();
+      }
+      deleteIterator(it);
+    }
+  }
 #ifdef PAINTTIMER
   int x = t.elapsed();
@@ -1424,8 +1445,8 @@ void KstApp::paintAll(KstPaintType pt) {
 
 void KstApp::showPlotDialog() {
-  KMdiChildView *pWindow = activeWindow();
+  KMdiChildView *win = activeWindow();
 
-  if (_plotDialog->isHidden() && pWindow) {
-    _plotDialog->show_I(pWindow->caption(), QString::null);
+  if (win && _plotDialog->isHidden()) {
+    _plotDialog->show_I(win->caption(), QString::null);
   } else {
     _plotDialog->show_I();
@@ -1433,6 +1454,6 @@ void KstApp::showPlotDialog() {
 }
 
-void KstApp::showPlotDialog(const QString& strWindow, const QString& strPlot) {
-  _plotDialog->show_I(strWindow, strPlot);
+void KstApp::showPlotDialog(const QString& window, const QString& plot) {
+  _plotDialog->show_I(window, plot);
 }
 

--- kdeextragear-2/kst/kst/kstviewwidget.cpp  #1.63:1.64
@@ -28,4 +27,5 @@
 KstViewWidget::KstViewWidget(KstTopLevelViewPtr view, QWidget *parent, const char *name, WFlags w)
 : QWidget(parent, name, WStyle_Customize | w), _view(view), _menu(0L) {
+  _nextUpdate = P_PAINT;
   setDragEnabled(true);
   setDropEnabled(true);
@@ -282,5 +282,6 @@ void KstViewWidget::paintEvent(QPaintEve
 #endif
   if (e) {  // Resize/expose/etc triggered by X11
-    _view->paint(P_PAINT);
+    _view->paint(_nextUpdate);
+    _nextUpdate = P_PAINT;
 #ifdef BENCHMARK
     int x = t.elapsed();
@@ -440,4 +441,9 @@ KstTopLevelViewPtr KstViewWidget::viewOb
 }
 
+
+void KstViewWidget::nextUpdateDo(KstPaintType updateType) {
+  _nextUpdate = updateType;
+}
+
 #include "kstviewwidget.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kstviewwidget.h  #1.20:1.21
@@ -39,4 +39,5 @@ class KstViewWidget : public QWidget {
     void paint();
 
+    void nextUpdateDo(KstPaintType updateType);
 
     KstViewObjectPtr findChildFor(const QPoint& pos);
@@ -64,9 +65,10 @@ class KstViewWidget : public QWidget {
   private:
     KstTopLevelViewPtr _view;
-    KstViewObject*     _vo_datamode;
+    KstViewObject *_vo_datamode;
     bool _dropEnabled : 1;
     bool _dragEnabled : 1;
     KPopupMenu *_menu;
     QDragObject *_drag;
+    KstPaintType _nextUpdate;
 };
 




More information about the Kst mailing list