GP-1981 - Theming - Base module color conversion

This commit is contained in:
dragonmacher 2022-09-01 15:00:44 -04:00 committed by ghidragon
parent 7c7d98090f
commit 15e633c239
97 changed files with 1142 additions and 1777 deletions

View file

@ -18,7 +18,6 @@ data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
data/base.listing.theme.properties||GHIDRA||||END|
data/base.theme.properties||GHIDRA||||END|
data/decompiler.theme.properties||GHIDRA||||END|
data/file_extension_icons.xml||GHIDRA||||END|
data/functionTags.xml||GHIDRA||||END|
data/ms_pe_rich_products.xml||GHIDRA||||END|

View file

@ -9,12 +9,12 @@ color.bg.listing.tabs.selected = #788CBD
color.bg.listing.tabs.unselected = [color]control
color.bg.listing.tabs.highlighted = #ABC8FF
color.bg.listing.tabs.list = rgb(255, 255, 230)
color.bg.listing.tabs.more.tabs.hover = rgb(255, 226, 213)
color.fg.listing.tabs.text.selected = black
color.fg.listing.tabs.text.unselected = color.fg
color.fg.listing.tabs.list = black
color.bg.listing.header.active.field = rgb(244, 221, 183)
color.fg.listing.header.active.field = color.fg
@ -30,7 +30,7 @@ color.fg.listing.entrypoint = magenta
color.fg.listing.comment.auto = lightGray
color.fg.listing.comment.eol = blue
color.fg.listing.comment.repeatable = darkOrange
color.fg.listing.comment.ref-repeatable = cornflowerBlue
color.fg.listing.comment.ref.repeatable = cornflowerBlue
color.fg.listing.comment.plate = gray
color.fg.listing.comment.post = blue
color.fg.listing.comment.pre = indigo
@ -41,23 +41,23 @@ color.fg.listing.function.name = blue
color.fg.listing.function.param = black
color.fg.listing.function.tag = mediumVioletRed
color.fg.listing.function.param.auto = gray
color.fg.listing.function.return-type = black
color.fg.listing.function.return.type = black
color.fg.listing.function.param.custom = indigo
color.fg.listing.function.param.dynamic = #006666
color.fg.listing.label.local = green
color.fg.listing.label.non-primary = olive
color.fg.listing.label.non.primary = olive
color.fg.listing.label.primary = darkBlue
color.fg.listing.mnemonic.override = deepPink
color.fg.listing.mnemonic = navy
color.fg.listing.mnemonic.unimplemented = navy
// TODO
color.fg.listing.flow-arrow.inactive = lightGray
color.fg.listing.flow-arrow.active = color.fg
color.fg.listing.flow-arrow.selected = limeGreen
color.fg.listing.flow.arrow.inactive = lightGray
color.fg.listing.flow.arrow.active = color.fg
color.fg.listing.flow.arrow.selected = limeGreen
color.fg.listing.separator = color.fg
color.fg.listing.variable = purple
color.fg.listing.version-tracking = purple
color.fg.listing.version.tracking = purple
color.fg.listing.xref = darkGreen
color.fg.listing.xref.offcut = gray
color.fg.listing.xref.read = blue
@ -86,50 +86,4 @@ color.fg.listing.tabs.list = black
color.bg.listing.header.active.field = rgb(244, 221, 183)
color.fg.listing.header.active.field = black
#color.fg.listing.address = color.fg
#color.fg.listing.ref.bad = red
#color.fg.listing.bytes = blue
#color.fg.listing.constant = turquoise
#color.fg.listing.label.unreferenced = black
#color.fg.listing.entrypoint = magenta
#color.fg.listing.comment.auto = rgb(95,129,157)
#color.fg.listing.comment.eol = blue
#color.fg.listing.comment.repeatable = darkOrange
#color.fg.listing.comment.ref-repeatable = cornflowerBlue
#color.fg.listing.comment.plate = gray
#color.fg.listing.comment.post = blue
#color.fg.listing.comment.pre = indigo
#color.fg.listing.ref.ext.resolved = teal
#color.fg.listing.fieldname = color.fg
#color.fg.listing.function.callfixup = fuchsia
#color.fg.listing.function.name = blue
#color.fg.listing.function.param = black
#color.fg.listing.function.tag = mediumVioletRed
#color.fg.listing.function.param.auto = gray
#color.fg.listing.function.return-type = black
#color.fg.listing.function.param.custom = indigo
#color.fg.listing.function.param.dynamic = teal
#color.fg.listing.label.local = green
#color.fg.listing.label.non-primary = olive
#color.fg.listing.label.primary = darkBlue
#color.fg.listing.mnemonic.override = deepPink
#color.fg.listing.mnemonic = lightSlateGray
#color.fg.listing.mnemonic.unimplemented = navy
#color.fg.listing.flow-arrow.inactive = lightGray
#color.fg.listing.flow-arrow.active = color.fg
#color.fg.listing.flow-arrow.selected = limeGreen
#color.fg.listing.separator = color.fg
#color.fg.listing.variable = purple
#color.fg.listing.version-tracking = purple
#color.fg.listing.xref = darkGreen
#color.fg.listing.xref.offcut = gray
#color.fg.listing.xref.read = blue
#color.fg.listing.xref.write = darkOrange
#color.fg.listing.xref.other = color.fg
#color.fg.listing.register = olive
#color.fg.listing.underline = cornflowerBlue
#color.fg.listing.pcode.label = blue
#color.fg.listing.pcode.space = blue
#color.fg.listing.pcode.varnode = blue
#color.fg.listing.pcode.userop = blue

View file

@ -2,10 +2,12 @@
color.bg.undefined = rgb(220, 220, 220) // bg for clients displaying undefined functions
color.flowtype.fall-through = red
color.flowtype.fall.through = red
color.flowtype.jump.conditional = #007C00 // dark green
color.flowtype.jump.unconditional = blue
color.function.thunk = color.palette.blue
color.bg.table.selection.bundle = [color]textHighlight
color.fg.table.selection.bundle = [color]textHighlightText
color.fg.table.bundle.disabled = darkGray
@ -28,13 +30,13 @@ color.fg.infopanel.version = color.fg
color.fg.interpreterpanel = color.fg
color.fg.interpreterpanel.error = color.fg.error
color.fg.listing.highlighter.default = yellow
color.fg.listing.highlighter.scoped-read = rgb(204,204, 0)
color.fg.listing.highlighter.scoped-write = green
color.fg.listing.highlighter.scoped.read = rgb(204,204, 0)
color.fg.listing.highlighter.scoped.write = green
color.bg.markerservice = color.bg
color.bg.search.highlight = rgb(255,255,200)
color.bg.search.current-line.highlight = yellow
color.bg.search.current.line.highlight = yellow
color.bg.tree.renderer.icon.fill = #9F9FFF
color.bg.tree.renderer.icon.line = #8282FF
@ -43,17 +45,120 @@ color.bg.analysis.options.not.default.enablement = rgb(255, 255, 200)
color.bg.analysis.options.not.default.enablement.selected = rgb(177, 212, 236)
color.fg.analysis.options.prototype = crimson
color.fg.plugin.assembler.completion.least = rgb(0, 128, 0)
color.fg.plugin.assembler.completion.middle = rgb(0, 0, 128)
color.fg.plugin.assembler.completion.most = blue
color.bg.plugin.bookmark.analysis = rgb(255, 128, 0) // orange
color.bg.plugin.bookmark.default = rgb(255, 0, 255) // magenta
color.bg.plugin.bookmark.error = rgb(204, 0, 51) // dark red
color.bg.plugin.bookmark.info = rgb(0, 255, 255) // cyan
color.bg.plugin.bookmark.note = rgb(128, 0, 255) // purple
color.bg.plugin.bookmark.warning = rgb(255, 196, 51) // dark yellow
color.bg.plugin.colorizer.default = #84AFD3
color.bg.plugin.colorizer.marker = pink
color.fg.plugin.comments.history.text = blue
color.fg.plugin.comments.history.user = color.fg
color.fg.plugin.comments.history.date = rgb(124, 37, 18)
color.bg.plugin.datamgr.edge.default = blue
color.bg.plugin.datamgr.edge.composite = magenta
color.bg.plugin.datamgr.edge.reference = blue
color.bg.plugin.datamgr.icon.highlight = rgb(204, 204, 255)
color.bg.plugin.editors.compositeeditor.text = color.fg
color.bg.plugin.editors.compositeeditor.line = [color]Component.borderColor
color.bg.plugin.editors.compositeeditor.line.interior = #D4D4D4
color.bg.plugin.editors.compositeeditor.byte.header = #DFDFDF
color.bg.plugin.editors.compositeeditor.bit.undefined = #F8F8F8
color.bg.plugin.editors.compositeeditor.bit.component = #BFBFFF
color.bg.plugin.editors.compositeeditor.bit.active = green
color.bg.plugin.editors.compositeeditor.bit.conflict = yellow
color.bg.plugin.editors.compositeeditor.non.bit = #A0A0FF
color.fg.plugin.equate.enum = lightskyblue
color.fg.plugin.function.editor.dialog.thunk = color.function.thunk
color.fg.plugin.function.editor.dialog.textfield.default = color.fg
color.fg.plugin.function.editor.dialog.textfield.error = color.fg.error
color.fg.plugin.function.editor.dialog.textfield.function.name = color.palette.blue
color.fg.plugin.function.editor.dialog.textfield.parameter = color.palette.magenta
color.bg.plugin.windowlocation = black
color.bg.plugin.windowlocation.bounds.virtual = red
color.bg.plugin.windowlocation.bounds.visible = green
color.bg.plugin.windowlocation.screens = orange
color.bg.plugin.windowlocation.window.selected = rgba(0, 255, 0, 200)
color.fg.plugin.windowlocation.window.text = gray
color.bg.plugin.instructionsearch.table.masked.instruction = rgb(237, 243, 254) // faint blue
color.bg.plugin.instructionsearch.table.masked.non.instruction = rgb(255, 242, 214) // tan
color.bg.plugin.instructionsearch.table.not.masked.instruction = rgb(188, 212, 254) // light blue
color.bg.plugin.instructionsearch.table.not.masked.non.instruction = rgb(203, 186, 150) // dark tan
color.bg.plugin.instructionsearch.table.default = rgb(214, 217, 223)
color.bg.plugin.instructionsearch.search.markers = lightgreen
color.fg.plugin.interpreter.renderer.color.standard.1 = rgb(0,0,0) // black
color.fg.plugin.interpreter.renderer.color.standard.2 = rgb(194, 54, 33) // red
color.fg.plugin.interpreter.renderer.color.standard.3 = rgb(37, 188, 36) // green
color.fg.plugin.interpreter.renderer.color.standard.4 = rgb(173, 173, 39) // yellow
color.fg.plugin.interpreter.renderer.color.standard.5 = rgb(73, 46, 225) // blue
color.fg.plugin.interpreter.renderer.color.standard.6 = rgb(211, 56, 211) // magenta
color.fg.plugin.interpreter.renderer.color.standard.7 = rgb(51, 187, 200) // cyan
color.fg.plugin.interpreter.renderer.color.standard.8 = rgb(203, 204, 205) // white
color.fg.plugin.interpreter.renderer.color.intense.1 = rgb(129, 131, 131) // intense black
color.fg.plugin.interpreter.renderer.color.intense.2 = rgb(252, 57, 31) // intense red
color.fg.plugin.interpreter.renderer.color.intense.3 = rgb(49, 231, 34) // intense green
color.fg.plugin.interpreter.renderer.color.intense.4 = rgb(234, 236, 35) // intense yellow
color.fg.plugin.interpreter.renderer.color.intense.5 = rgb(88, 51, 255) // intense blue
color.fg.plugin.interpreter.renderer.color.intense.6 = rgb(249, 53, 248) // intense magenta
color.fg.plugin.interpreter.renderer.color.intense.7 = rgb(20, 240, 240) // intense cyan
color.fg.plugin.interpreter.renderer.color.intense.8 = rgb(233, 235, 235) // intense white
color.bg.plugin.locationreferences.highlight = rgb(168, 202, 242)
color.bg.plugin.myprogramchangesdisplay.markers.changes.unsaved = darkgray
color.bg.plugin.myprogramchangesdisplay.markers.changes.conflicting = color.fg.error
color.bg.plugin.myprogramchangesdisplay.markers.changes.latest.version = blue
color.bg.plugin.myprogramchangesdisplay.markers.changes.not.checked.in = green
color.bg.plugin.overview.defalt = gray
color.bg.plugin.overview.address.data = rgb(128, 255, 128)
color.bg.plugin.overview.address.function = rgb(204, 150, 255)
color.bg.plugin.overview.address.external.ref = rgb(255, 150, 150)
color.bg.plugin.overview.address.instruction = rgb(192, 192, 255)
color.bg.plugin.overview.address.undefined = rgb(255, 51, 102)
color.bg.plugin.overview.address.uninitialized = black
color.bg.plugin.overview.entropy.knot.1 = red
color.bg.plugin.overview.entropy.knot.2 = blue
color.bg.plugin.overview.entropy.knot.3 = green
color.bg.plugin.overview.entropy.knot.4 = yellow
color.bg.plugin.overview.entropy.knot.5 = blue
color.bg.plugin.overview.entropy.uninitialized = blue
color.bg.plugin.overview.entropy.palette.base.low = black
color.bg.plugin.overview.entropy.palette.base.high = white
color.bg.plugin.overview.entropy.palette.text = color.fg
color.bg.plugin.references.table.active.operand = rgb(205, 205, 205)
color.bg.plugin.register.marker = rgb(0, 153, 153)
[Dark Defaults]
color.bg = rgb(40, 42, 46) // TODO this should be in a more generic module
color.bg.undefined = #5C4D68
color.flowtype.fall-through = rgb(164, 66, 66)
color.flowtype.fall.through = rgb(164, 66, 66)
color.flowtype.jump.conditional = rgb(95, 129, 157)
color.flowtype.jump.unconditional = rgb(140, 148, 64)
color.bg.table.selection.bundle = [color]textHighlight
color.fg.table.selection.bundle = [color]textHighlightText
color.fg.table.bundle.disabled = lightGray
@ -67,11 +172,15 @@ color.fg.table.ghidratable.equate = royalBlue
color.fg.table.ghidratable.suggestion = darkGray
color.bg.search.highlight = rgb(189,183,107)
color.bg.search.current-line.highlight = gold
color.bg.search.current.line.highlight = gold
color.fg.listing.highlighter.scoped-read = rgb(100,100, 0)
color.fg.listing.highlighter.scoped-write = forestGreen
color.fg.listing.highlighter.scoped.read = rgb(100,100, 0)
color.fg.listing.highlighter.scoped.write = forestGreen
color.bg.analysis.options.not.default.enablement = #D1D19E
color.bg.analysis.options.not.default.enablement.selected = rgb(177, 212, 236)
color.fg.analysis.options.prototype = lightcoral
color.bg.plugin.datamgr.edge.default = deepskyblue
color.bg.plugin.datamgr.edge.composite = plum
color.bg.plugin.datamgr.edge.reference = deepskyblue

View file

@ -1,31 +0,0 @@
[Defaults]
color.bg.decompiler = color.bg
color.fg.decompiler = color.fg
color.fg.decompiler.keyword = #0001e6
color.fg.decompiler.function.name = blue
color.fg.decompiler.comment = blueViolet
color.fg.decompiler.variable = #999900 // close to oliveDrab
color.fg.decompiler.constant = forestGreen
color.fg.decompiler.type = mediumBlue
color.fg.decompiler.parameter = darkMagenta
color.fg.decompiler.global = darkCyan
color.bg.decompiler.middle-mouse = rgba(255,255,0,.5)
color.bg.decompiler.current-variable = rgba(255,255,0,0.5)
[Dark Defaults]
color.fg.decompiler.keyword = peru
color.fg.decompiler.function.name = cadetBlue
color.fg.decompiler.comment = lightSlateGray
color.fg.decompiler.variable = #999900 // close to oliveDrab
color.fg.decompiler.constant = forestGreen
color.fg.decompiler.type = blue
color.fg.decompiler.parameter = darkMagenta
color.fg.decompiler.global = darkCyan
color.bg.decompiler.middle-mouse = rgb(55,59,65)
color.bg.decompiler.current-variable = rgb(55, 59, 65)

View file

@ -25,6 +25,7 @@ import javax.swing.text.html.HTMLEditorKit;
import docking.widgets.OptionDialog;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.GhidraOptions;
import ghidra.app.services.ProgramManager;
import ghidra.framework.model.DomainObject;
@ -270,7 +271,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
appendTableHeader(buffy);
String specialFontOpen = "<B><font color=\"green\">";
String specialFontOpen = "<B><font color=\"" + Palette.GREEN.toHexString() + "\">";
String specialFontClose = "</font></B>";
for (Program program : validList) {

View file

@ -21,6 +21,7 @@ import java.beans.PropertyEditorSupport;
import javax.swing.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.framework.options.CustomOptionsEditor;
import ghidra.util.layout.PairLayout;
@ -115,12 +116,10 @@ public class StoredAnalyzerTimesPropertyEditor extends PropertyEditorSupport
new JTextField(StoredAnalyzerTimes.formatTimeMS(times.getTotalTime()));
valueField.setEditable(false);
valueField.setHorizontalAlignment(SwingConstants.RIGHT);
valueField.setBorder(BorderFactory.createLineBorder(Color.black, 2));
valueField.setBorder(BorderFactory.createLineBorder(Java.BORDER, 2));
panel.add(valueField);
return panel;
}
}

View file

