[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Thu Jul 24 19:42:51 CEST 2008
SVN commit 837436 by fenton:
Add Shared Axis updating on item move.
Remove triggering of invalid zoom's.
Add Shared Axis updating on non-tied zooms.
M +22 -10 plotitem.cpp
M +33 -1 viewgridlayout.cpp
M +1 -0 viewgridlayout.h
M +4 -0 viewitem.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #837435:837436
@@ -1796,11 +1796,13 @@
void PlotItem::zoomFixedExpression(const QRectF &projection) {
#if DEBUG_ZOOM
- qDebug() << "zoomFixedExpression" << endl;
+ qDebug() << "zoomFixedExpression" << projection << "current" << projectionRect();
#endif
- ZoomCommand *cmd = new ZoomFixedExpressionCommand(this, projection);
- _undoStack->push(cmd);
- cmd->redo();
+ if (projection.isValid()) {
+ ZoomCommand *cmd = new ZoomFixedExpressionCommand(this, projection);
+ _undoStack->push(cmd);
+ cmd->redo();
+ }
}
@@ -1808,9 +1810,11 @@
#if DEBUG_ZOOM
qDebug() << "zoomXRange" << endl;
#endif
- ZoomCommand *cmd = new ZoomXRangeCommand(this, projection);
- _undoStack->push(cmd);
- cmd->redo();
+ if (projection.isValid()) {
+ ZoomCommand *cmd = new ZoomXRangeCommand(this, projection);
+ _undoStack->push(cmd);
+ cmd->redo();
+ }
}
@@ -1818,9 +1822,11 @@
#if DEBUG_ZOOM
qDebug() << "zoomYRange" << endl;
#endif
- ZoomCommand *cmd = new ZoomYRangeCommand(this, projection);
- _undoStack->push(cmd);
- cmd->redo();
+ if (projection.isValid()) {
+ ZoomCommand *cmd = new ZoomYRangeCommand(this, projection);
+ _undoStack->push(cmd);
+ cmd->redo();
+ }
}
@@ -2274,6 +2280,12 @@
foreach (ZoomState state, _originalStates) {
applyZoomTo(state.item);
}
+
+ if (PlotItem *plotItem = qobject_cast<PlotItem*>(_item)) {
+ if (!plotItem->isTiedZoom()) {
+ ViewGridLayout::resetSharedPlots(plotItem);
+ }
+ }
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewgridlayout.cpp #837435:837436
@@ -147,10 +147,42 @@
}
+void ViewGridLayout::resetSharedPlots(ViewItem *item) {
+ if (PlotItem *plotItem = qobject_cast<PlotItem*>(item)) {
+ } else {
+ return;
+ }
+
+ QList<QGraphicsItem*> list;
+ if (item->parentItem()) {
+ list = item->parentItem()->QGraphicsItem::children();
+ foreach (QGraphicsItem *graphicsItem, list) {
+ if (PlotItem *plotItem = qgraphicsitem_cast<PlotItem*>(graphicsItem)) {
+ plotItem->setLabelsVisible(true);
+ plotItem->update();
+ }
+ }
+ } else {
+ if (item->parentView()) {
+ QList<QGraphicsItem*> list = item->parentView()->items();
+ foreach (QGraphicsItem *item, list) {
+ ViewItem *viewItem = qgraphicsitem_cast<ViewItem*>(item);
+ if (!viewItem || viewItem->parentItem() || !viewItem->isVisible())
+ continue;
+ if (PlotItem *plotItem = qobject_cast<PlotItem*>(viewItem)) {
+ plotItem->setLabelsVisible(true);
+ }
+ }
+ }
+ }
+}
+
+
void ViewGridLayout::resetSharedAxis() {
foreach (LayoutItem item, _items) {
- if (PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem))
+ if (PlotItem *plotItem = qobject_cast<PlotItem*>(item.viewItem)) {
plotItem->setLabelsVisible(true);
+ }
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewgridlayout.h #837435:837436
@@ -53,6 +53,7 @@
bool isEnabled() const;
void setEnabled(bool enabled);
+ static void resetSharedPlots(ViewItem *item);
public Q_SLOTS:
void reset();
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #837435:837436
@@ -1700,18 +1700,22 @@
new MoveCommand(this, _originalPosition, pos());
maybeReparent();
+ ViewGridLayout::resetSharedPlots(this);
} else if (oldMode == View::Resize && _originalRect != rect()) {
new ResizeCommand(this, _originalRect, rect());
maybeReparent();
+ ViewGridLayout::resetSharedPlots(this);
} else if (oldMode == View::Scale && _originalTransform != transform()) {
new ScaleCommand(this, _originalTransform, transform());
maybeReparent();
+ ViewGridLayout::resetSharedPlots(this);
} else if (oldMode == View::Rotate && _originalTransform != transform()) {
new RotateCommand(this, _originalTransform, transform());
maybeReparent();
+ ViewGridLayout::resetSharedPlots(this);
}
}
More information about the Kst
mailing list