From c3fb619456647802a17540f53227ad1afa01a10f Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 10 Mar 2005 10:11:42 +0000 Subject: [PATCH] Scale canvas not needed --- src/jalview/gui/ScaleCanvas.java | 108 -------------------------------------- src/jalview/gui/ScalePanel.java | 91 +++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 121 deletions(-) delete mode 100755 src/jalview/gui/ScaleCanvas.java diff --git a/src/jalview/gui/ScaleCanvas.java b/src/jalview/gui/ScaleCanvas.java deleted file mode 100755 index d708248..0000000 --- a/src/jalview/gui/ScaleCanvas.java +++ /dev/null @@ -1,108 +0,0 @@ -package jalview.gui; - -import java.awt.*; -import javax.swing.*; - -public class ScaleCanvas extends JPanel { - - int xoffset; - - public static final int HEIGHT = 30; - - boolean paintFlag = false; - - protected AlignViewport av; - - public ScaleCanvas(AlignViewport av) { - this.av = av; - - } - public void paintComponent(Graphics g) - { - drawScale(g, av.getStartRes(), av.getEndRes(), getWidth()); - } - -// scalewidth will normally be screenwidth, - public void drawScale(Graphics gg, int startx, int endx, int scaleWidth) - { - - int charWidth = av.getCharWidth(); - - gg.setFont(av.getFont()); - - //Fill in the background - - gg.setColor(Color.white); - gg.fillRect(0,0,scaleWidth, HEIGHT); - - int resWidth = endx - startx + 1; - - // We want roughly one tick every 50 pixels - - double rough = scaleWidth/50.0; - - double roughtick = resWidth/rough; - - int digits = (int)(Math.log(roughtick)/Math.log(10)); - int num = (int)(roughtick/Math.pow(10,digits)); - - if (Math.abs(10-num) < 3) - num = 10; - else if (Math.abs(5-num) >= 2) - num = 5; - // else - // num = 2; - - //System.out.println("Dig " + digits + " " + rough + " " + roughtick + " " + getWidth() + " " + num); - - int space = (int)(num * Math.pow(10,digits)); - - //Set the text font - - gg.setColor(Color.black); - - int scalestartx = startx - startx%space + space; - - - //Fill the selected columns - ColumnSelection cs = av.getColumnSelection(); - int width = charWidth; - if (width == 0) - width = 1; - - gg.setColor(new Color(220,0,0)); - for (int i=0; i