Merge branch 'develop' into features/JAL-2435splitScreenFont
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 3 Apr 2017 10:55:29 +0000 (11:55 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 3 Apr 2017 10:55:29 +0000 (11:55 +0100)
14 files changed:
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/api/AlignViewportI.java
src/jalview/api/ViewStyleI.java
src/jalview/appletgui/AlignViewport.java
src/jalview/appletgui/FontChooser.java
src/jalview/appletgui/SeqPanel.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/FontChooser.java
src/jalview/gui/SplitFrame.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GFontChooser.java
src/jalview/viewmodel/AlignmentViewport.java
src/jalview/viewmodel/styles/ViewStyle.java

index f284ff9..e179a68 100644 (file)
@@ -1219,6 +1219,7 @@ label.configure_displayed_columns = Customise Displayed Options
 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
index a878ab7..9d7c2e4 100644 (file)
@@ -1144,6 +1144,7 @@ label.open_split_window=Abrir ventana dividida
 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
@@ -1162,6 +1163,7 @@ label.find=Buscar
 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
@@ -1179,7 +1181,6 @@ info.change_threshold_mode_to_enable=Cambiar Modo de Umbral para Habilitar
 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
index 8b07340..9e6d1c0 100644 (file)
@@ -36,6 +36,7 @@ import jalview.schemes.ColourSchemeI;
 import jalview.viewmodel.ViewportRanges;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -470,4 +471,27 @@ public interface AlignViewportI extends ViewStyleI
    * @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);
+
+  /**
+   * Answers true if split screen protein and cDNA use the same font
+   * 
+   * @return
+   */
+  boolean isProteinFontAsCdna();
+
+  /**
+   * Set the flag for whether split screen protein and cDNA use the same font
+   * 
+   * @return
+   */
+  void setProteinFontAsCdna(boolean b);
 }
index db82dcf..2b554ea 100644 (file)
@@ -257,4 +257,18 @@ public interface ViewStyleI
    * @return
    */
   void setScaleProteinAsCdna(boolean b);
+
+  /**
+   * Answers true if split screen protein and cDNA use the same font
+   * 
+   * @return
+   */
+  boolean isProteinFontAsCdna();
+
+  /**
+   * Set the flag for whether split screen protein and cDNA use the same font
+   * 
+   * @return
+   */
+  void setProteinFontAsCdna(boolean b);
 }
index 065c503..cb0b197 100644 (file)
@@ -42,6 +42,7 @@ import jalview.viewmodel.AlignmentViewport;
 import jalview.viewmodel.ViewportRanges;
 
 import java.awt.Font;
+import java.awt.FontMetrics;
 
 public class AlignViewport extends AlignmentViewport implements
         SelectionSource
@@ -129,7 +130,7 @@ public class AlignViewport extends AlignmentViewport implements
         }
       }
     }
-    setFont(font);
+    setFont(font, true);
 
     MAC = new jalview.util.Platform().isAMac();
 
@@ -269,7 +270,11 @@ public class AlignViewport extends AlignmentViewport implements
 
   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)
@@ -278,14 +283,17 @@ public class AlignViewport extends AlignmentViewport implements
       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)));
     }
   }
index 59f6957..727aa88 100644 (file)
@@ -59,6 +59,8 @@ public class FontChooser extends Panel implements ItemListener
 
   private Checkbox scaleAsCdna = new Checkbox();
 
+  private Checkbox fontAsCdna = new Checkbox();
+
   private Button ok = new Button();
 
   private Button cancel = new Button();
@@ -83,6 +85,8 @@ public class FontChooser extends Panel implements ItemListener
 
   private Frame frame;
 
+  boolean inSplitFrame = false;
+
   /**
    * Constructor for a TreePanel font chooser
    * 
@@ -152,7 +156,7 @@ public class FontChooser extends Panel implements ItemListener
     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;
   }
@@ -160,6 +164,7 @@ public class FontChooser extends Panel implements ItemListener
   /**
    * Actions on change of font name, size or style.
    */
+  @Override
   public void itemStateChanged(ItemEvent evt)
   {
     final Object source = evt.getSource();
@@ -208,10 +213,11 @@ public class FontChooser extends Panel implements ItemListener
       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)
       {
@@ -276,8 +282,19 @@ public class FontChooser extends Panel implements ItemListener
     }
     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;
