Merge remote-tracking branch 'origin/GT-2735-dragonmacher'

This commit is contained in:
ghidravore 2019-04-16 14:58:50 -04:00
commit 4ce178c419
6 changed files with 34 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import com.google.common.base.Function;
import edu.uci.ics.jung.visualization.picking.PickedInfo;
import ghidra.app.plugin.core.functiongraph.graph.FGVertexType;
import ghidra.app.plugin.core.functiongraph.graph.vertex.FGVertex;
import ghidra.program.util.ProgramSelection;
public class FGVertexPickableBackgroundPaintTransformer implements Function<FGVertex, Paint> {
@ -55,6 +56,15 @@ public class FGVertexPickableBackgroundPaintTransformer implements Function<FGVe
@Override
public Paint apply(FGVertex v) {
Color backgroundColor = v.getBackgroundColor();
ProgramSelection selection = v.getProgramSelection();
if (!selection.isEmpty()) {
// mix the colors so the user can see both the selection and the background color
Color selectionColor = v.getSelectionColor();
Color mixed = mix(selectionColor, backgroundColor);
backgroundColor = mixed;
}
FGVertexType vertexType = v.getVertexType();
if (info.isPicked(v)) {
if (v.isDefaultBackgroundColor()) {

View File

@ -289,6 +289,11 @@ public abstract class AbstractFunctionGraphVertex implements FGVertex {
return doGetComponent().getBackgroundColor();
}
@Override
public Color getSelectionColor() {
return doGetComponent().getSelectionColor();
}
@Override
public void clearColor() {
doGetComponent().clearColor();

View File

@ -90,6 +90,8 @@ public abstract class AbstractGraphComponentPanel extends JPanel {
abstract Color getBackgroundColor();
abstract Color getSelectionColor();
abstract Color getUserDefinedColor();
abstract Color getDefaultBackgroundColor();

View File

@ -86,6 +86,8 @@ public interface FGVertex extends VisualVertex {
public Color getBackgroundColor();
public Color getSelectionColor();
public void setBackgroundColor(Color color);
public void clearColor();
@ -205,5 +207,7 @@ public interface FGVertex extends VisualVertex {
*/
public void setShowing(boolean isShowing);
@Override
public void dispose();
}

View File

@ -39,6 +39,7 @@ import ghidra.util.*;
import ghidra.util.exception.AssertException;
import ghidra.util.layout.VerticalLayout;
import resources.ResourceManager;
import util.CollectionUtils;
/**
* This panel looks similar in appearance to the LisGraphComponentPanel, with a header, actions
@ -414,6 +415,13 @@ public class GroupedFunctionGraphComponentPanel extends AbstractGraphComponentPa
return defaultBackgroundColor;
}
@Override
Color getSelectionColor() {
Set<FGVertex> vertices = groupVertex.getVertices();
FGVertex v = CollectionUtils.any(vertices);
return v.getSelectionColor();
}
@Override
JComponent getHeader() {
return genericHeader;

View File

@ -261,6 +261,11 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
return listingPanel.getTextBackgroundColor();
}
@Override
Color getSelectionColor() {
return fieldPanel.getSelectionColor();
}
private void createActions() {
String firstGroup = "group1";
String secondGroup = "group2";