If alignment is closed, then undo performed in visible window
[jalview.git] / src / jalview / gui / AlignViewport.java
index 7c3279e..358d00d 100755 (executable)
@@ -109,6 +109,18 @@ public class AlignViewport
 
     boolean gatherViewsHere = false;
 
+    Stack historyList = new Stack();
+    Stack redoList = new Stack();
+
+    Hashtable sequenceColours;
+
+    int thresholdTextColour = 0;
+    Color textColour = Color.black;
+    Color textColour2 = Color.white;
+
+    boolean rightAlignIds = false;
+
+
     /**
      * Creates a new AlignViewport object.
      *
@@ -146,6 +158,8 @@ public class AlignViewport
       showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);
       showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);
 
+      rightAlignIds = Cache.getDefault("RIGHT_ALIGN_IDS", false);
+
       autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
 
       padGaps = Cache.getDefault("PAD_GAPS", true);
@@ -231,6 +245,8 @@ public class AlignViewport
                 globalColourScheme.setConsensus(hconsensus);
             }
         }
+
+        wrapAlignment = jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false);
     }
 
 
@@ -1531,10 +1547,25 @@ public class AlignViewport
           updateConservation(ap);
         }
 
+        //Reset endRes of groups if beyond alignment width
+        int alWidth = alignment.getWidth();
+        Vector groups = alignment.getGroups();
+        if(groups!=null)
+        {
+          for(int i=0; i<groups.size(); i++)
+          {
+            SequenceGroup sg = (SequenceGroup)groups.elementAt(i);
+            if(sg.getEndRes()>alWidth)
+              sg.setEndRes(alWidth-1);
+          }
+        }
+
+        if(selectionGroup!=null && selectionGroup.getEndRes()>alWidth)
+          selectionGroup.setEndRes(alWidth-1);
+
         resetAllColourSchemes();
 
         alignment.adjustSequenceAnnotations();
-
     }
 
 
@@ -1579,5 +1610,24 @@ public class AlignViewport
     }
 
 
+    public Color getSequenceColour(SequenceI seq)
+    {
+      if(sequenceColours==null || !sequenceColours.containsKey(seq))
+        return Color.white;
+      else
+        return (Color)sequenceColours.get(seq);
+    }
+
+    public void setSequenceColour(SequenceI seq, Color col)
+    {
+      if(sequenceColours==null)
+        sequenceColours = new Hashtable();
+
+      if(col == null)
+        sequenceColours.remove(seq);
+      else
+        sequenceColours.put(seq, col);
+    }
+
 
 }