@@ -344,6 +361,10 @@ public class FontChooser extends Panel implements ItemListener
     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()
@@ -388,7 +409,8 @@ public class FontChooser extends Panel implements ItemListener
     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);
 
@@ -402,6 +424,7 @@ public class FontChooser extends Panel implements ItemListener
     this.add(optionsPanel, BorderLayout.NORTH);
     if (ap.alignFrame.getSplitFrame() != null)
     {
+      inSplitFrame = true;
       this.add(scalePanel, BorderLayout.CENTER);
     }
     this.add(okCancelPanel, BorderLayout.SOUTH);
index 0e12703..4b200ad 100644 (file)
@@ -959,7 +959,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
           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
index 602e3a1..96a5cbe 100644 (file)
@@ -57,6 +57,7 @@ import jalview.ws.params.AutoCalcSetting;
 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;
@@ -348,23 +349,19 @@ public class AlignViewport extends AlignmentViewport implements
   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);
     }
index 8220aea..fdf3d2a 100755 (executable)
@@ -26,12 +26,10 @@ import jalview.util.MessageManager;
 
 import java.awt.Font;
 import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
 import java.awt.geom.Rectangle2D;
 
 import javax.swing.JInternalFrame;
 import javax.swing.JLayeredPane;
-import javax.swing.JOptionPane;
 
 /**
  * DOCUMENT ME!
@@ -50,8 +48,16 @@ public class FontChooser extends GFontChooser
    */
   Font oldFont;
 
+  /*
+   * the state of 'scale protein as cDNA' on opening the dialog
+   */
   boolean oldProteinScale;
 
+  /*
+   * the state of 'same font for protein and cDNA' on opening the dialog
+   */
+  boolean oldMirrorFont;
+
   boolean init = true;
 
   JInternalFrame frame;
@@ -64,33 +70,32 @@ public class FontChooser extends GFontChooser
   private boolean lastSelMono = false;
 
   /**
-   * Creates a new FontChooser object.
+   * Creates a new FontChooser for a tree panel
    * 
-   * @param ap
-   *          DOCUMENT ME!
+   * @param treePanel
    */
-  public FontChooser(TreePanel tp)
+  public FontChooser(TreePanel treePanel)
   {
-    this.tp = tp;
-    ap = tp.treeCanvas.ap;
-    oldFont = tp.getTreeFont();
+    this.tp = treePanel;
+    ap = treePanel.treeCanvas.ap;
+    oldFont = treePanel.getTreeFont();
     defaultButton.setVisible(false);
     smoothFont.setEnabled(false);
     init();
   }
 
   /**
-   * Creates a new FontChooser object.
+   * Creates a new FontChooser for an alignment panel
    * 
-   * @param ap
-   *          DOCUMENT ME!
+   * @param alignPanel
    */
-  public FontChooser(AlignmentPanel ap)
+  public FontChooser(AlignmentPanel alignPanel)
   {
-    oldFont = ap.av.getFont();
-    oldProteinScale = ap.av.isScaleProteinAsCdna();
+    oldFont = alignPanel.av.getFont();
+    oldProteinScale = alignPanel.av.isScaleProteinAsCdna();
+    oldMirrorFont = alignPanel.av.isProteinFontAsCdna();
 
-    this.ap = ap;
+    this.ap = alignPanel;
     init();
   }
 
@@ -103,14 +108,16 @@ public class FontChooser extends GFontChooser
 
     /*
      * 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(ap.av.isProteinFontAsCdna());
     }
 
     if (tp != null)
@@ -122,7 +129,7 @@ public class FontChooser extends GFontChooser
     else
     {
       Desktop.addInternalFrame(frame,
-              MessageManager.getString("action.change_font"), 380, 200,
+              MessageManager.getString("action.change_font"), 380, 220,
               false);
     }
 
@@ -158,7 +165,7 @@ public class FontChooser extends GFontChooser
   }
 
   @Override
-  public void smoothFont_actionPerformed(ActionEvent e)
+  protected void smoothFont_actionPerformed()
   {
     ap.av.antiAlias = smoothFont.isSelected();
     ap.getAnnotationPanel().image = null;
@@ -172,7 +179,7 @@ public class FontChooser extends GFontChooser
    *          DOCUMENT ME!
    */
   @Override
