label.start_jalview = Start Jalview
label.biojs_html_export = BioJS
label.scale_as_cdna = Scale protein residues to codons
+label.font_as_cdna = Use same font for cDNA and peptide
label.scale_protein_to_cdna = Scale Protein to cDNA
label.scale_protein_to_cdna_tip = Make protein residues same width as codons in split frame views
info.select_annotation_row = Select Annotation Row
label.open_split_window?=¿Quieres abrir ventana dividida, con cDNA y proteína vinculadas?
status.searching_for_pdb_structures=Buscando Estructuras PDB
label.scale_as_cdna=Adaptar residuos proteicos a los codones
+label.font_as_cdna=Utilizar la misma fuente para nucleotídos y proteicos
action.export_hidden_sequences=Exportar Secuencias Ocultas
action.export_hidden_columns=Exportar Columnas Ocultas
label.found_structures_summary=Resumen de Estructuras Encontradas
label.select_pdb_file=Seleccionar Fichero PDB
label.structures_filter=Filtro de Estructuras
label.scale_protein_to_cdna=Adaptar proteína a cDNA
+label.scale_protein_to_cdna_tip=Hacer a los residuos de proteínas de la misma anchura que los codones en ventanas divididas
status.loading_cached_pdb_entries=Cargando Entradas PDB en Caché
label.select=Seleccionar :
label.select_by_annotation=Seleccionar/Ocultar Columnas por Anotación
label.separate_multiple_query_values=Introducir uno o mas {0}s separados por punto y coma ";"
label.let_chimera_manage_structure_colours=Deja que Chimera maneje colores de estructuras
label.view_rna_structure=Estructura 2D VARNA
-label.scale_protein_to_cdna_tip=Hacer a los residuos de proteínas de la misma anchura que los codones en ventanas divididas
label.colour_with_chimera=Colorear con Chimera
label.show_pdbstruct_dialog=Datos de Estructura 3D...
label.hide_all=Ocultar todos
import jalview.schemes.ColourSchemeI;
import java.awt.Color;
+import java.awt.Font;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
* @return search results or null
*/
SearchResultsI getSearchResults();
+
+ /**
+ * Updates view settings with the given font. You may need to call
+ * AlignmentPanel.fontChanged to update the layout geometry.
+ *
+ * @param setGrid
+ * when true, charWidth/height is set according to font metrics
+ */
+ void setFont(Font newFont, boolean b);
}
import jalview.viewmodel.AlignmentViewport;
import java.awt.Font;
+import java.awt.FontMetrics;
public class AlignViewport extends AlignmentViewport implements
SelectionSource, VamsasSource, CommandListener
}
}
}
- setFont(font);
+ setFont(font, true);
MAC = new jalview.util.Platform().isAMac();
private float heightScale = 1, widthScale = 1;
- public void setFont(Font f)
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFont(Font f, boolean setGrid)
{
font = f;
if (nullFrame == null)
nullFrame.addNotify();
}
- java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
- setCharHeight((int) (heightScale * fm.getHeight()));
- setCharWidth((int) (widthScale * fm.charWidth('M')));
+ if (setGrid)
+ {
+ FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
+ setCharHeight((int) (heightScale * fm.getHeight()));
+ setCharWidth((int) (widthScale * fm.charWidth('M')));
+ }
if (isUpperCasebold())
{
Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
- fm = nullFrame.getGraphics().getFontMetrics(f2);
+ FontMetrics fm = nullFrame.getGraphics().getFontMetrics(f2);
setCharWidth((int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10)));
}
}
private Checkbox scaleAsCdna = new Checkbox();
+ private Checkbox fontAsCdna = new Checkbox();
+
private Button ok = new Button();
private Button cancel = new Button();
private Frame frame;
+ boolean inSplitFrame = false;
+
/**
* Constructor for a TreePanel font chooser
*
this.frame = new Frame();
frame.add(this);
jalview.bin.JalviewLite.addFrame(frame,
- MessageManager.getString("action.change_font"), 440, 115);
+ MessageManager.getString("action.change_font"), 440, 145);
init = false;
}
/**
* Actions on change of font name, size or style.
*/
+ @Override
public void itemStateChanged(ItemEvent evt)
{
final Object source = evt.getSource();
if (ap.av.getCodingComplement() != null)
{
ap.av.getCodingComplement().setScaleProteinAsCdna(oldScaleProtein);
+ ap.av.getCodingComplement().setFont(oldFont, true);
ap.alignFrame.getSplitFrame().repaint();
}
- ap.av.setFont(oldFont);
+ ap.av.setFont(oldFont, true);
ViewStyleI style = ap.av.getViewStyle();
if (style.getCharWidth() != oldCharWidth)
{
}
else if (ap != null)
{
- ap.av.setFont(newFont);
+ ap.av.setFont(newFont, true);
ap.fontChanged();
+
+ /*
+ * and change font in other half of split frame if any
+ */
+ if (inSplitFrame && fontAsCdna.getState())
+ {
+ ap.av.getCodingComplement().setFont(newFont, true);
+ SplitFrame splitFrame = ap.alignFrame.getSplitFrame();
+ splitFrame.adjustLayout();
+ splitFrame.repaint();
+ }
}
// remember last selected
lastSelected = newFont;
scaleAsCdna.addItemListener(this);
scaleAsCdna.setState(ap.av.isScaleProteinAsCdna());
+ fontAsCdna.setLabel(MessageManager.getString("label.font_as_cdna"));
+ fontAsCdna.setFont(VERDANA_11PT);
+ fontAsCdna.setState(true);
+
ok.setFont(VERDANA_11PT);
ok.setLabel(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
stylePanel.add(fontStyle, BorderLayout.CENTER);
sizePanel.add(sizeLabel, BorderLayout.WEST);
sizePanel.add(fontSize, BorderLayout.CENTER);
- scalePanel.add(scaleAsCdna, BorderLayout.CENTER);
+ scalePanel.add(scaleAsCdna, BorderLayout.NORTH);
+ scalePanel.add(fontAsCdna, BorderLayout.SOUTH);
okCancelPanel.add(ok, null);
okCancelPanel.add(cancel, null);
this.add(optionsPanel, BorderLayout.NORTH);
if (ap.alignFrame.getSplitFrame() != null)
{
+ inSplitFrame = true;
this.add(scalePanel, BorderLayout.CENTER);
}
this.add(okCancelPanel, BorderLayout.SOUTH);
fontSize = 1;
}
- av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
+ av.setFont(
+ new Font(av.font.getName(), av.font.getStyle(), fontSize),
+ true);
av.setCharWidth(oldWidth);
}
else
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Hashtable;
boolean validCharWidth;
/**
- * update view settings with the given font. You may need to call
- * alignPanel.fontChanged to update the layout geometry
- *
- * @param setGrid
- * when true, charWidth/height is set according to font mentrics
+ * {@inheritDoc}
*/
+ @Override
public void setFont(Font f, boolean setGrid)
{
font = f;
Container c = new Container();
- java.awt.FontMetrics fm = c.getFontMetrics(font);
- int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
- .getCharHeight();
if (setGrid)
{
+ FontMetrics fm = c.getFontMetrics(font);
+ int ww = fm.charWidth('M');
setCharHeight(fm.getHeight());
setCharWidth(ww);
}
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
-import javax.swing.JOptionPane;
/**
* DOCUMENT ME!
/*
* Enable 'scale protein as cDNA' in a SplitFrame view. The selection is
- * stored in the ViewStyle of both dna and protein Viewport
+ * stored in the ViewStyle of both dna and protein Viewport. Also enable
+ * checkbox for copy font changes to other half of split frame.
*/
- scaleAsCdna.setEnabled(false);
- if (ap.av.getCodingComplement() != null)
+ boolean inSplitFrame = ap.av.getCodingComplement() != null;
+ if (inSplitFrame)
{
- scaleAsCdna.setEnabled(true);
scaleAsCdna.setVisible(true);
scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna());
+ fontAsCdna.setVisible(true);
+ fontAsCdna.setSelected(true);
}
if (tp != null)
else
{
Desktop.addInternalFrame(frame,
- MessageManager.getString("action.change_font"), 380, 200,
+ MessageManager.getString("action.change_font"), 380, 220,
false);
}
ap.av.setFont(oldFont, true);
ap.av.setScaleProteinAsCdna(oldProteinScale);
ap.paintAlignment(true);
- if (scaleAsCdna.isEnabled())
+ if (scaleAsCdna.isVisible() && scaleAsCdna.isEnabled())
{
- ap.av.setScaleProteinAsCdna(oldProteinScale);
ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale);
+ ap.av.getCodingComplement().setFont(oldFont, true);
}
}
else if (tp != null)
{
ap.av.setFont(newFont, true);
ap.fontChanged();
+
+ /*
+ * and change font in other half of split frame if any
+ */
+ if (fontAsCdna.isEnabled() && fontAsCdna.isSelected())
+ {
+ ap.av.getCodingComplement().setFont(newFont, true);
+ SplitFrame splitFrame = (SplitFrame) ap.alignFrame
+ .getSplitViewContainer();
+ splitFrame.repaint();
+ }
}
monospaced.setSelected(mw == iw);
.getSplitViewContainer();
splitFrame.adjustLayout();
splitFrame.repaint();
- // ap.paintAlignment(true);
- // TODO would like to repaint
}
}
protected JCheckBox scaleAsCdna = new JCheckBox();
+ protected JCheckBox fontAsCdna = new JCheckBox();
+
/**
* Creates a new GFontChooser object.
*/
fontSize.setPreferredSize(new Dimension(50, 21));
fontSize.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
fontSize_actionPerformed(e);
fontStyle.setPreferredSize(new Dimension(90, 21));
fontStyle.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
fontStyle_actionPerformed(e);
fontName.setPreferredSize(new Dimension(180, 21));
fontName.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
fontName_actionPerformed(e);
ok.setFont(VERDANA_11PT);
ok.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ok_actionPerformed(e);
cancel.setFont(VERDANA_11PT);
cancel.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
cancel_actionPerformed(e);
defaultButton.setText(MessageManager.getString("label.set_as_default"));
defaultButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
defaultButton_actionPerformed(e);
smoothFont.setFont(JvSwingUtils.getLabelFont());
smoothFont.setOpaque(false);
smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
- smoothFont.setBounds(new Rectangle(41, 65, 260, 23));
+ smoothFont.setBounds(new Rectangle(1, 65, 300, 23));
smoothFont.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
smoothFont_actionPerformed(e);
});
/*
- * Scale protein as cDNA is only visible in SplitFrame protein alignment
+ * Scale protein as cDNA is only visible in SplitFrame
*/
scaleAsCdna.setVisible(false);
scaleAsCdna.setFont(JvSwingUtils.getLabelFont());
scaleAsCdna.setOpaque(false);
scaleAsCdna.setText(MessageManager.getString("label.scale_as_cdna"));
- scaleAsCdna.setBounds(new Rectangle(41, 85, 260, 23));
+ scaleAsCdna.setBounds(new Rectangle(1, 85, 300, 23));
scaleAsCdna.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
scaleAsCdna_actionPerformed(e);
}
});
+ /*
+ * Same font for cDNA/peptide is only visible in SplitFrame
+ */
+ fontAsCdna.setVisible(false);
+ fontAsCdna.setFont(JvSwingUtils.getLabelFont());
+ fontAsCdna.setOpaque(false);
+ fontAsCdna.setText(MessageManager.getString("label.font_as_cdna"));
+ fontAsCdna.setBounds(new Rectangle(1, 105, 350, 23));
+
monospaced.setEnabled(false);
monospaced.setFont(JvSwingUtils.getLabelFont());
monospaced.setOpaque(false);
*/
JPanel jPanel4 = new JPanel();
jPanel4.setOpaque(false);
- jPanel4.setBounds(new Rectangle(24, 112, 300, 35));
+ jPanel4.setBounds(new Rectangle(24, 132, 300, 35));
jPanel4.add(defaultButton);
jPanel4.add(ok);
jPanel4.add(cancel);
this.add(smoothFont);
this.add(scaleAsCdna);
+ this.add(fontAsCdna);
this.add(jPanel3, null);
this.add(jPanel2, null);
this.add(jPanel4);