diff --git a/bin/app/data/color_schemes/bad_rainbow.xml b/bin/app/data/color_schemes/bad_rainbow.xml
index 15a92e60..cf55fcb3 100644
--- a/bin/app/data/color_schemes/bad_rainbow.xml
+++ b/bin/app/data/color_schemes/bad_rainbow.xml
@@ -378,6 +378,14 @@
#FFFFFF
+
+
+ transparent
+
+
+ white
+
+
diff --git a/bin/app/data/color_schemes/bright.xml b/bin/app/data/color_schemes/bright.xml
index 15a48e3a..05980902 100644
--- a/bin/app/data/color_schemes/bright.xml
+++ b/bin/app/data/color_schemes/bright.xml
@@ -349,6 +349,14 @@
black
+
+
+ transparent
+
+
+ black
+
+
diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml
index 22242c3d..1b822ba6 100644
--- a/bin/app/data/color_schemes/dark.xml
+++ b/bin/app/data/color_schemes/dark.xml
@@ -352,6 +352,14 @@
#F7F7F7
+
+
+ transparent
+
+
+ white
+
+
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 2e03cf81..73e8fe2b 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -2,12 +2,12 @@
add_files(
LIB_FILES
- component/controller/helper/BucketGrid.cpp
- component/controller/helper/BucketGrid.h
+ component/controller/helper/BucketLayouter.cpp
+ component/controller/helper/BucketLayouter.h
component/controller/helper/DummyEdge.h
component/controller/helper/DummyNode.h
- component/controller/helper/GraphPostprocessor.cpp
- component/controller/helper/GraphPostprocessor.h
+ component/controller/helper/ListLayouter.cpp
+ component/controller/helper/ListLayouter.h
component/controller/helper/NetworkProtocolHelper.cpp
component/controller/helper/NetworkProtocolHelper.h
component/controller/helper/SnippetMerger.cpp
@@ -362,7 +362,7 @@ add_files(
utility/text/TextAccess.cpp
utility/text/TextAccess.h
-
+
utility/ApplicationArchitectureType.h
utility/AppPath.cpp
utility/AppPath.h
diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp
index b77db5cb..e8732fb0 100644
--- a/src/lib/component/controller/GraphController.cpp
+++ b/src/lib/component/controller/GraphController.cpp
@@ -7,7 +7,8 @@
#include "utility/utility.h"
#include "utility/utilityString.h"
-#include "component/controller/helper/BucketGrid.h"
+#include "component/controller/helper/BucketLayouter.h"
+#include "component/controller/helper/ListLayouter.h"
#include "component/view/GraphView.h"
#include "component/view/GraphViewStyle.h"
#include "data/access/StorageAccess.h"
@@ -72,20 +73,30 @@ void GraphController::handleMessage(MessageActivateTokens* message)
std::vector tokenIds = utility::concat(m_activeNodeIds, m_activeEdgeIds);
- std::shared_ptr graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds);
+ bool isNamespace = false;
+ std::shared_ptr graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds, &isNamespace);
createDummyGraphForTokenIdsAndSetActiveAndVisibility(tokenIds, graph);
- if (m_activeNodeIds.size() == 1)
+ if (isNamespace)
{
- bundleNodes();
+ addCharacterIndex();
+ layoutNesting();
+ layoutList();
+ }
+ else
+ {
+ if (m_activeNodeIds.size() == 1)
+ {
+ bundleNodes();
+ }
+
+ layoutNesting();
+ layoutGraph(true);
+ assignBundleIds();
}
- layoutNesting();
- layoutGraph(true);
- assignBundleIds();
-
- buildGraph(message, true);
+ buildGraph(message, !isNamespace, true, isNamespace);
}
void GraphController::handleMessage(MessageFlushUpdates* message)
@@ -115,8 +126,16 @@ void GraphController::handleMessage(MessageGraphNodeBundleSplit* message)
DummyNode* node = m_dummyNodes[i].get();
if (node->isBundleNode() && node->tokenId == message->bundleId)
{
- m_dummyNodes.insert(m_dummyNodes.begin() + i + 1, node->bundledNodes.begin(), node->bundledNodes.end());
- m_dummyNodes.erase(m_dummyNodes.begin() + i);
+ if (message->removeOtherNodes)
+ {
+ std::vector> nodes(node->bundledNodes.begin(), node->bundledNodes.end());
+ m_dummyNodes = nodes;
+ }
+ else
+ {
+ m_dummyNodes.insert(m_dummyNodes.begin() + i + 1, node->bundledNodes.begin(), node->bundledNodes.end());
+ m_dummyNodes.erase(m_dummyNodes.begin() + i);
+ }
break;
}
}
@@ -134,10 +153,19 @@ void GraphController::handleMessage(MessageGraphNodeBundleSplit* message)
std::vector tokenIds = utility::concat(m_activeNodeIds, m_activeEdgeIds);
setActiveAndVisibility(tokenIds);
- layoutNesting();
- layoutGraph();
+ if (message->layoutToList)
+ {
+ addCharacterIndex();
+ layoutNesting();
+ layoutList();
+ }
+ else
+ {
+ layoutNesting();
+ layoutGraph();
+ }
- buildGraph(message, false);
+ buildGraph(message, false, true, message->layoutToList);
}
void GraphController::handleMessage(MessageGraphNodeExpand* message)
@@ -942,6 +970,7 @@ void GraphController::bundleByType(
if (bundleNode)
{
+ bundleNode->bundledNodeType = type;
m_dummyNodes.push_back(bundleNode);
}
}
@@ -959,9 +988,13 @@ void GraphController::bundleNodesByType()
nodes.push_back(oldNodes[i]);
}
+ bundleByType(nodes, Node::NODE_FILE, "Files");
+ bundleByType(nodes, Node::NODE_MACRO, "Macros");
+
bundleByType(nodes, Node::NODE_NAMESPACE, "Namespaces");
bundleByType(nodes, Node::NODE_PACKAGE, "Packages");
- bundleByType(nodes, Node::NODE_BUILTIN_TYPE, "Built-in Types");
+
+ // bundleByType(nodes, Node::NODE_BUILTIN_TYPE, "Built-in Types");
bundleByType(nodes, Node::NODE_CLASS, "Classes");
bundleByType(nodes, Node::NODE_INTERFACE, "Interfaces");
bundleByType(nodes, Node::NODE_STRUCT, "Structs");
@@ -973,9 +1006,6 @@ void GraphController::bundleNodesByType()
bundleByType(nodes, Node::NODE_TYPEDEF, "Typedefs");
bundleByType(nodes, Node::NODE_ENUM, "Enums");
- bundleByType(nodes, Node::NODE_FILE, "Files");
- bundleByType(nodes, Node::NODE_MACRO, "Macros");
-
// // should never be visible
bundleByType(nodes, Node::NODE_METHOD, "Methods");
@@ -1022,6 +1052,7 @@ void GraphController::bundleNodesByType()
if (anonymousBundle)
{
+ anonymousBundle->bundledNodeType = Node::NODE_NAMESPACE;
bundleNode->bundledNodeCount = bundleNode->getBundledNodeCount() + anonymousBundle->getBundledNodeCount();
bundleNode->bundledNodes.insert(anonymousBundle);
}
@@ -1029,6 +1060,43 @@ void GraphController::bundleNodesByType()
}
}
+void GraphController::addCharacterIndex()
+{
+ // Remove index characters from last time
+ DummyNode::BundledNodesSet newNodes;
+ for (const std::shared_ptr node : m_dummyNodes)
+ {
+ if (!node->isTextNode())
+ {
+ newNodes.insert(node);
+ }
+ }
+ m_dummyNodes.clear();
+ m_dummyNodes.insert(m_dummyNodes.end(), newNodes.begin(), newNodes.end());
+
+ // Add index characters
+ char character = 0;
+ for (size_t i = 0; i < m_dummyNodes.size(); i++)
+ {
+ if (!m_dummyNodes[i]->name.size())
+ {
+ continue;
+ }
+
+ if (toupper(m_dummyNodes[i]->name[0]) != character)
+ {
+ character = toupper(m_dummyNodes[i]->name[0]);
+
+ std::shared_ptr textNode = std::make_shared();
+ textNode->textNode = true;
+ textNode->name = character;
+ textNode->visible = true;
+
+ m_dummyNodes.insert(m_dummyNodes.begin() + i, textNode);
+ }
+ }
+}
+
void GraphController::layoutNesting()
{
TRACE();
@@ -1067,12 +1135,23 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
}
else if (node->isBundleNode())
{
- margins = GraphViewStyle::getMarginsOfBundleNode();
+ if (node->bundledNodeType != Node::NODE_UNDEFINED)
+ {
+ margins = GraphViewStyle::getMarginsForNodeType(node->bundledNodeType, false);
+ }
+ else
+ {
+ margins = GraphViewStyle::getMarginsOfBundleNode();
+ }
}
else if (node->isQualifierNode())
{
return;
}
+ else if (node->isTextNode())
+ {
+ margins = GraphViewStyle::getMarginsOfTextNode();
+ }
int y = 0;
int x = 0;
@@ -1277,7 +1356,7 @@ void GraphController::layoutGraph(bool getSortedNodes)
{
TRACE();
- BucketGrid grid(getView()->getViewSize());
+ BucketLayouter grid(getView()->getViewSize());
grid.createBuckets(m_dummyNodes, m_dummyEdges);
grid.layoutBuckets();
@@ -1287,6 +1366,14 @@ void GraphController::layoutGraph(bool getSortedNodes)
}
}
+void GraphController::layoutList()
+{
+ TRACE();
+
+ ListLayouter layouter(getView()->getViewSize());
+ layouter.layoutList(m_dummyNodes);
+}
+
void GraphController::assignBundleIds()
{
Id bundleId = 0;
@@ -1307,13 +1394,15 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
return nullptr;
}
-void GraphController::buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition)
+void GraphController::buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition, bool scrollToTop)
{
if (!message->isReplayed())
{
GraphView::GraphParams params;
params.centerActiveNode = centerActiveNode;
params.animatedTransition = animatedTransition;
+ params.scrollToTop = scrollToTop;
+ params.isIndexedList = scrollToTop;
getView()->rebuildGraph(m_graph, m_dummyNodes, m_dummyEdges, params);
}
@@ -1591,7 +1680,7 @@ void GraphController::handleMessage(MessageColorSchemeTest* message)
node->layoutBucket.y = (i / 6) + 1;
}
- BucketGrid grid(Vec2i(0, 0));
+ BucketLayouter grid(Vec2i(0, 0));
grid.createBuckets(m_dummyNodes, std::vector>());
grid.layoutBuckets();
diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h
index 135ba7fe..4e42229a 100644
--- a/src/lib/component/controller/GraphController.h
+++ b/src/lib/component/controller/GraphController.h
@@ -83,22 +83,28 @@ private:
void setNodeVisibilityRecursiveTopDown(DummyNode* node, bool parentExpanded) const;
void bundleNodes();
- void bundleNodesAndEdgesMatching(std::function matcher, size_t count, const std::string& name);
- std::shared_ptr bundleNodesMatching(std::list>& nodes, std::function matcher, const std::string& name);
+ void bundleNodesAndEdgesMatching(
+ std::function matcher, size_t count, const std::string& name);
+ std::shared_ptr bundleNodesMatching(
+ std::list>& nodes, std::function matcher, const std::string& name);
void bundleByType(std::list>& nodes, Node::NodeType type, const std::string& name);
void bundleNodesByType();
+ void addCharacterIndex();
+
void layoutNesting();
void layoutNestingRecursive(DummyNode* node) const;
void addExpandToggleNode(DummyNode* node) const;
void layoutToGrid(DummyNode* node) const;
void layoutGraph(bool getSortedNodes = false);
+ void layoutList();
+
void assignBundleIds();
DummyNode* getDummyGraphNodeById(Id tokenId) const;
- void buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition = true);
+ void buildGraph(MessageBase* message, bool centerActiveNode, bool animatedTransition = true, bool scrollToTop = false);
void forEachDummyNodeRecursive(std::function func);
void forEachDummyEdge(std::function func);
diff --git a/src/lib/component/controller/helper/BucketGrid.cpp b/src/lib/component/controller/helper/BucketLayouter.cpp
similarity index 91%
rename from src/lib/component/controller/helper/BucketGrid.cpp
rename to src/lib/component/controller/helper/BucketLayouter.cpp
index 335161f9..18a8bc48 100644
--- a/src/lib/component/controller/helper/BucketGrid.cpp
+++ b/src/lib/component/controller/helper/BucketLayouter.cpp
@@ -1,4 +1,4 @@
-#include "component/controller/helper/BucketGrid.h"
+#include "component/controller/helper/BucketLayouter.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/view/GraphViewStyle.h"
@@ -101,7 +101,7 @@ void Bucket::layout(int x, int y, int width, int height)
}
-BucketGrid::BucketGrid(Vec2i viewSize)
+BucketLayouter::BucketLayouter(Vec2i viewSize)
: m_viewSize(viewSize)
, m_i1(0)
, m_j1(0)
@@ -111,7 +111,7 @@ BucketGrid::BucketGrid(Vec2i viewSize)
m_buckets[0][0] = Bucket(0, 0);
}
-void BucketGrid::createBuckets(
+void BucketLayouter::createBuckets(
std::vector>& nodes, const std::vector>& edges
){
if (!nodes.size())
@@ -194,7 +194,7 @@ void BucketGrid::createBuckets(
}
}
-void BucketGrid::layoutBuckets()
+void BucketLayouter::layoutBuckets()
{
std::map widths;
std::map heights;
@@ -245,7 +245,7 @@ void BucketGrid::layoutBuckets()
}
}
-std::vector> BucketGrid::getSortedNodes()
+std::vector> BucketLayouter::getSortedNodes()
{
std::vector> sortedNodes;
@@ -261,7 +261,7 @@ std::vector> BucketGrid::getSortedNodes()
return sortedNodes;
}
-std::shared_ptr BucketGrid::findTopMostDummyNodeRecursive(
+std::shared_ptr BucketLayouter::findTopMostDummyNodeRecursive(
std::vector>& nodes, Id tokenId, std::shared_ptr top
){
for (std::shared_ptr node : nodes)
@@ -283,13 +283,13 @@ std::shared_ptr BucketGrid::findTopMostDummyNodeRecursive(
return nullptr;
}
-void BucketGrid::addNode(std::shared_ptr node)
+void BucketLayouter::addNode(std::shared_ptr node)
{
Bucket* bucket = getBucket(node->layoutBucket.x, node->layoutBucket.y);
bucket->addNode(node);
}
-bool BucketGrid::addNode(std::shared_ptr owner, std::shared_ptr target, bool horizontal)
+bool BucketLayouter::addNode(std::shared_ptr owner, std::shared_ptr target, bool horizontal)
{
Bucket* ownerBucket = getBucket(owner);
Bucket* targetBucket = getBucket(target);
@@ -324,7 +324,7 @@ bool BucketGrid::addNode(std::shared_ptr owner, std::shared_ptr node)
+Bucket* BucketLayouter::getBucket(std::shared_ptr node)
{
for (int j = m_j1; j <= m_j2; j++)
{
diff --git a/src/lib/component/controller/helper/BucketGrid.h b/src/lib/component/controller/helper/BucketLayouter.h
similarity index 91%
rename from src/lib/component/controller/helper/BucketGrid.h
rename to src/lib/component/controller/helper/BucketLayouter.h
index ebc5020c..5bf19792 100644
--- a/src/lib/component/controller/helper/BucketGrid.h
+++ b/src/lib/component/controller/helper/BucketLayouter.h
@@ -1,5 +1,5 @@
-#ifndef BUCKET_GRID_H
-#define BUCKET_GRID_H
+#ifndef BUCKET_LAYOUTER_H
+#define BUCKET_LAYOUTER_H
#include