-  protected void ok_actionPerformed(ActionEvent e)
+  protected void ok_actionPerformed()
   {
     try
     {
@@ -197,26 +204,26 @@ public class FontChooser extends GFontChooser
    *          DOCUMENT ME!
    */
   @Override
-  protected void cancel_actionPerformed(ActionEvent e)
+  protected void cancel_actionPerformed()
   {
     if (ap != null)
     {
       ap.av.setFont(oldFont, true);
       ap.av.setScaleProteinAsCdna(oldProteinScale);
+      ap.av.setProteinFontAsCdna(oldMirrorFont);
       ap.paintAlignment(true);
-      if (scaleAsCdna.isEnabled())
+
+      if (scaleAsCdna.isVisible() && scaleAsCdna.isEnabled())
       {
-        ap.av.setScaleProteinAsCdna(oldProteinScale);
         ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale);
+        ap.av.getCodingComplement().setProteinFontAsCdna(oldMirrorFont);
+        ap.av.getCodingComplement().setFont(oldFont, true);
       }
     }
     else if (tp != null)
     {
       tp.setTreeFont(oldFont);
     }
-    fontName.setSelectedItem(oldFont.getName());
-    fontSize.setSelectedItem(oldFont.getSize());
-    fontStyle.setSelectedIndex(oldFont.getStyle());
 
     try
     {
@@ -287,6 +294,30 @@ public class FontChooser extends GFontChooser
     {
       ap.av.setFont(newFont, true);
       ap.fontChanged();
+
+      /*
+       * adjust other half of split frame if any, if either same
+       * font, or proportionate scaling, is selected
+       */
+      if (fontAsCdna.isEnabled())
+      {
+        if (fontAsCdna.isSelected())
+        {
+          /*
+           * copy the font
+           */
+          ap.av.getCodingComplement().setFont(newFont, true);
+        }
+        if (fontAsCdna.isSelected() || scaleAsCdna.isSelected())
+        {
+          /*
+           * adjust layout for font change and/or sizing
+           */
+          SplitFrame splitFrame = (SplitFrame) ap.alignFrame
+                  .getSplitViewContainer();
+          splitFrame.repaint();
+        }
+      }
     }
 
     monospaced.setSelected(mw == iw);
@@ -299,13 +330,10 @@ public class FontChooser extends GFontChooser
   }
 
   /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
+   * Updates on change of selected font name
    */
   @Override
-  protected void fontName_actionPerformed(ActionEvent e)
+  protected void fontName_actionPerformed()
   {
     if (init)
     {
@@ -316,13 +344,10 @@ public class FontChooser extends GFontChooser
   }
 
   /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
+   * Updates on change of selected font size
    */
   @Override
-  protected void fontSize_actionPerformed(ActionEvent e)
+  protected void fontSize_actionPerformed()
   {
     if (init)
     {
@@ -333,13 +358,10 @@ public class FontChooser extends GFontChooser
   }
 
   /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
+   * Updates on change of selected font style
    */
   @Override
-  protected void fontStyle_actionPerformed(ActionEvent e)
+  protected void fontStyle_actionPerformed()
   {
     if (init)
     {
@@ -352,11 +374,9 @@ public class FontChooser extends GFontChooser
   /**
    * Make selected settings the defaults by storing them (via Cache class) in
    * the .jalview_properties file (the file is only written when Jalview exits)
-   * 
-   * @param e
    */
   @Override
-  public void defaultButton_actionPerformed(ActionEvent e)
+  public void defaultButton_actionPerformed()
   {
     Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());
     Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + "");
@@ -372,7 +392,7 @@ public class FontChooser extends GFontChooser
    * characters
    */
   @Override
-  protected void scaleAsCdna_actionPerformed(ActionEvent e)
+  protected void scaleAsCdna_actionPerformed()
   {
     ap.av.setScaleProteinAsCdna(scaleAsCdna.isSelected());
     ap.av.getCodingComplement().setScaleProteinAsCdna(
@@ -381,7 +401,23 @@ public class FontChooser extends GFontChooser
             .getSplitViewContainer();
     splitFrame.adjustLayout();
     splitFrame.repaint();
-    // ap.paintAlignment(true);
-    // TODO would like to repaint
+  }
+
+  /**
+   * Turn on/off mirroring of font across split frame. If turning on, also
+   * copies the current font across the split frame. If turning off, does not
+   * change fonts.
+   */
+  @Override
+  protected void mirrorFonts_actionPerformed()
+  {
+    boolean selected = fontAsCdna.isSelected();
+    ap.av.setProteinFontAsCdna(selected);
+    ap.av.getCodingComplement().setProteinFontAsCdna(selected);
+
+    if (selected)
+    {
+      changeFont();
+    }
   }
 }
index 6c849c3..1d929e6 100644 (file)
@@ -21,7 +21,6 @@
 package jalview.gui;
 
 import jalview.api.SplitContainerI;
-import jalview.api.ViewStyleI;
 import jalview.datamodel.AlignmentI;
 import jalview.jbgui.GAlignFrame;
 import jalview.jbgui.GSplitFrame;
@@ -189,10 +188,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI
             : (!bottomAlignment.isNucleotide() ? bottomViewport : null);
     if (protein != null && cdna != null)
     {
-      ViewStyleI vs = protein.getViewStyle();
-      int scale = vs.isScaleProteinAsCdna() ? 3 : 1;
-      vs.setCharWidth(scale * cdna.getViewStyle().getCharWidth());
-      protein.setViewStyle(vs);
+      int scale = protein.isScaleProteinAsCdna() ? 3 : 1;
+      protein.setCharWidth(scale * cdna.getViewStyle().getCharWidth());
     }
   }
 
index b759d64..ca2c194 100755 (executable)
@@ -1905,12 +1905,6 @@ public class GAlignFrame extends JInternalFrame
     // selectMenu.add(listenToViewSelections);
   }
 
-  protected void configureSelectMenu()
-  {
-    // TODO Auto-generated method stub
-
-  }
-
   /**
    * Constructs the entries on the Colour menu (but does not add them to the
    * menu).
index 8c893a2..5c15e80 100755 (executable)
@@ -63,6 +63,8 @@ public class GFontChooser extends JPanel
 
   protected JCheckBox scaleAsCdna = new JCheckBox();
 
+  protected JCheckBox fontAsCdna = new JCheckBox();
+
   /**
    * Creates a new GFontChooser object.
    */
@@ -98,9 +100,10 @@ public class GFontChooser extends JPanel
     fontSize.setPreferredSize(new Dimension(50, 21));
     fontSize.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        fontSize_actionPerformed(e);
+        fontSize_actionPerformed();
       }
     });
 
