From 42ae188a9819c341cd345baeab442cd0606ff157 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 24 Feb 2006 11:37:13 +0000 Subject: [PATCH] Drawpanel needs fewer args --- src/jalview/appletgui/SeqCanvas.java | 50 ++++++++++++++++------------------ 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 618ec8a..ac5ff89 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -204,7 +204,7 @@ public class SeqCanvas gg.translate(transX, transY); - drawPanel(gg, sr, er, ss, es, sr, ss, 0); + drawPanel(gg, sr, er, ss, es, 0); gg.translate( -transX, -transY); repaint(); @@ -266,8 +266,7 @@ public class SeqCanvas } else { - drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes, - av.startSeq, 0); + drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); } g.drawImage(img, 0, 0, this); @@ -384,7 +383,7 @@ public class SeqCanvas if(g.getClip()==null) g.setClip(0, 0, cWidth * av.charWidth, canvasHeight); - drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos); + drawPanel(g, startRes, endx, 0, al.getHeight(), ypos); g.setClip(null); @@ -425,8 +424,7 @@ public class SeqCanvas return annotations.adjustPanelHeight(); } - synchronized public void drawPanel(Graphics g, int x1, int x2, int y1, int y2, - int startx, int starty, int offset) + synchronized public void drawPanel(Graphics g, int startRes, int endRes, int startSeq, int endSeq, int offset) { g.setFont(av.getFont()); @@ -435,36 +433,34 @@ public class SeqCanvas SequenceI nextSeq; /// First draw the sequences ///////////////////////////// - for (int i = y1; i < y2; i++) + for (int i = startSeq; i < endSeq; i++) { nextSeq = av.alignment.getSequenceAt(i); - sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), x1, x2, - (x1 - startx) * av.charWidth, + sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), startRes, endRes, + (startRes - startRes) * av.charWidth, offset + - (i - starty) * av.charHeight, + (i - startSeq) * av.charHeight, av.charWidth, av.charHeight); if (av.showSequenceFeatures) { - fr.drawSequence(g, nextSeq, x1, x2, - (x1 - startx) * av.charWidth, - offset + - (i - starty) * av.charHeight, + fr.drawSequence(g, nextSeq, startRes, endRes, + offset +(i - startSeq) * av.charHeight, av.charWidth, av.charHeight); } /// Highlight search Results once all sequences have been drawn ////////////////////////////////////////////////////////// if (searchResults != null) { - int[] visibleResults = searchResults.getResults(nextSeq, x1, x2); + int[] visibleResults = searchResults.getResults(nextSeq, startRes, endRes); if (visibleResults != null) for (int r = 0; r < visibleResults.length; r += 2) { sr.drawHighlightedText(nextSeq, visibleResults[r], visibleResults[r + 1], - (visibleResults[r] - startx) * av.charWidth, - offset + ( (i - starty) * av.charHeight), + (visibleResults[r] - startRes) * av.charWidth, + offset + ( (i - startSeq) * av.charHeight), av.charWidth, av.charHeight); } } @@ -494,10 +490,10 @@ public class SeqCanvas int top = -1; int bottom = -1; - for (i = y1; i < y2; i++) + for (i = startSeq; i < endSeq; i++) { - sx = (group.getStartRes() - startx) * av.charWidth; - sy = offset + ((i - starty) * av.charHeight); + sx = (group.getStartRes() - startRes) * av.charWidth; + sy = offset + ((i - startSeq) * av.charHeight); ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1; @@ -506,14 +502,14 @@ public class SeqCanvas continue; } - if ( (sx <= (x2-x1)*av.charWidth) && + if ( (sx <= (endRes-startRes)*av.charWidth) && group.sequences.contains(av.alignment.getSequenceAt( i))) { if (bottom == -1) { - if(i == y2-1 || // Dont check for i+1 if on the bottom row + if(i == endSeq-1 || // Dont check for i+1 if on the bottom row !group.sequences.contains(av.alignment.getSequenceAt(i+1 ))) bottom = sy + av.charHeight; @@ -561,8 +557,8 @@ public class SeqCanvas if (sx + ex > imgWidth) ex = imgWidth; - else if (sx + ex >= (x2 - x1 + 1) * av.charWidth) - ex = (x2 - x1 + 1) * av.charWidth; + else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) + ex = (endRes - startRes + 1) * av.charWidth; if (top != -1) { @@ -583,7 +579,7 @@ public class SeqCanvas if (inGroup) { - sy = offset + ( (i - starty) * av.charHeight); + sy = offset + ( (i - startSeq) * av.charHeight); if (sx >= 0 && sx < imgWidth) g.drawLine(sx, oldY, sx, sy); @@ -598,8 +594,8 @@ public class SeqCanvas if (sx + ex > imgWidth) ex = imgWidth; - else if (sx + ex >= (x2 - x1 + 1) * av.charWidth) - ex = (x2 - x1 + 1) * av.charWidth; + else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) + ex = (endRes - startRes + 1) * av.charWidth; if (top != -1) { -- 1.7.10.2