From e2b36c74f66364df200d911fa36c2ec4a541b529 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 15 Aug 2006 10:34:29 +0000 Subject: [PATCH] Add key listener to scalePanel and annotationPanel --- src/jalview/appletgui/AlignFrame.java | 49 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index eb6fe49..08cbb9a 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -110,6 +110,8 @@ public class AlignFrame extends Frame implements ActionListener, this.addKeyListener(this); alignPanel.seqPanel.seqCanvas.addKeyListener(this); alignPanel.idPanel.idCanvas.addKeyListener(this); + alignPanel.scalePanel.addKeyListener(this); + alignPanel.annotationPanel.addKeyListener(this); viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @@ -327,6 +329,28 @@ public class AlignFrame extends Frame implements ActionListener, findMenuItem_actionPerformed(); } break; + case KeyEvent.VK_H: + { + SequenceGroup sg = viewport.getSelectionGroup(); + if (sg != null && sg.getSize(false) != viewport.alignment.getHeight()) + { + hideSelectedSeqs(); + } + else + viewport.showAllHiddenSeqs(); + + if (viewport.colSel.getSelected().size() > 0) + { + viewport.hideSelectedColumns(); + } + else + { + viewport.showAllHiddenColumns(); + } + alignPanel.repaint(); + break; + } + } } public void keyReleased(KeyEvent evt) @@ -442,16 +466,7 @@ public void itemStateChanged(ItemEvent evt) } else if(source == hideSequences && viewport.getSelectionGroup()!=null) { - SequenceI[] seqs = viewport.getSelectionGroup().getSequencesInOrder( - viewport.alignment - ); - - for (int i = 0; i < seqs.length; i++) - { - viewport.hideSequence(seqs[i]); - } - - alignPanel.repaint(); + hideSelectedSeqs(); } else if(source==featureSettings) featureSettings_actionPerformed(); @@ -1257,6 +1272,20 @@ public void itemStateChanged(ItemEvent evt) alignPanel.repaint(); } + void hideSelectedSeqs() + { + SequenceI[] seqs = viewport.getSelectionGroup().getSequencesInOrder( + viewport.alignment + ); + + for (int i = 0; i < seqs.length; i++) + { + viewport.hideSequence(seqs[i]); + } + + alignPanel.repaint(); + } + protected void scaleAbove_actionPerformed() { viewport.setScaleAboveWrapped(scaleAbove.getState()); -- 1.7.10.2