@@ -109,9 +112,10 @@ public class GFontChooser extends JPanel
     fontStyle.setPreferredSize(new Dimension(90, 21));
     fontStyle.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        fontStyle_actionPerformed(e);
+        fontStyle_actionPerformed();
       }
     });
 
@@ -132,9 +136,10 @@ public class GFontChooser extends JPanel
     fontName.setPreferredSize(new Dimension(180, 21));
     fontName.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        fontName_actionPerformed(e);
+        fontName_actionPerformed();
       }
     });
 
@@ -142,9 +147,10 @@ public class GFontChooser extends JPanel
     ok.setFont(VERDANA_11PT);
     ok.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        ok_actionPerformed(e);
+        ok_actionPerformed();
       }
     });
 
@@ -152,9 +158,10 @@ public class GFontChooser extends JPanel
     cancel.setFont(VERDANA_11PT);
     cancel.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        cancel_actionPerformed(e);
+        cancel_actionPerformed();
       }
     });
 
@@ -162,37 +169,57 @@ public class GFontChooser extends JPanel
     defaultButton.setText(MessageManager.getString("label.set_as_default"));
     defaultButton.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        defaultButton_actionPerformed(e);
+        defaultButton_actionPerformed();
       }
     });
 
     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);
+        smoothFont_actionPerformed();
       }
     });
 
     /*
-     * 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();
+      }
+    });
+
+    /*
+     * 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));
+    fontAsCdna.addActionListener(new ActionListener()
+    {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
-        scaleAsCdna_actionPerformed(e);
+        mirrorFonts_actionPerformed();
       }
     });
 
@@ -239,85 +266,53 @@ public class GFontChooser extends JPanel
      */
     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);
     this.add(jPanel1, null);
   }
 
