From: amwaterhouse Date: Thu, 2 Nov 2006 15:11:18 +0000 (+0000) Subject: selected states set in updateMenusFromViewport X-Git-Tag: Release_2_2~191 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=488e3a038c2ba1a3926f2af5eaea97ba76e028d0;p=jalview.git selected states set in updateMenusFromViewport --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2b4b7e0..7ef0e25 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -59,8 +59,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener /** DOCUMENT ME!! */ public String currentFileFormat = null; - Stack historyList = new Stack(); - Stack redoList = new Stack(); + private int treeCount = 0; /** @@ -136,13 +135,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener setGUINucleotide(viewport.alignment.isNucleotide()); } - if (jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false)) + setMenusFromViewport(viewport); + + if (viewport.wrapAlignment) { - wrapMenuItem.setSelected(true); wrapMenuItem_actionPerformed(null); } addKeyListener(); + + } void addKeyListener() @@ -177,6 +179,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener if(viewport.viewName==null) viewport.viewName="View 1"; + newview.historyList = viewport.historyList; + newview.redoList = viewport.redoList; + newview.sequenceSetID = viewport.getSequenceSetId(); newview.viewName = "View " + (Desktop.getViewCount(viewport.getSequenceSetId())+1); @@ -464,10 +469,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener public void setGUINucleotide(boolean nucleotide) { showTranslation.setVisible( nucleotide ); - //sequenceFeatures.setVisible(!nucleotide ); - //featureSettings.setVisible( !nucleotide ); - conservationMenuItem.setVisible( !nucleotide ); - modifyConservation.setVisible( !nucleotide ); + conservationMenuItem.setEnabled( !nucleotide ); + modifyConservation.setEnabled( !nucleotide ); //Remember AlignFrame always starts as protein if(!nucleotide) @@ -476,6 +479,34 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener } } + /** + * Need to call this method when tabs are selected for multiple views, + * or when loading from Jalview2XML.java + * @param av AlignViewport + */ + void setMenusFromViewport(AlignViewport av) + { + colourTextMenuItem.setSelected(av.showColourText); + abovePIDThreshold.setSelected(av.getAbovePIDThreshold()); + conservationMenuItem.setSelected(av.getConservationSelected()); + seqLimits.setSelected(av.getShowJVSuffix()); + renderGapsMenuItem.setSelected(av.renderGaps); + wrapMenuItem.setSelected(av.wrapAlignment); + annotationPanelMenuItem.setState(av.showAnnotation); + viewBoxesMenuItem.setSelected(av.showBoxes); + viewTextMenuItem.setSelected(av.showText); + + setColourSelected(ColourSchemeProperty. + getColourName(av.getGlobalColourScheme())); + + showSeqFeatures.setSelected(av.showSequenceFeatures); + hiddenMarkers.setState(av.showHiddenMarkers); + applyToAllGroups.setState(av.colourAppliesToAllGroups); + smoothFont.setState(av.antiAlias); + + updateEditMenuBar(); + } + Hashtable progressBars; public void setProgressBar(String message, long id) @@ -823,10 +854,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener void updateEditMenuBar() { - if (historyList.size() > 0) + if (viewport.historyList.size() > 0) { undoMenuItem.setEnabled(true); - CommandI command = (CommandI) historyList.peek(); + CommandI command = (CommandI) viewport.historyList.peek(); undoMenuItem.setText("Undo " + command.getDescription()); } else @@ -835,11 +866,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener undoMenuItem.setText("Undo"); } - if (redoList.size() > 0) + if (viewport.redoList.size() > 0) { redoMenuItem.setEnabled(true); - CommandI command = (CommandI) redoList.peek(); + CommandI command = (CommandI) viewport.redoList.peek(); redoMenuItem.setText("Redo " + command.getDescription()); } else @@ -854,8 +885,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener { if(command.getSize()>0) { - historyList.push(command); - redoList.clear(); + viewport.historyList.push(command); + viewport.redoList.clear(); updateEditMenuBar(); viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; } @@ -870,8 +901,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener */ protected void undoMenuItem_actionPerformed(ActionEvent e) { - CommandI command = (CommandI)historyList.pop(); - redoList.push(command); + CommandI command = (CommandI)viewport.historyList.pop(); + viewport.redoList.push(command); command.undoCommand(); viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; @@ -887,8 +918,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener */ protected void redoMenuItem_actionPerformed(ActionEvent e) { - CommandI command = (CommandI) redoList.pop(); - historyList.push(command); + CommandI command = (CommandI) viewport.redoList.pop(); + viewport.historyList.push(command); command.doCommand(); viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null; @@ -1489,7 +1520,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener } } - viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } } @@ -3100,6 +3132,7 @@ public void drop(DropTargetDropEvent evt) { alignPanel = (AlignmentPanel) alignPanels.elementAt(index); viewport = alignPanel.av; + setMenusFromViewport(viewport); } } diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 4287e70..cbe888a 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -827,7 +827,6 @@ public class GAlignFrame } }); applyToAllGroups.setText("Apply Colour To All Groups"); - applyToAllGroups.setState(true); applyToAllGroups.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -958,14 +957,7 @@ public class GAlignFrame } }); - /* tabbedPane.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent ece) - { - tabSelected(); - } - });*/ featureSettings.setText("Feature Settings..."); featureSettings.addActionListener(new ActionListener() { @@ -990,7 +982,7 @@ public class GAlignFrame smoothFont_actionPerformed(e); } }); - smoothFont.setState( jalview.bin.Cache.getDefault("ANTI_ALIAS",false)); + annotationColour.setText("By Annotation..."); annotationColour.addActionListener(new ActionListener() { @@ -1093,7 +1085,6 @@ public class GAlignFrame } }); hiddenMarkers.setText("Hidden Markers"); - hiddenMarkers.setState(true); hiddenMarkers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e)