From 8f050c10c0bd044493b7537b6c6d119c7c29c986 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 5 Jul 2011 15:00:19 +0100 Subject: [PATCH] partial patch for JAL-411 - text rendered above features --- src/jalview/appletgui/SeqCanvas.java | 9 ++++++--- src/jalview/appletgui/SequenceRenderer.java | 20 ++++++++++++++++---- src/jalview/gui/SeqCanvas.java | 8 ++++++-- src/jalview/gui/SequenceRenderer.java | 26 ++++++++------------------ 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index fd9d768..1452bb7 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -581,14 +581,17 @@ public class SeqCanvas extends Panel { continue; } - + // draw box background, possibly with sequence label. sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), - startRes, endRes, offset + ((i - startSeq) * av.charHeight)); - + startRes, endRes, offset + ((i - startSeq) * av.charHeight), true, !av.showSequenceFeatures); + if (av.showSequenceFeatures) { fr.drawSequence(g, nextSeq, startRes, endRes, offset + ((i - startSeq) * av.charHeight)); + // draw sequence label + sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), + startRes, endRes, offset + ((i - startSeq) * av.charHeight), false, true); } // / Highlight search Results once all sequences have been drawn diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 0215e55..b6eeba3 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -103,8 +103,19 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer return resBoxColour; } + /** + * draw coloured sequence to the current graphics cursor + * @param seq + * @param sg + * @param start + * @param end + * @param y1 + * @param drawBox - draw background + * @param drawText - draw text (if shading style permits) + */ + public void drawSequence(SequenceI seq, SequenceGroup[] sg, int start, - int end, int y1) + int end, int y1, boolean drawBox, boolean drawText) { if (seq == null) { @@ -112,10 +123,11 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } allGroups = sg; + if (drawBox) { + drawBoxes(seq, start, end, y1); + } - drawBoxes(seq, start, end, y1); - - if (av.validCharWidth) + if (av.validCharWidth && drawText) { drawText(seq, start, end, y1); } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index f625838..c8a6a75 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -697,13 +697,17 @@ public class SeqCanvas extends JComponent // empty continue; } + // draw box background, possibly with sequence label. sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), - startRes, endRes, offset + ((i - startSeq) * av.charHeight)); - + startRes, endRes, offset + ((i - startSeq) * av.charHeight), true, !av.showSequenceFeatures); + if (av.showSequenceFeatures) { fr.drawSequence(g, nextSeq, startRes, endRes, offset + ((i - startSeq) * av.charHeight)); + // draw sequence label + sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), + startRes, endRes, offset + ((i - startSeq) * av.charHeight), false, true); } // / Highlight search Results once all sequences have been drawn diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index b15851c..f2eae2a 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -125,35 +125,25 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } /** - * DOCUMENT ME! - * - * @param g - * DOCUMENT ME! + * draw coloured sequence to the current graphics cursor * @param seq - * DOCUMENT ME! * @param sg - * DOCUMENT ME! * @param start - * DOCUMENT ME! * @param end - * DOCUMENT ME! - * @param x1 - * DOCUMENT ME! * @param y1 - * DOCUMENT ME! - * @param width - * DOCUMENT ME! - * @param height - * DOCUMENT ME! + * @param drawBox - draw background + * @param drawText - draw text (if shading style permits) */ public void drawSequence(SequenceI seq, SequenceGroup[] sg, int start, - int end, int y1) + int end, int y1, boolean drawBox, boolean drawText) { allGroups = sg; - drawBoxes(seq, start, end, y1); + if (drawBox) { + drawBoxes(seq, start, end, y1); + } - if (av.validCharWidth) + if (av.validCharWidth && drawText) { drawText(seq, start, end, y1); } -- 1.7.10.2