diff --git a/apps/opencs/view/render/pathgridmode.cpp b/apps/opencs/view/render/pathgridmode.cpp index 2484dc04a..de7b09018 100644 --- a/apps/opencs/view/render/pathgridmode.cpp +++ b/apps/opencs/view/render/pathgridmode.cpp @@ -1,5 +1,7 @@ #include "pathgridmode.hpp" +#include + #include #include "../../model/world/commands.hpp" @@ -31,8 +33,39 @@ namespace CSVRender "
  • Other operations may be done with the context menu
  • " "

    Note: Only a single cell's pathgrid may be edited at a time"); } - void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hit) + + void PathgridMode::activate(CSVWidget::SceneToolbar* toolbar) { + mSelectAll = new QAction("Select all other nodes in cell", this); + mInvertSelection = new QAction("Invert selection", this); + mClearSelection = new QAction("Clear selection", this); + mRemoveSelected = new QAction("Remove selected nodes", this); + mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this); + + connect(mSelectAll, SIGNAL(triggered()), this, SLOT(selectAll())); + connect(mInvertSelection, SIGNAL(triggered()), this, SLOT(invertSelection())); + connect(mClearSelection, SIGNAL(triggered()), this, SLOT(clearSelection())); + connect(mRemoveSelected, SIGNAL(triggered()), this, SLOT(removeSelected())); + connect(mRemoveSelectedEdges, SIGNAL(triggered()), this, SLOT(removeSelectedEdges())); + + EditMode::activate(toolbar); + } + + bool PathgridMode::createContextMenu(QMenu* menu) + { + if (menu) + { + menu->addAction(mSelectAll); + menu->addAction(mInvertSelection); + menu->addAction(mClearSelection); + menu->addAction(mRemoveSelected); + menu->addAction(mRemoveSelectedEdges); + } + + return true; + } + + void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hitResult) } void PathgridMode::secondaryEditPressed(const WorldspaceHitResult& hit) @@ -160,4 +193,28 @@ namespace CSVRender { getWorldspaceWidget().reset(Mask_Pathgrid); } + + void PathgridMode::selectAll() + { + // Select rest of nodes in selected cell + getWorldspaceWidget().selectAll(Mask_Pathgrid); + } + + void PathgridMode::invertSelection() + { + getWorldspaceWidget().invertSelection(Mask_Pathgrid); + } + + void PathgridMode::clearSelection() + { + getWorldspaceWidget().clearSelection(Mask_Pathgrid); + } + + void PathgridMode::removeSelected() + { + } + + void PathgridMode::removeSelectedEdges() + { + } } diff --git a/apps/opencs/view/render/pathgridmode.hpp b/apps/opencs/view/render/pathgridmode.hpp index 75611e1f6..b6a650eb4 100644 --- a/apps/opencs/view/render/pathgridmode.hpp +++ b/apps/opencs/view/render/pathgridmode.hpp @@ -15,6 +15,10 @@ namespace CSVRender PathgridMode(WorldspaceWidget* worldspace, QWidget* parent=0); + virtual void activate(CSVWidget::SceneToolbar* toolbar); + + virtual bool createContextMenu(QMenu* menu); + virtual void primaryEditPressed(const WorldspaceHitResult& hit); virtual void secondaryEditPressed(const WorldspaceHitResult& hit); @@ -47,8 +51,22 @@ namespace CSVRender std::string mLastId; DragMode mDragMode; unsigned short mFromNode; + + QAction* mSelectAll; + QAction* mInvertSelection; + QAction* mClearSelection; + QAction* mRemoveSelected; + QAction* mRemoveSelectedEdges; + QString getTooltip(); + private slots: + + void selectAll(); + void invertSelection(); + void clearSelection(); + void removeSelected(); + void removeSelectedEdges(); }; }