Showing with 32 additions and 1 deletion.
  1. +20 −0 src/libkstapp/plotitem.cpp
  2. +6 −0 src/libkstapp/plotitem.h
  3. +6 −1 src/libkstapp/plotrenderitem.cpp
20 changes: 20 additions & 0 deletions src/libkstapp/plotitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ void PlotItem::createActions() {
registerShortcut(_zoomTied);
connect(_zoomTied, SIGNAL(triggered()), this, SLOT(zoomTied()));

_zoomOut = new QAction(tr("Zoom Out"), this);
_zoomOut->setShortcut(Qt::Key_Minus);
registerShortcut(_zoomOut);
connect(_zoomOut, SIGNAL(triggered()), this, SLOT(zoomOut()));

_zoomIn = new QAction(tr("Zoom In"), this);
_zoomIn->setShortcut(Qt::Key_Plus);
registerShortcut(_zoomIn);
connect(_zoomIn, SIGNAL(triggered()), this, SLOT(zoomIn()));

_zoomXTied = new QAction(tr("Zoom X Tied"), this);
_zoomXTied->setShortcut(Qt::CTRL+Qt::Key_T);
_zoomXTied->setCheckable(true);
Expand Down Expand Up @@ -3333,6 +3343,16 @@ void PlotItem::zoomLogY(bool force, bool autoLog, bool enableLog) {
}
}

void PlotItem::zoomOut(bool force) {
zoomYOut(force);
zoomXOut(force);
}

void PlotItem::zoomIn(bool force) {
zoomYIn(force);
zoomXIn(force);
}

void PlotItem::copyStatus() {
kstApp->clipboard()->setText(kstApp->mainWindow()->statusMessage());
kstApp->mainWindow()->setStatusMessage(tr("Info copied to clipboard: ") + kstApp->mainWindow()->statusMessage());
Expand Down
6 changes: 6 additions & 0 deletions src/libkstapp/plotitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ class PlotItem : public ViewItem, public PlotItemInterface
void zoomNormalizeYtoX(bool force = false);
void zoomLogY(bool force = false, bool autoLog = true, bool enableLog = false);

void zoomOut(bool force = false);
void zoomIn(bool force = false);


void copyStatus();
void copyXCoord();
void copyYCoord();
Expand Down Expand Up @@ -521,6 +525,8 @@ class PlotItem : public ViewItem, public PlotItemInterface
QAction *_zoomXTied;
QAction *_zoomYTied;
QAction *_zoomMeanCentered;
QAction *_zoomOut;
QAction *_zoomIn;
QAction *_zoomXMaximum;
QAction *_zoomXAutoBorder;
QAction *_zoomXNoSpike;
Expand Down
7 changes: 6 additions & 1 deletion src/libkstapp/plotrenderitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ void PlotRenderItem::addRelation(RelationPtr relation) {
if (relation) {
_relationList.append(relation);
if (_relationList.count() == 1) {
plotItem()->zoomMaximum();
if (plotItem()->xAxis()->axisZoomMode() != PlotAxis::FixedExpression) {
plotItem()->zoomXMaximum();
}
if (plotItem()->yAxis()->axisZoomMode() != PlotAxis::FixedExpression) {
plotItem()->zoomYMaximum();
}
plotItem()->xAxis()->setAxisReversed(relation->invertXHint());
plotItem()->yAxis()->setAxisReversed(relation->invertYHint());
}
Expand Down