From: gmungoc Date: Mon, 13 Apr 2015 14:59:59 +0000 (+0100) Subject: JAL-1690 show 'scale protein' in protein _and_ dna menus; default true X-Git-Tag: Jalview_2_9~69^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e0c4027fce496e56101696f10559eb3ea94c7e7e;p=jalview.git JAL-1690 show 'scale protein' in protein _and_ dna menus; default true --- diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index ae59470..6456878 100644 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -204,6 +204,13 @@ public class FontChooser extends Panel implements ItemListener { if (ap != null) { + ap.av.setScaleProteinAsCdna(oldScaleProtein); + if (ap.av.getCodingComplement() != null) + { + ap.av.getCodingComplement().setScaleProteinAsCdna(oldScaleProtein); + ap.alignFrame.getSplitFrame().repaint(); + } + ap.av.setFont(oldFont); ViewStyleI style = ap.av.getViewStyle(); if (style.getCharWidth() != oldCharWidth) @@ -390,11 +397,10 @@ public class FontChooser extends Panel implements ItemListener optionsPanel.add(stylePanel, null); /* - * Only show 'scale protein as cDNA' in protein half of a SplitFrame + * Only show 'scale protein as cDNA' in a SplitFrame */ this.add(optionsPanel, BorderLayout.NORTH); - if (ap.alignFrame.getSplitFrame() != null - && !ap.av.getAlignment().isNucleotide()) + if (ap.alignFrame.getSplitFrame() != null) { this.add(scalePanel, BorderLayout.CENTER); } @@ -408,8 +414,11 @@ public class FontChooser extends Panel implements ItemListener protected void scaleAsCdna_actionPerformed() { ap.av.setScaleProteinAsCdna(scaleAsCdna.getState()); + ap.av.getCodingComplement().setScaleProteinAsCdna( + scaleAsCdna.getState()); ap.alignFrame.getSplitFrame().adjustLayout(); ap.paintAlignment(true); + ap.alignFrame.getSplitFrame().repaint(); } } diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 72b7bd6..5e13781 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -91,11 +91,10 @@ public class FontChooser extends GFontChooser smoothFont.setSelected(ap.av.antiAlias); /* - * Enable 'scale protein as cDNA' in protein half of a SplitFrame view. The - * selection is stored in the ViewStyle of the Viewport + * Enable 'scale protein as cDNA' in a SplitFrame view. The selection is + * stored in the ViewStyle of both dna and protein Viewport */ - if (ap.av.getCodingComplement() != null - && !ap.av.getAlignment().isNucleotide()) + if (ap.av.getCodingComplement() != null) { scaleAsCdna.setVisible(true); scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna()); @@ -189,6 +188,11 @@ public class FontChooser extends GFontChooser ap.av.setFont(oldFont, true); ap.av.setScaleProteinAsCdna(oldProteinScale); ap.paintAlignment(true); + if (scaleAsCdna.isEnabled()) + { + ap.av.setScaleProteinAsCdna(oldProteinScale); + ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale); + } } else if (tp != null) { @@ -314,10 +318,10 @@ public class FontChooser extends GFontChooser } /** - * DOCUMENT ME! + * 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 - * DOCUMENT ME! */ public void defaultButton_actionPerformed(ActionEvent e) { @@ -326,6 +330,8 @@ public class FontChooser extends GFontChooser Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString()); Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); + Cache.setProperty(Preferences.SCALE_PROTEIN_TO_CDNA, + Boolean.toString(scaleAsCdna.isSelected())); } /** @@ -336,7 +342,13 @@ public class FontChooser extends GFontChooser protected void scaleAsCdna_actionPerformed(ActionEvent e) { ap.av.setScaleProteinAsCdna(scaleAsCdna.isSelected()); - ((SplitFrame) ap.alignFrame.getSplitViewContainer()).adjustLayout(); - ap.paintAlignment(true); + ap.av.getCodingComplement().setScaleProteinAsCdna( + scaleAsCdna.isSelected()); + final SplitFrame splitFrame = (SplitFrame) ap.alignFrame + .getSplitViewContainer(); + splitFrame.adjustLayout(); + splitFrame.repaint(); + // ap.paintAlignment(true); + // TODO would like to repaint } } diff --git a/src/jalview/viewmodel/styles/ViewStyle.java b/src/jalview/viewmodel/styles/ViewStyle.java index fc34be8..adc2baf 100644 --- a/src/jalview/viewmodel/styles/ViewStyle.java +++ b/src/jalview/viewmodel/styles/ViewStyle.java @@ -149,7 +149,7 @@ public class ViewStyle implements ViewStyleI * If true, scale protein residues to 3 times width of cDNA bases (in * SplitFrame views only) */ - private boolean scaleProteinAsCdna = false; + private boolean scaleProteinAsCdna = true; public ViewStyle(ViewStyleI viewStyle) {