X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FOverviewPanel.java;h=cbbfcff01821a9d80ba88030fda052f4ed339f7b;hb=7be3a744db5213f49e70178ade126d1cc797c762;hp=366f5bcb196d9e6a8722230379eade6e2c73e8ff;hpb=5cd5b6e7864fe435ceb3f5c2f339a436ea0aac93;p=jalview.git diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 366f5bc..cbbfcff 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +26,7 @@ public class OverviewPanel extends Panel implements Runnable, MouseMotionListener, MouseListener { Image miniMe; + Image offscreen; AlignViewport av; AlignmentPanel ap; float scalew = 1f; @@ -139,7 +140,6 @@ public class OverviewPanel boxX = evt.getX(); boxY = evt.getY(); checkValid(); - ap.repaint(); } void checkValid() @@ -189,7 +189,7 @@ public class OverviewPanel } ap.setScrollValues( col, row ); - + ap.repaint(); } /** @@ -253,17 +253,19 @@ public class OverviewPanel scaleh = (float) sequencesHeight / (float) fullsizeHeight; miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight); + offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight); Graphics mg = miniMe.getGraphics(); float sampleCol = (float) alwidth / (float) width; float sampleRow = (float) alheight / (float) sequencesHeight; - int lastcol=-1, lastrow=-1; + int lastcol=0, lastrow=0; + int xstart=0, ystart=0; Color color = Color.yellow; int row, col, sameRow = 0, sameCol = 0; jalview.datamodel.SequenceI seq; boolean hiddenRow = false; - for (row = 0; row < sequencesHeight; row++) + for (row = 0; row <= sequencesHeight; row++) { if((int)(row*sampleRow)==lastrow) { @@ -271,8 +273,6 @@ public class OverviewPanel continue; } - lastrow = (int)(row*sampleRow); - hiddenRow = false; if (av.hasHiddenRows) { @@ -292,12 +292,6 @@ public class OverviewPanel else seq = av.alignment.getSequenceAt(lastrow); - if(seq==null) - { - System.out.println(lastrow+" null"); - continue; - } - for (col = 0; col < width; col++) { if ( (int) (col * sampleCol) == lastcol && (int) (row * sampleRow) == lastrow) @@ -329,12 +323,15 @@ public class OverviewPanel mg.setColor(color); if (sameCol == 1 && sameRow == 1) - mg.drawLine(col, row, col, row); + mg.drawLine(xstart, ystart, xstart, ystart); else - mg.fillRect(col, row, col+sameCol, col+sameRow); + mg.fillRect(xstart, ystart, sameCol, sameRow); + xstart = col; sameCol = 1; } + lastrow = (int)(row*sampleRow); + ystart = row; sameRow = 1; } @@ -419,9 +416,14 @@ public class OverviewPanel public void paint(Graphics g) { + Graphics og = offscreen.getGraphics(); if (miniMe != null) { - g.drawImage(miniMe, 0, 0, this); + og.drawImage(miniMe, 0, 0, this); + og.setColor(Color.red); + og.drawRect(boxX, boxY, boxWidth, boxHeight); + og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); + g.drawImage(offscreen, 0,0, this); } else { @@ -432,10 +434,6 @@ public class OverviewPanel g.drawString("Recalculating", 5, sequencesHeight / 2); g.drawString("Overview.....", 5, (sequencesHeight / 2) + 20); } - - g.setColor(Color.red); - g.drawRect(boxX, boxY, boxWidth, boxHeight); - g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); } }