Add key listener to scalePanel and annotationPanel
authoramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:34:29 +0000 (10:34 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:34:29 +0000 (10:34 +0000)
src/jalview/appletgui/AlignFrame.java

index eb6fe49..08cbb9a 100755 (executable)
@@ -110,6 +110,8 @@ public class AlignFrame extends Frame implements ActionListener,
    this.addKeyListener(this);\r
    alignPanel.seqPanel.seqCanvas.addKeyListener(this);\r
    alignPanel.idPanel.idCanvas.addKeyListener(this);\r
+   alignPanel.scalePanel.addKeyListener(this);\r
+   alignPanel.annotationPanel.addKeyListener(this);\r
 \r
     viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener()\r
     {\r
@@ -327,6 +329,28 @@ public class AlignFrame extends Frame implements ActionListener,
           findMenuItem_actionPerformed();\r
         }\r
         break;\r
+      case KeyEvent.VK_H:\r
+      {\r
+        SequenceGroup sg = viewport.getSelectionGroup();\r
+        if (sg != null && sg.getSize(false) != viewport.alignment.getHeight())\r
+        {\r
+          hideSelectedSeqs();\r
+        }\r
+        else\r
+          viewport.showAllHiddenSeqs();\r
+\r
+        if (viewport.colSel.getSelected().size() > 0)\r
+        {\r
+          viewport.hideSelectedColumns();\r
+        }\r
+        else\r
+         {\r
+           viewport.showAllHiddenColumns();\r
+         }\r
+        alignPanel.repaint();\r
+        break;\r
+      }\r
+\r
     }\r
   }\r
   public void keyReleased(KeyEvent evt)\r
@@ -442,16 +466,7 @@ public void itemStateChanged(ItemEvent evt)
     }\r
     else if(source == hideSequences && viewport.getSelectionGroup()!=null)\r
     {\r
-      SequenceI[] seqs = viewport.getSelectionGroup().getSequencesInOrder(\r
-          viewport.alignment\r
-          );\r
-\r
-      for (int i = 0; i < seqs.length; i++)\r
-      {\r
-        viewport.hideSequence(seqs[i]);\r
-      }\r
-\r
-      alignPanel.repaint();\r
+      hideSelectedSeqs();\r
     }\r
     else if(source==featureSettings)\r
             featureSettings_actionPerformed();\r
@@ -1257,6 +1272,20 @@ public void itemStateChanged(ItemEvent evt)
     alignPanel.repaint();\r
   }\r
 \r
+  void hideSelectedSeqs()\r
+  {\r
+    SequenceI[] seqs = viewport.getSelectionGroup().getSequencesInOrder(\r
+        viewport.alignment\r
+        );\r
+\r
+    for (int i = 0; i < seqs.length; i++)\r
+    {\r
+      viewport.hideSequence(seqs[i]);\r
+    }\r
+\r
+    alignPanel.repaint();\r
+  }\r
+\r
   protected void scaleAbove_actionPerformed()\r
   {\r
     viewport.setScaleAboveWrapped(scaleAbove.getState());\r