-  protected void scaleAsCdna_actionPerformed(ActionEvent e)
+  protected void mirrorFonts_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  protected void ok_actionPerformed(ActionEvent e)
+  protected void scaleAsCdna_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  protected void cancel_actionPerformed(ActionEvent e)
+  protected void ok_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  protected void fontName_actionPerformed(ActionEvent e)
+  protected void cancel_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  protected void fontSize_actionPerformed(ActionEvent e)
+  protected void fontName_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  protected void fontStyle_actionPerformed(ActionEvent e)
+  protected void fontSize_actionPerformed()
   {
   }
 
-  /**
-   * DOCUMENT ME!
-   * 
-   * @param e
-   *          DOCUMENT ME!
-   */
-  public void defaultButton_actionPerformed(ActionEvent e)
+  protected void fontStyle_actionPerformed()
   {
   }
 
-  public void smoothFont_actionPerformed(ActionEvent e)
+  public void defaultButton_actionPerformed()
   {
+  }
 
+  protected void smoothFont_actionPerformed()
+  {
   }
 }
index 47dceec..ae678fb 100644 (file)
  */
 package jalview.viewmodel;
 
-import java.awt.Color;
-import java.beans.PropertyChangeSupport;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.analysis.Conservation;
 import jalview.api.AlignCalcManagerI;
@@ -68,6 +57,17 @@ import jalview.workers.ComplementConsensusThread;
 import jalview.workers.ConsensusThread;
 import jalview.workers.StrucConsensusThread;
 
+import java.awt.Color;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
 /**
  * base class holding visualization and analysis attributes and common logic for
  * an active alignment view displayed in the GUI
@@ -2650,6 +2650,18 @@ public abstract class AlignmentViewport implements AlignViewportI,
     viewStyle.setScaleProteinAsCdna(b);
   }
 
+  @Override
+  public boolean isProteinFontAsCdna()
+  {
+    return viewStyle.isProteinFontAsCdna();
+  }
+
+  @Override
+  public void setProteinFontAsCdna(boolean b)
+  {
+    viewStyle.setProteinFontAsCdna(b);
+  }
+
   /**
    * @return true if view should scroll to show the highlighted region of a
    *         sequence
index 14a1bde..f01047d 100644 (file)
@@ -168,6 +168,12 @@ public class ViewStyle implements ViewStyleI
    */
   private boolean scaleProteinAsCdna = true;
 
+  /*
+   * if true, font changes to protein or cDNA are applied to both
+   * sides of a split screen
+   */
+  private boolean proteinFontAsCdna = true;
+
   /**
    * Copy constructor
    * 
@@ -195,6 +201,7 @@ public class ViewStyle implements ViewStyleI
     setScaleAboveWrapped(vs.getScaleAboveWrapped());
     setScaleLeftWrapped(vs.getScaleLeftWrapped());
     setScaleProteinAsCdna(vs.isScaleProteinAsCdna());
+    setProteinFontAsCdna(vs.isProteinFontAsCdna());
     setScaleRightWrapped(vs.getScaleRightWrapped());
     setSeqNameItalics(vs.isSeqNameItalics());
     setShowAnnotation(vs.isShowAnnotation());
@@ -255,6 +262,7 @@ public class ViewStyle implements ViewStyleI
             && getScaleAboveWrapped() == vs.getScaleAboveWrapped()
             && getScaleLeftWrapped() == vs.getScaleLeftWrapped()
             && isScaleProteinAsCdna() == vs.isScaleProteinAsCdna()
+            && isProteinFontAsCdna() == vs.isProteinFontAsCdna()
             && getScaleRightWrapped() == vs.getScaleRightWrapped()
             && isSeqNameItalics() == vs.isSeqNameItalics()
             && isShowAnnotation() == vs.isShowAnnotation()
@@ -1094,4 +1102,16 @@ public class ViewStyle implements ViewStyleI
   {
     this.scaleProteinAsCdna = b;
   }
+
+  @Override
+  public boolean isProteinFontAsCdna()
+  {
+    return proteinFontAsCdna;
+  }
+
+  @Override
+  public void setProteinFontAsCdna(boolean b)
+  {
+    proteinFontAsCdna = b;
+  }
 }