Mercurial > 510Connectbot
changeset 245:23119f3c0d28
add host preference for fixed screen size
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 14 Jul 2014 11:15:42 -0700 |
parents | 32737a428805 |
children | dfe5f44bbea1 |
files | src/com/five_ten_sg/connectbot/service/TerminalBridge.java |
diffstat | 1 files changed, 12 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Mon Jul 14 11:07:11 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Mon Jul 14 11:15:42 2014 -0700 @@ -79,7 +79,6 @@ public class TerminalBridge implements VDUDisplay { public final static String TAG = "ConnectBot.TerminalBridge"; - public final static float DEFAULT_FONT_SIZE = 10.0f; private final static float FONT_SIZE_FACTOR = 1.1f; public Integer[] color; @@ -189,7 +188,7 @@ defaultPaint.setFakeBoldText(true); // more readable? localOutput = new LinkedList<String>(); fontSizeChangedListeners = new LinkedList<FontSizeChangedListener>(); - setFontSize(host.getFontSize()); // not correct for fixed size screen + setMyFontSize(); resetColors(); selectionArea = new SelectionArea(); } @@ -332,15 +331,19 @@ } // get proper font size - if (host.getFixedSize()) { - resizeComputed(host.getFixedWidth(), host.getFixedHeight(), w, h); + setMyFontSize(); + + // finally send any post-login string, if requested + injectString(host.getPostLogin()); + } + + private setMyFontSize() { + if ((parent != null) && (host.getFixedSize())) { + resizeComputed(host.getFixedWidth(), host.getFixedHeight(), parent.getWidth(), parent.getHeight()); } else { setFontSize(host.getFontSize()); } - - // finally send any post-login string, if requested - injectString(host.getPostLogin()); } /** @@ -441,7 +444,7 @@ * sure we resize PTY if needed. */ final void setFontSize(float size) { - if (size <= 0.0) size = 12.0; + if (size <= 0.0) size = 12.0f; size = (float)(int)((size * 10.0f) + 0.5f) / 10.0f; defaultPaint.setTextSize(size); fontSize = size; @@ -999,12 +1002,7 @@ */ public void resetSize(TerminalView parent) { this.forcedSize = false; - float defaultFontSize = Float.parseFloat(manager.prefs.getString(PreferenceConstants.DEFAULT_FONT_SIZE, "-1")); - - if (defaultFontSize > 0) - setFontSize(defaultFontSize); - else - setFontSize(DEFAULT_FONT_SIZE); + setMyFontSize(); } /**