summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/config/Config.java
diff options
context:
space:
mode:
authorGravatar 2xsaiko2020-04-24 18:39:57 +0200
committerGravatar GitHub2020-04-24 17:39:57 +0100
commit04b01512c124c76f3b3d99ba07ef30ea6a90b52f (patch)
tree33ffbe9fba1fd762cc7a7997db9764b181f29d7b /src/main/java/cuchaz/enigma/config/Config.java
parentUpdate darcula to fix dark theme (diff)
downloadenigma-fork-04b01512c124c76f3b3d99ba07ef30ea6a90b52f.tar.gz
enigma-fork-04b01512c124c76f3b3d99ba07ef30ea6a90b52f.tar.xz
enigma-fork-04b01512c124c76f3b3d99ba07ef30ea6a90b52f.zip
Add a configurable scale factor (#230)
* Add swing-dpi dependency * Implement scale factor * Improve custom scale dialog, fix crash * Remove use of $ in identifiers * Use custom functional interface for scale listeners * Bump version Co-authored-by: modmuss50 <modmuss50@gmail.com>
Diffstat (limited to 'src/main/java/cuchaz/enigma/config/Config.java')
-rw-r--r--src/main/java/cuchaz/enigma/config/Config.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java
index 15a974c..20605b7 100644
--- a/src/main/java/cuchaz/enigma/config/Config.java
+++ b/src/main/java/cuchaz/enigma/config/Config.java
@@ -7,6 +7,7 @@ import cuchaz.enigma.source.DecompilerService;
7import cuchaz.enigma.source.Decompilers; 7import cuchaz.enigma.source.Decompilers;
8 8
9import cuchaz.enigma.utils.I18n; 9import cuchaz.enigma.utils.I18n;
10import cuchaz.enigma.gui.util.ScaleUtil;
10 11
11import javax.swing.*; 12import javax.swing.*;
12import javax.swing.plaf.metal.MetalLookAndFeel; 13import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -78,7 +79,7 @@ public class Config {
78 public static boolean isDarkLaf() { 79 public static boolean isDarkLaf() {
79 // a bit of a hack because swing doesn't give any API for that, and we need colors that aren't defined in look and feel 80 // a bit of a hack because swing doesn't give any API for that, and we need colors that aren't defined in look and feel
80 JPanel panel = new JPanel(); 81 JPanel panel = new JPanel();
81 panel.setSize(new Dimension(10, 10)); 82 panel.setSize(ScaleUtil.getDimension(10, 10));
82 panel.doLayout(); 83 panel.doLayout();
83 84
84 BufferedImage image = new BufferedImage(panel.getSize().width, panel.getSize().height, BufferedImage.TYPE_INT_RGB); 85 BufferedImage image = new BufferedImage(panel.getSize().width, panel.getSize().height, BufferedImage.TYPE_INT_RGB);
@@ -187,6 +188,8 @@ public class Config {
187 188
188 public LookAndFeel lookAndFeel = LookAndFeel.DEFAULT; 189 public LookAndFeel lookAndFeel = LookAndFeel.DEFAULT;
189 190
191 public float scaleFactor = 1.0f;
192
190 public Decompiler decompiler = Decompiler.PROCYON; 193 public Decompiler decompiler = Decompiler.PROCYON;
191 194
192 private Config() { 195 private Config() {