From 2794d58ed2b048de8cad254bea750f69d859240d Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 17 Aug 2006 10:08:02 +0000 Subject: [PATCH] Control and alt for toggle hide --- src/jalview/appletgui/AlignFrame.java | 29 ++++++++++++++++++---------- src/jalview/gui/AlignmentPanel.java | 34 ++++++++++++++++++++------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 64423b0..0c7f5d1 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -331,20 +331,29 @@ public class AlignFrame extends Frame implements ActionListener, break; case KeyEvent.VK_H: { - SequenceGroup sg = viewport.getSelectionGroup(); + boolean toggleSeqs = !evt.isControlDown(); + boolean toggleCols = !evt.isAltDown(); boolean hide = false; - if (sg != null && sg.getSize(false) != viewport.alignment.getHeight()) + SequenceGroup sg = viewport.getSelectionGroup(); + + if(toggleSeqs) { - hide = true; - viewport.hideAllSelectedSeqs(); + if (sg != null && sg.getSize(false) != viewport.alignment.getHeight()) + { + hide = true; + viewport.hideAllSelectedSeqs(); + } + else + viewport.showAllHiddenSeqs(); } - else if (viewport.colSel.getSelected().size() < 1) - viewport.showAllHiddenSeqs(); - if (viewport.colSel.getSelected().size() > 0) - viewport.hideSelectedColumns(); - else if (!hide) - viewport.showAllHiddenColumns(); + if(toggleCols) + { + if (viewport.colSel.getSelected().size() > 0) + viewport.hideSelectedColumns(); + else if (!hide) + viewport.showAllHiddenColumns(); + } alignPanel.repaint(); break; diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index c0de33e..f7cc054 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -237,21 +237,29 @@ public class AlignmentPanel extends GAlignmentPanel break; case KeyEvent.VK_H: { - SequenceGroup sg = av.getSelectionGroup(); + boolean toggleSeqs = !evt.isControlDown(); + boolean toggleCols = !evt.isAltDown(); boolean hide = false; - if(sg!=null && sg.getSize(false)!=av.alignment.getHeight()) - { - hide = true; - alignFrame.hideSelSequences_actionPerformed(null); - } - else if(av.colSel.getSelected().size()<1) - alignFrame.showAllSeqs_actionPerformed(null); - - if(av.colSel.getSelected().size()>0) - alignFrame.hideSelColumns_actionPerformed(null); - else if(!hide) - alignFrame.showAllColumns_actionPerformed(null); + SequenceGroup sg = av.getSelectionGroup(); + if(toggleSeqs) + { + if(sg != null && sg.getSize(false) != av.alignment.getHeight()) + { + alignFrame.hideSelSequences_actionPerformed(null); + hide = true; + } + else + alignFrame.showAllSeqs_actionPerformed(null); + } + + if (toggleCols) + { + if(av.colSel.getSelected().size() > 0) + alignFrame.hideSelColumns_actionPerformed(null); + else if(!hide) + alignFrame.showAllColumns_actionPerformed(null); + } break; } -- 1.7.10.2