]> source.dussan.org Git - tigervnc.git/commitdiff
Make scaling factor arguments "FixedRatio" and "Auto" case-insensitive
authorBrian Hinz <bphinz@users.sourceforge.net>
Sun, 26 Aug 2012 20:56:58 +0000 (20:56 +0000)
committerBrian Hinz <bphinz@users.sourceforge.net>
Sun, 26 Aug 2012 20:56:58 +0000 (20:56 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4966 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/com/tigervnc/vncviewer/CConn.java
java/com/tigervnc/vncviewer/DesktopWindow.java
java/com/tigervnc/vncviewer/Viewport.java

index e3aea9430f1c434b41b1b46e6c58287428e37b23..1b099d0512b7705bb1d93845015662c1b2d01f43 100644 (file)
@@ -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();
         }
       }
index b55947eadd225d9ed7412138e000b8c2d23409b3..46af0b9ac85baf807c5abe7e1e7db8e95a2970c4 100644 (file)
@@ -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);
index de3621c21e25c6cd6e0cf281ee48b237df3d8389..503a653e862c3d630ec8091ca7e130ab601310bb 100644 (file)
@@ -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);