mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 04:05:23 +08:00
GP-1 Fixed a few minor issues with new theming code
This commit is contained in:
@@ -16,6 +16,7 @@ data/ElfFunctionsThatDoNotReturn||GHIDRA||||END|
|
|||||||
data/ExtensionPoint.manifest||GHIDRA||||END|
|
data/ExtensionPoint.manifest||GHIDRA||||END|
|
||||||
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||||
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||||
|
data/base.file.extensions.icons.theme.properties||GHIDRA||||END|
|
||||||
data/base.icons.theme.properties||GHIDRA||||END|
|
data/base.icons.theme.properties||GHIDRA||||END|
|
||||||
data/base.listing.theme.properties||GHIDRA||||END|
|
data/base.listing.theme.properties||GHIDRA||||END|
|
||||||
data/base.programgraph.theme.properties||GHIDRA||||END|
|
data/base.programgraph.theme.properties||GHIDRA||||END|
|
||||||
@@ -80,7 +81,6 @@ data/symbols/win64/mfc80u.exports||GHIDRA||||END|
|
|||||||
data/symbols/win64/mfc90.exports||GHIDRA||||END|
|
data/symbols/win64/mfc90.exports||GHIDRA||||END|
|
||||||
data/symbols/win64/mfc90u.exports||GHIDRA||||END|
|
data/symbols/win64/mfc90u.exports||GHIDRA||||END|
|
||||||
data/symbols/win64/msvcrt.hints||GHIDRA||||END|
|
data/symbols/win64/msvcrt.hints||GHIDRA||||END|
|
||||||
data/typeinfo/base.file.extensions.icons.theme.properties||GHIDRA||||END|
|
|
||||||
data/typeinfo/generic/generic_clib.gdt||GHIDRA||||END|
|
data/typeinfo/generic/generic_clib.gdt||GHIDRA||||END|
|
||||||
data/typeinfo/generic/generic_clib_64.gdt||GHIDRA||||END|
|
data/typeinfo/generic/generic_clib_64.gdt||GHIDRA||||END|
|
||||||
data/typeinfo/mac_10.9/mac_osx.gdt||GHIDRA||||END|
|
data/typeinfo/mac_10.9/mac_osx.gdt||GHIDRA||||END|
|
||||||
|
|||||||
@@ -108,10 +108,7 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent e) {
|
public ActionContext getActionContext(MouseEvent e) {
|
||||||
if (e == null) {
|
if (e != null && e.getSource() == table) {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (e.getSource() == table) {
|
|
||||||
FontValue currentValue = filterTable.getSelectedRowObject();
|
FontValue currentValue = filterTable.getSelectedRowObject();
|
||||||
if (currentValue == null) {
|
if (currentValue == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent e) {
|
public ActionContext getActionContext(MouseEvent e) {
|
||||||
if (e.getSource() == table) {
|
if (e != null && e.getSource() == table) {
|
||||||
IconValue currentValue = filterTable.getSelectedRowObject();
|
IconValue currentValue = filterTable.getSelectedRowObject();
|
||||||
if (currentValue == null) {
|
if (currentValue == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -215,6 +215,9 @@ public class ThemeUtils {
|
|||||||
private static boolean saveCurrentValues(ThemeManager themeManager, String themeName) {
|
private static boolean saveCurrentValues(ThemeManager themeManager, String themeName) {
|
||||||
GTheme activeTheme = themeManager.getActiveTheme();
|
GTheme activeTheme = themeManager.getActiveTheme();
|
||||||
File file = getSaveFile(themeName);
|
File file = getSaveFile(themeName);
|
||||||
|
if (!file.exists()) {
|
||||||
|
Msg.info(ThemeUtils.class, "Saving theme to " + file);
|
||||||
|
}
|
||||||
|
|
||||||
GTheme newTheme = new GTheme(file, themeName, activeTheme.getLookAndFeelType(),
|
GTheme newTheme = new GTheme(file, themeName, activeTheme.getLookAndFeelType(),
|
||||||
activeTheme.useDarkDefaults());
|
activeTheme.useDarkDefaults());
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class ThemeFileLoader {
|
|||||||
Application.findFilesByExtensionInApplication(".theme.properties");
|
Application.findFilesByExtensionInApplication(".theme.properties");
|
||||||
|
|
||||||
for (ResourceFile resourceFile : themeDefaultFiles) {
|
for (ResourceFile resourceFile : themeDefaultFiles) {
|
||||||
Msg.debug(this, "found theme file: " + resourceFile.getAbsolutePath());
|
|
||||||
try {
|
try {
|
||||||
ThemePropertyFileReader reader = new ThemePropertyFileReader(resourceFile);
|
ThemePropertyFileReader reader = new ThemePropertyFileReader(resourceFile);
|
||||||
defaults.load(reader.getDefaultValues());
|
defaults.load(reader.getDefaultValues());
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public abstract class ThemeValue<T> implements Comparable<ThemeValue<T>> {
|
|||||||
// loop resolving indirect references
|
// loop resolving indirect references
|
||||||
while (referred != null) {
|
while (referred != null) {
|
||||||
if (referred.value != null) {
|
if (referred.value != null) {
|
||||||
return referred.value;
|
return referred.get(values);
|
||||||
}
|
}
|
||||||
visitedKeys.add(referred.id);
|
visitedKeys.add(referred.id);
|
||||||
if (visitedKeys.contains(referred.referenceId)) {
|
if (visitedKeys.contains(referred.referenceId)) {
|
||||||
|
|||||||
@@ -123,6 +123,30 @@ public class IconValueTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseWithOverlays() throws ParseException {
|
public void testParseWithOverlays() throws ParseException {
|
||||||
|
IconValue value = IconValue.parse("icon.foo", "EMPTY_ICON{Plus2.png}");
|
||||||
|
values.addIcon(value);
|
||||||
|
value = IconValue.parse("icon.test",
|
||||||
|
"images/core.png[size(25,25)]{icon.foo[move(4,4)]}");
|
||||||
|
|
||||||
|
assertEquals("icon.test", value.getId());
|
||||||
|
Icon icon = value.get(values);
|
||||||
|
|
||||||
|
assertTrue(icon instanceof MultiIcon);
|
||||||
|
MultiIcon multiIcon = (MultiIcon) icon;
|
||||||
|
Icon[] icons = multiIcon.getIcons();
|
||||||
|
assertEquals(2, icons.length);
|
||||||
|
assertEquals(25, icons[0].getIconWidth());
|
||||||
|
assertEquals(25, icons[0].getIconWidth());
|
||||||
|
assertEquals(16, icons[1].getIconWidth());
|
||||||
|
assertEquals(16, icons[1].getIconWidth());
|
||||||
|
assertTrue(icons[1] instanceof TranslateIcon);
|
||||||
|
TranslateIcon tIcon = (TranslateIcon) icons[1];
|
||||||
|
Icon baseIcon = tIcon.getBaseIcon();
|
||||||
|
assertTrue(baseIcon instanceof MultiIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParseWithModifiedOverlay() throws ParseException {
|
||||||
IconValue value = IconValue.parse("icon.test",
|
IconValue value = IconValue.parse("icon.test",
|
||||||
"images/core.png[size(25,25)]{images/flag.png[size(8,8)][move(4,4)]}");
|
"images/core.png[size(25,25)]{images/flag.png[size(8,8)][move(4,4)]}");
|
||||||
assertEquals("icon.test", value.getId());
|
assertEquals("icon.test", value.getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user