GP-769 - Function Graph - added option to not used dimming for return flow edges

This commit is contained in:
dragonmacher 2021-03-12 15:26:35 -05:00
parent f2e702d1b2
commit e19d59cac7
5 changed files with 103 additions and 62 deletions

View file

@ -840,6 +840,22 @@
location when zooming from the middle-mouse. The default for this option is off, which
triggers zoom to work from the center of the graph, regardless of the mouse location.</P>
<P>The <B>View Settings</B> option describes how the graph will be zoomed when it is first
loaded. The values are:</P>
<UL>
<LI><B>Start Fully Zoomed Out</B> - always start fully zoomed out so that the entire
graph can be seen.</LI>
<LI><B>Start Fully Zoomed In/B> - always start fully zoomed in on the vertex containing
the current location.</LI>
<LI><B>Remember User Settings</B> - keep the zoom level where the user previously left
it.</LI>
</UL>
<BR>
<BR>
<P>There are various edge color and highlight color options available to change. The
highlight colors are those to be used when the flow animations take place.</P>
</BLOCKQUOTE>

View file

@ -50,6 +50,13 @@
</P>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>Use Dim Return Edges</B> option makes default code block return flow edges
lighter than conditional edges. This makes it easier for users to scan the
graph and ignore return flows.
</P>
</BLOCKQUOTE>
</BLOCKQUOTE>

View file

@ -185,8 +185,8 @@ public class FunctionGraphOptions extends VisualGraphOptions {
options.registerOption(SCROLL_WHEEL_PANS_KEY, getScrollWheelPans(), help,
SCROLL_WHEEL_PANS_DESCRIPTION);
options.registerOption(GRAPH_BACKGROUND_COLOR_KEY, DEFAULT_GRAPH_BACKGROUND_COLOR,
help, GRAPH_BACKGROUND_COLOR_DESCRPTION);
options.registerOption(GRAPH_BACKGROUND_COLOR_KEY, DEFAULT_GRAPH_BACKGROUND_COLOR, help,
GRAPH_BACKGROUND_COLOR_DESCRPTION);
options.registerOption(DEFAULT_VERTEX_BACKGROUND_COLOR_KEY, DEFAULT_VERTEX_BACKGROUND_COLOR,
help, DEFAULT_VERTEX_BACKGROUND_COLOR_DESCRPTION);

View file

@ -31,7 +31,12 @@ public class DNLayoutOptions implements FGLayoutOptions {
"edges should be routed around any intersecting vertex. When toggled off, edges will " +
"pass through any intersecting vertices.";
private static final String DIM_RETURN_EDGES_KEY = "Use Dim Return Edges";
private static final String DIM_RETURN_EDGES_DESCRIPTION =
"Signals to lighten the default return edges.";
private boolean useEdgeRoutingAroundVertices;
private boolean useDimmedReturnEdges = true;
@Override
public void registerOptions(Options options) {
@ -40,21 +45,32 @@ public class DNLayoutOptions implements FGLayoutOptions {
options.registerOption(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices,
help, USE_EDGE_ROUTING_AROUND_VERTICES_DESCRIPTION);
options.registerOption(DIM_RETURN_EDGES_KEY, useDimmedReturnEdges, help,
DIM_RETURN_EDGES_DESCRIPTION);
}
@Override
public void loadOptions(Options options) {
useEdgeRoutingAroundVertices =
options.getBoolean(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices);
useDimmedReturnEdges = options.getBoolean(DIM_RETURN_EDGES_KEY, useDimmedReturnEdges);
}
public boolean useEdgeRoutingAroundVertices() {
return useEdgeRoutingAroundVertices;
}
public boolean useDimmedReturnEdges() {
return useDimmedReturnEdges;
}
@Override
public boolean optionChangeRequiresRelayout(String optionName) {
// format: 'Nested Code Layout.Route Edges....'
return optionName.endsWith(USE_EDGE_ROUTING_AROUND_VERTICES_KEY);
return optionName.endsWith(USE_EDGE_ROUTING_AROUND_VERTICES_KEY) ||
optionName.endsWith(DIM_RETURN_EDGES_KEY);
}
}

View file

@ -733,6 +733,10 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
private void lighten(FGEdge e) {
if (!getLayoutOptions().useDimmedReturnEdges()) {
return;
}
// assumption: edges that move to the left in this layout are return flows that happen
// after the code block has been executed. We dim those a bit so that they
// produce less clutter.
@ -840,8 +844,11 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
BlockCopy copy = (BlockCopy) child;
StringBuilder buffy = new StringBuilder();
buffy.append(printDepth(depth, depth + 1)).append(' ').append(ID).append(
" plain - ").append(copy.getRef());
buffy.append(printDepth(depth, depth + 1))
.append(' ')
.append(ID)
.append(" plain - ")
.append(copy.getRef());
debug(buffy.toString());
}
@ -1207,8 +1214,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
int row = startRow;
for (int i = 0; i < allChildren.size(); i++) {
DecompilerBlock block = allChildren.get(i);
for (DecompilerBlock block : allChildren) {
if (block instanceof DecompilerBlockGraph) {
row = ((DecompilerBlockGraph) block).setRows(row);
}
@ -1229,8 +1235,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
String getChildrenString(int depth) {
StringBuilder buffy = new StringBuilder();
int childCount = 0;
for (int i = 0; i < allChildren.size(); i++) {
DecompilerBlock block = allChildren.get(i);
for (DecompilerBlock block : allChildren) {
if (block instanceof DecompilerBlockGraph) {
String blockName = block.getName();
@ -1447,9 +1452,8 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
// The 'list' structure for children's nesting:
// -all nodes are at the same level
//
for (int i = 0; i < allChildren.size(); i++) {
for (DecompilerBlock block : allChildren) {
int column = col;
DecompilerBlock block = allChildren.get(i);
block.setCol(column);
}
@ -1477,8 +1481,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
// -each successive condition is another level nested
//
int column = col;
for (int i = 0; i < allChildren.size(); i++) {
DecompilerBlock block = allChildren.get(i);
for (DecompilerBlock block : allChildren) {
block.setCol(column);
column++;
}
@ -1518,8 +1521,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
// -all blocks nested
//
int column = col + 1;
for (int i = 0; i < allChildren.size(); i++) {
DecompilerBlock block = allChildren.get(i);
for (DecompilerBlock block : allChildren) {
block.setCol(column);
}