X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFontChooser.java;h=9803822ecd1759c9d406af5d052569e90985d006;hb=629aab8cacd34324f5bd6aad568db5857fec8c81;hp=ddaf4aa63709ac80bec8f32889b9d809abc3a83f;hpb=eab172160ce8e1f0d3ca95c1c273124a194e13e4;p=jalview.git diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index ddaf4aa..9803822 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.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 @@ -50,8 +50,10 @@ public class FontChooser extends GFontChooser public FontChooser(TreePanel tp) { this.tp = tp; + ap = tp.treeCanvas.ap; oldFont = tp.getTreeFont(); defaultButton.setVisible(false); + smoothFont.setEnabled(false); init(); } /** @@ -70,10 +72,13 @@ public class FontChooser extends GFontChooser { frame = new JInternalFrame(); frame.setContentPane(this); + + smoothFont.setSelected(ap.av.antiAlias); + if(tp!=null) - Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 480, 100, false); + Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170, false); else - Desktop.addInternalFrame(frame, "Change Font", 480, 100, false); + Desktop.addInternalFrame(frame, "Change Font", 340, 170, false); frame.setLayer(JLayeredPane.PALETTE_LAYER); @@ -85,7 +90,7 @@ public class FontChooser extends GFontChooser fontName.addItem(fonts[i]); } - for (int i = 1; i < 31; i++) + for (int i = 1; i < 51; i++) { fontSize.addItem(i + ""); } @@ -98,9 +103,23 @@ public class FontChooser extends GFontChooser fontSize.setSelectedItem(oldFont.getSize() + ""); fontStyle.setSelectedIndex(oldFont.getStyle()); + FontMetrics fm = getGraphics().getFontMetrics(oldFont); + monospaced.setSelected( fm.getStringBounds("M",getGraphics()).getWidth() + ==fm.getStringBounds("|",getGraphics()).getWidth()); + + init = false; } + public void smoothFont_actionPerformed(ActionEvent e) + { + ap.av.antiAlias = smoothFont.isSelected(); + ap.annotationPanel.image = null; + ap.repaint(); + } + + + /** * DOCUMENT ME! * @@ -162,15 +181,22 @@ public class FontChooser extends GFontChooser Font newFont = new Font(fontName.getSelectedItem().toString(), fontStyle.getSelectedIndex(), Integer.parseInt(fontSize.getSelectedItem().toString())); - if (ap != null) + if(tp != null) { - ap.av.setFont(newFont); - ap.fontChanged(); + tp.setTreeFont(newFont); } - else if(tp != null) + else if(ap != null) { - tp.setTreeFont(newFont); + ap.av.setFont(newFont); + ap.fontChanged(); } + + + FontMetrics fm = getGraphics().getFontMetrics(newFont); + + monospaced.setSelected( fm.getStringBounds("M",getGraphics()).getWidth() + ==fm.getStringBounds("|",getGraphics()).getWidth()); + } /** @@ -228,5 +254,6 @@ public class FontChooser extends GFontChooser Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString()); Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + ""); Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString()); + Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); } }