Commit 29316172 authored by Skylot's avatar Skylot

fix(gui): use editor font in files tree and fix bundled font loading

parent 82d0d622
......@@ -17,8 +17,6 @@ import jadx.gui.ui.codearea.EditorTheme;
import jadx.gui.utils.LangLocale;
import jadx.gui.utils.NLS;
import static jadx.gui.utils.Utils.FONT_HACK;
public class JadxSettingsWindow extends JDialog {
private static final long serialVersionUID = -1804570470377354148L;
......@@ -38,7 +36,6 @@ public class JadxSettingsWindow extends JDialog {
this.prevLang = settings.getLangLocale();
initUI();
registerBundledFonts();
setTitle(NLS.str("preferences.title"));
setSize(400, 550);
......@@ -48,13 +45,6 @@ public class JadxSettingsWindow extends JDialog {
setLocationRelativeTo(null);
}
public static void registerBundledFonts() {
GraphicsEnvironment grEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (FONT_HACK != null) {
grEnv.registerFont(FONT_HACK);
}
}
private void initUI() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
......@@ -202,7 +192,6 @@ public class JadxSettingsWindow extends JDialog {
int i = themesCbx.getSelectedIndex();
EditorTheme editorTheme = editorThemes[i];
settings.setEditorThemePath(editorTheme.getPath());
mainWindow.setEditorTheme(editorTheme.getPath());
mainWindow.loadSettings();
});
......
......@@ -111,16 +111,11 @@ public class MainWindow extends JFrame {
this.cacheObject = new CacheObject();
resetCache();
registerBundledFonts();
initUI();
initMenuAndToolbar();
applySettings();
checkForUpdate();
}
private void applySettings() {
setFont(settings.getFont());
setEditorTheme(settings.getEditorThemePath());
loadSettings();
checkForUpdate();
}
public void open() {
......@@ -649,7 +644,14 @@ public class MainWindow extends JFrame {
setFont(font);
}
public void setEditorTheme(String editorThemePath) {
public static void registerBundledFonts() {
GraphicsEnvironment grEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (Utils.FONT_HACK != null) {
grEnv.registerFont(Utils.FONT_HACK);
}
}
private void setEditorTheme(String editorThemePath) {
try {
editorTheme = Theme.load(getClass().getResourceAsStream(editorThemePath));
} catch (Exception e) {
......@@ -667,6 +669,14 @@ public class MainWindow extends JFrame {
}
public void loadSettings() {
Font font = settings.getFont();
Font largerFont = font.deriveFont(font.getSize() + 2.f);
setFont(largerFont);
setEditorTheme(settings.getEditorThemePath());
tree.setFont(largerFont);
tree.setRowHeight(-1);
tabbedPane.loadSettings();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment