From: gmungoc Date: Wed, 18 Mar 2015 20:31:15 +0000 (+0000) Subject: JAL-845 adjust both sides of split frame when changing fonts etc X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=21366eb85dd197c07aa40ae50713841e16b5f974;p=jalview.git JAL-845 adjust both sides of split frame when changing fonts etc --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 8998f09..0566ee0 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -185,6 +185,10 @@ public class AlignmentPanel extends GAlignmentPanel implements { overviewPanel.setBoxPosition(); } + if (this.alignFrame.getSplitViewContainer() != null) + { + ((SplitFrame) this.alignFrame.getSplitViewContainer()).adjustLayout(); + } repaint(); } diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index d594051..a29376e 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -91,7 +91,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI /** * Do any tweaking and twerking of the layout wanted. */ - private void adjustLayout() + public void adjustLayout() { /* * Ensure sequence ids are the same width for good alignment. @@ -111,19 +111,23 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI /* * Set the character width for protein to 3 times that for dna. */ - final AlignViewport topViewport = ((AlignFrame) getTopFrame()).viewport; - final AlignViewport bottomViewport = ((AlignFrame) getBottomFrame()).viewport; - final AlignmentI topAlignment = topViewport.getAlignment(); - final AlignmentI bottomAlignment = bottomViewport.getAlignment(); - AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport - : (bottomAlignment.isNucleotide() ? bottomViewport : null); - AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport - : (!bottomAlignment.isNucleotide() ? bottomViewport : null); - if (protein != null && cdna != null) + boolean scaleThreeToOne = true; // TODO a new Preference option? + if (scaleThreeToOne) { - ViewStyleI vs = cdna.getViewStyle(); - vs.setCharWidth(3 * vs.getCharWidth()); - protein.setViewStyle(vs); + final AlignViewport topViewport = ((AlignFrame) getTopFrame()).viewport; + final AlignViewport bottomViewport = ((AlignFrame) getBottomFrame()).viewport; + final AlignmentI topAlignment = topViewport.getAlignment(); + final AlignmentI bottomAlignment = bottomViewport.getAlignment(); + AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport + : (bottomAlignment.isNucleotide() ? bottomViewport : null); + AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport + : (!bottomAlignment.isNucleotide() ? bottomViewport : null); + if (protein != null && cdna != null) + { + ViewStyleI vs = cdna.getViewStyle(); + vs.setCharWidth(3 * vs.getCharWidth()); + protein.setViewStyle(vs); + } } }