From a41c0e1b85b819442c72556d40553bc158e80155 Mon Sep 17 00:00:00 2001 From: Andreas Stallinger Date: Tue, 12 May 2015 13:55:23 +0200 Subject: [PATCH] ui: bidirectional hovering hovering for graphview and codeview via messaging, hovering in one view will "hover" the equivalent in the other view --- src/app/qt/element/QtCodeArea.cpp | 40 ++++++++++++--- src/app/qt/element/QtCodeArea.h | 5 ++ src/app/qt/element/QtCodeFile.cpp | 16 ++++++ src/app/qt/element/QtCodeFile.h | 2 + src/app/qt/element/QtCodeFileList.cpp | 16 ++++++ src/app/qt/element/QtCodeFileList.h | 3 ++ src/app/qt/element/QtCodeSnippet.cpp | 10 ++++ src/app/qt/element/QtCodeSnippet.h | 3 ++ src/app/qt/view/QtCodeView.cpp | 22 +++++++++ src/app/qt/view/QtCodeView.h | 7 +++ src/app/qt/view/QtGraphView.cpp | 49 +++++++++++++++++++ src/app/qt/view/QtGraphView.h | 7 +++ src/app/qt/view/graphElements/QtGraphEdge.cpp | 16 +++++- src/app/qt/view/graphElements/QtGraphEdge.h | 3 ++ src/app/qt/view/graphElements/QtGraphNode.cpp | 20 +++++++- src/app/qt/view/graphElements/QtGraphNode.h | 4 ++ src/lib/CMakeLists.txt | 2 + .../component/controller/CodeController.cpp | 12 ++++- src/lib/component/controller/CodeController.h | 6 +++ .../component/controller/GraphController.cpp | 12 +++++ .../component/controller/GraphController.h | 6 +++ src/lib/component/view/CodeView.h | 3 ++ src/lib/component/view/GraphView.h | 2 + .../utility/messaging/type/MessageFocusIn.h | 23 +++++++++ .../utility/messaging/type/MessageFocusOut.h | 23 +++++++++ 25 files changed, 302 insertions(+), 10 deletions(-) create mode 100644 src/lib/utility/messaging/type/MessageFocusIn.h create mode 100644 src/lib/utility/messaging/type/MessageFocusOut.h diff --git a/src/app/qt/element/QtCodeArea.cpp b/src/app/qt/element/QtCodeArea.cpp index 4e0c1db1..92f72a17 100644 --- a/src/app/qt/element/QtCodeArea.cpp +++ b/src/app/qt/element/QtCodeArea.cpp @@ -8,6 +8,8 @@ #include "utility/messaging/type/MessageActivateTokenLocation.h" #include "utility/messaging/type/MessageShowFile.h" +#include "utility/messaging/type/MessageFocusIn.h" +#include "utility/messaging/type/MessageFocusOut.h" #include "data/location/TokenLocation.h" #include "data/location/TokenLocationFile.h" @@ -47,7 +49,8 @@ QtCodeArea::QtCodeArea( , m_parent(parent) , m_maximizeButton(nullptr) , m_startLineNumber(startLineNumber) - , m_hoveredAnnotation(nullptr) + , m_focusedTokenId(0) + , m_isFocused(false) , m_digits(0) { setObjectName("code_area"); @@ -193,7 +196,12 @@ void QtCodeArea::leaveEvent(QEvent* event) m_maximizeButton->setEnabled(false); } - m_hoveredAnnotation = nullptr; + if(m_isFocused) + { + MessageFocusOut(m_focusedTokenId).dispatch(); + } + m_isFocused = false; + annotateText(); } @@ -227,11 +235,19 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event) if (annotation && annotation->isScope) { annotation = nullptr; + MessageFocusOut(m_focusedTokenId).dispatch(); } - if (annotation != m_hoveredAnnotation) + if (annotation && annotation->tokenId != m_focusedTokenId) { - m_hoveredAnnotation = annotation; + if(m_isFocused) + { + MessageFocusOut(m_focusedTokenId).dispatch(); + } + + m_focusedTokenId = annotation->tokenId; + m_isFocused = true; + MessageFocusIn(m_focusedTokenId).dispatch(); const std::vector& errorMessages = m_parent->getErrorMessages(); @@ -362,11 +378,11 @@ void QtCodeArea::annotateText() { bool isActive = std::find(ids.begin(), ids.end(), annotation.tokenId) != ids.end(); - if (&annotation == m_hoveredAnnotation && errorMessages.size()) + if (annotation.tokenId == m_focusedTokenId && errorMessages.size()) { color = Colori(255, 0, 0, 128); } - else if (&annotation == m_hoveredAnnotation) + else if(annotation.tokenId == m_focusedTokenId) { color = ApplicationSettings::getInstance()->getCodeActiveLinkColor(); } @@ -436,3 +452,15 @@ int QtCodeArea::endTextEditPosition() const return position - 1; } + +void QtCodeArea::focusToken(Id tokenId) +{ + m_focusedTokenId = tokenId; + annotateText(); +} + +void QtCodeArea::defocusToken() +{ + m_focusedTokenId = -1; + annotateText(); +} diff --git a/src/app/qt/element/QtCodeArea.h b/src/app/qt/element/QtCodeArea.h index 68b2c111..a9f3ff47 100644 --- a/src/app/qt/element/QtCodeArea.h +++ b/src/app/qt/element/QtCodeArea.h @@ -57,6 +57,9 @@ public: void update(); + void focusToken(Id tokenId); + void defocusToken(); + protected: virtual void resizeEvent(QResizeEvent *event); virtual void showEvent(QShowEvent* event); @@ -103,6 +106,8 @@ private: std::vector m_annotations; const Annotation* m_hoveredAnnotation; + Id m_focusedTokenId; + bool m_isFocused; int m_digits; }; diff --git a/src/app/qt/element/QtCodeFile.cpp b/src/app/qt/element/QtCodeFile.cpp index e51eb76d..35edf3d9 100644 --- a/src/app/qt/element/QtCodeFile.cpp +++ b/src/app/qt/element/QtCodeFile.cpp @@ -102,3 +102,19 @@ void QtCodeFile::clickedTitle() { MessageShowFile(m_filePath.absoluteStr(), 0, 0).dispatch(); } + +void QtCodeFile::focusToken(Id tokenId) +{ + for (std::shared_ptr snippet : m_snippets) + { + snippet->focusToken(tokenId); + } +} + +void QtCodeFile::defocusToken() +{ + for (std::shared_ptr snippet : m_snippets) + { + snippet->defocusToken(); + } +} diff --git a/src/app/qt/element/QtCodeFile.h b/src/app/qt/element/QtCodeFile.h index cc834fa1..adda99b2 100644 --- a/src/app/qt/element/QtCodeFile.h +++ b/src/app/qt/element/QtCodeFile.h @@ -37,6 +37,8 @@ public: ); void update(); + void focusToken(Id tokenId); + void defocusToken(); private slots: void clickedTitle(); diff --git a/src/app/qt/element/QtCodeFileList.cpp b/src/app/qt/element/QtCodeFileList.cpp index 0ad7cfdf..9f7fc634 100644 --- a/src/app/qt/element/QtCodeFileList.cpp +++ b/src/app/qt/element/QtCodeFileList.cpp @@ -110,3 +110,19 @@ void QtCodeFileList::updateFiles() file->update(); } } + +void QtCodeFileList::focusToken(Id tokenId) +{ + for (std::shared_ptr file: m_files) + { + file->focusToken(tokenId); + } +} + +void QtCodeFileList::defocusToken() +{ + for (std::shared_ptr file: m_files) + { + file->defocusToken(); + } +} diff --git a/src/app/qt/element/QtCodeFileList.h b/src/app/qt/element/QtCodeFileList.h index 1c3918ad..c987d3c8 100644 --- a/src/app/qt/element/QtCodeFileList.h +++ b/src/app/qt/element/QtCodeFileList.h @@ -40,6 +40,9 @@ public: bool getShowMaximizeButton() const; void setShowMaximizeButton(bool show); + void focusToken(Id tokenId); + void defocusToken(); + private: void updateFiles(); diff --git a/src/app/qt/element/QtCodeSnippet.cpp b/src/app/qt/element/QtCodeSnippet.cpp index ad7fea04..9bdf5d19 100644 --- a/src/app/qt/element/QtCodeSnippet.cpp +++ b/src/app/qt/element/QtCodeSnippet.cpp @@ -57,3 +57,13 @@ void QtCodeSnippet::update() { m_codeArea->update(); } + +void QtCodeSnippet::focusToken(Id tokenId) +{ + m_codeArea->focusToken(tokenId); +} + +void QtCodeSnippet::defocusToken() +{ + m_codeArea->defocusToken(); +} diff --git a/src/app/qt/element/QtCodeSnippet.h b/src/app/qt/element/QtCodeSnippet.h index dd42cf41..ee32813a 100644 --- a/src/app/qt/element/QtCodeSnippet.h +++ b/src/app/qt/element/QtCodeSnippet.h @@ -33,6 +33,9 @@ public: void updateLineNumberAreaWidthForDigits(int digits); void update(); + void focusToken(Id tokenId); + void defocusToken(); + private: QtCodeFile* m_parent; // need this? QPushButton* m_title; diff --git a/src/app/qt/view/QtCodeView.cpp b/src/app/qt/view/QtCodeView.cpp index b1033526..3bd76993 100644 --- a/src/app/qt/view/QtCodeView.cpp +++ b/src/app/qt/view/QtCodeView.cpp @@ -12,6 +12,8 @@ QtCodeView::QtCodeView(ViewLayout* viewLayout) , m_refreshViewFunctor(std::bind(&QtCodeView::doRefreshView, this)) , m_showCodeSnippetsFunctor(std::bind(&QtCodeView::doShowCodeSnippets, this, std::placeholders::_1)) , m_showCodeFileFunctor(std::bind(&QtCodeView::doShowCodeFile, this, std::placeholders::_1)) + , m_focusTokenFunctor(std::bind(&QtCodeView::doFocusToken, this, std::placeholders::_1)) + , m_defocusTokenFunctor(std::bind(&QtCodeView::doDefocusToken, this)) { m_widget = new QtCodeFileList(); setStyleSheet(m_widget); @@ -137,3 +139,23 @@ void QtCodeView::clearClosedWindows() } } } + +void QtCodeView::focusToken(const Id tokenId) +{ + m_focusTokenFunctor(tokenId); +} + +void QtCodeView::defocusToken() +{ + m_defocusTokenFunctor(); +} + +void QtCodeView::doFocusToken(const Id tokenId) +{ + m_widget->focusToken(tokenId); +} + +void QtCodeView::doDefocusToken() +{ + m_widget->defocusToken(); +} diff --git a/src/app/qt/view/QtCodeView.h b/src/app/qt/view/QtCodeView.h index 2c93b552..647a873e 100644 --- a/src/app/qt/view/QtCodeView.h +++ b/src/app/qt/view/QtCodeView.h @@ -30,10 +30,15 @@ public: virtual void showCodeSnippets(const std::vector& snippets); virtual void showCodeFile(const CodeSnippetParams& params); + virtual void focusToken(const Id tokenId); + virtual void defocusToken(); + private: void doRefreshView(); void doShowCodeSnippets(const std::vector& snippets); void doShowCodeFile(const CodeSnippetParams& params); + void doFocusToken(const Id tokenId); + void doDefocusToken(); std::shared_ptr createQtCodeFileList() const; @@ -43,6 +48,8 @@ private: QtThreadedFunctor<> m_refreshViewFunctor; QtThreadedFunctor&> m_showCodeSnippetsFunctor; QtThreadedFunctor m_showCodeFileFunctor; + QtThreadedFunctor m_focusTokenFunctor; + QtThreadedFunctor<> m_defocusTokenFunctor; QtCodeFileList* m_widget; std::vector> m_windows; diff --git a/src/app/qt/view/QtGraphView.cpp b/src/app/qt/view/QtGraphView.cpp index c8c090a6..9e4a17fc 100644 --- a/src/app/qt/view/QtGraphView.cpp +++ b/src/app/qt/view/QtGraphView.cpp @@ -25,6 +25,9 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout) std::bind(&QtGraphView::doRebuildGraph, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)) , m_clearFunctor(std::bind(&QtGraphView::doClear, this)) , m_resizeFunctor(std::bind(&QtGraphView::doResize, this)) + , m_focusInFunctor(std::bind(&QtGraphView::doFocusIn, this, std::placeholders::_1)) + , m_focusOutFunctor(std::bind(&QtGraphView::doFocusOut, this, std::placeholders::_1)) + { } @@ -494,3 +497,49 @@ void QtGraphView::createTransition() connect(m_transition.get(), SIGNAL(finished()), this, SLOT(finishedTransition())); m_transition->start(); } + +void QtGraphView::focusToken(Id tokenId) +{ + m_focusInFunctor(tokenId); +} + +void QtGraphView::doFocusIn(Id tokenId) +{ + std::shared_ptr node = findNodeRecursive(m_oldNodes, tokenId); + if(node) + { + node->focusIn(); + return; + } + for(std::shared_ptr edge : m_oldEdges) + { + if(edge->getData()->getId() == tokenId) + { + edge->focusIn(); + return; + } + } +} + +void QtGraphView::defocusToken(Id tokenId) +{ + m_focusOutFunctor(tokenId); +} + +void QtGraphView::doFocusOut(Id tokenId) +{ + std::shared_ptr node = findNodeRecursive(m_oldNodes, tokenId); + if(node) + { + node->focusOut(); + return; + } + for(std::shared_ptr edge : m_oldEdges) + { + if(edge->getData()->getId() == tokenId) + { + edge->focusOut(); + return; + } + } +} \ No newline at end of file diff --git a/src/app/qt/view/QtGraphView.h b/src/app/qt/view/QtGraphView.h index 4c012e6b..c4800c9e 100644 --- a/src/app/qt/view/QtGraphView.h +++ b/src/app/qt/view/QtGraphView.h @@ -35,6 +35,9 @@ public: virtual void rebuildGraph(std::shared_ptr graph, const std::vector& nodes, const std::vector& edges); virtual void clear(); + virtual void focusToken(Id tokenId); + virtual void defocusToken(Id tokenId); + virtual void resizeView(); virtual Vec2i getViewSize() const; @@ -50,6 +53,8 @@ private: void doRebuildGraph(std::shared_ptr graph, const std::vector& nodes, const std::vector& edges); void doClear(); void doResize(); + void doFocusIn(Id tokenId); + void doFocusOut(Id tokeId); std::shared_ptr findNodeRecursive(const std::list>& nodes, Id tokenId); @@ -72,6 +77,8 @@ private: QtThreadedFunctor, const std::vector&, const std::vector&> m_rebuildGraphFunctor; QtThreadedFunctor m_clearFunctor; QtThreadedFunctor m_resizeFunctor; + QtThreadedFunctor m_focusInFunctor; + QtThreadedFunctor m_focusOutFunctor; std::shared_ptr m_graph; std::shared_ptr m_oldGraph; diff --git a/src/app/qt/view/graphElements/QtGraphEdge.cpp b/src/app/qt/view/graphElements/QtGraphEdge.cpp index c800e55d..c2a129fd 100644 --- a/src/app/qt/view/graphElements/QtGraphEdge.cpp +++ b/src/app/qt/view/graphElements/QtGraphEdge.cpp @@ -5,6 +5,8 @@ #include #include "utility/messaging/type/MessageActivateTokens.h" +#include "utility/messaging/type/MessageFocusIn.h" +#include "utility/messaging/type/MessageFocusOut.h" #include "component/view/graphElements/GraphNode.h" #include "component/view/GraphViewStyle.h" @@ -137,13 +139,23 @@ void QtGraphEdge::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) } void QtGraphEdge::hoverEnterEvent(QGraphicsSceneHoverEvent* event) +{ + MessageFocusIn(getData()->getId()).dispatch(); +} + +void QtGraphEdge::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) +{ + MessageFocusOut(getData()->getId()).dispatch(); +} + +void QtGraphEdge::focusIn() { bool isActive = m_isActive; this->setIsActive(true); m_isActive = isActive; } -void QtGraphEdge::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) +void QtGraphEdge::focusOut() { this->setIsActive(m_isActive); -} +} \ No newline at end of file diff --git a/src/app/qt/view/graphElements/QtGraphEdge.h b/src/app/qt/view/graphElements/QtGraphEdge.h index b720b798..98372c0e 100644 --- a/src/app/qt/view/graphElements/QtGraphEdge.h +++ b/src/app/qt/view/graphElements/QtGraphEdge.h @@ -33,6 +33,9 @@ public: void onClick(); + void focusIn(); + void focusOut(); + protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event); diff --git a/src/app/qt/view/graphElements/QtGraphNode.cpp b/src/app/qt/view/graphElements/QtGraphNode.cpp index 0349adef..c7760032 100644 --- a/src/app/qt/view/graphElements/QtGraphNode.cpp +++ b/src/app/qt/view/graphElements/QtGraphNode.cpp @@ -6,6 +6,8 @@ #include "utility/messaging/type/MessageActivateTokens.h" #include "utility/messaging/type/MessageGraphNodeMove.h" +#include "utility/messaging/type/MessageFocusIn.h"; +#include "utility/messaging/type/MessageFocusOut.h"; #include "qt/graphics/QtRoundedRectItem.h" #include "qt/utility/QtDeviceScaledPixmap.h" @@ -332,12 +334,28 @@ void QtGraphNode::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) } void QtGraphNode::hoverEnterEvent(QGraphicsSceneHoverEvent* event) +{ + if(m_data) + { + MessageFocusIn(m_data->getId()).dispatch(); + } +} + +void QtGraphNode::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) +{ + if(m_data) + { + MessageFocusOut(m_data->getId()).dispatch(); + } +} + +void QtGraphNode::focusIn() { m_isHovering = true; updateStyle(); } -void QtGraphNode::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) +void QtGraphNode::focusOut() { m_isHovering = false; updateStyle(); diff --git a/src/app/qt/view/graphElements/QtGraphNode.h b/src/app/qt/view/graphElements/QtGraphNode.h index b69c7bd1..312ab021 100644 --- a/src/app/qt/view/graphElements/QtGraphNode.h +++ b/src/app/qt/view/graphElements/QtGraphNode.h @@ -6,6 +6,7 @@ #include "component/view/graphElements/GraphNode.h" #include "component/view/GraphViewStyle.h" +#include "utility/messaging/MessageListener.h" class QtGraphEdge; class QtRoundedRectItem; @@ -76,6 +77,9 @@ public: virtual void onClick(); void hoverEnter(); + void focusIn(); + void focusOut(); + virtual void updateStyle(); protected: diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index c404704f..496f43c5 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -253,6 +253,8 @@ add_files( utility/messaging/type/MessageAutoRefreshChanged.h utility/messaging/type/MessageFind.h utility/messaging/type/MessageFinishedParsing.h + utility/messaging/type/MessageFocusIn.h + utility/messaging/type/MessageFocusOut.h utility/messaging/type/MessageGraphNodeExpand.h utility/messaging/type/MessageGraphNodeMove.h utility/messaging/type/MessageInterruptTasks.h diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 5a2d2be5..0e5e50d2 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -70,6 +70,16 @@ void CodeController::handleMessage(MessageFinishedParsing* message) } } +void CodeController::handleMessage(MessageFocusIn* message) +{ + getView()->focusToken(message->tokenId); +} + +void CodeController::handleMessage(MessageFocusOut* message) +{ + getView()->defocusToken(); +} + void CodeController::handleMessage(MessageRefresh* message) { getView()->refreshView(); @@ -183,7 +193,7 @@ std::vector CodeController::getSnippetsForFile(std: std::shared_ptr tempFile = m_storageAccess->getTokenLocationsForLinesInFile(file->getFilePath().str(), params.startLineNumber, params.endLineNumber); TokenLocationLine* firstUsedLine = nullptr; - for (rsize_t i = params.startLineNumber; i <= params.endLineNumber, firstUsedLine == nullptr; i++) + for (size_t i = params.startLineNumber; i <= params.endLineNumber, firstUsedLine == nullptr; i++) { firstUsedLine = tempFile->findTokenLocationLineByNumber(i); } diff --git a/src/lib/component/controller/CodeController.h b/src/lib/component/controller/CodeController.h index 20bfcf85..77582ced 100644 --- a/src/lib/component/controller/CodeController.h +++ b/src/lib/component/controller/CodeController.h @@ -11,6 +11,8 @@ #include "utility/messaging/type/MessageActivateTokenLocation.h" #include "utility/messaging/type/MessageActivateTokens.h" #include "utility/messaging/type/MessageFinishedParsing.h" +#include "utility/messaging/type/MessageFocusIn.h" +#include "utility/messaging/type/MessageFocusOut.h" #include "utility/messaging/type/MessageRefresh.h" #include "utility/messaging/type/MessageShowFile.h" #include "utility/types.h" @@ -23,6 +25,8 @@ class CodeController , public MessageListener , public MessageListener , public MessageListener + , public MessageListener + , public MessageListener , public MessageListener , public MessageListener { @@ -36,6 +40,8 @@ private: virtual void handleMessage(MessageActivateTokenLocation* message); virtual void handleMessage(MessageActivateTokens* message); virtual void handleMessage(MessageFinishedParsing* message); + virtual void handleMessage(MessageFocusIn* message); + virtual void handleMessage(MessageFocusOut* message); virtual void handleMessage(MessageRefresh* message); virtual void handleMessage(MessageShowFile* message); diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 8db8ed7d..540e06ac 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -51,6 +51,18 @@ void GraphController::handleMessage(MessageFinishedParsing* message) getView()->clear(); } +#include + +void GraphController::handleMessage(MessageFocusIn* message) +{ + getView()->focusToken(message->tokenId); +} + +void GraphController::handleMessage(MessageFocusOut *message) +{ + getView()->defocusToken(message->tokenId); +} + void GraphController::handleMessage(MessageGraphNodeExpand* message) { DummyNode* node = findDummyNodeRecursive(m_dummyNodes, message->tokenId); diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index 2ed3d67e..3820d2f4 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -6,6 +6,8 @@ #include "utility/messaging/MessageListener.h" #include "utility/messaging/type/MessageActivateTokens.h" #include "utility/messaging/type/MessageFinishedParsing.h" +#include "utility/messaging/type/MessageFocusIn.h" +#include "utility/messaging/type/MessageFocusOut.h" #include "utility/messaging/type/MessageGraphNodeExpand.h" #include "utility/messaging/type/MessageGraphNodeMove.h" @@ -24,6 +26,8 @@ class GraphController : public Controller , public MessageListener , public MessageListener + , public MessageListener + , public MessageListener , public MessageListener , public MessageListener { @@ -34,6 +38,8 @@ public: private: virtual void handleMessage(MessageActivateTokens* message); virtual void handleMessage(MessageFinishedParsing* message); + virtual void handleMessage(MessageFocusIn* message); + virtual void handleMessage(MessageFocusOut* message); virtual void handleMessage(MessageGraphNodeExpand* message); virtual void handleMessage(MessageGraphNodeMove* message); diff --git a/src/lib/component/view/CodeView.h b/src/lib/component/view/CodeView.h index 03b47f99..3dbe27c2 100644 --- a/src/lib/component/view/CodeView.h +++ b/src/lib/component/view/CodeView.h @@ -43,6 +43,9 @@ public: virtual void showCodeSnippets(const std::vector& snippets) = 0; virtual void showCodeFile(const CodeSnippetParams& params) = 0; + virtual void focusToken(const Id tokenId) = 0; + virtual void defocusToken() = 0; + private: CodeController* getController(); }; diff --git a/src/lib/component/view/GraphView.h b/src/lib/component/view/GraphView.h index b39c6e09..42322692 100644 --- a/src/lib/component/view/GraphView.h +++ b/src/lib/component/view/GraphView.h @@ -24,6 +24,8 @@ public: virtual void rebuildGraph( std::shared_ptr graph, const std::vector& nodes, const std::vector& edges) = 0; virtual void clear() = 0; + virtual void focusToken(Id tokenId) = 0; + virtual void defocusToken(Id tokenId) = 0; virtual void resizeView() = 0; diff --git a/src/lib/utility/messaging/type/MessageFocusIn.h b/src/lib/utility/messaging/type/MessageFocusIn.h new file mode 100644 index 00000000..ffed96bd --- /dev/null +++ b/src/lib/utility/messaging/type/MessageFocusIn.h @@ -0,0 +1,23 @@ +#ifndef MESSAGE_FOCUS_IN_H +#define MESSAGE_FOCUS_IN_H + +#include "utility/messaging/Message.h" +#include "utility/types.h" + +class MessageFocusIn : public Message +{ +public: + MessageFocusIn(Id tokenId) + : tokenId(tokenId) + { + } + + static const std::string getStaticType() + { + return "MessageFocusIn"; + } + + const Id tokenId; +}; + +#endif //MESSAGE_FOCUS_IN_H diff --git a/src/lib/utility/messaging/type/MessageFocusOut.h b/src/lib/utility/messaging/type/MessageFocusOut.h new file mode 100644 index 00000000..411c8e08 --- /dev/null +++ b/src/lib/utility/messaging/type/MessageFocusOut.h @@ -0,0 +1,23 @@ +#ifndef MESSAGE_FOCUS_OUT_H +#define MESSAGE_FOCUS_OUT_H + +#include "utility/messaging/Message.h" +#include "utility/types.h" + +class MessageFocusOut : public Message +{ +public: + MessageFocusOut(Id tokenId) + : tokenId(tokenId) + { + } + + static const std::string getStaticType() + { + return "MessageHoverLeave"; + } + + const Id tokenId; +}; + +#endif //MESSAGE_FOCUS_OUT_H