ui: Layout template specializations vertically

* use closed arrow for template specialization edges
* no specialization edges in call graph
This commit is contained in:
Eberhard Graether
2018-04-05 21:48:45 +02:00
parent e1a7141352
commit f79e50d529
7 changed files with 31 additions and 9 deletions
@@ -185,7 +185,7 @@ void GraphController::handleMessage(MessageActivateTrail* message)
MessageStatus(L"Layouting depth graph", false, true).dispatch();
if (message->trailType == Edge::EDGE_INHERITANCE)
if (message->trailType & Edge::EDGE_INHERITANCE)
{
groupTrailNodes(NodeType::GROUP_INHERITANCE);
}
@@ -922,7 +922,7 @@ void GraphController::bundleNodes()
return;
}
if (e->isType(Edge::EDGE_INHERITANCE | Edge::EDGE_OVERRIDE))
if (e->isType(Edge::LAYOUT_VERTICAL))
{
bundleInfo->layoutVertical = true;
bundleInfo->isReferenced = false;
@@ -1067,6 +1067,16 @@ void GraphController::bundleNodes()
L"Referenced Symbols"
);
bundleNodesAndEdgesMatching(
[](const DummyNode::BundleInfo& info, const Node* data)
{
return info.isReferencing && info.layoutVertical && data->findEdgeOfType(Edge::EDGE_TEMPLATE_SPECIALIZATION);
},
5,
false,
L"Specializing Symbols"
);
bundleNodesAndEdgesMatching(
[](const DummyNode::BundleInfo& info, const Node* data)
{
@@ -683,7 +683,7 @@ void TrailLayouter::addEdge(const std::shared_ptr<DummyEdge> dummyEdge, const st
Id originTopLevelId = topLevelAncestorIds.find(dummyEdge->ownerId)->second;
Id targetTopLevelId = topLevelAncestorIds.find(dummyEdge->targetId)->second;
if (dummyEdge->data->isType(Edge::EDGE_OVERRIDE | Edge::EDGE_INHERITANCE) != invertedLayout())
if (dummyEdge->data->isType(Edge::LAYOUT_VERTICAL) != invertedLayout())
{
std::swap(originTopLevelId, targetTopLevelId);
}
@@ -654,6 +654,15 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(
style.zValue = isActive ? 2 : -20;
}
break;
case Edge::EDGE_TEMPLATE_SPECIALIZATION:
style.zValue = isActive ? 2 : -3;
case Edge::EDGE_TEMPLATE_MEMBER_SPECIALIZATION:
style.arrowLength = 10;
style.arrowWidth = 13;
style.arrowClosed = true;
break;
case Edge::EDGE_INCLUDE:
style.zValue = isActive ? 2 : -3;
default:
+3
View File
@@ -36,6 +36,9 @@ public:
static int typeToInt(EdgeType type);
static EdgeType intToType(int value);
static const TypeMask LAYOUT_VERTICAL = EDGE_INHERITANCE | EDGE_OVERRIDE | EDGE_TEMPLATE_SPECIALIZATION |
EDGE_TEMPLATE_MEMBER_SPECIALIZATION;
Edge(Id id, EdgeType type, Node* from, Node* to);
Edge(const Edge& other, Node* from, Node* to);
virtual ~Edge();
+2 -2
View File
@@ -1080,7 +1080,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForTrail(
m_sqliteIndexStorage.getEdgesBySourceIds(nodeIdsToProcess) :
m_sqliteIndexStorage.getEdgesByTargetIds(nodeIdsToProcess);
if (trailType & (Edge::EDGE_OVERRIDE | Edge::EDGE_INHERITANCE))
if (trailType & Edge::LAYOUT_VERTICAL)
{
utility::append(edges,
forward ?
@@ -1095,7 +1095,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForTrail(
{
if (Edge::intToType(edge.type) & trailType)
{
bool isForward = forward == !(Edge::intToType(edge.type) & (Edge::EDGE_OVERRIDE | Edge::EDGE_INHERITANCE));
bool isForward = forward == !(Edge::intToType(edge.type) & Edge::LAYOUT_VERTICAL);
const Id nodeId = isForward ? edge.targetNodeId : edge.sourceNodeId;
const Id otherNodeId = isForward ? edge.sourceNodeId : edge.targetNodeId;
+2 -3
View File
@@ -669,13 +669,12 @@ MessageActivateTrail QtGraphView::getMessageActivateTrail(bool forward)
if (node->getData()->getType().isInheritable())
{
trailType = Edge::EDGE_INHERITANCE;
trailType = Edge::EDGE_INHERITANCE | Edge::EDGE_TEMPLATE_SPECIALIZATION;
horizontalLayout = false;
}
else if (node->getData()->getType().isCallable())
{
trailType = Edge::EDGE_CALL | Edge::EDGE_OVERRIDE |
Edge::EDGE_TEMPLATE_SPECIALIZATION | Edge::EDGE_TEMPLATE_MEMBER_SPECIALIZATION;
trailType = Edge::EDGE_CALL | Edge::EDGE_OVERRIDE;
horizontalLayout = true;
}
else if (node->getData()->getType().isFile())
@@ -184,7 +184,8 @@ void QtGraphEdge::updateLine()
}
}
if (type == Edge::EDGE_INHERITANCE)
if (type == Edge::EDGE_INHERITANCE || (type == Edge::EDGE_TEMPLATE_SPECIALIZATION &&
owner == owner->getLastParent() && target == target->getLastParent()))
{
child->setRoute(QtLineItemBase::ROUTE_VERTICAL);