X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=8146be0314bd1be23d4188153ce7c6111886cd20;hb=e1124a62486322d2d28482529d2d6b850ce1719b;hp=444b6bbb0f4bc6cf0104a468ec2add8689984497;hpb=019042a9f87d94260b3060cdf45ab93ca714a46d;p=jalview.git diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 444b6bb..8146be0 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -203,6 +203,8 @@ public class SeqPanel extends JPanel }); } + int startWrapBlock=-1; + int wrappedBlock=-1; int findRes(MouseEvent evt) { int res = 0; @@ -216,10 +218,10 @@ public class SeqPanel extends JPanel int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight; int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth()); - int block = y/chunkHeight; - block += av.getStartRes()/cwidth; + wrappedBlock = y/chunkHeight; + wrappedBlock += av.getStartRes()/cwidth; - res = block*cwidth + x / av.getCharWidth(); + res = wrappedBlock*cwidth + x / av.getCharWidth(); } else { @@ -284,6 +286,9 @@ public class SeqPanel extends JPanel int seq = findSeq(evt); int res = findRes(evt); + if(seq<0 || res<0) + return; + if ((seq < av.getAlignment().getHeight()) && (res < av.getAlignment().getSequenceAt(seq).getLength())) { @@ -580,97 +585,8 @@ public class SeqPanel extends JPanel ap.alignFrame.updateEditMenuBar(); } - av.updateConservation(); - av.updateConsensus(); - - //Does the edit affect any groups? - ////////////////////////////// - Vector groupsToUpdate = new Vector(); - SequenceGroup sg = av.getSelectionGroup(); - - int s, g, gSize = av.alignment.getGroups().size(); - if (sg != null) - { - groupsToUpdate.addElement(av.getSelectionGroup()); - int sSize = sg.getSize(); - for (s = 0; s < sSize; s++) - { - SequenceI seq = sg.getSequenceAt(s); - - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups(). - elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - } - else - { - SequenceI seq = av.alignment.getSequenceAt(startseq); - for (g = 0; g < gSize; g++) - { - SequenceGroup sg2 = (SequenceGroup) av.alignment.getGroups().elementAt( - g); - if (sg2.sequences.contains(seq)) - { - if (!groupsToUpdate.contains(sg2)) - groupsToUpdate.addElement(sg2); - continue; - } - } - } - - gSize = groupsToUpdate.size(); - for (g = 0; g < gSize; g++) - { - ( (SequenceGroup) groupsToUpdate.elementAt(g)).recalcConservation(); - } - ////End of updating groups - ////////////////////////////////////////// - - // Y O Y CLUSTALX - ColourSchemeI cs = av.getGlobalColourScheme(); - if(cs!=null) - { - if (cs.conservationApplied()) - { - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, - av.alignment.getSequences(), - 0, av.alignment.getWidth() - 1); - c.calculate(); - c.verdict(false, av.ConsPercGaps); - - if (cs instanceof ClustalxColourScheme) - { - ClustalxColourScheme cxs = (ClustalxColourScheme) cs; - cxs.resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } - else - { - cs.setConservation(c); - av.setGlobalColourScheme(cs); - } + av.firePropertyChange("alignment", null,av.getAlignment().getSequences()); - } - - if (cs instanceof ClustalxColourScheme) - { - ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(), - av.alignment.getWidth()); - av.setGlobalColourScheme(cs); - } - } } /** @@ -684,6 +600,11 @@ public class SeqPanel extends JPanel int seq = findSeq(evt); oldSeq = seq; + startWrapBlock=wrappedBlock; + + if(seq<0 || res<0) + return; + SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq); if ((sequence == null) || (res > sequence.getLength())) @@ -831,6 +752,9 @@ public class SeqPanel extends JPanel int res = findRes(evt); int y = findSeq(evt); + if(wrappedBlock!=startWrapBlock) + return; + if (stretchGroup == null) { return;