@ -27,6 +27,8 @@ import docking.EmptyBorderToggleButton;
import docking.widgets.autocomplete.*;
import docking.widgets.label.GDLabel;
import docking.widgets.textfield.TextFieldLinker;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import ghidra.GhidraApplicationLayout;
import ghidra.GhidraLaunchable;
import ghidra.app.plugin.assembler.Assembler;
@ -60,6 +62,14 @@ import resources.ResourceManager;
* Otherwise, the usual autocompletion behavior is applied automatically.
*/
public class AssemblyDualTextField {
private static Color FG_PREFERENCE_MOST =
new GColor("color.fg.plugin.assembler.completion.most");
private static Color FG_PREFERENCE_MIDDLE =
new GColor("color.fg.plugin.assembler.completion.middle");
private static Color FG_PREFERENCE_LEAST =
new GColor("color.fg.plugin.assembler.completion.least");
protected final TextFieldLinker linker = new TextFieldLinker();
protected final JTextField mnemonic = new JTextField();
protected final JTextField operands = new JTextField();
@ -179,8 +189,8 @@ public class AssemblyDualTextField {
public AssemblyInstruction(String text, byte[] data, int preference) {
// TODO?: Description to display constructor tree information
super("", NumericUtilities.convertBytesToString(data, " "),
preference == 10000 ? Color.BLUE
: preference == 5000 ? new Color(0, 0, 128) : new Color(0, 128, 0),
preference == 10000 ? FG_PREFERENCE_MOST
: preference == 5000 ? FG_PREFERENCE_MIDDLE : FG_PREFERENCE_LEAST,
-preference);
this.data = data;
}
@ -220,7 +230,7 @@ public class AssemblyDualTextField {
private String text;
public AssemblyError(String text, String desc) {
super(text, desc, Color.RED, 1);
super(text, desc, Colors.ERROR, 1);
this.text = text;
}
@ -442,7 +452,7 @@ public class AssemblyDualTextField {
* Set the "existing" instruction used for ordering proposed instructions by "most similar"
*
* @see #computePreference(AssemblyResolvedPatterns)
* @param existing
* @param existing the existing instruction
*/
public void setExisting(Instruction existing) {
this.existing = existing;
@ -468,6 +478,7 @@ public class AssemblyDualTextField {
/**
* For single mode: Get the text field containing the full assembly text
* @return the text field
*/
public JTextField getAssemblyField() {
return assembly;
@ -550,19 +561,14 @@ public class AssemblyDualTextField {
if (assembly.isVisible()) {
throw new AssertionError();
}
else {
return VisibilityMode.DUAL_VISIBLE;
}
}
else {
if (assembly.isVisible()) {
return VisibilityMode.SINGLE_VISIBLE;
}
else {
return VisibilityMode.INVISIBLE;
}
}
}
/**
* Set the font for all text fields
@ -695,7 +701,6 @@ public class AssemblyDualTextField {
* one are preferred. Last, the shortest instructions are preferred.
*
* @param rc a resolved instruction
* @param existing the instruction, if any, currently under the user's cursor
* @return a preference
*/
protected int computePreference(AssemblyResolvedPatterns rc) {

View file

@ -15,7 +15,6 @@
*/
package ghidra.app.plugin.core.assembler;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.FocusListener;
import java.awt.event.KeyListener;
@ -26,6 +25,7 @@ import docking.action.KeyBindingData;
import docking.action.MenuData;
import docking.widgets.fieldpanel.FieldPanel;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import ghidra.framework.plugintool.Plugin;
import ghidra.program.database.util.ProgramTransaction;
import ghidra.program.model.address.*;
@ -56,7 +56,7 @@ public class PatchDataAction extends AbstractPatchAction {
setKeyBindingData(new KeyBindingData(KEYBIND_PATCH_DATA));
setHelpLocation(new HelpLocation(owner.getName(), "patch_data"));
input.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
input.setBorder(BorderFactory.createLineBorder(Colors.ERROR, 2));
init();
}

View file

@ -15,7 +15,6 @@
*/
package ghidra.app.plugin.core.assembler;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.FocusListener;
import java.awt.event.KeyListener;
@ -33,6 +32,7 @@ import docking.action.MenuData;
import docking.widgets.autocomplete.*;
import docking.widgets.fieldpanel.*;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers;
import ghidra.app.plugin.core.assembler.AssemblyDualTextField.*;
@ -146,9 +146,9 @@ public class PatchInstructionAction extends AbstractPatchAction {
setKeyBindingData(new KeyBindingData(KEYBIND_PATCH_INSTRUCTION));
setHelpLocation(new HelpLocation(owner.getName(), "patch_instruction"));
input.getMnemonicField().setBorder(BorderFactory.createLineBorder(Color.RED, 2));
input.getOperandsField().setBorder(BorderFactory.createLineBorder(Color.RED, 2));
input.getAssemblyField().setBorder(BorderFactory.createLineBorder(Color.RED, 2));
input.getMnemonicField().setBorder(BorderFactory.createLineBorder(Colors.ERROR, 2));
input.getOperandsField().setBorder(BorderFactory.createLineBorder(Colors.ERROR, 2));
input.getAssemblyField().setBorder(BorderFactory.createLineBorder(Colors.ERROR, 2));
input.getAutocompleter().addAutocompletionListener(listenerForAccept);

View file

@ -21,6 +21,7 @@ import javax.swing.ImageIcon;
import org.apache.commons.lang3.StringUtils;
import generic.theme.GColor;
import ghidra.app.services.*;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSet;
@ -52,12 +53,12 @@ public class BookmarkNavigator {
final static int ANALYSIS_PRIORITY = MarkerService.BOOKMARK_PRIORITY + 6;
final static int DEFAULT_PRIORITY = MarkerService.BOOKMARK_PRIORITY + 8;
final static Color NOTE_COLOR = new Color(128, 0, 255); // Purple
final static Color INFO_COLOR = new Color(0, 255, 255); // Cyan
final static Color WARNING_COLOR = new Color(255, 196, 51); // Dark Yellow
final static Color ERROR_COLOR = new Color(204, 0, 51); // Dark Red
final static Color ANALYSIS_COLOR = new Color(255, 128, 0); // Orange
final static Color DEFAULT_COLOR = new Color(255, 0, 255); // Magenta
final static Color NOTE_COLOR = new GColor("color.bg.plugin.bookmark.note");
final static Color INFO_COLOR = new GColor("color.bg.plugin.bookmark.info");
final static Color WARNING_COLOR = new GColor("color.bg.plugin.bookmark.warning");
final static Color ERROR_COLOR = new GColor("color.bg.plugin.bookmark.error");
final static Color ANALYSIS_COLOR = new GColor("color.bg.plugin.bookmark.analysis");
final static Color DEFAULT_COLOR = new GColor("color.bg.plugin.bookmark.default");
private String type;
private MarkerService markerService;

View file

@ -16,7 +16,6 @@
package ghidra.app.plugin.core.checksums;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
@ -25,6 +24,7 @@ import javax.swing.*;
import docking.ActionContext;
import docking.action.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.context.ProgramContextAction;
import ghidra.framework.plugintool.ComponentProviderAdapter;
import ghidra.util.HelpLocation;
@ -97,7 +97,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter {
errorStatus = new GDLabel(" ");
errorStatus.setName("message");
errorStatus.setHorizontalAlignment(SwingConstants.CENTER);
errorStatus.setForeground(Color.RED);
errorStatus.setForeground(Colors.ERROR);
errorStatus.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
main.add(errorStatus, BorderLayout.SOUTH);

View file

@ -588,7 +588,8 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
}
color =
fieldOptions.getColor(GhidraOptions.OPTION_HIGHLIGHT_COLOR, new Color(255, 255, 180));
fieldOptions.getColor(GhidraOptions.OPTION_HIGHLIGHT_COLOR,
GhidraOptions.DEFAULT_HIGHLIGHT_COLOR);
MarkerSet highlightMarkers = getHighlightMarkers(currentProgram);
fieldPanel.setHighlightColor(color);
if (highlightMarkers != null) {

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.codebrowser;
import java.awt.Color;
import java.math.BigInteger;
import generic.theme.TempColorUtils;
import ghidra.app.util.viewer.listingpanel.ListingBackgroundColorModel;
import ghidra.app.util.viewer.listingpanel.ListingPanel;
@ -52,10 +53,7 @@ public class LayeredColorModel implements ListingBackgroundColorModel {
}
private Color blend(Color primary, Color secondary) {
int red = (primary.getRed() * 2 + secondary.getRed()) / 3;
int green = (primary.getGreen() * 2 + secondary.getGreen()) / 3;
int blue = (primary.getBlue() * 2 + secondary.getBlue()) / 3;
return new Color(red, green, blue);
return TempColorUtils.blend1(primary, secondary);
}
@Override

View file

@ -54,8 +54,8 @@ public class ListingHighlightProvider
implements ButtonPressedListener, OptionsChangeListener, HighlightProvider {
//@formatter:off
private static final Color DEFAULT_HIGHLIGHT_COLOR = new GColor("color.fg.listing.highlighter.default");
private static final Color DEFAULT_SCOPED_READ_COLOR = new GColor("color.fg.listing.highlighter.scoped-read");
private static final Color DEFAULT_SCOPED_WRITE_COLOR = new GColor("color.fg.listing.highlighter.scoped-write");
private static final Color DEFAULT_SCOPED_READ_COLOR = new GColor("color.fg.listing.highlighter.scoped.read");
private static final Color DEFAULT_SCOPED_WRITE_COLOR = new GColor("color.fg.listing.highlighter.scoped.write");
private static final String DISPLAY_HIGHLIGHT_NAME = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Enabled";
private static final String SCOPED_WRITE_HIGHLIGHT_COLOR = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scoped Write Highlight Color";
private static final String SCOPED_READ_HIGHLIGHT_COLOR = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scoped Read Highlight Color";
@ -144,7 +144,7 @@ public class ListingHighlightProvider
Pattern highlightPattern = currentHighlightPattern;
Matcher matcher = highlightPattern.matcher(text);
List<Highlight> highlightList = new ArrayList<Highlight>();
List<Highlight> highlightList = new ArrayList<>();
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end() - 1;
@ -479,7 +479,7 @@ public class ListingHighlightProvider
}
private Set<Register> getRegisterSet(Register reg) {
Set<Register> regSet = new HashSet<Register>();
Set<Register> regSet = new HashSet<>();
regSet.add(reg);
Register r = reg.getParentRegister();
while (r != null) {
@ -558,7 +558,7 @@ public class ListingHighlightProvider
// and set writeScope, all other instructions upto that point will be
// added to read scope
Program prog = instr.getProgram();
Stack<Address> backStack = new Stack<Address>();
Stack<Address> backStack = new Stack<>();
pushInstructionBackFlows(instr, backStack);
while (!backStack.isEmpty()) {
Address addr = backStack.pop();
@ -587,7 +587,7 @@ public class ListingHighlightProvider
// follow flow downwards until register is changed
// add in each line that has register anywhere
Program prog = instr.getProgram();
Stack<Address> stack = new Stack<Address>();
Stack<Address> stack = new Stack<>();
pushInstructionFlows(instr, stack);
while (!stack.isEmpty()) {
Address addr = stack.pop();
@ -847,7 +847,7 @@ public class ListingHighlightProvider
varnodeSize -= intOff;
varnodeOffset += intOff;
List<Varnode> varnodes = new ArrayList<Varnode>();
List<Varnode> varnodes = new ArrayList<>();
for (Varnode v : variableStorage.getVarnodes()) {
if (varnodeOffset >= v.getSize()) {
varnodeOffset -= v.getSize();

View file

@ -19,6 +19,7 @@ import javax.swing.JComponent;
import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import ghidra.GhidraOptions;
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
import ghidra.app.util.ToolTipUtils;
@ -111,7 +112,8 @@ public class DataTypeListingHover extends AbstractConfigurableHover implements L
}
if (warningMsg.length() != 0) {
String errorText =
"<HTML><center><font color=\"red\">" + warningMsg + "!</font></center><BR>";
"<HTML><center><font color=\"" + Colors.ERROR.toHexString() + "\">" +
warningMsg + "!</font></center><BR>";
toolTipText = toolTipText.replace("<HTML>", errorText);
}
return createTooltipComponent(toolTipText);
@ -149,7 +151,9 @@ public class DataTypeListingHover extends AbstractConfigurableHover implements L
result += "<br>Missing NULL terminator.";
}
if (sdi.getStringLength() > dataInstance.getLength()) {
result += "<br><font color=\"red\">String exceeds data field.</font>";
result +=
"<br><font color=\"" + Colors.ERROR.toHexString() +
"\">String exceeds data field.</font>";
}
}
return result;

View file

@ -24,6 +24,8 @@ import org.jdom.Element;
import docking.ActionContext;
import docking.action.DockingAction;
import docking.action.MenuData;
import generic.theme.GColor;
import generic.theme.TempColorUtils;
import ghidra.app.CorePluginPackage;
import ghidra.app.context.ListingActionContext;
import ghidra.app.plugin.PluginCategoryNames;
@ -61,7 +63,7 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
private static final String MARKER_DESCRIPTION = "Shows the location of user-applied colors";
private static final int PRIORITY = MarkerService.CHANGE_PRIORITY - 1; // lowest priority
private static final Color MARKER_COLOR = Color.PINK;
private static final Color MARKER_COLOR = new GColor("color.bg.plugin.colorizer.marker");
private static final String COLOR_HISTORY_XML_NAME = "COLOR_HISTORY";
private static final String COLOR_HISTORY_LIST_XML_NAME = "COLOR_HISTORY";
@ -80,12 +82,7 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
private NextColorRangeAction nextAction;
private PreviousColorRangeAction previousAction;
private SwingUpdateManager updateManager = new SwingUpdateManager(1000, new Runnable() {
@Override
public void run() {
doUpdate();
}
});
private SwingUpdateManager updateManager = new SwingUpdateManager(1000, () -> doUpdate());
public ColorizingPlugin(PluginTool tool) {
super(tool);
@ -108,12 +105,12 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
public void readConfigState(SaveState saveState) {
Element xmlElement = saveState.getXmlElement(COLOR_HISTORY_XML_NAME);
if (xmlElement != null) {
List<Color> savedColorHistory = new ArrayList<Color>();
List<Color> savedColorHistory = new ArrayList<>();
List<Element> colorElements = xmlElement.getChildren("COLOR");
for (Element element : colorElements) {
String rgbString = element.getAttributeValue("RGB");
int rgb = Integer.parseInt(rgbString);
savedColorHistory.add(new Color(rgb, true));
savedColorHistory.add(TempColorUtils.fromRgba(rgb));
}
service.setColorHistory(savedColorHistory);
@ -153,15 +150,15 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
}
@Override
public void serviceAdded(Class<?> interfaceClass, Object service) {
public void serviceAdded(Class<?> interfaceClass, Object newService) {
if (interfaceClass.equals(MarkerService.class)) {
markerService = (MarkerService) service;
markerService = (MarkerService) newService;
}
}
@Override
public void serviceRemoved(Class<?> interfaceClass, Object service) {
public void serviceRemoved(Class<?> interfaceClass, Object removedService) {
if (interfaceClass.equals(MarkerService.class)) {
markerService = null;
}

View file

@ -20,6 +20,9 @@ import java.util.Collections;
import java.util.List;
import docking.options.editor.GhidraColorChooser;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.theme.TempColorUtils;
import ghidra.app.util.viewer.listingpanel.PropertyBasedBackgroundColorModel;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.database.IntRangeMap;
@ -29,7 +32,7 @@ import ghidra.util.exception.DuplicateNameException;
class ColorizingServiceProvider implements ColorizingService {
private static final Color DEFAULT_COLOR = new Color(0x84AFD3);
private static final Color DEFAULT_COLOR = new GColor("color.bg.plugin.colorizer.default");
static final String COLOR_CHOOSER_TITLE = "Please Select Background Color";
private final PluginTool tool;
@ -86,7 +89,7 @@ class ColorizingServiceProvider implements ColorizingService {
public Color getColorFromUser(Color suggestedColor) {
if (colorChooser == null) {
colorChooser =
new GhidraColorChooser(suggestedColor == null ? Color.WHITE : suggestedColor);
new GhidraColorChooser(suggestedColor == null ? Palette.WHITE : suggestedColor);
colorChooser.setTitle(COLOR_CHOOSER_TITLE);
if (savedColorHistory != null) {
colorChooser.setColorHistory(savedColorHistory);
@ -135,7 +138,7 @@ class ColorizingServiceProvider implements ColorizingService {
if (map != null) {
Integer value = map.getValue(address);
if (value != null) {
return new Color(value, true);
return TempColorUtils.fromRgba(value);
}
}
return null;

View file

@ -16,12 +16,12 @@
package ghidra.app.plugin.core.comments;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.text.*;
import generic.theme.GColor;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.CommentHistory;
import ghidra.program.model.listing.Program;
@ -115,18 +115,22 @@ class CommentHistoryPanel extends JPanel {
textAttrSet = new SimpleAttributeSet();
textAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
textAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
textAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
textAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.plugin.comments.history.text"));
userAttrSet = new SimpleAttributeSet();
userAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
userAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
userAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
userAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.plugin.comments.history.user"));
dateAttrSet = new SimpleAttributeSet();
dateAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
dateAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
dateAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
dateAttrSet.addAttribute(StyleConstants.Foreground, new Color(124, 37, 18));
dateAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.plugin.comments.history.date"));
tabAttrSet = new SimpleAttributeSet();
TabStop tabs = new TabStop(100, StyleConstants.ALIGN_LEFT, TabStop.LEAD_NONE);

View file

@ -28,6 +28,7 @@ import docking.ActionContext;
import docking.widgets.DropDownSelectionTextField;
import docking.widgets.OptionDialog;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitAttributes;
import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitFieldAllocation;
import ghidra.app.services.DataTypeManagerService;
@ -73,7 +74,6 @@ public class BitFieldEditorPanel extends JPanel {
private BitSelectionHandler bitSelectionHandler;
private boolean updating = false;
BitFieldEditorPanel(Composite composite, DataTypeManagerService dtmService,
@ -179,7 +179,7 @@ public class BitFieldEditorPanel extends JPanel {
statusTextField = new GDLabel(" ");
statusTextField.setHorizontalAlignment(SwingConstants.CENTER);
statusTextField.setForeground(Color.red);
statusTextField.setForeground(Colors.ERROR);
// use a strut panel so the size of the message area does not change if we make
// the message label not visible

View file

@ -22,6 +22,7 @@ import java.util.*;
import javax.help.UnsupportedOperationException;
import javax.swing.*;
import generic.theme.GColor;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Composite;
import ghidra.util.HTMLUtilities;
@ -42,15 +43,25 @@ public class BitFieldPlacementComponent extends JPanel implements Scrollable {
private static final int LENEND_BOX_SIZE = 16;
private static final Color TEXT_COLOR = Color.black;
private static final Color LINE_COLOR = Color.black;
private static final Color BYTE_HEADER_COLOR = new Color(0xdfdfdf);
private static final Color UNDEFINED_BIT_COLOR = new Color(0xf8f8f8);
private static final Color ACTIVE_BITFIELD_BITS_COLOR = Color.green;
private static final Color CONFLICT_BITS_COLOR = Color.yellow;
private static final Color BITFIELD_COMPONENT_COLOR = new Color(0xbfbfff);
private static final Color NON_BITFIELD_COMPONENT_COLOR = new Color(0xa0a0ff);
private static final Color INTERIOR_LINE_COLOR = new Color(0xd4d4d4);
private static final Color TEXT_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.text");
private static final Color LINE_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.line");
private static final Color BYTE_HEADER_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.byte.header");
private static final Color UNDEFINED_BIT_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.bit.undefined");
private static final Color BITFIELD_COMPONENT_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.bit.component");
private static final Color ACTIVE_BITFIELD_BITS_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.bit.active");
private static final Color CONFLICT_BITS_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.bit.conflict");
private static final Color NON_BITFIELD_COMPONENT_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.non.bit");
private static final Color INTERIOR_LINE_COLOR =
new GColor("color.bg.plugin.editors.compositeeditor.line.interior");
private int bitWidth = 10;
private int byteWidth = getByteWidth(bitWidth);
@ -211,7 +222,7 @@ public class BitFieldPlacementComponent extends JPanel implements Scrollable {
return;
}
if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) {
// TODO: should we handle other modes?
// should we handle other modes?
return;
}
e.consume();

View file

@ -30,6 +30,7 @@ import docking.widgets.OptionDialog;
import docking.widgets.button.GRadioButton;
import docking.widgets.fieldpanel.support.FieldSelection;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitAttributes;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Composite;
@ -394,7 +395,9 @@ public class CompEditorPanel extends CompositeEditorPanel {
String alignmentToolTip =
"<HTML>The <B>align</B> control allows the overall minimum alignment of this<BR>" +
"data type to be specified. The actual computed alignment<BR>" +
"may be any multiple of this value. <font color=blue size=\"-2\">(&lt;F1&gt; for help)</HTML>";
"may be any multiple of this value. " +
"<font color=\"" + Palette.BLUE.toHexString() +
"\" size=\"-2\">(&lt;F1&gt; for help)</HTML>";
alignPanel.setToolTipText(alignmentToolTip);
addMinimumAlignmentComponents();
@ -570,7 +573,8 @@ public class CompEditorPanel extends CompositeEditorPanel {
infoPanel.add(actualAlignmentPanel, gridBagConstraints);
actualAlignmentValueTextField = new JTextField(8);
actualAlignmentValueTextField.setText("" + ((CompEditorModel) model).getActualAlignment());
actualAlignmentValueTextField
.setText(Integer.toString(((CompEditorModel) model).getActualAlignment()));
actualAlignmentValueTextField.setToolTipText(actualAlignmentToolTip);
actualAlignmentValueTextField.setEditable(false);
if (helpManager != null) {
@ -586,7 +590,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 3;
infoPanel.add(actualAlignmentValueTextField, gridBagConstraints);
actualAlignmentValueTextField.setBackground(new Color(getBackground().getRGB()));
actualAlignmentValueTextField.setBackground(getBackground());
}
private void setupPacking() {
@ -669,8 +673,11 @@ public class CompEditorPanel extends CompositeEditorPanel {
private void setupPackingEnablementButton() {
packingEnablementButton.setName("Packing Enablement");
String packingToolTipText =
"<HTML>Enable packing when details of all components are known (including sizing and alignment).<BR>" +
"Disable packing when Reverse Engineering composite. <font color=blue size=\"-2\">(&lt;F1&gt; for help)</font></HTML>";
"<HTML>Enable packing when details of all components are known (including sizing and" +
" alignment).<BR>" +
"Disable packing when Reverse Engineering composite. " +
"<font color=\"" + Palette.BLUE.toHexString() +
"\" size=\"-2\">(&lt;F1&gt; for help)</font></HTML>";
packingEnablementButton.addActionListener(e -> {
((CompEditorModel) model).setPackingType(
packingEnablementButton.isSelected() ? PackingType.DEFAULT : PackingType.DISABLED,
@ -708,7 +715,8 @@ public class CompEditorPanel extends CompositeEditorPanel {
explicitPackingButton.addActionListener(e -> chooseByValuePacking());
explicitPackingButton.setToolTipText(packingToolTipText);
if (helpManager != null) {
helpManager.registerHelp(explicitPackingButton, new HelpLocation(provider.getHelpTopic(),
helpManager.registerHelp(explicitPackingButton,
new HelpLocation(provider.getHelpTopic(),
provider.getHelpName() + "_" + "Pack"));
}
@ -831,7 +839,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
}
else {
// not editable - use same background as panel
sizeTextField.setBackground(new Color(getBackground().getRGB()));
sizeTextField.setBackground(getBackground());
}
}

View file

@ -43,6 +43,7 @@ import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import docking.widgets.table.*;
import docking.widgets.textfield.GValidatedTextField;
import generic.theme.GColor;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.datatype.DataTypeSelectionEditor;
import ghidra.app.util.datatype.NavigationDirection;
@ -70,8 +71,6 @@ public abstract class CompositeEditorPanel extends JPanel
implements CompositeEditorModelListener, ComponentCellEditorListener, Draggable, Droppable {
// Normal color for selecting components in the table.
// TODO: Why do we choose a different selection color?
//private static final Color SELECTION_COLOR = Color.YELLOW.brighter().brighter();
//protected static final Insets TEXTFIELD_INSETS = new JTextField().getInsets();
protected static final Border BEVELED_BORDER = BorderFactory.createLoweredBevelBorder();
@ -605,8 +604,6 @@ public abstract class CompositeEditorPanel extends JPanel
JScrollPane sp = new JScrollPane(table);
table.setPreferredScrollableViewportSize(new Dimension(model.getWidth(), 250));
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
//table.setSelectionBackground(SELECTION_COLOR);
//table.setSelectionForeground(Color.black);
tablePanel.add(sp, BorderLayout.CENTER);
SearchControlPanel searchPanel = new SearchControlPanel(this);
@ -636,7 +633,7 @@ public abstract class CompositeEditorPanel extends JPanel
// This can happen on the Mac and is usually white. This is a simple solution for
// that scenario. If this fails on other platforms, then do something more advanced
// at that point.
table.setGridColor(Color.GRAY);
table.setGridColor(new GColor("color.bg.table.grid"));
}
}
@ -668,7 +665,7 @@ public abstract class CompositeEditorPanel extends JPanel
JPanel panel = new JPanel(new BorderLayout());
statusLabel = new GDLabel(" ");
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
statusLabel.setForeground(Color.blue);
statusLabel.setForeground(new GColor("color.fg.dialog.status.normal"));
statusLabel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {

View file

@ -15,13 +15,13 @@
*/
package ghidra.app.plugin.core.compositeeditor;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import docking.widgets.table.GTableCellRenderer;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.util.ToolTipUtils;
import ghidra.program.model.data.*;
import ghidra.util.HTMLUtilities;
@ -43,7 +43,7 @@ public class DataTypeCellRenderer extends GTableCellRenderer {
String dtString = "";
String tooltipText = null;
boolean useRed = false;
boolean showError = false;
DataType dt = null;
if (value instanceof DataTypeInstance) {
@ -51,7 +51,7 @@ public class DataTypeCellRenderer extends GTableCellRenderer {
tooltipText = getDataTypeToolTip(dt);
dtString = dt.getDisplayName();
if (dt.isNotYetDefined()) {
useRed = true;
showError = true;
}
}
@ -61,8 +61,8 @@ public class DataTypeCellRenderer extends GTableCellRenderer {
c.setToolTipText(tooltipText);
if (useRed) {
c.setForeground(Color.RED);
if (showError) {
c.setForeground(Colors.ERROR);
}
return c;

View file

@ -15,10 +15,10 @@
*/
package ghidra.app.plugin.core.data;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.TitledBorder;
@ -31,6 +31,7 @@ import javax.swing.text.Document;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.table.*;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.ToolTipUtils;
import ghidra.framework.plugintool.PluginTool;
@ -272,18 +273,17 @@ public class CreateStructureDialog extends DialogComponentProvider {
return matchingStylePanel;
}
// toggles whether the structure being created is new, based upon the
// name field, or a current structure, based upon a structure in the
// table. This method updates the GUI to reflect the current creation
// state.
// toggles whether the structure being created is new, based upon the name field, or a current
// structure, based upon a structure in the table. This method updates the GUI to reflect the
// current creation state.
private void setCreateStructureByName(boolean createStructureByName) {
if (createStructureByName) {
nameBorder.setTitleColor(Color.BLACK);
structureBorder.setTitleColor(Color.GRAY);
nameBorder.setTitleColor(Colors.FOREGROUND);
structureBorder.setTitleColor(Colors.FOREGROUND_DISABLED);
}
else {
nameBorder.setTitleColor(Color.GRAY);
structureBorder.setTitleColor(Color.BLACK);
nameBorder.setTitleColor(Colors.FOREGROUND_DISABLED);
structureBorder.setTitleColor(Colors.FOREGROUND);
}
nameTextField.setEnabled(createStructureByName);
@ -299,7 +299,7 @@ public class CreateStructureDialog extends DialogComponentProvider {
// this class in terms of data contained
private void searchForMatchingStructures(final Program program, final Structure structure) {
SwingUtilities.invokeLater(() -> {
Swing.runLater(() -> {
// Get the structures from the DataTypeManagers of the
// DataTypeManagerService
DataTypeManagerService service = pluginTool.getService(DataTypeManagerService.class);

View file

@ -18,10 +18,9 @@ package ghidra.app.plugin.core.datamgr;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import docking.widgets.label.GDHtmlLabel;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.util.ToolTipUtils;
import ghidra.app.util.html.HTMLDataTypeRepresentation;
import ghidra.program.model.data.DataType;
@ -41,13 +40,6 @@ class DataTypeComparePanel extends JPanel {
private String clientName;
private String sourceName;
/**
* Creates a panel for viewing two data types side by side.
* @param dataType1 the first data type to display.
* @param dataType2 the second data type to display.
* @param one_to_two true if this panel should display an arrow from data type 1 to data type 2.
* false if the should be from 2 to 1.
*/
DataTypeComparePanel(String clientName, String sourceName) {
super(new GridLayout(0, 2));
this.clientName = clientName;
@ -72,12 +64,12 @@ class DataTypeComparePanel extends JPanel {
add(rightPanel);
dtLabel1 = new GDHtmlLabel();
dtLabel1.setOpaque(true);
dtLabel1.setBackground(Color.WHITE);
dtLabel1.setBackground(Colors.BACKGROUND);
dtLabel1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0));
dtLabel1.setVerticalAlignment(SwingConstants.TOP);
dtLabel2 = new GDHtmlLabel();
dtLabel2.setOpaque(true);
dtLabel2.setBackground(Color.WHITE);
dtLabel2.setBackground(Colors.BACKGROUND);
dtLabel2.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0));
dtLabel2.setVerticalAlignment(SwingConstants.TOP);
@ -96,19 +88,13 @@ class DataTypeComparePanel extends JPanel {
private void syncScrollers(JScrollPane leftScrollPane, JScrollPane rightScrollPane) {
final JViewport viewport1 = leftScrollPane.getViewport();
final JViewport viewport2 = rightScrollPane.getViewport();
viewport1.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
viewport1.addChangeListener(e -> {
int y = viewport1.getViewPosition().y;
viewport2.setViewPosition(new Point(0, y));
}
});
viewport2.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
viewport2.addChangeListener(e -> {
int y = viewport2.getViewPosition().y;
viewport1.setViewPosition(new Point(0, y));
}
});
}

View file

@ -24,6 +24,7 @@ import docking.ActionContext;
import docking.action.*;
import docking.widgets.OptionDialog;
import docking.widgets.tree.GTree;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
import ghidra.app.plugin.core.datamgr.archive.FileArchive;
@ -95,7 +96,8 @@ public class DeleteArchiveAction extends DockingAction {
"Confirm Delete Operation",
"<html><b>Are you sure you want to delete archive: " +
HTMLUtilities.escapeHTML(node.getName()) + "?<br><br>" +
"<font color=\"red\">(WARNING: This action will permanently " +
"<font color=\"" + Colors.ERROR.toHexString() +
"\">(WARNING: This action will permanently " +
"delete the file from disk.)</font></b>",
"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
return;

View file

@ -23,6 +23,7 @@ import docking.action.MenuData;
import docking.widgets.OptionDialog;
import docking.widgets.tree.GTree;
import docking.widgets.tree.GTreeNode;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
import ghidra.app.plugin.core.datamgr.archive.*;
@ -79,7 +80,8 @@ public class RemoveInvalidArchiveFromProgramAction extends DockingAction {
"<html><b>Are you sure you want to delete archive: " +
HTMLUtilities.escapeHTML(invalidArchiveNode.getName()) +
" from the program?<br><br>" +
"<font color=\"red\">(WARNING: This action will disassociate " +
"<font color=\"" + Colors.ERROR.toHexString() +
"\">(WARNING: This action will disassociate " +
"all datatypes in the program from this archive.)</font></b>",
"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
return;

View file

@ -17,6 +17,7 @@ package ghidra.app.plugin.core.datamgr.actions;
import java.awt.Color;
import generic.theme.GColor;
import ghidra.app.util.ToolTipUtils;
import ghidra.program.model.data.*;
import ghidra.service.graph.*;
@ -33,6 +34,13 @@ import ghidra.util.task.TaskMonitor;
*/
public class TypeGraphTask extends Task {
private static final Color BG_COLOR_DEFAULT =
new GColor("color.bg.plugin.datamgr.edge.default");
private static final Color BG_COLOR_COMPOSITE =
new GColor("color.bg.plugin.datamgr.edge.composite");
private static final Color BG_COLOR_REFERERNCE =
new GColor("color.bg.plugin.datamgr.edge.reference");
private DataType type;
private String graphTitle;
private GraphDisplayProvider graphService;
@ -64,9 +72,9 @@ public class TypeGraphTask extends Task {
.build();
GraphDisplayOptions options = new GraphDisplayOptionsBuilder(graphType)
.defaultVertexColor(Color.BLUE)
.edge(COMPOSITE, Color.MAGENTA)
.edge(REFERENCE, Color.BLUE)
.defaultVertexColor(BG_COLOR_DEFAULT)
.edge(COMPOSITE, BG_COLOR_COMPOSITE)
.edge(REFERENCE, BG_COLOR_REFERERNCE)
.build();
AttributedGraph graph = new AttributedGraph(graphTitle, graphType);

View file

@ -31,6 +31,7 @@ import docking.ActionContext;
import docking.ComponentProvider;
import docking.action.*;
import docking.widgets.OptionDialog;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.compositeeditor.EditorListener;
import ghidra.app.plugin.core.compositeeditor.EditorProvider;
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
@ -400,8 +401,9 @@ public class EnumEditorProvider extends ComponentProviderAdapter
private int showOptionDialog(Enum editedEnoom, Set<String> oldNameFields) {
StringBuilder msg = new StringBuilder(
"<html>If you save this Enum with the <font color=#ff0000>new value(s)</font>" +
" listed below,<br> it will invalidate equates created with the old value(s).<br>");
"<html>If you save this Enum with the <font color=\"" + Colors.ERROR.toHexString() +
"\">new value(s)</font> listed below,<br>" +
" it will invalidate equates created with the old value(s).<br>");
msg.append("<ul>");
for (String field : oldNameFields) {
String newVal;
@ -412,13 +414,16 @@ public class EnumEditorProvider extends ComponentProviderAdapter
// Happens if a field is deleted or there is a name AND value change.
newVal = "Missing";
}
msg.append(String.format("<li>%s: 0x%s \u2192 <font color=#ff0000>%s</font></li>",
msg.append(String.format(
"<li>%s: 0x%s \u2192 <font color=\"" + Colors.ERROR.toHexString() +
"\">%s</font></li>",
HTMLUtilities.escapeHTML(field), Long.toHexString(originalEnum.getValue(field)),
newVal));
}
msg.append("</ul>");
msg.append(
"Invalidated equates can be automatically removed now or<br>managed later from the <i><b>Equates Table</i></b> window.");
"Invalidated equates can be automatically removed now or<br>managed later from the" +
" <i><b>Equates Table</i></b> window.");
msg.append("</html>");
int choice = OptionDialog.showOptionDialog(editorPanel, "Equate Conflicts", msg.toString(),
"Save and remove", "Save", OptionDialog.ERROR_MESSAGE);

View file

@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import generic.theme.GColor;
import ghidra.app.services.DataTypeQueryService;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Enum;
@ -37,6 +38,9 @@ public class DataTypeUtils {
private static final char END_CHAR = '\uffff';
private static final char BEGIN_CHAR = '\u0000';
private static final Color COLOR_ICON_HIGHLIGHT =
new GColor("color.bg.plugin.datamgr.icon.highlight");
private static Map<Icon, MultiIcon> highlightIconMap = new HashMap<>();
private static String OPEN_FOLDER = "images/openFolder.png";
@ -281,7 +285,7 @@ public class DataTypeUtils {
MultiIcon highlightIcon = highlightIconMap.get(baseIcon);
if (highlightIcon == null) {
highlightIcon = new MultiIcon(new HighlightIcon(new Color(204, 204, 255)));
highlightIcon = new MultiIcon(new HighlightIcon(COLOR_ICON_HIGHLIGHT));
highlightIcon.addIcon(baseIcon);
highlightIconMap.put(baseIcon, highlightIcon);
}
@ -461,7 +465,6 @@ public class DataTypeUtils {
}
Msg.showInfo(DataTypeUtils.class, parent, title, msg);
}
}
//==================================================================================================
@ -533,45 +536,3 @@ class HighlightIcon implements Icon {
g.drawRect(x, y, WIDTH + 1, HEIGHT - 1);
}
}
class VersionIcon implements Icon {
private static Color VERSION_ICON_COLOR_DARK = new Color(0x82, 0x82, 0xff);
private static Color VERSION_ICON_COLOR_LIGHT = new Color(0x9f, 0x9f, 0xff);
private static final int WIDTH = 18;
private static final int HEIGHT = 17;
int width;
int height;
VersionIcon() {
this(WIDTH, HEIGHT);
}
VersionIcon(int width, int height) {
this.width = width;
this.height = height;
}
@Override
public int getIconHeight() {
return height;
}
@Override
public int getIconWidth() {
return width;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(VERSION_ICON_COLOR_LIGHT);
g.fillRect(x + 1, y + 1, width - 2, height - 2);
g.setColor(VERSION_ICON_COLOR_DARK);
g.drawLine(x + 1, y, x + width - 2, y);
g.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
g.drawLine(x + 1, y + height - 1, x + width - 2, y + height - 1);
g.drawLine(x, y + 1, x, y + height - 2);
}
}

View file

@ -34,6 +34,7 @@ import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.filter.FilterListener;
import docking.widgets.filter.FilterTextField;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.listing.Program;
import ghidra.util.HelpLocation;
import ghidra.util.task.SwingUpdateManager;
@ -133,8 +134,8 @@ class FilterAction extends ToggleDockingAction {
}
synchronized void selectTypes(ArrayList<String> list) {
for (int i = 0; i < list.size(); i++) {
typeEnabledMap.put(list.get(i), Boolean.TRUE);
for (String element : list) {
typeEnabledMap.put(element, Boolean.TRUE);
}
if (dialog != null) {
dialog.selectTypes(list);
@ -222,15 +223,13 @@ class FilterAction extends ToggleDockingAction {
}
void selectTypes(ArrayList<String> list) {
for (int i = 0; i < list.size(); i++) {
String type = list.get(i);
for (String type : list) {
selectCheckBox(type);
}
}
private void selectCheckBox(String typeName) {
for (int i = 0; i < checkboxes.size(); i++) {
JCheckBox cb = checkboxes.get(i);
for (JCheckBox cb : checkboxes) {
if (cb.getText().equals(typeName)) {
cb.setSelected(true);
return;
@ -302,7 +301,7 @@ class FilterAction extends ToggleDockingAction {
typeButtonPanel.add(selectNoneButton);
checkboxPanel = new JPanel();
checkboxPanel.setBackground(Color.WHITE);
checkboxPanel.setBackground(Colors.BACKGROUND);
checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS));
buildCheckBoxList();

View file

@ -24,6 +24,7 @@ import javax.swing.event.ChangeListener;
import docking.WindowPosition;
import docking.widgets.list.GListCellRenderer;
import generic.theme.Gui;
import ghidra.GhidraOptions;
import ghidra.app.CorePluginPackage;
import ghidra.app.plugin.PluginCategoryNames;
@ -449,8 +450,8 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
Color background = selectedAddressColor;
if (isSelected) {
foreground = foreground.brighter();
background = background.darker();
foreground = Gui.brighter(foreground);
background = Gui.darker(background);
}
setForeground(foreground);
@ -509,22 +510,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
opt.removeOptionsChangeListener(optionsChangeListener);
}
/**
* Adds the given listener to be notified when the user selects list
* items in the view.
*
* @param listener The listener to add.
*/
// void addListSelectionListener( ListSelectionListener listener )
// {
// contentList.addListSelectionListener( listener );
// }
/**
* Sets the contents to the provided value.
*
* @param displayContents The value that the view should display.
*/
void setContents(DisassembledAddressInfo[] addressInfos) {
contentList.setListData(addressInfos);
}
@ -606,9 +591,8 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
}
/**
* An object that provides information about the address that it wraps.
* The info knows how to locate a {@link CodeInfo} object for the address
* and can generate a string preview of the address.
* An object that provides information about the address that it wraps. The info knows how to
* locate an info object for the address and can generate a string preview of the address.
*/
private class DisassembledAddressInfo {
/**
@ -683,8 +667,8 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
/**
* Get the code unit from the program location.
*
* @param The address from which we want the CodeUnit.
* @return CodeUnit null if there is no location.
* @param address the address from which we want the CodeUnit.
* @return null if there is no location.
*/
private CodeUnit getCodeUnitForAddress(Address address) {
CodeUnit codeUnit = null;
@ -693,8 +677,8 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
Listing listing = currentProgram.getListing();
codeUnit = listing.getCodeUnitAt(address);
// if the CodeUnit is Data and is not defined, then we
// need to try to virutally disassemble it
// if the CodeUnit is Data and is not defined, then we need to try to virtually
// disassemble it
if (codeUnit instanceof Data) {
if (!((Data) codeUnit).isDefined()) {
CodeUnit virtualCodeUnit = virtuallyDisassembleAddress(address);
@ -727,18 +711,15 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
codeUnit = disassembler.disassemble(address);
}
catch (UsrException ue) {
// these exceptions happen if there is insufficient data
// from the program: InsufficientBytesException,
// UnknownInstructionException, UnknownContextException
// these exceptions happen if there is insufficient data from the program:
// InsufficientBytesException, UnknownInstructionException,
// UnknownContextException
}
}
return codeUnit;
}
/**
* Gets the preview String for the provided code unit.
*/
public String getAddressPreview(CodeUnitFormat format) {
return getAddress().toString() + " " + format.getRepresentationString(addressCodeUnit);
}

View file

@ -21,8 +21,11 @@ import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JTable;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.util.ToolTipUtils;
import ghidra.docking.settings.FormatSettingsDefinition;
import ghidra.docking.settings.Settings;
@ -40,6 +43,8 @@ import util.CollectionUtils;
class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
private static final Color FG_ENUM_BASED = new GColor("color.fg.plugin.equate.enum");
private EquateTablePlugin plugin;
private List<Equate> equateList = new ArrayList<>();
@ -149,10 +154,14 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
return label;
}
JTable table = data.getTable();
if (!eq.isValidUUID()) { // Error equate
label.setForeground((isSelected) ? Color.WHITE : Color.RED);
} else if (!eq.isEnumBased()) { // User label
label.setForeground((isSelected) ? Color.WHITE : Color.BLUE.brighter());
label.setForeground(
(isSelected) ? table.getSelectionForeground() : Tables.FG_ERROR_UNSELECTED);
}
else if (!eq.isEnumBased()) { // User label
label.setForeground(
(isSelected) ? table.getSelectionForeground() : FG_ENUM_BASED);
}
String tooltip = getEquateToolTip(eq);
@ -192,7 +201,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
@Override
public String getValue(Equate rowObject, Settings settings, Object data,
ServiceProvider serviceProvider) throws IllegalArgumentException {
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getDisplayName();
}
@ -243,7 +252,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
@Override
public Long getValue(Equate rowObject, Settings settings, Object data,
ServiceProvider serviceProvider) throws IllegalArgumentException {
ServiceProvider sp) throws IllegalArgumentException {
FormatSettingsDefinition formatDef = FormatSettingsDefinition.DEF;
@ -274,7 +283,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
@Override
public Integer getValue(Equate rowObject, Settings settings, Object data,
ServiceProvider serviceProvider) throws IllegalArgumentException {
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getReferenceCount();
}
@ -292,7 +301,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
@Override
public Boolean getValue(Equate rowObject, Settings settings, Object data,
ServiceProvider serviceProvider) throws IllegalArgumentException {
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.isEnumBased();
}
}

View file

@ -15,11 +15,12 @@
*/
package ghidra.app.plugin.core.function;
import java.awt.Color;
import java.math.BigInteger;
import docking.widgets.fieldpanel.field.*;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.app.cmd.function.CallDepthChangeInfo;
import ghidra.app.util.HighlightProvider;
import ghidra.app.util.viewer.field.*;
@ -39,12 +40,8 @@ public class StackDepthFieldFactory extends FieldFactory {
private CallDepthChangeInfo depth = null;
private long lastModNumber = -1;
/**
*
*/
public StackDepthFieldFactory() {
super(FIELD_NAME);
// TODO Auto-generated constructor stub
}
private StackDepthFieldFactory(FieldFormatModel model, HighlightProvider hsProvider,
@ -57,14 +54,11 @@ public class StackDepthFieldFactory extends FieldFactory {
@Override
public FieldFactory newInstance(FieldFormatModel newModel, HighlightProvider highlightProvider,
ToolOptions displayOptions, ToolOptions fieldOptions) {
return new StackDepthFieldFactory(newModel, highlightProvider, displayOptions,
ToolOptions toolDisplayOptions, ToolOptions fieldOptions) {
return new StackDepthFieldFactory(newModel, highlightProvider, toolDisplayOptions,
fieldOptions);
}
/**
* @see ghidra.app.util.viewer.field.FieldFactory#getField(ProxyObj, int)
*/
@Override
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
Object obj = proxy.getObject();
@ -94,14 +88,14 @@ public class StackDepthFieldFactory extends FieldFactory {
// This can be used to display the value of any register symbolically flowing over the program.
// depthString = depth.getRegValueRepresentation(cu.getMinAddress(), cu.getProgram().getRegister("ESP"));
AttributedString as = new AttributedString(depthString, Color.BLUE, getMetrics());
AttributedString as = new AttributedString(depthString, Palette.BLUE, getMetrics());
Integer overrideDepth =
CallDepthChangeInfo.getStackDepthChange(cu.getProgram(), cu.getMinAddress());
if (overrideDepth != null) {
String grows = (func.getStackFrame().growsNegative() ? " - " : " + ");
depthString = depthString + grows + Integer.toString(overrideDepth, 16);
as = new AttributedString(depthString, Color.RED, getMetrics());
as = new AttributedString(depthString, Colors.ERROR, getMetrics());
}
FieldElement text = new TextFieldElement(as, 0, 0);
@ -109,13 +103,9 @@ public class StackDepthFieldFactory extends FieldFactory {
width, hlProvider);
}
/**
* @param depthChange
* @return
*/
private String getDepthString(int depthChange, boolean isInDelaySlot) {
if (isInDelaySlot) {
return ""; // if in delayslot, stack changes will be on main instruction
return ""; // if in delay slot, stack changes will be on main instruction
}
String stringDepth = "- ? -";

View file

@ -35,6 +35,9 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GComboBox;
import docking.widgets.label.GLabel;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.*;
import generic.util.WindowUtilities;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.ToolTipUtils;
@ -50,6 +53,9 @@ import ghidra.util.layout.VerticalLayout;
import resources.ResourceManager;
public class FunctionEditorDialog extends DialogComponentProvider implements ModelChangeListener {
private static final Color FG_COLOR_THUNK =
new GColor("color.fg.plugin.function.editor.dialog.thunk");
private static Icon ADD_ICON = ResourceManager.loadImage("images/Plus.png");
private static Icon REMOVE_ICON = ResourceManager.loadImage("images/edit-delete.png");
private static Icon UP_ICON = ResourceManager.loadImage("images/up.png");
@ -209,10 +215,10 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
thunkedText.setEditable(false);
DockingUtils.setTransparent(thunkedText);
CompoundBorder border =
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.GRAY),
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
BorderFactory.createEmptyBorder(0, 5, 0, 5));
thunkedText.setBorder(border);
thunkedText.setForeground(Color.BLUE);
thunkedText.setForeground(FG_COLOR_THUNK);
thunkedPanel.add(thunkedText);
return thunkedPanel;
}
@ -224,9 +230,9 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
scroll = new JScrollPane(verticalScrollPanel);
scroll.setBorder(null);
scroll.setOpaque(true);
scroll.setBackground(Color.WHITE);
scroll.getViewport().setBackground(new Color(0, 0, 0, 0)); // transparent
scroll.getViewport().setBackground(Color.WHITE);
scroll.setBackground(Colors.BACKGROUND);
scroll.getViewport().setBackground(Palette.NO_COLOR); // transparent
scroll.getViewport().setBackground(Colors.BACKGROUND);
previewPanel.add(scroll, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLoweredBevelBorder());
scroll.getViewport().addMouseListener(new MouseAdapter() {
@ -657,12 +663,13 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
DataType dataType = (DataType) value;
Color color = isSelected ? table.getSelectionForeground() : table.getForeground();
if (!tableModel.isCellEditable(row, column)) {
color = isSelected ? Color.yellow : Color.gray;
color =
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED;
}
if (dataType != null) {
setText(dataType.getName());
if (dataType.isNotYetDefined()) {
color = Color.red;
color = isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED;
}
String toolTipText = ToolTipUtils.getToolTipText(dataType);
String headerText = "<HTML><b>" +
@ -751,17 +758,20 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
boolean isInvalidStorage =
!storage.isValid() || rowData.getFormalDataType().getLength() != storage.size();
if (isInvalidStorage) {
setForeground(Color.RED);
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
setToolTipText("Invalid Parameter Storage");
}
else {
setForeground(isSelected ? Color.WHITE : Color.BLACK);
setForeground(
isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
setToolTipText("");
}
setText(storage.toString());
}
else {
setForeground(isSelected ? Color.WHITE : Color.BLACK);
setForeground(
isSelected ? table.getSelectionForeground() : Colors.FOREGROUND);
setText("");
setToolTipText(null);
}
@ -770,6 +780,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
}
private class VariableStringCellRenderer extends GTableCellRenderer {
@Override
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
@ -785,7 +796,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
if (!tableModel.isCellEditable(row, column)) {
setForeground(isSelected ? Color.yellow : Color.gray);
setForeground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
}
else {
if (isSelected) {
@ -853,7 +865,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
Composite originalComposite = g2d.getComposite();
g2d.setComposite(alphaComposite);
g.setColor(Color.white);
g.setColor(Colors.BACKGROUND);
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g2d.setComposite(originalComposite);

View file

@ -15,9 +15,6 @@
*/
package ghidra.app.plugin.core.function.editor;
import static java.awt.Color.blue;
import static java.awt.Color.red;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
@ -28,16 +25,21 @@ import javax.swing.event.*;
import javax.swing.text.*;
import docking.actions.KeyBindingUtils;
import generic.theme.GColor;
import ghidra.util.Swing;
class FunctionSignatureTextField extends JTextPane {
private static final String ENTER_ACTION_NAME = "ENTER";
private static final String ESCAPE_ACTION_NAME = "ESCAPE";
private static final String TAB_ACTION_NAME = "TAB";
public static Color DEFAULT_COLOR = Color.black;
public static Color PARAMETER_NAME_COLOR = new Color(155, 50, 155);
public static Color FUNCTION_NAME_COLOR = blue;
public static Color ERROR_NAME_COLOR = red;
public static Color DEFAULT_COLOR =
new GColor("color.fg.plugin.function.editor.dialog.textfield.default");
public static Color PARAMETER_NAME_COLOR =
new GColor("color.fg.plugin.function.editor.dialog.textfield.parameter");
public static Color FUNCTION_NAME_COLOR =
new GColor("color.fg.plugin.function.editor.dialog.textfield.function.name");
public static Color ERROR_NAME_COLOR =
new GColor("color.fg.plugin.function.editor.dialog.textfield.error");
private StyledDocument doc;
private SimpleAttributeSet paramNameAttributes;

View file

@ -15,7 +15,6 @@
*/
package ghidra.app.plugin.core.function.editor;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.util.EventObject;
@ -24,6 +23,7 @@ import javax.swing.*;
import javax.swing.table.TableCellEditor;
import docking.DockingWindowManager;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.program.model.listing.VariableStorage;
class StorageTableCellEditor extends AbstractCellEditor implements TableCellEditor {
@ -53,16 +53,14 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
boolean isSelected, int row, int column) {
String stringValue = value == null ? "" : value.toString();
JTextField field = new JTextField(stringValue);
field.setBackground(Color.yellow);
field.setBackground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
field.setEditable(false);
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
FunctionVariableData rowData = tableModel.getRowObject(row);
final StorageAddressEditorDialog dialog = new StorageAddressEditorDialog(model.getProgram(),
model.getDataTypeManagerService(), (VariableStorage) value, rowData);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SwingUtilities.invokeLater(() -> {
DockingWindowManager.showDialog(table, dialog);
if (!dialog.wasCancelled()) {
storage = dialog.getStorage();
@ -77,7 +75,6 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
else {
cellEditor.stopCellEditing();
}
}
});
return field;
}

View file

@ -15,9 +15,9 @@
*/
package ghidra.app.plugin.core.function.tags;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.BevelBorder;
@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.HintTextField;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.app.cmd.function.CreateFunctionTagCmd;
import ghidra.app.context.ProgramActionContext;
import ghidra.framework.cmd.Command;
@ -58,8 +59,6 @@ import resources.ResourceManager;
public class FunctionTagProvider extends ComponentProviderAdapter
implements DomainObjectListener {
private Color BORDER_COLOR = Color.GRAY;
private SourceTagsPanel sourcePanel;
private TargetTagsPanel targetPanel;
private FunctionTagButtonPanel buttonPanel;
@ -240,9 +239,9 @@ public class FunctionTagProvider extends ComponentProviderAdapter
targetPanel = new TargetTagsPanel(this, tool, "Assigned To Function");
allFunctionsPanel = new AllFunctionsPanel(program, this, "Functions with Selected Tag");
buttonPanel = new FunctionTagButtonPanel(sourcePanel, targetPanel);
sourcePanel.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
targetPanel.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
sourcePanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
targetPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
// If we don't set this, then the splitter won't be able to shrink the
// target panels below the size required by its header, which can be large

View file

@ -24,6 +24,8 @@ import javax.swing.JToolTip;
import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.gotoquery.GoToHelper;
import ghidra.app.services.CodeFormatService;
import ghidra.app.util.*;
@ -44,7 +46,8 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
private static final int WINDOW_OFFSET = 50;
private static final Color BACKGROUND_COLOR = new Color(255, 255, 230);
private static final Color BACKGROUND_COLOR = Colors.TOOLTIP_BACKGROUND;
private static final Color FG_COLOR_NOT_IN_MEMORY = new GColor("color.fg.disabled");
private CodeFormatService codeFormatService;
private ListingPanel panel;
@ -283,7 +286,7 @@ public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
String message = "Address not in memory";
message = HTMLUtilities.italic(message);
message = HTMLUtilities.colorString(Color.GRAY, message);
message = HTMLUtilities.colorString(FG_COLOR_NOT_IN_MEMORY, message);
buffy.append(message);
toolTip.setTipText(buffy.toString());
return toolTip;

View file

@ -15,13 +15,13 @@
*/
package ghidra.app.plugin.core.instructionsearch;
import java.awt.Color;
import java.util.HashSet;
import java.util.Set;
import docking.action.DockingAction;
import docking.action.MenuData;
import docking.tool.ToolConstants;
import generic.theme.GThemeDefaults.Colors.Dialogs;
import ghidra.app.CorePluginPackage;
import ghidra.app.context.NavigatableActionContext;
import ghidra.app.context.NavigatableContextAction;
@ -135,12 +135,12 @@ public class InstructionSearchPlugin extends ProgramPlugin {
if (selection.getNumAddresses() == 0) {
dialog.displayMessage(
"Select instructions from the listing (and hit reload) to populate the table.",
Color.BLUE);
Dialogs.FG_MESSAGE_NORMAL);
return false;
}
if (!isSelectionSizeValid(selection)) {
dialog.displayMessage("Invalid selection. Cannot select more than " +
MAX_SELECTION_SIZE + " instructions and/or data items.", Color.RED);
MAX_SELECTION_SIZE + " instructions and/or data items.", Dialogs.FG_MESSAGE_ERROR);
return false;
}
@ -150,7 +150,7 @@ public class InstructionSearchPlugin extends ProgramPlugin {
}
}
catch (InvalidInputException e) {
dialog.displayMessage(e.getMessage(), Color.RED);
dialog.displayMessage(e.getMessage(), Dialogs.FG_MESSAGE_ERROR);
return false;
}

View file

@ -22,6 +22,8 @@ import java.util.Set;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.instructionsearch.ui.AbstractInstructionTable.OperandState;
import ghidra.app.plugin.core.instructionsearch.ui.InstructionTable;
@ -42,37 +44,41 @@ public class InstructionTableDataObject {
* This is static since all data objects will have the same list of
* observers
*/
private Set<InstructionTableObserver> observers = new HashSet<InstructionTableObserver>();
private Set<InstructionTableObserver> observers = new HashSet<>();
// The text displayed in the cell.
private String data;
// Some cell attributes.
private Color backgroundColor;
private Color foregroundColor;
private Color foregroundColor = Colors.FOREGROUND;
private int fontStyle;
// The border style of the cell. This is used to facilitate the 3D look of the
// cells (bevel-styling).
// The border style of the cell. This is used to facilitate the 3D look of the cells
// (bevel-styling).
private Border border;
// The state of the object; this describes whether the cell is in a masked or
// unmasked state, or neither (NA).
// The state of the object; this describes whether the cell is in a masked or unmasked state,
// or neither (NA).
private OperandState state;
// True if this data object represents an instruction (and not an undefined data item or
// string).
// True if this data object represents an instruction (and not an undefined data).
private boolean isInstruction;
// Stores information about the operand for this cell (if it's an operand); if the
// cell represents a mnemonic then this does not apply.
private OperandMetadata operandCase;
private static final Color BACKGROUND_COLOR = new Color(237, 243, 254);
private static final Color BACKGROUND_COLOR_DARKER = new Color(188, 212, 254);
private static final Color BACKGROUND_COLOR_NON_INSTRUCTION = new Color(255, 242, 214);
private static final Color BACKGROUND_COLOR_DARKER_NON_INSTRUCTION = new Color(203, 186, 150);
private static final Color PANEL_COLOR = new Color(214, 217, 223);
private static final Color BG_COLOR_MASKED_INSTRUCTION =
new GColor("color.bg.plugin.instructionsearch.table.masked.instruction");
private static final Color BG_COLOR_NOT_MASKED_INSTRUCTION =
new GColor("color.bg.plugin.instructionsearch.table.not.masked.instruction");
private static final Color BG_COLOR_MASKED_NON_INSTRUCTION =
new GColor("color.bg.plugin.instructionsearch.table.masked.non.instruction");
private static final Color BG_COLOR_NOT_MASKED_NON_INSTRUCTION =
new GColor("color.bg.plugin.instructionsearch.table.not.masked.non.instruction");
private static final Color BG_COLOR_DEFAULT =
new GColor("color.bg.plugin.instructionsearch.table.default");
/**
* Constructor.
@ -124,22 +130,20 @@ public class InstructionTableDataObject {
switch (state) {
case MASKED:
backgroundColor =
isInstruction ? BACKGROUND_COLOR : BACKGROUND_COLOR_NON_INSTRUCTION;
foregroundColor = Color.BLACK;
isInstruction ? BG_COLOR_MASKED_INSTRUCTION : BG_COLOR_MASKED_NON_INSTRUCTION;
border = BorderFactory.createLoweredSoftBevelBorder();
break;
case NOT_MASKED:
backgroundColor = isInstruction ? BACKGROUND_COLOR_DARKER
: BACKGROUND_COLOR_DARKER_NON_INSTRUCTION;
foregroundColor = Color.BLACK;
backgroundColor = isInstruction ? BG_COLOR_NOT_MASKED_INSTRUCTION
: BG_COLOR_NOT_MASKED_NON_INSTRUCTION;
border = BorderFactory.createRaisedSoftBevelBorder();
break;
case NA:
backgroundColor = PANEL_COLOR;
backgroundColor = BG_COLOR_DEFAULT;
break;
case PREVIEW:
backgroundColor =
isInstruction ? BACKGROUND_COLOR : BACKGROUND_COLOR_NON_INSTRUCTION;
isInstruction ? BG_COLOR_MASKED_INSTRUCTION : BG_COLOR_MASKED_NON_INSTRUCTION;
break;
}
@ -148,9 +152,6 @@ public class InstructionTableDataObject {
}
}
/**
* Subscribes the given observer to be notified of changes to this object.
*/
public void register(InstructionTableObserver observer) {
observers.add(observer);
}

View file

@ -15,11 +15,13 @@
*/
package ghidra.app.plugin.core.instructionsearch.ui;
import java.awt.*;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
/**
@ -31,11 +33,6 @@ public class ControlPanel extends JPanel {
private SelectionScopeWidget rangeWidget;
private SearchDirectionWidget directionWidget;
/**
*
* @param plugin
* @param dialog
*/
public ControlPanel(InstructionSearchPlugin plugin, InstructionSearchDialog dialog) {
setLayout(new GridBagLayout());
@ -60,21 +57,13 @@ public class ControlPanel extends JPanel {
gbc.weightx = 1.0;
this.add(directionWidget, gbc);
this.setBorder(BorderFactory.createLineBorder(Color.GRAY));
this.setBorder(BorderFactory.createLineBorder(Java.BORDER));
}
/**
*
* @return
*/
public SelectionScopeWidget getRangeWidget() {
return this.rangeWidget;
}
/**
*
* @return
*/
public SearchDirectionWidget getDirectionWidget() {
return this.directionWidget;
}

View file

@ -15,25 +15,23 @@
*/
package ghidra.app.plugin.core.instructionsearch.ui;
import java.awt.Color;
import java.awt.Font;
import docking.widgets.textarea.HintTextArea;
import generic.theme.GThemeDefaults.Colors;
/**
* Allows users to provide a text hint in a text field, shown only when the text is empty.
*
* <p>
* Hint text will be shown in light grey, italicized, and in angle brackets. Normal text will
* be plain black.
*/
public class HintTextAreaIS extends HintTextArea {
private String hint;
/**
* Constructs the class with the hint text to be shown.
*
* @param hint
* @param hint the hint
*/
public HintTextAreaIS(final String hint) {
super(hint);
@ -53,16 +51,12 @@ public class HintTextAreaIS extends HintTextArea {
setAttributes();
}
/*********************************************************************************************
* PRIVATE METHODS
********************************************************************************************/
/**
* Sets the text attributes to be used when there is an error in the input.
*/
private void setErrorAttributes() {
this.setFont(getFont().deriveFont(Font.PLAIN));
setForeground(Color.RED);
setForeground(Colors.ERROR);
}
}

View file

@ -15,7 +15,8 @@
*/
package ghidra.app.plugin.core.instructionsearch.ui;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
@ -25,6 +26,7 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import docking.DialogComponentProvider;
import generic.theme.GThemeDefaults.Colors.Dialogs;
import ghidra.app.plugin.core.instructionsearch.model.*;
import ghidra.app.plugin.core.instructionsearch.ui.SelectionModeWidget.InputMode;
import ghidra.app.plugin.core.instructionsearch.util.InstructionSearchUtils;
@ -290,7 +292,8 @@ public class InsertBytesWidget extends DialogComponentProvider implements KeyLis
// there's a problem with the input. Just print a message to the user and
// exit.
if (allBytes.size() < instruction.getLength()) {
msgPanel.setMessageText("Input invalid: unknown disassembly error.", Color.RED);
msgPanel.setMessageText("Input invalid: unknown disassembly error.",
Dialogs.FG_MESSAGE_ERROR);
return;
}
allBytes.subList(0, instruction.getLength()).clear();
@ -300,7 +303,8 @@ public class InsertBytesWidget extends DialogComponentProvider implements KeyLis
// If there's an exception, just stop and let the user figure out what went
// wrong - no need to continue.
msgPanel.setMessageText("Input invalid: unknown disassembly error.", Color.RED);
msgPanel.setMessageText("Input invalid: unknown disassembly error.",
Dialogs.FG_MESSAGE_ERROR);
Msg.debug(this, "Error disassembling instruction", e);
return;

View file

@ -23,6 +23,8 @@ import javax.swing.*;
import docking.ComponentProvider;
import docking.DialogComponentProvider;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Dialogs;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
import ghidra.app.plugin.core.instructionsearch.model.InstructionMetadata;
@ -61,6 +63,9 @@ import ghidra.util.task.TaskMonitor;
public class InstructionSearchDialog extends DialogComponentProvider implements Observer {
private static final Color BG_COLOR_MARKERS =
new GColor("color.bg.plugin.instructionsearch.search.markers");
// Panel containing the {@link InstructionTable} and {@link PreviewTable}.
private InstructionSearchMainPanel tablePanel;
@ -136,7 +141,7 @@ public class InstructionSearchDialog extends DialogComponentProvider implements
if (selection == null && getMessagePanel() != null) {
getMessagePanel().setMessageText(
"Select instructions from the listing (and hit reload) to populate the table.",
Color.BLUE);
Dialogs.FG_MESSAGE_NORMAL);
}
if (selection != null && plugin.isSelectionValid(selection, this)) {
@ -498,7 +503,7 @@ public class InstructionSearchDialog extends DialogComponentProvider implements
model.setSelectionSize(matchSize);
TableComponentProvider<Address> tableProvider =
table.showTableWithMarkers(title + " " + model.getName(), "InstructionSearch",
model, Color.GREEN, null, "Instruction Search Results", null);
model, BG_COLOR_MARKERS, null, "Instruction Search Results", null);
tableProvider.installRemoveItemsAction();
};
SystemUtilities.runSwingLater(runnable);

View file

@ -15,7 +15,6 @@
*/
package ghidra.app.plugin.core.instructionsearch.ui;
import java.awt.Color;
import java.awt.event.*;
import java.util.List;
@ -23,6 +22,7 @@ import javax.swing.*;
import docking.DockingWindowManager;
import docking.widgets.EmptyBorderButton;
import generic.theme.GThemeDefaults.Colors.Dialogs;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
import ghidra.app.plugin.core.instructionsearch.model.*;
import ghidra.app.services.GoToService;
@ -168,7 +168,9 @@ public class InstructionTable extends AbstractInstructionTable {
}
InstructionTableDataObject[][] dataObjects =
new InstructionTableDataObject[dialog.getSearchData().getInstructions().size()][numColumns];
new InstructionTableDataObject[dialog.getSearchData()
.getInstructions()
.size()][numColumns];
// Loop over all instructions, adding pertinent info to each data object. This could be a long-running
// operation so put in a task that can be cancelled.
@ -516,9 +518,10 @@ public class InstructionTable extends AbstractInstructionTable {
}
else {
if (dialog.getMessagePanel() != null) {
dialog.getMessagePanel().setMessageText(
dialog.getMessagePanel()
.setMessageText(
"Instruction was loaded manually, no address in the listing to navigate to.",
Color.BLUE);
Dialogs.FG_MESSAGE_NORMAL);
}
}
}

View file

@ -21,6 +21,7 @@ import javax.swing.*;
import javax.swing.table.TableModel;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.Gui;
import ghidra.app.plugin.core.instructionsearch.model.InstructionTableDataObject;
import ghidra.util.table.GhidraTableCellRenderer;
@ -30,10 +31,6 @@ import ghidra.util.table.GhidraTableCellRenderer;
*/
public class InstructionTableCellRenderer extends GhidraTableCellRenderer {
/**
*
* @param font
*/
public InstructionTableCellRenderer(Font font) {
super(font);
}
@ -76,24 +73,10 @@ public class InstructionTableCellRenderer extends GhidraTableCellRenderer {
return this;
}
/*********************************************************************************************
* PRIVATE METHODS
********************************************************************************************/
/**
*
* @param dataObject
* @param theRenderer
*/
private void setBorderAttributes(InstructionTableDataObject dataObject, JLabel theRenderer) {
theRenderer.setBorder(dataObject.getBorder());
}
/**
*
* @param dataObject
* @param theRenderer
*/
private void setForegroundAttributes(InstructionTableDataObject dataObject,
JLabel theRenderer) {
// Change the foreground to use a font of our choosing. The main reason is that we
@ -103,12 +86,6 @@ public class InstructionTableCellRenderer extends GhidraTableCellRenderer {
theRenderer.setFont(newFont);
}
/**
*
* @param isSelected
* @param hasFocus
* @param dataObject
*/
private void setBackgroundAttributes(boolean isSelected, boolean hasFocus,
InstructionTableDataObject dataObject) {
// Set the background color based on what the cell says. If it's selected, make it a
@ -116,7 +93,7 @@ public class InstructionTableCellRenderer extends GhidraTableCellRenderer {
Color backgroundColor = dataObject.getBackgroundColor();
if (backgroundColor != null) {
if (isSelected || hasFocus) {
setBackground(backgroundColor.darker());
setBackground(Gui.darker(backgroundColor));
}
else {
setBackground(backgroundColor);
@ -124,12 +101,6 @@ public class InstructionTableCellRenderer extends GhidraTableCellRenderer {
}
}
/**
*
* @param table
* @param value
* @param col
*/
private void setTextAttributes(JTable table, Object value, int col) {
setHorizontalAlignment(SwingConstants.LEFT);
TableModel model = table.getModel();

View file

@ -15,19 +15,18 @@
*/
package ghidra.app.plugin.core.instructionsearch.ui;
import java.awt.Color;
import java.util.*;
import javax.swing.SwingUtilities;
import generic.theme.GThemeDefaults.Colors.Dialogs;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
import ghidra.app.plugin.core.instructionsearch.model.InstructionMetadata;
import ghidra.app.plugin.core.instructionsearch.ui.SearchDirectionWidget.Direction;
import ghidra.app.services.GoToService;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressRange;
import ghidra.program.model.listing.CodeUnit;
import ghidra.program.model.listing.*;
import ghidra.program.util.BytesFieldLocation;
import ghidra.util.Swing;
import ghidra.util.task.Task;
import ghidra.util.task.TaskMonitor;
@ -73,7 +72,10 @@ class SearchInstructionsTask extends Task {
// See if we're searching forward or backwards.
boolean forward =
searchDialog.getControlPanel().getDirectionWidget().getSearchDirection().equals(
searchDialog.getControlPanel()
.getDirectionWidget()
.getSearchDirection()
.equals(
Direction.FORWARD);
// If we're searching backwards we need to process address ranges in reverse so reverse
@ -121,7 +123,7 @@ class SearchInstructionsTask extends Task {
//
// Note we put these on the swing thread or it will throw off the task monitor display.
if (searchResults != null) {
SwingUtilities.invokeLater(() -> {
Swing.runLater(() -> {
goToLocation(searchResults.getAddr());
searchDialog.getMessagePanel().clear();
});
@ -134,7 +136,8 @@ class SearchInstructionsTask extends Task {
// If we've gone through all the ranges and there are still no results, show an
// error message.
searchDialog.getMessagePanel().setMessageText("No results found", Color.BLUE);
searchDialog.getMessagePanel()
.setMessageText("No results found", Dialogs.FG_MESSAGE_NORMAL);
return;
}
@ -157,13 +160,13 @@ class SearchInstructionsTask extends Task {
// The reason for the getting the CodeUnit is that the instruction might be an off-cut,
// and if that's the case, then we can't navigate directly to it. What we have to do
// is find the CodeUnit containing the instruction and navigate to that.
Program currentProgram = searchPlugin.getCurrentProgram();
Listing listing = currentProgram.getListing();
if (direction == Direction.FORWARD) {
for (InstructionMetadata instr : searchResults) {
CodeUnit unit = searchPlugin.getCurrentProgram().getListing().getCodeUnitContaining(
instr.getAddr());
if (unit.getMinAddress().compareTo(currentAddress) > 0) {
return unit.getMinAddress();
CodeUnit cu = listing.getCodeUnitContaining(instr.getAddr());
if (cu.getMinAddress().compareTo(currentAddress) > 0) {
return cu.getMinAddress();
}
}
}
@ -173,14 +176,12 @@ class SearchInstructionsTask extends Task {
//
// See above for an explanation for why we need to get the CodeUnit in this block.
if (direction == Direction.BACKWARD) {
ListIterator<InstructionMetadata> iter =
searchResults.listIterator(searchResults.size());
while (iter.hasPrevious()) {
InstructionMetadata instr = iter.previous();
CodeUnit unit = searchPlugin.getCurrentProgram().getListing().getCodeUnitContaining(
instr.getAddr());
if (unit.getMinAddress().compareTo(currentAddress) < 0) {
return unit.getMinAddress();
ListIterator<InstructionMetadata> it = searchResults.listIterator(searchResults.size());
while (it.hasPrevious()) {
InstructionMetadata instr = it.previous();
CodeUnit cu = listing.getCodeUnitContaining(instr.getAddr());
if (cu.getMinAddress().compareTo(currentAddress) < 0) {
return cu.getMinAddress();
}
}
}

View file

@ -19,6 +19,8 @@ import java.awt.Color;
import javax.swing.text.*;
import generic.theme.GColor;
import generic.theme.TempColorUtils;
import ghidra.app.plugin.core.interpreter.AnsiParser.AnsiParserHandler;
/**
@ -32,22 +34,6 @@ import ghidra.app.plugin.core.interpreter.AnsiParser.AnsiParserHandler;
* renderers prevents the corruption of those escape sequences when interleaving the output streams.
*/
public class AnsiRenderer {
public static final Color BLACK = new Color(0, 0, 0);
public static final Color RED = new Color(194, 54, 33);
public static final Color GREEN = new Color(37, 188, 36);
public static final Color YELLOW = new Color(173, 173, 39);
public static final Color BLUE = new Color(73, 46, 225);
public static final Color MAGENTA = new Color(211, 56, 211);
public static final Color CYAN = new Color(51, 187, 200);
public static final Color WHITE = new Color(203, 204, 205);
public static final Color HI_BLACK = new Color(129, 131, 131);
public static final Color HI_RED = new Color(252, 57, 31);
public static final Color HI_GREEN = new Color(49, 231, 34);
public static final Color HI_YELLOW = new Color(234, 236, 35);
public static final Color HI_BLUE = new Color(88, 51, 255);
public static final Color HI_MAGENTA = new Color(249, 53, 248);
public static final Color HI_CYAN = new Color(20, 240, 240);
public static final Color HI_WHITE = new Color(233, 235, 235);
/**
* These colors are taken from Terminal.app as documented on Wikipedia as of 26 April 2022.
@ -58,23 +44,23 @@ public class AnsiRenderer {
*/
private static final Color[] BASIC_COLORS = {
// standard colors
BLACK,
RED,
GREEN,
YELLOW,
BLUE,
MAGENTA,
CYAN,
WHITE,
new GColor("color.fg.plugin.interpreter.renderer.color.standard.1"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.2"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.3"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.4"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.5"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.6"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.7"),
new GColor("color.fg.plugin.interpreter.renderer.color.standard.8"),
// high intensity colors
HI_BLACK,
HI_RED,
HI_GREEN,
HI_YELLOW,
HI_BLUE,
HI_MAGENTA,
HI_CYAN,
HI_WHITE,
new GColor("color.fg.plugin.interpreter.renderer.color.intense.1"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.2"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.3"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.4"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.5"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.6"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.7"),
new GColor("color.fg.plugin.interpreter.renderer.color.intense.8"),
};
/**
* This aids the implementation of the 6x6x6 color cube.
@ -98,12 +84,12 @@ public class AnsiRenderer {
}
/**
* Get the 8-bit ansi color.
* Get the 8-bit ANSI color.
*
* <p>
* Colors 0-15 are the {@link AnsiRenderer#BASIC_COLORS: standard + high-intensity. Colors
* Colors 0-15 are the {@link AnsiRenderer#AnsiRenderer}: standard + high-intensity. Colors
* 16-231 come from a 6x6x6 RGB cube; see {@link AnsiRenderer#CUBE_STEPS}. Finally, colors
* 232-255 are 24 steps of grayscale.
* 232-255 are 24 steps of gray scale.
*
* @param v an 8-bit number
* @return the ANSI color
@ -117,12 +103,12 @@ public class AnsiRenderer {
int b = v % 6;
int g = (v / 6) % 6;
int r = (v / 36) % 6;
return new Color(CUBE_STEPS[r], CUBE_STEPS[g], CUBE_STEPS[b]);
return TempColorUtils.fromRgb(CUBE_STEPS[r], CUBE_STEPS[g], CUBE_STEPS[b]);
}
else if (v < 256) {
v -= 232;
int gray = v * 10 + 8;
return new Color(gray, gray, gray);
return TempColorUtils.fromRgb(gray, gray, gray);
}
else {
/* invalid */
@ -146,7 +132,7 @@ public class AnsiRenderer {
private int handleSGRAttribute(String[] bits, int pos) throws NumberFormatException {
int code = Integer.parseInt(bits[pos]);
if (code >= 30 && code < 50) {
/* Colour codes */
/* Color codes */
Object attributeName =
(code < 40) ? StyleConstants.Foreground : StyleConstants.Background;
int colorCode = code % 10;
@ -172,7 +158,7 @@ public class AnsiRenderer {
int r = Integer.parseInt(bits[pos + 2]);
int g = Integer.parseInt(bits[pos + 3]);
int b = Integer.parseInt(bits[pos + 4]);
attributes.addAttribute(attributeName, new Color(r, g, b));
attributes.addAttribute(attributeName, TempColorUtils.fromRgb(r, g, b));
return 5;
}
return 1;
@ -314,6 +300,7 @@ public class AnsiRenderer {
* @param document Document to render the string to
* @param text A text string which may contain 7-bit ANSI escape codes
* @param attributes Current text attributes; may be modified by this function
* @throws BadLocationException if there is an error parsing the text
*/
public void renderString(StyledDocument document, String text, MutableAttributeSet attributes)
throws BadLocationException {

View file

@ -25,6 +25,7 @@ import javax.swing.border.EmptyBorder;
import javax.swing.event.ListDataListener;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GThemeDefaults.Colors;
import generic.util.WindowUtilities;
import ghidra.app.plugin.core.console.CodeCompletion;
@ -37,7 +38,7 @@ import ghidra.app.plugin.core.console.CodeCompletion;
public class CodeCompletionWindow extends JDialog {
private static final long serialVersionUID = 1L;
/* from ReferenceHoverPlugin */
private static final Color BACKGROUND_COLOR = new Color(255, 255, 230);
private static final Color BACKGROUND_COLOR = Colors.TOOLTIP_BACKGROUND;
protected final InterpreterPanel console;
protected final JTextPane outputTextField;

View file

@ -27,6 +27,7 @@ import javax.swing.ImageIcon;
import docking.widgets.fieldpanel.support.FieldRange;
import docking.widgets.fieldpanel.support.FieldSelection;
import generic.json.Json;
import generic.theme.TempColorUtils;
import ghidra.app.services.MarkerDescriptor;
import ghidra.app.services.MarkerSet;
import ghidra.app.util.viewer.listingpanel.VerticalPixelAddressMap;
@ -259,10 +260,7 @@ abstract class MarkerSetImpl implements MarkerSet {
}
protected static Color getFillColor(Color c) {
int red = (c.getRed() + 3 * COLOR_VALUE) / 4;
int green = (c.getGreen() + 3 * COLOR_VALUE) / 4;
int blue = (c.getBlue() + 3 * COLOR_VALUE) / 4;
return new Color(red, green, blue);
return TempColorUtils.blend2(c, COLOR_VALUE);
}
@Override

View file

@ -29,6 +29,7 @@ import javax.swing.ImageIcon;
import docking.ActionContext;
import docking.action.DockingAction;
import docking.action.ToolBarData;
import generic.theme.GColor;
import ghidra.app.CorePluginPackage;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.ProgramPlugin;
@ -73,6 +74,15 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
private final static int OTHER_CHANGES_PRIORITY = MarkerService.CHANGE_PRIORITY + 2;
private final static int CONFLICT_PRIORITY = MarkerService.CHANGE_PRIORITY + 3;
private static final Color BG_COLOR_MARKER_UNSAVED =
new GColor("color.bg.plugin.myprogramchangesdisplay.markers.changes.unsaved");
private static final Color BG_COLOR_MARKER_CONFLICTING =
new GColor("color.bg.plugin.myprogramchangesdisplay.markers.changes.conflicting");
private static final Color BG_COLOR_MARKER_LATEST =
new GColor("color.bg.plugin.myprogramchangesdisplay.markers.changes.latest.version");
private static final Color BG_COLOR_MARKER_NOT_CHECKED_IN =
new GColor("color.bg.plugin.myprogramchangesdisplay.markers.changes.not.checked.in");
private MarkerService markerService;
private MarkerSet currentMyChangeMarks; // my changes since last save
@ -191,7 +201,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
private void createMarkerSets(Program program) {
currentMyChangeMarks =
markerService.createAreaMarker("Changes: Unsaved", "My changes not yet saved", program,
MY_CHANGE_PRIORITY, true, true, false, Color.darkGray);
MY_CHANGE_PRIORITY, true, true, false, BG_COLOR_MARKER_UNSAVED);
if (program.getDomainFile().isCheckedOut()) {
trackServerChanges(program);
@ -201,15 +211,15 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
private void trackServerChanges(Program program) {
currentChangesSinceCheckoutMarks = markerService.createAreaMarker("Changes: Not Checked-In",
"My saved changes made since I checked it out", program, CHANGES_SINCE_CO_PRIORITY,
true, true, false, Color.GREEN);
true, true, false, BG_COLOR_MARKER_NOT_CHECKED_IN);
currentOtherChangeMarks = markerService.createAreaMarker("Changes: Latest Version",
"Changes made by others to this program since I checked it out", program,
OTHER_CHANGES_PRIORITY, true, true, false, Color.BLUE);
OTHER_CHANGES_PRIORITY, true, true, false, BG_COLOR_MARKER_LATEST);
currentConflictChangeMarks = markerService.createAreaMarker("Changes: Conflicting",
"Changes made by others to this program that conflict with my changes", program,
CONFLICT_PRIORITY, true, true, false, Color.RED);
CONFLICT_PRIORITY, true, true, false, BG_COLOR_MARKER_CONFLICTING);
}
private void disposeMarkerSets(Program program) {

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,11 +23,10 @@ import javax.swing.*;
import javax.swing.event.ChangeListener;
import javax.swing.text.*;
/**
*
*/
import generic.theme.GThemeDefaults.Colors;
public class RegisterField extends JTextField {
// private static Color UNSET_COLOR = new Color(204,0,204);
private int bitSize;
private Long currentValue;
private long maxValue;
@ -36,19 +34,17 @@ public class RegisterField extends JTextField {
private boolean inFocus;
private boolean skipFilter;
private ChangeListener listener;
private Color noValueColor = Color.LIGHT_GRAY;
private Color valueColor = Color.BLACK;
private Color noValueColor = Colors.FOREGROUND_DISABLED;
private Color valueColor = Colors.FOREGROUND;
private boolean useNoValue;
/**
* Constructor for RegisterField.
*/
public RegisterField(int bitSize, Long initialValue) {
this(bitSize, initialValue, true);
}
public RegisterField(int bitSize, Long initialValue, boolean useNoValue) {
this.useNoValue = useNoValue;
setBitSize( bitSize );
setBitSize(bitSize);
doc = new PlainDocument();
doc.setDocumentFilter(new MyDocFilter());
@ -56,17 +52,20 @@ public class RegisterField extends JTextField {
doSetValue(initialValue);
this.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent ev) {
inFocus = true;
doSetValue(currentValue);
}
@Override
public void focusLost(FocusEvent ev) {
inFocus = false;
doSetValue(currentValue);
}
});
}
public Long getValue() {
return currentValue;
}
@ -75,10 +74,12 @@ public class RegisterField extends JTextField {
noValueColor = c;
updateColor();
}
public void setValueColor(Color c) {
valueColor = c;
updateColor();
}
private void updateColor() {
if (inFocus || currentValue != null) {
setForeground(valueColor);
@ -89,7 +90,8 @@ public class RegisterField extends JTextField {
setHorizontalAlignment(CENTER);
}
}
public void setBitSize( int bitSize ) {
public void setBitSize(int bitSize) {
this.bitSize = bitSize;
boolean isValid = bitSize >= 1 && bitSize < 64;
@ -108,16 +110,18 @@ public class RegisterField extends JTextField {
}
/// if the value is no longer valid, then clear the value
if ( !isValidValue( getValue() ) ) {
doSetValue( null );
if (!isValidValue(getValue())) {
doSetValue(null);
}
}
public void setValue(Long value) {
if (isEqual(value, currentValue)) {
return;
}
doSetValue(value);
}
private void doSetValue(Long value) {
if (value == null) {
if (inFocus) {
@ -133,11 +137,12 @@ public class RegisterField extends JTextField {
}
}
else {
setTextField("0x"+Long.toHexString(value.longValue()));
setTextField("0x" + Long.toHexString(value.longValue()));
}
currentValue = value;
updateColor();
}
private boolean isEqual(Long l1, Long l2) {
if (l1 != null) {
return l1.equals(l2);
@ -147,24 +152,29 @@ public class RegisterField extends JTextField {
}
return true;
}
private void setTextField(String text) {
if ( doc == null ) {
if (doc == null) {
return;
}
skipFilter = true;
try {
doc.replace(0, doc.getLength(), text, null);
}
catch (BadLocationException e) {}
catch (BadLocationException e) {
// ignore
}
skipFilter = false;
}
public void setChangeListener(ChangeListener listener) {
this.listener = listener;
}
private boolean processText() {
String text = getText();
if (text.length() == 0){
if (text.length() == 0) {
if (currentValue != null) {
currentValue = null;
notifyListeners();
@ -174,19 +184,19 @@ public class RegisterField extends JTextField {
if (text.equals("0x") || text.equals("0X")) {
if ((currentValue == null) || (currentValue.longValue() != 0)) {
currentValue = new Long(0);
currentValue = 0L;
notifyListeners();
}
return true;
}
try {
if (!text.startsWith("0x") && !text.startsWith("0X")) {
while(text.length() > 1 && text.charAt(0)== '0') {
while (text.length() > 1 && text.charAt(0) == '0') {
text = text.substring(1);
}
}
Long newValue = Long.decode(text);
if ( isValidValue( newValue ) ) {
if (isValidValue(newValue)) {
if (!newValue.equals(currentValue)) {
currentValue = newValue;
notifyListeners();
@ -194,25 +204,24 @@ public class RegisterField extends JTextField {
return true;
}
}
catch(Exception e) {
catch (Exception e) {
// handled by using beep below
}
Toolkit.getDefaultToolkit().beep();
return false;
}
private boolean isValidValue(Long value) {
if ( value == null ) {
if (value == null) {
return false;
}
long l = value.longValue();
return (l >= 0) && (l <= maxValue);
}
class MyDocFilter extends DocumentFilter {
/**
* @see javax.swing.text.DocumentFilter#insertString(FilterBypass, int, String, AttributeSet)
*/
@Override
public void insertString(FilterBypass fb, int offset, String string,
AttributeSet attr) throws BadLocationException {
@ -228,9 +237,6 @@ public class RegisterField extends JTextField {
}
}
/**
* @see javax.swing.text.DocumentFilter#remove(FilterBypass, int, int)
*/
@Override
public void remove(FilterBypass fb, int offset, int length)
throws BadLocationException {
@ -246,9 +252,6 @@ public class RegisterField extends JTextField {
}
}
/**
* @see javax.swing.text.DocumentFilter#replace(FilterBypass, int, int, String, AttributeSet)
*/
@Override
public void replace(FilterBypass fb, int offset, int length,
String text, AttributeSet attrs) throws BadLocationException {
@ -268,7 +271,7 @@ public class RegisterField extends JTextField {
JFrame f = new JFrame("Test");
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JTextField("123"), BorderLayout.SOUTH);
RegisterField rf = new RegisterField(1, new Long(1));
RegisterField rf = new RegisterField(1, 1L);
panel.add(rf, BorderLayout.CENTER);
f.getContentPane().add(panel);
f.pack();
@ -277,15 +280,15 @@ public class RegisterField extends JTextField {
private void notifyListeners() {
if (listener != null) {
listener.stateChanged( null );
listener.stateChanged(null);
}
}
public int getBitSize() {
return bitSize;
}
public Color getValueColor() {
return valueColor;
}
}

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.navigation.locationreferences;
import java.awt.Color;
import docking.widgets.fieldpanel.support.Highlight;
import generic.theme.GColor;
import ghidra.GhidraOptions;
import ghidra.app.nav.Navigatable;
import ghidra.app.services.*;
@ -42,7 +43,8 @@ class LocationReferencesHighlighter {
"Reference Search" + GhidraOptions.DELIMITER + "Highlight Match Color";
private static final String HIGHLIGHT_COLOR_DESCRIPTION =
"The highlight color of matches for the 'Show References' searcher";
private static Color DEFAULT_HIGHLIGHT_COLOR = new Color(168, 202, 242);
private static Color DEFAULT_HIGHLIGHT_COLOR =
new GColor("color.bg.plugin.locationreferences.highlight");
private boolean isHighlighting = false;
private final Navigatable navigatable;
@ -52,15 +54,11 @@ class LocationReferencesHighlighter {
private HighlightProvider highlightProvider;
private MarkerRemover markerRemover;
private Color highlightColor;
private OptionsChangeListener optionsListener = new OptionsChangeListener() {
@Override
public void optionsChanged(ToolOptions options, String name, Object oldValue,
Object newValue) {
if (name.equals(HIGHLIGHT_COLOR_KEY)) {
private OptionsChangeListener optionsListener = (options, name, oldValue, newValue) -> {
if (name.equals(HIGHLIGHT_COLOR_KEY)) {
highlightColor = (Color) newValue;
}
}
};
}
};
// This is a bit unusual, but we do this here, since this highlighter will come and
// go with each search. If we do not register a priori, then the option will not appear in the

View file

@ -15,13 +15,13 @@
*/
package ghidra.app.plugin.core.navigation.locationreferences;
import java.awt.Color;
import java.awt.Component;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.program.model.address.Address;
@ -171,7 +171,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
super.getTableCellRendererComponent(data);
LocationReference rowObject = (LocationReference) data.getRowObject();
String refTypeString = getRefTypeString(rowObject);
String refTypeString = getRefTypeString(rowObject, data.isSelected());
if (refTypeString != null) {
setText(refTypeString);
return this;
@ -184,12 +184,13 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
return this;
}
private String getRefTypeString(LocationReference rowObject) {
private String getRefTypeString(LocationReference rowObject, boolean isSelected) {
String refType = rowObject.getRefTypeString();
if (!StringUtils.isBlank(refType)) {
String trailingText = "";
if (rowObject.isOffcutReference()) {
setForeground(Color.RED);
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
trailingText = OFFCUT_STRING;
}
return refType + trailingText;
@ -199,7 +200,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
@Override
public String getFilterString(LocationReference rowObject, Settings settings) {
String refTypeString = getRefTypeString(rowObject);
String refTypeString = getRefTypeString(rowObject, false);
if (refTypeString != null) {
return refTypeString;
}

View file

@ -25,6 +25,7 @@ import java.util.List;
import javax.swing.*;
import docking.action.DockingActionIf;
import generic.theme.GColor;
import ghidra.app.nav.Navigatable;
import ghidra.app.services.GoToService;
import ghidra.app.util.viewer.listingpanel.OverviewProvider;
@ -40,7 +41,7 @@ import help.Help;
* Uses an {@link OverviewColorService} to get the appropriate color for an address.
*/
public class OverviewColorComponent extends JPanel implements OverviewProvider {
private static final Color DEFAULT_COLOR = Color.GRAY;
private static final Color DEFAULT_COLOR = new GColor("color.bg.plugin.overview.defalt");
private OverviewColorService service;
private Color[] colors = new Color[0];
private final SwingUpdateManager refreshUpdater =
@ -158,7 +159,7 @@ public class OverviewColorComponent extends JPanel implements OverviewProvider {
}
BigInteger indexCount = map.getIndexCount();
if (indexCount.equals(BigInteger.ZERO)) {
Arrays.fill(colors, Color.GRAY);
Arrays.fill(colors, DEFAULT_COLOR);
repaint();
return;
}

View file

@ -22,6 +22,7 @@ import java.util.List;
import docking.ActionContext;
import docking.DialogComponentProvider;
import docking.action.DockingActionIf;
import generic.theme.GColor;
import ghidra.app.plugin.core.overview.*;
import ghidra.framework.model.*;
import ghidra.framework.options.OptionsChangeListener;
@ -44,13 +45,18 @@ import ghidra.util.HelpLocation;
public class AddressTypeOverviewColorService
implements OverviewColorService, OptionsChangeListener, DomainObjectListener {
private static final String OPTIONS_NAME = "Overview";
private static final Color DEFAULT_INSTRUCTION_COLOR = new Color(192, 192, 255);
private static final Color DEFAULT_DATA_COLOR = new Color(128, 255, 128);
private static final Color DEFAULT_FUNCTION_COLOR = new Color(204, 150, 255);
private static final Color DEFAULT_UNDEFINED_COLOR = new Color(255, 51, 102);
private static final Color DEFAULT_UNINITIALIZED_COLOR = Color.BLACK;
private static final Color DEFAULT_EXTERNAL_REF_COLOR = new Color(255, 150, 150);
private static final Color DEFAULT_MARKER_COLOR = Color.WHITE;
private static final Color DEFAULT_INSTRUCTION_COLOR =
new GColor("color.bg.plugin.overview.address.instruction");
private static final Color DEFAULT_DATA_COLOR =
new GColor("color.bg.plugin.overview.address.data");
private static final Color DEFAULT_FUNCTION_COLOR =
new GColor("color.bg.plugin.overview.address.function");
private static final Color DEFAULT_UNDEFINED_COLOR =
new GColor("color.bg.plugin.overview.address.undefined");
private static final Color DEFAULT_UNINITIALIZED_COLOR =
new GColor("color.bg.plugin.overview.address.uninitialized");
private static final Color DEFAULT_EXTERNAL_REF_COLOR =
new GColor("color.bg.plugin.overview.address.external.ref");
Color instructionColor = DEFAULT_INSTRUCTION_COLOR;
Color dataColor = DEFAULT_DATA_COLOR;

View file

@ -17,6 +17,7 @@ package ghidra.app.plugin.core.overview.entropy;
import java.awt.Color;
import generic.theme.GColor;
import ghidra.app.plugin.core.overview.OverviewColorPlugin;
import ghidra.framework.options.OptionsChangeListener;
import ghidra.framework.options.ToolOptions;
@ -28,34 +29,51 @@ import ghidra.util.HelpLocation;
* the color Palette for that service.
*/
public class EntropyOverviewOptionsManager implements OptionsChangeListener {
private static final Color uninitializedColor = Color.decode("0x0000ff");
private static final Color UNINITIALIZED_COLOR =
new GColor("color.bg.plugin.overview.entropy.uninitialized");
private static final String OPTIONS_NAME = "Entropy";
private final static String CHUNKSIZE_STRING = "Chunk size";
private final static String CHUNKSIZE_DESC_STRING = "Number of bytes per entropy score";
private final static EntropyChunkSize chunksize_def = EntropyChunkSize.LARGE;
private final static String KNOT_COLOR_STRING =
private static final String CHUNKSIZE_STRING = "Chunk size";
private static final String CHUNKSIZE_DESC_STRING = "Number of bytes per entropy score";
private static final EntropyChunkSize CHUNKSIZE_DEF = EntropyChunkSize.LARGE;
private static final String KNOT_COLOR_STRING =
"Color to use for highlighting a specific range of entropy values";
private final static String KNOT_TYPE_STRING = "Type of range to highlight";
private final static String KNOT1_COLOR_STRING = "Range 1 color";
private final static String KNOT1_TYPE_STRING = "Entropy Range 1";
private final static Color knot1_def_color = Color.decode("0xff0000");
private final static EntropyKnot knot1_def_type = EntropyKnot.COMPRESSED;
private final static String KNOT2_COLOR_STRING = "Range 2 color";
private final static String KNOT2_TYPE_STRING = "Entropy Range 2";
private final static Color knot2_def_color = Color.decode("0x0000ff");
private final static EntropyKnot knot2_def_type = EntropyKnot.X86;
private final static String KNOT3_COLOR_STRING = "Range 3 color";
private final static String KNOT3_TYPE_STRING = "Entropy Range 3";
private final static Color knot3_def_color = Color.decode("0x00ff00");
private final static EntropyKnot knot3_def_type = EntropyKnot.ASCII;
private final static String KNOT4_COLOR_STRING = "Range 4 color";
private final static String KNOT4_TYPE_STRING = "Entropy Range 4";
private final static Color knot4_def_color = Color.decode("0xffff00");
private final static EntropyKnot knot4_def_type = EntropyKnot.UTF16;
private final static String KNOT5_COLOR_STRING = "Range 5 color";
private final static String KNOT5_TYPE_STRING = "Entropy Range 5";
private final static Color knot5_def_color = Color.decode("0x0000ff");
private final static EntropyKnot knot5_def_type = EntropyKnot.NONE;
private static final String KNOT_TYPE_STRING = "Type of range to highlight";
private static final String KNOT1_COLOR_STRING = "Range 1 color";
private static final String KNOT1_TYPE_STRING = "Entropy Range 1";
private static final Color KNOT1_DEF_COLOR =
new GColor("color.bg.plugin.overview.entropy.knot.1");
private static final EntropyKnot KNOT1_DEF_TYPE = EntropyKnot.COMPRESSED;
private static final String KNOT2_COLOR_STRING = "Range 2 color";
private static final String KNOT2_TYPE_STRING = "Entropy Range 2";
private static final Color KNOT2_DEF_COLOR =
new GColor("color.bg.plugin.overview.entropy.knot.2");
private static final EntropyKnot KNOT2_DEF_TYPE = EntropyKnot.X86;
private static final String KNOT3_COLOR_STRING = "Range 3 color";
private static final String KNOT3_TYPE_STRING = "Entropy Range 3";
private static final Color KNOT3_DEF_COLOR =
new GColor("color.bg.plugin.overview.entropy.knot.3");
private static final EntropyKnot KNOT3_DEF_TYPE = EntropyKnot.ASCII;
private static final String KNOT4_COLOR_STRING = "Range 4 color";
private static final String KNOT4_TYPE_STRING = "Entropy Range 4";
private static final Color KNOT4_DEF_COLOR =
new GColor("color.bg.plugin.overview.entropy.knot.4");
private static final EntropyKnot KNOT4_DEF_TYPE = EntropyKnot.UTF16;
private static final String KNOT5_COLOR_STRING = "Range 5 color";
private static final String KNOT5_TYPE_STRING = "Entropy Range 5";
private static final Color KNOT5_DEF_COLOR =
new GColor("color.bg.plugin.overview.entropy.knot.5");
private static final EntropyKnot KNOT5_DEF_TYPE = EntropyKnot.NONE;
private static final Color PALETTE_COLOR_HIGH =
new GColor("color.bg.plugin.overview.entropy.palette.base.high");
private static final Color PALETTE_COLOR_LOW =
new GColor("color.bg.plugin.overview.entropy.palette.base.low");
private EntropyChunkSize chunksize;
private Color knot1color;
private EntropyKnot knot1type;
@ -67,7 +85,7 @@ public class EntropyOverviewOptionsManager implements OptionsChangeListener {
private EntropyKnot knot4type;
private Color knot5color;
private EntropyKnot knot5type;
private Palette palette = new Palette(256, uninitializedColor);
private Palette palette = new Palette(256, UNINITIALIZED_COLOR);
private EntropyOverviewColorService service;
public EntropyOverviewOptionsManager(PluginTool tool, EntropyOverviewColorService service) {
@ -78,18 +96,18 @@ public class EntropyOverviewOptionsManager implements OptionsChangeListener {
options.addOptionsChangeListener(this);
options.setOptionsHelpLocation(help);
options.registerOption(CHUNKSIZE_STRING, chunksize_def, help, CHUNKSIZE_DESC_STRING);
options.registerOption(KNOT1_COLOR_STRING, knot1_def_color, help, KNOT_COLOR_STRING);
options.registerOption(KNOT2_COLOR_STRING, knot2_def_color, help, KNOT_COLOR_STRING);
options.registerOption(KNOT3_COLOR_STRING, knot3_def_color, help, KNOT_COLOR_STRING);
options.registerOption(KNOT4_COLOR_STRING, knot4_def_color, help, KNOT_COLOR_STRING);
options.registerOption(KNOT5_COLOR_STRING, knot5_def_color, help, KNOT_COLOR_STRING);
options.registerOption(CHUNKSIZE_STRING, CHUNKSIZE_DEF, help, CHUNKSIZE_DESC_STRING);
options.registerOption(KNOT1_COLOR_STRING, KNOT1_DEF_COLOR, help, KNOT_COLOR_STRING);
options.registerOption(KNOT2_COLOR_STRING, KNOT2_DEF_COLOR, help, KNOT_COLOR_STRING);
options.registerOption(KNOT3_COLOR_STRING, KNOT3_DEF_COLOR, help, KNOT_COLOR_STRING);
options.registerOption(KNOT4_COLOR_STRING, KNOT4_DEF_COLOR, help, KNOT_COLOR_STRING);
options.registerOption(KNOT5_COLOR_STRING, KNOT5_DEF_COLOR, help, KNOT_COLOR_STRING);
options.registerOption(KNOT1_TYPE_STRING, knot1_def_type, help, KNOT_TYPE_STRING);
options.registerOption(KNOT2_TYPE_STRING, knot2_def_type, help, KNOT_TYPE_STRING);
options.registerOption(KNOT3_TYPE_STRING, knot3_def_type, help, KNOT_TYPE_STRING);
options.registerOption(KNOT4_TYPE_STRING, knot4_def_type, help, KNOT_TYPE_STRING);
options.registerOption(KNOT5_TYPE_STRING, knot5_def_type, help, KNOT_TYPE_STRING);
options.registerOption(KNOT1_TYPE_STRING, KNOT1_DEF_TYPE, help, KNOT_TYPE_STRING);
options.registerOption(KNOT2_TYPE_STRING, KNOT2_DEF_TYPE, help, KNOT_TYPE_STRING);
options.registerOption(KNOT3_TYPE_STRING, KNOT3_DEF_TYPE, help, KNOT_TYPE_STRING);
options.registerOption(KNOT4_TYPE_STRING, KNOT4_DEF_TYPE, help, KNOT_TYPE_STRING);
options.registerOption(KNOT5_TYPE_STRING, KNOT5_DEF_TYPE, help, KNOT_TYPE_STRING);
readOptions(options);
updatePalettes();
@ -104,23 +122,23 @@ public class EntropyOverviewOptionsManager implements OptionsChangeListener {
}
private void readOptions(ToolOptions options) {
chunksize = options.getEnum(CHUNKSIZE_STRING, chunksize_def);
chunksize = options.getEnum(CHUNKSIZE_STRING, CHUNKSIZE_DEF);
knot1color = options.getColor(KNOT1_COLOR_STRING, knot1_def_color);
knot2color = options.getColor(KNOT2_COLOR_STRING, knot2_def_color);
knot3color = options.getColor(KNOT3_COLOR_STRING, knot3_def_color);
knot4color = options.getColor(KNOT4_COLOR_STRING, knot4_def_color);
knot5color = options.getColor(KNOT5_COLOR_STRING, knot5_def_color);
knot1color = options.getColor(KNOT1_COLOR_STRING, KNOT1_DEF_COLOR);
knot2color = options.getColor(KNOT2_COLOR_STRING, KNOT2_DEF_COLOR);
knot3color = options.getColor(KNOT3_COLOR_STRING, KNOT3_DEF_COLOR);
knot4color = options.getColor(KNOT4_COLOR_STRING, KNOT4_DEF_COLOR);
knot5color = options.getColor(KNOT5_COLOR_STRING, KNOT5_DEF_COLOR);
knot1type = options.getEnum(KNOT1_TYPE_STRING, knot1_def_type);
knot2type = options.getEnum(KNOT2_TYPE_STRING, knot2_def_type);
knot3type = options.getEnum(KNOT3_TYPE_STRING, knot3_def_type);
knot4type = options.getEnum(KNOT4_TYPE_STRING, knot4_def_type);
knot5type = options.getEnum(KNOT5_TYPE_STRING, knot5_def_type);
knot1type = options.getEnum(KNOT1_TYPE_STRING, KNOT1_DEF_TYPE);
knot2type = options.getEnum(KNOT2_TYPE_STRING, KNOT2_DEF_TYPE);
knot3type = options.getEnum(KNOT3_TYPE_STRING, KNOT3_DEF_TYPE);
knot4type = options.getEnum(KNOT4_TYPE_STRING, KNOT4_DEF_TYPE);
knot5type = options.getEnum(KNOT5_TYPE_STRING, KNOT5_DEF_TYPE);
}
private void addPaletteKnot(String name, Color col, double point, double width) {
private void addPaletteKnot(String name, Color color, double point, double width) {
int palettewidth = 256;
int pointint = (int) Math.floor((palettewidth / 8.0) * point);
if (pointint > 255) {
@ -131,11 +149,11 @@ public class EntropyOverviewOptionsManager implements OptionsChangeListener {
if (start < 0) {
start = 0;
}
palette.addKnot(name, col, start, pointint);
palette.addKnot(name, color, start, pointint);
}
private void updatePalettes() {
palette.setBase(Color.decode("0x000000"), Color.decode("0xffffff"));
palette.setBase(PALETTE_COLOR_LOW, PALETTE_COLOR_HIGH);
addPaletteKnots();
service.paletteChanged();
}

View file

@ -20,6 +20,8 @@ import java.util.ArrayList;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
public class KnotLabelPanel extends JPanel {
private static final Font FONT = new Font("Times New Roman", Font.BOLD, 16);
private int topBottomMargin = 10;
@ -52,7 +54,7 @@ public class KnotLabelPanel extends JPanel {
int fontOffset = ascent / 3; // this looks about right
ArrayList<KnotRecord> knots = palette.getKnots();
g.setColor(Color.BLACK);
g.setColor(Java.BORDER);
g.drawLine(5, topBottomMargin - 6, 10, topBottomMargin - ascent + 2);
g.drawString("min entropy (0.0)", 20, topBottomMargin - ascent - descent);
@ -67,7 +69,7 @@ public class KnotLabelPanel extends JPanel {
g.drawLine(5, y, 10, y);
}
g.setColor(Color.BLACK);
g.setColor(Java.BORDER);
g.drawLine(5, height + topBottomMargin + 4, 10, height + topBottomMargin + 8);
g.drawString("max entropy (8.0)", 20, topBottomMargin + height + ascent + descent);

View file

@ -22,28 +22,27 @@ import java.util.ArrayList;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import docking.util.GraphicsUtils;
import docking.widgets.label.GLabel;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
/**
* Class used by the entropy legend panel to show known entropy ranges.
*/
public class KnotPanel extends JPanel implements ComponentListener {
private static final long serialVersionUID = 1L;
private static final int SPACING = 5;
private static final Font FONT = new Font("SansSerif", Font.PLAIN, 10);
private static final Color FG_COLOR_TEXT =
new GColor("color.bg.plugin.overview.entropy.palette.text");
private Palette palette = null;
private FontMetrics metrics;
private ChangeListener paletteListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
buildLabels();
}
};
private ChangeListener paletteListener = e -> buildLabels();
public KnotPanel() {
super();
@ -63,7 +62,6 @@ public class KnotPanel extends JPanel implements ComponentListener {
return;
}
g.setColor(Color.BLACK);
g.setFont(FONT);
int height = getHeight();
int width = getWidth();
@ -72,8 +70,8 @@ public class KnotPanel extends JPanel implements ComponentListener {
int baseline = (height - fontHeight - 1) / 2 + metrics.getMaxAscent();
ArrayList<KnotRecord> knots = palette.getKnots();
for (int i = 0; i < knots.size(); i++) {
KnotRecord rec = knots.get(i);
for (KnotRecord rec : knots) {
g.setColor(Java.BORDER);
int start = (rec.start * width) / palsize;
int end = (rec.end * width) / palsize;
g.drawLine(start, 0, start, height - 1);
@ -92,6 +90,7 @@ public class KnotPanel extends JPanel implements ComponentListener {
}
}
g.setColor(FG_COLOR_TEXT);
if (w < knotwidth) { // we found a suitable font
g.setFont(currentMetrics.getFont());
GraphicsUtils.drawString(this, g, rec.name, start + (knotwidth - 1) / 2 - w / 2,
@ -136,7 +135,7 @@ public class KnotPanel extends JPanel implements ComponentListener {
for (KnotRecord record : knots) {
JLabel label = new GLabel(record.name);
label.setFont(FONT);
label.setBorder(new ToplessLineBorder(Color.BLACK));
label.setBorder(new ToplessLineBorder(Java.BORDER));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setToolTipText(record.name);

View file

@ -21,6 +21,7 @@ import java.util.ArrayList;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import generic.theme.TempColorUtils;
import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
@ -75,7 +76,7 @@ public class Palette {
int green = (int) (lo.getGreen() * (1.0 - t) + hi.getGreen() * t);
int blue = (int) (lo.getBlue() * (1.0 - t) + hi.getGreen() * t);
t += step;
colors[i] = new Color(red, green, blue);
colors[i] = TempColorUtils.fromRgb(red, green, blue);
}
knots.clear();
firePaletteChanged();
@ -111,7 +112,7 @@ public class Palette {
int green = (int) Math.floor(tmp);
tmp = (knot.getBlue() - oldcolor.getBlue()) * t + oldcolor.getBlue();
int blue = (int) Math.floor(tmp);
colors[start] = new Color(red, green, blue);
colors[start] = TempColorUtils.fromRgb(red, green, blue);
cur += radianstep;
start += 1;
}

View file

@ -19,6 +19,8 @@ import java.awt.*;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
public class PalettePanel extends JPanel {
private Palette palette;
@ -45,12 +47,12 @@ public class PalettePanel extends JPanel {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.BLACK);
g.setColor(Java.BORDER);
if (palette == null) {
g.setColor(Color.BLACK);
g.drawRect(0, 0, width - 1, height - 1);
return;
}
int palsize = palette.getSize();
//Draw the rectangles for each pixel
for (int i = 0; i < height; i++) {
@ -62,7 +64,7 @@ public class PalettePanel extends JPanel {
g.setColor(c);
g.fillRect(0, topBottomMargin + i, width, 1);
}
g.setColor(Color.BLACK);
g.setColor(Java.BORDER);
g.drawRect(0, topBottomMargin, width - 1, height);
}

View file

@ -27,13 +27,14 @@ import docking.widgets.fieldpanel.LayoutModel;
import docking.widgets.fieldpanel.internal.EmptyLayoutBackgroundColorManager;
import docking.widgets.fieldpanel.internal.LayoutBackgroundColorManager;
import docking.widgets.fieldpanel.internal.PaintContext;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import ghidra.util.DateUtils;
import ghidra.util.Msg;
import ghidra.util.task.TaskMonitor;
public class CodeUnitPrintable implements Printable {
//private FieldPanel panel;
private LayoutModel lm;
private int startIndex;
private int endIndex;
@ -48,11 +49,11 @@ public class CodeUnitPrintable implements Printable {
private static final PaintContext PAINT_CONTEXT = new PaintContext();
static {
PAINT_CONTEXT.setForegroundColor(Color.BLACK);
PAINT_CONTEXT.setBackgroundColor(Color.WHITE);
PAINT_CONTEXT.setCursorColor(Color.RED);
PAINT_CONTEXT.setSelectionColor(new Color(180, 255, 180));
PAINT_CONTEXT.setHighlightColor(new Color(255, 255, 150));
PAINT_CONTEXT.setForegroundColor(Colors.FOREGROUND);
PAINT_CONTEXT.setBackgroundColor(Colors.BACKGROUND);
PAINT_CONTEXT.setCursorColor(Colors.CURSOR);
PAINT_CONTEXT.setSelectionColor(new GColor("color.bg.selection"));
PAINT_CONTEXT.setHighlightColor(new GColor("color.bg.highlight"));
PAINT_CONTEXT.setPrinting(true);
}
@ -69,13 +70,6 @@ public class CodeUnitPrintable implements Printable {
this.book = book;
this.job = job;
this.startDate = startDate;
if (pod.getMonochrome()) {
PAINT_CONTEXT.setPrintColor(Color.BLACK);
}
else {
PAINT_CONTEXT.setPrintColor(null);
}
}
public CodeUnitPrintable(LayoutModel lm, java.util.List<Layout> layouts, double scaleAmount,
@ -89,20 +83,13 @@ public class CodeUnitPrintable implements Printable {
this.book = book;
this.job = job;
this.startDate = startDate;
if (pod.getMonochrome()) {
PAINT_CONTEXT.setPrintColor(Color.BLACK);
}
else {
PAINT_CONTEXT.setPrintColor(null);
}
}
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
Graphics2D g2 = GraphicsUtils.getGraphics2D(graphics);
g2.setColor(Color.BLACK);
g2.setColor(Colors.FOREGROUND);
monitor.setMessage("Printing Page " + (pageIndex + 1));
monitor.initialize(100);

View file

@ -56,6 +56,8 @@ public class MultiTabPanel extends JPanel {
private final static Color BG_SELECTION_COLOR = SELECTED_TAB_COLOR;
private final static Color BG_NON_SELECTION_COLOR =
new GColor("color.bg.listing.tabs.unselected");
private static final Color BG_COLOR_MORE_TABS_HOVER =
new GColor("color.bg.listing.tabs.more.tabs.hover");
private static final Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 11);
private static final Font LIST_LABEL_FONT = new Font("Tahoma", Font.BOLD, 9);
@ -209,8 +211,6 @@ public class MultiTabPanel extends JPanel {
return false;
}
////////////////////////////////////////////////////////////
private TabPanel createProgramTab(final Program program, boolean isSelected) {
final JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 1));
labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
@ -639,7 +639,7 @@ public class MultiTabPanel extends JPanel {
newLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4));
newLabel.setToolTipText("Show Tab List");
newLabel.setName("showList");
newLabel.setBackground(new Color(255, 226, 213));
newLabel.setBackground(BG_COLOR_MORE_TABS_HOVER);
defaultListLabelBorder = newLabel.getBorder();
final Border hoverBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED);

View file

@ -24,6 +24,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import docking.widgets.GComponent;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.listing.Group;
import resources.ResourceManager;
@ -344,7 +345,7 @@ class DnDTreeCellRenderer extends DefaultTreeCellRenderer {
cutImage.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(cutImage, 0, 0, null);
g2d.setColor(new Color(255, 255, 255, 128));
g2d.setColor(Colors.DISABLED);
g2d.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight());
return ResourceManager.getImageIconFromImage(imageName, bufferedImage);
}

View file

@ -29,6 +29,8 @@ import docking.DockingUtils;
import docking.actions.KeyBindingUtils;
import docking.dnd.*;
import docking.widgets.table.AutoscrollAdapter;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
/**
* Class to support Drag and Drop; it is also responsible for
@ -37,6 +39,9 @@ import docking.widgets.table.AutoscrollAdapter;
*/
public abstract class DragNDropTree extends JTree implements Draggable, Droppable, Autoscroll {
private static final Color BG_COLOR_DRAG_NO_SELECTION =
new GColor("color.bg.tree.drag.no.selection");
private AutoscrollAdapter autoscroller;
protected DefaultTreeModel treeModel;
@ -63,13 +68,6 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
protected Color nonSelectionDragColor;
protected int relativeMousePos; // mouse position within the node:
// -1 --> above node,
// 0 --> at the node
// 1 --> below the node
/**
* Construct a new DragNDropTree.
*/
public DragNDropTree(DefaultTreeModel model) {
super(model);
treeModel = model;
@ -82,7 +80,7 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
dndCellRenderer = new DnDTreeCellRenderer();
setCellRenderer(dndCellRenderer);
plafSelectionColor = dndCellRenderer.getBackgroundSelectionColor();
nonSelectionDragColor = new Color(204, 204, 255);
nonSelectionDragColor = BG_COLOR_DRAG_NO_SELECTION;
initDragNDrop();
ToolTipManager.sharedInstance().registerComponent(this);
autoscroller = new AutoscrollAdapter(this, getRowHeight());
@ -164,7 +162,8 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
public void dragCanceled(DragSourceDropEvent event) {
draggedNodes = null;
dndCellRenderer.setBackgroundSelectionColor(plafSelectionColor);
dndCellRenderer.setBackgroundNonSelectionColor(dndCellRenderer.getBackgroundNonSelectionColor());
dndCellRenderer
.setBackgroundNonSelectionColor(dndCellRenderer.getBackgroundNonSelectionColor());
}
//////////////////////////////////////////////////////////////////////
@ -263,8 +262,8 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
}
else {
destinationNode = null;
dndCellRenderer.setSelectionForDrag(Color.red);
dndCellRenderer.setNonSelectionForDrag(Color.red);
dndCellRenderer.setSelectionForDrag(Colors.ERROR);
dndCellRenderer.setNonSelectionForDrag(Colors.ERROR);
}
Point p = e.getLocation();
dndCellRenderer.setRowForFeedback(getRowForLocation(p.x, p.y));

View file

@ -24,8 +24,6 @@ import java.util.List;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.AbstractTableModel;
import org.jdom.Element;
@ -34,6 +32,8 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.app.util.AddressInput;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.*;
@ -83,13 +83,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
@Override
public void requestFocus() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// do later to override the default later nature of focus
toAddressField.requestFocus();
}
});
SwingUtilities.invokeLater(() -> toAddressField.requestFocus());
}
private void buildPanel() {
@ -97,12 +91,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
offsetCheckbox = new GCheckBox("Offset:");
offsetCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
offsetCheckbox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
enableOffsetField(offsetCheckbox.isSelected());
}
});
offsetCheckbox.addChangeListener(e -> enableOffsetField(offsetCheckbox.isSelected()));
offsetField = new JTextField();
addrLabel = new GDLabel("Base Address:");
@ -150,11 +139,11 @@ class EditMemoryReferencePanel extends EditReferencePanel {
enableOffsetField(false);
}
private void enableOffsetField(boolean state) {
offsetCheckbox.setSelected(state);
offsetField.setEnabled(state);
offsetField.setBackground(state ? Color.WHITE : getBackground());
if (!state) {
private void enableOffsetField(boolean enabled) {
offsetCheckbox.setSelected(enabled);
offsetField.setEnabled(enabled);
offsetField.setBackground(enabled ? Colors.BACKGROUND : getBackground());
if (!enabled) {
offsetField.setText("0x0");
}
else {
@ -173,7 +162,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
}
}
}
addrLabel.setText(state ? "Base Address:" : "To Address:");
addrLabel.setText(enabled ? "Base Address:" : "To Address:");
}
private void populateRefTypes(RefType adhocType) {
@ -304,7 +293,8 @@ class EditMemoryReferencePanel extends EditReferencePanel {
toAddr = fromCu.getAddress(fromOpIndex);
}
if (toAddr != null) {
Reference r = p.getReferenceManager().getReference(fromCu.getMinAddress(), toAddr,
Reference r = p.getReferenceManager()
.getReference(fromCu.getMinAddress(), toAddr,
fromOpIndex);
if (r != null) {
toAddr = null;
@ -540,7 +530,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
model = new HistoryTableModel(fromCodeUnit.getProgram());
displayTable = new JTable(model);
displayTable.setTableHeader(null);
displayTable.setBorder(new LineBorder(Color.BLACK));
displayTable.setBorder(new LineBorder(Java.BORDER));
displayTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
displayTable.addMouseListener(new MouseAdapter() {
@ -588,7 +578,8 @@ class EditMemoryReferencePanel extends EditReferencePanel {
p.y += toAddressField.getHeight();
historyWin.setLocation(p);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener(
"focusOwner", new PropertyChangeListener() {
boolean hasFocus = false;
@ -600,7 +591,8 @@ class EditMemoryReferencePanel extends EditReferencePanel {
}
else if (hasFocus) {
hasFocus = false;
KeyboardFocusManager.getCurrentKeyboardFocusManager().removePropertyChangeListener(
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removePropertyChangeListener(
"focusOwner", this);
hideAddressHistoryPopup();
}

View file

@ -35,6 +35,8 @@ import docking.dnd.DropTgtAdapter;
import docking.dnd.Droppable;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.util.SelectionTransferData;
import ghidra.app.util.SelectionTransferable;
@ -76,7 +78,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
static int MNEMONIC_OPINDEX = ReferenceManager.MNEMONIC;
static Color HIGHLIGHT_COLOR = new Color(205, 205, 205);
static Color BG_COLOR_ACTIVE_OPERAND =
new GColor("color.bg.plugin.references.table.active.operand");
private static final DataFlavor[] ACCEPTABLE_DROP_FLAVORS =
new DataFlavor[] { SelectionTransferable.localProgramSelectionFlavor };
@ -132,7 +135,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
if (currentCodeUnit != null) {
Memory memory = currentCodeUnit.getProgram().getMemory();
try {
Object data = e.getTransferable().getTransferData(
Object data = e.getTransferable()
.getTransferData(
SelectionTransferable.localProgramSelectionFlavor);
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
if (memory.contains(view)) {
@ -530,7 +534,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
private Data findComponent(Data data, Address addr) {
while (addr.compareTo(data.getMinAddress()) >= 0) {
long offset = addr.subtract(data.getMinAddress());
Data d = data.getComponentAt((int) offset);
Data d = data.getComponentContaining((int) offset);
if (d == null) {
break;
}
@ -954,8 +958,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
if (!isSelected) {
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
cb.setBackground(HIGHLIGHT_COLOR);
setBackground(HIGHLIGHT_COLOR);
cb.setBackground(BG_COLOR_ACTIVE_OPERAND);
setBackground(BG_COLOR_ACTIVE_OPERAND);
cb.setOpaque(true);
}
}
@ -1004,7 +1008,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
else {
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
checkbox.setForeground(table.getForeground());
checkbox.setBackground(HIGHLIGHT_COLOR);
checkbox.setBackground(BG_COLOR_ACTIVE_OPERAND);
checkbox.setOpaque(true);
}
else {
@ -1047,7 +1051,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
if (isSelected) {
if (bad) {
setForeground(Color.pink);
setForeground(Tables.FG_ERROR_SELECTED);
setFont(boldFont);
}
else {
@ -1060,14 +1064,14 @@ public class EditReferencesProvider extends ComponentProviderAdapter
// set color to red if address does not exist in memory
if (bad) {
setForeground(Color.red);
setForeground(Tables.FG_ERROR_UNSELECTED);
setFont(boldFont);
}
else {
setFont(defaultFont);
}
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
setBackground(HIGHLIGHT_COLOR);
setBackground(BG_COLOR_ACTIVE_OPERAND);
setOpaque(true);
}
}

View file

@ -32,6 +32,7 @@ import docking.actions.KeyBindingUtils;
import docking.dnd.DropTgtAdapter;
import docking.dnd.Droppable;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.util.*;
import ghidra.app.util.viewer.field.BrowserCodeUnitFormat;
import ghidra.program.model.address.Address;
@ -43,15 +44,13 @@ import ghidra.program.model.symbol.*;
class InstructionPanel extends JPanel implements ChangeListener {
private static final int ETCHED_BORDER_THICKNESS = 2;
private static final int BORDER_SIZE = 2;
private static final Border EMPTY_BORDER = new EmptyBorder(BORDER_SIZE,
BORDER_SIZE, BORDER_SIZE, BORDER_SIZE);
private static final Border ETCHED_BORDER = new EtchedBorder();
private static final Border ETCHED_BORDER = new EtchedBorder(Color.BLACK, Color.GRAY);
private static final Border EMPTY_BORDER = new EmptyBorder(ETCHED_BORDER_THICKNESS,
ETCHED_BORDER_THICKNESS, ETCHED_BORDER_THICKNESS, ETCHED_BORDER_THICKNESS);
private final static Color UNLOCKED_LABEL_COLOR = Color.blue;
private final static Color NOT_IN_MEMORY_COLOR = Color.red;
private final static Color DEFAULT_FG_COLOR = Color.black;
private final static Color NOT_IN_MEMORY_COLOR = Colors.ERROR;
private final static Color DEFAULT_FG_COLOR = Colors.FOREGROUND;
private static final DataFlavor[] ACCEPTABLE_DROP_FLAVORS =
new DataFlavor[] { SelectionTransferable.localProgramSelectionFlavor };
@ -85,13 +84,13 @@ class InstructionPanel extends JPanel implements ChangeListener {
*/
@Override
public void dragUnderFeedback(boolean ok, DropTargetDragEvent e) {
// stub
}
/**
* Return true if is OK to drop the transferable at the location
* specified the event.
* @param e event that has current state of drag and drop operation
* @param data data that is being dragged
*/
@Override
public boolean isDropOk(DropTargetDragEvent e) {
@ -102,7 +101,8 @@ class InstructionPanel extends JPanel implements ChangeListener {
updateLabels(getLabelIndex((JLabel) targetComp), -1);
try {
Object data = e.getTransferable().getTransferData(
Object data = e.getTransferable()
.getTransferData(
SelectionTransferable.localProgramSelectionFlavor);
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
if (memory.contains(view)) {
@ -110,18 +110,18 @@ class InstructionPanel extends JPanel implements ChangeListener {
}
}
catch (UnsupportedFlavorException e1) {
// return false
}
catch (IOException e1) {
// return false
}
}
return false;
}
/**
* Revert back to normal if any drag feedback was set.
*/
@Override
public void undoDragUnderFeedback() {
// stub
}
/**
@ -156,9 +156,6 @@ class InstructionPanel extends JPanel implements ChangeListener {
create(topPad, leftPad, bottomPad, rightPad);
}
/**
* Returns the current code unit displayed.
*/
CodeUnit getCurrentCodeUnit() {
return currentCodeUnit;
}
@ -168,14 +165,6 @@ class InstructionPanel extends JPanel implements ChangeListener {
updateLabels(activeIndex, activeSubIndex);
}
/**
* Set the code unit location.
* @param cu code unit
* @param loc location
* @param opIndex operand index
* @param showBlockID ID for what to show for the block name in the
* operand
*/
void setCodeUnitLocation(CodeUnit cu, int opIndex, int subIndex, boolean locked) {
if (cu != null) {
this.locked = locked;
@ -286,7 +275,7 @@ class InstructionPanel extends JPanel implements ChangeListener {
/**
* Enable drop on specified number of operands.
* A value of -1 will disable all drop targets.
* @param numOperands
* @param numOperands the number of operands
*/
private void updateDropTargets(int numOperands) {
++numOperands;
@ -374,7 +363,7 @@ class InstructionPanel extends JPanel implements ChangeListener {
if (activeIndex == opIndex) {
operandLabels[opIndex].setBorder(ETCHED_BORDER);
operandLabels[opIndex].setBackground(EditReferencesProvider.HIGHLIGHT_COLOR);
operandLabels[opIndex].setBackground(EditReferencesProvider.BG_COLOR_ACTIVE_OPERAND);
operandLabels[opIndex].setOpaque(true);
}
else {
@ -393,7 +382,7 @@ class InstructionPanel extends JPanel implements ChangeListener {
mnemonicLabel.setForeground(DEFAULT_FG_COLOR);
if (activeIndex == ReferenceManager.MNEMONIC) {
mnemonicLabel.setBackground(EditReferencesProvider.HIGHLIGHT_COLOR);
mnemonicLabel.setBackground(EditReferencesProvider.BG_COLOR_ACTIVE_OPERAND);
mnemonicLabel.setBorder(ETCHED_BORDER);
mnemonicLabel.setOpaque(true);
}

View file

@ -26,6 +26,7 @@ import javax.swing.*;
import docking.widgets.OptionDialog;
import docking.widgets.table.*;
import generic.theme.GColor;
import ghidra.app.cmd.register.SetRegisterCmd;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.services.*;
@ -45,7 +46,8 @@ class RegisterValuesPanel extends JPanel {
private static final String VALUE_COLUMN_NAME = "Value";
private static final String START_ADDRESS_COLUMN_NAME = "Start Address";
private static final String END_ADDRESS_COLUMN_NAME = "End Address";
private static final Color REGISTER_MARKER_COLOR = new Color(0, 153, 153);
private static final Color REGISTER_MARKER_COLOR =
new GColor("color.bg.plugin.register.marker");
private Program currentProgram;
private GhidraTable table;

View file

@ -33,6 +33,7 @@ import docking.actions.KeyBindingUtils;
import docking.options.editor.FontEditor;
import docking.widgets.OptionDialog;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.script.GhidraScriptUtil;
import ghidra.framework.options.SaveState;
import ghidra.util.*;
@ -41,7 +42,7 @@ import resources.Icons;
import resources.ResourceManager;
public class GhidraScriptEditorComponentProvider extends ComponentProvider {
static final String EDITOR_COMPONENT_NAME="EDITOR";
static final String EDITOR_COMPONENT_NAME = "EDITOR";
static final String CHANGE_DESTINATION_TITLE = "Where Would You Like to Store Your Changes?";
static final String FILE_ON_DISK_CHANGED_TITLE = "File Changed on Disk";
@ -69,7 +70,6 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider {
saveState.putInt("DEFAULT_FONT_SIZE", defaultFont.getSize());
}
private GhidraScriptMgrPlugin plugin;
private GhidraScriptComponentProvider provider;
private String title;
@ -227,7 +227,8 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider {
@Override
public boolean isEnabledForContext(ActionContext context) {
Object contextObject = context.getContextObject();
return contextObject == GhidraScriptEditorComponentProvider.this && !undoStack.isEmpty();
return contextObject == GhidraScriptEditorComponentProvider.this &&
!undoStack.isEmpty();
}
};
undoAction.setDescription("Undo");
@ -247,7 +248,8 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider {
@Override
public boolean isEnabledForContext(ActionContext context) {
Object contextObject = context.getContextObject();
return contextObject == GhidraScriptEditorComponentProvider.this && !redoStack.isEmpty();
return contextObject == GhidraScriptEditorComponentProvider.this &&
!redoStack.isEmpty();
}
};
redoAction.setDescription("Redo");
@ -447,7 +449,8 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider {
int choice = OptionDialog.showOptionDialog(scrollPane, FILE_ON_DISK_CHANGED_TITLE,
"<html>The contents of the script file have changed on disk.<br><br>Would " +
"you like to <b>keep your changes</b> in the editor or <b><font color=\"red\">" +
"you like to <b>keep your changes</b> in the editor or <b><font color=\"" +
Colors.ERROR.toHexString() + "\">" +
"discard</font></b> your changes?",
KEEP_CHANGES_TEXT, DISCARD_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE);
@ -469,7 +472,9 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider {
//
choice = OptionDialog.showOptionDialog(scrollPane, CHANGE_DESTINATION_TITLE,
"<html>You can save your current changes to <b>another file</b> or " +
"<b><font color=\"red\">overwrite</font></b> the contents of the file on disk.",
"<b><font color=\"" +
Colors.ERROR.toHexString() +
"\">overwrite</font></b> the contents of the file on disk.",
SAVE_CHANGES_AS_TEXT, OVERWRITE_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE);
//

View file

@ -24,6 +24,8 @@ import javax.swing.event.TableModelEvent;
import docking.widgets.table.*;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.script.GhidraScriptInfoManager;
import ghidra.app.script.ScriptInfo;
import ghidra.docking.settings.Settings;
@ -370,7 +372,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
KeyBindingsInfo info = (KeyBindingsInfo) value;
if (info.errorMessage != null) {
component.setForeground(Color.RED);
component.setForeground(Tables.FG_ERROR_UNSELECTED);
component.setToolTipText(info.errorMessage);
}
else {
@ -380,18 +382,20 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
}
if (info.hasAction) {
component.setForeground(Color.BLACK);
component.setForeground(Colors.FOREGROUND);
component.setToolTipText("Keybinding for action in tool" + keybindingText);
}
else {
component.setForeground(Color.LIGHT_GRAY);
component.setForeground(Colors.FOREGROUND_DISABLED);
component.setToolTipText("Keybinding for script" + keybindingText);
}
}
if (isSelected) {
JTable table = data.getTable();
Color selectedForegroundColor =
(info.errorMessage != null) ? Color.PINK : Color.WHITE;
(info.errorMessage != null) ? Tables.FG_ERROR_SELECTED
: table.getSelectionForeground();
component.setForeground(selectedForegroundColor);
}
return component;

View file

@ -25,6 +25,7 @@ import javax.swing.event.*;
import org.apache.commons.lang3.StringUtils;
import docking.widgets.*;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.app.script.ScriptInfo;
import ghidra.util.HTMLUtilities;
import ghidra.util.UserSearchUtils;
@ -271,7 +272,8 @@ public class ScriptSelectionEditor {
// show the keybinding at the top softly so the user can quickly see it without
// it interfering with the overall description
buffy.append("<P>");
buffy.append("<FONT COLOR=\"GRAY\"><I>&nbsp;");
buffy.append("<FONT COLOR=\"" +
Palette.GRAY.toHexString() + "\"><I>&nbsp;");
buffy.append(keyBinding.toString());
buffy.append("</I></FONT>");
buffy.append("<P><P>");

View file

@ -1,107 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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.spaceview;
import java.awt.Color;
import java.awt.image.IndexColorModel;
public class GhidraColorMap {
/*
tier 1
undefined (GRAY)
zero (BLACK)
low (DARK ORANGE)
whitespace (PALE BLUE)
digit (LIGHT BLUE)
upper (LIGHT BLUE)
lower (MED BLUE)
symbol (DARK BLUE)
high (DARK RED)
full (-1, 255) (WHITE)
tier 2
float? (GREEN)
double? (GREEN)
int? (ORANGE)
long? (ORANGE)
instruction? (PINK)
address? (YELLOW)
tier 3
SEAFOAM
defined data (simple types)
defined data (structs)
defined data (unions)
MAGENTA
code (memory)
code (flow)
code (special)
code (normal)
PURPLE
fun code (memory)
fun code (flow)
fun code (special)
fun code (normal)
RED
error bookmarks
tier 4
selected (BRIGHT GREEN)
highlighted (BRIGHT YELLOW)
selected and highlighted (BRIGHT YELLOW GREEN)
immutables needed:
segmenting
hilbert ordering
maximuming
from array
cache
iterator
also:
bijection from address to index in array space
bijection from pixelspace to indexspace
*/
public IndexColorModel getColorModel() {
Color[] colors =
new Color[] { new Color(190, 255, 0), Color.red, new Color(128, 128, 128), Color.cyan,
Color.magenta, };
byte[] red = new byte[colors.length];
byte[] grn = new byte[colors.length];
byte[] blu = new byte[colors.length];
for (int ii = 0; ii < colors.length; ++ii) {
red[ii] = (byte) colors[ii].getRed();
grn[ii] = (byte) colors[ii].getGreen();
blu[ii] = (byte) colors[ii].getBlue();
}
IndexColorModel colorModel = new IndexColorModel(8, colors.length, red, grn, blu);
return colorModel;
}
}

View file

@ -1,63 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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.spaceview;
public enum PixelType {
UNUSED_TYPE,
ERROR,
UNINIT_UNUSED,
UNINIT_DATA,
EXTERNAL,
UNDEF_DATA0,
UNDEF_DATA1,
UNDEF_DATA2,
UNDEF_DATA3,
UNDEF_DATA4,
UNDEF_DATA5,
UNDEF_DATA6,
UNDEF_DATA7,
DEF_DATA0,
DEF_DATA1,
DEF_DATA2,
DEF_DATA3,
DEF_DATA4,
DEF_DATA5,
DEF_DATA6,
DEF_DATA7,
CODE_MEMORY,
CODE_FLOW,
CODE_SPECIAL,
CODE_NORMAL,
FUN_CODE_MEMORY,
FUN_CODE_FLOW,
FUN_CODE_SPECIAL,
FUN_CODE_NORMAL,
SELECTED,
HIGHLIGHTED,
SEL_AND_HIGH;
public byte type() {
return (byte) ordinal();
}
}

View file

@ -1,99 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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.spaceview;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.*;
import java.util.Hashtable;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class SpacecurveRasterPanel extends JPanel {
protected static final Hashtable<?, ?> EMPTY_HASHTABLE = new Hashtable<Object, Object>();
byte[] raster;
private int width;
private int height;
private IndexColorModel colorModel;
public SpacecurveRasterPanel(IndexColorModel colorModel) {
this.colorModel = colorModel;
}
public void setRaster(byte[] raster, int width, int height) {
if (raster.length != width * height) {
throw new IllegalArgumentException("raster.length != width * height");
}
this.raster = raster;
this.width = width;
this.height = height;
repaint();
}
public void setColorModel(IndexColorModel colorModel) {
this.colorModel = colorModel;
repaint();
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
if (raster != null) {
DataBufferByte dbb = new DataBufferByte(raster, height * width, 0);
ComponentSampleModel sm = getComponentSampleModel();
WritableRaster wr = Raster.createWritableRaster(sm, dbb, null);
BufferedImage img = new BufferedImage(colorModel, wr, true, EMPTY_HASHTABLE);
g2.drawImage(img, 0, 0, null);
}
}
protected ComponentSampleModel getComponentSampleModel() {
return new ComponentSampleModel(DataBuffer.TYPE_BYTE, width, height, 1, width,
new int[] { 0 });
}
public static void main(String[] args) {
byte[] red = new byte[256];
byte[] grn = new byte[256];
byte[] blu = new byte[256];
for (int ii = 0; ii < 256; ++ii) {
int jj = (255 - ii);
red[ii] = (byte) jj;
grn[ii] = (byte) (jj * jj / 255);
blu[ii] = (byte) (Math.sqrt(jj) / Math.sqrt(255.0) * 255.0);
}
IndexColorModel colorModel = new IndexColorModel(8, 256, red, grn, blu);
final int width = 256;
final int height = 256;
byte[] raster = new byte[width * height];
for (int ii = 0; ii < raster.length; ++ii) {
raster[ii] = (byte) ((ii * 1) % 256);
}
SpacecurveRasterPanel panel = new SpacecurveRasterPanel(colorModel);
panel.setRaster(raster, width, height);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(panel);
frame.setSize(width, height);
frame.setVisible(true);
}
}

View file

@ -1,455 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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.symboltree;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class InfiniteProgressPanel extends JComponent implements MouseListener {
private static final String DEFAULT_MESSAGE_TEXT = "";
private static final int DEFAULT_NUMBER_OF_BARS = 14;
private static final float DEFAULT_SHIELD = .60F;
private static final int DEFAULT_FRAMES_PER_SECOND = 7;
private static final int DEFAULT_FADEIN_DELAY = 300;
protected String text = DEFAULT_MESSAGE_TEXT;
protected int fadeDelay = DEFAULT_FADEIN_DELAY;
protected float shield = DEFAULT_SHIELD;
protected int barsCount = DEFAULT_NUMBER_OF_BARS;
protected int fps = DEFAULT_FRAMES_PER_SECOND;
protected RenderingHints hints;
protected Area[] ticker;
// state values
protected Thread animation;
protected boolean paintAnimation = false;
protected int alphaLevel = 0;
public InfiniteProgressPanel() {
this( DEFAULT_MESSAGE_TEXT );
}
public InfiniteProgressPanel( String text ) {
this( text, DEFAULT_NUMBER_OF_BARS );
}
public InfiniteProgressPanel( String text, int barsCount ) {
this( text, barsCount, DEFAULT_SHIELD );
}
public InfiniteProgressPanel( String text, int barsCount, float shield ) {
this( text, barsCount, shield, DEFAULT_FRAMES_PER_SECOND );
}
public InfiniteProgressPanel( String text, int barsCount, float shield, int fps ) {
this( text, barsCount, shield, fps, DEFAULT_FADEIN_DELAY );
}
public InfiniteProgressPanel( String text, int barsCount, float shield, int fps, int rampDelay ) {
setText( text );
this.fadeDelay = rampDelay >= 0 ? rampDelay : 0;
this.shield = shield >= 0.0f ? shield : 0.0f;
this.fps = fps > 0 ? fps : 15;
this.barsCount = barsCount > 0 ? barsCount : 14;
this.hints = new RenderingHints( RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY );
this.hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
this.hints.put( RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON );
}
public void setText( String newText ) {
text = newText;
if ( text == null ) {
text = "";
}
repaint();
}
public String getText() {
return text;
}
public void start() {
if ( animation != null ) {
animation.interrupt();
}
removeMouseListener( this ); // be sure not to add the listener twice
addMouseListener( this );
setVisible( true );
ticker = buildTicker( barsCount );
double fixIncrement = 2.0 * Math.PI / (barsCount);
animation = new Thread( new Animator( fixIncrement, fadeDelay ) );
animation.start();
}
public void stop() {
if ( animation != null ) {
animation.interrupt();
animation = null;
double fixIncrement = 2.0 * Math.PI / (barsCount);
animation = new Thread( new FadeOutAnimator( fixIncrement, fadeDelay) );
animation.start();
}
}
public void interrupt() {
if ( animation != null ) {
animation.interrupt();
animation = null;
removeMouseListener(this);
setVisible(false);
}
}
private Area[] buildTicker( int barCount ) {
Area[] newTicker = new Area[barCount];
Point2D.Double center = new Point2D.Double( (double) getWidth() / 2,
(double) getHeight() / 2 );
double fixedAngle = 2.0 * Math.PI / (barCount);
for ( double i = 0.0; i < barCount; i++ ) {
Area primitive = buildPrimitive();
AffineTransform toCenter = AffineTransform.getTranslateInstance(center.getX(),
center.getY() );
AffineTransform toBorder = AffineTransform.getTranslateInstance(45.0, -6.0 );
AffineTransform toCircle = AffineTransform.getRotateInstance(-i * fixedAngle,
center.getX(), center.getY() );
AffineTransform toWheel = new AffineTransform();
toWheel.concatenate(toCenter);
toWheel.concatenate(toBorder);
primitive.transform(toWheel);
primitive.transform(toCircle);
newTicker[(int) i] = primitive;
}
return newTicker;
}
private Area buildPrimitive() {
Rectangle2D.Double body = new Rectangle2D.Double( 6, 0, 30, 12 ); // location and size
Ellipse2D.Double head = new Ellipse2D.Double( 0, 0, 12, 12 );
Ellipse2D.Double tail = new Ellipse2D.Double( 30, 0, 12, 12 );
Area tick = new Area(body);
tick.add( new Area( head ) );
tick.add( new Area( tail ) );
return tick;
}
@Override
public void paintComponent( Graphics g ) {
if ( !paintAnimation ) {
return;
}
int width = getWidth();
int height = getHeight();
double maxY = 0.0;
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHints(hints);
g2.setColor( new Color( 255, 255, 255, (int) (alphaLevel * shield) ) );
g2.fillRect(0, 0, width, height);
double textPosition = 0.0;
for ( Area element : ticker ) {
Rectangle2D bounds = element.getBounds2D();
if ( bounds.getMaxY() > textPosition ) {
textPosition = bounds.getMaxY();
}
}
int channel = 0;
int blue = 255;
Color textColor = Color.BLACK;
for ( int i = 0; i < ticker.length; i++ ) {
channel = 264 - 128 / (i + 1);
blue = channel+126 > 255 ? 255 : channel+126;
Color color = new Color( channel, channel, blue, (int) (alphaLevel * shield) );
if ( i == 0 ) {
textColor = color;
}
g2.setColor( color );
g2.fill( ticker[i] );
Rectangle2D bounds = ticker[i].getBounds2D();
if ( bounds.getMaxY() > maxY ) {
maxY = bounds.getMaxY();
}
}
paintText( g2, textColor, textPosition );
}
private void paintText( Graphics2D graphics, Color color, double textPosition ) {
if ( text == null || text.trim().length() == 0 ) {
return;
}
FontRenderContext context = graphics.getFontRenderContext();
TextLayout layout = new TextLayout( text, getFont(), context );
Rectangle2D bounds = layout.getBounds();
graphics.setColor( Color.BLACK );
layout.draw( graphics, (float) (getWidth() - bounds.getWidth()) / 2,
(float) (textPosition + layout.getLeading() + 2 * layout.getAscent() ) );
}
// fade out
private class FadeOutAnimator implements Runnable {
private final int fadeDelayTime;
private AffineTransform transformToCircle;
private long startRampupTime;
private FadeOutAnimator( double transformTheta, int fadeDelayTime ) {
this.fadeDelayTime = fadeDelayTime;
Point2D.Double center = new Point2D.Double( (double) getWidth() / 2,
(double) getHeight() / 2 );
transformToCircle = AffineTransform.getRotateInstance(transformTheta,
center.getX(), center.getY() );
}
public void run() {
startRampupTime = System.currentTimeMillis();
if ( fadeDelayTime == 0 ) {
alphaLevel = 0;
}
while ( !Thread.interrupted() && (alphaLevel > 0) ) {
transformTicker();
repaint();
updateBackgroundAlpha();
if ( !pauseForEffect() ) {
break;
}
}
paintAnimation = false;
repaint();
setVisible(false);
removeMouseListener( InfiniteProgressPanel.this );
}
// true indicates a successful pause
protected boolean pauseForEffect() {
try {
Thread.sleep( (1000/fps) );
} catch ( InterruptedException ie ) {
return false; // we've stopped the thread
}
Thread.yield();
return true;
}
protected void transformTicker() {
for ( Area element : ticker ) {
element.transform( transformToCircle );
}
}
protected void updateBackgroundAlpha() {
if ( alphaLevel <= 0 ) {
return;
}
int elapsedTime = (int) (System.currentTimeMillis() - startRampupTime);
int increment = (255 * elapsedTime) / fadeDelayTime;
alphaLevel = 255 - increment;
if ( alphaLevel <= 0 ) {
alphaLevel = 0;
}
}
}
private class Animator implements Runnable {
private boolean inRampUpPeriod = false;
private final int rampDelayTime;
private AffineTransform transformToCircle;
private long startRampupTime;
protected Animator( double transformTheta, int rampDelayTime ) {
this.rampDelayTime = rampDelayTime;
Point2D.Double center = new Point2D.Double( (double) getWidth() / 2,
(double) getHeight() / 2 );
transformToCircle = AffineTransform.getRotateInstance(transformTheta,
center.getX(), center.getY() );
}
public void run() {
startRampupTime = System.currentTimeMillis();
if ( rampDelayTime == 0 ) {
alphaLevel = 255;
}
paintAnimation = true;
inRampUpPeriod = true;
while ( !Thread.interrupted() ) {
transformTicker();
repaint();
updateBackgroundAlpha();
if ( !pauseForEffect() ) {
break;
}
}
}
// true indicates a successful pause
protected boolean pauseForEffect() {
try {
Thread.sleep( (1000/fps) );
} catch ( InterruptedException ie ) {
return false; // we've stopped the thread
}
Thread.yield();
return true;
}
protected void transformTicker() {
if ( inRampUpPeriod ) {
return;
}
for ( Area element : ticker ) {
element.transform( transformToCircle );
}
}
protected void updateBackgroundAlpha() {
if ( alphaLevel >= 255 ) {
inRampUpPeriod = false;
return;
}
int elapsedTime = (int) (System.currentTimeMillis() - startRampupTime);
int increment = (255 * elapsedTime) / rampDelayTime;
alphaLevel = increment;
if ( alphaLevel >= 255 ) {
alphaLevel = 255;
inRampUpPeriod = false;
}
}
}
public void mouseClicked(MouseEvent e) {
Toolkit.getDefaultToolkit().beep();
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public static void main( String[] args ) {
final JFrame frame = new JFrame( "Ticker Test" );
frame.setSize( 400, 600 );
final Component originalGlassPane = frame.getGlassPane();
final InfiniteProgressPanel progressPanel = new InfiniteProgressPanel("Processing request...");
progressPanel.fps = 7;
progressPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked( MouseEvent e ) {
//progressPanel.interrupt();
progressPanel.stop();
frame.setGlassPane(originalGlassPane);
}
} );
JPanel mainPanel = new JPanel( new BorderLayout() );
JScrollPane scrollPane = new JScrollPane();
final JTextArea textArea = new JTextArea( 50, 40 );
textArea.setText("some text here..." );
scrollPane.getViewport().add( textArea );
mainPanel.add( scrollPane, BorderLayout.CENTER );
JButton button = new JButton( "Start" );
button.addActionListener(new ActionListener() {
public void actionPerformed( ActionEvent event ) {
frame.setGlassPane(progressPanel);
progressPanel.start();
}
} );
mainPanel.add( button, BorderLayout.SOUTH );
frame.setSize( 400, 400 );
frame.setLocation( GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint() );
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add( mainPanel );
frame.setVisible( true );
}
}

View file

@ -19,6 +19,7 @@ import java.awt.Color;
import java.awt.Component;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.util.SymbolInspector;
import ghidra.program.model.address.Address;
import ghidra.program.model.lang.Register;
@ -78,7 +79,7 @@ class SymbolRenderer extends GhidraTableCellRenderer {
setBold();
Color color =
(inspector != null) && (value instanceof Symbol) ? inspector.getColor((Symbol) value)
: Color.BLACK;
: Colors.FOREGROUND;
if (!isSelected) {
setForeground(color);

View file

@ -16,7 +16,6 @@
package ghidra.app.plugin.core.totd;
import java.awt.*;
import java.awt.event.*;
import java.util.List;
import javax.swing.*;
@ -26,6 +25,8 @@ import docking.DialogComponentProvider;
import docking.DockingWindowManager;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import resources.ResourceManager;
class TipOfTheDayDialog extends DialogComponentProvider {
@ -65,38 +66,25 @@ class TipOfTheDayDialog extends DialogComponentProvider {
showTipsCheckbox = new GCheckBox("Show Tips on Startup?");
showTipsCheckbox.setSelected(true); // TODO (FixMe) Moved this before its listener to prevent project save for now.
showTipsCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
showTipsChanged();
}
});
showTipsCheckbox.addItemListener(e -> showTipsChanged());
nextTipButton = new JButton("Next Tip");
nextTipButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
nextTipButton.addActionListener(e -> {
incrementTipIndex();
loadNextTip();
}
});
addButton(nextTipButton);
closeButton = new JButton("Close");
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
close();
}
});
closeButton.addActionListener(e -> close());
addButton(closeButton);
JPanel panel = new JPanel(new BorderLayout());
Border panelBorder =
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10),
BorderFactory.createLineBorder(Color.BLACK));
BorderFactory.createLineBorder(Java.BORDER));
panel.setBorder(panelBorder);
panel.setBackground(Color.WHITE);
panel.setBackground(Colors.BACKGROUND);
JLabel label = new GLabel("Did you know...", tipIcon, SwingConstants.LEFT);
label.setFont(new Font("dialog", Font.BOLD, 12));

View file

@ -15,6 +15,10 @@
*/
package ghidra.app.plugin.debug.propertymanager;
import javax.swing.ImageIcon;
import javax.swing.Timer;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.app.CorePluginPackage;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.ProgramPlugin;
@ -28,17 +32,8 @@ import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.Program;
import ghidra.program.util.*;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.Timer;
import resources.ResourceManager;
/**
* PropertyManagerPlugin
*/
@ -80,13 +75,10 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
markerService = tool.getService(MarkerService.class);
updateTimer = new Timer(500, new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateTimer = new Timer(500, e -> {
if (propertyViewProvider != null && propertyViewProvider.isVisible()) {
propertyViewProvider.refresh();
}
}
});
updateTimer.setRepeats(false);
}
@ -95,6 +87,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
* (non-Javadoc)
* @see ghidra.framework.model.DomainObjectListener#domainObjectChanged(ghidra.framework.model.DomainObjectChangedEvent)
*/
@Override
public void domainObjectChanged(DomainObjectChangedEvent ev) {
if (propertyViewProvider == null || !propertyViewProvider.isVisible()) {
return;
@ -110,8 +103,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
if (eventType == DomainObject.DO_OBJECT_RESTORED ||
eventType == ChangeManager.DOCR_MEMORY_BLOCK_MOVED ||
eventType == ChangeManager.DOCR_MEMORY_BLOCK_REMOVED ||
eventType == ChangeManager.DOCR_CODE_UNIT_PROPERTY_ALL_REMOVED)
{
eventType == ChangeManager.DOCR_CODE_UNIT_PROPERTY_ALL_REMOVED) {
affectedByChange = true;
break;
}
@ -124,7 +116,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
break;
}
CodeUnitPropertyChangeRecord pcr = (CodeUnitPropertyChangeRecord)record;
CodeUnitPropertyChangeRecord pcr = (CodeUnitPropertyChangeRecord) record;
Address addr = pcr.getAddress();
if (addr != null) {
if (currentSelection.contains(addr)) {
@ -176,7 +168,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
if (searchMarks == null && currentProgram != null) {
searchMarks = markerService.createPointMarker(PROPERTY_MARKER_NAME,
"Locations where properties are set", currentProgram,
MarkerService.PROPERTY_PRIORITY, true, true, false, Color.pink, propIcon);
MarkerService.PROPERTY_PRIORITY, true, true, false, Palette.PINK, propIcon);
}
return searchMarks;
}
@ -185,10 +177,10 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
* Dispose search marker manager
*/
void disposeSearchMarks() {
disposeSearchMarks( currentProgram );
disposeSearchMarks(currentProgram);
}
private void disposeSearchMarks( Program program ) {
private void disposeSearchMarks(Program program) {
if (searchMarks != null && program != null) {
markerService.removeMarker(searchMarks, program);
searchMarks = null;
@ -196,7 +188,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
}
void clearSearchMarks() {
if ( searchMarks != null ) {
if (searchMarks != null) {
searchMarks.clearAll();
}
}

View file

@ -26,6 +26,7 @@ import javax.swing.*;
import docking.ComponentProvider;
import docking.Tool;
import generic.theme.GColor;
import generic.util.WindowUtilities;
import generic.util.image.ImageUtils;
import ghidra.app.DeveloperPluginPackage;
@ -46,6 +47,18 @@ import ghidra.util.Swing;
//@formatter:on
public class WindowLocationPlugin extends Plugin {
private static final Color BG_COLOR = new GColor("color.bg.plugin.windowlocation");
private static final Color BG_COLOR_BOUNDS_VIRTUAL =
new GColor("color.bg.plugin.windowlocation.bounds.virtual");
private static final Color BG_COLOR_BOUNDS_VISIBLE =
new GColor("color.bg.plugin.windowlocation.bounds.visible");
private static final Color BG_COLOR_SCREENS =
new GColor("color.bg.plugin.windowlocation.screens");
private static final Color BG_COLOR_WINDOW_SELECTED =
new GColor("color.bg.plugin.windowlocation.window.selected");
private static final Color FG_COLOR_WINDOW_TEXT =
new GColor("color.fg.plugin.windowlocation.window.text");
static final String NAME = "Window Locations";
private WindowLocationProvider provider;
@ -75,12 +88,7 @@ public class WindowLocationPlugin extends Plugin {
windowPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
Toolkit toolkit = Toolkit.getDefaultToolkit();
AWTEventListener listener = new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
windowPanel.repaint();
}
};
AWTEventListener listener = event -> windowPanel.repaint();
toolkit.addAWTEventListener(listener, AWTEvent.MOUSE_MOTION_EVENT_MASK);
toolkit.addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK);
}
@ -124,7 +132,7 @@ public class WindowLocationPlugin extends Plugin {
Dimension size = getSize();
double panelWidth = size.getWidth();
double panelHeight = size.getHeight();
setBackground(Color.BLACK);
setBackground(BG_COLOR);
g.fillRect(0, 0, (int) panelWidth, (int) panelHeight);
Graphics2D g2d = (Graphics2D) g;
@ -135,9 +143,9 @@ public class WindowLocationPlugin extends Plugin {
clone.concatenate(newxform);
g2d.setTransform(clone);
paintVirtualBounds(g2d, Color.RED);
paintVisibleBounds(g2d, Color.GREEN);
paintScreens(g2d, Color.ORANGE);
paintVirtualBounds(g2d, BG_COLOR_BOUNDS_VIRTUAL);
paintVisibleBounds(g2d, BG_COLOR_BOUNDS_VISIBLE);
paintScreens(g2d, BG_COLOR_SCREENS);
paintWindows(g2d, newxform);
}
finally {
@ -183,7 +191,7 @@ public class WindowLocationPlugin extends Plugin {
Font f = g2d.getFont();
Font biggerFont = f.deriveFont(40f);
g2d.setFont(biggerFont);
g2d.setColor(Color.GRAY);
g2d.setColor(FG_COLOR_WINDOW_TEXT);
Window[] windows = Window.getWindows();
@ -380,8 +388,7 @@ public class WindowLocationPlugin extends Plugin {
Color bg = g2d.getColor();
try {
Color withAlpha = new Color(0, 255, 0, 200);
g2d.setColor(withAlpha);
g2d.setColor(BG_COLOR_WINDOW_SELECTED);
g2d.fill(b);
}
finally {

View file

@ -103,6 +103,6 @@ public interface PluginConstants {
* address.
*/
public static final Color SEARCH_HIGHLIGHT_CURRENT_ADDR_COLOR =
new GColor("color.bg.search.current-line.highlight");
new GColor("color.bg.search.current.line.highlight");
}

View file

@ -95,13 +95,13 @@ public class OptionsGui extends JPanel {
"Function Auto-Parameters", new GColor("color.fg.listing.function.param.auto"));
public static final ScreenElement FUN_RET_TYPE = new ScreenElement("Function Return Type",
new GColor("color.fg.listing.function.return-type"));
new GColor("color.fg.listing.function.return.type"));
public static final ScreenElement COMMENT_REPEATABLE =
new ScreenElement("Comment, Repeatable", new GColor("color.fg.listing.comment.repeatable"));
public static final ScreenElement COMMENT_REF_REPEAT = new ScreenElement(
"Comment, Referenced Repeatable", new GColor("color.fg.listing.comment.ref-repeatable"));
"Comment, Referenced Repeatable", new GColor("color.fg.listing.comment.ref.repeatable"));
public static final ScreenElement LABELS_LOCAL =
new ScreenElement("Labels, Local", new GColor("color.fg.listing.label.local"));
@ -116,16 +116,16 @@ public class OptionsGui extends JPanel {
new GColor("color.fg.listing.mnemonic.unimplemented"));
public static final ScreenElement FLOW_ARROW_NON_ACTIVE = new ScreenElement(
"Flow Arrow, Not Active", new GColor("color.fg.listing.flow-arrow.inactive"));
"Flow Arrow, Not Active", new GColor("color.fg.listing.flow.arrow.inactive"));
public static final ScreenElement FLOW_ARROW_ACTIVE =
new ScreenElement("Flow Arrow, Active", new GColor("color.fg.listing.flow-arrow.active"));
new ScreenElement("Flow Arrow, Active", new GColor("color.fg.listing.flow.arrow.active"));
public static final ScreenElement FLOW_ARROW_SELECTED = new ScreenElement(
"Flow Arrow, Selected", new GColor("color.fg.listing.flow-arrow.selected"));
"Flow Arrow, Selected", new GColor("color.fg.listing.flow.arrow.selected"));
public static final ScreenElement LABELS_NON_PRIMARY =
new ScreenElement("Labels, Non-primary", new GColor("color.fg.listing.label.non-primary"));
new ScreenElement("Labels, Non-primary", new GColor("color.fg.listing.label.non.primary"));
public static final ScreenElement COMMENT_PLATE = new ScreenElement("Comment, Plate",
"Plate Comment", new GColor("color.fg.listing.comment.plate"));
@ -152,7 +152,7 @@ public class OptionsGui extends JPanel {
"Parameter, Dynamic Storage", new GColor("color.fg.listing.function.param.dynamic"));
public static final ScreenElement VERSION_TRAK =
new ScreenElement("Version Track", new GColor("color.fg.listing.version-tracking"));
new ScreenElement("Version Track", new GColor("color.fg.listing.version.tracking"));
public static final ScreenElement XREF =
new ScreenElement("XRef", new GColor("color.fg.listing.xref"));

View file

@ -1,7 +1,31 @@
[Defaults]
color.bg.decompiler = color.bg
color.fg.decompiler = color.fg
color.fg.decompiler.keyword = #0001e6
color.fg.decompiler.function.name = blue
color.fg.decompiler.comment = blueViolet
color.fg.decompiler.variable = #999900 // close to oliveDrab
color.fg.decompiler.constant = forestGreen
color.fg.decompiler.type = mediumBlue
color.fg.decompiler.parameter = darkMagenta
color.fg.decompiler.global = darkCyan
color.bg.decompiler.middle.mouse = rgba(255,255,0,.5)
color.bg.decompiler.current.variable = rgba(255,255,0,0.5)
[Dark Defaults]
color.fg.decompiler.keyword = peru
color.fg.decompiler.function.name = cadetBlue
color.fg.decompiler.comment = lightSlateGray
color.fg.decompiler.variable = #999900 // close to oliveDrab
color.fg.decompiler.constant = forestGreen
color.fg.decompiler.type = blue
color.fg.decompiler.parameter = darkMagenta
color.fg.decompiler.global = darkCyan
color.bg.decompiler.middle.mouse = rgb(55,59,65)
color.bg.decompiler.current.variable = rgb(55, 59, 65)

View file

@ -303,12 +303,12 @@ public class DecompileOptions {
private final static IntegerFormatEnum INTEGERFORMAT_OPTIONDEFAULT = IntegerFormatEnum.BestFit; // Must match PrintLanguage::resetDefaultsInternal
private IntegerFormatEnum integerFormat;
private final static Color HIGHLIGHT_MIDDLE_MOUSE_DEF = new GColor("color.bg.decompiler.middle-mouse");
private final static Color HIGHLIGHT_MIDDLE_MOUSE_DEF = new GColor("color.bg.decompiler.middle.mouse");
private Color middleMouseHighlightColor;
private int middleMouseHighlightButton = MouseEvent.BUTTON2;
private final static String HIGHLIGHT_CURRENT_VARIABLE_MSG ="Display.Color for Current Variable Highlight";
private final static Color HIGHLIGHT_CURRENT_VARIABLE_DEF = new GColor("color.bg.decompiler.current-variable");
private final static Color HIGHLIGHT_CURRENT_VARIABLE_DEF = new GColor("color.bg.decompiler.current.variable");
private Color currentVariableHighlightColor;
private final static String HIGHLIGHT_KEYWORD_MSG = "Display.Color for Keywords";

View file

@ -4,15 +4,15 @@
color.bg.functiongraph = color.bg
color.fg.label.picked = color.fg
color.fg.label.non-picked = color.fg.disabled
color.fg.label.non.picked = color.fg.disabled
color.bg.functiongraph.vertex.group = rgb(226, 255, 155)
color.bg.functiongraph.vertex.entry = color.palette.lightgreen
color.bg.functiongraph.vertex.exit = color.palette.lightred
color.bg.functiongraph.vertex.picked = color.palette.yellow
color.bg.functiongraph.edge.fall-through = color.flowtype.fall-through
color.bg.functiongraph.edge.fall-through.highlight = rgb(255, 127, 127)
color.bg.functiongraph.edge.fall.through = color.flowtype.fall.through
color.bg.functiongraph.edge.fall.through.highlight = rgb(255, 127, 127)
color.bg.functiongraph.edge.jump.conditional = color.flowtype.jump.conditional
color.bg.functiongraph.edge.jump.conditional.highlight = lime
color.bg.functiongraph.edge.jump.unconditional = color.flowtype.jump.unconditional
@ -27,15 +27,15 @@ color.bg.functiongraph.paint.icon = rgb(189, 221, 252) // gentle pale blue
// color.bg.functiongraph = color.bg
// color.fg.label.picked = color.fg
// color.fg.label.non-picked = color.fg.disabled
// color.fg.label.non.picked = color.fg.disabled
color.bg.functiongraph.vertex.group = rgb(226, 222, 179) // TODO confirm value
// color.bg.functiongraph.vertex.entry = color.palette.lightgreen
// color.bg.functiongraph.vertex.exit = color.palette.lightred
// color.bg.functiongraph.vertex.picked = color.palette.yellow
// color.bg.functiongraph.edge.fall-through = color.flowtype.fall-through
color.bg.functiongraph.edge.fall-through.highlight = rgb(165, 76, 80)
// color.bg.functiongraph.edge.fall.through = color.flowtype.fall.through
color.bg.functiongraph.edge.fall.through.highlight = rgb(165, 76, 80)
// color.bg.functiongraph.edge.jump.conditional = color.flowtype.jump.conditional
color.bg.functiongraph.edge.jump.conditional.highlight = rgb(95, 160, 196)
// color.bg.functiongraph.edge.jump.unconditional = color.flowtype.jump.unconditional

View file

@ -221,7 +221,7 @@ public class FGComponent extends GraphComponent<FGVertex, FGEdge, FunctionGraph>
// renderer inside of the VisualGraphRenderer
VisualGraphEdgeLabelRenderer edgeLabelRenderer =
new VisualGraphEdgeLabelRenderer(new GColor("color.fg.label.picked"));
edgeLabelRenderer.setNonPickedForegroundColor(new GColor("color.fg.label.non-picked"));
edgeLabelRenderer.setNonPickedForegroundColor(new GColor("color.fg.label.non.picked"));
edgeLabelRenderer.setRotateEdgeLabels(false);
renderContext.setEdgeLabelRenderer(edgeLabelRenderer);

View file

@ -94,11 +94,11 @@ public class FunctionGraphOptions extends VisualGraphOptions {
private Color defaultVertexBackgroundColor = new GColor("color.bg.functiongraph");
private Color defaultGroupBackgroundColor = new GColor("color.bg.functiongraph.vertex.group");
private Color fallthroughEdgeColor = new GColor("color.bg.functiongraph.edge.fall-through");
private Color fallthroughEdgeColor = new GColor("color.bg.functiongraph.edge.fall.through");
private Color conditionalJumpEdgeColor = new GColor("color.bg.functiongraph.edge.jump.conditional");
private Color unconditionalJumpEdgeColor = new GColor("color.bg.functiongraph.edge.jump.unconditional");
private Color fallthroughEdgeHighlightColor = new GColor("color.bg.functiongraph.edge.fall-through.highlight");
private Color fallthroughEdgeHighlightColor = new GColor("color.bg.functiongraph.edge.fall.through.highlight");
private Color conditionalJumpEdgeHighlightColor = new GColor("color.bg.functiongraph.edge.jump.conditional.highlight");
private Color unconditionalJumpEdgeHighlightColor = new GColor("color.bg.functiongraph.edge.jump.unconditional.highlight");
//@formatter:on

View file

@ -1,6 +1,7 @@
[Defaults]
color.palette.nocolor = rgba(255,255,255,0)
color.palette.disabled = rgba(255,255,255,0)
color.palette.black = black
color.palette.blue = blue
@ -40,3 +41,5 @@ color.palette.white = white
#color.palette.yellow = rgb(191, 191, 64) // olive
color.palette.cyan = #00CCCC // less harsh
color.palette.blue = deepskyblue
color.palette.magenta = plum

View file

@ -1,6 +1,6 @@
[Defaults]
color.bg = white
color.bg = white // note: this is the text/widget bg color
color.fg = black
color.fg.error = red
color.fg.disabled = lightGray
@ -33,8 +33,13 @@ color.bg.currentline = rgb(232,242,254)
color.cursor.focused = red
color.cursor.unfocused = pink
color.bg.table.grid = gray
color.bg.table.row = color.bg
color.bg.table.row.alt = rgb(237,243,254)
color.fg.table.uneditable.selected = yellow
color.fg.table.uneditable.unselected = lightgray
color.fg.error.table.unselected = color.fg.error
color.fg.error.table.selected = lightpink
color.bg.tableheader.gradient.start = color.bg
color.bg.tableheader.gradient.end = lightGray
@ -45,6 +50,8 @@ color.bg.textfield.hint.valid = color.bg
color.bg.textfield.hint.invalid = rgb(255,225,225)
color.fg.textfield.hint = color.fg
color.bg.tree.drag.no.selection = rgb(204, 204, 255)
color.bg.filterfield = yellow
color.fg.filterfield = black
@ -64,7 +71,7 @@ color.bg.fieldpanel = color.bg
color.fg.fieldpanel = color.fg
color.bg.fieldpanel.selection = color.bg.selection
color.bg.fieldpanel.highlight = color.bg.highlight
color.bg.fieldpanel.selection-highlight = green
color.bg.fieldpanel.selection.and.highlight = green
// Icons files
icon.empty = images/EmptyIcon16.gif
@ -106,6 +113,7 @@ icon.theme.export = images/mail-folder-outbox.png
color.bg = #46494B // color used by flatlaf dark theme
color.fg = lightgray
color.fg.error = indianRed
color.fg.disabled = gray
color.fg.help.selector.h1 = #66AAF4
color.fg.help.selector.h2 = #9999F9
@ -140,11 +148,15 @@ color.fg.filterfield = darkSlateGray
color.bg.selection = teal
color.bg.highlight = olive
color.bg.fieldpanel.selection-highlight = darkGreen
color.bg.fieldpanel.selection.and.highlight = darkGreen
color.bg.table.row.alt = rgb(45,47,65)
color.fg.table.uneditable.selected = lemonchiffon
color.fg.table.uneditable.unselected = lightgray
color.bg.tableheader.gradient.start = color.bg
color.bg.tableheader.gradient.end = darkGray
color.bg.tableheader.gradient.start.primary = color.bg
color.bg.tableheader.gradient.end.primary = darkBlue
color.bg.table.row.alt = rgb(45,47,65)

View file

@ -29,7 +29,6 @@ public class PaintContext {
private Color selectionColor;
private Color highlightColor;
private Color selectedHighlightColor;
private Color printColor;
private Color cursorColor;
private Color focusedCursorColor;
@ -47,7 +46,7 @@ public class PaintContext {
foreground = new GColor("color.fg.fieldpanel");
selectionColor = new GColor("color.bg.fieldpanel.selection");
highlightColor = new GColor("color.bg.fieldpanel.highlight");
selectedHighlightColor = new GColor("color.bg.fieldpanel.selection-highlight");
selectedHighlightColor = new GColor("color.bg.fieldpanel.selection.and.highlight");
focusedCursorColor = new GColor("color.cursor.focused");
notFocusedCursorColor = new GColor("color.cursor.unfocused");
cursorColor = focusedCursorColor;
@ -64,7 +63,6 @@ public class PaintContext {
focusedCursorColor = other.focusedCursorColor;
notFocusedCursorColor = other.notFocusedCursorColor;
invisibleCursorColor = other.invisibleCursorColor;
printColor = other.printColor;
}
/**
@ -177,10 +175,6 @@ public class PaintContext {
return notFocusedCursorColor;
}
public void setPrintColor(Color c) {
printColor = c;
}
public void setPrinting(boolean b) {
printing = b;
}

View file

@ -23,6 +23,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import docking.widgets.table.constraint.ColumnConstraint;
import generic.theme.GThemeDefaults.Colors;
import ghidra.util.HTMLUtilities;
import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
@ -206,7 +207,7 @@ public abstract class AbstractColumnConstraintEditor<T> implements ColumnConstra
* @return an HTML string suitable for a JLabel.
*/
protected final static String formatStatus(String message, boolean error) {
Color color = error ? Color.RED : Color.BLACK;
Color color = error ? Colors.ERROR : Colors.FOREGROUND;
String messageWithFont = HTMLUtilities.setFont(message, color, 12);
String html = HTMLUtilities.wrapAsHTML(messageWithFont);
return html;

View file

@ -78,7 +78,7 @@ public class GColor extends Color {
* Creates a transparent version of this GColor. If the underlying value of this GColor changes,
* the transparent version will also change.
* @param newAlpha the transparency level for the new color
* @return a tranparent version of this GColor
* @return a transparent version of this GColor
*/
public GColor withAlpha(int newAlpha) {
return new GColor(id, newAlpha);

View file

@ -44,8 +44,12 @@ public class GThemeDefaults {
// generic color concepts
//@formatter:off
public static final GColor BACKGROUND = new GColor("color.bg");
public static final GColor CURSOR = new GColor("color.cursor.focused");
public static final GColor DISABLED = new GColor("color.palette.disabled");
public static final GColor ERROR = new GColor("color.fg.error");
public static final GColor FOREGROUND = new GColor("color.fg");
public static final GColor FOREGROUND_DISABLED = new GColor("color.fg.disabled");
public static final GColor TOOLTIP_BACKGROUND = new GColor("color.bg.tooltip");
//@formatter:on
@ -53,6 +57,26 @@ public class GThemeDefaults {
public static final GColor BORDER = new GColor(Ids.Java.BORDER);
}
public static class Tables {
public static final GColor FG_ERROR_SELECTED =
new GColor("color.fg.error.table.selected");
public static final GColor FG_ERROR_UNSELECTED =
new GColor("color.fg.error.table.unselected");
public static final GColor FG_UNEDITABLE_SELECTED =
new GColor("color.fg.table.uneditable.selected");
public static final GColor FG_UNEDITABLE_UNSELECTED =
new GColor("color.fg.table.uneditable.unselected");
}
public static class Dialogs {
public static final GColor FG_MESSAGE_NORMAL =
new GColor("color.fg.dialog.status.normal");
public static final GColor FG_MESSAGE_ERROR =
new GColor("color.fg.dialog.status.error");
}
/**
* Generic palette colors, using color names, that may be changed along with the theme
*/
@ -69,6 +93,7 @@ public class GThemeDefaults {
public static final GColor GREEN = new GColor("color.palette.green");
public static final GColor LIGHT_GRAY = new GColor("color.palette.lightgray");
public static final GColor LIME = new GColor("color.palette.lime");
public static final GColor MAGENTA = new GColor("color.palette.magenta");
public static final GColor ORANGE = new GColor("color.palette.orange");
public static final GColor PINK = new GColor("color.palette.pink");
public static final GColor RED = new GColor("color.palette.red");

View file

@ -0,0 +1,51 @@
/* ###
* 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 generic.theme;
import java.awt.Color;
/**
* A class to serve as a placeholder for migrating code. After the migration is complete, uses
* of this class can be removed, with the original code being restored in the process.
*/
public class TempColorUtils {
public static Color fromRgb(int rgb) {
return new Color(rgb);
}
public static Color fromRgba(int rgba) {
return new Color(rgba, true);
}
public static Color fromRgb(int r, int g, int b) {
return new Color(r, g, b);
}
public static Color blend1(Color primary, Color secondary) {
int red = (primary.getRed() * 2 + secondary.getRed()) / 3;
int green = (primary.getGreen() * 2 + secondary.getGreen()) / 3;
int blue = (primary.getBlue() * 2 + secondary.getBlue()) / 3;
return new Color(red, green, blue);
}
public static Color blend2(Color c, int value) {
int red = (c.getRed() + 3 * value) / 4;
int green = (c.getGreen() + 3 * value) / 4;
int blue = (c.getBlue() + 3 * value) / 4;
return new Color(red, green, blue);
}
}

View file

@ -6,8 +6,8 @@ color.fg.pluginpanel.description = gray
color.bg.panel.details = color.bg
color.fg.pluginpanel.details.title = maroon
color.fg.pluginpanel.details.name.no-dependents = limeGreen
color.fg.pluginpanel.details.name.has-dependents = red
color.fg.pluginpanel.details.name.no.dependents = limeGreen
color.fg.pluginpanel.details.name.has.dependents = red
color.fg.pluginpanel.details.description = blue
color.fg.pluginpanel.details.category = magenta
color.fg.pluginpanel.details.class = black
@ -21,17 +21,12 @@ color.border.pluginpanel = darkGray
color.fg.plugin.installer.table.has.dependents = red
color.fg.plugin.installer.table.has.dependents.selected = pink
[Dark Defaults]
color.fg.pluginpanel.details.title = indianRed
color.fg.pluginpanel.details.name.no-dependents = forestGreen
color.fg.pluginpanel.details.name.has-dependents = indianRed
color.fg.pluginpanel.details.description = blue
color.fg.pluginpanel.details.category = darkMagenta
color.fg.pluginpanel.details.class = gray
color.fg.pluginpanel.details.loc = darkGray
color.fg.pluginpanel.details.developer =mediumVioletRed
color.fg.pluginpanel.details.dependency = forestGreen
color.fg.pluginpanel.details.novalue = dimGray
color.fg.pluginpanel.name = #d3d3d3 // LightGray
color.fg.pluginpanel.description = #808080 // Gray
@ -42,8 +37,8 @@ color.fg.pluginpanel.details.dependency = #228b22 // ForestGreen
color.fg.pluginpanel.details.description = #aaaaff
color.fg.pluginpanel.details.developer = #c71585 // MediumVioletRed
color.fg.pluginpanel.details.loc = #a9a9a9 // DarkGray
color.fg.pluginpanel.details.name.has-dependents = #cd939f
color.fg.pluginpanel.details.name.no-dependents = #66ff66
color.fg.pluginpanel.details.name.has.dependents = #cd939f
color.fg.pluginpanel.details.name.no.dependents = #66ff66
color.fg.pluginpanel.details.novalue = #999900
color.fg.pluginpanel.details.title = #cd939f

View file

@ -254,14 +254,14 @@ class PluginDetailsPanel extends AbstractDetailsPanel {
nameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
nameAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
nameAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.name.no-dependents"));
new GColor("color.fg.pluginpanel.details.name.no.dependents"));
depNameAttrSet = new SimpleAttributeSet();
depNameAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
depNameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
depNameAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
depNameAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.name.has-dependents"));
new GColor("color.fg.pluginpanel.details.name.has.dependents"));
descrAttrSet = new SimpleAttributeSet();
descrAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");