From: amwaterhouse Date: Thu, 21 Apr 2005 17:23:03 +0000 (+0000) Subject: Tick 5 and 10 marks X-Git-Tag: Release_2_0~377 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=e32a272b8c13b5dfa65d2ef6735292748e88d34e;p=jalview.git Tick 5 and 10 marks --- diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index e49eb17..2ec4570 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -111,82 +111,59 @@ public class ScalePanel extends JPanel public void paintComponent(Graphics g) { - drawScale(g, av.getStartRes(), av.getEndRes(), getWidth()); + drawScale(g, av.getStartRes(), av.getEndRes(), getWidth(), getHeight()); } // scalewidth will normally be screenwidth, - public void drawScale(Graphics g, int startx, int endx, int scaleWidth) + public void drawScale(Graphics g, int startx, int endx, int width, int height) { Graphics2D gg = (Graphics2D)g; - gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); - int charWidth = av.getCharWidth(); - gg.setFont(av.getFont()); + gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); //Fill in the background - gg.setColor(Color.white); - gg.fillRect(0,0,scaleWidth, getHeight()); - - 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 (roughtick>5) - num = 10; - else - 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.fillRect(0,0,width, height); gg.setColor(Color.black); - int scalestartx = 0; - if(space>0) - 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