Version: 1.3.0_devel (using KDE 3.4.0, compiled sources) Compiler: gcc version 3.4.3 OS: SunOS (sun4u) release 5.8 I was introducing a new user to the joys of kst, and... the demonstration was not as convincing as I would have liked :-( I have not yet completely figured out the problem, but there are *strange* things happening, apparently linked with copying plots (RMB in layout mode, I have not checked whether Crtl+C/Ctrl+V does the same). I suspect something is really wrong somewhere, as I have even had crashes like: Assertion failed: _geom.left() >= 0 && _geom.top() >= 0 && !_geom.size().isNull(), file kstviewobject.cpp, line 1397 KCrash: crashing... crashRecursionCounter = 2 So, I am going to try and give you hints to reproduce the problem, but I'm not quite sure yet what is wrong... 1) kst -w gyrodata.dat, create the 3 curves in one window 2) display the legend in plot P1 3) create a new window W2 3) layout mode: P1 RMB->copy to W2 4) first problem: the legend is not displayed 5) (that's where you have to be inventive !) play around with the plots, change some settings and contents, save and reload the file and at some point you'll notice bad problems like some plots not being saved/reloaded properly, broken geometries, duplicate plots where there shouldn't be, crashes, etc... Hint: it seems that the key to breaking things is saving/reloading.
SVN commit 523337 by arwalker: CCBUG:124367 Allow legends to be copied with a plot. M +19 -0 kstviewarrow.cpp M +2 -0 kstviewarrow.h M +21 -0 kstviewbox.cpp M +2 -0 kstviewbox.h M +15 -0 kstviewellipse.cpp M +2 -0 kstviewellipse.h M +31 -2 kstviewlabel.cpp M +2 -0 kstviewlabel.h M +31 -0 kstviewlegend.cpp M +2 -0 kstviewlegend.h M +19 -1 kstviewline.cpp M +2 -0 kstviewline.h M +1 -0 kstviewobject.cpp M +18 -0 kstviewpicture.cpp M +2 -0 kstviewpicture.h
Nicolas, would you mind testing for this problem again - you should at least see the legend now. It would help if you could come up with a set of repeatable steps (though I realise that may not be possible).
SVN commit 523354 by arwalker: CCBUG:124367 Add back line M +1 -0 kstviewline.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kstviewline.cpp #523353:523354 @@ -74,6 +74,7 @@ } // always these values + setTransparent(true); _type = "Line"; setMinimumSize(QSize(1, 1)); }
There is some progress here: - I confirm that the legend is copied correctly - I have found repeatable steps that lead to some plots disappearing and that trigger the assertion crash: 1) kst -w gyrodata.dat, load 3 curves in one window 2) Window->New (with default name) 3) F6 + P1->RMB: copy to W2 4) save to debug.kst, exit kst and reload debug.kst: it looks good 5) F6 + P2->RMB: copy to W2 6) save debug.kst, exit and reload debug.kst: the first plot in W1 is missing, as well as the second one in W2 7) in W1, do cleanup layout, default title: CRASH with above assertion failure! (note: after some more testing, the crash is not 100%... I hope you will catch it anyway) I hope you will be able to trace and fix the problems with this scenario...
SVN commit 523647 by arwalker: BUG:124367 Ensure a unique plot name. Nicolas, I believe this should fix the problem you described. Thanks for describing the scenario so cleanly. M +30 -5 kst2dplot.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #523646:523647 @@ -435,11 +435,36 @@ _type = "Plot"; if (name.isEmpty()) { - plotName = KST::suggestPlotName(); + plotName = i18n("Copy-%1").arg(plot.tagName()); } else { plotName = name; } + KstApp *app = KstApp::inst(); + KMdiIterator<KMdiChildView*> *iter; + bool duplicate = true; + static int last = 0; + + // check for unique plot name + while (duplicate) { + duplicate = false; + iter = app->createIterator(); + while (iter->currentItem() && !duplicate) { + KMdiChildView *childview = iter->currentItem(); + KstViewWindow *viewwindow = dynamic_cast<KstViewWindow*>(childview); + if (viewwindow) { + if (viewwindow->view()->findChild(plotName)) { + ++last; + plotName = i18n("Copy%1-%2").arg(last).arg(plot.tagName()); + duplicate = true; + break; + } + } + iter->next(); + } + app->deleteIterator(iter); + } + commonConstructor(plotName, plot._xScaleMode, plot._yScaleMode, @@ -3256,14 +3281,14 @@ void Kst2DPlot::copyObjectQuietly(KstViewObject& parent, const QString& name) const { - QString plotName; - + QString plotName; + if (name.isEmpty()) { - plotName = KST::suggestPlotName(); + plotName = i18n("Copy-%1").arg(tagName()); } else { plotName = name; } - + parent.appendChild(new Kst2DPlot(*this, plotName), true); }
This seems to have solved the problems indeed. Thanks for the fix !