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; ...@@ -17,8 +17,6 @@ import jadx.gui.ui.codearea.EditorTheme;
import jadx.gui.utils.LangLocale; import jadx.gui.utils.LangLocale;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import static jadx.gui.utils.Utils.FONT_HACK;
public class JadxSettingsWindow extends JDialog { public class JadxSettingsWindow extends JDialog {
private static final long serialVersionUID = -1804570470377354148L; private static final long serialVersionUID = -1804570470377354148L;
...@@ -38,7 +36,6 @@ public class JadxSettingsWindow extends JDialog { ...@@ -38,7 +36,6 @@ public class JadxSettingsWindow extends JDialog {
this.prevLang = settings.getLangLocale(); this.prevLang = settings.getLangLocale();
initUI(); initUI();
registerBundledFonts();
setTitle(NLS.str("preferences.title")); setTitle(NLS.str("preferences.title"));
setSize(400, 550); setSize(400, 550);
...@@ -48,13 +45,6 @@ public class JadxSettingsWindow extends JDialog { ...@@ -48,13 +45,6 @@ public class JadxSettingsWindow extends JDialog {
setLocationRelativeTo(null); setLocationRelativeTo(null);
} }
public static void registerBundledFonts() {
GraphicsEnvironment grEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (FONT_HACK != null) {
grEnv.registerFont(FONT_HACK);
}
}
private void initUI() { private void initUI() {
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
...@@ -202,7 +192,6 @@ public class JadxSettingsWindow extends JDialog { ...@@ -202,7 +192,6 @@ public class JadxSettingsWindow extends JDialog {
int i = themesCbx.getSelectedIndex(); int i = themesCbx.getSelectedIndex();
EditorTheme editorTheme = editorThemes[i]; EditorTheme editorTheme = editorThemes[i];
settings.setEditorThemePath(editorTheme.getPath()); settings.setEditorThemePath(editorTheme.getPath());
mainWindow.setEditorTheme(editorTheme.getPath());
mainWindow.loadSettings(); mainWindow.loadSettings();
}); });
......
...@@ -111,16 +111,11 @@ public class MainWindow extends JFrame { ...@@ -111,16 +111,11 @@ public class MainWindow extends JFrame {
this.cacheObject = new CacheObject(); this.cacheObject = new CacheObject();
resetCache(); resetCache();
registerBundledFonts();
initUI(); initUI();
initMenuAndToolbar(); initMenuAndToolbar();
applySettings();
checkForUpdate();
}
private void applySettings() {
setFont(settings.getFont());
setEditorTheme(settings.getEditorThemePath());
loadSettings(); loadSettings();
checkForUpdate();
} }
public void open() { public void open() {
...@@ -649,7 +644,14 @@ public class MainWindow extends JFrame { ...@@ -649,7 +644,14 @@ public class MainWindow extends JFrame {
setFont(font); 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 { try {
editorTheme = Theme.load(getClass().getResourceAsStream(editorThemePath)); editorTheme = Theme.load(getClass().getResourceAsStream(editorThemePath));
} catch (Exception e) { } catch (Exception e) {
...@@ -667,6 +669,14 @@ public class MainWindow extends JFrame { ...@@ -667,6 +669,14 @@ public class MainWindow extends JFrame {
} }
public void loadSettings() { 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(); 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