From 7c7d98090f6ee957706b7d6f62a0ac454c7aa9e6 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Mon, 22 Aug 2022 19:24:05 -0400 Subject: [PATCH] GP-1981 - Theming - Version Tracking color conversion; Help css color conversion --- .../Base/data/base.listing.theme.properties | 4 +- .../Features/Base/data/base.theme.properties | 10 +-- .../src/main/help/help/shared/Frontpage.css | 2 +- .../main/help/help/topics/DataPlugin/Data.htm | 11 ++- .../core/osgi/BundleStatusTableModel.java | 10 +-- .../help/topics/FunctionID/FunctionID.html | 12 +-- .../VersionTracking/certification.manifest | 1 + .../data/version.tracking.theme.properties | 65 ++++++++++++++ .../VTDualListingHighlightProvider.java | 90 +++++++++++-------- .../filters/AbstractAddressRangeFilter.java | 11 ++- .../gui/filters/FilterFormattedTextField.java | 33 ++++--- .../VTFunctionAssociationProvider.java | 5 +- .../markuptable/MarkupItemValueRenderer.java | 9 +- .../markuptable/VTMarkupItemsTableModel.java | 16 +++- .../matchtable/MatchMarkupStatusRenderer.java | 32 +++++-- .../matchtable/MatchTableRenderer.java | 4 +- .../matchtable/VTMarkupStatusIcon.java | 43 +++++---- .../VTMatchOneToManyTableProvider.java | 4 +- .../relatedMatches/RelatedMatchRenderer.java | 13 ++- .../gui/util/AbstractVTMatchTableModel.java | 15 ++-- .../feature/vt/gui/util/VTSymbolRenderer.java | 3 +- .../Docking/data/docking.theme.properties | 26 +++++- .../java/docking/help/GHelpHTMLEditorKit.java | 68 ++++++++++++-- .../Graph/data/graph.theme.properties | 6 ++ .../vertex/AbstractVisualVertexRenderer.java | 16 +++- 25 files changed, 367 insertions(+), 142 deletions(-) create mode 100644 Ghidra/Features/VersionTracking/data/version.tracking.theme.properties diff --git a/Ghidra/Features/Base/data/base.listing.theme.properties b/Ghidra/Features/Base/data/base.listing.theme.properties index 448ee4895e..991405471f 100644 --- a/Ghidra/Features/Base/data/base.listing.theme.properties +++ b/Ghidra/Features/Base/data/base.listing.theme.properties @@ -24,7 +24,7 @@ color.cursor.unfocused.listing = color.cursor.unfocused 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.constant = green color.fg.listing.label.unreferenced = black color.fg.listing.entrypoint = magenta color.fg.listing.comment.auto = lightGray @@ -43,7 +43,7 @@ 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.function.param.dynamic = #006666 color.fg.listing.label.local = green color.fg.listing.label.non-primary = olive color.fg.listing.label.primary = darkBlue diff --git a/Ghidra/Features/Base/data/base.theme.properties b/Ghidra/Features/Base/data/base.theme.properties index c56e8053dc..2375c4aed2 100644 --- a/Ghidra/Features/Base/data/base.theme.properties +++ b/Ghidra/Features/Base/data/base.theme.properties @@ -6,10 +6,9 @@ color.flowtype.fall-through = red color.flowtype.jump.conditional = #007C00 // dark green color.flowtype.jump.unconditional = blue -color.bg.table.selection.bundle = lightSkyBlue -color.fg.table.selection.bundle = black +color.bg.table.selection.bundle = [color]textHighlight +color.fg.table.selection.bundle = [color]textHighlightText color.fg.table.bundle.disabled = darkGray -color.fg.table.bundle.error = red color.fg.table.bundle.busy = gray color.fg.table.bundle.inactive = black color.fg.table.bundle.active = green @@ -55,10 +54,9 @@ color.flowtype.jump.conditional = rgb(95, 129, 157) color.flowtype.jump.unconditional = rgb(140, 148, 64) -color.bg.table.selection.bundle = darkBlue -color.fg.table.selection.bundle = gray +color.bg.table.selection.bundle = [color]textHighlight +color.fg.table.selection.bundle = [color]textHighlightText color.fg.table.bundle.disabled = lightGray -color.fg.table.bundle.error = indianRed color.fg.table.bundle.busy = gray color.fg.table.bundle.inactive = lightGray color.fg.table.bundle.active = limeGreen diff --git a/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm b/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm index 103809ad82..4319372e67 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm @@ -23,7 +23,7 @@

Data Types

-

Data is created by applying Data Types to bytes in +

Data is created by applying Data Types to bytes in memory.  Data Types interpret bytes as values and provide a visual interpretation of those bytes based on the Data Type used, e.g., a four byte IEEE floating point number or a two byte little endian @@ -583,7 +583,7 @@

 Regardless of how a data type is applied, data is only created if the data type will fit within the available undefined bytes.  

-

Drag from Data Type Manager

+

Drag from Data Type Manager

Use the

Cycle Groups

+ "Cycle__float_double"> Cycle Groups

Cycle Groups are an easy way to apply basic data types (byte, word, float, @@ -679,7 +678,7 @@

-

Favorites

+

Favorites

A Favorite data type is a data type that you use frequently and want to apply @@ -703,7 +702,7 @@ Shortcut.  Key Bindings allow you to assign "hot keys" to any menu item.

-

Recently Used Data Type

+

Recently Used Data Type

The last applied data type is always available at the bottom of the data menu.  By diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java index df11cafa29..d30d509af6 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java @@ -15,9 +15,9 @@ */ package ghidra.app.plugin.core.osgi; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; import java.util.*; -import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -45,7 +45,7 @@ public class BundleStatusTableModel extends GDynamicColumnTableModel> { //@formatter:off - private static final Color COLOR_BUNDLE_ERROR = new GColor("color.fg.table.bundle.error"); + private static final Color COLOR_BUNDLE_ERROR = new GColor("color.fg.error"); private static final Color COLOR_BUNDLE_DISABLED = new GColor("color.fg.table.bundle.disabled"); private static final Color COLOR_BUNDLE_BUSY = new GColor("color.fg.table.bundle.busy"); private static final Color COLOR_BUNDLE_INACTIVE = new GColor("color.fg.table.bundle.inactive"); @@ -150,8 +150,6 @@ public class BundleStatusTableModel }); } - /***************************************************/ - @Override public boolean isCellEditable(int rowIndex, int columnIndex) { BundleStatus status = statuses.get(rowIndex); @@ -557,7 +555,6 @@ public class BundleStatusTableModel BundleStatus status = (BundleStatus) data.getRowObject(); ResourceFile file = (ResourceFile) data.getValue(); JLabel label = (JLabel) super.getTableCellRendererComponent(data); - label.setFont(defaultFont.deriveFont(defaultFont.getStyle() | Font.BOLD)); label.setText(Path.toPathString(file)); GhidraBundle bundle = bundleHost.getGhidraBundle(file); if (bundle == null || bundle instanceof GhidraPlaceholderBundle || !file.exists()) { @@ -577,6 +574,7 @@ public class BundleStatusTableModel label.setForeground(COLOR_BUNDLE_INACTIVE); } } + return label; } diff --git a/Ghidra/Features/FunctionID/src/main/help/help/topics/FunctionID/FunctionID.html b/Ghidra/Features/FunctionID/src/main/help/help/topics/FunctionID/FunctionID.html index 88e321fbcb..353450c658 100644 --- a/Ghidra/Features/FunctionID/src/main/help/help/topics/FunctionID/FunctionID.html +++ b/Ghidra/Features/FunctionID/src/main/help/help/topics/FunctionID/FunctionID.html @@ -13,8 +13,8 @@ Function ID -  - Next +� +�Next @@ -290,14 +290,14 @@ parameter information is stripped. - - + - + - +
  Next +��Next
Function ID Function ID�  Function ID Plug-in�Function ID Plug-in
diff --git a/Ghidra/Features/VersionTracking/certification.manifest b/Ghidra/Features/VersionTracking/certification.manifest index 1c3c497aa1..927370bc2b 100644 --- a/Ghidra/Features/VersionTracking/certification.manifest +++ b/Ghidra/Features/VersionTracking/certification.manifest @@ -5,6 +5,7 @@ ##MODULE IP: Tango Icons - Public Domain Module.manifest||GHIDRA||||END| data/ExtensionPoint.manifest||GHIDRA||reviewed||END| +data/version.tracking.theme.properties||GHIDRA||||END| src/main/docs/VTClasses.png||GHIDRA||reviewed||END| src/main/docs/VTGuiImpl.png||GHIDRA||reviewed||END| src/main/help/help/TOC_Source.xml||GHIDRA||reviewed||END| diff --git a/Ghidra/Features/VersionTracking/data/version.tracking.theme.properties b/Ghidra/Features/VersionTracking/data/version.tracking.theme.properties new file mode 100644 index 0000000000..34498dbfaa --- /dev/null +++ b/Ghidra/Features/VersionTracking/data/version.tracking.theme.properties @@ -0,0 +1,65 @@ +[Defaults] + +color.fg.version.tracking.tooltip = gray + +color.bg.version.tracking.dual.listing.highlight.markup.applied = rgb(150, 220, 150) // green +color.bg.version.tracking.dual.listing.highlight.markup.unapplied = rgb(255, 170, 85) // orange +color.bg.version.tracking.dual.listing.highlight.markup.ignored = gainsboro // gray +color.bg.version.tracking.dual.listing.highlight.markup.rejected = rgb(250, 200, 200) // pink +color.bg.version.tracking.dual.listing.highlight.markup.failed = rgb(255, 80, 80) // red +color.bg.version.tracking.dual.listing.highlight.markup.no.address = rgb(205, 185, 220) // purple +color.bg.version.tracking.dual.listing.highlight.markup.same = rgb(175, 225, 255) // light blue +color.bg.version.tracking.dual.listing.highlight.markup.conflict = rgb(255, 225, 105) // gold + +color.bg.version.tracking.filter.formatted.field.error = rgb(218, 217, 206) // grayish +color.bg.version.tracking.filter.formatted.field.editing = rgb(243, 242, 131) // yellowish + +color.bg.version.tracking.match.table.locked.out = whitesmoke +color.bg.version.tracking.match.table.markup.status.applied = rgb(0, 180, 0) // green +color.bg.version.tracking.match.table.markup.status.rejected = red +color.bg.version.tracking.match.table.markup.status.dont.care = royalblue +color.bg.version.tracking.match.table.markup.status.dont.know = orange +color.bg.version.tracking.match.table.markup.status.tooltip.unexamined = black +color.fg.version.tracking.match.table.error = color.fg.error + +color.fg.version.tracking.markup.items.table.error = color.fg.error +color.fg.version.tracking.markup.items.table.user.defined.address = cyan +color.fg.version.tracking.markup.items.table.user.defined.address.selected = lightseagreen + +color.bg.version.tracking.related.matches.table.good = green +color.bg.version.tracking.related.matches.table.medium = yellow +color.bg.version.tracking.related.matches.table.bad = red + +color.fg.version.tracking.function.match.local.info = green + +[Dark Defaults] + + +color.bg.version.tracking.dual.listing.highlight.markup.applied = rgb(150, 220, 150) // green +color.bg.version.tracking.dual.listing.highlight.markup.unapplied = rgb(255, 170, 85) // orange +color.bg.version.tracking.dual.listing.highlight.markup.ignored = rgb(220, 220, 220) // gray +color.bg.version.tracking.dual.listing.highlight.markup.rejected = rgb(250, 200, 200) // pink +color.bg.version.tracking.dual.listing.highlight.markup.failed = rgb(255, 80, 80) // red +color.bg.version.tracking.dual.listing.highlight.markup.no.address = rgb(205, 185, 220) // purple +color.bg.version.tracking.dual.listing.highlight.markup.same = rgb(175, 225, 255) // light blue +color.bg.version.tracking.dual.listing.highlight.markup.conflict = rgb(255, 225, 105) // gold + +color.bg.version.tracking.filter.formatted.field.error = rgb(218, 217, 206) // grayish +color.bg.version.tracking.filter.formatted.field.editing = rgb(243, 242, 131) // yellowish + +color.bg.version.tracking.match.table.locked.out = whitesmoke +color.bg.version.tracking.match.table.markup.status.applied = rgb(0, 180, 0) // green +color.bg.version.tracking.match.table.markup.status.rejected = red +color.bg.version.tracking.match.table.markup.status.dont.care = royalblue +color.bg.version.tracking.match.table.markup.status.dont.know = orange +color.fg.version.tracking.match.table.error = color.fg.error + +color.fg.version.tracking.markup.items.table.error = color.fg.error +color.fg.version.tracking.markup.items.table.user.defined.address = cyan +color.fg.version.tracking.markup.items.table.user.defined.address.selected = lightseagreen + +color.bg.version.tracking.related.matches.table.good = green +color.bg.version.tracking.related.matches.table.medium = yellow +color.bg.version.tracking.related.matches.table.bad = red + +color.fg.version.tracking.function.match.local.info = green \ No newline at end of file diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTDualListingHighlightProvider.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTDualListingHighlightProvider.java index f144b618a1..07a21479b5 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTDualListingHighlightProvider.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTDualListingHighlightProvider.java @@ -15,6 +15,11 @@ */ package ghidra.feature.vt.gui.duallisting; +import java.awt.Color; +import java.util.*; + +import docking.widgets.fieldpanel.support.Highlight; +import generic.theme.GColor; import ghidra.app.plugin.core.codebrowser.ListingHighlightProvider; import ghidra.app.util.HighlightProvider; import ghidra.app.util.viewer.field.*; @@ -32,24 +37,27 @@ import ghidra.program.model.listing.*; import ghidra.util.Msg; import ghidra.util.exception.AssertException; -import java.awt.Color; -import java.util.*; - -import docking.widgets.fieldpanel.support.Highlight; - public class VTDualListingHighlightProvider implements HighlightProvider { - private static Color APPLIED_MARKUP_COLOR = new Color(150, 220, 150); // green - private static Color UNAPPLIED_MARKUP_COLOR = new Color(255, 170, 85); // orange - private static Color IGNORED_MARKUP_COLOR = new Color(220, 220, 220); // gray - private static Color REJECTED_MARKUP_COLOR = new Color(250, 200, 200); // pink - private static Color FAILED_MARKUP_COLOR = new Color(255, 80, 80); // red - private static Color NO_ADDRESS_MARKUP_COLOR = new Color(205, 185, 220); // purple - private static Color SAME_MARKUP_COLOR = new Color(175, 225, 255); // light blue - private static Color CONFLICT_MARKUP_COLOR = new Color(255, 225, 105); // gold + private static Color APPLIED_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.applied"); + private static Color UNAPPLIED_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.unapplied"); + private static Color IGNORED_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.ignored"); + private static Color REJECTED_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.rejected"); + private static Color FAILED_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.failed"); + private static Color NO_ADDRESS_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.no.address"); + private static Color SAME_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.same"); + private static Color CONFLICT_MARKUP_COLOR = + new GColor("color.bg.version.tracking.dual.listing.highlight.markup.conflict"); private HashMap> map = - new HashMap>(); + new HashMap<>(); private final VTController controller; private ListingPanel listingPanel; private ListingHighlightProvider listingHighlighter; @@ -112,7 +120,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { HashMap typeMap = map.get(address); if (typeMap == null) { - typeMap = new HashMap(); + typeMap = new HashMap<>(); map.put(address, typeMap); } @@ -203,7 +211,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { cursorTextOffset, highlights); } - List highlightList = new ArrayList(); + List highlightList = new ArrayList<>(); for (Highlight highlight : highlights) { highlightList.add(highlight); @@ -274,7 +282,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { } return highlightColor; } - + /** * Creates a darker shade of the color passed-in, based on the given amount. * @@ -285,22 +293,22 @@ public class VTDualListingHighlightProvider implements HighlightProvider { * * @param color the color to shade * @param amount number between 0..1 (the smaller the number, the darker the shade) - * @return + * @return the new color */ private static Color shade(Color color, double amount) { if (color != null) { - + int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); - + double newR = (r * amount); double newG = (g * amount); double newB = (b * amount); - - return new Color((int)newR, (int)newG, (int)newB); + + return new Color((int) newR, (int) newG, (int) newB); } - + return null; } @@ -315,7 +323,8 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (markupItem != null) { VTMarkupItemStatus status = markupItem.getStatus(); StringStringable value = - (StringStringable) ((isSource || markupItem.canUnapply()) ? markupItem.getSourceValue() + (StringStringable) ((isSource || markupItem.canUnapply()) + ? markupItem.getSourceValue() : markupItem.getOriginalDestinationValue()); String comment = value.getString(); if (comment != null) { @@ -418,7 +427,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { CodeUnit codeUnit = (CodeUnit) obj; address = codeUnit.getMinAddress(); } - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); HashMap typeMap = map.get(address); if (typeMap != null) { VTMarkupItem markupItem = typeMap.get(RepeatableCommentMarkupType.INSTANCE); @@ -429,7 +438,8 @@ public class VTDualListingHighlightProvider implements HighlightProvider { return highlightList.toArray(new Highlight[highlightList.size()]); } - private Highlight[] getFunctionSignatureHighlights(String text, Object obj, int cursorTextOffset) { + private Highlight[] getFunctionSignatureHighlights(String text, Object obj, + int cursorTextOffset) { Function function = null; if (obj instanceof Function) { function = (Function) obj; @@ -445,7 +455,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { Address address = function.getEntryPoint(); HashMap typeMap = map.get(address); if (typeMap != null) { - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); // // Check if the text is in the Return Type // addFunctionHighlight(FunctionReturnTypeMarkupType.INSTANCE, text, cursorTextOffset, @@ -485,7 +495,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { Address address = function.getEntryPoint(); HashMap typeMap = map.get(address); if (typeMap != null) { - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); VTMarkupItem markupItem = typeMap.get(FunctionSignatureMarkupType.INSTANCE); if (markupItem == null) { @@ -544,7 +554,8 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (startIndex >= 0) { int endIndex = startIndex + displayString.length() - 1; Color highlightColor = - getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, endIndex); + getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, + endIndex); Highlight highlight = new Highlight(startIndex, endIndex, highlightColor); highlightList.add(highlight); } @@ -557,7 +568,8 @@ public class VTDualListingHighlightProvider implements HighlightProvider { VTMarkupItem markupItem = typeMap.get(FunctionNameMarkupType.INSTANCE); if (markupItem != null) { FunctionNameStringable value = - (isSource || markupItem.canUnapply()) ? (FunctionNameStringable) markupItem.getSourceValue() + (isSource || markupItem.canUnapply()) + ? (FunctionNameStringable) markupItem.getSourceValue() : (FunctionNameStringable) markupItem.getOriginalDestinationValue(); if (value != null) { int parameterStart = text.indexOf("("); @@ -569,7 +581,8 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (startIndex >= 0) { int endIndex = startIndex + name.length() - 1; Color highlightColor = - getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, endIndex); + getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, + endIndex); Highlight highlight = new Highlight(startIndex, endIndex, highlightColor); highlightList.add(highlight); } @@ -832,7 +845,7 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (storageAddress == null) { return new Highlight[0]; } - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); HashMap typeMap = map.get(storageAddress); if (typeMap != null) { VTMarkupItem markupItem = typeMap.get(markupType); @@ -914,16 +927,18 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (typeMap != null) { VTMarkupItem markupItem = typeMap.get(LabelMarkupType.INSTANCE); if (markupItem != null) { - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); MultipleSymbolStringable value = - (MultipleSymbolStringable) ((isSource || markupItem.canUnapply()) ? markupItem.getSourceValue() + (MultipleSymbolStringable) ((isSource || markupItem.canUnapply()) + ? markupItem.getSourceValue() : markupItem.getOriginalDestinationValue()); if (value != null) { // Highlight the entire labels field. int startIndex = 0; int endIndex = text.length() - 1; Color highlightColor = - getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, endIndex); + getMarkupBackgroundColor(cursorTextOffset, markupItem, startIndex, + endIndex); Highlight highlight = new Highlight(startIndex, endIndex, highlightColor); highlightList.add(highlight); return highlightList.toArray(new Highlight[highlightList.size()]); @@ -942,9 +957,10 @@ public class VTDualListingHighlightProvider implements HighlightProvider { if (typeMap != null) { VTMarkupItem markupItem = typeMap.get(DataTypeMarkupType.INSTANCE); if (markupItem != null) { - ArrayList highlightList = new ArrayList(); + ArrayList highlightList = new ArrayList<>(); DataTypeStringable value = - (DataTypeStringable) ((isSource || markupItem.canUnapply()) ? markupItem.getSourceValue() + (DataTypeStringable) ((isSource || markupItem.canUnapply()) + ? markupItem.getSourceValue() : markupItem.getOriginalDestinationValue()); if (value != null) { Program sourceProgram = diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java index 5474428836..bef870e6d2 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java @@ -30,11 +30,13 @@ import docking.widgets.combobox.GhidraComboBox; import docking.widgets.label.GDLabel; import docking.widgets.label.GHtmlLabel; import docking.widgets.textfield.HexIntegerFormatter; +import generic.theme.GColor; import ghidra.feature.vt.api.main.VTAssociation; import ghidra.feature.vt.gui.provider.matchtable.NumberRangeProducer; import ghidra.feature.vt.gui.provider.matchtable.NumberRangeSubFilterChecker; import ghidra.framework.options.SaveState; import ghidra.program.model.address.Address; +import ghidra.util.WebColors; public abstract class AbstractAddressRangeFilter extends AncillaryFilter implements NumberRangeSubFilterChecker, NumberRangeProducer { @@ -46,6 +48,8 @@ public abstract class AbstractAddressRangeFilter extends AncillaryFilter private static final String UPPER_RANGE_SELECTED_VALUE_KEY = "upper.range.selected.value.key"; private static final String IS_ENABLED_VALUE_KEY = "is.enabled.value.key"; + private static final Color FG_TOOLTIP_DEFAULT = new GColor("color.fg.version.tracking.tooltip"); + private static final Integer BASE_COMPONENT_LAYER = 1; private static final Integer HOVER_COMPONENT_LAYER = 2; private static final Integer DISABLED_COMPONENT_LAYER = 3; @@ -118,8 +122,10 @@ public abstract class AbstractAddressRangeFilter extends AncillaryFilter // // Lower Score Panel // + String fgColor = WebColors.toString(FG_TOOLTIP_DEFAULT, false); lowerRangePanel = new JPanel(new GridLayout(2, 1)); - JLabel lowLabel = new GHtmlLabel("low"); + JLabel lowLabel = + new GHtmlLabel("low"); lowLabel.setHorizontalAlignment(SwingConstants.CENTER); lowLabel.setVerticalAlignment(SwingConstants.BOTTOM); lowerRangePanel.add(lowLabel); @@ -138,7 +144,8 @@ public abstract class AbstractAddressRangeFilter extends AncillaryFilter // Upper Score Panel // upperRangePanel = new JPanel(new GridLayout(2, 1)); - JLabel upperLabel = new GHtmlLabel("high"); + JLabel upperLabel = + new GHtmlLabel("high"); upperLabel.setHorizontalAlignment(SwingConstants.CENTER); upperLabel.setVerticalAlignment(SwingConstants.BOTTOM); upperRangePanel.add(upperLabel); diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/FilterFormattedTextField.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/FilterFormattedTextField.java index bdcf2965dd..499bf810bd 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/FilterFormattedTextField.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/FilterFormattedTextField.java @@ -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. @@ -16,15 +15,10 @@ */ package ghidra.feature.vt.gui.filters; -import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.APPLIED; -import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.NONE; -import ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus; -import ghidra.util.SystemUtilities; +import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.*; import java.awt.Color; import java.awt.event.FocusEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.text.ParseException; import java.util.HashSet; import java.util.Set; @@ -33,12 +27,18 @@ import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -public class FilterFormattedTextField extends JFormattedTextField { - private static final Color ERROR_BACKGROUND_COLOR = new Color(218, 217, 206); - private static final String TEXT_FIELD_BACKGROUND_COLOR_KEY = "TextField.background"; - protected static final Color EDITING_BACKGROUND_COLOR = new Color(243, 242, 131); +import generic.theme.GColor; +import ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus; +import ghidra.util.SystemUtilities; - private Set listeners = new HashSet(); +public class FilterFormattedTextField extends JFormattedTextField { + private static final Color ERROR_BACKGROUND_COLOR = + new GColor("color.bg.version.tracking.filter.formatted.field.error"); + protected static final Color EDITING_BACKGROUND_COLOR = + new GColor("color.bg.version.tracking.filter.formatted.field.editing"); + private static final String TEXT_FIELD_BACKGROUND_COLOR_KEY = "TextField.background"; + + private Set listeners = new HashSet<>(); private FilterEditingStatus currentStatus = NONE; private final Object defaultValue; @@ -57,24 +57,23 @@ public class FilterFormattedTextField extends JFormattedTextField { this.currentStatus = NONE; getDocument().addDocumentListener(new DocumentListener() { + @Override public void removeUpdate(DocumentEvent e) { updateText(); } + @Override public void insertUpdate(DocumentEvent e) { updateText(); } + @Override public void changedUpdate(DocumentEvent e) { updateText(); } }); - addPropertyChangeListener("value", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - editingFinished(); - } - }); + addPropertyChangeListener("value", evt -> editingFinished()); } public void disableFocusEventProcessing() { diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationProvider.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationProvider.java index a05c432e0f..ea7324cd92 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationProvider.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationProvider.java @@ -37,6 +37,7 @@ import docking.widgets.EventTrigger; import docking.widgets.fieldpanel.FieldPanel; import docking.widgets.label.GDLabel; import docking.widgets.table.threaded.ThreadedTableModel; +import generic.theme.GColor; import ghidra.app.plugin.core.functioncompare.FunctionComparisonPanel; import ghidra.app.services.GoToService; import ghidra.app.util.viewer.listingpanel.ListingCodeComparisonPanel; @@ -79,6 +80,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter ResourceManager.loadImage("images/application_tile_horizontal.png"); private static final String SHOW_COMPARE_ACTION_GROUP = "A9_ShowCompare"; // "A9_" forces to right of other dual view actions in toolbar. + private static final Color FG_ERROR = new GColor("color.fg.error"); + private GhidraTable sourceFunctionsTable; private GhidraTable destinationFunctionsTable; private VTFunctionAssociationTableModel sourceFunctionsModel; @@ -358,7 +361,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter JPanel statusPanel = new JPanel(new BorderLayout()); statusLabel = new GDLabel(NO_ERROR_MESSAGE); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); - statusLabel.setForeground(Color.RED.darker()); + statusLabel.setForeground(FG_ERROR); statusLabel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/MarkupItemValueRenderer.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/MarkupItemValueRenderer.java index 6767682d12..0e73f988e1 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/MarkupItemValueRenderer.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/MarkupItemValueRenderer.java @@ -15,7 +15,6 @@ */ package ghidra.feature.vt.gui.provider.markuptable; -import java.awt.Color; import java.awt.Component; import org.apache.commons.lang3.StringUtils; @@ -93,9 +92,11 @@ public class MarkupItemValueRenderer extends AbstractGhidraColumnRenderer> allFilters = new ArrayList<>(); private final VTController controller; @@ -336,7 +344,7 @@ public class VTMarkupItemsTableModel extends AddressBasedTableModel { + private static final Color FG_TOOLTIP_DEFAULT = new GColor("color.fg.version.tracking.tooltip"); + private static final Color FG_TOOLTIP_UNEXAMINED = + new GColor("color.bg.version.tracking.match.table.markup.status.tooltip.unexamined"); + private static ImageIcon DISABLED_ICON = ResourceManager.getDisabledIcon(ResourceManager.loadImage("images/ledgreen.png"), 50); + private static ImageIcon DISABLED_ICON_SMALL = + ResourceManager.getDisabledIcon(ResourceManager.loadImage("images/ledgreen.png", 8, 8), 50); + private static final ImageIcon APPLIED_BASE_ICON = ResourceManager.loadImage("images/ledgreen.png", 8, 8); private static final ImageIcon REJECTED_BASE_ICON = @@ -53,11 +63,11 @@ public class MatchMarkupStatusRenderer extends AbstractGhidraColumnRenderer"); buf.append(""); buf.append(message).append("
"); icon = DISABLED_ICON; + + icon = ERROR_BASE_ICON; + message = "Has one or more \"Applied\" markup items"; fontColor = "gray"; if (status.hasAppliedMarkup()) { @@ -126,6 +141,9 @@ public class MatchMarkupStatusRenderer extends AbstractGhidraColumnRenderer
"); icon = DISABLED_ICON; + + icon = DISABLED_ICON_SMALL; + message = "Has one or more \"Rejected\" markup items to apply"; fontColor = "gray"; if (status.hasRejectedMarkup()) { diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/MatchTableRenderer.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/MatchTableRenderer.java index 88ba481fd4..9f12a5edd3 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/MatchTableRenderer.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/MatchTableRenderer.java @@ -21,11 +21,13 @@ import java.awt.Component; import javax.swing.JTable; import docking.widgets.table.GTableCellRenderingData; +import generic.theme.GColor; import ghidra.feature.vt.api.main.*; import ghidra.util.table.CompositeGhidraTableCellRenderer; public class MatchTableRenderer extends CompositeGhidraTableCellRenderer { - private static final Color LOCKED_OUT_BACKGROUND_COLOR = new Color(239, 239, 239); + private static final Color LOCKED_OUT_BACKGROUND_COLOR = + new GColor("color.bg.version.tracking.match.table.locked.out"); @Override public Component getTableCellRendererComponent(GTableCellRenderingData data) { diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMarkupStatusIcon.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMarkupStatusIcon.java index 1000c818be..ec9b80fbdd 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMarkupStatusIcon.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMarkupStatusIcon.java @@ -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. @@ -16,15 +15,27 @@ */ package ghidra.feature.vt.gui.provider.matchtable; -import ghidra.feature.vt.api.main.VTAssociationMarkupStatus; - import java.awt.*; import java.util.ArrayList; import java.util.List; import javax.swing.Icon; +import generic.theme.GColor; +import generic.theme.GThemeDefaults.Colors.Java; +import ghidra.feature.vt.api.main.VTAssociationMarkupStatus; + public class VTMarkupStatusIcon implements Icon { + + private static final Color BG_APPLIED = + new GColor("color.bg.version.tracking.match.table.markup.status.applied"); + private static final Color BG_REJECTED = + new GColor("color.bg.version.tracking.match.table.markup.status.rejected"); + private static final Color BG_DONT_CARE = + new GColor("color.bg.version.tracking.match.table.markup.status.dont.care"); + private static final Color BG_DONT_KNOW = + new GColor("color.bg.version.tracking.match.table.markup.status.dont.know"); + private int BORDER = 2; private int WIDTH = 44; private int KNOB_WIDTH = 4; @@ -63,7 +74,7 @@ public class VTMarkupStatusIcon implements Icon { drawBar(g, x + startX + BORDER + 1, y + BORDER + 1, width, colors.get(i)); } - g.setColor(Color.BLACK); + g.setColor(Java.BORDER); g.drawRect(x, y, WIDTH, HEIGHT); // g.drawRect(x, y, WIDTH / 2, HEIGHT); g.drawRect(x + WIDTH, y + HEIGHT / 2 - 3, KNOB_WIDTH, 6); @@ -75,22 +86,20 @@ public class VTMarkupStatusIcon implements Icon { g.fillRect(x, y, width, HEIGHT - 2 * BORDER - 1); } - private List getColors(VTAssociationMarkupStatus status) { - Color ORANGE = new Color(255, 150, 0); - Color GREEN = new Color(0, 180, 0); - Color BLUE = new Color(80, 80, 240); - List list = new ArrayList(4); - if (status.hasRejectedMarkup()) { - list.add(Color.RED); + private List getColors(VTAssociationMarkupStatus markupStatus) { + + List list = new ArrayList<>(4); + if (markupStatus.hasRejectedMarkup()) { + list.add(BG_REJECTED); } - if (status.hasAppliedMarkup() || status.isFullyApplied()) { - list.add(GREEN); + if (markupStatus.hasAppliedMarkup() || markupStatus.isFullyApplied()) { + list.add(BG_APPLIED); } - if (status.hasDontCareMarkup()) { - list.add(BLUE); + if (markupStatus.hasDontCareMarkup()) { + list.add(BG_DONT_CARE); } - if (status.hasDontKnowMarkup()) { - list.add(ORANGE); + if (markupStatus.hasDontKnowMarkup()) { + list.add(BG_DONT_KNOW); } return list; } diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyTableProvider.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyTableProvider.java index 754c333c5e..bb26dee74a 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyTableProvider.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyTableProvider.java @@ -30,6 +30,7 @@ import docking.widgets.label.GDLabel; import docking.widgets.table.GTable; import docking.widgets.table.RowObjectTableModel; import docking.widgets.table.threaded.ThreadedTableModel; +import generic.theme.GColor; import ghidra.feature.vt.api.impl.VTChangeManager; import ghidra.feature.vt.api.main.*; import ghidra.feature.vt.gui.actions.*; @@ -66,7 +67,8 @@ public abstract class VTMatchOneToManyTableProvider extends ComponentProviderAda private static final String TITLE_PREFIX = "Version Tracking Matches for "; private static final Icon ICON = ResourceManager.loadImage("images/text_list_bullets.png"); - protected static final Color LOCAL_INFO_FOREGROUND_COLOR = new Color(0, 128, 0); + protected static final Color LOCAL_INFO_FOREGROUND_COLOR = + new GColor("color.fg.version.tracking.function.match.local.info"); private JComponent component; private MatchThreadedTablePanel tablePanel; diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/relatedMatches/RelatedMatchRenderer.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/relatedMatches/RelatedMatchRenderer.java index 458569aab5..949cf80260 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/relatedMatches/RelatedMatchRenderer.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/relatedMatches/RelatedMatchRenderer.java @@ -23,11 +23,20 @@ import javax.swing.*; import docking.widgets.label.GIconLabel; import docking.widgets.table.GTableCellRenderingData; +import generic.theme.GColor; import ghidra.feature.vt.api.main.VTAssociationStatus; import ghidra.util.table.GhidraTableCellRenderer; import resources.ResourceManager; public class RelatedMatchRenderer extends GhidraTableCellRenderer { + + private static final Color GOOD = + new GColor("color.bg.version.tracking.related.matches.table.good"); + private static final Color MEDIUM = + new GColor("color.bg.version.tracking.related.matches.table.medium"); + private static final Color BAD = + new GColor("color.bg.version.tracking.related.matches.table.bad"); + static Map sourceMap; static Map destinationMap; static Map statusMap; @@ -99,10 +108,6 @@ public class RelatedMatchRenderer extends GhidraTableCellRenderer { return renderer; } - private static final Color GOOD = Color.green; - private static final Color MEDIUM = Color.yellow; - private static final Color BAD = Color.red; - private Color findBackgroundColor(VTRelatedMatchType value) { double goodness = value.getGoodness() / 100.0; double badness = 1.0 - goodness; diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/util/AbstractVTMatchTableModel.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/util/AbstractVTMatchTableModel.java index adb8b489a7..ee43ba8ad0 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/util/AbstractVTMatchTableModel.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/util/AbstractVTMatchTableModel.java @@ -27,6 +27,7 @@ import javax.swing.JLabel; import docking.widgets.table.GTableCellRenderingData; import docking.widgets.table.TableFilter; +import generic.theme.GColor; import ghidra.app.util.SymbolInspector; import ghidra.docking.settings.Settings; import ghidra.feature.vt.api.impl.VTProgramCorrelatorInfo; @@ -56,6 +57,8 @@ public abstract class AbstractVTMatchTableModel extends AddressBasedTableModel markupStatusColumnComparator = new MarkupStatusColumnComparator(); protected VTSession session; + private static final Color FG_ERROR = new GColor("color.fg.version.tracking.match.table.error"); + private Set> allFilters = new HashSet<>(); protected final VTController controller; @@ -589,7 +592,7 @@ public abstract class AbstractVTMatchTableModel extends AddressBasedTableModel * This class is currently installed by the {@link GHelpSet}. * @@ -60,6 +61,25 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { private static final String HELP_WINDOW_ZOOM_FACTOR = "HELP.WINDOW.FONT.SIZE.MODIFIER"; private static int fontSizeModifier; + /** + * A mapping of known style sheet colors to convert from the values in the style sheet to colors + * defined in the system theme. + */ + private static final Map colorsById = new HashMap<>(); + static { + colorsById.put("h1", new GColor("color.fg.help.selector.h1")); + colorsById.put("h2", new GColor("color.fg.help.selector.h2")); + colorsById.put("h3", new GColor("color.fg.help.selector.h3")); + colorsById.put("p.providedbyplugin", + new GColor("color.fg.help.selector.p.provided.by.plugin")); + colorsById.put("p.relatedtopic", + new GColor("color.fg.help.selector.p.related.topic")); + colorsById.put("th", new GColor("color.fg.help.selector.th")); + colorsById.put("code", new GColor("color.fg.help.selector.code")); + colorsById.put("code.path", new GColor("color.fg.help.selector.code.path")); + } + private static final Pattern COLOR_PATTERN = Pattern.compile("(color:\\s*#{0,1}\\w+;)"); + private HyperlinkListener[] delegateListeners = null; private HyperlinkListener resolverHyperlinkListener; @@ -276,11 +296,19 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { return null; } - StringBuffer buffy = new StringBuffer(); + StringBuilder buffy = new StringBuilder(); try { List lines = FileUtilities.getLines(url); for (String line : lines) { - changePixels(line, fontSizeModifier, buffy); + + StringBuilder lineBuilder = new StringBuilder(); + changePixels(line, fontSizeModifier, lineBuilder); + + String updatedLine = lineBuilder.toString(); + lineBuilder.delete(0, lineBuilder.length()); + changeColor(updatedLine, lineBuilder); + + buffy.append(lineBuilder.toString()); buffy.append('\n'); } } @@ -293,7 +321,31 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { return reader; } - private void changePixels(String line, int amount, StringBuffer buffy) { + private void changeColor(String line, StringBuilder buffy) { + + int blockStart = line.indexOf("{"); + if (blockStart == -1) { + buffy.append(line); + return; + } + + String cssSelector = line.substring(0, blockStart).trim(); + cssSelector = cssSelector.toLowerCase(); // normalize + GColor gColor = colorsById.get(cssSelector); + if (gColor == null) { + buffy.append(line); + return; + } + + Matcher matcher = COLOR_PATTERN.matcher(line); + if (matcher.find()) { + matcher.appendReplacement(buffy, "color: " + gColor.toHexString() + ";"); + } + + matcher.appendTail(buffy); + } + + private void changePixels(String line, int amount, StringBuilder buffy) { Matcher matcher = FONT_SIZE_PATTERN.matcher(line); while (matcher.find()) { diff --git a/Ghidra/Framework/Graph/data/graph.theme.properties b/Ghidra/Framework/Graph/data/graph.theme.properties index 6c5d57f8a9..1fd525d29c 100644 --- a/Ghidra/Framework/Graph/data/graph.theme.properties +++ b/Ghidra/Framework/Graph/data/graph.theme.properties @@ -6,6 +6,9 @@ color.bg.visualgraph.satellite = lightgray color.bg.highlight.visualgraph = rgba(255,255,0,155) // somewhat transparent yellow color.bg.visualgraph.message = rgb(138, 185, 241) // jordy blue +color.bg.visualgraph.drop.shadow.dark = black +color.bg.visualgraph.drop.shadow.light = gray + color.bg.visualgraph.satellite.vertex = color.palette.material.secondary.variant color.fg.visualgraph.message = color.palette.black @@ -39,6 +42,9 @@ color.bg.highlight.visualgraph = rgba(120,120,120,155) // light gray with dark b color.bg.visualgraph.message = rgb(65, 146, 242) // dark blue close to jordy blue color.fg.visualgraph.message = color.palette.lightgray +color.bg.visualgraph.drop.shadow.dark = black +color.bg.visualgraph.drop.shadow.light = gray + color.bg.visualgraph.satellite.vertex = color.palette.material.secondary.variant color.bg.visualgraph.dockingvertex = color.palette.material.secondary.variant diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/vertex/AbstractVisualVertexRenderer.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/vertex/AbstractVisualVertexRenderer.java index 62f8685877..bf88e0ee8b 100644 --- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/vertex/AbstractVisualVertexRenderer.java +++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/vertex/AbstractVisualVertexRenderer.java @@ -30,7 +30,6 @@ import edu.uci.ics.jung.visualization.transform.MutableTransformer; import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; import edu.uci.ics.jung.visualization.transform.shape.GraphicsDecorator; import generic.theme.GColor; -import generic.theme.GThemeDefaults.Colors.Palette; import ghidra.graph.viewer.VisualEdge; import ghidra.graph.viewer.VisualVertex; @@ -44,6 +43,10 @@ public class AbstractVisualVertexRenderer { private static final Color HIGHLIGHT_COLOR = new GColor("color.bg.highlight.visualgraph"); + private static final Color DROP_SHADOW_DARK = + new GColor("color.bg.visualgraph.drop.shadow.dark"); + private static final Color DROP_SHADOW_LIGHT = + new GColor("color.bg.visualgraph.drop.shadow.light"); private Function vertexFillPaintTransformer; @@ -146,14 +149,21 @@ public class AbstractVisualVertexRenderer