viewport.hasHiddenColumns updated after undo/redo performed
authoramwaterhouse <Andrew Waterhouse>
Wed, 25 Oct 2006 14:03:43 +0000 (14:03 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 25 Oct 2006 14:03:43 +0000 (14:03 +0000)
src/jalview/gui/AlignFrame.java

index 260085d..4687b3c 100755 (executable)
@@ -857,6 +857,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
     historyList.push(command);
     redoList.clear();
     updateEditMenuBar();
+
+    viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null;
   }
 
 
@@ -878,6 +880,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
    // if (hi.alColumnChanges!=null)
    //   nh.alColumnChanges = hi.alColumnChanges.getInverse();
    // restoreHistoryItem(hi);
+   viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null;
    updateEditMenuBar();
     viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
   }
@@ -892,6 +895,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
     CommandI command = (CommandI) redoList.pop();
     historyList.push(command);
     command.doCommand();
+    viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null;
 
    // HistoryItem nh,hi = (HistoryItem) redoList.pop();
   //  historyList.push(nh=new HistoryItem(hi.getDescription(), viewport.alignment,
@@ -1461,7 +1465,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
 
 
       TrimRegionCommand trimRegion;
-
       if(trimLeft)
       {
         trimRegion = new TrimRegionCommand("Remove Left",
@@ -1469,30 +1472,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
                                     seqs,
                                     column,
                                     viewport.alignment,
-                                    viewport.colSel);
-
-        colSel.compensateForEdit(0, column);
-
-        //AW edit.addShift(0,min);
-        if (viewport.getSelectionGroup() != null)
-        {
-          viewport.getSelectionGroup().adjustForRemoveLeft(column);
-        }
+                                    viewport.colSel,
+                                    viewport.selectionGroup);
       }
      else
      {
-       trimRegion = new TrimRegionCommand("Remove Left",
+       trimRegion = new TrimRegionCommand("Remove Right",
                                    TrimRegionCommand.TRIM_RIGHT,
                                    seqs,
                                    column,
                                    viewport.alignment,
-                                   viewport.colSel);
-       // TODO: delete hidden column entries in colSel to right of max
-       // TODO: record hidden columns in history for undo.
-       if (viewport.getSelectionGroup() != null)
-       {
-         viewport.getSelectionGroup().adjustForRemoveRight(column);
-       }
+                                   viewport.colSel,
+                                   viewport.selectionGroup);
      }
 
       addHistoryItem(trimRegion);
@@ -2602,7 +2593,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener
         AlignmentSorter.sortByTree(viewport.getAlignment(),
                                    treePanel.getTree());
 
-        addHistoryItem(new OrderCommand("Tree Sort", oldOrder, viewport.alignment));
+        addHistoryItem(new OrderCommand("Tree Sort",
+                                        oldOrder,
+                                        viewport.alignment));
 
 
         alignPanel.repaint();