| 2477 | } |
| 2478 | |
| 2479 | void WorksheetView::cartesianPlotNavigationChanged(QAction* action) { |
| 2480 | // TODO: find out, which element was selected to find out which range should be changed |
| 2481 | // Project().projectExplorer().currentAspect() |
| 2482 | |
| 2483 | auto op = (CartesianPlot::NavigationOperation)action->data().toInt(); |
| 2484 | auto plotActionMode = m_worksheet->cartesianPlotActionMode(); |
| 2485 | if (plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToSelection) { |
| 2486 | int cSystemIndex = CartesianPlot::cSystemIndex(m_selectedElement); |
| 2487 | const auto& plots = m_worksheet->children<CartesianPlot>(); |
| 2488 | for (auto* plot : plots) { |
| 2489 | if (m_selectedItems.indexOf(plot->graphicsItem()) != -1) |
| 2490 | plot->navigate(cSystemIndex, op); |
| 2491 | else { |
| 2492 | // check if one of the plots childrend is selected. Do the operation there too. |
| 2493 | for (auto* child : plot->children<WorksheetElement>()) { |
| 2494 | if (m_selectedItems.indexOf(child->graphicsItem()) != -1) { |
| 2495 | plot->navigate(cSystemIndex, op); |
| 2496 | break; |
| 2497 | } |
| 2498 | } |
| 2499 | } |
| 2500 | } |
| 2501 | } else if ((plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToAllY |
| 2502 | && (op == CartesianPlot::NavigationOperation::ScaleAutoX || op == CartesianPlot::NavigationOperation::ShiftLeftX |
| 2503 | || op == CartesianPlot::NavigationOperation::ShiftRightX || op == CartesianPlot::NavigationOperation::ZoomInX |
| 2504 | || op == CartesianPlot::NavigationOperation::ZoomOutX)) |
| 2505 | || (plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToAllX |
| 2506 | && (op == CartesianPlot::NavigationOperation::ScaleAutoY || op == CartesianPlot::NavigationOperation::ShiftUpY |
| 2507 | || op == CartesianPlot::NavigationOperation::ShiftDownY || op == CartesianPlot::NavigationOperation::ZoomInY |
| 2508 | || op == CartesianPlot::NavigationOperation::ZoomOutY))) { |
| 2509 | int cSystemIndex = CartesianPlot::cSystemIndex(m_selectedElement); |
| 2510 | if (m_selectedElement->type() == AspectType::CartesianPlot) |
| 2511 | static_cast<CartesianPlot*>(m_selectedElement)->navigate(-1, op); |
| 2512 | else { |
| 2513 | auto parentPlot = static_cast<CartesianPlot*>(m_selectedElement->parent(AspectType::CartesianPlot)); |
| 2514 | if (parentPlot) // really needed? |
| 2515 | parentPlot->navigate(cSystemIndex, op); |
| 2516 | } |
| 2517 | } else { |
| 2518 | const auto& plots = m_worksheet->children<CartesianPlot>(); |
| 2519 | for (auto* plot : plots) |
| 2520 | plot->navigate(-1, op); |
| 2521 | } |
| 2522 | } |
| 2523 | |
| 2524 | Worksheet::CartesianPlotActionMode WorksheetView::getCartesianPlotActionMode() const { |
| 2525 | return m_worksheet->cartesianPlotActionMode(); |