optimize repaints
authoramwaterhouse <Andrew Waterhouse>
Thu, 3 May 2007 14:40:57 +0000 (14:40 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 3 May 2007 14:40:57 +0000 (14:40 +0000)
src/jalview/appletgui/AlignViewport.java
src/jalview/appletgui/AppletJmol.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AppJMol.java
src/jalview/gui/IdPanel.java

index 2996c98..3418270 100755 (executable)
@@ -276,7 +276,7 @@ public class AlignViewport
           {
             if (ap != null)
             {
-              ap.paintAlignment(true);
+              ap.paintAlignment(false);
             }
             Thread.sleep(200);
           }
@@ -454,7 +454,7 @@ public class AlignViewport
         {
           if (ap != null)
           {
-            ap.paintAlignment(true);
+            ap.paintAlignment(false);
           }
 
           Thread.sleep(200);
index 53115d2..538d177 100644 (file)
@@ -471,6 +471,7 @@ public class AppletJmol extends Frame
   }
 
   FeatureRenderer fr;
+  String lastCommand;
   public void colourBySequence(AlignmentPanel ap)
   {
     if(!colourBySequence)
@@ -482,7 +483,7 @@ public class AppletJmol extends Frame
     if (mapping.length < 1)
       return;
 
-    SequenceRenderer sr = ap.seqPanel.seqCanvas.getSequenceRenderer();
+    SequenceRenderer sr = new SequenceRenderer(ap.av);
 
     boolean showFeatures = false;
     if (ap.av.showSequenceFeatures)
@@ -549,7 +550,10 @@ public class AppletJmol extends Frame
       }
     }
 
-    viewer.evalStringQuiet(command.toString());
+    if (lastCommand != null && !lastCommand.equals(command.toString()))
+      viewer.evalStringQuiet(command.toString());
+
+    lastCommand = command.toString();
   }
 
   StringBuffer condenseCommand(String command, int pos)
index b68008a..cbb19fb 100755 (executable)
@@ -300,7 +300,7 @@ public class AlignViewport
             {
               if (ap != null)
               {
-              ap.paintAlignment(true);
+                ap.paintAlignment(false);
               }
               Thread.sleep(200);
             }
@@ -496,7 +496,7 @@ public class AlignViewport
           {
             if (ap != null)
             {
-            ap.paintAlignment(true);
+            ap.paintAlignment(false);
             }
 
             Thread.sleep(200);
@@ -1466,7 +1466,7 @@ public class AlignViewport
     }
 
     /**
-     * This method returns an array of new SequenceI objects 
+     * This method returns an array of new SequenceI objects
      * derived from the whole alignment or just the current
      * selection with start and end points adjusted
      * @note if you need references to the actual SequenceI objects in the alignment or currently selected then use getSequenceSelection()
@@ -1479,7 +1479,7 @@ public class AlignViewport
       if (selectionGroup == null)
     {
         sequences = alignment.getSequencesArray();
-        AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation(); 
+        AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
         for (int i=0; i<sequences.length; i++)
         {
           sequences[i] = new Sequence(sequences[i], annots); // construct new sequence with subset of visible annotation
index 3f2d895..d8ef11a 100644 (file)
@@ -396,7 +396,7 @@ public synchronized void addSequence(SequenceI [] seq)
   public void seqColour_actionPerformed(ActionEvent actionEvent)
   {
     colourBySequence = seqColour.isSelected();
-    colourBySequence(ap);
+    colourBySequence(ap.alignFrame.alignPanel);
   }
 
   public void chainColour_actionPerformed(ActionEvent actionEvent)
@@ -599,9 +599,17 @@ public synchronized void addSequence(SequenceI [] seq)
 //End StructureListener
 ////////////////////////////
 
+  String lastCommand;
   FeatureRenderer fr=null;
   public void colourBySequence(AlignmentPanel ap)
   {
+
+    if(ap.alignFrame.getCurrentView()!=ap.av)
+    {
+      System.out.println("RETURN");
+      return;
+    }
+
     if(!colourBySequence)
       return;
 
@@ -611,7 +619,7 @@ public synchronized void addSequence(SequenceI [] seq)
     if (mapping.length < 1)
       return;
 
-    SequenceRenderer sr = ap.seqPanel.seqCanvas.getSequenceRenderer();
+    SequenceRenderer sr = new SequenceRenderer(ap.av);
 
     boolean showFeatures = false;
 
@@ -679,7 +687,11 @@ public synchronized void addSequence(SequenceI [] seq)
       }
     }
 
-    viewer.evalStringQuiet(command.toString());
+    if (lastCommand != null && !lastCommand.equals(command.toString()))
+    {
+      viewer.evalStringQuiet(command.toString());
+    }
+    lastCommand = command.toString();
   }
 
   StringBuffer condenseCommand(StringBuffer command, int pos)
index d80c4b8..e6c3009 100755 (executable)
@@ -421,7 +421,7 @@ public class IdPanel
           running = false;\r
         }\r
 \r
-        alignPanel.paintAlignment(true);\r
+        alignPanel.paintAlignment(false);\r
 \r
         try\r
         {\r