X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=4f13a780ccf18be43213908eb5f284c9a88c1b48;hb=cd669a0e8c7b91b379bca8fe6e702cf0fcbd1ce0;hp=d225c2e90dbbc51b35e68a5f7f6e6b46c87aaaa6;hpb=1f66bdde8f5379d17fe56001443e0e6fde1150d1;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d225c2e..4f13a78 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -95,6 +95,7 @@ import jalview.api.analysis.SimilarityParamsI; import jalview.bin.Cache; import jalview.bin.Console; import jalview.bin.Jalview; +import jalview.bin.groovy.JalviewObjectI; import jalview.commands.CommandI; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; @@ -503,7 +504,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void focusGained(FocusEvent e) { - Jalview.setCurrentAlignFrame(AlignFrame.this); + Jalview.getInstance().setCurrentAlignFrame(AlignFrame.this); } }); @@ -1252,10 +1253,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void saveAlignment(String file, FileFormatI format) { - saveAlignment(file, format, false); + saveAlignment(file, format, false, false); } - public void saveAlignment(String file, FileFormatI format, boolean stdout) + public void saveAlignment(String file, FileFormatI format, boolean stdout, + boolean forceBackup) { lastSaveSuccessful = true; if (!stdout) @@ -1308,7 +1310,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, else { // create backupfiles object and get new temp filename destination - boolean doBackup = BackupFiles.getEnabled() && !stdout; + boolean doBackup = forceBackup + || (BackupFiles.getEnabled() && !stdout); BackupFiles backupfiles = null; if (doBackup) { @@ -1562,7 +1565,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void createPNG(File f) throws ImageOutputException { - createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing()); + createPNG(f, null, BitmapImageSizing.defaultBitmapImageSizing()); } public void createPNG(File f, String renderer, BitmapImageSizing userBis) @@ -1794,7 +1797,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * * @return alignment objects for all views */ - AlignmentI[] getViewAlignments() + public AlignmentI[] getViewAlignments() { if (alignPanels != null) { @@ -4815,7 +4818,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * Object[] { String,SequenceI} */ ArrayList filesmatched = new ArrayList<>(); - ArrayList filesnotmatched = new ArrayList<>(); + ArrayList filesnotmatched = new ArrayList<>(); for (int i = 0; i < files.size(); i++) { // BH 2018 @@ -4861,9 +4864,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } mtch = idm.findAllIdMatches(pdbfn); } + FileFormatI type=null; if (mtch != null) { - FileFormatI type; try { type = new IdentifyFile().identify(file, protocol); @@ -4879,7 +4882,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } // File wasn't named like one of the sequences or wasn't a PDB // file. - filesnotmatched.add(file); + filesnotmatched.add(new Object[] { file, protocol, type}); } } int assocfiles = 0; @@ -4933,7 +4936,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ for (Object[] o : filesmatched) { - filesnotmatched.add(o[0]); + filesnotmatched.add(new Object[] { o[0], o[1]}); } } } @@ -4955,9 +4958,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { return; } - for (Object fn : filesnotmatched) + for (Object[] fn : filesnotmatched) { - loadJalviewDataFile(fn, null, null, null); + loadJalviewDataFile(fn[0], (DataSourceType) fn[1], (FileFormatI)fn[2], null); } } @@ -5053,7 +5056,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { format = new IdentifyFile().identify(file, sourceType); } - if (FileFormat.ScoreMatrix == format) + if (FileFormat.FeatureSettings == format) + { + if (featureSettings != null) + { + featureSettings.load(file, sourceType); + } + else + { + FeatureSettings.loadFeatureSettingsFile(getFeatureRenderer(), + fileObject, sourceType); + } + } + else if (FileFormat.ScoreMatrix == format) { ScoreMatrixFile sm = new ScoreMatrixFile( new FileParse(file, sourceType)); @@ -5839,6 +5854,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } alignPanel.validateAnnotationDimensions(true); + // TODO this triggers relayout of annotation panel - otherwise annotation label height is different to panel height + alignPanel.fontChanged(); alignPanel.alignmentChanged(); } @@ -5961,12 +5978,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void runGroovy_actionPerformed() { - Jalview.setCurrentAlignFrame(this); - groovy.ui.Console console = Desktop.getGroovyConsole(); + Jalview.getInstance().setCurrentAlignFrame(this); + groovy.console.ui.Console console = Desktop.getGroovyConsole(); if (console != null) { try { + console.setVariable(JalviewObjectI.currentAlFrameName, this); console.runScript(); } catch (Exception ex) {