#include "selectionmode.hpp" #include #include #include #include #include "worldspacewidget.hpp" namespace CSVWidget { class SceneToolbar; } namespace CSVRender { SelectionMode::SelectionMode( CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget, unsigned int interactionMask) : SceneToolMode(parent, "Selection mode") , mWorldspaceWidget(worldspaceWidget) , mInteractionMask(interactionMask) { addButton(":scenetoolbar/selection-mode-cube", "cube-centre", "Centred cube" "
  • Drag with {scene-select-primary} for primary select or {scene-select-secondary} for secondary " "select " "from the centre of the selection cube outwards.
  • " "
  • The selection cube is aligned to the word space axis
  • " "
  • If context selection mode is enabled, a drag with {scene-edit-primary} or {scene-edit-secondary} not " "starting on an instance will have the same effect
  • " "
"); addButton(":scenetoolbar/selection-mode-cube-corner", "cube-corner", "Cube corner to corner" "
  • Drag with {scene-select-primary} for primary select or {scene-select-secondary} for secondary " "select " "from one corner of the selection cube to the opposite corner
  • " "
  • The selection cube is aligned to the word space axis
  • " "
  • If context selection mode is enabled, a drag with {scene-edit-primary} or {scene-edit-secondary} not " "starting on an instance will have the same effect
  • " "
"); addButton(":scenetoolbar/selection-mode-cube-sphere", "sphere", "Centred sphere" "
  • Drag with {scene-select-primary} for primary select or {scene-select-secondary} for secondary " "select " "from the centre of the selection sphere outwards
  • " "
  • If context selection mode is enabled, a drag with {scene-edit-primary} or {scene-edit-secondary} not " "starting on an instance will have the same effect
  • " "
"); mSelectAll = new QAction("Select all", this); mDeselectAll = new QAction("Clear selection", this); mInvertSelection = new QAction("Invert selection", this); connect(mSelectAll, &QAction::triggered, this, &SelectionMode::selectAll); connect(mDeselectAll, &QAction::triggered, this, &SelectionMode::clearSelection); connect(mInvertSelection, &QAction::triggered, this, &SelectionMode::invertSelection); } WorldspaceWidget& SelectionMode::getWorldspaceWidget() { return mWorldspaceWidget; } bool SelectionMode::createContextMenu(QMenu* menu) { if (menu) { menu->addAction(mSelectAll); menu->addAction(mDeselectAll); menu->addAction(mInvertSelection); } return true; } void SelectionMode::selectAll() { getWorldspaceWidget().selectAll(mInteractionMask); } void SelectionMode::clearSelection() { getWorldspaceWidget().clearSelection(mInteractionMask); } void SelectionMode::invertSelection() { getWorldspaceWidget().invertSelection(mInteractionMask); } }