mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-13 06:33:02 +00:00
GP-1 Fixed a few minor issues with new theming code
This commit is contained in:
parent
e657a70141
commit
4763ce6e8a
@ -16,6 +16,7 @@ data/ElfFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||
data/ExtensionPoint.manifest||GHIDRA||||END|
|
||||
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||
data/base.file.extensions.icons.theme.properties||GHIDRA||||END|
|
||||
data/base.icons.theme.properties||GHIDRA||||END|
|
||||
data/base.listing.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/mfc90u.exports||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_64.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
|
||||
public ActionContext getActionContext(MouseEvent e) {
|
||||
if (e == null) {
|
||||
return null;
|
||||
}
|
||||
if (e.getSource() == table) {
|
||||
if (e != null && e.getSource() == table) {
|
||||
FontValue currentValue = filterTable.getSelectedRowObject();
|
||||
if (currentValue == null) {
|
||||
return null;
|
||||
|
@ -104,7 +104,7 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
|
||||
|
||||
@Override
|
||||
public ActionContext getActionContext(MouseEvent e) {
|
||||
if (e.getSource() == table) {
|
||||
if (e != null && e.getSource() == table) {
|
||||
IconValue currentValue = filterTable.getSelectedRowObject();
|
||||
if (currentValue == null) {
|
||||
return null;
|
||||
|
@ -215,6 +215,9 @@ public class ThemeUtils {
|
||||
private static boolean saveCurrentValues(ThemeManager themeManager, String themeName) {
|
||||
GTheme activeTheme = themeManager.getActiveTheme();
|
||||
File file = getSaveFile(themeName);
|
||||
if (!file.exists()) {
|
||||
Msg.info(ThemeUtils.class, "Saving theme to " + file);
|
||||
}
|
||||
|
||||
GTheme newTheme = new GTheme(file, themeName, activeTheme.getLookAndFeelType(),
|
||||
activeTheme.useDarkDefaults());
|
||||
|
@ -44,7 +44,6 @@ public class ThemeFileLoader {
|
||||
Application.findFilesByExtensionInApplication(".theme.properties");
|
||||
|
||||
for (ResourceFile resourceFile : themeDefaultFiles) {
|
||||
Msg.debug(this, "found theme file: " + resourceFile.getAbsolutePath());
|
||||
try {
|
||||
ThemePropertyFileReader reader = new ThemePropertyFileReader(resourceFile);
|
||||
defaults.load(reader.getDefaultValues());
|
||||
|
@ -93,7 +93,7 @@ public abstract class ThemeValue<T> implements Comparable<ThemeValue<T>> {
|
||||
// loop resolving indirect references
|
||||
while (referred != null) {
|
||||
if (referred.value != null) {
|
||||
return referred.value;
|
||||
return referred.get(values);
|
||||
}
|
||||
visitedKeys.add(referred.id);
|
||||
if (visitedKeys.contains(referred.referenceId)) {
|
||||
|
@ -123,6 +123,30 @@ public class IconValueTest {
|
||||
|
||||
@Test
|
||||
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",
|
||||
"images/core.png[size(25,25)]{images/flag.png[size(8,8)][move(4,4)]}");
|
||||
assertEquals("icon.test", value.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user