MCPcopy Create free account
hub / github.com/KDE/labplot / handleCartesianPlotSelected

Method handleCartesianPlotSelected

src/frontend/worksheet/WorksheetView.cpp:1645–1747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1643}
1644
1645void WorksheetView::handleCartesianPlotSelected(CartesianPlot* plot) {
1646 if (tbCartesianPlotAddNew) { // not available in the presenter mode
1647 tbCartesianPlotAddNew->setMenu(plot->addNewMenu()); // update the tool button shown in the toolbar
1648 cartesianPlotAddNewAction->setMenu(plot->addNewMenu()); // update the action shown in the main menu
1649 }
1650
1651 /* Action to All: action is applied to all ranges
1652 * - Applied to all plots and all ranges
1653 * Action to X: action is applied to all x ranges
1654 * - x zoom selection: zooming into all x ranges of all plots (Normaly all plots will have the same x ranges so it makes sense
1655 * - y zoom selection: makes no sense. disable
1656 * Action to Y: action is applied to all y ranges
1657 * - x zoom selection: makes no sense. disable
1658 * - y zoom selection: zooming into all y ranges of all plots
1659 * Action to Selection
1660 * - x zoom selection: makes no sense, because the range is unknown, disable
1661 * - y zoom selection: makes no sense, because the range is unknown, disable
1662 * - What happens when only one range is available?
1663 */
1664
1665 switch (m_worksheet->cartesianPlotActionMode()) {
1666 case Worksheet::CartesianPlotActionMode::ApplyActionToAll: // Is there a usecase for this?
1667 cartesianPlotZoomSelectionModeAction->setEnabled(true);
1668 cartesianPlotZoomXSelectionModeAction->setEnabled(true);
1669 cartesianPlotZoomYSelectionModeAction->setEnabled(true);
1670 zoomInAction->setEnabled(true);
1671 zoomOutAction->setEnabled(true);
1672 zoomInXAction->setEnabled(true);
1673 zoomOutXAction->setEnabled(true);
1674 zoomInYAction->setEnabled(true);
1675 zoomOutYAction->setEnabled(true);
1676 shiftLeftXAction->setEnabled(true);
1677 shiftRightXAction->setEnabled(true);
1678 shiftUpYAction->setEnabled(true);
1679 shiftDownYAction->setEnabled(true);
1680 scaleAutoAction->setEnabled(true);
1681 scaleAutoXAction->setEnabled(true);
1682 scaleAutoYAction->setEnabled(true);
1683 break;
1684 case Worksheet::CartesianPlotActionMode::ApplyActionToSelection: {
1685 bool enableX = plot->rangeCount(Dimension::X) == 1;
1686 bool enableY = plot->rangeCount(Dimension::Y) == 1;
1687 // only when only one range available
1688 cartesianPlotZoomSelectionModeAction->setEnabled(enableX && enableY);
1689 cartesianPlotZoomXSelectionModeAction->setEnabled(enableX);
1690 cartesianPlotZoomYSelectionModeAction->setEnabled(enableY);
1691 zoomInAction->setEnabled(true);
1692 zoomOutAction->setEnabled(true);
1693 zoomInXAction->setEnabled(true);
1694 zoomOutXAction->setEnabled(true);
1695 zoomInYAction->setEnabled(true);
1696 zoomOutYAction->setEnabled(true);
1697 shiftLeftXAction->setEnabled(true);
1698 shiftRightXAction->setEnabled(true);
1699 shiftUpYAction->setEnabled(true);
1700 shiftDownYAction->setEnabled(true);
1701 scaleAutoAction->setEnabled(true);
1702 scaleAutoXAction->setEnabled(true);

Callers

nothing calls this directly

Calls 4

addNewMenuMethod · 0.80
setEnabledMethod · 0.45
rangeCountMethod · 0.45

Tested by

no test coverage detected