package jalview.gui;
-import jalview.api.SplitContainerI;
-import jalview.api.ViewStyleI;
-import jalview.datamodel.AlignmentI;
-import jalview.jbgui.GAlignFrame;
-import jalview.jbgui.GSplitFrame;
-import jalview.structure.StructureSelectionManager;
-import jalview.viewmodel.AlignmentViewport;
-
import java.awt.Component;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
+import jalview.api.SplitContainerI;
+import jalview.api.ViewStyleI;
+import jalview.datamodel.AlignmentI;
+import jalview.jbgui.GAlignFrame;
+import jalview.jbgui.GSplitFrame;
+import jalview.structure.StructureSelectionManager;
+import jalview.viewmodel.AlignmentViewport;
+
/**
* An internal frame on the desktop that hosts a horizontally split view of
* linked DNA and Protein alignments. Additional views can be created in linked
((AlignFrame) getTopFrame()).getViewport().setCodingComplement(
((AlignFrame) getBottomFrame()).getViewport());
- setSize(AlignFrame.DEFAULT_WIDTH, Desktop.instance.getHeight() - 20);
+ int width = ((AlignFrame) getTopFrame()).getWidth();
+ // about 50 pixels for the SplitFrame's title bar etc
+ int height = ((AlignFrame) getTopFrame()).getHeight()
+ + ((AlignFrame) getBottomFrame()).getHeight() + 50;
+ height = Math.min(height, Desktop.instance.getHeight() - 20);
+ // setSize(AlignFrame.DEFAULT_WIDTH, Desktop.instance.getHeight() - 20);
+ setSize(width, height);
adjustLayout();
*/
protected void overrideImplementedKeyBindings()
{
+ overrideFind();
overrideNewView();
overrideCloseView();
overrideExpandViews();
}
super.setComplementVisible(alignFrame, show);
}
+
+ /**
+ * Replace Cmd-F Find action with our version. This is necessary because the
+ * 'default' Finder searches in the first AlignFrame it finds. We need it to
+ * search in the half of the SplitFrame that has the mouse.
+ */
+ protected void overrideFind()
+ {
+ /*
+ * Ctrl-F / Cmd-F open Finder dialog, 'focused' on the right alignment
+ */
+ KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ AbstractAction action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Component c = getFrameAtMouse();
+ if (c != null && c instanceof AlignFrame)
+ {
+ AlignFrame af = (AlignFrame) c;
+ new Finder(af.viewport, af.alignPanel);
+ }
+ }
+ };
+ overrideKeyBinding(key_cmdF, action);
+ }
}