ui: redesigned graph overview and use new list layouting within overview bundles

* overview bundles imitate style of bundled node type
* removed bundle for built-in types
* show contents of overview bundle in vertical list layouted with new ListLayouter
* nodes starting with the same letter are grouped with the letter displayed above
* pressing the letter key will scroll to the group
* also use this list layouting for namespace & package contents
* renamed BucketGrid to BucketLayouter
* moved used functions of GraphPostProcessor to GraphViewStyle and removed GraphPostProcessor

fortune cookie message = Don't be afraid to take that big step
This commit is contained in:
Eberhard Graether
2017-02-02 13:29:40 +01:00
parent 993d66727d
commit 52b0cd2017
34 changed files with 577 additions and 578 deletions
+83
View File
@@ -23,6 +23,53 @@ float GraphViewStyle::s_zoomFactor;
std::map<std::string, GraphViewStyle::NodeColor> GraphViewStyle::s_nodeColors;
std::map<std::string, std::string> GraphViewStyle::s_edgeColors;
Vec2i GraphViewStyle::alignOnRaster(Vec2i position)
{
int rasterPosDivisor = s_gridCellSize + s_gridCellPadding;
if (position.x % rasterPosDivisor != 0)
{
int t = position.x / rasterPosDivisor;
int r = position.x % rasterPosDivisor;
if (std::abs(r) > rasterPosDivisor/2)
{
if (t != 0)
{
t += (t / std::abs(t));
}
else if (r != 0)
{
t += (r / std::abs(r));
}
}
position.x = t * rasterPosDivisor;
}
if (position.y % rasterPosDivisor != 0)
{
int t = position.y / rasterPosDivisor;
int r = position.y % rasterPosDivisor;
if (std::abs(r) > rasterPosDivisor/2)
{
if(t != 0)
{
t += (t / std::abs(t));
}
else if(r != 0)
{
t += (r / std::abs(r));
}
}
position.y = t * rasterPosDivisor;
}
return position;
}
GraphViewStyle::NodeMargins::NodeMargins()
: left(0)
, right(0)
@@ -176,6 +223,11 @@ size_t GraphViewStyle::getFontSizeOfQualifier()
return s_fontSize - 3;
}
size_t GraphViewStyle::getFontSizeOfTextNode()
{
return s_fontSize + 5;
}
std::string GraphViewStyle::getFontNameForNodeType(Node::NodeType type)
{
return s_fontName;
@@ -191,6 +243,11 @@ std::string GraphViewStyle::getFontNameOfExpandToggleNode()
return "Fira Sans";
}
std::string GraphViewStyle::getFontNameOfTextNode()
{
return "Fira Sans";
}
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType type, bool hasChildren)
{
NodeMargins margins;
@@ -308,6 +365,17 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfBundleNode()
return getMarginsForNodeType(Node::NODE_ENUM, false);
}
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfTextNode()
{
NodeMargins margins;
margins.left = margins.right = 0;
margins.top = margins.bottom = 6;
margins.minWidth = margins.charHeight = getFontSizeOfTextNode();
return margins;
}
GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
Node::NodeType type, bool defined, bool isActive, bool isFocused, bool hasChildren, bool hasQualifier
){
@@ -463,6 +531,21 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfQualifier()
return style;
}
GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfTextNode()
{
NodeStyle style;
style.color = getNodeColor("text", false);
style.fontName = getFontNameOfTextNode();
style.fontSize = getFontSizeOfTextNode();
style.fontBold = true;
style.textOffset.y = 10;
return style;
}
GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType type, bool isActive, bool isFocused)
{
EdgeStyle style;