apply version 2.7 copyright
[jalview.git] / src / jalview / gui / SeqPanel.java
old mode 100755 (executable)
new mode 100644 (file)
index d176b86..ca5d7f7
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -33,7 +33,7 @@ import jalview.structure.*;
  * DOCUMENT ME!
  * 
  * @author $author$
- * @version $Revision$
+ * @version $Revision: 1.130 $
  */
 public class SeqPanel extends JPanel implements MouseListener,
         MouseMotionListener, MouseWheelListener, SequenceListener,
@@ -123,7 +123,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       addMouseMotionListener(this);
       addMouseListener(this);
       addMouseWheelListener(this);
-      ssm = StructureSelectionManager.getStructureSelectionManager();
+      ssm = StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
       ssm.addStructureViewerListener(this);
       ssm.addSelectionListener(this);
     }
@@ -811,17 +811,20 @@ public class SeqPanel extends JPanel implements MouseListener,
                             .getType()))
             {
               tmpString = features[i].getDescription();
-              int startTag = tmpString.toUpperCase().indexOf("<HTML>");
+              String tmp2up=tmpString.toUpperCase();
+              int startTag = tmp2up.indexOf("<HTML>");
               if (startTag > -1)
               {
                 tmpString = tmpString.substring(startTag + 6);
+                tmp2up = tmp2up.substring(startTag+6);
               }
-              int endTag = tmpString.toUpperCase().indexOf("</BODY>");
+              int endTag = tmp2up.indexOf("</BODY>");
               if (endTag > -1)
               {
                 tmpString = tmpString.substring(0, endTag);
+                tmp2up = tmp2up.substring(0, endTag);
               }
-              endTag = tmpString.toUpperCase().indexOf("</HTML>");
+              endTag = tmp2up.indexOf("</HTML>");
               if (endTag > -1)
               {
                 tmpString = tmpString.substring(0, endTag);
@@ -1882,6 +1885,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     // shared between viewports.
     if (av == source
             || !av.followSelection
+            || (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
             || (source instanceof AlignViewport && ((AlignViewport) source)
                     .getSequenceSetId().equals(av.getSequenceSetId())))
     {
@@ -1892,7 +1896,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     // rules are: colsel is copied if there is a real intersection between
     // sequence selection
     boolean repaint = false, copycolsel = true;
-    if (av.selectionGroup == null || !av.isSelectionGroupChanged())
+    // if (!av.isSelectionGroupChanged(false))
     {
       SequenceGroup sgroup = null;
       if (seqsel != null && seqsel.getSize()>0)
@@ -1907,7 +1911,7 @@ public class SeqPanel extends JPanel implements MouseListener,
         sgroup = seqsel.intersect(av.alignment,
                 (av.hasHiddenRows) ? av.hiddenRepSequences : null);
         if ((sgroup == null || sgroup.getSize() == 0)
-                && (colsel == null || colsel.size() == 0))
+                || (colsel == null || colsel.size() == 0))
         {
           // don't copy columns if the region didn't intersect.
           copycolsel = false;
@@ -1921,9 +1925,10 @@ public class SeqPanel extends JPanel implements MouseListener,
       {
         av.setSelectionGroup(null);
       }
-      repaint = av.isSelectionGroupChanged();
+      av.isSelectionGroupChanged(true);
+      repaint = true;
     }
-    if (copycolsel && (av.colSel == null || !av.isColSelChanged()))
+    if (copycolsel)
     {
       // the current selection is unset or from a previous message
       // so import the new colsel.
@@ -1932,6 +1937,7 @@ public class SeqPanel extends JPanel implements MouseListener,
         if (av.colSel != null)
         {
           av.colSel.clear();
+          repaint=true;
         }
       }
       else
@@ -1946,7 +1952,8 @@ public class SeqPanel extends JPanel implements MouseListener,
           av.colSel.setElementsFrom(colsel);
         }
       }
-      repaint |= av.isColSelChanged();
+      av.isColSelChanged(true);
+      repaint = true;
     }
     if (copycolsel && av.hasHiddenColumns
             && (av.colSel == null || av.colSel.getHiddenColumns() == null))