X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FTrimRegionCommand.java;h=a61d4910c8e7f306d60e15202df18903f94ace8f;hb=a790ec56ce1c4b2eafbfdef7b067283e9a114d27;hp=8ada376dc57ce8d0119188c940e5eca9bc081d9e;hpb=ebb678af128304dc13e1b6ec9e0961489bf83d39;p=jalview.git diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java index 8ada376..a61d491 100644 --- a/src/jalview/commands/TrimRegionCommand.java +++ b/src/jalview/commands/TrimRegionCommand.java @@ -1,109 +1,172 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.commands; - -import jalview.util.ShiftList; - -import jalview.datamodel.*; - -public class TrimRegionCommand - extends EditCommand -{ - public static String TRIM_LEFT = "TrimLeft"; - public static String TRIM_RIGHT = "TrimRight"; - - public ColumnSelection colSel = null; - - int [] start; - - public TrimRegionCommand(String description, - String command, - SequenceI[] seqs, - int column, - AlignmentI al, - ColumnSelection colSel) - { - this.description = description; - if (command.equalsIgnoreCase(TRIM_LEFT)) - { - edits = new Edit[] { new Edit(CUT, seqs, 0, column, al)}; - this.colSel = colSel; - } - else if (command.equalsIgnoreCase(TRIM_RIGHT)) - { - edits = new Edit[] - { new Edit(CUT, seqs, column+1, al.getWidth() - column, al)}; - } - - //We need to keep a record of the sequence start - //in order to restore the state after a redo - int i, isize = edits[0].seqs.length; - start = new int[isize]; - for(i=0; i