primitive methods for getting current undo/redo state and comparing with another...
[jalview.git] / src / MCview / AppletPDBCanvas.java
index 47aa94b..73ed7a7 100755 (executable)
@@ -83,6 +83,7 @@ public class AppletPDBCanvas
 
   public AppletPDBCanvas(PDBEntry pdbentry,
                          SequenceI[] seq,
+                         String [] chains,
                          AlignmentPanel ap,
                          String protocol)
 
@@ -94,7 +95,7 @@ public class AppletPDBCanvas
     ssm = StructureSelectionManager.getStructureSelectionManager();
 
     try{
-      pdb = ssm.setMapping(seq, pdbentry.getFile(), protocol);
+      pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
 
       if(protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
        pdbentry.setFile("INLINE"+pdb.id);
@@ -117,7 +118,6 @@ public class AppletPDBCanvas
     int pdbend = 0;
     int seqstart = 0;
     int seqend = 0;
-    AlignSeq maxAlignseq = null;
 
     //JUST DEAL WITH ONE SEQUENCE FOR NOW
     SequenceI sequence = seq[0];
@@ -164,8 +164,7 @@ public class AppletPDBCanvas
         pdbend = as.seq2end;
         seqstart = as.seq1start + sequence.getStart() - 1;
         seqend = as.seq1end + sequence.getEnd() - 1;
-        maxAlignseq = as;
-      }
+       }
 
       mappingDetails.append("\nPDB start/end " + pdbstart + " " + pdbend);
       mappingDetails.append("\nSEQ start/end " + seqstart + " " + seqend);
@@ -497,7 +496,7 @@ public class AppletPDBCanvas
   // Applet and Application specific sequence renderers to be used
   void colourBySequence()
   {
-    SequenceRenderer sr = ap.getSequenceRenderer();
+    SequenceRenderer sr = new SequenceRenderer(ap.av);
 
     StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile());
 
@@ -590,12 +589,12 @@ public class AppletPDBCanvas
 
       xstart = (int) ( ( (tmpBond.start[0] - centre[0]) * scale) +
                       (getSize().width / 2));
-      ystart = (int) ( ( (tmpBond.start[1] - centre[1]) * scale) +
+      ystart = (int) ( ( (centre[1] - tmpBond.start[1] ) * scale) +
                       (getSize().height / 2));
 
       xend = (int) ( ( (tmpBond.end[0] - centre[0]) * scale) +
                     (getSize().width / 2));
-      yend = (int) ( ( (tmpBond.end[1] - centre[1]) * scale) +
+      yend = (int) ( ( (centre[1] - tmpBond.end[1] ) * scale) +
                     (getSize().height / 2));
 
       xmid = (xend + xstart) / 2;
@@ -835,7 +834,7 @@ public class AppletPDBCanvas
     }
     else
     {
-      objmat.rotatex( (float) ( (my - omy)));
+      objmat.rotatex( (float) ( (omy - my)));
       objmat.rotatey( (float) ( (omx - mx)));
     }
 
@@ -916,7 +915,7 @@ public class AppletPDBCanvas
     {
       int xstart = (int) ( ( (b.start[0] - centre[0]) * scale) +
                           (getSize().width / 2));
-      int ystart = (int) ( ( (b.start[1] - centre[1]) * scale) +
+      int ystart = (int) ( ( (centre[1] - b.start[1]) * scale) +
                           (getSize().height / 2));
 
       g.setColor(Color.red);
@@ -927,7 +926,7 @@ public class AppletPDBCanvas
     {
       int xstart = (int) ( ( (b.end[0] - centre[0]) * scale) +
                           (getSize().width / 2));
-      int ystart = (int) ( ( (b.end[1] - centre[1]) * scale) +
+      int ystart = (int) ( ( (centre[1] - b.end[1]) * scale) +
                           (getSize().height / 2));
 
       g.setColor(Color.red);
@@ -961,7 +960,7 @@ public class AppletPDBCanvas
 
           if (Math.abs(truex - x) <= 2)
           {
-            int truey = (int) ( ( (tmpBond.start[1] - centre[1]) * scale) +
+            int truey = (int) ( ( (centre[1] - tmpBond.start[1] ) * scale) +
                                (getSize().height / 2));
 
             if (Math.abs(truey - y) <= 2)
@@ -1077,7 +1076,7 @@ public class AppletPDBCanvas
   ///StructureListener
   public String getPdbFile()
   {
-    return "???";
+    return pdbentry.getFile();
   }
 
 
@@ -1158,7 +1157,6 @@ public class AppletPDBCanvas
 
   public void updateColours(Object source)
   {
-    AlignmentPanel ap = (AlignmentPanel) source;
     colourBySequence();
     redrawneeded = true;
     repaint();