GP-2909 Fixing update issues when changing themes

This commit is contained in:
ghidragon
2022-12-01 18:15:29 -05:00
parent 1a6c9be8e3
commit c9670ed4ef
6 changed files with 62 additions and 19 deletions

View File

@@ -130,12 +130,12 @@ public class ApplicationThemeManager extends ThemeManager {
lookAndFeelManager = lafType.getLookAndFeelManager(this);
try {
lookAndFeelManager.installLookAndFeel();
themePreferences.save(theme);
notifyThemeChanged(new AllValuesChangedThemeEvent(true));
}
catch (Exception e) {
Msg.error(this, "Error setting LookAndFeel: " + lafType.getName(), e);
}
themePreferences.save(theme);
}
currentValues.checkForUnresolvedReferences();
}
@@ -192,12 +192,12 @@ public class ApplicationThemeManager extends ThemeManager {
updateChangedValuesMap(currentValue, newValue);
currentValues.addFont(newValue);
notifyThemeChanged(new FontChangedThemeEvent(currentValues, newValue));
// update all java LookAndFeel fonts affected by this changed
String id = newValue.getId();
Set<String> changedFontIds = findChangedJavaFontIds(id);
lookAndFeelManager.fontsChanged(changedFontIds);
notifyThemeChanged(new FontChangedThemeEvent(currentValues, newValue));
}
@Override
@@ -208,12 +208,8 @@ public class ApplicationThemeManager extends ThemeManager {
}
updateChangedValuesMap(currentValue, newValue);
currentValues.addColor(newValue);
lookAndFeelManager.colorsChanged();
notifyThemeChanged(new ColorChangedThemeEvent(currentValues, newValue));
// now update the ui
if (lookAndFeelManager != null) {
lookAndFeelManager.colorsChanged();
}
}
@Override
@@ -225,7 +221,6 @@ public class ApplicationThemeManager extends ThemeManager {
updateChangedValuesMap(currentValue, newValue);
currentValues.addIcon(newValue);
notifyThemeChanged(new IconChangedThemeEvent(currentValues, newValue));
// now update the ui
// update all java LookAndFeel icons affected by this changed
@@ -233,6 +228,7 @@ public class ApplicationThemeManager extends ThemeManager {
Set<String> changedIconIds = findChangedJavaIconIds(id);
Icon newIcon = newValue.get(currentValues);
lookAndFeelManager.iconsChanged(changedIconIds, newIcon);
notifyThemeChanged(new IconChangedThemeEvent(currentValues, newValue));
}
/**

View File

@@ -30,6 +30,7 @@ import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
import resources.ResourceManager;
import utilities.util.reflection.ReflectionUtilities;
import utility.function.Callback;
/**
* This class manages application themes and their values. The ThemeManager is an abstract