X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=f386bf323d75a45aef6eb924dc0d6ca7e7a58895;hb=c16d6b192b294503d2bd16294454cfe136426e7d;hp=fd1fa7d992089a066fec858fff415cce7c7f5747;hpb=bdffa0f9868c4600039b0aadea11d4f0bebcac69;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index fd1fa7d..f386bf3 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -2177,5 +2177,29 @@ public class AlignViewport implements SelectionSource { return this.showConsensusHistogram; } - + /** + * synthesize a column selection if none exists so it covers the given selection group. + * if wholewidth is false, no column selection is made if the selection group covers the whole alignment width. + * @param sg + * @param wholewidth + */ + public void expandColSelection(SequenceGroup sg, boolean wholewidth) + { + int sgs,sge; + if (sg!=null && (sgs=sg.getStartRes())>=0 && sg.getStartRes()<=(sge=sg.getEndRes())&& (colSel==null || colSel.getSelected()==null || colSel.getSelected().size()==0)) + { + if (!wholewidth && alignment.getWidth()==(1+sge-sgs)) + { + // do nothing + return; + } + if (colSel==null) + { + colSel = new ColumnSelection(); + } + for (int cspos = sg.getStartRes(); cspos<=sg.getEndRes(); cspos++) { + colSel.addElement(cspos); + } + } + } }