GT-3019 - Function Graph - Added option for edge routing around vertices

This commit is contained in:
dragonmacher
2019-07-25 18:40:21 -04:00
parent ac98e609d7
commit a04185e942
24 changed files with 933 additions and 259 deletions
@@ -0,0 +1,53 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.app.plugin.core.functiongraph.graph.layout;
import ghidra.framework.options.Options;
import ghidra.util.HelpLocation;
/**
* Options for the {@link DecompilerNestedLayout}
*/
public class DNLayoutOptions implements FGLayoutOptions {
private static final String USE_EDGE_ROUTING_AROUND_VERTICES_KEY =
"Route Edges Around Vertices";
private static final String USE_EDGE_ROUTING_AROUND_VERTICES_DESCRIPTION = "Signals that " +
"edges should be routed around any intersecting vertex. When toggled off, edges will " +
"pass through any intersecting vertices.";
private boolean useEdgeRoutingAroundVertices;
@Override
public void registerOptions(Options options) {
// TODO layout-specific help
HelpLocation help = new HelpLocation(OWNER, "Options");
options.registerOption(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices,
help, USE_EDGE_ROUTING_AROUND_VERTICES_DESCRIPTION);
}
@Override
public void loadOptions(Options options) {
useEdgeRoutingAroundVertices =
options.getBoolean(USE_EDGE_ROUTING_AROUND_VERTICES_KEY, useEdgeRoutingAroundVertices);
}
public boolean useEdgeRoutingAroundVertices() {
return useEdgeRoutingAroundVertices;
}
}
@@ -18,25 +18,33 @@ package ghidra.app.plugin.core.functiongraph.graph.layout;
import javax.swing.Icon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.framework.options.Options;
import ghidra.util.task.TaskMonitor;
import resources.ResourceManager;
public class DecompilerNestedLayoutProvider implements FGLayoutProvider {
public class DecompilerNestedLayoutProvider extends FGLayoutProvider {
private static final Icon ICON =
ResourceManager.loadImage("images/function_graph_code_flow.png");
static final String LAYOUT_NAME = "Nested Code Layout";
@Override
public FGLayout getFGLayout(FunctionGraph graph, TaskMonitor monitor) {
DecompilerNestedLayout layout = new DecompilerNestedLayout(graph);
DecompilerNestedLayout layout = new DecompilerNestedLayout(graph, LAYOUT_NAME);
layout.setTaskMonitor(monitor);
return layout;
}
@Override
public FGLayoutOptions createLayoutOptions(Options options) {
DNLayoutOptions layoutOptions = new DNLayoutOptions();
layoutOptions.registerOptions(options);
return layoutOptions;
}
@Override
public String getLayoutName() {
// TODO better name?...or rename classes to match
return "Nested Code Layout";
return LAYOUT_NAME;
}
@Override