From 1efa38acf4e8102bf4e64b08005f8dc21bdd0145 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 8 May 2007 10:58:23 +0000 Subject: [PATCH 1/1] instant update when seq colour is pressed --- src/jalview/appletgui/AppletJmol.java | 28 ++++++++++++++++------------ src/jalview/gui/AppJmol.java | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 6e2047b..f64014b 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -354,6 +354,7 @@ public class AppletJmol extends Frame { if (evt.getSource() == seqColour) { + lastCommand = null; colourBySequence = seqColour.getState(); colourBySequence(ap); } @@ -467,13 +468,14 @@ public class AppletJmol extends Frame return new Color(viewer.getAtomArgb(atomIndex)); } - FeatureRenderer fr; String lastCommand; - public void colourBySequence(AlignmentPanel ap) + FeatureRenderer fr=null; + public void colourBySequence(AlignmentPanel sourceap) { - if(!colourBySequence) - return; + this.ap = sourceap; + if (!colourBySequence) + return; StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile()); @@ -483,6 +485,7 @@ public class AppletJmol extends Frame SequenceRenderer sr = new SequenceRenderer(ap.av); boolean showFeatures = false; + if (ap.av.showSequenceFeatures) { showFeatures = true; @@ -502,14 +505,14 @@ public class AppletJmol extends Frame for (int m = 0; m < mapping.length; m++) { if (mapping[m].getSequence() == sequence[s] - && ap.av.alignment.findIndex(sequence[s])>-1) + && ap.av.alignment.findIndex(sequence[s]) > -1) { for (int r = 0; r < sequence[s].getLength(); r++) { int pos = mapping[m].getPDBResNum( sequence[s].findPosition(r)); - if (pos < 1 || pos==lastPos) + if (pos < 1 || pos == lastPos) continue; lastPos = pos; @@ -519,7 +522,7 @@ public class AppletJmol extends Frame if (showFeatures) col = fr.findFeatureColour(col, sequence[s], r); - if (command.toString().endsWith(":" + mapping[m].getChain()+ + if (command.toString().endsWith(":" + mapping[m].getChain() + ";color[" + col.getRed() + "," + col.getGreen() + "," @@ -537,10 +540,9 @@ public class AppletJmol extends Frame } command.append(";color[" - + col.getRed() + "," - + col.getGreen() + "," - + col.getBlue() + "]"); - + + col.getRed() + "," + + col.getGreen() + "," + + col.getBlue() + "]"); } break; } @@ -548,11 +550,13 @@ public class AppletJmol extends Frame } if (lastCommand == null || !lastCommand.equals(command.toString())) + { viewer.evalStringQuiet(command.toString()); - + } lastCommand = command.toString(); } + StringBuffer condenseCommand(String command, int pos) { diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index ab03d10..c082463 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -413,6 +413,7 @@ public synchronized void addSequence(SequenceI [] seq) public void seqColour_actionPerformed(ActionEvent actionEvent) { + lastCommand = null; colourBySequence = seqColour.isSelected(); colourBySequence(ap.alignFrame.alignPanel); } -- 1.7.10.2