Summary: | Adding a plot in Z mode messes leads to meyhem. | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Netterfield <netterfield> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.1.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Netterfield
2005-05-22 01:03:39 UTC
I have a patch for this that unmaximizes, but there are two problems. 1) It makes append/insert/prepend child O(n) instead of O(1) (or doubles the time in the case of "insert"). 2) The maximized plot doesn't get its coordinates updated properly when it is restored so it appears as crosshatches. I'll commit irrespective of 1) when I fix this since insertion isn't a limiting factor really, and the lists are small. It's still not ideal though. SVN commit 417073 by staikos: Well, this mostly fixes adding new plots when in maximized mode (and renames zoom->maximized as we did in public interfaces). Unfortunately the maximized plot has an invalid top border and I haven't been able to figure out why yet. Debug output is left there to demonstrate the problem. CCBUG: 106086 M +1 -0 trunk/extragear/graphics/kst/kst/kst2dplot.cpp M +2 -2 trunk/extragear/graphics/kst/kst/kstiface_impl.cpp M +1 -1 trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp M +28 -2 trunk/extragear/graphics/kst/kst/kstviewobject.cpp M +2 -1 trunk/extragear/graphics/kst/kst/kstviewobject.h --- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #417072:417073 @@ -2291,6 +2291,7 @@ } // only attempt to draw if plot is big enough + kdDebug () << tagName() << ": x_px = " << x_px << " xright_bdr_px = " << xright_bdr_px << " xleft_bdr_px = " << xleft_bdr_px << " y_px = " << y_px << " ybot_bdr_px = " << ybot_bdr_px << " ytop_bdr_px = " << ytop_bdr_px << endl; if (x_px - xright_bdr_px - xleft_bdr_px >= 10.0 && y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10.0) { Lx = RelPlotRegion.left(); --- trunk/extragear/graphics/kst/kst/kstiface_impl.cpp #417072:417073 @@ -1061,7 +1061,7 @@ Kst2DPlotList::Iterator plot_iter = plotlist.findTag(plotName); if (plot_iter != plotlist.end()) { app->deleteIterator(iter); - (*plot_iter)->zoom(true); + (*plot_iter)->setMaximized(true); return true; } } @@ -1082,7 +1082,7 @@ Kst2DPlotList::Iterator plot_iter = plotlist.findTag(plotName); if (plot_iter != plotlist.end()) { app->deleteIterator(iter); - (*plot_iter)->zoom(false); + (*plot_iter)->setMaximized(false); return true; } } --- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #417072:417073 @@ -203,7 +203,7 @@ clearFocus(); paint(P_PAINT); } else if (_mode == DisplayMode && v != DisplayMode) { - recursively<bool>(&KstViewObject::zoom, false); + recursively<bool>(&KstViewObject::setMaximized, false); } _mode = v; --- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #417072:417073 @@ -299,6 +299,13 @@ void KstViewObject::appendChild(KstViewObjectPtr obj, bool keepAspect) { obj->_parent = this; _children.append(obj); + + for (KstViewObjectList::Iterator i = children().begin(); i != children().end(); ++i) { + if ((*i)->maximized()) { + (*i)->setMaximized(false); + } + } + if (keepAspect) { obj->updateFromAspect(); } else { @@ -310,6 +317,13 @@ void KstViewObject::prependChild(KstViewObjectPtr obj, bool keepAspect) { obj->_parent = this; _children.prepend(obj); + + for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) { + if ((*i)->maximized()) { + (*i)->setMaximized(false); + } + } + if (keepAspect) { obj->updateFromAspect(); } else { @@ -339,6 +353,13 @@ _children.prepend(obj); } obj->_parent = this; + + for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) { + if ((*i)->maximized()) { + (*i)->setMaximized(false); + } + } + if (keepAspect) { obj->updateFromAspect(); } else { @@ -1043,8 +1064,13 @@ } -void KstViewObject::zoom(bool zoom) { - if (_maximized != zoom) { +bool KstViewObject::maximized() const { + return _maximized; +} + + +void KstViewObject::setMaximized(bool maximized) { + if (_maximized != maximized) { zoomToggle(); } } --- trunk/extragear/graphics/kst/kst/kstviewobject.h #417072:417073 @@ -149,7 +149,8 @@ virtual void drawFocusRect(QPainter& p); virtual void drawSelectRect(QPainter& p); - virtual void zoom(bool zoom); + virtual void setMaximized(bool maximized); + bool maximized() const; virtual bool isSelected() const; virtual void setSelected(bool selected); void selectAll(); The problem is that label size is miscalculated. It uses the old size for axis labels. This will be fixed implicitly with the new label code and is unrelated to the original bug. |