mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-769 - Function Graph - added option to not used dimming for return flow edges
This commit is contained in:
parent
f2e702d1b2
commit
e19d59cac7
5 changed files with 103 additions and 62 deletions
|
@ -840,6 +840,22 @@
|
||||||
location when zooming from the middle-mouse. The default for this option is off, which
|
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>
|
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
|
<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>
|
highlight colors are those to be used when the flow animations take place.</P>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
|
@ -50,6 +50,13 @@
|
||||||
</P>
|
</P>
|
||||||
</BLOCKQUOTE>
|
</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>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -185,8 +185,8 @@ public class FunctionGraphOptions extends VisualGraphOptions {
|
||||||
options.registerOption(SCROLL_WHEEL_PANS_KEY, getScrollWheelPans(), help,
|
options.registerOption(SCROLL_WHEEL_PANS_KEY, getScrollWheelPans(), help,
|
||||||
SCROLL_WHEEL_PANS_DESCRIPTION);
|
SCROLL_WHEEL_PANS_DESCRIPTION);
|
||||||
|
|
||||||
options.registerOption(GRAPH_BACKGROUND_COLOR_KEY, DEFAULT_GRAPH_BACKGROUND_COLOR,
|
options.registerOption(GRAPH_BACKGROUND_COLOR_KEY, DEFAULT_GRAPH_BACKGROUND_COLOR, help,
|
||||||
help, GRAPH_BACKGROUND_COLOR_DESCRPTION);
|
GRAPH_BACKGROUND_COLOR_DESCRPTION);
|
||||||
|
|
||||||
options.registerOption(DEFAULT_VERTEX_BACKGROUND_COLOR_KEY, DEFAULT_VERTEX_BACKGROUND_COLOR,
|
options.registerOption(DEFAULT_VERTEX_BACKGROUND_COLOR_KEY, DEFAULT_VERTEX_BACKGROUND_COLOR,
|
||||||
help, DEFAULT_VERTEX_BACKGROUND_COLOR_DESCRPTION);
|
help, DEFAULT_VERTEX_BACKGROUND_COLOR_DESCRPTION);
|
||||||
|
|
|
@ -31,7 +31,12 @@ public class DNLayoutOptions implements FGLayoutOptions {
|
||||||
"edges should be routed around any intersecting vertex. When toggled off, edges will " +
|
"edges should be routed around any intersecting vertex. When toggled off, edges will " +
|
||||||
"pass through any intersecting vertices.";
|
"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 useEdgeRoutingAroundVertices;
|
||||||
|
private boolean useDimmedReturnEdges = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerOptions(Options options) {
|
public void registerOptions(Options options) {
|
||||||
|
@ -40,21 +45,32 @@ public class DNLayoutOptions implements FGLayoutOptions {
|
||||||
|
|
||||||
options.registerOption(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices,
|
options.registerOption(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices,
|
||||||
help, USE_EDGE_ROUTING_AROUND_VERTICES_DESCRIPTION);
|
help, USE_EDGE_ROUTING_AROUND_VERTICES_DESCRIPTION);
|
||||||
|
|
||||||
|
options.registerOption(DIM_RETURN_EDGES_KEY, useDimmedReturnEdges, help,
|
||||||
|
DIM_RETURN_EDGES_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadOptions(Options options) {
|
public void loadOptions(Options options) {
|
||||||
useEdgeRoutingAroundVertices =
|
useEdgeRoutingAroundVertices =
|
||||||
options.getBoolean(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices);
|
options.getBoolean(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices);
|
||||||
|
|
||||||
|
useDimmedReturnEdges = options.getBoolean(DIM_RETURN_EDGES_KEY, useDimmedReturnEdges);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useEdgeRoutingAroundVertices() {
|
public boolean useEdgeRoutingAroundVertices() {
|
||||||
return useEdgeRoutingAroundVertices;
|
return useEdgeRoutingAroundVertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean useDimmedReturnEdges() {
|
||||||
|
return useDimmedReturnEdges;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean optionChangeRequiresRelayout(String optionName) {
|
public boolean optionChangeRequiresRelayout(String optionName) {
|
||||||
// format: 'Nested Code Layout.Route Edges....'
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,6 +733,10 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
|
|
||||||
private void lighten(FGEdge e) {
|
private void lighten(FGEdge e) {
|
||||||
|
|
||||||
|
if (!getLayoutOptions().useDimmedReturnEdges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// assumption: edges that move to the left in this layout are return flows that happen
|
// 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
|
// after the code block has been executed. We dim those a bit so that they
|
||||||
// produce less clutter.
|
// produce less clutter.
|
||||||
|
@ -840,8 +844,11 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
BlockCopy copy = (BlockCopy) child;
|
BlockCopy copy = (BlockCopy) child;
|
||||||
|
|
||||||
StringBuilder buffy = new StringBuilder();
|
StringBuilder buffy = new StringBuilder();
|
||||||
buffy.append(printDepth(depth, depth + 1)).append(' ').append(ID).append(
|
buffy.append(printDepth(depth, depth + 1))
|
||||||
" plain - ").append(copy.getRef());
|
.append(' ')
|
||||||
|
.append(ID)
|
||||||
|
.append(" plain - ")
|
||||||
|
.append(copy.getRef());
|
||||||
|
|
||||||
debug(buffy.toString());
|
debug(buffy.toString());
|
||||||
}
|
}
|
||||||
|
@ -1207,8 +1214,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
|
|
||||||
int row = startRow;
|
int row = startRow;
|
||||||
|
|
||||||
for (int i = 0; i < allChildren.size(); i++) {
|
for (DecompilerBlock block : allChildren) {
|
||||||
DecompilerBlock block = allChildren.get(i);
|
|
||||||
if (block instanceof DecompilerBlockGraph) {
|
if (block instanceof DecompilerBlockGraph) {
|
||||||
row = ((DecompilerBlockGraph) block).setRows(row);
|
row = ((DecompilerBlockGraph) block).setRows(row);
|
||||||
}
|
}
|
||||||
|
@ -1229,8 +1235,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
String getChildrenString(int depth) {
|
String getChildrenString(int depth) {
|
||||||
StringBuilder buffy = new StringBuilder();
|
StringBuilder buffy = new StringBuilder();
|
||||||
int childCount = 0;
|
int childCount = 0;
|
||||||
for (int i = 0; i < allChildren.size(); i++) {
|
for (DecompilerBlock block : allChildren) {
|
||||||
DecompilerBlock block = allChildren.get(i);
|
|
||||||
if (block instanceof DecompilerBlockGraph) {
|
if (block instanceof DecompilerBlockGraph) {
|
||||||
|
|
||||||
String blockName = block.getName();
|
String blockName = block.getName();
|
||||||
|
@ -1447,9 +1452,8 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
// The 'list' structure for children's nesting:
|
// The 'list' structure for children's nesting:
|
||||||
// -all nodes are at the same level
|
// -all nodes are at the same level
|
||||||
//
|
//
|
||||||
for (int i = 0; i < allChildren.size(); i++) {
|
for (DecompilerBlock block : allChildren) {
|
||||||
int column = col;
|
int column = col;
|
||||||
DecompilerBlock block = allChildren.get(i);
|
|
||||||
block.setCol(column);
|
block.setCol(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1477,8 +1481,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
// -each successive condition is another level nested
|
// -each successive condition is another level nested
|
||||||
//
|
//
|
||||||
int column = col;
|
int column = col;
|
||||||
for (int i = 0; i < allChildren.size(); i++) {
|
for (DecompilerBlock block : allChildren) {
|
||||||
DecompilerBlock block = allChildren.get(i);
|
|
||||||
block.setCol(column);
|
block.setCol(column);
|
||||||
column++;
|
column++;
|
||||||
}
|
}
|
||||||
|
@ -1518,8 +1521,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
// -all blocks nested
|
// -all blocks nested
|
||||||
//
|
//
|
||||||
int column = col + 1;
|
int column = col + 1;
|
||||||
for (int i = 0; i < allChildren.size(); i++) {
|
for (DecompilerBlock block : allChildren) {
|
||||||
DecompilerBlock block = allChildren.get(i);
|
|
||||||
block.setCol(column);
|
block.setCol(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue