From 4f7cd8cd5a7a77e95f290de0e41fa3a8d34090f9 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 11 Feb 2017 16:22:09 -0500 Subject: [PATCH] yet another attempt for the editor sizing --- app/src/processing/app/ui/Editor.java | 7 ++++++- app/src/processing/app/ui/Toolkit.java | 12 +++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 28e906c00..01bddf99a 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -263,8 +263,13 @@ public abstract class Editor extends JFrame implements RunnerListener { textarea.setRightClickPopup(new TextAreaPopup()); textarea.setHorizontalOffset(JEditTextArea.leftHandGutter); //System.out.println(textarea.getPreferredSize()); + final int editorHeight = + Preferences.getInteger("editor.window.height.default") - 240; + final int editorWidth = + Preferences.getInteger("editor.window.width.default") - 70; // textarea.setPreferredSize(new Dimension(textarea.getPreferredSize().width, -// Toolkit.zoom(360))); +// Toolkit.zoom(textareaHeight))); + textarea.setPreferredSize(Toolkit.zoom(editorWidth, editorHeight)); { // Hack: add Numpad Slash as an alternative shortcut for Comment/Uncomment int modifiers = Toolkit.awtToolkit.getMenuShortcutKeyMask(); diff --git a/app/src/processing/app/ui/Toolkit.java b/app/src/processing/app/ui/Toolkit.java index 75270f058..98b31085f 100644 --- a/app/src/processing/app/ui/Toolkit.java +++ b/app/src/processing/app/ui/Toolkit.java @@ -844,6 +844,11 @@ public class Toolkit { } + static public Dimension zoom(int w, int h) { + return new Dimension(zoom(w), zoom(h)); + } + + static private float parseZoom() { String zoomSel = Preferences.get("editor.zoom"); if (zoomOptions.hasValue(zoomSel)) { @@ -870,13 +875,6 @@ public class Toolkit { } - /* - static Dimension zoom(int w, int h) { - return new Dimension(zoom(w), zoom(h)); - } - */ - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .