]> source.dussan.org Git - tigervnc.git/commitdiff
Change name of menu key class to be consistent with Java style guidelines.
authorBrian Hinz <bphinz@users.sourceforge.net>
Sun, 26 Aug 2012 18:06:52 +0000 (18:06 +0000)
committerBrian Hinz <bphinz@users.sourceforge.net>
Sun, 26 Aug 2012 18:06:52 +0000 (18:06 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4959 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/com/tigervnc/vncviewer/CConn.java
java/com/tigervnc/vncviewer/DesktopWindow.java
java/com/tigervnc/vncviewer/F8Menu.java
java/com/tigervnc/vncviewer/MenuKey.java [new file with mode: 0644]
java/com/tigervnc/vncviewer/OptionsDialog.java
java/com/tigervnc/vncviewer/menukey.java [deleted file]

index 2faf787d21aea5df9657a553bd9c10474821a6f5..814b0df70ee49ee33e252232aff34c6514bee7cb 100644 (file)
@@ -165,7 +165,7 @@ public class CConn extends CConnection
     autoSelect = viewer.autoSelect.getValue();
     formatChange = false; encodingChange = false;
     fullScreen = viewer.fullScreen.getValue();
-    menuKeyCode = menukey.getMenuKeyCode();
+    menuKeyCode = MenuKey.getMenuKeyCode();
     options = new OptionsDialog(this);
     options.initDialog();
     clipboardDialog = new ClipboardDialog(this);
@@ -875,7 +875,7 @@ public class CConn extends CConnection
     options.viewOnly.setSelected(viewer.viewOnly.getValue());
     options.acceptClipboard.setSelected(viewer.acceptClipboard.getValue());
     options.sendClipboard.setSelected(viewer.sendClipboard.getValue());
-    options.menuKey.setSelectedItem(KeyEvent.getKeyText(menukey.getMenuKeyCode()));
+    options.menuKey.setSelectedItem(KeyEvent.getKeyText(MenuKey.getMenuKeyCode()));
     options.sendLocalUsername.setSelected(viewer.sendLocalUsername.getValue());
 
     if (state() == RFBSTATE_NORMAL) {
@@ -1067,8 +1067,8 @@ public class CConn extends CConnection
     }
 
     clipboardDialog.setSendingEnabled(viewer.sendClipboard.getValue());
-    viewer.menuKey.setParam(menukey.getMenuKeySymbols()[options.menuKey.getSelectedIndex()].name);
-    F8Menu.f8.setText("Send "+KeyEvent.getKeyText(menukey.getMenuKeyCode()));
+    viewer.menuKey.setParam(MenuKey.getMenuKeySymbols()[options.menuKey.getSelectedIndex()].name);
+    F8Menu.f8.setText("Send "+KeyEvent.getKeyText(MenuKey.getMenuKeyCode()));
 
     setShared(options.shared.isSelected());
     viewer.useLocalCursor.setParam(options.useLocalCursor.isSelected());
index 3ef25f3a1342c60b4f58e6dd0ebf7c1dca2bdd73..27d1dce778f254ff108b2c694e388db92503e139 100644 (file)
@@ -409,7 +409,7 @@ class DesktopWindow extends JPanel implements
   public void keyReleased(KeyEvent e) {}
   /** Handle the key-pressed event. */
   public void keyPressed(KeyEvent e) {
-    if (e.getKeyCode() == menukey.getMenuKeyCode()) {
+    if (e.getKeyCode() == MenuKey.getMenuKeyCode()) {
       int sx = (scaleWidthRatio == 1.00) 
         ? lastX : (int)Math.floor(lastX*scaleWidthRatio);
       int sy = (scaleHeightRatio == 1.00) 
index 317caf3574878ebe8a9b5645ca023920d352a445..b346db951229824f25b816eddf56e88c41200d0c 100644 (file)
@@ -51,7 +51,7 @@ public class F8Menu extends JPopupMenu implements ActionListener {
     addSeparator();
     clipboard  = addMenuItem("Clipboard...");
     addSeparator();
-    f8 = addMenuItem("Send "+KeyEvent.getKeyText(menukey.getMenuKeyCode()), menukey.getMenuKeyCode());
+    f8 = addMenuItem("Send "+KeyEvent.getKeyText(MenuKey.getMenuKeyCode()), MenuKey.getMenuKeyCode());
     ctrlAltDel = addMenuItem("Send Ctrl-Alt-Del");
     addSeparator();
     refresh    = addMenuItem("Refresh Screen", KeyEvent.VK_H);
diff --git a/java/com/tigervnc/vncviewer/MenuKey.java b/java/com/tigervnc/vncviewer/MenuKey.java
new file mode 100644 (file)
index 0000000..0a24014
--- /dev/null
@@ -0,0 +1,93 @@
+/* Copyright 2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
+ * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright 2012 Brian P. Hinz
+ * 
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+
+package com.tigervnc.vncviewer;
+
+import java.awt.event.KeyEvent;
+
+import com.tigervnc.rfb.*;
+
+public class MenuKey 
+{
+  static class MenuKeySymbol {
+    public MenuKeySymbol(String name_, int keycode_) {
+      name = name_;
+      keycode = keycode_;
+    }
+    String name;
+    int keycode;
+  }
+
+  private static final MenuKeySymbol[] menuSymbols = {
+    new MenuKeySymbol("F1", KeyEvent.VK_F1),
+    new MenuKeySymbol("F2", KeyEvent.VK_F2),
+    new MenuKeySymbol("F3", KeyEvent.VK_F3),
+    new MenuKeySymbol("F4", KeyEvent.VK_F4),
+    new MenuKeySymbol("F5", KeyEvent.VK_F5),
+    new MenuKeySymbol("F6", KeyEvent.VK_F6),
+    new MenuKeySymbol("F7", KeyEvent.VK_F7),
+    new MenuKeySymbol("F8", KeyEvent.VK_F8),
+    new MenuKeySymbol("F9", KeyEvent.VK_F9),
+    new MenuKeySymbol("F10", KeyEvent.VK_F10),
+    new MenuKeySymbol("F11", KeyEvent.VK_F11),
+    new MenuKeySymbol("F12", KeyEvent.VK_F12),
+    new MenuKeySymbol("Pause", KeyEvent.VK_PAUSE),
+    new MenuKeySymbol("Print", KeyEvent.VK_PRINTSCREEN),
+    new MenuKeySymbol("Scroll_Lock", KeyEvent.VK_SCROLL_LOCK),
+    new MenuKeySymbol("Escape", KeyEvent.VK_ESCAPE),
+    new MenuKeySymbol("Insert", KeyEvent.VK_INSERT),
+    new MenuKeySymbol("Delete", KeyEvent.VK_DELETE),
+    new MenuKeySymbol("Home", KeyEvent.VK_HOME),
+    new MenuKeySymbol("Page_Up", KeyEvent.VK_PAGE_UP),
+    new MenuKeySymbol("Page_Down", KeyEvent.VK_PAGE_DOWN)
+  };
+  
+  static int getMenuKeySymbolCount() {
+    return menuSymbols.length;
+  }
+  
+  public static MenuKeySymbol[] getMenuKeySymbols() {
+    return menuSymbols;
+  }
+
+  public static String getMenuKeyValueStr() {
+    String s = "";
+    for (int i = 0; i < getMenuKeySymbolCount(); i++) {
+      s += menuSymbols[i].name;
+      if (i < getMenuKeySymbolCount() - 1)
+        s += ", ";
+    }
+    return s;
+  }
+  
+  static int getMenuKeyCode() {
+    String menuKeyStr;
+    int menuKeyCode = KeyEvent.VK_F8;
+  
+    menuKeyStr = 
+      Configuration.global().getParam("menuKey").getValueStr();
+    for(int i = 0; i < getMenuKeySymbolCount(); i++)
+      if (menuSymbols[i].name.equals(menuKeyStr))
+        menuKeyCode = menuSymbols[i].keycode;
+  
+    return menuKeyCode;
+  }
+
+}
index 1be5ece822d894353e4345ef2500a03df0266ef4..afeaf2d76f693e79f4d499535a6b035e42028777 100644 (file)
@@ -132,9 +132,9 @@ class OptionsDialog extends Dialog implements
     sendClipboard = new JCheckBox("Send clipboard to server");
     sendClipboard.addItemListener(this);
     JLabel menuKeyLabel = new JLabel("Menu Key");
-    String[] menuKeys = new String[menukey.getMenuKeySymbolCount()]; 
-    for (int i = 0; i < menukey.getMenuKeySymbolCount(); i++)
-      menuKeys[i] = KeyEvent.getKeyText(menukey.getMenuKeySymbols()[i].keycode);
+    String[] menuKeys = new String[MenuKey.getMenuKeySymbolCount()]; 
+    for (int i = 0; i < MenuKey.getMenuKeySymbolCount(); i++)
+      menuKeys[i] = KeyEvent.getKeyText(MenuKey.getMenuKeySymbols()[i].keycode);
     menuKey  = new JComboBox(menuKeys);
     menuKey.addItemListener(this);
     addGBComponent(viewOnly,InputsPanel,        0, 0, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(4,5,0,5));
diff --git a/java/com/tigervnc/vncviewer/menukey.java b/java/com/tigervnc/vncviewer/menukey.java
deleted file mode 100644 (file)
index 10f1d10..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright 2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
- * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright 2012 Brian P. Hinz
- * 
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-package com.tigervnc.vncviewer;
-
-import java.awt.event.KeyEvent;
-
-import com.tigervnc.rfb.*;
-
-public class menukey 
-{
-  static class MenuKeySymbol {
-    public MenuKeySymbol(String name_, int keycode_) {
-      name = name_;
-      keycode = keycode_;
-    }
-    String name;
-    int keycode;
-  }
-
-  private static final MenuKeySymbol[] menuSymbols = {
-    new MenuKeySymbol("F1", KeyEvent.VK_F1),
-    new MenuKeySymbol("F2", KeyEvent.VK_F2),
-    new MenuKeySymbol("F3", KeyEvent.VK_F3),
-    new MenuKeySymbol("F4", KeyEvent.VK_F4),
-    new MenuKeySymbol("F5", KeyEvent.VK_F5),
-    new MenuKeySymbol("F6", KeyEvent.VK_F6),
-    new MenuKeySymbol("F7", KeyEvent.VK_F7),
-    new MenuKeySymbol("F8", KeyEvent.VK_F8),
-    new MenuKeySymbol("F9", KeyEvent.VK_F9),
-    new MenuKeySymbol("F10", KeyEvent.VK_F10),
-    new MenuKeySymbol("F11", KeyEvent.VK_F11),
-    new MenuKeySymbol("F12", KeyEvent.VK_F12),
-    new MenuKeySymbol("Pause", KeyEvent.VK_PAUSE),
-    new MenuKeySymbol("Print", KeyEvent.VK_PRINTSCREEN),
-    new MenuKeySymbol("Scroll_Lock", KeyEvent.VK_SCROLL_LOCK),
-    new MenuKeySymbol("Escape", KeyEvent.VK_ESCAPE),
-    new MenuKeySymbol("Insert", KeyEvent.VK_INSERT),
-    new MenuKeySymbol("Delete", KeyEvent.VK_DELETE),
-    new MenuKeySymbol("Home", KeyEvent.VK_HOME),
-    new MenuKeySymbol("Page_Up", KeyEvent.VK_PAGE_UP),
-    new MenuKeySymbol("Page_Down", KeyEvent.VK_PAGE_DOWN)
-  };
-  
-  static int getMenuKeySymbolCount()
-  {
-    return menuSymbols.length;
-  }
-  
-  public static MenuKeySymbol[] getMenuKeySymbols()
-  {
-    return menuSymbols;
-  }
-  
-  static int getMenuKeyCode()
-  {
-      String menuKeyStr;
-      int menuKeyCode = KeyEvent.VK_F8;
-  
-      menuKeyStr = 
-        Configuration.global().getParam("menuKey").getValueStr();
-      for(int i = 0; i < getMenuKeySymbolCount(); i++)
-        if (menuSymbols[i].name.equals(menuKeyStr))
-          menuKeyCode = menuSymbols[i].keycode;
-  
-      return menuKeyCode;
-  }
-
-}