mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Merge remote-tracking branch
'origin/GP-769-dragonmacher-fg-edge-weight-option--SQUASHED' (Closes #1106)
This commit is contained in:
commit
0ab0bb6ea3
5 changed files with 62 additions and 5 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>
|
||||||
|
|
|
@ -49,6 +49,13 @@
|
||||||
notes on how edges are routed for this layout.)
|
notes on how edges are routed for this layout.)
|
||||||
</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>
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class FunctionGraphOptions extends VisualGraphOptions {
|
||||||
private static final String EDGE_COLOR_CONDITIONAL_JUMP_KEY = "Edge Color - Conditional Jump ";
|
private static final String EDGE_COLOR_CONDITIONAL_JUMP_KEY = "Edge Color - Conditional Jump ";
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
private static final String NAVIGATION_HISTORY_KEY = "Navigation History";
|
private static final String NAVIGATION_HISTORY_KEY = "Navigation History";
|
||||||
private static final String NAVIGATION_HISTORY_DESCRIPTION =
|
private static final String NAVIGATION_HISTORY_DESCRIPTION =
|
||||||
"Determines how the navigation history will be updated when using the Function Graph. " +
|
"Determines how the navigation history will be updated when using the Function Graph. " +
|
||||||
"The basic options are:" +
|
"The basic options are:" +
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,6 +412,13 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
// Condensing is when the graph will pull nodes closer together on the x axis to
|
// Condensing is when the graph will pull nodes closer together on the x axis to
|
||||||
// reduce whitespace and make the entire graph easier to see. In this case, update
|
// reduce whitespace and make the entire graph easier to see. In this case, update
|
||||||
// the offset to avoid running into the moved vertices.
|
// the offset to avoid running into the moved vertices.
|
||||||
|
|
||||||
|
// Condensing Note: we have guilty knowledge that our parent class my condense the
|
||||||
|
// vertices and edges towards the center of the graph after we calculate positions.
|
||||||
|
// To prevent the edges from moving to far behind the vertices, we will compensate a
|
||||||
|
// bit for that effect using this offset value. The getEdgeOffset() method is
|
||||||
|
// updated for the condense factor.
|
||||||
|
|
||||||
int exaggerationFactor = 1;
|
int exaggerationFactor = 1;
|
||||||
if (isCondensedLayout()) {
|
if (isCondensedLayout()) {
|
||||||
exaggerationFactor = 2; // determined by trial-and-error; can be made into an option
|
exaggerationFactor = 2; // determined by trial-and-error; can be made into an option
|
||||||
|
@ -675,6 +682,13 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
// Condensing is when the graph will pull nodes closer together on the x axis to
|
// Condensing is when the graph will pull nodes closer together on the x axis to
|
||||||
// reduce whitespace and make the entire graph easier to see. In this case, update
|
// reduce whitespace and make the entire graph easier to see. In this case, update
|
||||||
// the offset to avoid running into the moved vertices.
|
// the offset to avoid running into the moved vertices.
|
||||||
|
|
||||||
|
// Condensing Note: we have guilty knowledge that our parent class my condense the
|
||||||
|
// vertices and edges towards the center of the graph after we calculate positions.
|
||||||
|
// To prevent the edges from moving to far behind the vertices, we will compensate a
|
||||||
|
// bit for that effect using this offset value. The getEdgeOffset() method is
|
||||||
|
// updated for the condense factor.
|
||||||
|
|
||||||
int vertexToEdgeOffset = otherVertex.getEdgeOffset();
|
int vertexToEdgeOffset = otherVertex.getEdgeOffset();
|
||||||
int exaggerationFactor = 1;
|
int exaggerationFactor = 1;
|
||||||
if (isCondensedLayout()) {
|
if (isCondensedLayout()) {
|
||||||
|
@ -700,7 +714,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
|
||||||
-p2 - just past the left edge
|
-p2 - just past the left edge
|
||||||
-p3 - just past the bottom of the vertex
|
-p3 - just past the bottom of the vertex
|
||||||
-p4 - back at the original x value
|
-p4 - back at the original x value
|
||||||
|
|
||||||
|
|
|
|
||||||
.___|
|
.___|
|
||||||
| .-----.
|
| .-----.
|
||||||
|
@ -794,6 +808,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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue