mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-2910 - Fixed missing theme definitions; removed unused theme
definitions; fixed module theme dependencies
This commit is contained in:
parent
1a99e2518d
commit
63d6063fa0
31 changed files with 178 additions and 139 deletions
|
@ -4,6 +4,7 @@
|
|||
##MODULE IP: Oxygen Icons - LGPL 3.0
|
||||
Module.manifest||GHIDRA||||END|
|
||||
build.files/buildLocalHelp.xml||GHIDRA||||END|
|
||||
data/help.theme.properties||GHIDRA||||END|
|
||||
src/main/resources/help/shared/arrow.gif||GHIDRA||||END|
|
||||
src/main/resources/help/shared/close16.gif||GHIDRA||||END|
|
||||
src/main/resources/help/shared/note.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
|
|
27
Ghidra/Framework/Help/data/help.theme.properties
Normal file
27
Ghidra/Framework/Help/data/help.theme.properties
Normal file
|
@ -0,0 +1,27 @@
|
|||
[Defaults]
|
||||
|
||||
|
||||
color.bg.help.hint = rgba(100, 100, 255, 100)
|
||||
color.fg.help.selector.h1 = #000080
|
||||
color.fg.help.selector.h2 = #984C4C
|
||||
color.fg.help.selector.h3 = #0000FF
|
||||
color.fg.help.selector.p.provided.by.plugin = #7F7F7F
|
||||
color.fg.help.selector.p.related.topic = #800080
|
||||
color.fg.help.selector.th = #EDF3FE
|
||||
color.fg.help.selector.code = black
|
||||
color.fg.help.selector.code.path = #4682B4
|
||||
|
||||
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
||||
|
||||
color.fg.help.selector.h1 = #66AAF4
|
||||
color.fg.help.selector.h2 = #9999F9
|
||||
color.fg.help.selector.h3 = #FF99CC
|
||||
color.fg.help.selector.p.provided.by.plugin = #CCCCCC
|
||||
color.fg.help.selector.p.related.topic = #800080
|
||||
color.fg.help.selector.th = #EDF3FE
|
||||
color.fg.help.selector.code = gray
|
||||
color.fg.help.selector.code.path = #5BA5E3
|
|
@ -21,8 +21,8 @@ import java.beans.PropertyChangeEvent;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -34,8 +34,7 @@ import javax.swing.text.html.*;
|
|||
import javax.swing.text.html.HTML.Tag;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.theme.GIcon;
|
||||
import generic.theme.Gui;
|
||||
import generic.theme.*;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -63,6 +62,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<String, GColor> 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;
|
||||
|
||||
|
@ -279,11 +297,19 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit {
|
|||
return null;
|
||||
}
|
||||
|
||||
StringBuffer buffy = new StringBuffer();
|
||||
StringBuilder buffy = new StringBuilder();
|
||||
try {
|
||||
List<String> 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');
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +322,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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue