GP-1981 Theme help and module conversions

This commit is contained in:
ghidragon 2022-09-13 16:36:26 -04:00
parent 4eb3d8fd86
commit 9a0d7892da
120 changed files with 1540 additions and 2846 deletions

View file

@ -30,6 +30,7 @@ import javax.swing.event.EventListenerList;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
import generic.theme.GThemeDefaults.Colors;
import ghidra.service.graph.Attributed;
/**
@ -60,8 +61,7 @@ public class AttributeFilters implements ItemSelectable {
/**
* a {@link Function} to allow custom coloring of the individual toolkit button foreground
*/
private Function<String, Paint> paintFunction = v -> Color.black;
private Function<String, Paint> paintFunction = v -> Colors.FOREGROUND;
/**
* @param excluded ignored keys

View file

@ -53,6 +53,7 @@ import docking.options.editor.OptionsDialog;
import docking.widgets.EventTrigger;
import docking.widgets.OptionDialog;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import generic.util.WindowUtilities;
import ghidra.framework.options.Options;
import ghidra.framework.options.ToolOptions;
@ -1025,7 +1026,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
.elements(vertices)
.maxFactor(.05)
.buttonSupplier(JRadioButton::new)
.paintFunction(v -> Color.BLACK)
.paintFunction(v -> Colors.FOREGROUND)
.build();
vertexFilters.addItemListener(item -> {
@ -1043,7 +1044,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
.elements(edges)
.maxFactor(.01)
.buttonSupplier(JRadioButton::new)
.paintFunction(e -> Color.BLACK)
.paintFunction(e -> Colors.FOREGROUND)
.build();
edgeFilters.addItemListener(item -> {

View file

@ -37,6 +37,7 @@ import org.jungrapht.visualization.renderers.Renderer;
import org.jungrapht.visualization.renderers.Renderer.VertexLabel.Position;
import org.jungrapht.visualization.util.RectangleUtils;
import generic.theme.GThemeDefaults.Colors;
import generic.util.image.ImageUtils;
import ghidra.service.graph.*;
import ghidra.util.HTMLUtilities;
@ -78,8 +79,8 @@ public class DefaultGraphRenderer implements GraphRenderer {
this.options = options;
renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
label = new JLabel();
label.setForeground(Color.black);
label.setBackground(Color.white);
label.setForeground(Colors.FOREGROUND);
label.setBackground(Colors.BACKGROUND);
label.setOpaque(false);
Border marginBorder = BorderFactory.createEmptyBorder(labelBorderSize, 2 * labelBorderSize,
labelBorderSize, 2 * labelBorderSize);
@ -163,7 +164,7 @@ public class DefaultGraphRenderer implements GraphRenderer {
}
renderContext.setVertexFontFunction(this::getFont);
renderContext.setVertexLabelRenderer(new JLabelVertexLabelRenderer(Color.black));
renderContext.setVertexLabelRenderer(new JLabelVertexLabelRenderer(Colors.FOREGROUND));
renderContext.setVertexDrawPaintFunction(this::getVertexColor);
renderContext.setVertexFillPaintFunction(this::getVertexColor);
renderContext.setVertexStrokeFunction(n -> new BasicStroke(3.0f));
@ -290,7 +291,7 @@ public class DefaultGraphRenderer implements GraphRenderer {
// shapes are centered at the origin, so translate the graphics to compensate
graphics.translate(-bounds.x + strokeThickness, -bounds.y + strokeThickness);
graphics.setPaint(Color.WHITE);
graphics.setPaint(Colors.BACKGROUND);
graphics.fill(scaledShape);
graphics.setPaint(vertexColor);
graphics.setStroke(new BasicStroke(strokeThickness));
@ -304,7 +305,7 @@ public class DefaultGraphRenderer implements GraphRenderer {
int yOffset = (int) ((iconHeight - label.getHeight()) * labelOffsetRatio);
graphics.translate(xOffset, yOffset);
graphics.setPaint(Color.black);
graphics.setPaint(Colors.FOREGROUND);
label.paint(graphics);
graphics.setTransform(graphicsTransform); // restore the original transform