ui: Hide nodes and edges from graph via context menu action or Alt + Click (issue #472)
* show all context menu actions, but disable unavailable * added hide action to undo redo stack
This commit is contained in:
@@ -413,6 +413,7 @@ add_files(
|
|||||||
utility/messaging/type/MessageForceEnterLicense.h
|
utility/messaging/type/MessageForceEnterLicense.h
|
||||||
utility/messaging/type/MessageGraphNodeBundleSplit.h
|
utility/messaging/type/MessageGraphNodeBundleSplit.h
|
||||||
utility/messaging/type/MessageGraphNodeExpand.h
|
utility/messaging/type/MessageGraphNodeExpand.h
|
||||||
|
utility/messaging/type/MessageGraphNodeHide.h
|
||||||
utility/messaging/type/MessageGraphNodeMove.h
|
utility/messaging/type/MessageGraphNodeMove.h
|
||||||
utility/messaging/type/MessageIDECreateCDB.h
|
utility/messaging/type/MessageIDECreateCDB.h
|
||||||
utility/messaging/type/MessageInterruptTasks.h
|
utility/messaging/type/MessageInterruptTasks.h
|
||||||
|
|||||||
@@ -160,39 +160,14 @@ void GraphController::handleMessage(MessageActivateTrail* message)
|
|||||||
|
|
||||||
createDummyGraph(graph);
|
createDummyGraph(graph);
|
||||||
m_graph->setTrailMode(message->horizontalLayout ? Graph::TRAIL_HORIZONTAL : Graph::TRAIL_VERTICAL);
|
m_graph->setTrailMode(message->horizontalLayout ? Graph::TRAIL_HORIZONTAL : Graph::TRAIL_VERTICAL);
|
||||||
|
m_graph->setHasTrailOrigin(message->originId);
|
||||||
|
|
||||||
setVisibility(setActive(m_activeNodeIds, true));
|
setVisibility(setActive(m_activeNodeIds, true));
|
||||||
|
|
||||||
layoutNesting();
|
|
||||||
|
|
||||||
TrailLayouter::LayoutDirection direction;
|
|
||||||
if (message->horizontalLayout)
|
|
||||||
{
|
|
||||||
if (message->originId)
|
|
||||||
{
|
|
||||||
direction = TrailLayouter::LAYOUT_LEFT_RIGHT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
direction = TrailLayouter::LAYOUT_RIGHT_LEFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (message->originId)
|
|
||||||
{
|
|
||||||
direction = TrailLayouter::LAYOUT_TOP_BOTTOM;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
direction = TrailLayouter::LAYOUT_BOTTOM_TOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageStatus("Layouting graph", false, true).dispatch();
|
MessageStatus("Layouting graph", false, true).dispatch();
|
||||||
|
|
||||||
TrailLayouter layout(direction);
|
layoutNesting();
|
||||||
layout.layoutGraph(m_dummyNodes, m_dummyEdges, m_topLevelAncestorIds);
|
layoutTrail(message->horizontalLayout, message->originId);
|
||||||
|
|
||||||
MessageStatus("Displaying graph", false, true).dispatch();
|
MessageStatus("Displaying graph", false, true).dispatch();
|
||||||
|
|
||||||
@@ -384,6 +359,73 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphController::handleMessage(MessageGraphNodeHide* message)
|
||||||
|
{
|
||||||
|
DummyNode* node = getDummyGraphNodeById(message->tokenId);
|
||||||
|
DummyEdge* edge = nullptr;
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
if (node->active || node->hasActiveSubNode())
|
||||||
|
{
|
||||||
|
MessageStatus("Can't hide active node or node with active children", true).dispatch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
node->hidden = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
edge = getDummyGraphEdgeById(message->tokenId);
|
||||||
|
if (edge)
|
||||||
|
{
|
||||||
|
edge->hidden = true;
|
||||||
|
edge->visible = false;
|
||||||
|
|
||||||
|
DummyNode* from = getDummyGraphNodeById(edge->ownerId);
|
||||||
|
DummyNode* to = getDummyGraphNodeById(edge->targetId);
|
||||||
|
|
||||||
|
if (from)
|
||||||
|
{
|
||||||
|
from->connected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to)
|
||||||
|
{
|
||||||
|
to->connected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node || edge)
|
||||||
|
{
|
||||||
|
bool showsTrail = m_graph->getTrailMode() != Graph::TRAIL_NONE;
|
||||||
|
|
||||||
|
setVisibility(setActive(utility::concat(m_activeNodeIds, m_activeEdgeIds), showsTrail));
|
||||||
|
|
||||||
|
if (hasCharacterIndex())
|
||||||
|
{
|
||||||
|
addCharacterIndex();
|
||||||
|
layoutNesting();
|
||||||
|
layoutList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layoutNesting();
|
||||||
|
|
||||||
|
if (showsTrail)
|
||||||
|
{
|
||||||
|
layoutTrail(m_graph->getTrailMode() == Graph::TRAIL_HORIZONTAL, m_graph->hasTrailOrigin());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layoutGraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildGraph(message, false, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphController::handleMessage(MessageGraphNodeMove* message)
|
void GraphController::handleMessage(MessageGraphNodeMove* message)
|
||||||
{
|
{
|
||||||
DummyNode* node = getDummyGraphNodeById(message->tokenId);
|
DummyNode* node = getDummyGraphNodeById(message->tokenId);
|
||||||
@@ -674,7 +716,8 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds, bool show
|
|||||||
DummyNode* to = getDummyGraphNodeById(edge->targetId);
|
DummyNode* to = getDummyGraphNodeById(edge->targetId);
|
||||||
|
|
||||||
bool isInheritance = edge->data->isType(Edge::EDGE_INHERITANCE);
|
bool isInheritance = edge->data->isType(Edge::EDGE_INHERITANCE);
|
||||||
if (from && to && (showAllEdges || noActive || from->active || to->active || edge->active || isInheritance))
|
if (from && to && !edge->hidden &&
|
||||||
|
(showAllEdges || noActive || from->active || to->active || edge->active || isInheritance))
|
||||||
{
|
{
|
||||||
edge->visible = true;
|
edge->visible = true;
|
||||||
from->connected = true;
|
from->connected = true;
|
||||||
@@ -727,7 +770,11 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n
|
|||||||
node->visible = false;
|
node->visible = false;
|
||||||
node->childVisible = false;
|
node->childVisible = false;
|
||||||
|
|
||||||
if (node->isExpandToggleNode())
|
if (node->hidden)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (node->isExpandToggleNode())
|
||||||
{
|
{
|
||||||
node->visible = true;
|
node->visible = true;
|
||||||
return false;
|
return false;
|
||||||
@@ -765,10 +812,9 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n
|
|||||||
|
|
||||||
void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool parentExpanded) const
|
void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool parentExpanded) const
|
||||||
{
|
{
|
||||||
node->visible = true;
|
|
||||||
|
|
||||||
if (node->isGraphNode() && node->data->getType().getType() == NodeType::NODE_ENUM && !node->isExpanded())
|
if (node->isGraphNode() && node->data->getType().getType() == NodeType::NODE_ENUM && !node->isExpanded())
|
||||||
{
|
{
|
||||||
|
node->visible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,13 +823,18 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa
|
|||||||
{
|
{
|
||||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||||
{
|
{
|
||||||
if (!subNode->isQualifierNode())
|
if (!subNode->isQualifierNode() && !subNode->isExpandToggleNode() && !subNode->hidden)
|
||||||
{
|
{
|
||||||
node->childVisible = true;
|
|
||||||
setNodeVisibilityRecursiveTopDown(subNode.get(), node->isExpanded());
|
setNodeVisibilityRecursiveTopDown(subNode.get(), node->isExpanded());
|
||||||
|
node->childVisible |= subNode->visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!node->isAccessNode() || node->childVisible)
|
||||||
|
{
|
||||||
|
node->visible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphController::hideBuiltinTypes()
|
void GraphController::hideBuiltinTypes()
|
||||||
@@ -1276,7 +1327,7 @@ void GraphController::addCharacterIndex()
|
|||||||
char character = 0;
|
char character = 0;
|
||||||
for (size_t i = 0; i < m_dummyNodes.size(); i++)
|
for (size_t i = 0; i < m_dummyNodes.size(); i++)
|
||||||
{
|
{
|
||||||
if (!m_dummyNodes[i]->name.size())
|
if (!m_dummyNodes[i]->visible || !m_dummyNodes[i]->name.size())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1295,6 +1346,18 @@ void GraphController::addCharacterIndex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphController::hasCharacterIndex() const
|
||||||
|
{
|
||||||
|
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||||
|
{
|
||||||
|
if (node->isTextNode())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void GraphController::layoutNesting()
|
void GraphController::layoutNesting()
|
||||||
{
|
{
|
||||||
TRACE();
|
TRACE();
|
||||||
@@ -1493,7 +1556,8 @@ void GraphController::addExpandToggleNode(DummyNode* node) const
|
|||||||
|
|
||||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||||
{
|
{
|
||||||
if (subSubNode->visible && (!subSubNode->isGraphNode() || !subSubNode->data->isImplicit() || node->data->isImplicit()))
|
if ((subSubNode->visible || subSubNode->hidden) &&
|
||||||
|
(!subSubNode->isGraphNode() || !subSubNode->data->isImplicit() || node->data->isImplicit()))
|
||||||
{
|
{
|
||||||
visibleSubNodeCount++;
|
visibleSubNodeCount++;
|
||||||
}
|
}
|
||||||
@@ -1562,8 +1626,17 @@ void GraphController::layoutGraph(bool getSortedNodes)
|
|||||||
{
|
{
|
||||||
TRACE();
|
TRACE();
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<DummyNode>> visibleNodes;
|
||||||
|
for (auto node : m_dummyNodes)
|
||||||
|
{
|
||||||
|
if (node->visible)
|
||||||
|
{
|
||||||
|
visibleNodes.push_back(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BucketLayouter grid(getView()->getViewSize());
|
BucketLayouter grid(getView()->getViewSize());
|
||||||
grid.createBuckets(m_dummyNodes, m_dummyEdges);
|
grid.createBuckets(visibleNodes, m_dummyEdges);
|
||||||
grid.layoutBuckets();
|
grid.layoutBuckets();
|
||||||
|
|
||||||
if (getSortedNodes)
|
if (getSortedNodes)
|
||||||
@@ -1576,8 +1649,56 @@ void GraphController::layoutList()
|
|||||||
{
|
{
|
||||||
TRACE();
|
TRACE();
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<DummyNode>> visibleNodes;
|
||||||
|
for (auto node : m_dummyNodes)
|
||||||
|
{
|
||||||
|
if (node->visible)
|
||||||
|
{
|
||||||
|
visibleNodes.push_back(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListLayouter layouter(getView()->getViewSize());
|
ListLayouter layouter(getView()->getViewSize());
|
||||||
layouter.layoutList(m_dummyNodes);
|
layouter.layoutList(visibleNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphController::layoutTrail(bool horizontal, bool hasOrigin)
|
||||||
|
{
|
||||||
|
TrailLayouter::LayoutDirection direction;
|
||||||
|
if (horizontal)
|
||||||
|
{
|
||||||
|
if (hasOrigin)
|
||||||
|
{
|
||||||
|
direction = TrailLayouter::LAYOUT_LEFT_RIGHT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
direction = TrailLayouter::LAYOUT_RIGHT_LEFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (hasOrigin)
|
||||||
|
{
|
||||||
|
direction = TrailLayouter::LAYOUT_TOP_BOTTOM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
direction = TrailLayouter::LAYOUT_BOTTOM_TOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<DummyNode>> visibleNodes;
|
||||||
|
for (auto node : m_dummyNodes)
|
||||||
|
{
|
||||||
|
if (node->visible)
|
||||||
|
{
|
||||||
|
visibleNodes.push_back(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TrailLayouter layout(direction);
|
||||||
|
layout.layoutGraph(visibleNodes, m_dummyEdges, m_topLevelAncestorIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphController::assignBundleIds()
|
void GraphController::assignBundleIds()
|
||||||
@@ -1608,6 +1729,19 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DummyEdge* GraphController::getDummyGraphEdgeById(Id tokenId) const
|
||||||
|
{
|
||||||
|
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||||
|
{
|
||||||
|
if (edge->data && edge->data->getId() == tokenId)
|
||||||
|
{
|
||||||
|
return edge.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void GraphController::buildGraph(
|
void GraphController::buildGraph(
|
||||||
MessageBase* message, bool centerActiveNode, bool animatedTransition, bool scrollToTop)
|
MessageBase* message, bool centerActiveNode, bool animatedTransition, bool scrollToTop)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "utility/messaging/type/MessageFocusOut.h"
|
#include "utility/messaging/type/MessageFocusOut.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||||
|
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||||
#include "utility/messaging/type/MessageScrollGraph.h"
|
#include "utility/messaging/type/MessageScrollGraph.h"
|
||||||
#include "utility/messaging/type/MessageSearchFullText.h"
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
@@ -42,6 +43,7 @@ class GraphController
|
|||||||
, public MessageListener<MessageFocusOut>
|
, public MessageListener<MessageFocusOut>
|
||||||
, public MessageListener<MessageGraphNodeBundleSplit>
|
, public MessageListener<MessageGraphNodeBundleSplit>
|
||||||
, public MessageListener<MessageGraphNodeExpand>
|
, public MessageListener<MessageGraphNodeExpand>
|
||||||
|
, public MessageListener<MessageGraphNodeHide>
|
||||||
, public MessageListener<MessageGraphNodeMove>
|
, public MessageListener<MessageGraphNodeMove>
|
||||||
, public MessageListener<MessageScrollGraph>
|
, public MessageListener<MessageScrollGraph>
|
||||||
, public MessageListener<MessageSearchFullText>
|
, public MessageListener<MessageSearchFullText>
|
||||||
@@ -62,6 +64,7 @@ private:
|
|||||||
virtual void handleMessage(MessageFocusOut* message);
|
virtual void handleMessage(MessageFocusOut* message);
|
||||||
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
||||||
virtual void handleMessage(MessageGraphNodeExpand* message);
|
virtual void handleMessage(MessageGraphNodeExpand* message);
|
||||||
|
virtual void handleMessage(MessageGraphNodeHide* message);
|
||||||
virtual void handleMessage(MessageGraphNodeMove* message);
|
virtual void handleMessage(MessageGraphNodeMove* message);
|
||||||
virtual void handleMessage(MessageScrollGraph* message);
|
virtual void handleMessage(MessageScrollGraph* message);
|
||||||
virtual void handleMessage(MessageSearchFullText* message);
|
virtual void handleMessage(MessageSearchFullText* message);
|
||||||
@@ -100,6 +103,7 @@ private:
|
|||||||
void bundleNodesByType();
|
void bundleNodesByType();
|
||||||
|
|
||||||
void addCharacterIndex();
|
void addCharacterIndex();
|
||||||
|
bool hasCharacterIndex() const;
|
||||||
|
|
||||||
void layoutNesting();
|
void layoutNesting();
|
||||||
void layoutNestingRecursive(DummyNode* node) const;
|
void layoutNestingRecursive(DummyNode* node) const;
|
||||||
@@ -108,10 +112,12 @@ private:
|
|||||||
|
|
||||||
void layoutGraph(bool getSortedNodes = false);
|
void layoutGraph(bool getSortedNodes = false);
|
||||||
void layoutList();
|
void layoutList();
|
||||||
|
void layoutTrail(bool horizontal, bool hasOrigin);
|
||||||
|
|
||||||
void assignBundleIds();
|
void assignBundleIds();
|
||||||
|
|
||||||
DummyNode* getDummyGraphNodeById(Id tokenId) const;
|
DummyNode* getDummyGraphNodeById(Id tokenId) const;
|
||||||
|
DummyEdge* getDummyGraphEdgeById(Id tokenId) const;
|
||||||
|
|
||||||
void buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition, bool scrollToTop);
|
void buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition, bool scrollToTop);
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,12 @@ void UndoRedoController::handleMessage(MessageGraphNodeExpand* message)
|
|||||||
processCommand(command);
|
processCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UndoRedoController::handleMessage(MessageGraphNodeHide* message)
|
||||||
|
{
|
||||||
|
Command command(std::make_shared<MessageGraphNodeHide>(*message), Command::ORDER_ADAPT);
|
||||||
|
processCommand(command);
|
||||||
|
}
|
||||||
|
|
||||||
void UndoRedoController::handleMessage(MessageGraphNodeMove* message)
|
void UndoRedoController::handleMessage(MessageGraphNodeMove* message)
|
||||||
{
|
{
|
||||||
Command command(std::make_shared<MessageGraphNodeMove>(*message), Command::ORDER_VIEW);
|
Command command(std::make_shared<MessageGraphNodeMove>(*message), Command::ORDER_VIEW);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||||
|
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||||
#include "utility/messaging/type/MessageRedo.h"
|
#include "utility/messaging/type/MessageRedo.h"
|
||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
@@ -44,6 +45,7 @@ class UndoRedoController
|
|||||||
, public MessageListener<MessageFinishedParsing>
|
, public MessageListener<MessageFinishedParsing>
|
||||||
, public MessageListener<MessageGraphNodeBundleSplit>
|
, public MessageListener<MessageGraphNodeBundleSplit>
|
||||||
, public MessageListener<MessageGraphNodeExpand>
|
, public MessageListener<MessageGraphNodeExpand>
|
||||||
|
, public MessageListener<MessageGraphNodeHide>
|
||||||
, public MessageListener<MessageGraphNodeMove>
|
, public MessageListener<MessageGraphNodeMove>
|
||||||
, public MessageListener<MessageRedo>
|
, public MessageListener<MessageRedo>
|
||||||
, public MessageListener<MessageRefresh>
|
, public MessageListener<MessageRefresh>
|
||||||
@@ -91,6 +93,7 @@ private:
|
|||||||
virtual void handleMessage(MessageFinishedParsing* message);
|
virtual void handleMessage(MessageFinishedParsing* message);
|
||||||
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
||||||
virtual void handleMessage(MessageGraphNodeExpand* message);
|
virtual void handleMessage(MessageGraphNodeExpand* message);
|
||||||
|
virtual void handleMessage(MessageGraphNodeHide* message);
|
||||||
virtual void handleMessage(MessageGraphNodeMove* message);
|
virtual void handleMessage(MessageGraphNodeMove* message);
|
||||||
virtual void handleMessage(MessageRedo* message);
|
virtual void handleMessage(MessageRedo* message);
|
||||||
virtual void handleMessage(MessageRefresh* message);
|
virtual void handleMessage(MessageRefresh* message);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ struct DummyEdge
|
|||||||
, targetId(0)
|
, targetId(0)
|
||||||
, data(nullptr)
|
, data(nullptr)
|
||||||
, visible(false)
|
, visible(false)
|
||||||
|
, hidden(false)
|
||||||
, active(false)
|
, active(false)
|
||||||
, weight(0)
|
, weight(0)
|
||||||
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
||||||
@@ -28,6 +29,7 @@ struct DummyEdge
|
|||||||
, targetId(targetId)
|
, targetId(targetId)
|
||||||
, data(data)
|
, data(data)
|
||||||
, visible(false)
|
, visible(false)
|
||||||
|
, hidden(false)
|
||||||
, active(false)
|
, active(false)
|
||||||
, weight(0)
|
, weight(0)
|
||||||
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
||||||
@@ -85,6 +87,7 @@ struct DummyEdge
|
|||||||
const Edge* data;
|
const Edge* data;
|
||||||
|
|
||||||
bool visible;
|
bool visible;
|
||||||
|
bool hidden;
|
||||||
bool active;
|
bool active;
|
||||||
|
|
||||||
std::vector<Vec4i> path;
|
std::vector<Vec4i> path;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
|
|
||||||
DummyNode()
|
DummyNode()
|
||||||
: visible(false)
|
: visible(false)
|
||||||
|
, hidden(false)
|
||||||
, childVisible(false)
|
, childVisible(false)
|
||||||
, tokenId(0)
|
, tokenId(0)
|
||||||
, data(nullptr)
|
, data(nullptr)
|
||||||
@@ -342,6 +343,7 @@ public:
|
|||||||
Vec2i size;
|
Vec2i size;
|
||||||
|
|
||||||
bool visible;
|
bool visible;
|
||||||
|
bool hidden;
|
||||||
bool childVisible;
|
bool childVisible;
|
||||||
|
|
||||||
Id tokenId;
|
Id tokenId;
|
||||||
|
|||||||
@@ -588,7 +588,14 @@ void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorId
|
|||||||
{
|
{
|
||||||
if (node->dummyNode)
|
if (node->dummyNode)
|
||||||
{
|
{
|
||||||
node->dummyNode->position = node->pos;
|
if (node->level != -1)
|
||||||
|
{
|
||||||
|
node->dummyNode->position = node->pos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node->dummyNode->visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,6 +296,16 @@ void Graph::setTrailMode(TrailMode trailMode)
|
|||||||
m_trailMode = trailMode;
|
m_trailMode = trailMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Graph::hasTrailOrigin() const
|
||||||
|
{
|
||||||
|
return m_hasTrailOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graph::setHasTrailOrigin(bool hasOrigin)
|
||||||
|
{
|
||||||
|
m_hasTrailOrigin = hasOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
void Graph::print(std::ostream& ostream) const
|
void Graph::print(std::ostream& ostream) const
|
||||||
{
|
{
|
||||||
ostream << "Graph:\n";
|
ostream << "Graph:\n";
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public:
|
|||||||
TrailMode getTrailMode() const;
|
TrailMode getTrailMode() const;
|
||||||
void setTrailMode(TrailMode trailMode);
|
void setTrailMode(TrailMode trailMode);
|
||||||
|
|
||||||
|
bool hasTrailOrigin() const;
|
||||||
|
void setHasTrailOrigin(bool hasOrigin);
|
||||||
|
|
||||||
void print(std::ostream& ostream) const;
|
void print(std::ostream& ostream) const;
|
||||||
void printBasic(std::ostream& ostream) const;
|
void printBasic(std::ostream& ostream) const;
|
||||||
|
|
||||||
@@ -72,6 +75,7 @@ private:
|
|||||||
std::map<Id, std::shared_ptr<Edge>> m_edges;
|
std::map<Id, std::shared_ptr<Edge>> m_edges;
|
||||||
|
|
||||||
TrailMode m_trailMode;
|
TrailMode m_trailMode;
|
||||||
|
bool m_hasTrailOrigin;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ostream, const Graph& graph);
|
std::ostream& operator<<(std::ostream& ostream, const Graph& graph);
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef MESSAGE_GRAPH_NODE_HIDE_H
|
||||||
|
#define MESSAGE_GRAPH_NODE_HIDE_H
|
||||||
|
|
||||||
|
#include "utility/messaging/Message.h"
|
||||||
|
#include "utility/types.h"
|
||||||
|
|
||||||
|
class MessageGraphNodeHide
|
||||||
|
: public Message<MessageGraphNodeHide>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessageGraphNodeHide(Id tokenId)
|
||||||
|
: tokenId(tokenId)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string getStaticType()
|
||||||
|
{
|
||||||
|
return "MessageGraphNodeHide";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void print(std::ostream& os) const
|
||||||
|
{
|
||||||
|
os << tokenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Id tokenId;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSAGE_GRAPH_NODE_HIDE_H
|
||||||
@@ -581,14 +581,13 @@ void QtCodeArea::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
{
|
{
|
||||||
m_eventPosition = event->pos();
|
m_eventPosition = event->pos();
|
||||||
|
|
||||||
|
m_setIDECursorPositionAction->setEnabled(!getSourceLocationFile()->getFilePath().empty());
|
||||||
|
|
||||||
QtContextMenu menu(event, this);
|
QtContextMenu menu(event, this);
|
||||||
if (!getSourceLocationFile()->getFilePath().empty())
|
menu.addSeparator();
|
||||||
{
|
menu.addFileActions(getSourceLocationFile()->getFilePath());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addFileActions(getSourceLocationFile()->getFilePath());
|
menu.addAction(m_setIDECursorPositionAction);
|
||||||
menu.addSeparator();
|
|
||||||
menu.addAction(m_setIDECursorPositionAction);
|
|
||||||
}
|
|
||||||
menu.show();
|
menu.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,14 +128,8 @@ void QtCodeFileTitleButton::updateTexts()
|
|||||||
|
|
||||||
void QtCodeFileTitleButton::contextMenuEvent(QContextMenuEvent* event)
|
void QtCodeFileTitleButton::contextMenuEvent(QContextMenuEvent* event)
|
||||||
{
|
{
|
||||||
QtContextMenu menu(event, this);
|
FilePath path = m_filePath;
|
||||||
menu.addSeparator();
|
if (text().size())
|
||||||
|
|
||||||
if (!m_filePath.empty())
|
|
||||||
{
|
|
||||||
menu.addFileActions(m_filePath);
|
|
||||||
}
|
|
||||||
else if (text().size())
|
|
||||||
{
|
{
|
||||||
Project* currentProject = Application::getInstance()->getCurrentProject().get();
|
Project* currentProject = Application::getInstance()->getCurrentProject().get();
|
||||||
if (!currentProject)
|
if (!currentProject)
|
||||||
@@ -143,9 +137,12 @@ void QtCodeFileTitleButton::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addFileActions(currentProject->getProjectSettingsFilePath());
|
path = currentProject->getProjectSettingsFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtContextMenu menu(event, this);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addFileActions(path);
|
||||||
menu.show();
|
menu.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QParallelAnimationGroup>
|
#include <QParallelAnimationGroup>
|
||||||
|
|
||||||
|
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||||
#include "qt/view/graphElements/QtGraphNode.h"
|
#include "qt/view/graphElements/QtGraphNode.h"
|
||||||
#include "qt/view/graphElements/QtGraphNodeData.h"
|
#include "qt/view/graphElements/QtGraphNodeData.h"
|
||||||
#include "qt/view/graphElements/QtGraphNodeBundle.h"
|
#include "qt/view/graphElements/QtGraphNodeBundle.h"
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
#include "qt/utility/utilityQt.h"
|
#include "qt/utility/utilityQt.h"
|
||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||||
|
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||||
#include "utility/utilityApp.h"
|
#include "utility/utilityApp.h"
|
||||||
#include "utility/ResourcePaths.h"
|
#include "utility/ResourcePaths.h"
|
||||||
|
|
||||||
@@ -57,6 +59,16 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
|
|||||||
m_copyNodeNameAction->setToolTip(tr("Copies the name of this node to the clipboard"));
|
m_copyNodeNameAction->setToolTip(tr("Copies the name of this node to the clipboard"));
|
||||||
connect(m_copyNodeNameAction, &QAction::triggered, this, &QtGraphicsView::copyNodeName);
|
connect(m_copyNodeNameAction, &QAction::triggered, this, &QtGraphicsView::copyNodeName);
|
||||||
|
|
||||||
|
m_hideNodeAction = new QAction(tr("Hide Node (Alt + Left Click)"), this);
|
||||||
|
m_hideNodeAction->setStatusTip(tr("Hide the node from this graph"));
|
||||||
|
m_hideNodeAction->setToolTip(tr("Hide the node from this graph"));
|
||||||
|
connect(m_hideNodeAction, &QAction::triggered, this, &QtGraphicsView::hideNode);
|
||||||
|
|
||||||
|
m_hideEdgeAction = new QAction(tr("Hide Edge (Alt + Left Click)"), this);
|
||||||
|
m_hideEdgeAction->setStatusTip(tr("Hide the edge from this graph"));
|
||||||
|
m_hideEdgeAction->setToolTip(tr("Hide the edge from this graph"));
|
||||||
|
connect(m_hideEdgeAction, &QAction::triggered, this, &QtGraphicsView::hideEdge);
|
||||||
|
|
||||||
m_bookmarkNodeAction = new QAction(tr("Bookmark Node"), this);
|
m_bookmarkNodeAction = new QAction(tr("Bookmark Node"), this);
|
||||||
m_bookmarkNodeAction->setStatusTip(tr("Create a bookmark for this node"));
|
m_bookmarkNodeAction->setStatusTip(tr("Create a bookmark for this node"));
|
||||||
m_bookmarkNodeAction->setToolTip(tr("Create a bookmark for this node"));
|
m_bookmarkNodeAction->setToolTip(tr("Create a bookmark for this node"));
|
||||||
@@ -113,6 +125,20 @@ QtGraphNode* QtGraphicsView::getNodeAtCursorPosition() const
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtGraphEdge* QtGraphicsView::getEdgeAtCursorPosition() const
|
||||||
|
{
|
||||||
|
QtGraphEdge* edge = nullptr;
|
||||||
|
|
||||||
|
QPointF point = mapToScene(mapFromGlobal(QCursor::pos()));
|
||||||
|
QGraphicsItem* item = scene()->itemAt(point, QTransform());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
edge = dynamic_cast<QtGraphEdge*>(item->parentItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
|
||||||
void QtGraphicsView::ensureVisibleAnimated(const QRectF& rect, int xmargin, int ymargin)
|
void QtGraphicsView::ensureVisibleAnimated(const QRectF& rect, int xmargin, int ymargin)
|
||||||
{
|
{
|
||||||
int xval = horizontalScrollBar()->value();
|
int xval = horizontalScrollBar()->value();
|
||||||
@@ -302,51 +328,64 @@ void QtGraphicsView::wheelEvent(QWheelEvent* event)
|
|||||||
void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||||
{
|
{
|
||||||
m_clipboardNodeName = "";
|
m_clipboardNodeName = "";
|
||||||
|
m_hideNodeId = 0;
|
||||||
|
m_hideEdgeId = 0;
|
||||||
m_bookmarkNodeId = 0;
|
m_bookmarkNodeId = 0;
|
||||||
FilePath clipboardFilePath;
|
FilePath clipboardFilePath;
|
||||||
|
|
||||||
QtGraphNode* node = getNodeAtCursorPosition();
|
QtGraphNode* node = getNodeAtCursorPosition();
|
||||||
while (node)
|
if (node)
|
||||||
{
|
{
|
||||||
QtGraphNodeData* dataNode = dynamic_cast<QtGraphNodeData*>(node);
|
while (node)
|
||||||
if (dataNode)
|
|
||||||
{
|
{
|
||||||
m_clipboardNodeName = dataNode->getName();
|
m_hideNodeId = node->getTokenId();
|
||||||
m_bookmarkNodeId = dataNode->getTokenId();
|
|
||||||
clipboardFilePath = dataNode->getFilePath();
|
QtGraphNodeData* dataNode = dynamic_cast<QtGraphNodeData*>(node);
|
||||||
|
if (dataNode)
|
||||||
|
{
|
||||||
|
m_clipboardNodeName = dataNode->getName();
|
||||||
|
m_bookmarkNodeId = dataNode->getTokenId();
|
||||||
|
clipboardFilePath = dataNode->getFilePath();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<QtGraphNodeBundle*>(node))
|
||||||
|
{
|
||||||
|
m_clipboardNodeName = node->getName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
node = node->getParent();
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<QtGraphNodeBundle*>(node))
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QtGraphEdge* edge = getEdgeAtCursorPosition();
|
||||||
|
if (edge)
|
||||||
{
|
{
|
||||||
m_clipboardNodeName = node->getName();
|
m_hideEdgeId = edge->getTokenId();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
node = node->getParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_hideNodeAction->setEnabled(m_hideNodeId);
|
||||||
|
m_hideEdgeAction->setEnabled(m_hideEdgeId);
|
||||||
|
m_bookmarkNodeAction->setEnabled(m_bookmarkNodeId);
|
||||||
|
|
||||||
|
m_copyNodeNameAction->setEnabled(m_clipboardNodeName.size());
|
||||||
|
|
||||||
|
|
||||||
QtContextMenu menu(event, this);
|
QtContextMenu menu(event, this);
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(m_exportGraphAction);
|
menu.addAction(m_exportGraphAction);
|
||||||
|
|
||||||
if (m_bookmarkNodeId)
|
menu.addSeparator();
|
||||||
{
|
menu.addAction(m_hideEdgeAction);
|
||||||
menu.addSeparator();
|
menu.addAction(m_hideNodeAction);
|
||||||
menu.addAction(m_bookmarkNodeAction);
|
menu.addAction(m_bookmarkNodeAction);
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_clipboardNodeName.empty() || !clipboardFilePath.empty())
|
menu.addSeparator();
|
||||||
{
|
menu.addAction(m_copyNodeNameAction);
|
||||||
menu.addSeparator();
|
menu.addFileActions(clipboardFilePath);
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_clipboardNodeName.empty())
|
|
||||||
{
|
|
||||||
menu.addAction(m_copyNodeNameAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!clipboardFilePath.empty())
|
|
||||||
{
|
|
||||||
menu.addFileActions(clipboardFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.show();
|
menu.show();
|
||||||
}
|
}
|
||||||
@@ -439,6 +478,16 @@ void QtGraphicsView::copyNodeName()
|
|||||||
QApplication::clipboard()->setText(m_clipboardNodeName.c_str());
|
QApplication::clipboard()->setText(m_clipboardNodeName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtGraphicsView::hideNode()
|
||||||
|
{
|
||||||
|
MessageGraphNodeHide(m_hideNodeId).dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtGraphicsView::hideEdge()
|
||||||
|
{
|
||||||
|
MessageGraphNodeHide(m_hideEdgeId).dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
void QtGraphicsView::bookmarkNode()
|
void QtGraphicsView::bookmarkNode()
|
||||||
{
|
{
|
||||||
MessageDisplayBookmarkCreator(m_bookmarkNodeId).dispatch();
|
MessageDisplayBookmarkCreator(m_bookmarkNodeId).dispatch();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "utility/types.h"
|
#include "utility/types.h"
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
class QtGraphEdge;
|
||||||
class QtGraphNode;
|
class QtGraphNode;
|
||||||
|
|
||||||
class QtGraphicsView
|
class QtGraphicsView
|
||||||
@@ -25,6 +26,7 @@ public:
|
|||||||
void setSceneRect(const QRectF& rect);
|
void setSceneRect(const QRectF& rect);
|
||||||
|
|
||||||
QtGraphNode* getNodeAtCursorPosition() const;
|
QtGraphNode* getNodeAtCursorPosition() const;
|
||||||
|
QtGraphEdge* getEdgeAtCursorPosition() const;
|
||||||
|
|
||||||
void ensureVisibleAnimated(const QRectF& rect, int xmargin = 50, int ymargin = 50);
|
void ensureVisibleAnimated(const QRectF& rect, int xmargin = 50, int ymargin = 50);
|
||||||
|
|
||||||
@@ -56,6 +58,8 @@ private slots:
|
|||||||
|
|
||||||
void exportGraph();
|
void exportGraph();
|
||||||
void copyNodeName();
|
void copyNodeName();
|
||||||
|
void hideNode();
|
||||||
|
void hideEdge();
|
||||||
void bookmarkNode();
|
void bookmarkNode();
|
||||||
|
|
||||||
void zoomInPressed();
|
void zoomInPressed();
|
||||||
@@ -81,6 +85,8 @@ private:
|
|||||||
bool m_shift;
|
bool m_shift;
|
||||||
|
|
||||||
std::string m_clipboardNodeName;
|
std::string m_clipboardNodeName;
|
||||||
|
Id m_hideNodeId;
|
||||||
|
Id m_hideEdgeId;
|
||||||
Id m_bookmarkNodeId;
|
Id m_bookmarkNodeId;
|
||||||
|
|
||||||
std::shared_ptr<QTimer> m_timer;
|
std::shared_ptr<QTimer> m_timer;
|
||||||
@@ -89,6 +95,8 @@ private:
|
|||||||
|
|
||||||
QAction* m_exportGraphAction;
|
QAction* m_exportGraphAction;
|
||||||
QAction* m_copyNodeNameAction;
|
QAction* m_copyNodeNameAction;
|
||||||
|
QAction* m_hideNodeAction;
|
||||||
|
QAction* m_hideEdgeAction;
|
||||||
QAction* m_bookmarkNodeAction;
|
QAction* m_bookmarkNodeAction;
|
||||||
|
|
||||||
QPushButton* m_zoomState;
|
QPushButton* m_zoomState;
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ void QtContextMenu::addFileActions(FilePath filePath)
|
|||||||
{
|
{
|
||||||
s_filePath = filePath;
|
s_filePath = filePath;
|
||||||
|
|
||||||
|
s_copyFullPathAction->setEnabled(!s_filePath.empty());
|
||||||
|
s_openContainingFolderAction->setEnabled(!s_filePath.empty());
|
||||||
|
|
||||||
addAction(s_copyFullPathAction);
|
addAction(s_copyFullPathAction);
|
||||||
addAction(s_openContainingFolderAction);
|
addAction(s_openContainingFolderAction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "utility/messaging/type/MessageFocusIn.h"
|
#include "utility/messaging/type/MessageFocusIn.h"
|
||||||
#include "utility/messaging/type/MessageFocusOut.h"
|
#include "utility/messaging/type/MessageFocusOut.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||||
|
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||||
#include "utility/messaging/type/MessageTooltipShow.h"
|
#include "utility/messaging/type/MessageTooltipShow.h"
|
||||||
#include "utility/messaging/type/MessageTooltipHide.h"
|
#include "utility/messaging/type/MessageTooltipHide.h"
|
||||||
#include "utility/utility.h"
|
#include "utility/utility.h"
|
||||||
@@ -80,6 +81,16 @@ QtGraphNode* QtGraphEdge::getTarget()
|
|||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id QtGraphEdge::getTokenId() const
|
||||||
|
{
|
||||||
|
if (getData())
|
||||||
|
{
|
||||||
|
return getData()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QtGraphEdge::updateLine()
|
void QtGraphEdge::updateLine()
|
||||||
{
|
{
|
||||||
QtGraphNode* owner = m_owner;
|
QtGraphNode* owner = m_owner;
|
||||||
@@ -269,6 +280,16 @@ void QtGraphEdge::onClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtGraphEdge::onHide()
|
||||||
|
{
|
||||||
|
Id tokenId = getTokenId();
|
||||||
|
|
||||||
|
if (tokenId)
|
||||||
|
{
|
||||||
|
MessageGraphNodeHide(tokenId).dispatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QtGraphEdge::focusIn()
|
void QtGraphEdge::focusIn()
|
||||||
{
|
{
|
||||||
if (!m_isFocused)
|
if (!m_isFocused)
|
||||||
@@ -328,7 +349,14 @@ void QtGraphEdge::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
|
|||||||
{
|
{
|
||||||
if (!m_mouseMoved)
|
if (!m_mouseMoved)
|
||||||
{
|
{
|
||||||
this->onClick();
|
if (event->modifiers() & Qt::AltModifier)
|
||||||
|
{
|
||||||
|
this->onHide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->onClick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public:
|
|||||||
QtGraphNode* getOwner();
|
QtGraphNode* getOwner();
|
||||||
QtGraphNode* getTarget();
|
QtGraphNode* getTarget();
|
||||||
|
|
||||||
|
Id getTokenId() const;
|
||||||
|
|
||||||
void updateLine();
|
void updateLine();
|
||||||
|
|
||||||
bool getIsActive() const;
|
bool getIsActive() const;
|
||||||
@@ -44,6 +46,7 @@ public:
|
|||||||
void setIsFocused(bool isFocused);
|
void setIsFocused(bool isFocused);
|
||||||
|
|
||||||
void onClick();
|
void onClick();
|
||||||
|
void onHide();
|
||||||
|
|
||||||
void focusIn();
|
void focusIn();
|
||||||
void focusOut();
|
void focusOut();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "qt/utility/utilityQt.h"
|
#include "qt/utility/utilityQt.h"
|
||||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
|
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
|
||||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||||
|
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||||
#include "utility/ResourcePaths.h"
|
#include "utility/ResourcePaths.h"
|
||||||
#include "utility/utilityString.h"
|
#include "utility/utilityString.h"
|
||||||
|
|
||||||
@@ -345,6 +346,20 @@ void QtGraphNode::onClick()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtGraphNode::onHide()
|
||||||
|
{
|
||||||
|
Id tokenId = getTokenId();
|
||||||
|
|
||||||
|
if (tokenId)
|
||||||
|
{
|
||||||
|
MessageGraphNodeHide(tokenId).dispatch();
|
||||||
|
}
|
||||||
|
else if (getParent())
|
||||||
|
{
|
||||||
|
getParent()->onHide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QtGraphNode::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
void QtGraphNode::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ public:
|
|||||||
virtual void addSubNode(QtGraphNode* node);
|
virtual void addSubNode(QtGraphNode* node);
|
||||||
|
|
||||||
virtual void onClick();
|
virtual void onClick();
|
||||||
|
virtual void onHide();
|
||||||
virtual void moved(const Vec2i& oldPosition);
|
virtual void moved(const Vec2i& oldPosition);
|
||||||
|
|
||||||
virtual void updateStyle() = 0;
|
virtual void updateStyle() = 0;
|
||||||
|
|||||||
@@ -35,7 +35,14 @@ void QtGraphNodeComponentClickable::nodeMouseReleaseEvent(QGraphicsSceneMouseEve
|
|||||||
{
|
{
|
||||||
if (!m_mouseMoved)
|
if (!m_mouseMoved)
|
||||||
{
|
{
|
||||||
m_graphNode->onClick();
|
if (event->modifiers() & Qt::AltModifier)
|
||||||
|
{
|
||||||
|
m_graphNode->onHide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_graphNode->onClick();
|
||||||
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user