set auto scale for x/y range index (index == -1: all ranges)
| 1334 | |
| 1335 | // set auto scale for x/y range index (index == -1: all ranges) |
| 1336 | void CartesianPlot::enableAutoScale(const Dimension dim, int index, const bool enable, bool fullRange) { |
| 1337 | PERFTRACE(QLatin1String(Q_FUNC_INFO)); |
| 1338 | Q_D(CartesianPlot); |
| 1339 | if (index < -1 || index >= rangeCount(dim)) { |
| 1340 | DEBUG(Q_FUNC_INFO << QStringLiteral("Warning: Invalid index: ").arg(index).toStdString()); |
| 1341 | return; |
| 1342 | } |
| 1343 | |
| 1344 | if (index == -1) { // all x ranges |
| 1345 | for (int i = 0; i < rangeCount(dim); i++) |
| 1346 | enableAutoScale(dim, i, enable, fullRange); |
| 1347 | return; |
| 1348 | } |
| 1349 | |
| 1350 | if (enable != range(dim, index).autoScale()) { |
| 1351 | DEBUG(Q_FUNC_INFO << ", x range " << index << " enable auto scale: " << enable) |
| 1352 | // TODO: maybe using the first and then adding the first one as parent to the next undo command |
| 1353 | exec(new CartesianPlotEnableAutoScaleIndexCmd(d, dim, enable, index, fullRange)); |
| 1354 | setProjectChanged(true); |
| 1355 | } |
| 1356 | } |
| 1357 | |
| 1358 | int CartesianPlot::rangeCount(const Dimension dim) const { |
| 1359 | Q_D(const CartesianPlot); |