diff options
| author | 2020-04-24 18:39:57 +0200 | |
|---|---|---|
| committer | 2020-04-24 17:39:57 +0100 | |
| commit | 04b01512c124c76f3b3d99ba07ef30ea6a90b52f (patch) | |
| tree | 33ffbe9fba1fd762cc7a7997db9764b181f29d7b /src/main/java/cuchaz/enigma/gui/dialog | |
| parent | Update darcula to fix dark theme (diff) | |
| download | enigma-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/gui/dialog')
5 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java index 82fd6a5..43b8265 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java | |||
| @@ -13,6 +13,7 @@ package cuchaz.enigma.gui.dialog; | |||
| 13 | 13 | ||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.utils.I18n; | 15 | import cuchaz.enigma.utils.I18n; |
| 16 | import cuchaz.enigma.gui.util.ScaleUtil; | ||
| 16 | import cuchaz.enigma.utils.Utils; | 17 | import cuchaz.enigma.utils.Utils; |
| 17 | 18 | ||
| 18 | import javax.swing.*; | 19 | import javax.swing.*; |
| @@ -59,7 +60,7 @@ public class AboutDialog { | |||
| 59 | 60 | ||
| 60 | // show the frame | 61 | // show the frame |
| 61 | pane.doLayout(); | 62 | pane.doLayout(); |
| 62 | frame.setSize(400, 220); | 63 | frame.setSize(ScaleUtil.getDimension(400, 220)); |
| 63 | frame.setResizable(false); | 64 | frame.setResizable(false); |
| 64 | frame.setLocationRelativeTo(parent); | 65 | frame.setLocationRelativeTo(parent); |
| 65 | frame.setVisible(true); | 66 | frame.setVisible(true); |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java index 78b1d75..908b42e 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java | |||
| @@ -13,6 +13,7 @@ package cuchaz.enigma.gui.dialog; | |||
| 13 | 13 | ||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.utils.I18n; | 15 | import cuchaz.enigma.utils.I18n; |
| 16 | import cuchaz.enigma.gui.util.ScaleUtil; | ||
| 16 | import cuchaz.enigma.utils.Utils; | 17 | import cuchaz.enigma.utils.Utils; |
| 17 | 18 | ||
| 18 | import javax.swing.*; | 19 | import javax.swing.*; |
| @@ -81,7 +82,7 @@ public class CrashDialog { | |||
| 81 | pane.add(buttonsPanel, BorderLayout.SOUTH); | 82 | pane.add(buttonsPanel, BorderLayout.SOUTH); |
| 82 | 83 | ||
| 83 | // show the frame | 84 | // show the frame |
| 84 | frame.setSize(600, 400); | 85 | frame.setSize(ScaleUtil.getDimension(600, 400)); |
| 85 | frame.setLocationRelativeTo(parent); | 86 | frame.setLocationRelativeTo(parent); |
| 86 | frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); | 87 | frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| 87 | } | 88 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java index 033318a..b2c159d 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.gui.dialog; | 12 | package cuchaz.enigma.gui.dialog; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.utils.I18n; | 14 | import cuchaz.enigma.utils.I18n; |
| 15 | import cuchaz.enigma.gui.util.ScaleUtil; | ||
| 15 | import cuchaz.enigma.utils.Utils; | 16 | import cuchaz.enigma.utils.Utils; |
| 16 | 17 | ||
| 17 | import javax.swing.*; | 18 | import javax.swing.*; |
| @@ -72,7 +73,7 @@ public class JavadocDialog { | |||
| 72 | pane.add(buttonsPanel, BorderLayout.SOUTH); | 73 | pane.add(buttonsPanel, BorderLayout.SOUTH); |
| 73 | 74 | ||
| 74 | // show the frame | 75 | // show the frame |
| 75 | frame.setSize(600, 400); | 76 | frame.setSize(ScaleUtil.getDimension(600, 400)); |
| 76 | frame.setLocationRelativeTo(parent); | 77 | frame.setLocationRelativeTo(parent); |
| 77 | frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); | 78 | frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| 78 | } | 79 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java index 6d9a419..e33ae82 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java | |||
| @@ -14,6 +14,7 @@ package cuchaz.enigma.gui.dialog; | |||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.ProgressListener; | 15 | import cuchaz.enigma.ProgressListener; |
| 16 | import cuchaz.enigma.utils.I18n; | 16 | import cuchaz.enigma.utils.I18n; |
| 17 | import cuchaz.enigma.gui.util.ScaleUtil; | ||
| 17 | import cuchaz.enigma.utils.Utils; | 18 | import cuchaz.enigma.utils.Utils; |
| 18 | 19 | ||
| 19 | import javax.swing.*; | 20 | import javax.swing.*; |
| @@ -48,11 +49,11 @@ public class ProgressDialog implements ProgressListener, AutoCloseable { | |||
| 48 | this.labelText.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); | 49 | this.labelText.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); |
| 49 | panel.add(this.labelText, BorderLayout.NORTH); | 50 | panel.add(this.labelText, BorderLayout.NORTH); |
| 50 | panel.add(this.progress, BorderLayout.CENTER); | 51 | panel.add(this.progress, BorderLayout.CENTER); |
| 51 | panel.setPreferredSize(new Dimension(360, 50)); | 52 | panel.setPreferredSize(ScaleUtil.getDimension(360, 50)); |
| 52 | 53 | ||
| 53 | // show the frame | 54 | // show the frame |
| 54 | pane.doLayout(); | 55 | pane.doLayout(); |
| 55 | this.frame.setSize(400, 120); | 56 | this.frame.setSize(ScaleUtil.getDimension(400, 120)); |
| 56 | this.frame.setResizable(false); | 57 | this.frame.setResizable(false); |
| 57 | this.frame.setLocationRelativeTo(parent); | 58 | this.frame.setLocationRelativeTo(parent); |
| 58 | this.frame.setVisible(true); | 59 | this.frame.setVisible(true); |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java index 47f9149..56ce751 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java | |||
| @@ -15,6 +15,7 @@ import com.google.common.collect.Lists; | |||
| 15 | import cuchaz.enigma.gui.Gui; | 15 | import cuchaz.enigma.gui.Gui; |
| 16 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 16 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 17 | import cuchaz.enigma.utils.I18n; | 17 | import cuchaz.enigma.utils.I18n; |
| 18 | import cuchaz.enigma.gui.util.ScaleUtil; | ||
| 18 | import me.xdrop.fuzzywuzzy.FuzzySearch; | 19 | import me.xdrop.fuzzywuzzy.FuzzySearch; |
| 19 | import me.xdrop.fuzzywuzzy.model.ExtractedResult; | 20 | import me.xdrop.fuzzywuzzy.model.ExtractedResult; |
| 20 | 21 | ||
| @@ -107,7 +108,7 @@ public class SearchDialog { | |||
| 107 | frame.setContentPane(pane); | 108 | frame.setContentPane(pane); |
| 108 | frame.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); | 109 | frame.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); |
| 109 | 110 | ||
| 110 | frame.setSize(360, 500); | 111 | frame.setSize(ScaleUtil.getDimension(360, 500)); |
| 111 | frame.setAlwaysOnTop(true); | 112 | frame.setAlwaysOnTop(true); |
| 112 | frame.setResizable(false); | 113 | frame.setResizable(false); |
| 113 | frame.setLocationRelativeTo(parent.getFrame()); | 114 | frame.setLocationRelativeTo(parent.getFrame()); |