setBackground(Color.white);\r
}\r
\r
- MCview.PDBCanvas pdbViewer;\r
+ MCview.PDBCanvas pdbCanvas;\r
public SequenceRenderer getSequenceRenderer()\r
{\r
return sr;\r
return fr;\r
}\r
\r
- public void setPDBViewer(MCview.PDBCanvas pc)\r
+ public void setPDBCanvas(MCview.PDBCanvas pc)\r
{\r
- pdbViewer = pc;\r
+ pdbCanvas = pc;\r
}\r
\r
public AlignViewport getViewport()\r
sr.renderGaps(av.renderGaps);\r
\r
if ((img != null) &&\r
- (fastPaint || (getWidth() != g.getClipBounds().width) ||\r
- (getHeight() != g.getClipBounds().height)))\r
+ (fastPaint && getVisibleRect() != g.getClipBounds()))\r
{\r
g.drawImage(img, 0, 0, this);\r
fastPaint = false;\r
return;\r
}\r
\r
+\r
+\r
+\r
// this draws the whole of the alignment\r
imgWidth = getWidth();\r
imgHeight = getHeight();\r
return;\r
}\r
\r
-\r
img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);\r
gg = (Graphics2D) img.getGraphics();\r
gg.setFont(av.getFont());\r
\r
g.drawImage(img, 0, 0, this);\r
\r
- if (pdbViewer != null)\r
+ if (pdbCanvas != null)\r
{\r
- pdbViewer.updateSeqColours();\r
+ pdbCanvas.updateSeqColours();\r
}\r
\r
}\r
\r
bi.getGraphics().setColor(initialCol);\r
bi.getGraphics().fillRect(0, 0, 1, 1);\r
- allGroups = null;\r
+ allGroups = av.alignment.findAllGroups(seq);\r
graphics = bi.getGraphics();\r
\r
drawBoxes(seq, i,i, 0, 0, 1,1);\r
public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
int width, int height)\r
{\r
- int i = start;\r
- int length = seq.getLength();\r
+ int i = start;\r
+ int length = seq.getLength();\r
\r
- int curStart = -1;\r
- int curWidth = width;\r
+ int curStart = -1;\r
+ int curWidth = width;\r
\r
- Color tempColour = null;\r
+ Color tempColour = null;\r
\r
- while (i <= end)\r
- {\r
- resBoxColour = Color.white;\r
+ while (i <= end)\r
+ {\r
+ resBoxColour = Color.white;\r
\r
- if (i < length)\r
+ if (i < length)\r
+ {\r
+ if (inCurrentSequenceGroup(i))\r
{\r
- if (inCurrentSequenceGroup(i))\r
+ if (currentSequenceGroup.getDisplayBoxes())\r
{\r
- if (currentSequenceGroup.getDisplayBoxes())\r
- {\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- }\r
+ getBoxColour(currentSequenceGroup.cs, seq, i);\r
}\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.getGlobalColourScheme(), seq, i);\r
- }\r
-\r
+ }\r
+ else if (av.getShowBoxes())\r
+ {\r
+ getBoxColour(av.getGlobalColourScheme(), seq, i);\r
}\r
\r
- if (resBoxColour != tempColour)\r
- {\r
- if (tempColour != null)\r
- {\r
- int xxx = x1 + (int) (av.charWidth * (curStart - start));\r
- if (width != av.charWidth)\r
- {\r
- xxx = x1 + (int) (av.charWidth * (curStart - start)) / 3;\r
- }\r
-\r
-\r
- graphics.fillRect(xxx, y1,\r
- curWidth, height);\r
- }\r
+ }\r
\r
- graphics.setColor(resBoxColour);\r
+ if (resBoxColour != tempColour)\r
+ {\r
+ if (tempColour != null)\r
+ {\r
+ graphics.fillRect(x1 + (width * (curStart - start)), y1,\r
+ curWidth, height);\r
+ }\r
\r
- curStart = i;\r
- curWidth = width;\r
- tempColour = resBoxColour;\r
- }\r
- else\r
- {\r
- curWidth += width;\r
- }\r
+ graphics.setColor(resBoxColour);\r
\r
- i++;\r
- }\r
+ curStart = i;\r
+ curWidth = width;\r
+ tempColour = resBoxColour;\r
+ }\r
+ else\r
+ {\r
+ curWidth += width;\r
+ }\r
\r
- int xxx = x1 + (int) (av.charWidth * (curStart - start));\r
- if (width != av.charWidth)\r
- {\r
- xxx = x1 + (int) (av.charWidth * (curStart - start)) / 3;\r
- }\r
+ i++;\r
+ }\r
\r
+ graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth,\r
+ height);\r
\r
- graphics.fillRect(xxx, y1, curWidth,\r
- height);\r
}\r
\r
/**\r
}\r
\r
charOffset = (width - fm.charWidth(s)) / 2;\r
+ graphics.drawString(String.valueOf(s),\r
+ charOffset + x1 + (int)(width * (i - start)), (y1 + height) - pady);\r
\r
- int xxx = charOffset + x1 + (int)(av.charWidth * (i - start));\r
- if(width != av.charWidth)\r
- {\r
- xxx = charOffset + x1 + (int)(av.charWidth * (i - start))/3;\r
- }\r
-\r
- graphics.drawString(String.valueOf(s),xxx, (y1 + height) - pady);\r
}\r
}\r
\r