From e88632fe0e6a74b1a9519cf9e58e769ad406e066 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 26 Jan 2007 17:30:23 +0000 Subject: [PATCH] Adjusts annotations for sequence edits --- src/jalview/commands/EditCommand.java | 108 +++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 39 deletions(-) diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index ed356dc..0c833d0 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -179,10 +179,7 @@ public class EditCommand implements CommandI command.gapChar); } - if (command.fullAlignmentHeight) - { - adjustAnnotations(command, true); - } + adjustAnnotations(command, true); } void deleteGap(Edit command) @@ -192,10 +189,7 @@ public class EditCommand implements CommandI command.seqs[s].deleteChars(command.position, command.position+command.number); } - if (command.fullAlignmentHeight) - { - adjustAnnotations(command, false); - } + adjustAnnotations(command, false); } void cut(Edit command) @@ -219,11 +213,7 @@ public class EditCommand implements CommandI } } - if (command.fullAlignmentHeight) - { - adjustAnnotations(command, false); - } - + adjustAnnotations(command, false); } void paste(Edit command) @@ -263,10 +253,8 @@ public class EditCommand implements CommandI command.seqs[i].setSequence(tmp.toString()); } - if (command.fullAlignmentHeight) - { - adjustAnnotations(command, true); - } + + adjustAnnotations(command, true); command.string = null; } @@ -274,9 +262,46 @@ public class EditCommand implements CommandI void adjustAnnotations(Edit command, boolean insert) { - AlignmentAnnotation [] annotations = command.al.getAlignmentAnnotation(); - if(annotations!=null) + + AlignmentAnnotation [] annotations = null; + + if (command.fullAlignmentHeight) + { + annotations = command.al.getAlignmentAnnotation(); + } + else { + int aSize = 0; + AlignmentAnnotation [] tmp; + for(int s=0; s