Summary: | copying plots in layout mode leads to chaos | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Nicolas Brisset <nicolas.brisset> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Nicolas Brisset
2006-03-27 16:38:58 UTC
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 ! |