Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/GT-2735-dragonmacher'
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidravore committed Apr 16, 2019
2 parents ab0781f + c018c3b commit 4ce178c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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> {

Expand Down Expand Up @@ -55,6 +56,15 @@ public FGVertexPickableBackgroundPaintTransformer(PickedInfo<FGVertex> info, Col
@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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ public Color getBackgroundColor() {
return doGetComponent().getBackgroundColor();
}

@Override
public Color getSelectionColor() {
return doGetComponent().getSelectionColor();
}

@Override
public void clearColor() {
doGetComponent().clearColor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ protected void regroupVertices() {

abstract Color getBackgroundColor();

abstract Color getSelectionColor();

abstract Color getUserDefinedColor();

abstract Color getDefaultBackgroundColor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public interface FGVertex extends VisualVertex {

public Color getBackgroundColor();

public Color getSelectionColor();

public void setBackgroundColor(Color color);

public void clearColor();
Expand Down Expand Up @@ -205,5 +207,7 @@ public interface FGVertex extends VisualVertex {
*/
public void setShowing(boolean isShowing);

@Override
public void dispose();

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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
Expand Down Expand Up @@ -414,6 +415,13 @@ Color getBackgroundColor() {
return defaultBackgroundColor;
}

@Override
Color getSelectionColor() {
Set<FGVertex> vertices = groupVertex.getVertices();
FGVertex v = CollectionUtils.any(vertices);
return v.getSelectionColor();
}

@Override
JComponent getHeader() {
return genericHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ Color getBackgroundColor() {
return listingPanel.getTextBackgroundColor();
}

@Override
Color getSelectionColor() {
return fieldPanel.getSelectionColor();
}

private void createActions() {
String firstGroup = "group1";
String secondGroup = "group2";
Expand Down

0 comments on commit 4ce178c

Please sign in to comment.