From 131340b547874c6c87f66e78c563b15572fa0621 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 8 Aug 2019 16:07:21 +0100 Subject: [PATCH] JAL-3403 Fit To Window menu item for Jmol --- src/jalview/ext/jmol/JalviewJmolBinding.java | 13 +++++++++++++ src/jalview/gui/ChimeraViewFrame.java | 7 ------- src/jalview/gui/StructureViewerBase.java | 1 + src/jalview/jbgui/GStructureViewer.java | 6 +----- .../structures/models/AAStructureBindingModel.java | 7 +++++++ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 7acafd7..972f093 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -1460,4 +1460,17 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { return String.valueOf(model + 1) + ".1"; } + + /** + * Sends a command to recentre the display + */ + @Override + public void focusView() + { + /* + * don't use evalStateCommand because it ignores a command that is the same + * as the last command (why?); but user may have adjusted the display since + */ + viewer.evalString("zoom 0"); + } } diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 71e90d9..08cad53 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -98,7 +98,6 @@ public class ChimeraViewFrame extends StructureViewerBase helpItem.setText(MessageManager.getString("label.chimera_help")); savemenu.setVisible(false); // not yet implemented - viewMenu.add(fitToWindow); JMenuItem writeFeatures = new JMenuItem( MessageManager.getString("label.create_chimera_attributes")); @@ -787,12 +786,6 @@ public class ChimeraViewFrame extends StructureViewerBase } @Override - protected void fitToWindow_actionPerformed() - { - jmb.focusView(); - } - - @Override public ViewerType getViewerType() { return ViewerType.CHIMERA; diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index e7e2967..b327176 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -784,6 +784,7 @@ public abstract class StructureViewerBase extends GStructureViewer } }); viewMenu.add(hideHiddenRegions); + viewMenu.add(fitToWindow); final ItemListener handler = new ItemListener() { diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index a7a970f..7fc56d2 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -161,7 +161,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - fitToWindow_actionPerformed(); + getBinding().focusView(); } }); @@ -215,10 +215,6 @@ public abstract class GStructureViewer extends JInternalFrame statusPanel.add(statusBar, null); } - protected void fitToWindow_actionPerformed() - { - } - protected void highlightSelection_actionPerformed() { } diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 1dea2c6..af5fd0a 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -1055,4 +1055,11 @@ public abstract class AAStructureBindingModel { return chainNames; } + + /** + * Send a command to resize and/or centre the structure display + */ + public void focusView() + { + } } -- 1.7.10.2