X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqCanvas.java;h=cd5aa74f61d26b53841a2940d19cda8fbcc9f02b;hb=5edb685cf52a607834a82c10cb4dd9c139e31dde;hp=821136fa448053f3bcf9a0c327dc787aee04efcf;hpb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;p=jalview.git diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 821136f..cd5aa74 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -21,7 +21,7 @@ package jalview.appletgui; import jalview.datamodel.AlignmentI; -import jalview.datamodel.SearchResults; +import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.renderer.ScaleRenderer; @@ -50,8 +50,6 @@ public class SeqCanvas extends Panel AlignViewport av; - SearchResults searchResults = null; - boolean fastPaint = false; int cursorX = 0; @@ -218,12 +216,12 @@ public class SeqCanvas extends Panel // Its possible on certain browsers that the call to fastpaint // is faster than it can paint, so this check here catches // this possibility - if (lastsr + horizontal != av.startRes) + if (lastsr + horizontal != av.getStartRes()) { - horizontal = av.startRes - lastsr; + horizontal = av.getStartRes() - lastsr; } - lastsr = av.startRes; + lastsr = av.getStartRes(); fastPaint = true; gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth @@ -231,7 +229,8 @@ public class SeqCanvas extends Panel imgHeight - vertical * avcharHeight, -horizontal * avcharWidth, -vertical * avcharHeight); - int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, transX = 0, transY = 0; + int sr = av.getStartRes(), er = av.getEndRes(), ss = av.getStartSeq(), es = av + .getEndSeq(), transX = 0, transY = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { @@ -246,21 +245,22 @@ public class SeqCanvas extends Panel else if (vertical > 0) // scroll down { ss = es - vertical; - if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time + if (ss < av.getStartSeq()) // ie scrolling too fast, more than a page at a + // time { - ss = av.startSeq; + ss = av.getStartSeq(); } else { - transY = imgHeight - vertical * avcharHeight; + transY = imgHeight - ((vertical + 1) * avcharHeight); } } else if (vertical < 0) { es = ss - vertical; - if (es > av.endSeq) + if (es > av.getEndSeq()) { - es = av.endSeq; + es = av.getEndSeq(); } } @@ -333,11 +333,12 @@ public class SeqCanvas extends Panel if (av.getWrapAlignment()) { - drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes); + drawWrappedPanel(gg, imgWidth, imgHeight, av.getStartRes()); } else { - drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); + drawPanel(gg, av.getStartRes(), av.getEndRes(), av.getStartSeq(), + av.getEndSeq(), 0); } g.drawImage(img, 0, 0, this); @@ -423,7 +424,7 @@ public class SeqCanvas extends Panel av.setWrappedWidth(cWidth); - av.endRes = av.startRes + cWidth; + av.setEndRes(av.getStartRes() + cWidth); int endx; int ypos = hgap; @@ -612,7 +613,7 @@ public class SeqCanvas extends Panel // / First draw the sequences // /////////////////////////// - for (int i = startSeq; i < endSeq; i++) + for (int i = startSeq; i <= endSeq; i++) { nextSeq = av.getAlignment().getSequenceAt(i); @@ -632,9 +633,10 @@ public class SeqCanvas extends Panel // / Highlight search Results once all sequences have been drawn // //////////////////////////////////////////////////////// - if (searchResults != null) + if (av.hasSearchResults()) { - int[] visibleResults = searchResults.getResults(nextSeq, startRes, + int[] visibleResults = av.getSearchResults().getResults(nextSeq, + startRes, endRes); if (visibleResults != null) { @@ -695,7 +697,7 @@ public class SeqCanvas extends Panel int bottom = -1; int alHeight = av.getAlignment().getHeight() - 1; - for (i = startSeq; i < endSeq; i++) + for (i = startSeq; i <= endSeq; i++) { sx = (group.getStartRes() - startRes) * avcharWidth; sy = offset + ((i - startSeq) * avcharHeight); @@ -843,10 +845,9 @@ public class SeqCanvas extends Panel } } - public void highlightSearchResults(SearchResults results) + public void highlightSearchResults(SearchResultsI results) { - searchResults = results; - + av.setSearchResults(results); repaint(); }