From 77920fe87ac7e54ae369207719e6ddb15289eca3 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Sun, 26 Aug 2012 20:56:58 +0000 Subject: [PATCH] Make scaling factor arguments "FixedRatio" and "Auto" case-insensitive git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4966 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/com/tigervnc/vncviewer/CConn.java | 14 +++++++------- java/com/tigervnc/vncviewer/DesktopWindow.java | 7 ++++--- java/com/tigervnc/vncviewer/Viewport.java | 5 +++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index e3aea943..1b099d05 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -880,9 +880,9 @@ public class CConn extends CConnection options.useLocalCursor.setSelected(viewer.useLocalCursor.getValue()); options.acceptBell.setSelected(viewer.acceptBell.getValue()); String scaleString = viewer.scalingFactor.getValue(); - if (scaleString.equals("Auto")) { + if (scaleString.equalsIgnoreCase("Auto")) { options.scalingFactor.setSelectedItem("Auto"); - } else if(scaleString.equals("FixedRatio")) { + } else if(scaleString.equalsIgnoreCase("FixedRatio")) { options.scalingFactor.setSelectedItem("Fixed Aspect Ratio"); } else { digit = Integer.parseInt(scaleString); @@ -955,14 +955,14 @@ public class CConn extends CConnection String scaleString = options.scalingFactor.getSelectedItem().toString(); String oldScaleFactor = viewer.scalingFactor.getValue(); - if (scaleString.equals("Auto")) { + if (scaleString.equalsIgnoreCase("Auto")) { if (!oldScaleFactor.equals(scaleString)) { viewer.scalingFactor.setParam("Auto"); if (desktop != null) reconfigureViewport(); } - } else if(scaleString.equals("Fixed Aspect Ratio")) { - if (!oldScaleFactor.equals("FixedRatio")) { + } else if(scaleString.equalsIgnoreCase("Fixed Aspect Ratio")) { + if (!oldScaleFactor.equalsIgnoreCase("FixedRatio")) { viewer.scalingFactor.setParam("FixedRatio"); if (desktop != null) reconfigureViewport(); @@ -971,8 +971,8 @@ public class CConn extends CConnection scaleString=scaleString.substring(0, scaleString.length()-1); if (!oldScaleFactor.equals(scaleString)) { viewer.scalingFactor.setParam(scaleString); - if ((desktop != null) && (!oldScaleFactor.equals("Auto") || - !oldScaleFactor.equals("FixedRatio"))) { + if ((desktop != null) && (!oldScaleFactor.equalsIgnoreCase("Auto") || + !oldScaleFactor.equalsIgnoreCase("FixedRatio"))) { reconfigureViewport(); } } diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java index b55947ea..46af0b9a 100644 --- a/java/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/com/tigervnc/vncviewer/DesktopWindow.java @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright (C) 2006 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2009 Paul Donohue. All Rights Reserved. - * Copyright (C) 2010 D. R. Commander. All Rights Reserved. + * Copyright (C) 2010, 2012 D. R. Commander. All Rights Reserved. * Copyright (C) 2011-2012 Brian P. Hinz * * This is free software; you can redistribute it and/or modify @@ -285,7 +285,8 @@ class DesktopWindow extends JPanel implements public void setScaledSize() { String scaleString = cc.viewer.scalingFactor.getValue(); - if (!scaleString.equals("Auto") && !scaleString.equals("FixedRatio")) { + if (!scaleString.equalsIgnoreCase("Auto") && + !scaleString.equalsIgnoreCase("FixedRatio")) { int scalingFactor = Integer.parseInt(scaleString); scaledWidth = (int)Math.floor((float)cc.cp.width * (float)scalingFactor/100.0); @@ -303,7 +304,7 @@ class DesktopWindow extends JPanel implements vpSize.height - vpInsets.top - vpInsets.bottom); if (availableSize.width == 0 || availableSize.height == 0) availableSize = new Dimension(cc.cp.width, cc.cp.height); - if (scaleString.equals("FixedRatio")) { + if (scaleString.equalsIgnoreCase("FixedRatio")) { float widthRatio = (float)availableSize.width / (float)cc.cp.width; float heightRatio = (float)availableSize.height / (float)cc.cp.height; float ratio = Math.min(widthRatio, heightRatio); diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index de3621c2..503a653e 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -59,7 +59,8 @@ public class Viewport extends JFrame cc.toggleFullScreen(); } String scaleString = cc.viewer.scalingFactor.getValue(); - if (scaleString.equals("Auto") || scaleString.equals("FixedRatio")) { + if (scaleString.equalsIgnoreCase("Auto") || + scaleString.equalsIgnoreCase("FixedRatio")) { if ((sp.getSize().width != cc.desktop.scaledWidth) || (sp.getSize().height != cc.desktop.scaledHeight)) { int policy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; @@ -69,7 +70,7 @@ public class Viewport extends JFrame cc.desktop.scaledHeight)); sp.validate(); if (getExtendedState() != JFrame.MAXIMIZED_BOTH && - scaleString.equals("FixedRatio")) { + scaleString.equalsIgnoreCase("FixedRatio")) { int w = cc.desktop.scaledWidth + getInsets().left + getInsets().right; int h = cc.desktop.scaledHeight + getInsets().top + getInsets().bottom; setSize(w, h); -- 2.39.5