From 4e2f6c0857eff90e30d4b64540ce4b7265053bc9 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 17 Sep 2018 09:29:19 +0100 Subject: [PATCH] JAL-345 add to AlignViewController API and define a keystroke listener following same modifiers as select highlighted columns --- src/jalview/api/AlignViewControllerI.java | 19 +++++++++++++++++++ src/jalview/controller/AlignViewController.java | 18 ++---------------- src/jalview/gui/AlignFrame.java | 11 +++++++++++ 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/jalview/api/AlignViewControllerI.java b/src/jalview/api/AlignViewControllerI.java index a7ec69e..ef3df15 100644 --- a/src/jalview/api/AlignViewControllerI.java +++ b/src/jalview/api/AlignViewControllerI.java @@ -111,4 +111,23 @@ public interface AlignViewControllerI boolean markHighlightedColumns(boolean invert, boolean extendCurrent, boolean toggle); + /** + * + * Add highlighted sequences to selected rows. Exclude highlighted sequences + * from selected rows. toggle inclusion or exclusion of highlighted sequences. + * or add/exclude/toggle for sequences not highlighted. + * + * @param invert + * - when true, sequences that are not highlighted are added/removed + * from selection + * @param extendCurrent + * - normally true , the current selected group is modified. + * Otherwise a new selection is created + * @param toggle + * - toggle selection status for highlighted/not highlighted sequence + * @return + */ + boolean selectHighlightedSequences(boolean invert, boolean extendCurrent, + boolean toggle); + } diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index aac7801..38d04e2 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -385,22 +385,8 @@ public class AlignViewController implements AlignViewControllerI } - /** - * - * Add highlighted sequences to selected rows. Exclude highlighted sequences - * from selected rows. toggle inclusion or exclusion of highlighted sequences. - * or add/exclude/toggle for sequences not highlighted. - * - * @param invert - * - when true, sequences that are not highlighted are added/removed - * from selection - * @param extendCurrent - * - normally true , the current selected group is modified. - * Otherwise a new selection is created - * @param toggle - * - toggle selection status for highlighted/not highlighted sequence - * @return - */ + + @Override public boolean selectHighlightedSequences(boolean invert, boolean extendCurrent, boolean toggle) { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 0fdc9f0..54e9955 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -687,6 +687,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, toggleSel); break; } + case KeyEvent.VK_K: + { + boolean toggleSel = evt.isControlDown() || evt.isMetaDown(); + boolean modifyExisting = true; // always modify, don't clear + // evt.isShiftDown(); + boolean invertHighlighted = evt.isAltDown(); + avc.selectHighlightedSequences(invertHighlighted, modifyExisting, + toggleSel); + break; + } + case KeyEvent.VK_PAGE_UP: viewport.getRanges().pageUp(); break; -- 1.7.10.2