From: amwaterhouse Date: Wed, 23 Mar 2005 16:27:38 +0000 (+0000) Subject: adjustForRemoveLeft / Right added X-Git-Tag: Release_2_0~514 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=39d42f25edeb526275d178e0259e767e7c29bd78;p=jalview.git adjustForRemoveLeft / Right added --- diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 4c6420c..0cf954b 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -47,6 +47,43 @@ public class SequenceGroup endRes = end; } + public boolean adjustForRemoveLeft(int col) + { + // return value is true if the group still exists + if(startRes>=col) + startRes = startRes - col; + if(endRes>=col) + { + endRes = endRes - col; + if(startRes>endRes) + startRes = 0; + } + else + { + // must delete this group!! + return false; + } + + return true; + } + + public boolean adjustForRemoveRight(int col) + { + + if(startRes>col) + { + // delete this group + return false; + } + + if(endRes>=col) + endRes = col; + + + return true; + } + + public String getName() { return groupName; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 7071d81..00961d6 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -462,6 +462,18 @@ public class AlignFrame extends GAlignFrame int min = colSel.getMin(); viewport.getAlignment().trimLeft(min); colSel.compensateForEdit(0,min); + + if(viewport.getSelectionGroup()!=null) + viewport.getSelectionGroup().adjustForRemoveLeft(min); + + Vector groups = viewport.alignment.getGroups(); + for(int i=0; i 0) { int max = colSel.getMax(); - if(max>1) - viewport.getAlignment().trimRight(max); + viewport.getAlignment().trimRight(max); + if(viewport.getSelectionGroup()!=null) + viewport.getSelectionGroup().adjustForRemoveRight(max); + + Vector groups = viewport.alignment.getGroups(); + for(int i=0; i