diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 6f27d5656..2367ede99 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../../model/doc/document.hpp" @@ -284,6 +285,16 @@ void CSVWorld::ScriptEdit::updateLineNumberArea(const QRect &rect, int dy) updateLineNumberAreaWidth(0); } +void CSVWorld::ScriptEdit::commentSelection() +{ + +} + +void CSVWorld::ScriptEdit::uncommentSelection() +{ + +} + void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) { QPlainTextEdit::resizeEvent(e); @@ -292,6 +303,16 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) mLineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); } +void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu *menu = createStandardContextMenu(); + menu->addAction("Comment Selection", this, SLOT(commentSelection())); + menu->addAction("Uncomment Selection", this, SLOT(uncommentSelection())); + + menu->exec(event->globalPos()); + delete menu; +} + void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event) { QPainter painter(mLineNumberArea); diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 4977ed8e0..27e2cd17e 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -77,6 +77,8 @@ namespace CSVWorld virtual void resizeEvent(QResizeEvent *e); + virtual void contextMenuEvent(QContextMenuEvent *event); + private: QVector mAllowedTypes; @@ -111,6 +113,10 @@ namespace CSVWorld void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberArea(const QRect &, int); + + void commentSelection(); + + void uncommentSelection(); }; class LineNumberArea : public QWidget