label.light_colour = Light Colour
label.highlightnode = Left click to select leaves.<br>Double-click to invert leaves.<br>Right click to change colour.
label.load_colour_scheme = Load colour scheme
+label.copy_format_from = Copy format from
label.toggle_enabled_views = When enabled, allows many views to be selected.
+label.select_all_views = Select all views
+label.select_many_views = Select many views
label.edit_notes_parameter_set = Click to edit the notes for this parameter set.
label.open_local_file = Open local file
label.enable_automatically_sort_alignment_when_open_new_tree = Enable this to automatically sort<br>the alignment when you open<br> a new tree.
label.paste_new_window = Paste To New Window
label.settings_for_param = Settings for {0}
label.view_params = View {0}
-label.select_all_views = Select all views
label.all_views = All Views
label.align_sequences_to_existing_alignment = Align sequences to an existing alignment
label.realign_with_params = Realign with {0}
{
invalidate();
Dimension d = idPanel.idCanvas.getSize();
- idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);
+ final int canvasHeight = seqPanel.seqCanvas.getSize().height;
+ if (canvasHeight != d.height)
+ {
+ idPanel.idCanvas.setSize(d.width, canvasHeight);
+ }
if (av.getWrapAlignment())
{
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
public class IdwidthAdjuster extends Panel implements MouseListener,
MouseMotionListener
{
active = false;
repaint();
+
+ /*
+ * If in a SplitFrame with co-scaled alignments, set the other's id width to
+ * match; note applet does not (yet) store this in ViewStyle
+ */
+ /*
+ * Code disabled for now as it doesn't work, don't know why; idCanvas width
+ * keeps resetting to a previous value (actually two alternating values!)
+ */
+ // final AlignViewportI viewport = ap.getAlignViewport();
+ // if (viewport.getCodingComplement() != null
+ // && viewport.isScaleProteinAsCdna())
+ // {
+ // Dimension d = ap.idPanel.idCanvas.getSize();
+ // SplitFrame sf = ap.alignFrame.getSplitFrame();
+ // final AlignmentPanel otherPanel =
+ // sf.getComplement(ap.alignFrame).alignPanel;
+ // otherPanel.setIdWidth(d.width, d.height);
+ // otherPanel.repaint();
+ // }
}
public void mouseEntered(MouseEvent evt)
Dimension d = ap.idPanel.idCanvas.getSize();
int dif = evt.getX() - oldX;
- if (d.width + dif > 20 || dif > 0)
+ final int newWidth = d.width + dif;
+ if (newWidth > 20 || dif > 0)
{
- ap.setIdWidth(d.width + dif, d.height);
- this.setSize(d.width + dif, getSize().height);
+ ap.setIdWidth(newWidth, d.height);
+ this.setSize(newWidth, getSize().height);
oldX = evt.getX();
}
-
}
public void mouseMoved(MouseEvent evt)
final List<AlignmentPanel> selviews = new ArrayList<AlignmentPanel>();
final List<AlignmentPanel> origview = new ArrayList<AlignmentPanel>();
- ViewSelectionMenu vsel = new ViewSelectionMenu("Transfer colours from",
+ final String menuLabel = MessageManager
+ .getString("label.copy_format_from");
+ ViewSelectionMenu vsel = new ViewSelectionMenu(menuLabel,
new ViewSetProvider()
{
{
origview.clear();
origview.add(alignPanel);
- return Desktop.getAlignmentPanels(null);
+ // make an array of all alignment panels except for this one
+ List<AlignmentPanel> aps = new ArrayList<AlignmentPanel>(
+ Arrays.asList(Desktop.getAlignmentPanels(null)));
+ aps.remove(AlignFrame.this.alignPanel);
+ return aps.toArray(new AlignmentPanel[aps.size()]);
}
}, selviews, new ItemListener()
{
{
if (origview.size() > 0)
{
+ final AlignmentPanel ap = origview.get(0);
+
+ /*
+ * Copy the ViewStyle of the selected panel to 'this one'.
+ * Don't change value of 'scaleProteinAsCdna' unless copying
+ * from a SplitFrame.
+ */
ViewStyleI vs = selviews.get(0).getAlignViewport()
.getViewStyle();
- origview.get(0).getAlignViewport().setViewStyle(vs);
- AlignViewportI complement = origview.get(0)
- .getAlignViewport().getCodingComplement();
- if (complement != null)
+ boolean fromSplitFrame = selviews.get(0)
+ .getAlignViewport().getCodingComplement() != null;
+ if (!fromSplitFrame)
+ {
+ vs.setScaleProteinAsCdna(ap.getAlignViewport()
+ .getViewStyle().isScaleProteinAsCdna());
+ }
+ ap.getAlignViewport().setViewStyle(vs);
+
+ /*
+ * Also rescale ViewStyle of SplitFrame complement if there is
+ * one _and_ it is set to 'scaledProteinAsCdna'; we don't copy
+ * the whole ViewStyle (allow cDNA protein to have different
+ * fonts)
+ */
+ AlignViewportI complement = ap.getAlignViewport()
+ .getCodingComplement();
+ if (complement != null && vs.isScaleProteinAsCdna())
{
AlignFrame af = Desktop.getAlignFrameFor(complement);
- if (complement.isNucleotide())
- {
- complement.setViewStyle(vs);
- vs.setCharWidth(vs.getCharWidth() / 3);
- }
- else
- {
- int rw = vs.getCharWidth();
- vs.setCharWidth(rw * 3);
- complement.setViewStyle(vs);
- vs.setCharWidth(rw);
- }
- af.alignPanel.updateLayout();
+ ((SplitFrame) af.getSplitViewContainer())
+ .adjustLayout();
af.setMenusForViewport();
}
- origview.get(0).updateLayout();
- origview.get(0).setSelected(true);
- origview.get(0).alignFrame.setMenusForViewport();
+
+ ap.updateLayout();
+ ap.setSelected(true);
+ ap.alignFrame.setMenusForViewport();
}
}
{
try
{
+ if (alignFrame.getSplitViewContainer() != null)
+ {
+ /*
+ * bring enclosing SplitFrame to front first if there is one
+ */
+ ((SplitFrame) alignFrame.getSplitViewContainer()).setSelected(b);
+ }
alignFrame.setSelected(b);
} catch (Exception ex)
{
}
- ;
if (b)
{
*/
package jalview.gui;
-import jalview.util.MessageManager;
-
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.util.List;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
+import jalview.util.MessageManager;
+
/**
* this is an implementation of an abstract Jalview GUI class that provides a
* dialog/menu which allows the user to select/deselect specific views from a
{
// ensure we update menu state to reflect external selection list state
append = append || _selectedviews.size() > 1;
- toggleview = new JCheckBoxMenuItem("Select many views", append);
+ toggleview = new JCheckBoxMenuItem(
+ MessageManager.getString("label.select_many_views"), append);
toggleview.setToolTipText(MessageManager
.getString("label.toggle_enabled_views"));
toggleview.addItemListener(new ItemListener()
invertSel.setEnabled(append);
selectAll.setEnabled(append);
}
- for (AlignmentPanel ap : allviews)
+ for (final AlignmentPanel ap : allviews)
{
String nm = ((ap.getViewName() == null || ap.getViewName().length() == 0) ? ""
: ap.getViewName() + " for ")
+ ap.alignFrame.getTitle();
- final JCheckBoxMenuItem a = new JCheckBoxMenuItem(nm,
+ final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(nm,
_selectedviews.contains(ap));
- final AlignmentPanel p = ap;
- a.addItemListener(new ItemListener()
+ checkBox.addItemListener(new ItemListener()
{
@Override
public void itemStateChanged(ItemEvent e)
{
enabled = false;
// toggle the inclusion state
- if (_selectedviews.indexOf(p) == -1)
+ if (_selectedviews.indexOf(ap) == -1)
{
- _selectedviews.add(p);
- a.setSelected(true);
+ _selectedviews.add(ap);
+ checkBox.setSelected(true);
}
else
{
- _selectedviews.remove(p);
- a.setSelected(false);
+ _selectedviews.remove(ap);
+ checkBox.setSelected(false);
}
enabled = true;
_handler.itemStateChanged(e);
{
// Deselect everything and select this item only
_selectedviews.clear();
- _selectedviews.add(p);
+ _selectedviews.add(ap);
enabled = false;
for (Component c : getMenuComponents())
{
if (c instanceof JCheckBoxMenuItem)
{
- ((JCheckBoxMenuItem) c).setSelected(a == c);
+ ((JCheckBoxMenuItem) c).setSelected(checkBox == c);
}
}
enabled = true;
}
}
});
- a.addMouseListener(new MouseListener()
+ checkBox.addMouseListener(new MouseAdapter()
{
-
- @Override
- public void mouseReleased(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mousePressed(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
@Override
public void mouseExited(MouseEvent e)
{
try
{
- p.setSelected(false);
+ ap.setSelected(false);
} catch (Exception ex)
{
}
- ;
}
@Override
public void mouseEntered(MouseEvent e)
{
-
try
{
- p.setSelected(true);
+ ap.setSelected(true);
} catch (Exception ex)
{
}
- ;
- }
-
- @Override
- public void mouseClicked(MouseEvent e)
- {
}
});
- add(a);
+ add(checkBox);
}
}