Dont change ap font from treePanel
[jalview.git] / src / jalview / gui / AlignViewport.java
index 0161517..fb2047e 100755 (executable)
@@ -112,6 +112,15 @@ public class AlignViewport
     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.
      *
@@ -149,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);
@@ -1335,15 +1346,17 @@ public class AlignViewport
 
     public void invertColumnSelection()
     {
-      int column;
       for(int i=0; i<alignment.getWidth(); i++)
       {
-        column = i;
-
-        if(colSel.contains(column))
-          colSel.removeElement(column);
+        if(colSel.contains(i))
+          colSel.removeElement(i);
         else
-          colSel.addElement(column);
+        {
+          if (!hasHiddenColumns || colSel.isVisible(i))
+          {
+            colSel.addElement(i);
+          }
+        }
 
       }
 
@@ -1536,6 +1549,22 @@ 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();
@@ -1583,5 +1612,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);
+    }
+
 
 }