From: amwaterhouse Date: Thu, 12 May 2005 09:08:34 +0000 (+0000) Subject: corrections for find when edit takes place X-Git-Tag: Release_2_0~300 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5150ffd5baa1f58bb6b4059616bc6b9050326553;p=jalview.git corrections for find when edit takes place --- diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index ddfc432..68746e3 100755 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -76,6 +76,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { public void keyPressed(KeyEvent evt) { + System.out.println(evt.getKeyCode()); switch(evt.getKeyCode()) { case 27: // escape key @@ -192,12 +193,17 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene seqPanel.seqCanvas.highlightSearchResults( results ); // do we need to scroll the panel? - if(results!=null && (av.getStartSeq()>results[0] - || av.getEndSeq()results[1] - || av.getEndRes() start + || av.getEndRes() < end + || (av.getStartSeq() > results[0] + || av.getEndSeq() < results[0])) + setScrollValues(start, results[0]); + } } diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 0b1e319..ab4cd7b 100755 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -12,6 +12,7 @@ public class Finder extends GFinder AlignmentPanel ap; Frame frame; SuperGroup searchGroup; + Vector searchResults; int seqIndex = 0; int resIndex = 0; @@ -59,8 +60,32 @@ public class Finder extends GFinder public void createNewGroup_actionPerformed(ActionEvent e) { - for(int i=0; i= y1 && searchSeq < y2) { + SequenceI seq = av.getAlignment().getSequenceAt(searchSeq); + + int searchStart = seq.findIndex( searchResults[r+1] )-1; + int searchEnd = seq.findIndex( searchResults[r+2] )-1; + SequenceRenderer ssr = (SequenceRenderer) sr; if(searchStart x2) searchEnd = x2; - ssr.drawHighlightedText(av.getAlignment().getSequenceAt(searchSeq), + + ssr.drawHighlightedText(seq, searchStart, searchEnd, (searchStart - startx) * av.charWidth, diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 6e4a34f..7df2254 100755 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -344,10 +344,10 @@ public class SeqPanel extends Panel { if ( jalview.util.Comparison.isGap( av.alignment.getSequenceAt(seq).getSequence().charAt(j))) - av.alignment.getSequenceAt(seq).deleteCharAt(j); + av.alignment.getSequenceAt(seq).deleteCharAt(j); av.alignment.getWidth(); - seqCanvas.repaint(); + repaint(); seqEditOccurred=seq; } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 26b470a..b339e51 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -156,12 +156,17 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene seqPanel.seqCanvas.highlightSearchResults( results ); // do we need to scroll the panel? - if(results!=null && (av.getStartSeq()>results[0] - || av.getEndSeq()results[1] - || av.getEndRes() start + || av.getEndRes() < end + || (av.getStartSeq() > results[0] + || av.getEndSeq() < results[0])) + setScrollValues(start, results[0]); + } } diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 5a2dfe9..594baf8 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -14,6 +14,7 @@ public class Finder extends GFinder AlignmentPanel ap; JInternalFrame frame; SuperGroup searchGroup; + Vector searchResults; int seqIndex = 0; int resIndex = 0; @@ -74,8 +75,32 @@ public class Finder extends GFinder public void createNewGroup_actionPerformed(ActionEvent e) { - for(int i=0; i= y1 && searchSeq < y2) { + SequenceI seq = av.getAlignment().getSequenceAt(searchSeq); + + int searchStart = seq.findIndex( searchResults[r+1] )-1; + int searchEnd = seq.findIndex( searchResults[r+2] )-1; + SequenceRenderer ssr = (SequenceRenderer) sr; if(searchStart x2) searchEnd = x2; - ssr.drawHighlightedText(av.getAlignment().getSequenceAt(searchSeq), + + ssr.drawHighlightedText(seq, searchStart, searchEnd, (searchStart - startx) * av.charWidth, diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index ddbd97c..162f978 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -347,11 +347,12 @@ public class SeqPanel extends JPanel { if ( jalview.util.Comparison.isGap( av.alignment.getSequenceAt(seq).getSequence().charAt(j))) - av.alignment.getSequenceAt(seq).deleteCharAt(j); + av.alignment.getSequenceAt(seq).deleteCharAt(j); av.alignment.getWidth(); repaint(); seqEditOccurred=seq; + }