Mercurial > 510Connectbot
changeset 244:32737a428805
add host preference for fixed screen size
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 14 Jul 2014 11:07:11 -0700 |
parents | 918dfcb862ed |
children | 23119f3c0d28 |
files | deployment.connections src/com/five_ten_sg/connectbot/HostListActivity.java src/com/five_ten_sg/connectbot/service/TerminalBridge.java src/com/five_ten_sg/connectbot/util/PreferenceConstants.java |
diffstat | 4 files changed, 21 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/deployment.connections Mon Jul 14 10:36:15 2014 -0700 +++ b/deployment.connections Mon Jul 14 11:07:11 2014 -0700 @@ -4,6 +4,9 @@ # nickname (string) # color (string) ("red", "green", "blue", "gray") # fontsize (float) +# fixed_size (boolean) +# fixed_width (integer) +# fixed_height (integer) # pubkeyid (integer) (-2, -1) -2=none, -1=any # useauthagent (string) ("no", "confirm", "yes") # postlogin (string) @@ -30,6 +33,9 @@ tn5250://pub1.rzkh.de:23#battleship encryption5250=NONE fontsize=12.5 + fixed_size=true + fixed_width=80 + fixed_height=25 # @@ -38,20 +44,18 @@ # available global keys: # # memkeys (boolean) -# update (string) ("Daily", "Weekly", "Never") # connPersist (boolean) # emulation (string) ("xterm-color", "xterm-256color", "xterm", "vt100", "ansi", "screen") # scrollback (integer) # rotation (string) ("Default", "Force landscape", "Force portrait", "Automatic") # shiftfkeys (boolean) # ctrlfkeys (boolean) -# volumefont (boolean) # keymode (string) ("Use right-side keys", "Use left-side keys", "none") -# camera (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "None") -# volup (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "None") -# voldn (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "None") -# search (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "None") -# ptt (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "None") +# camera (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "Increase Font Size", "Decrease Font Size", "None") +# volup (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "Increase Font Size", "Decrease Font Size", "None") +# voldn (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "Increase Font Size", "Decrease Font Size", "None") +# search (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "Increase Font Size", "Decrease Font Size", "None") +# ptt (string) ("CTRL", "Esc", "Tab", "Screen Capture", "Ctrl+A then Space", "Ctrl+A", "Esc+A", "Monitor Key", "Soft Function Keypad", "Increase Font Size", "Decrease Font Size", "None") # keepalive (boolean) # wifilock (boolean) # bumpyarrows (boolean) @@ -64,9 +68,6 @@ # bellVolume (float) # bellVibrate (boolean) # bellNotification (boolean) -# default_font_size (float) -# default_fsize_width (integer) -# default_fsize_height (integer) # screen_capture_folder (string) # screen_capture_popup (boolean) # file_dialog (string) @@ -78,7 +79,6 @@ # global:// - update=Never emulation=xterm-256color scrollback=200 rotation=Force landscape @@ -87,7 +87,6 @@ voldn=Tab search=None ptt=Monitor Key - default_font_size=12.5 # # end
--- a/src/com/five_ten_sg/connectbot/HostListActivity.java Mon Jul 14 10:36:15 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/HostListActivity.java Mon Jul 14 11:07:11 2014 -0700 @@ -419,14 +419,12 @@ Editor editor = prefs.edit(); HashMap<String,String> types = new HashMap<String,String>(); types.put("memkeys", "boolean"); - types.put("update", "string"); types.put("connPersist", "boolean"); types.put("emulation", "string"); types.put("scrollback", "integer"); types.put("rotation", "string"); types.put("shiftfkeys", "boolean"); types.put("ctrlfkeys", "boolean"); - types.put("volumefont", "boolean"); types.put("keymode", "string"); types.put("camera", "string"); types.put("volup", "string"); @@ -445,9 +443,6 @@ types.put("bellVolume", "float"); types.put("bellVibrate", "boolean"); types.put("bellNotification", "boolean"); - types.put("default_font_size", "float"); - types.put("default_fsize_width", "integer"); - types.put("default_fsize_height", "integer"); types.put("screen_capture_folder", "string"); types.put("screen_capture_popup", "boolean"); types.put("file_dialog", "string");
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Mon Jul 14 10:36:15 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Mon Jul 14 11:07:11 2014 -0700 @@ -189,22 +189,7 @@ defaultPaint.setFakeBoldText(true); // more readable? localOutput = new LinkedList<String>(); fontSizeChangedListeners = new LinkedList<FontSizeChangedListener>(); - float defaultFontSize = Float.parseFloat(manager.prefs.getString(PreferenceConstants.DEFAULT_FONT_SIZE, "-1")); - Log.i(TAG, "fontSize: " + this.fontSize + ", defaultFontSize: " + defaultFontSize); - - float hostFontSize; - if (fontSize <= 0) { - if ((defaultFontSize > 0) && (host.getFontSize() <= 0)) - hostFontSize = defaultFontSize; - else - hostFontSize = host.getFontSize(); - } - else - hostFontSize = fontSize; - - if (hostFontSize <= 0) hostFontSize = DEFAULT_FONT_SIZE; - - setFontSize(hostFontSize); + setFontSize(host.getFontSize()); // not correct for fixed size screen resetColors(); selectionArea = new SelectionArea(); } @@ -346,8 +331,14 @@ relayThread.start(); } - // force font-size to make sure we resizePTY as needed - setFontSize(fontSize); + // get proper font size + if (host.getFixedSize()) { + resizeComputed(host.getFixedWidth(), host.getFixedHeight(), w, h); + } + else { + setFontSize(host.getFontSize()); + } + // finally send any post-login string, if requested injectString(host.getPostLogin()); } @@ -450,7 +441,7 @@ * sure we resize PTY if needed. */ final void setFontSize(float size) { - if (size <= 0.0) return; + if (size <= 0.0) size = 12.0; size = (float)(int)((size * 10.0f) + 0.5f) / 10.0f; defaultPaint.setTextSize(size); fontSize = size;
--- a/src/com/five_ten_sg/connectbot/util/PreferenceConstants.java Mon Jul 14 10:36:15 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/util/PreferenceConstants.java Mon Jul 14 11:07:11 2014 -0700 @@ -96,7 +96,6 @@ public static final String EXTENDED_LONGPRESS = "extended_longpress"; public static final String SCREEN_CAPTURE_POPUP = "screen_capture_popup"; public static final String SCREEN_CAPTURE_FOLDER = "screen_capture_folder"; - public static final String DEFAULT_FONT_SIZE = "default_font_size"; public static final String FILE_DIALOG = "file_dialog"; public static final String DOWNLOAD_FOLDER = "download_folder"; public static final String REMOTE_UPLOAD_FOLDER = "remote_upload_folder";